mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
tweaking the getdirectories asynctask
This commit is contained in:
parent
b778e60781
commit
aab55cef62
1 changed files with 22 additions and 20 deletions
|
@ -28,31 +28,33 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
val fileSorting = config.fileSorting
|
||||
val parents = context.getParents()
|
||||
|
||||
parents.map {
|
||||
val paths = File(it).list()
|
||||
if (paths?.size ?: 0 > 0) {
|
||||
for (path in paths) {
|
||||
val isImage = path.isGif() or path.isImageFast()
|
||||
val isVideo = if (isImage) false else path.isVideoFast()
|
||||
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()
|
||||
|
||||
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, path)
|
||||
val size = file.length()
|
||||
if (size == 0L)
|
||||
continue
|
||||
val file = File(it, filename)
|
||||
val size = file.length()
|
||||
if (size == 0L)
|
||||
continue
|
||||
|
||||
val name = file.name
|
||||
val dateModified = file.lastModified()
|
||||
val medium = Medium(name, file.absolutePath, false, dateModified, dateModified, size)
|
||||
media.add(medium)
|
||||
val dateModified = file.lastModified()
|
||||
val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateModified, size)
|
||||
media.add(medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue