diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 8f991c375..1b406663c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -130,10 +130,10 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va } private fun filterDirectories(dirs: MutableList) { - if (!mConfig.showHiddenFolders) + if (!mConfig.showHiddenFolders) { removeHiddenFolders(dirs) - - removeNoMediaFolders(dirs) + removeNoMediaFolders(dirs) + } } private fun removeHiddenFolders(dirs: MutableList) { @@ -143,19 +143,16 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va } private fun removeNoMediaFolders(dirs: MutableList) { - val showHiddenFolders = mConfig.showHiddenFolders - if (!showHiddenFolders) { - val ignoreDirs = ArrayList() - 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 ignoreDirs = ArrayList() + 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) } }