hide the subfolders of excluded folders too

This commit is contained in:
tibbi 2017-03-03 21:46:48 +01:00
parent 5064ca612f
commit 99376a3bb0
1 changed files with 3 additions and 1 deletions

View File

@ -106,10 +106,12 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
private fun removeExcludedFolders(paths: MutableList<String>) { private fun removeExcludedFolders(paths: MutableList<String>) {
val excludedPaths = config.excludedFolders val excludedPaths = config.excludedFolders
val ignorePaths = paths.filter { excludedPaths.contains(it) } val ignorePaths = paths.filter { isThisOrParentExcluded(it, excludedPaths) }
paths.removeAll(ignorePaths) paths.removeAll(ignorePaths)
} }
private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet<String>) = excludedPaths.any { path.startsWith(it) }
private fun movePinnedToFront(dirs: ArrayList<Directory>): ArrayList<Directory> { private fun movePinnedToFront(dirs: ArrayList<Directory>): ArrayList<Directory> {
val foundFolders = ArrayList<Directory>() val foundFolders = ArrayList<Directory>()
val pinnedFolders = config.pinnedFolders val pinnedFolders = config.pinnedFolders