show error messages if deleting failed
This commit is contained in:
parent
67a459ced7
commit
0c2598d37b
2 changed files with 14 additions and 2 deletions
|
@ -235,6 +235,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
}
|
||||
|
||||
Thread({
|
||||
var hadSuccess = false
|
||||
files.filter { it.exists() && it.isImageVideoGif() }
|
||||
.forEach {
|
||||
if (needsPermissions) {
|
||||
|
@ -244,13 +245,19 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
val uri = URLDecoder.decode(document.uri.toString(), "UTF-8")
|
||||
val filename = URLDecoder.decode(it.absolutePath.getFilenameFromPath(), "UTF-8")
|
||||
if (uri.endsWith(filename) && !document.isDirectory) {
|
||||
document.delete()
|
||||
if (document.delete())
|
||||
hadSuccess = true
|
||||
}
|
||||
} else {
|
||||
it.delete()
|
||||
if (it.delete())
|
||||
hadSuccess = true
|
||||
}
|
||||
deleteFromMediaStore(it)
|
||||
}
|
||||
if (!hadSuccess)
|
||||
runOnUiThread {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}).start()
|
||||
|
||||
if (mMedia.isEmpty()) {
|
||||
|
|
|
@ -246,6 +246,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
val filename = URLDecoder.decode(file.absolutePath.getFilenameFromPath(), "UTF-8")
|
||||
if (uri.endsWith(filename) && !document.isDirectory) {
|
||||
document.delete()
|
||||
} else {
|
||||
runOnUiThread {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
return@Thread
|
||||
}
|
||||
} else {
|
||||
file.delete()
|
||||
|
|
Loading…
Reference in a new issue