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 f89422816..c314944c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -172,8 +172,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun notifyDeletion(cnt: Int) { - getDirectories() - val res = resources val msg = res.getQuantityString(R.plurals.folders_deleted, cnt, cnt) mSnackbar = Snackbar.make(coordinator_layout, msg, Snackbar.LENGTH_INDEFINITE) 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 416bf3460..9ed687877 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -242,7 +242,17 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList(selections.size) - selections.forEach { paths.add(dirs[it].path) } + val removeDirs = ArrayList(selections.size) + + selections.reverse() + selections.forEach { + val directory = dirs[it] + paths.add(directory.path) + removeDirs.add(directory) + notifyItemRemoved(it) + } + + dirs.removeAll(removeDirs) listener?.prepareForDeleting(paths) }