Skip to content

Commit

Permalink
properly handle exporting checklist note values
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed Mar 29, 2020
1 parent 3c2daae commit eee2d57
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit eee2d57

Please sign in to comment.