From 164518bb80f5eb7180b61b0dca855997d15877e8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Sep 2020 22:54:22 +0200 Subject: [PATCH] move folder distinction check further --- .../simplemobiletools/gallery/pro/helpers/MediaFetcher.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 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 3a7fcc181..7822da75f 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 @@ -66,7 +66,8 @@ class MediaFetcher(val context: Context) { val shouldShowHidden = config.shouldShowHidden val excludedPaths = config.excludedFolders val includedPaths = config.includedFolders - folders.filter { it.shouldFolderBeVisible(excludedPaths, includedPaths, shouldShowHidden, context) }.toMutableList() as ArrayList + folders.distinctBy { it.getDistinctPath() } + .filter { it.shouldFolderBeVisible(excludedPaths, includedPaths, shouldShowHidden, context) }.toMutableList() as ArrayList } catch (e: Exception) { ArrayList() } @@ -190,7 +191,7 @@ class MediaFetcher(val context: Context) { addFolder(foldersToScan, it) } - return foldersToScan.distinctBy { it.getDistinctPath() }.toMutableSet() as LinkedHashSet + return foldersToScan.toMutableSet() as LinkedHashSet } private fun addFolder(curFolders: HashSet, folder: String) {