diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index b7bdd5d4d..d09dfbcea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -962,11 +962,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } - private fun getUniqueSortedDirs(dirs: ArrayList): ArrayList { - val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList - return getSortedDirectories(distinctDirs) - } - private fun createDirectoryFromMedia(path: String, curMedia: ArrayList, albumCovers: ArrayList, hiddenString: String, includedFolders: MutableSet, isSortingAscending: Boolean): Directory { var thumbnail = curMedia.firstOrNull { getDoesFilePathExist(it.path) }?.path ?: "" @@ -997,8 +992,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun setupAdapter(dirs: ArrayList, textToSearch: String = "") { val currAdapter = directories_grid.adapter - val updatedDirs = getUniqueSortedDirs(dirs).toMutableList() as ArrayList - var dirsToShow = getDirsToShow(updatedDirs).clone() as ArrayList + val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() }.toMutableList() as ArrayList + val sortedDirs = getSortedDirectories(distinctDirs) + var dirsToShow = getDirsToShow(sortedDirs).clone() as ArrayList + if (currAdapter == null) { initZoomListener() val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller