From df5981f74c7b19dc6724ee9b44cfae1b1b5e0842 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 6 Jan 2017 16:59:29 +0100 Subject: [PATCH] show .nomedia folders if Show hidden folders is checked --- .../asynctasks/GetDirectoriesAsynctask.kt | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) 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 dddbcabab..1019786b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -143,16 +143,19 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va } private fun removeNoMediaFolders(dirs: MutableList) { - 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 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) + } } - } - dirs.removeAll(ignoreDirs) + dirs.removeAll(ignoreDirs) + } } }