do not show hidden or excluded folders at "Show all folders content" view

This commit is contained in:
tibbi 2017-05-24 20:37:56 +02:00
parent 5c7ede90de
commit 234b2ed933

View file

@ -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
var isExcluded = false
excludedFolders.forEach {
if (path.startsWith(it)) {
isExcluded = true
}
}
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
}