avoid checking folder visibility twice at fetching
This commit is contained in:
parent
7e69c392a4
commit
a049943c1e
|
@ -61,12 +61,7 @@ class MediaFetcher(val context: Context) {
|
||||||
val selectionArgs = getSelectionArgsQuery(filterMedia).toTypedArray()
|
val selectionArgs = getSelectionArgsQuery(filterMedia).toTypedArray()
|
||||||
val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
|
val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
|
||||||
folders.addAll(parseCursor(cursor!!))
|
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) {
|
} catch (e: Exception) {
|
||||||
ArrayList()
|
ArrayList()
|
||||||
}
|
}
|
||||||
|
@ -192,6 +187,7 @@ class MediaFetcher(val context: Context) {
|
||||||
|
|
||||||
val showHidden = config.shouldShowHidden
|
val showHidden = config.shouldShowHidden
|
||||||
val excludedFolders = config.excludedFolders
|
val excludedFolders = config.excludedFolders
|
||||||
|
|
||||||
return foldersToScan.distinctBy { it.getDistinctPath() }
|
return foldersToScan.distinctBy { it.getDistinctPath() }
|
||||||
.filter { it.shouldFolderBeVisible(excludedFolders, includedFolders, showHidden, context) }.toMutableSet() as LinkedHashSet<String>
|
.filter { it.shouldFolderBeVisible(excludedFolders, includedFolders, showHidden, context) }.toMutableSet() as LinkedHashSet<String>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.72'
|
ext.kotlin_version = '1.4.0'
|
||||||
ext.is_proprietary = gradle.startParameter.taskNames.any { task -> task.contains("Proprietary") }
|
ext.is_proprietary = gradle.startParameter.taskNames.any { task -> task.contains("Proprietary") }
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Loading…
Reference in New Issue