mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
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:
commit
54672c4d1c
3 changed files with 20 additions and 4 deletions
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue