filter cached media by type too
This commit is contained in:
parent
a90f48889d
commit
8af103d98c
2 changed files with 8 additions and 2 deletions
|
@ -263,6 +263,14 @@ fun Context.getCachedMedia(path: String, callback: (ArrayList<Medium>) -> Unit)
|
||||||
if (!shouldShowHidden) {
|
if (!shouldShowHidden) {
|
||||||
filteredMedia = media.filter { !it.name.startsWith('.') } as ArrayList<Medium>
|
filteredMedia = media.filter { !it.name.startsWith('.') } as ArrayList<Medium>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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<Medium>
|
||||||
|
|
||||||
callback(filteredMedia)
|
callback(filteredMedia)
|
||||||
|
|
||||||
media.filter { !File(it.path).exists() }.forEach {
|
media.filter { !File(it.path).exists() }.forEach {
|
||||||
|
|
|
@ -167,7 +167,6 @@ class MediaFetcher(val context: Context) {
|
||||||
|
|
||||||
private fun groupDirectories(media: ArrayList<Medium>): HashMap<String, ArrayList<Medium>> {
|
private fun groupDirectories(media: ArrayList<Medium>): HashMap<String, ArrayList<Medium>> {
|
||||||
val directories = LinkedHashMap<String, ArrayList<Medium>>()
|
val directories = LinkedHashMap<String, ArrayList<Medium>>()
|
||||||
val hasOTG = context.hasOTGConnected() && context.config.OTGBasePath.isNotEmpty()
|
|
||||||
for (medium in media) {
|
for (medium in media) {
|
||||||
if (shouldStop) {
|
if (shouldStop) {
|
||||||
break
|
break
|
||||||
|
@ -226,7 +225,6 @@ class MediaFetcher(val context: Context) {
|
||||||
else -> TYPE_GIF
|
else -> TYPE_GIF
|
||||||
}
|
}
|
||||||
|
|
||||||
val parentPath = file.absolutePath.removeSuffix("/")
|
|
||||||
val medium = Medium(null, filename, file.absolutePath, folder, dateModified, dateTaken, size, type)
|
val medium = Medium(null, filename, file.absolutePath, folder, dateModified, dateTaken, size, type)
|
||||||
curMedia.add(medium)
|
curMedia.add(medium)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue