diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index 906c0f026..bbc9f8129 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -263,6 +263,14 @@ fun Context.getCachedMedia(path: String, callback: (ArrayList) -> Unit) if (!shouldShowHidden) { filteredMedia = media.filter { !it.name.startsWith('.') } as ArrayList } + + val filterMedia = config.filterMedia + filteredMedia = filteredMedia.filter { + (filterMedia and IMAGES != 0 && it.type == TYPE_IMAGE) || + (filterMedia and VIDEOS != 0 && it.type == TYPE_VIDEO) || + (filterMedia and GIFS != 0 && it.type == TYPE_GIF) + } as ArrayList + callback(filteredMedia) media.filter { !File(it.path).exists() }.forEach { 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 ccb160104..2068d35c0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -167,7 +167,6 @@ class MediaFetcher(val context: Context) { private fun groupDirectories(media: ArrayList): HashMap> { val directories = LinkedHashMap>() - val hasOTG = context.hasOTGConnected() && context.config.OTGBasePath.isNotEmpty() for (medium in media) { if (shouldStop) { break @@ -226,7 +225,6 @@ class MediaFetcher(val context: Context) { else -> TYPE_GIF } - val parentPath = file.absolutePath.removeSuffix("/") val medium = Medium(null, filename, file.absolutePath, folder, dateModified, dateTaken, size, type) curMedia.add(medium) }