shouldShowRecommendedFiles

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-12-18 16:34:22 +01:00
parent e605eadae2
commit e4375eb36f
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF

View file

@ -439,9 +439,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
PreviewTextFragment.setText(headerViewHolder.getHeaderText(), text, null, activity, true, true, viewThemeUtils);
headerViewHolder.getHeaderView().setOnClickListener(v -> ocFileListFragmentInterface.onHeaderClicked());
ViewExtensionsKt.setVisibleIf(headerViewHolder.getBinding().recommendedFilesLayout, !recommendedFiles.isEmpty());
ViewExtensionsKt.setVisibleIf(headerViewHolder.getBinding().recommendedFilesLayout, shouldShowRecommendedFiles());
if (!recommendedFiles.isEmpty()) {
if (shouldShowRecommendedFiles()) {
final var recommendedFilesRecyclerView = headerViewHolder.getBinding().recommendedFilesRecyclerView;
final LinearLayoutManager layoutManager = new LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false);
@ -481,6 +481,10 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
}
private boolean shouldShowRecommendedFiles() {
return !recommendedFiles.isEmpty() && currentDirectory.isRootDirectory();
}
private void checkVisibilityOfFileFeaturesLayout(ListViewHolder holder) {
int fileFeaturesVisibility = View.GONE;
LinearLayout fileFeaturesLayout = holder.getFileFeaturesLayout();
@ -781,7 +785,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
return false;
}
if (!recommendedFiles.isEmpty() && currentDirectory.isRootDirectory()) {
if (shouldShowRecommendedFiles()) {
return true;
}