mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
split directories at media fetching into a separate arraylist
This commit is contained in:
parent
2d2f84e956
commit
77f3c3adb6
1 changed files with 16 additions and 3 deletions
|
@ -207,11 +207,24 @@ class MediaFetcher(val context: Context) {
|
||||||
val checkFileExistence = config.fileLoadingPriority == PRIORITY_VALIDITY
|
val checkFileExistence = config.fileLoadingPriority == PRIORITY_VALIDITY
|
||||||
val showHidden = config.shouldShowHidden
|
val showHidden = config.shouldShowHidden
|
||||||
val dateTakens = if (getProperDateTaken && folder != FAVORITES && !isRecycleBin) getFolderDateTakens(folder) else HashMap()
|
val dateTakens = if (getProperDateTaken && folder != FAVORITES && !isRecycleBin) getFolderDateTakens(folder) else HashMap()
|
||||||
|
val subdirs = ArrayList<File>()
|
||||||
|
|
||||||
val files = when (folder) {
|
val files = when (folder) {
|
||||||
FAVORITES -> favoritePaths.filter { showHidden || !it.contains("/.") }.map { File(it) }.toTypedArray()
|
FAVORITES -> favoritePaths.filter { showHidden || !it.contains("/.") }.map { File(it) }.toMutableList() as ArrayList<File>
|
||||||
RECYCLE_BIN -> deletedMedia.map { File(it.path) }.toTypedArray()
|
RECYCLE_BIN -> deletedMedia.map { File(it.path) }.toMutableList() as ArrayList<File>
|
||||||
else -> File(folder).listFiles() ?: return media
|
else -> {
|
||||||
|
val allFiles = File(folder).listFiles() ?: return media
|
||||||
|
val notDirs = ArrayList<File>()
|
||||||
|
allFiles.forEach {
|
||||||
|
if (it.isDirectory) {
|
||||||
|
subdirs.add(it)
|
||||||
|
} else {
|
||||||
|
notDirs.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notDirs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
|
|
Loading…
Reference in a new issue