From 99376a3bb073589c007e9b4a1838bfcc0c98a8c0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 3 Mar 2017 21:46:48 +0100 Subject: [PATCH] hide the subfolders of excluded folders too --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index c2d883404..790214824 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -106,10 +106,12 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va private fun removeExcludedFolders(paths: MutableList) { val excludedPaths = config.excludedFolders - val ignorePaths = paths.filter { excludedPaths.contains(it) } + val ignorePaths = paths.filter { isThisOrParentExcluded(it, excludedPaths) } paths.removeAll(ignorePaths) } + private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet) = excludedPaths.any { path.startsWith(it) } + private fun movePinnedToFront(dirs: ArrayList): ArrayList { val foundFolders = ArrayList() val pinnedFolders = config.pinnedFolders