use of com.genonbeta.TrebleShot.adapter.FileListAdapter in project TrebleShot by genonbeta.
the class FileListFragment method onAdapter.
@Override
public FileListAdapter onAdapter() {
return new FileListAdapter(getActivity(), new AccessDatabase(getActivity())) {
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
holder.getView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FileListAdapter.GenericFileHolder fileInfo = getAdapter().getItem(holder);
if (mFileClickedListener == null || !mFileClickedListener.onFileClicked(fileInfo)) {
if (fileInfo instanceof FileListAdapter.FileHolder)
performLayoutClick(v, holder);
else if (fileInfo instanceof FileListAdapter.DirectoryHolder || fileInfo instanceof FileListAdapter.WritablePathHolder) {
FileListFragment.this.goPath(fileInfo.file);
if (isSelectionActivated() && !PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("helpFolderSelection", false))
createSnackbar(R.string.mesg_helpFolderSelection).setAction(R.string.butn_gotIt, new View.OnClickListener() {
@Override
public void onClick(View v) {
PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean("helpFolderSelection", true).apply();
}
}).show();
}
}
}
});
}
};
}
Aggregations