diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 57cfcba2d..3b843fe28 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -160,7 +160,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun askConfirmDelete() { ConfirmationDialog(this) { - deleteFile() + Thread({ + deleteFile() + }).start() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index d0b5059b8..58e989713 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -171,7 +171,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private fun askConfirmDelete() { ConfirmationDialog(activity) { actMode?.finish() - deleteFiles() + Thread({ + deleteFiles() + }).start() } } @@ -187,7 +189,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val medium = media[it] files.add(File(medium.path)) removeMedia.add(medium) - notifyItemRemoved(it) + activity.runOnUiThread { + notifyItemRemoved(it) + } } media.removeAll(removeMedia)