Delete root directory from background service when wiping
This commit is contained in:
parent
faeab5d3f6
commit
6f49cec157
@ -131,10 +131,9 @@ class ExplorerActivity : BaseExplorerActivity() {
|
|||||||
${getString(R.string.ask_for_wipe)}
|
${getString(R.string.ask_for_wipe)}
|
||||||
""".trimIndent())
|
""".trimIndent())
|
||||||
.setPositiveButton(R.string.yes) { _, _ ->
|
.setPositiveButton(R.string.yes) { _, _ ->
|
||||||
fileOperationService.wipeUris(urisToWipe) { errorMsg ->
|
fileOperationService.wipeUris(urisToWipe, rootFile) { errorMsg ->
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (errorMsg == null){
|
if (errorMsg == null){
|
||||||
rootFile?.delete()
|
|
||||||
Toast.makeText(this, R.string.wipe_successful, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, R.string.wipe_successful, Toast.LENGTH_SHORT).show()
|
||||||
} else {
|
} else {
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
|
@ -307,7 +307,7 @@ class FileOperationService : Service() {
|
|||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun wipeUris(uris: List<Uri>, callback: (String?) -> Unit){
|
fun wipeUris(uris: List<Uri>, rootFile: DocumentFile? = null, callback: (String?) -> Unit){
|
||||||
Thread {
|
Thread {
|
||||||
val notification = showNotification(R.string.file_op_wiping_msg, uris.size)
|
val notification = showNotification(R.string.file_op_wiping_msg, uris.size)
|
||||||
var errorMsg: String? = null
|
var errorMsg: String? = null
|
||||||
@ -323,6 +323,9 @@ class FileOperationService : Service() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (errorMsg == null) {
|
||||||
|
rootFile?.delete()
|
||||||
|
}
|
||||||
cancelNotification(notification)
|
cancelNotification(notification)
|
||||||
callback(errorMsg)
|
callback(errorMsg)
|
||||||
}.start()
|
}.start()
|
||||||
|
Loading…
Reference in New Issue
Block a user