click listener checks for file, dir and unknwon files

This commit is contained in:
M M Arif 2019-10-02 23:32:01 +05:00
parent 90df3a31fe
commit 4d998150a3
2 changed files with 15 additions and 4 deletions

View File

@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.FileViewActivity;
import org.mian.gitnex.helpers.Toasty;
import org.mian.gitnex.models.Files;
import java.util.ArrayList;
import java.util.List;
@ -42,15 +43,23 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
//ImageView filesDropdownMenu = itemView.findViewById(R.id.filesDropdownMenu);
itemView.setOnClickListener(new View.OnClickListener() {
fileName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = v.getContext();
Intent intent = new Intent(context, FileViewActivity.class);
intent.putExtra("singleFileName", fileName.getText().toString());
context.startActivity(intent);
if(fileType.getText().toString().equals("file")) {
Intent intent = new Intent(context, FileViewActivity.class);
intent.putExtra("singleFileName", fileName.getText().toString());
context.startActivity(intent);
}
else if(fileType.getText().toString().equals("dir")) {
Toasty.info(context, context.getString(R.string.filesDirNotSupportedYet));
}
else {
Toasty.info(context, context.getString(R.string.filesGenericError));
}
}
});

View File

@ -472,6 +472,8 @@
<!-- files -->
<string name="noDataFilesTab">No files found</string>
<string name="filesDirNotSupportedYet">Directory browsing is not supported yet</string>
<string name="filesGenericError">Sorry this file cannot be viewed as API return an error</string>
<!-- generic copy -->
<string name="okButton">OK</string>