editing renameItemDialog style so its not that indented
This commit is contained in:
parent
0d583c4f32
commit
f4f2adde24
|
@ -27,31 +27,32 @@ class RenameItemDialog(val context: Context, val path: String, val item: FileDir
|
||||||
show()
|
show()
|
||||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
|
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
|
||||||
val newName = view.item_name.value
|
val newName = view.item_name.value
|
||||||
if (newName.isAValidFilename()) {
|
if (!newName.isAValidFilename()) {
|
||||||
val currFile = File(path, item.name)
|
context.toast(R.string.invalid_name)
|
||||||
val newFile = File(path, newName)
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
if (newFile.exists()) {
|
val currFile = File(path, item.name)
|
||||||
context.toast(R.string.name_taken)
|
val newFile = File(path, newName)
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.needsStupidWritePermissions(path)) {
|
if (newFile.exists()) {
|
||||||
val document = context.getFileDocument(currFile.absolutePath, Config.newInstance(context).treeUri)
|
context.toast(R.string.name_taken)
|
||||||
if (document.canWrite())
|
return@setOnClickListener
|
||||||
document.renameTo(newName)
|
}
|
||||||
|
|
||||||
|
if (context.needsStupidWritePermissions(path)) {
|
||||||
|
val document = context.getFileDocument(currFile.absolutePath, Config.newInstance(context).treeUri)
|
||||||
|
if (document.canWrite())
|
||||||
|
document.renameTo(newName)
|
||||||
|
sendSuccess(newFile)
|
||||||
|
dismiss()
|
||||||
|
} else {
|
||||||
|
if (currFile.renameTo(newFile)) {
|
||||||
sendSuccess(newFile)
|
sendSuccess(newFile)
|
||||||
dismiss()
|
dismiss()
|
||||||
} else {
|
} else {
|
||||||
if (currFile.renameTo(newFile)) {
|
context.toast(R.string.error_occurred)
|
||||||
sendSuccess(newFile)
|
|
||||||
dismiss()
|
|
||||||
} else {
|
|
||||||
context.toast(R.string.error_occurred)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
context.toast(R.string.invalid_name)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue