From a049943c1e1f4f1ccc7bfd9eb76b9a2a1d114772 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Sep 2020 21:33:03 +0200 Subject: [PATCH] avoid checking folder visibility twice at fetching --- .../simplemobiletools/gallery/pro/helpers/MediaFetcher.kt | 8 ++------ build.gradle | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index 9e66b62b8..79b9cd186 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -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 + folders.toMutableList() as ArrayList } 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 } diff --git a/build.gradle b/build.gradle index a291777ca..8fd2d51a6 100644 --- a/build.gradle +++ b/build.gradle @@ -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 {