diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 2d89a18e7..9927b0799 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -240,6 +240,16 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList(selections.size) val removeDirs = ArrayList(selections.size) + var isShowingPermDialog = false + activity.runOnUiThread { + if (activity.isShowingPermDialog(File(dirs[selections[0]].path))) { + isShowingPermDialog = true + } + } + + if (isShowingPermDialog) + return + selections.reverse() selections.forEach { val directory = dirs[it] @@ -249,6 +259,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList, val files = ArrayList(selections.size) val removeMedia = ArrayList(selections.size) + var isShowingPermDialog = false + activity.runOnUiThread { + if (activity.isShowingPermDialog(File(media[selections[0]].path))) { + isShowingPermDialog = true + } + } + + if (isShowingPermDialog) + return + selections.reverse() selections.forEach { val medium = media[it] @@ -190,6 +200,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } media.removeAll(removeMedia) + markedItems.clear() listener?.deleteFiles(files) }