From b4262111d7fbca11309adf9dd9e7f2119b5f453f Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sat, 30 Apr 2022 23:58:21 +0100 Subject: [PATCH] use MediaStore request way of deleting files on SDK 31 - on SDK 31+, if the app can manange media, we want to use the MediaStore request way of deleting files - we use the new method added BaseSimpleActivity.checkManageMediaOrHandleSAFDialogSdk30 that performs the check and determines if we should show the SAF dialog or not --- .../gallery/pro/activities/ViewPagerActivity.kt | 8 ++++---- .../gallery/pro/adapters/MediaAdapter.kt | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index fc3226e6c..3f0e35bba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -1122,9 +1122,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val fileDirItem = FileDirItem(path, path.getFilenameFromPath()) if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { - handleSAFDialogSdk30(fileDirItem.path) { + checkManageMediaOrHandleSAFDialogSdk30(fileDirItem.path) { if (!it) { - return@handleSAFDialogSdk30 + return@checkManageMediaOrHandleSAFDialogSdk30 } mIgnoredPaths.add(fileDirItem.path) @@ -1150,9 +1150,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun handleDeletion(fileDirItem: FileDirItem) { - handleSAFDialogSdk30(fileDirItem.path) { + checkManageMediaOrHandleSAFDialogSdk30(fileDirItem.path) { if (!it) { - return@handleSAFDialogSdk30 + return@checkManageMediaOrHandleSAFDialogSdk30 } mIgnoredPaths.add(fileDirItem.path) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 97275a268..eebb97e76 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -491,9 +491,9 @@ class MediaAdapter( } val sdk30SafPath = selectedPaths.firstOrNull { activity.isAccessibleWithSAFSdk30(it) } ?: getFirstSelectedItemPath() ?: return@handleSAFDialog - activity.handleSAFDialogSdk30(sdk30SafPath) { + activity.checkManageMediaOrHandleSAFDialogSdk30(sdk30SafPath) { if (!it) { - return@handleSAFDialogSdk30 + return@checkManageMediaOrHandleSAFDialogSdk30 } val fileDirItems = ArrayList(selectedKeys.size)