Merge pull request #10036 from nextcloud/fix/hide-sharing-favorites

Don't try to show share information in Favorites screen
This commit is contained in:
Álvaro Brey 2022-06-23 12:14:35 +02:00 committed by GitHub
commit 54672c4d1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 4 deletions

View file

@ -39,6 +39,7 @@ import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.GalleryItems
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.activity.ComponentsGetter
import com.owncloud.android.ui.fragment.SearchType
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.FileSortOrder
@ -110,7 +111,11 @@ class GalleryAdapter(
val itemViewHolder = holder as GalleryItemViewHolder
val ocFile = files[section].files[relativePosition]
ocFileListDelegate.bindGridViewHolder(itemViewHolder, ocFile)
ocFileListDelegate.bindGridViewHolder(
itemViewHolder,
ocFile,
SearchType.GALLERY_SEARCH
)
}
}

View file

@ -128,6 +128,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
private final ThemeColorUtils themeColorUtils;
private final ThemeDrawableUtils themeDrawableUtils;
private final ThemeAvatarUtils themeAvatarUtils;
private SearchType searchType;
public OCFileListAdapter(
Activity activity,
@ -376,7 +377,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
return;
}
ocFileListDelegate.bindGridViewHolder(gridViewHolder, file);
ocFileListDelegate.bindGridViewHolder(gridViewHolder, file, searchType);
if (holder instanceof ListItemViewHolder) {
bindListItemViewHolder((ListItemViewHolder) gridViewHolder, file);
@ -639,6 +640,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
mFilesAll.clear();
}
searchType = null;
notifyDataSetChanged();
}
@ -701,6 +704,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
mFiles = sortOrder.sortCloudFiles(mFiles);
}
this.searchType = searchType;
mFilesAll.clear();
mFilesAll.addAll(mFiles);

View file

@ -31,6 +31,7 @@ import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.datamodel.ThumbnailsCacheManager.ThumbnailGenerationTask
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.ui.activity.ComponentsGetter
import com.owncloud.android.ui.fragment.SearchType
import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.theme.ThemeColorUtils
@ -88,7 +89,11 @@ class OCFileListDelegate(
checkedFiles.clear()
}
fun bindGridViewHolder(gridViewHolder: ListGridImageViewHolder, file: OCFile) {
fun bindGridViewHolder(
gridViewHolder: ListGridImageViewHolder,
file: OCFile,
searchType: SearchType?
) {
// thumbnail
gridViewHolder.thumbnail.tag = file.fileId
DisplayUtils.setThumbnail(
@ -124,7 +129,8 @@ class OCFileListDelegate(
bindGridMetadataViews(file, gridViewHolder)
// shares
val shouldHideShare = gridView || hideItemOptions || file.isFolder && !file.canReshare()
val shouldHideShare = gridView || hideItemOptions || file.isFolder && !file.canReshare() ||
searchType == SearchType.FAVORITE_SEARCH
if (shouldHideShare) {
gridViewHolder.shared.visibility = View.GONE
} else {