check shared icon visibility in adapter

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-11-05 16:18:36 +01:00 committed by Alper Öztürk
parent 3ae45b4beb
commit 7a7c12b3df
2 changed files with 14 additions and 0 deletions

View file

@ -39,6 +39,7 @@ import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.model.OfflineOperationType; import com.nextcloud.model.OfflineOperationType;
import com.nextcloud.model.OCFileFilterType; import com.nextcloud.model.OCFileFilterType;
import com.nextcloud.utils.extensions.ViewExtensionsKt; import com.nextcloud.utils.extensions.ViewExtensionsKt;
import com.nextcloud.utils.mdm.MDMConfig;
import com.owncloud.android.MainApp; import com.owncloud.android.MainApp;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.databinding.GridImageBinding; import com.owncloud.android.databinding.GridImageBinding;
@ -458,6 +459,12 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
} }
updateLivePhotoIndicators(gridViewHolder, file); updateLivePhotoIndicators(gridViewHolder, file);
if (!MDMConfig.INSTANCE.shareViaLink(activity) ||
!MDMConfig.INSTANCE.shareViaUser(activity) ||
!MDMConfig.INSTANCE.sendFilesSupport(activity)) {
gridViewHolder.getShared().setVisibility(View.GONE);
}
} }
} }

View file

@ -22,6 +22,7 @@ import com.nextcloud.client.jobs.download.FileDownloadHelper
import com.nextcloud.client.jobs.upload.FileUploadHelper import com.nextcloud.client.jobs.upload.FileUploadHelper
import com.nextcloud.client.preferences.AppPreferences import com.nextcloud.client.preferences.AppPreferences
import com.nextcloud.utils.extensions.createRoundedOutline import com.nextcloud.utils.extensions.createRoundedOutline
import com.nextcloud.utils.mdm.MDMConfig
import com.owncloud.android.R import com.owncloud.android.R
import com.owncloud.android.datamodel.FileDataStorageManager import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile import com.owncloud.android.datamodel.OCFile
@ -368,6 +369,12 @@ class OCFileListDelegate(
private fun showShareIcon(gridViewHolder: ListViewHolder, file: OCFile) { private fun showShareIcon(gridViewHolder: ListViewHolder, file: OCFile) {
val sharedIconView = gridViewHolder.shared val sharedIconView = gridViewHolder.shared
if (!MDMConfig.shareViaLink(context) || !MDMConfig.shareViaUser(context) || !MDMConfig.sendFilesSupport(context)) {
sharedIconView.visibility = View.GONE
return
}
if (gridViewHolder is OCFileListItemViewHolder || file.unreadCommentsCount == 0) { if (gridViewHolder is OCFileListItemViewHolder || file.unreadCommentsCount == 0) {
sharedIconView.visibility = View.VISIBLE sharedIconView.visibility = View.VISIBLE
if (file.isSharedWithSharee || file.isSharedWithMe) { if (file.isSharedWithSharee || file.isSharedWithMe) {