From f38981be7bf0bc2f107e69520c24db5807b2800c Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Sep 2020 22:07:39 +0200 Subject: [PATCH] move the single folder visibility check a bit further in the process --- .../gallery/pro/helpers/MediaFetcher.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index 79b9cd186..3a7fcc181 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -61,7 +61,12 @@ class MediaFetcher(val context: Context) { val selectionArgs = getSelectionArgsQuery(filterMedia).toTypedArray() val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null) folders.addAll(parseCursor(cursor!!)) - folders.toMutableList() as ArrayList + + val config = context.config + val shouldShowHidden = config.shouldShowHidden + val excludedPaths = config.excludedFolders + val includedPaths = config.includedFolders + folders.filter { it.shouldFolderBeVisible(excludedPaths, includedPaths, shouldShowHidden, context) }.toMutableList() as ArrayList } catch (e: Exception) { ArrayList() } @@ -185,11 +190,7 @@ class MediaFetcher(val context: Context) { addFolder(foldersToScan, it) } - val showHidden = config.shouldShowHidden - val excludedFolders = config.excludedFolders - - return foldersToScan.distinctBy { it.getDistinctPath() } - .filter { it.shouldFolderBeVisible(excludedFolders, includedFolders, showHidden, context) }.toMutableSet() as LinkedHashSet + return foldersToScan.distinctBy { it.getDistinctPath() }.toMutableSet() as LinkedHashSet } private fun addFolder(curFolders: HashSet, folder: String) {