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