catch exceptions thrown at clearing the recycle bin
This commit is contained in:
parent
44014ef44a
commit
f066f4b84a
1 changed files with 9 additions and 5 deletions
|
@ -293,11 +293,15 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList<String>, mediumDa
|
|||
|
||||
fun BaseSimpleActivity.emptyTheRecycleBin(callback: (() -> Unit)? = null) {
|
||||
Thread {
|
||||
recycleBin.deleteRecursively()
|
||||
galleryDB.MediumDao().clearRecycleBin()
|
||||
galleryDB.DirectoryDao().deleteRecycleBin()
|
||||
toast(R.string.recycle_bin_emptied)
|
||||
callback?.invoke()
|
||||
try {
|
||||
recycleBin.deleteRecursively()
|
||||
galleryDB.MediumDao().clearRecycleBin()
|
||||
galleryDB.DirectoryDao().deleteRecycleBin()
|
||||
toast(R.string.recycle_bin_emptied)
|
||||
callback?.invoke()
|
||||
} catch (e: Exception) {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue