filter wrong directories sooner

This commit is contained in:
tibbi 2017-02-26 12:26:32 +01:00
parent e243de95d1
commit ad8cd557ce
2 changed files with 19 additions and 22 deletions

View file

@ -25,9 +25,7 @@ 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()
val filenames = File(it).list()
if (filenames?.size ?: 0 > 0) {
for (filename in filenames) {
val isImage = filename.isImageFast() || filename.isGif()
@ -53,7 +51,6 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
}
}
}
}
Medium.sorting = fileSorting
media.sort()

View file

@ -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())