avoid checking folder visibility twice at fetching

This commit is contained in:
tibbi 2020-09-09 21:33:03 +02:00
parent 7e69c392a4
commit a049943c1e
2 changed files with 3 additions and 7 deletions

View File

@ -61,12 +61,7 @@ class MediaFetcher(val context: Context) {
val selectionArgs = getSelectionArgsQuery(filterMedia).toTypedArray()
val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
folders.addAll(parseCursor(cursor!!))
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>
folders.toMutableList() as ArrayList<String>
} catch (e: Exception) {
ArrayList()
}
@ -192,6 +187,7 @@ class MediaFetcher(val context: Context) {
val showHidden = config.shouldShowHidden
val excludedFolders = config.excludedFolders
return foldersToScan.distinctBy { it.getDistinctPath() }
.filter { it.shouldFolderBeVisible(excludedFolders, includedFolders, showHidden, context) }.toMutableSet() as LinkedHashSet<String>
}

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.4.0'
ext.is_proprietary = gradle.startParameter.taskNames.any { task -> task.contains("Proprietary") }
repositories {