hide the Favorites folder if all items are hidden and they shouldnt be shown

This commit is contained in:
tibbi 2018-07-01 20:11:07 +02:00
parent f186889a78
commit d78eff3cee
1 changed files with 8 additions and 0 deletions

View File

@ -652,6 +652,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
private fun gotDirectories(newDirs: ArrayList<Directory>) { private fun gotDirectories(newDirs: ArrayList<Directory>) {
// if hidden item showing is disabled but all Favorite items are hidden, hide the Favorites folder
if (!config.shouldShowHidden) {
val favoritesFolder = newDirs.firstOrNull { it.areFavorites() }
if (favoritesFolder != null && favoritesFolder.tmb.getFilenameFromPath().startsWith('.')) {
newDirs.remove(favoritesFolder)
}
}
val dirs = getSortedDirectories(newDirs) val dirs = getSortedDirectories(newDirs)
var isPlaceholderVisible = dirs.isEmpty() var isPlaceholderVisible = dirs.isEmpty()