From 54f7b18e030693379995e82c534fee7ea9f7d1e5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 30 Nov 2018 22:46:19 +0100 Subject: [PATCH] use a copy of Dirs arraylist before updating the directories adapter --- .../gallery/pro/activities/MainActivity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 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 ee9920b88..8e628723f 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 @@ -928,15 +928,15 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } private fun showSortedDirs(dirs: ArrayList) { - val updatedDirs = getUniqueSortedDirs(dirs) + val updatedDirs = getUniqueSortedDirs(dirs).toMutableList() as ArrayList runOnUiThread { (directories_grid.adapter as? DirectoryAdapter)?.updateDirs(updatedDirs) } } private fun getUniqueSortedDirs(dirs: ArrayList): ArrayList { - val sortedDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList - return getSortedDirectories(sortedDirs) + val distinctDirs = dirs.distinctBy { it.path.getDistinctPath() } as ArrayList + return getSortedDirectories(distinctDirs) } private fun createDirectoryFromMedia(path: String, curMedia: ArrayList, albumCovers: ArrayList, hiddenString: String,