mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
catch exceptions thrown at clearing the recycle bin
This commit is contained in:
@ -293,11 +293,15 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList<String>, mediumDa
|
|||||||
|
|
||||||
fun BaseSimpleActivity.emptyTheRecycleBin(callback: (() -> Unit)? = null) {
|
fun BaseSimpleActivity.emptyTheRecycleBin(callback: (() -> Unit)? = null) {
|
||||||
Thread {
|
Thread {
|
||||||
recycleBin.deleteRecursively()
|
try {
|
||||||
galleryDB.MediumDao().clearRecycleBin()
|
recycleBin.deleteRecursively()
|
||||||
galleryDB.DirectoryDao().deleteRecycleBin()
|
galleryDB.MediumDao().clearRecycleBin()
|
||||||
toast(R.string.recycle_bin_emptied)
|
galleryDB.DirectoryDao().deleteRecycleBin()
|
||||||
callback?.invoke()
|
toast(R.string.recycle_bin_emptied)
|
||||||
|
callback?.invoke()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
toast(R.string.unknown_error_occurred)
|
||||||
|
}
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user