From e243de95d1f8916a63a7bdfecfd4d91f412180c8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 26 Feb 2017 12:10:15 +0100 Subject: [PATCH] hide folders starting with a dot if hidden should be shown --- .../com/simplemobiletools/gallery/extensions/context.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 299d0c90c..ccdad77d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -73,17 +73,22 @@ fun Context.getParents(): ArrayList { if (config.showHiddenFolders) { parents.addAll(getNoMediaFolders()) } else { - removeNoMediaFolders(parents) + removeHiddenFolders(parents) } return parents } -private fun removeNoMediaFolders(paths: MutableList) { +private fun removeHiddenFolders(paths: MutableList) { val ignorePaths = ArrayList() for (path in paths) { val dir = File(path) if (dir.exists() && dir.isDirectory) { + if (dir.name.startsWith(".")) { + ignorePaths.add((path)) + continue + } + val res = dir.list { file, filename -> filename == NOMEDIA } if (res?.isNotEmpty() == true) ignorePaths.add(path)