From 32012061a65a9c059e2e181359126210d3eb1f81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 13 Dec 2018 16:34:41 +0100 Subject: [PATCH] remove another redundant function for getting unique directories --- .../gallery/pro/activities/MainActivity.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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