From e095ee7421edba30c51a947ecee6f419cb8ce6ad Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 Sep 2019 21:07:53 +0200 Subject: [PATCH] fix #1552, fixing a glitch related to removing multiple folders at once --- .../gallery/pro/adapters/DirectoryAdapter.kt | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 94ce790ae..dafd0cc89 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -218,47 +218,50 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList - if (success) { - hideFolder(path) - } - } - } else { - config.wasHideFolderTooltipShown = true - ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) { - activity.handleLockedFolderOpening(path) { success -> - if (success) { - hideFolder(path) + activity.handleLockedFolderOpening(path) { success -> + if (success) { + if (path.containsNoMedia()) { + activity.removeNoMedia(path) { + if (activity.config.shouldShowHidden) { + updateFolderNames() + } else { + activity.runOnUiThread { + listener?.refreshItems() + finishActMode() + } } } + } else { + config.addIncludedFolder(path) + activity.runOnUiThread { + listener?.refreshItems() + finishActMode() + } } } - } else { - activity.handleLockedFolderOpening(path) { success -> - if (success) { - if (path.containsNoMedia()) { - activity.removeNoMedia(path) { - if (activity.config.shouldShowHidden) { - updateFolderNames() - } else { - activity.runOnUiThread { - listener?.refreshItems() - finishActMode() - } - } - } - } else { - config.addIncludedFolder(path) - activity.runOnUiThread { - listener?.refreshItems() - finishActMode() - } - } - } + } + } + } + + private fun hideFolders(paths: ArrayList) { + for (path in paths) { + activity.handleLockedFolderOpening(path) { success -> + if (success) { + hideFolder(path) } } }