Skip to content

Commit ee3abd2

Browse files
committed
simplify note exporting
1 parent 0e45034 commit ee3abd2

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ class MainActivity : SimpleActivity() {
183183
findItem(R.id.rename_note).isVisible = multipleNotesExist
184184
findItem(R.id.open_note).isVisible = multipleNotesExist
185185
findItem(R.id.delete_note).isVisible = multipleNotesExist
186-
findItem(R.id.export_all_notes).isVisible = multipleNotesExist && !isQPlus()
187-
findItem(R.id.export_notes).isVisible = multipleNotesExist && isQPlus()
186+
findItem(R.id.export_all_notes).isVisible = multipleNotesExist
188187
findItem(R.id.open_search).isVisible = !isCurrentItemChecklist
189188
findItem(R.id.remove_done_items).isVisible = isCurrentItemChecklist
190189
findItem(R.id.sort_checklist).isVisible = isCurrentItemChecklist
@@ -223,8 +222,7 @@ class MainActivity : SimpleActivity() {
223222
R.id.open_file -> tryOpenFile()
224223
R.id.import_folder -> openFolder()
225224
R.id.export_as_file -> fragment?.handleUnlocking { tryExportAsFile() }
226-
R.id.export_all_notes -> tryExportAllNotes()
227-
R.id.export_notes -> tryExportNotes()
225+
R.id.export_all_notes -> tryExportNotes()
228226
R.id.import_notes -> tryImportNotes()
229227
R.id.print -> fragment?.handleUnlocking { printText() }
230228
R.id.delete_note -> fragment?.handleUnlocking { displayDeleteNotePrompt() }
@@ -889,20 +887,24 @@ class MainActivity : SimpleActivity() {
889887
}
890888

891889
private fun tryExportNotes() {
892-
hideKeyboard()
893-
val fileName = "${getString(R.string.notes)}_${getCurrentFormattedDateTime()}"
894-
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
895-
type = EXPORT_MIME_TYPE
896-
putExtra(Intent.EXTRA_TITLE, fileName)
897-
addCategory(Intent.CATEGORY_OPENABLE)
890+
if (isQPlus()) {
891+
hideKeyboard()
892+
val fileName = "${getString(R.string.notes)}_${getCurrentFormattedDateTime()}"
893+
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
894+
type = EXPORT_MIME_TYPE
895+
putExtra(Intent.EXTRA_TITLE, fileName)
896+
addCategory(Intent.CATEGORY_OPENABLE)
898897

899-
try {
900-
startActivityForResult(this, PICK_EXPORT_NOTES_INTENT)
901-
} catch (e: ActivityNotFoundException) {
902-
toast(R.string.system_service_disabled, Toast.LENGTH_LONG)
903-
} catch (e: Exception) {
904-
showErrorToast(e)
898+
try {
899+
startActivityForResult(this, PICK_EXPORT_NOTES_INTENT)
900+
} catch (e: ActivityNotFoundException) {
901+
toast(R.string.system_service_disabled, Toast.LENGTH_LONG)
902+
} catch (e: Exception) {
903+
showErrorToast(e)
904+
}
905905
}
906+
} else {
907+
tryExportAllNotesBelowQ()
906908
}
907909
}
908910

@@ -1002,17 +1004,17 @@ class MainActivity : SimpleActivity() {
10021004
}
10031005
}
10041006

1005-
private fun tryExportAllNotes() {
1007+
private fun tryExportAllNotesBelowQ() {
10061008
handlePermission(PERMISSION_WRITE_STORAGE) {
10071009
if (it) {
1008-
exportAllNotes()
1010+
exportAllNotesBelowQ()
10091011
} else {
10101012
toast(R.string.no_storage_permissions)
10111013
}
10121014
}
10131015
}
10141016

1015-
private fun exportAllNotes() {
1017+
private fun exportAllNotesBelowQ() {
10161018
ExportFilesDialog(this, mNotes) { parent, extension ->
10171019
val items = arrayListOf(
10181020
RadioItem(EXPORT_FILE_SYNC, getString(R.string.update_file_at_note)),

app/src/main/res/menu/menu.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@
7676
app:showAsAction="never" />
7777
<item
7878
android:id="@+id/export_all_notes"
79-
android:title="@string/export_all_notes"
80-
app:showAsAction="never" />
81-
<item
82-
android:id="@+id/export_notes"
8379
android:title="@string/export_notes"
8480
app:showAsAction="never" />
8581
<item

0 commit comments

Comments
 (0)