wip, need clean up

This commit is contained in:
M M Arif
2019-10-03 23:50:57 +05:00
parent 345d577fbf
commit e4ab2f64fc
5 changed files with 115 additions and 6 deletions

View File

@@ -10,11 +10,13 @@ import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
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 org.mian.gitnex.util.TinyDB;
import java.util.ArrayList;
import java.util.List;
@@ -27,8 +29,13 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
private List<Files> filesList;
private Context mCtx;
private List<Files> filesListFull;
public FilesDirsResponse filesDirResponse;
static class FilesViewHolder extends RecyclerView.ViewHolder {
public interface FilesDirsResponse{
void onClickResponse(String str);
}
class FilesViewHolder extends RecyclerView.ViewHolder {
private ImageView fileTypeImage;
private TextView fileName;
@@ -48,6 +55,7 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
public void onClick(View v) {
Context context = v.getContext();
TinyDB tinyDb = new TinyDB(context);
if(fileType.getText().toString().equals("file")) {
Intent intent = new Intent(context, FileViewActivity.class);
@@ -55,7 +63,10 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
context.startActivity(intent);
}
else if(fileType.getText().toString().equals("dir")) {
Toasty.info(context, context.getString(R.string.filesDirNotSupportedYet));
//tinyDb.putString("filesDir", fileName.getText().toString());
if(filesDirResponse!=null)
filesDirResponse.onClickResponse(fileName.getText().toString());
//Toasty.info(context, context.getString(R.string.filesDirNotSupportedYet));
}
else {
Toasty.info(context, context.getString(R.string.filesGenericError));