mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
make sure Favorites folder is not shown twice
This commit is contained in:
parent
40dc05602c
commit
43a6ececba
1 changed files with 5 additions and 0 deletions
|
@ -662,6 +662,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
val favoriteMedia = mediumDao.getFavorites() as ArrayList<Medium>
|
||||
if (favoriteMedia.isNotEmpty()) {
|
||||
// avoid adding Favorites twice
|
||||
val currentFavoriteDir = dirs.firstOrNull { it.areFavorites() }
|
||||
if (currentFavoriteDir != null) {
|
||||
dirs.remove(currentFavoriteDir)
|
||||
}
|
||||
val favorites = createDirectoryFromMedia(FAVORITES, favoriteMedia, albumCovers, hiddenString, includedFolders, isSortingAscending)
|
||||
dirs.add(favorites)
|
||||
showSortedDirs(dirs)
|
||||
|
|
Loading…
Reference in a new issue