move the single folder visibility check a bit further in the process

This commit is contained in:
tibbi 2020-09-09 22:07:39 +02:00
parent 6d059ad426
commit f38981be7b

View file

@ -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<String>
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<String>
} 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<String>
return foldersToScan.distinctBy { it.getDistinctPath() }.toMutableSet() as LinkedHashSet<String>
}
private fun addFolder(curFolders: HashSet<String>, folder: String) {