mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
hide folders whose parent contains .nomedia when appropriate
This commit is contained in:
parent
b83341c299
commit
f5eb3c931e
1 changed files with 18 additions and 1 deletions
|
@ -74,12 +74,29 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
return if (isThisOrParentExcluded(path, excludedPaths))
|
||||
false
|
||||
else if (!config.shouldShowHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) {
|
||||
!(file.containsNoMedia() || path.contains("/."))
|
||||
var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.")
|
||||
if (!containsNoMediaOrDot) {
|
||||
containsNoMediaOrDot = checkParentHasNoMedia(file.parentFile)
|
||||
}
|
||||
!containsNoMediaOrDot
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkParentHasNoMedia(file: File): Boolean {
|
||||
var curFile = file
|
||||
while (true) {
|
||||
if (curFile.containsNoMedia()) {
|
||||
return true
|
||||
}
|
||||
curFile = curFile.parentFile
|
||||
if (curFile.absolutePath == "/")
|
||||
break
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet<String>) = excludedPaths.any { path.startsWith(it) }
|
||||
|
||||
private fun movePinnedToFront(dirs: ArrayList<Directory>): ArrayList<Directory> {
|
||||
|
|
Loading…
Reference in a new issue