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({
|
Thread({
|
||||||
|
var hadSuccess = false
|
||||||
files.filter { it.exists() && it.isImageVideoGif() }
|
files.filter { it.exists() && it.isImageVideoGif() }
|
||||||
.forEach {
|
.forEach {
|
||||||
if (needsPermissions) {
|
if (needsPermissions) {
|
||||||
|
@ -244,13 +245,19 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
val uri = URLDecoder.decode(document.uri.toString(), "UTF-8")
|
val uri = URLDecoder.decode(document.uri.toString(), "UTF-8")
|
||||||
val filename = URLDecoder.decode(it.absolutePath.getFilenameFromPath(), "UTF-8")
|
val filename = URLDecoder.decode(it.absolutePath.getFilenameFromPath(), "UTF-8")
|
||||||
if (uri.endsWith(filename) && !document.isDirectory) {
|
if (uri.endsWith(filename) && !document.isDirectory) {
|
||||||
document.delete()
|
if (document.delete())
|
||||||
|
hadSuccess = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
it.delete()
|
if (it.delete())
|
||||||
|
hadSuccess = true
|
||||||
}
|
}
|
||||||
deleteFromMediaStore(it)
|
deleteFromMediaStore(it)
|
||||||
}
|
}
|
||||||
|
if (!hadSuccess)
|
||||||
|
runOnUiThread {
|
||||||
|
toast(R.string.unknown_error_occurred)
|
||||||
|
}
|
||||||
}).start()
|
}).start()
|
||||||
|
|
||||||
if (mMedia.isEmpty()) {
|
if (mMedia.isEmpty()) {
|
||||||
|
|
|
@ -246,6 +246,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
val filename = URLDecoder.decode(file.absolutePath.getFilenameFromPath(), "UTF-8")
|
val filename = URLDecoder.decode(file.absolutePath.getFilenameFromPath(), "UTF-8")
|
||||||
if (uri.endsWith(filename) && !document.isDirectory) {
|
if (uri.endsWith(filename) && !document.isDirectory) {
|
||||||
document.delete()
|
document.delete()
|
||||||
|
} else {
|
||||||
|
runOnUiThread {
|
||||||
|
toast(R.string.unknown_error_occurred)
|
||||||
|
}
|
||||||
|
return@Thread
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
file.delete()
|
file.delete()
|
||||||
|
|
Loading…
Reference in a new issue