mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-13 23:12:02 +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) {
|
||||
(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 oldText = context!!.getNoteStoredValue(note)
|
||||
if (newText != oldText) {
|
||||
if (newText != null && newText != oldText) {
|
||||
note.value = newText
|
||||
saveNoteValue(note)
|
||||
context!!.updateWidget()
|
||||
@ -144,11 +147,14 @@ class NoteFragment : Fragment() {
|
||||
db.updateNoteValue(note)
|
||||
(activity as MainActivity).noteSavedSuccessfully(note.title)
|
||||
} 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) {
|
||||
GRAVITY_CENTER -> Gravity.CENTER_HORIZONTAL
|
||||
|
Loading…
x
Reference in New Issue
Block a user