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 size: Long
var isImage: Boolean var isImage: Boolean
var isVideo: Boolean var isVideo: Boolean
val excludedFolders = config.excludedFolders
do { do {
try { try {
@ -102,11 +102,23 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo
if (!showHidden && filename.startsWith('.')) if (!showHidden && filename.startsWith('.'))
continue continue
dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) var isExcluded = false
dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L excludedFolders.forEach {
if (path.startsWith(it)) {
isExcluded = true
}
}
val medium = Medium(filename, path, isVideo, dateModified, dateTaken, size) if (!showHidden && path.contains("/."))
curMedia.add(medium) 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) { } catch (e: Exception) {
continue continue
} }