diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index c55b5837a..e50ee4eea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -662,6 +662,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { val favoriteMedia = mediumDao.getFavorites() as ArrayList 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)