Skip to content

Commit b4dd0a0

Browse files
committed
Make export behavior more consistent with pre-3.0
1 parent d77b954 commit b4dd0a0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/src/main/java/com/farmerbb/notepad/android/NotepadActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class NotepadActivity: ComponentActivity(), FSAFActivityCallbacks {
6262
}
6363

6464
override fun fsafStartActivityForResult(intent: Intent, requestCode: Int) {
65-
if (intent.action == Intent.ACTION_OPEN_DOCUMENT) {
66-
// Override type to plaintext only
67-
intent.type = "text/plain"
65+
when(intent.action) {
66+
Intent.ACTION_OPEN_DOCUMENT -> intent.type = "text/plain"
67+
Intent.ACTION_OPEN_DOCUMENT_TREE -> intent.removeExtra(Intent.EXTRA_LOCAL_ONLY)
6868
}
6969

7070
startActivityForResult(intent, requestCode)

app/src/main/java/com/farmerbb/notepad/viewmodel/NotepadViewModel.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ class NotepadViewModel(
290290
clearSelectedNotes()
291291
}
292292

293+
if (hydratedNotes.size == 1) {
294+
val note = hydratedNotes.first()
295+
exportSingleNote(note.metadata, note.text, filenameFormat)
296+
return@launch
297+
}
298+
293299
artVandelay.exportNotes(
294300
hydratedNotes,
295301
filenameFormat,

0 commit comments

Comments
 (0)