diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 0412fd4ba..9d4201e3a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -620,12 +620,14 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag } if (config.filterMedia and TYPE_PORTRAITS != 0) { + val foldersToAdd = ArrayList() for (folder in foldersToScan) { val allFiles = File(folder).listFiles() ?: continue allFiles.filter { it.isDirectory && it.name.startsWith("img_", true) }.forEach { - foldersToScan.add(it.absolutePath) + foldersToAdd.add(it.absolutePath) } } + foldersToScan.addAll(foldersToAdd) } val shouldShowHidden = config.shouldShowHidden