mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-23 19:57:23 +02:00
store the note value in db only if its not linked to a file
This commit is contained in:
parent
c0617d518a
commit
6585cf0b2f
app/src/main
kotlin/com/simplemobiletools/notes
res
values-de
values-es
values-fr
values-hu
values-it
values-ja
values-pt-rPT
values-sv
values
@ -30,7 +30,7 @@ class NotesPagerAdapter(fm: FragmentManager, private val notes: List<Note>) : Fr
|
|||||||
|
|
||||||
override fun getPageTitle(position: Int) = notes[position].title
|
override fun getPageTitle(position: Int) = notes[position].title
|
||||||
|
|
||||||
fun getCurrentNoteText(position: Int) = fragments[position].getCurrentNoteText()
|
fun getCurrentNoteText(position: Int) = fragments[position].getCurrentNoteViewText()
|
||||||
|
|
||||||
fun showKeyboard(position: Int) = fragments[position]?.showKeyboard()
|
fun showKeyboard(position: Int) = fragments[position]?.showKeyboard()
|
||||||
}
|
}
|
||||||
|
@ -56,16 +56,14 @@ class NoteFragment : Fragment() {
|
|||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCurrentNoteText() = view.notes_view.text.toString()
|
|
||||||
|
|
||||||
fun saveText() {
|
fun saveText() {
|
||||||
val newText = getCurrentNoteText()
|
val newText = getCurrentNoteViewText()
|
||||||
val oldText = note.value
|
val oldText = getNoteStoredValue()
|
||||||
if (newText != oldText) {
|
if (newText != oldText) {
|
||||||
note.value = newText
|
note.value = newText
|
||||||
mDb.updateNoteValue(note)
|
saveNoteValue(note)
|
||||||
context.updateWidget()
|
|
||||||
}
|
}
|
||||||
|
context.updateWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showKeyboard() {
|
fun showKeyboard() {
|
||||||
@ -74,12 +72,26 @@ class NoteFragment : Fragment() {
|
|||||||
imm.showSoftInput(view.notes_view, InputMethodManager.SHOW_IMPLICIT)
|
imm.showSoftInput(view.notes_view, InputMethodManager.SHOW_IMPLICIT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun saveNoteValue(note: Note) {
|
||||||
|
if (note.path.isEmpty()) {
|
||||||
|
mDb.updateNoteValue(note)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCurrentNoteViewText() = view.notes_view.text.toString()
|
||||||
|
|
||||||
|
private fun getNoteStoredValue(): String {
|
||||||
|
return note.value
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
val config = context.config
|
val config = context.config
|
||||||
view.notes_view.apply {
|
view.notes_view.apply {
|
||||||
setText(note.value)
|
setText(getNoteStoredValue())
|
||||||
setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
||||||
gravity = context.getTextGravity()
|
gravity = context.getTextGravity()
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<string name="save_as_file">Save as file</string>
|
<string name="save_as_file">Save as file</string>
|
||||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||||
<string name="only_import_file_content">Only import the file content</string>
|
<string name="only_import_file_content">Only import the file content</string>
|
||||||
<string name="update_file_at_note">Update the file at updating the note</string>
|
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user