Merge pull request #751 from esensar/fix/602-delete-otg
Handle file/folder creation, deletion and copy/move for OTG
This commit is contained in:
commit
f60145aa8b
|
@ -51,6 +51,21 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
|
|||
|
||||
private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) {
|
||||
when {
|
||||
activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) {
|
||||
if (!it) {
|
||||
return@handleSAFDialog
|
||||
}
|
||||
|
||||
val documentFile = activity.getDocumentFile(path.getParentPath())
|
||||
if (documentFile == null) {
|
||||
val error = String.format(activity.getString(R.string.could_not_create_folder), path)
|
||||
activity.showErrorToast(error)
|
||||
callback(false)
|
||||
return@handleSAFDialog
|
||||
}
|
||||
documentFile.createDirectory(path.getFilenameFromPath())
|
||||
success(alertDialog)
|
||||
}
|
||||
isRPlus() || path.startsWith(activity.internalStoragePath, true) -> {
|
||||
if (activity.isRestrictedSAFOnlyRoot(path)) {
|
||||
activity.handleAndroidSAFDialog(path) {
|
||||
|
@ -72,21 +87,6 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
|
|||
}
|
||||
}
|
||||
}
|
||||
activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) {
|
||||
if (!it) {
|
||||
return@handleSAFDialog
|
||||
}
|
||||
|
||||
val documentFile = activity.getDocumentFile(path.getParentPath())
|
||||
if (documentFile == null) {
|
||||
val error = String.format(activity.getString(R.string.could_not_create_folder), path)
|
||||
activity.showErrorToast(error)
|
||||
callback(false)
|
||||
return@handleSAFDialog
|
||||
}
|
||||
documentFile.createDirectory(path.getFilenameFromPath())
|
||||
success(alertDialog)
|
||||
}
|
||||
else -> {
|
||||
RootHelpers(activity).createFileFolder(path, false) {
|
||||
if (it) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.filemanager.pro.extensions
|
|||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
|
|
@ -5,7 +5,7 @@ kotlin = "1.9.0"
|
|||
androidx-swiperefreshlayout = "1.1.0"
|
||||
androidx-documentfile = "1.0.1"
|
||||
#Simple tools
|
||||
simple-commons = "eceb48949e"
|
||||
simple-commons = "0661d6d44a"
|
||||
#Other
|
||||
autofittextview = "0.2.1"
|
||||
gestureviews = "2.5.2"
|
||||
|
|
Loading…
Reference in New Issue