speed up cached folder fetching by not checking .nomedia multiple times

This commit is contained in:
tibbi 2021-01-13 21:02:06 +01:00
parent c07427c8c2
commit 7957f28b97
1 changed files with 8 additions and 1 deletions

View File

@ -576,7 +576,14 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly:
val hiddenString = resources.getString(R.string.hidden)
filteredDirectories.forEach {
it.name = if (it.path.doesThisOrParentHaveNoMedia(noMediaFolders) && !it.path.isThisOrParentIncluded(includedPaths)) {
val noMediaPath = "${it.path}/.nomedia"
val hasNoMedia = if (folderNoMediaStatuses.keys.contains(noMediaPath)) {
folderNoMediaStatuses[noMediaPath]!!
} else {
it.path.doesThisOrParentHaveNoMedia(noMediaFolders)
}
it.name = if (hasNoMedia && !it.path.isThisOrParentIncluded(includedPaths)) {
"${it.name.removeSuffix(hiddenString).trim()} $hiddenString"
} else {
it.name.removeSuffix(hiddenString).trim()