mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
show error messages if deleting failed
This commit is contained in:
@@ -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()
|
||||||
|
Reference in New Issue
Block a user