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

View file

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