show .nomedia folders if Show hidden folders is checked

This commit is contained in:
tibbi 2017-01-06 16:59:29 +01:00
parent ccf71496e2
commit df5981f74c
1 changed files with 12 additions and 9 deletions

View File

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