properly handle negative callback of handleSAFDialog
This commit is contained in:
parent
e18cce99a8
commit
4bee97ffd6
|
@ -397,6 +397,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
||||||
CompressAsDialog(activity, firstPath) {
|
CompressAsDialog(activity, firstPath) {
|
||||||
val destination = it
|
val destination = it
|
||||||
activity.handleSAFDialog(firstPath) {
|
activity.handleSAFDialog(firstPath) {
|
||||||
|
if (!it) {
|
||||||
|
return@handleSAFDialog
|
||||||
|
}
|
||||||
|
|
||||||
activity.toast(R.string.compressing)
|
activity.toast(R.string.compressing)
|
||||||
val paths = getSelectedFileDirItems().map { it.path }
|
val paths = getSelectedFileDirItems().map { it.path }
|
||||||
Thread {
|
Thread {
|
||||||
|
@ -422,6 +426,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.handleSAFDialog(firstPath) {
|
activity.handleSAFDialog(firstPath) {
|
||||||
|
if (!it) {
|
||||||
|
return@handleSAFDialog
|
||||||
|
}
|
||||||
|
|
||||||
val paths = getSelectedFileDirItems().asSequence().map { it.path }.filter { it.isZipFile() }.toList()
|
val paths = getSelectedFileDirItems().asSequence().map { it.path }.filter { it.isZipFile() }.toList()
|
||||||
tryDecompressingPaths(paths) {
|
tryDecompressingPaths(paths) {
|
||||||
if (it) {
|
if (it) {
|
||||||
|
@ -608,6 +616,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.handleSAFDialog(SAFPath) {
|
activity.handleSAFDialog(SAFPath) {
|
||||||
|
if (!it) {
|
||||||
|
return@handleSAFDialog
|
||||||
|
}
|
||||||
|
|
||||||
val files = ArrayList<FileDirItem>(selectedKeys.size)
|
val files = ArrayList<FileDirItem>(selectedKeys.size)
|
||||||
val positions = ArrayList<Int>()
|
val positions = ArrayList<Int>()
|
||||||
selectedKeys.forEach {
|
selectedKeys.forEach {
|
||||||
|
|
|
@ -51,6 +51,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
|
||||||
private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) {
|
private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) {
|
||||||
when {
|
when {
|
||||||
activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) {
|
activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) {
|
||||||
|
if (!it) {
|
||||||
|
return@handleSAFDialog
|
||||||
|
}
|
||||||
|
|
||||||
val documentFile = activity.getDocumentFile(path.getParentPath())
|
val documentFile = activity.getDocumentFile(path.getParentPath())
|
||||||
if (documentFile == null) {
|
if (documentFile == null) {
|
||||||
val error = String.format(activity.getString(R.string.could_not_create_folder), path)
|
val error = String.format(activity.getString(R.string.could_not_create_folder), path)
|
||||||
|
@ -83,6 +87,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
|
||||||
when {
|
when {
|
||||||
activity.needsStupidWritePermissions(path) -> {
|
activity.needsStupidWritePermissions(path) -> {
|
||||||
activity.handleSAFDialog(path) {
|
activity.handleSAFDialog(path) {
|
||||||
|
if (!it) {
|
||||||
|
return@handleSAFDialog
|
||||||
|
}
|
||||||
|
|
||||||
val documentFile = activity.getDocumentFile(path.getParentPath())
|
val documentFile = activity.getDocumentFile(path.getParentPath())
|
||||||
if (documentFile == null) {
|
if (documentFile == null) {
|
||||||
val error = String.format(activity.getString(R.string.could_not_create_file), path)
|
val error = String.format(activity.getString(R.string.could_not_create_file), path)
|
||||||
|
|
Loading…
Reference in New Issue