From 234b2ed933c53bd346e122e06002893c409dff8b Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 24 May 2017 20:37:56 +0200 Subject: [PATCH] do not show hidden or excluded folders at "Show all folders content" view --- .../gallery/extensions/context.kt | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 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 4840fb9e3..5c53f6d25 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -69,7 +69,7 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo var size: Long var isImage: Boolean var isVideo: Boolean - + val excludedFolders = config.excludedFolders do { try { @@ -102,11 +102,23 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo if (!showHidden && filename.startsWith('.')) continue - dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) - dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L + var isExcluded = false + excludedFolders.forEach { + if (path.startsWith(it)) { + isExcluded = true + } + } - val medium = Medium(filename, path, isVideo, dateModified, dateTaken, size) - curMedia.add(medium) + if (!showHidden && path.contains("/.")) + isExcluded = true + + if (!isExcluded) { + dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) + dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L + + val medium = Medium(filename, path, isVideo, dateModified, dateTaken, size) + curMedia.add(medium) + } } catch (e: Exception) { continue }