mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-15 15:57:24 +02:00
avoid saving text if current notes view is null
This commit is contained in:
parent
570b3c230d
commit
187e7888d2
@ -111,7 +111,10 @@ class NoteFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (menuVisible && noteId != 0) {
|
if (menuVisible && noteId != 0) {
|
||||||
(activity as MainActivity).currentNoteTextChanged(getCurrentNoteViewText())
|
val currentText = getCurrentNoteViewText()
|
||||||
|
if (currentText != null) {
|
||||||
|
(activity as MainActivity).currentNoteTextChanged(currentText)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +131,7 @@ class NoteFragment : Fragment() {
|
|||||||
|
|
||||||
val newText = getCurrentNoteViewText()
|
val newText = getCurrentNoteViewText()
|
||||||
val oldText = context!!.getNoteStoredValue(note)
|
val oldText = context!!.getNoteStoredValue(note)
|
||||||
if (newText != oldText) {
|
if (newText != null && newText != oldText) {
|
||||||
note.value = newText
|
note.value = newText
|
||||||
saveNoteValue(note)
|
saveNoteValue(note)
|
||||||
context!!.updateWidget()
|
context!!.updateWidget()
|
||||||
@ -144,11 +147,14 @@ class NoteFragment : Fragment() {
|
|||||||
db.updateNoteValue(note)
|
db.updateNoteValue(note)
|
||||||
(activity as MainActivity).noteSavedSuccessfully(note.title)
|
(activity as MainActivity).noteSavedSuccessfully(note.title)
|
||||||
} else {
|
} else {
|
||||||
(activity as MainActivity).exportNoteValueToFile(note.path, getCurrentNoteViewText(), true)
|
val currentText = getCurrentNoteViewText()
|
||||||
|
if (currentText != null) {
|
||||||
|
(activity as MainActivity).exportNoteValueToFile(note.path, currentText, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCurrentNoteViewText() = view.notes_view?.text.toString()
|
fun getCurrentNoteViewText() = view.notes_view?.text?.toString()
|
||||||
|
|
||||||
private fun getTextGravity() = when (context!!.config.gravity) {
|
private fun getTextGravity() = when (context!!.config.gravity) {
|
||||||
GRAVITY_CENTER -> Gravity.CENTER_HORIZONTAL
|
GRAVITY_CENTER -> Gravity.CENTER_HORIZONTAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user