fix #168, show an error if file/folder creation fails for whatever reason

This commit is contained in:
tibbi
2018-02-17 11:39:45 +01:00
parent 25e4564b1e
commit 803b30c59c
2 changed files with 3 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ class CreateNewItemDialog(val activity: BaseSimpleActivity, val path: String, va
private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) { private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) {
when { when {
activity.needsStupidWritePermissions(this.path) -> activity.handleSAFDialog(path) { activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) {
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)

View File

@@ -253,6 +253,8 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
CreateNewItemDialog(activity as SimpleActivity, currentPath) { CreateNewItemDialog(activity as SimpleActivity, currentPath) {
if (it) { if (it) {
refreshItems() refreshItems()
} else {
activity?.toast(R.string.unknown_error_occurred)
} }
} }
} }