forked from hardcoresushi/DroidFS
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)}
|
||||
""".trimIndent())
|
||||
.setPositiveButton(R.string.yes) { _, _ ->
|
||||
fileOperationService.wipeUris(urisToWipe) { errorMsg ->
|
||||
fileOperationService.wipeUris(urisToWipe, rootFile) { errorMsg ->
|
||||
runOnUiThread {
|
||||
if (errorMsg == null){
|
||||
rootFile?.delete()
|
||||
Toast.makeText(this, R.string.wipe_successful, Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
ColoredAlertDialogBuilder(this)
|
||||
|
@ -307,7 +307,7 @@ class FileOperationService : Service() {
|
||||
}.start()
|
||||
}
|
||||
|
||||
fun wipeUris(uris: List<Uri>, callback: (String?) -> Unit){
|
||||
fun wipeUris(uris: List<Uri>, rootFile: DocumentFile? = null, callback: (String?) -> Unit){
|
||||
Thread {
|
||||
val notification = showNotification(R.string.file_op_wiping_msg, uris.size)
|
||||
var errorMsg: String? = null
|
||||
@ -323,6 +323,9 @@ class FileOperationService : Service() {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (errorMsg == null) {
|
||||
rootFile?.delete()
|
||||
}
|
||||
cancelNotification(notification)
|
||||
callback(errorMsg)
|
||||
}.start()
|
||||
|
Loading…
Reference in New Issue
Block a user