Skip to content

Commit 3dd51a9

Browse files
committed
allow syncing notes to document uri files
1 parent 7c6bca4 commit 3dd51a9

File tree

1 file changed

+11
-3
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/activities

1 file changed

+11
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class MainActivity : SimpleActivity() {
520520
if (hasPermission(PERMISSION_READ_STORAGE)) {
521521
openFile()
522522
} else {
523-
Intent(Intent.ACTION_GET_CONTENT).apply {
523+
Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
524524
addCategory(Intent.CATEGORY_OPENABLE)
525525
type = "text/*"
526526
startActivityForResult(this, PICK_OPEN_FILE_INTENT)
@@ -624,8 +624,16 @@ class MainActivity : SimpleActivity() {
624624
val note = Note(null, noteTitle, content, NoteType.TYPE_CHECKLIST.value)
625625
displayNewNoteDialog(note.value, title = noteTitle, setChecklistAsDefault = true)
626626
} else {
627-
val note = Note(null, noteTitle, content, NoteType.TYPE_TEXT.value)
628-
displayNewNoteDialog(note.value, title = noteTitle, "")
627+
val items = arrayListOf(
628+
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),
629+
RadioItem(EXPORT_FILE_NO_SYNC, getString(R.string.only_export_file_content)))
630+
631+
RadioGroupDialog(this, items) {
632+
val syncFile = it as Int == EXPORT_FILE_SYNC
633+
val path = if (syncFile) uri.toString() else ""
634+
val note = Note(null, noteTitle, content, NoteType.TYPE_TEXT.value)
635+
displayNewNoteDialog(note.value, title = noteTitle, path)
636+
}
629637
}
630638
}
631639

0 commit comments

Comments
 (0)