show the current folder as an available option at grouping too, not just subfolders

This commit is contained in:
tibbi 2018-12-15 22:40:15 +01:00
parent ce4dee2573
commit 619e7ee3f4

View file

@ -975,6 +975,16 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
val foldersToShow = getDirectParentSubfolders(dirFolders)
val parentDirs = dirs.filter { foldersToShow.contains(it.path) } as ArrayList<Directory>
updateSubfolderCounts(dirs, parentDirs)
// show the current folder as an available option too, not just subfolders
if (mCurrentPathPrefix.isNotEmpty()) {
val currentFolder = mDirs.firstOrNull { parentDirs.firstOrNull { it.path == mCurrentPathPrefix } == null && it.path == mCurrentPathPrefix }
currentFolder?.apply {
subfoldersCount = 1
parentDirs.add(this)
}
}
parentDirs
} else {
dirs.forEach { it.subfoldersMediaCount = it.mediaCnt }