mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-17 16:57:23 +02:00
update commons to 3.0.23
This commit is contained in:
parent
af45085170
commit
e834a06467
@ -45,7 +45,7 @@ ext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:3.0.21'
|
implementation 'com.simplemobiletools:commons:3.0.23'
|
||||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||||
|
|
||||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
|
||||||
|
@ -22,41 +22,42 @@ class RenameNoteDialog(val activity: SimpleActivity, val db: DBHelper, val note:
|
|||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.create().apply {
|
.create().apply {
|
||||||
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
activity.setupDialogStuff(view, this, R.string.rename_note)
|
activity.setupDialogStuff(view, this, R.string.rename_note) {
|
||||||
getButton(BUTTON_POSITIVE).setOnClickListener {
|
getButton(BUTTON_POSITIVE).setOnClickListener {
|
||||||
val title = view.note_name.value
|
val title = view.note_name.value
|
||||||
when {
|
when {
|
||||||
title.isEmpty() -> activity.toast(R.string.no_title)
|
title.isEmpty() -> activity.toast(R.string.no_title)
|
||||||
db.doesTitleExist(title) -> activity.toast(R.string.title_taken)
|
db.doesTitleExist(title) -> activity.toast(R.string.title_taken)
|
||||||
else -> {
|
else -> {
|
||||||
note.title = title
|
note.title = title
|
||||||
val path = note.path
|
val path = note.path
|
||||||
if (path.isNotEmpty()) {
|
if (path.isNotEmpty()) {
|
||||||
if (title.isEmpty()) {
|
if (title.isEmpty()) {
|
||||||
activity.toast(R.string.filename_cannot_be_empty)
|
activity.toast(R.string.filename_cannot_be_empty)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
val file = File(path)
|
val file = File(path)
|
||||||
val newFile = File(file.parent, title)
|
val newFile = File(file.parent, title)
|
||||||
if (!newFile.name.isAValidFilename()) {
|
if (!newFile.name.isAValidFilename()) {
|
||||||
activity.toast(R.string.invalid_name)
|
activity.toast(R.string.invalid_name)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.renameFile(file, newFile) {
|
activity.renameFile(file, newFile) {
|
||||||
if (it) {
|
if (it) {
|
||||||
note.path = newFile.absolutePath
|
note.path = newFile.absolutePath
|
||||||
db.updateNotePath(note)
|
db.updateNotePath(note)
|
||||||
} else {
|
} else {
|
||||||
activity.toast(R.string.rename_file_error)
|
activity.toast(R.string.rename_file_error)
|
||||||
return@renameFile
|
return@renameFile
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
db.updateNoteTitle(note)
|
||||||
|
dismiss()
|
||||||
|
callback(note)
|
||||||
}
|
}
|
||||||
db.updateNoteTitle(note)
|
|
||||||
dismiss()
|
|
||||||
callback(note)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user