mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-24 20:40:09 +01:00
fix #298, properly save checklist values at renaming
This commit is contained in:
parent
2667cc4d64
commit
bbc14d4aae
@ -619,7 +619,12 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
private fun addTextToCurrentNote(text: String) = getPagerAdapter().appendText(view_pager.currentItem, text)
|
||||
|
||||
private fun saveCurrentNote(force: Boolean) = getPagerAdapter().saveCurrentNote(view_pager.currentItem, force)
|
||||
private fun saveCurrentNote(force: Boolean) {
|
||||
getPagerAdapter().saveCurrentNote(view_pager.currentItem, force)
|
||||
if (mCurrentNote.type == TYPE_CHECKLIST) {
|
||||
mCurrentNote.value = getPagerAdapter().getNoteChecklistItems(view_pager.currentItem) ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
private fun displayDeleteNotePrompt() {
|
||||
DeleteNoteDialog(this, mCurrentNote) {
|
||||
|
@ -57,6 +57,8 @@ class NotesPagerAdapter(fm: FragmentManager, val notes: List<Note>, val activity
|
||||
|
||||
fun saveAllFragmentTexts() = fragments.values.forEach { (it as? TextFragment)?.saveText(false) }
|
||||
|
||||
fun getNoteChecklistItems(position: Int) = (fragments[position] as? ChecklistFragment)?.getChecklistItems()
|
||||
|
||||
fun undo(position: Int) = (fragments[position] as? TextFragment)?.undo()
|
||||
|
||||
fun redo(position: Int) = (fragments[position] as? TextFragment)?.redo()
|
||||
|
@ -122,13 +122,15 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
||||
}
|
||||
}
|
||||
|
||||
note!!.value = Gson().toJson(items)
|
||||
note!!.value = getChecklistItems()
|
||||
context?.notesDB?.insertOrUpdate(note!!)
|
||||
context?.updateWidgets()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getChecklistItems() = Gson().toJson(items)
|
||||
|
||||
override fun saveChecklist() {
|
||||
saveNote()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user