Fix FileFeaturesLayout visibility

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-12-20 15:23:14 +01:00
parent c4aca7c7ce
commit 7d0db80f4d
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
2 changed files with 29 additions and 17 deletions

View file

@ -41,6 +41,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.elyeproj.loaderviewlibrary.LoaderImageView;
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
@ -430,6 +431,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
ocFileListDelegate.bindGridViewHolder(gridViewHolder, file, searchType);
checkVisibilityOfMoreButtons(gridViewHolder);
checkVisibilityOfFileFeaturesLayout(gridViewHolder);
if (holder instanceof ListItemViewHolder) {
bindListItemViewHolder((ListItemViewHolder) gridViewHolder, file);
@ -438,12 +440,31 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
if (holder instanceof ListGridItemViewHolder) {
bindListGridItemViewHolder((ListGridItemViewHolder) holder, file);
checkVisibilityOfMoreButtons((ListGridItemViewHolder) holder);
checkVisibilityOfFileFeaturesLayout((ListGridItemViewHolder) holder);
}
updateLivePhotoIndicators(gridViewHolder, file);
}
}
private void checkVisibilityOfFileFeaturesLayout(ListGridImageViewHolder holder) {
int fileFeaturesVisibility = View.GONE;
LinearLayout fileFeaturesLayout = holder.getFileFeaturesLayout();
if (fileFeaturesLayout == null) {
return;
}
for (int i = 0; i < fileFeaturesLayout.getChildCount(); i++) {
View child = fileFeaturesLayout.getChildAt(i);
if (child.getVisibility() == View.VISIBLE) {
fileFeaturesVisibility = View.VISIBLE;
}
}
fileFeaturesLayout.setVisibility(fileFeaturesVisibility);
}
private void checkVisibilityOfMoreButtons(ListGridImageViewHolder holder) {
ImageButton moreButton = holder.getMore();
if (moreButton == null) {

View file

@ -243,28 +243,19 @@ class OCFileListDelegate(
bindGridMetadataViews(file, gridViewHolder)
// shares
val shouldHideShare = hideItemOptions ||
!file.isFolder && file.isEncrypted ||
file.isEncrypted && !EncryptionUtils.supportsSecureFiledrop(file, user) ||
searchType == SearchType.FAVORITE_SEARCH
val shouldHideShare = (
hideItemOptions ||
!file.isFolder &&
file.isEncrypted ||
file.isEncrypted &&
!EncryptionUtils.supportsSecureFiledrop(file, user) ||
searchType == SearchType.FAVORITE_SEARCH
)
if (shouldHideShare) {
gridViewHolder.shared.visibility = View.GONE
} else {
showShareIcon(gridViewHolder, file)
}
/*
val hideFilesLayout = (hideItemOptions ||
!file.isFolder && file.isEncrypted ||
file.isEncrypted && !EncryptionUtils.supportsSecureFiledrop(file, user) ||
searchType == SearchType.FAVORITE_SEARCH)
if (hideFilesLayout) {
gridViewHolder.fileFeaturesLayout?.let { it.visibility = View.GONE }
} else {
showShareIcon(gridViewHolder, file)
}
*/
}
private fun bindUnreadComments(file: OCFile, gridViewHolder: ListGridImageViewHolder) {