From f49348d86d1124637711ac60c6915fbd5180881c Mon Sep 17 00:00:00 2001 From: Naveen Date: Sun, 12 Mar 2023 21:49:04 +0530 Subject: [PATCH] Rescan path after deleting `.nomedia` --- .../gallery/pro/extensions/Activity.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 450cc43a9..fe096ba67 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -253,8 +253,15 @@ fun BaseSimpleActivity.removeNoMedia(path: String, callback: (() -> Unit)? = nul tryDeleteFileDirItem(file.toFileDirItem(applicationContext), false, false) { callback?.invoke() - deleteFromMediaStore(file.absolutePath) - rescanFolderMedia(path) + deleteFromMediaStore(file.absolutePath) { needsRescan -> + if (needsRescan) { + rescanAndDeletePath(path) { + rescanFolderMedia(path) + } + } else { + rescanFolderMedia(path) + } + } } }