small get directories style tweak

This commit is contained in:
tibbi 2017-01-07 16:10:38 +01:00
parent 0efdb071cc
commit 926a45c72e

View file

@ -130,10 +130,10 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
} }
private fun filterDirectories(dirs: MutableList<Directory>) { private fun filterDirectories(dirs: MutableList<Directory>) {
if (!mConfig.showHiddenFolders) if (!mConfig.showHiddenFolders) {
removeHiddenFolders(dirs) removeHiddenFolders(dirs)
removeNoMediaFolders(dirs)
removeNoMediaFolders(dirs) }
} }
private fun removeHiddenFolders(dirs: MutableList<Directory>) { private fun removeHiddenFolders(dirs: MutableList<Directory>) {
@ -143,19 +143,16 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
} }
private fun removeNoMediaFolders(dirs: MutableList<Directory>) { private fun removeNoMediaFolders(dirs: MutableList<Directory>) {
val showHiddenFolders = mConfig.showHiddenFolders val ignoreDirs = ArrayList<Directory>()
if (!showHiddenFolders) { for (d in dirs) {
val ignoreDirs = ArrayList<Directory>() val dir = File(d.path)
for (d in dirs) { if (dir.exists() && dir.isDirectory) {
val dir = File(d.path) val res = dir.list { file, filename -> filename == ".nomedia" }
if (dir.exists() && dir.isDirectory) { if (res?.isNotEmpty() == true)
val res = dir.list { file, filename -> filename == ".nomedia" } ignoreDirs.add(d)
if (res?.isNotEmpty() == true)
ignoreDirs.add(d)
}
} }
dirs.removeAll(ignoreDirs)
} }
dirs.removeAll(ignoreDirs)
} }
} }