use a background thread for deleting stuff

This commit is contained in:
tibbi 2017-01-07 12:06:29 +01:00
parent b6fbe68643
commit de63b61bf6
2 changed files with 9 additions and 3 deletions

View file

@ -160,7 +160,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun askConfirmDelete() {
ConfirmationDialog(this) {
Thread({
deleteFile()
}).start()
}
}

View file

@ -171,7 +171,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
private fun askConfirmDelete() {
ConfirmationDialog(activity) {
actMode?.finish()
Thread({
deleteFiles()
}).start()
}
}
@ -187,8 +189,10 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
val medium = media[it]
files.add(File(medium.path))
removeMedia.add(medium)
activity.runOnUiThread {
notifyItemRemoved(it)
}
}
media.removeAll(removeMedia)
listener?.deleteFiles(files)