properly handle exporting checklist note values

This commit is contained in:
tibbi 2020-03-29 22:20:45 +02:00
parent 3c2daaee9a
commit eee2d57cd2
1 changed files with 9 additions and 1 deletions

View File

@ -230,7 +230,7 @@ class MainActivity : SimpleActivity() {
if (requestCode == PICK_OPEN_FILE_INTENT && resultCode == RESULT_OK && resultData != null && resultData.data != null) {
importUri(resultData.data!!)
} else if (requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
tryExportNoteValueToFile(resultData.dataString!!, getCurrentNoteText() ?: "", true)
tryExportNoteValueToFile(resultData.dataString!!, getCurrentNoteValue(), true)
}
}
@ -846,6 +846,14 @@ class MainActivity : SimpleActivity() {
private fun getCurrentNoteText() = getPagerAdapter().getCurrentNoteViewText(view_pager.currentItem)
private fun getCurrentNoteValue(): String {
return if (mCurrentNote.type == NoteType.TYPE_TEXT.value) {
getCurrentNoteText() ?: ""
} else {
getPagerAdapter().getNoteChecklistItems(view_pager.currentItem) ?: ""
}
}
private fun addTextToCurrentNote(text: String) = getPagerAdapter().appendText(view_pager.currentItem, text)
private fun saveCurrentNote(force: Boolean) {