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 0694bbc53..0ca8e74a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -552,6 +552,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_grid.setDragSelectActive(position) } + override fun recheckPinnedFolders() { + gotDirectories(movePinnedDirectoriesToFront(mDirs), true) + } + private fun checkWhatsNewDialog() { arrayListOf().apply { add(Release(46, R.string.release_46)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index cf0a6fad1..9454f0ca4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -221,7 +221,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList) fun itemLongClicked(position: Int) + + fun recheckPinnedFolders() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index c04c3371e..f7cd61529 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -75,7 +75,11 @@ fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList< val foundFolders = ArrayList() val pinnedFolders = config.pinnedFolders - dirs.forEach { if (pinnedFolders.contains(it.path)) foundFolders.add(it) } + dirs.forEach { + if (pinnedFolders.contains(it.path)) + foundFolders.add(it) + } + dirs.removeAll(foundFolders) dirs.addAll(0, foundFolders) return dirs