diff --git a/app/build.gradle b/app/build.gradle index afe542fb9..ffb128e41 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.18.14' + implementation 'com.simplemobiletools:commons:3.18.17' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.3' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 3347415ee..e9d25e99e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -6,10 +6,10 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.SORT_DESCENDING +import com.simplemobiletools.commons.helpers.sumByLong import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.checkAppendingHidden import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.sumByLong import com.simplemobiletools.gallery.helpers.MediaFetcher import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/ArrayList.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/ArrayList.kt deleted file mode 100644 index 8d5d3ad27..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/ArrayList.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.simplemobiletools.gallery.extensions - -import java.util.* - -fun ArrayList.sumByLong(selector: (E) -> Long) = map { selector(it) }.sum() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 7c111db4b..c1887ed1b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -12,8 +12,6 @@ import java.io.File import java.util.LinkedHashMap import kotlin.collections.ArrayList import kotlin.collections.HashSet -import kotlin.collections.component1 -import kotlin.collections.component2 import kotlin.collections.set class MediaFetcher(val context: Context) { @@ -21,25 +19,7 @@ class MediaFetcher(val context: Context) { fun getMediaByDirectories(isPickVideo: Boolean, isPickImage: Boolean): HashMap> { val media = getFilesFrom("", isPickImage, isPickVideo) - val excludedPaths = context.config.excludedFolders - val includedPaths = context.config.includedFolders - val showHidden = context.config.shouldShowHidden - val directories = groupDirectories(media) - - val removePaths = ArrayList() - for ((path, curMedia) in directories) { - // make sure the path has uppercase letters wherever appropriate - val groupPath = File(curMedia.first().path).parent - if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths, showHidden)) { - removePaths.add(groupPath.toLowerCase()) - } - } - - removePaths.forEach { - directories.remove(it) - } - - return directories + return groupDirectories(media) } fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList {