mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
filter wrong directories sooner
This commit is contained in:
parent
e243de95d1
commit
ad8cd557ce
2 changed files with 19 additions and 22 deletions
|
@ -25,32 +25,29 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
val parents = context.getParents()
|
||||
|
||||
parents.forEach {
|
||||
val dir = File(it)
|
||||
if (dir.isDirectory) {
|
||||
val filenames = dir.list()
|
||||
if (filenames?.size ?: 0 > 0) {
|
||||
for (filename in filenames) {
|
||||
val isImage = filename.isImageFast() || filename.isGif()
|
||||
val isVideo = if (isImage) false else filename.isVideoFast()
|
||||
val filenames = File(it).list()
|
||||
if (filenames?.size ?: 0 > 0) {
|
||||
for (filename in filenames) {
|
||||
val isImage = filename.isImageFast() || filename.isGif()
|
||||
val isVideo = if (isImage) false else filename.isVideoFast()
|
||||
|
||||
if (!isImage && !isVideo)
|
||||
continue
|
||||
if (!isImage && !isVideo)
|
||||
continue
|
||||
|
||||
if (isVideo && (isPickImage || showMedia == IMAGES))
|
||||
continue
|
||||
if (isVideo && (isPickImage || showMedia == IMAGES))
|
||||
continue
|
||||
|
||||
if (isImage && (isPickVideo || showMedia == VIDEOS))
|
||||
continue
|
||||
if (isImage && (isPickVideo || showMedia == VIDEOS))
|
||||
continue
|
||||
|
||||
val file = File(it, filename)
|
||||
val size = file.length()
|
||||
if (size == 0L)
|
||||
continue
|
||||
val file = File(it, filename)
|
||||
val size = file.length()
|
||||
if (size == 0L)
|
||||
continue
|
||||
|
||||
val dateModified = file.lastModified()
|
||||
val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateModified, size)
|
||||
media.add(medium)
|
||||
}
|
||||
val dateModified = file.lastModified()
|
||||
val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateModified, size)
|
||||
media.add(medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ fun Context.getParents(): ArrayList<String> {
|
|||
}
|
||||
|
||||
val parents = ArrayList<String>()
|
||||
parentsSet.mapTo(parents, { it })
|
||||
parentsSet.filterTo(parents, { File(it).isDirectory })
|
||||
|
||||
if (config.showHiddenFolders) {
|
||||
parents.addAll(getNoMediaFolders())
|
||||
|
|
Loading…
Reference in a new issue