From 66cd5dad3ee34eaa79f3701411eea8f5308af668 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 17 Oct 2018 11:57:04 +0200 Subject: [PATCH] make sure the directories and distinct before sorting --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 280f51940..6a4dc9887 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -833,8 +833,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } private fun showSortedDirs(dirs: ArrayList) { - var sortedDirs = getSortedDirectories(dirs) - sortedDirs = sortedDirs.distinctBy { it.path.getDistinctPath() } as ArrayList + var sortedDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList + sortedDirs = getSortedDirectories(sortedDirs) runOnUiThread { (directories_grid.adapter as? DirectoryAdapter)?.updateDirs(sortedDirs)