show .nomedia folders if appropriate
This commit is contained in:
parent
75c209eb48
commit
387c063376
|
@ -28,7 +28,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
||||||
val media = context.getFilesFrom("", isPickImage, isPickVideo)
|
val media = context.getFilesFrom("", isPickImage, isPickVideo)
|
||||||
val excludedPaths = config.excludedFolders
|
val excludedPaths = config.excludedFolders
|
||||||
val directories = groupDirectories(media)
|
val directories = groupDirectories(media)
|
||||||
val dirs = ArrayList(directories.values.filter { File(it.path).exists() }).filter { !isThisOrParentExcluded(it.path, excludedPaths) } as ArrayList<Directory>
|
val dirs = ArrayList(directories.values.filter { File(it.path).exists() }).filter { !shouldFolderBeVisible(it.path, excludedPaths) } as ArrayList<Directory>
|
||||||
Directory.sorting = config.directorySorting
|
Directory.sorting = config.directorySorting
|
||||||
dirs.sort()
|
dirs.sort()
|
||||||
return movePinnedToFront(dirs)
|
return movePinnedToFront(dirs)
|
||||||
|
@ -69,6 +69,10 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
||||||
return directories
|
return directories
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet<String>): Boolean {
|
||||||
|
return isThisOrParentExcluded(path, excludedPaths) || (!config.shouldShowHidden && File(path).containsNoMedia())
|
||||||
|
}
|
||||||
|
|
||||||
private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet<String>) = excludedPaths.any { path.startsWith(it) }
|
private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet<String>) = excludedPaths.any { path.startsWith(it) }
|
||||||
|
|
||||||
private fun movePinnedToFront(dirs: ArrayList<Directory>): ArrayList<Directory> {
|
private fun movePinnedToFront(dirs: ArrayList<Directory>): ArrayList<Directory> {
|
||||||
|
|
Loading…
Reference in New Issue