delete images on a background thread from viewpager too

This commit is contained in:
tibbi 2017-02-09 21:57:21 +01:00
parent 58ace8e59f
commit 0e541f091c

View file

@ -241,11 +241,16 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
// double check we have the uri to the proper file path, not some parent folder // double check we have the uri to the proper file path, not some parent folder
val uri = URLDecoder.decode(document.uri.toString(), "UTF-8") val uri = URLDecoder.decode(document.uri.toString(), "UTF-8")
if (uri.endsWith(file.absolutePath.getFilenameFromPath()) && !document.isDirectory) if (uri.endsWith(file.absolutePath.getFilenameFromPath()) && !document.isDirectory) {
Thread({
document.delete() document.delete()
}).start()
}
} }
} else { } else {
Thread({
file.delete() file.delete()
}).start()
} }
if (deleteFromMediaStore(file)) { if (deleteFromMediaStore(file)) {