From 17e1ece0f6bfc555ec39fa8d97fbd353767aa458 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 20 Nov 2021 10:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/source/manage/BookSourceActivity.kt | 8 +++++--- .../ui/rss/source/manage/RssSourceActivity.kt | 20 +++++++++---------- app/src/main/res/menu/book_source.xml | 10 ++-------- app/src/main/res/menu/book_source_sel.xml | 5 +++++ app/src/main/res/menu/rss_source.xml | 12 ----------- app/src/main/res/menu/rss_source_sel.xml | 7 +++++++ 6 files changed, 28 insertions(+), 34 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 6533035bb..55b8ed893 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -27,6 +27,7 @@ import io.legado.app.lib.theme.primaryTextColor import io.legado.app.model.CheckSource import io.legado.app.model.Debug import io.legado.app.ui.association.ImportBookSourceDialog +import io.legado.app.ui.book.local.rule.TxtTocRuleActivity import io.legado.app.ui.book.source.debug.BookSourceDebugActivity import io.legado.app.ui.book.source.edit.BookSourceEditActivity import io.legado.app.ui.document.HandleFileContract @@ -120,15 +121,13 @@ class BookSourceActivity : VMBaseActivity startActivity() R.id.menu_import_qr -> qrResult.launch(null) - R.id.menu_share_source -> viewModel.saveToFile(adapter.selection) { - share(it) - } R.id.menu_group_manage -> showDialogFragment() R.id.menu_import_local -> importDoc.launch { mode = HandleFileContract.FILE allowExtensions = arrayOf("txt", "json") } R.id.menu_import_onLine -> showImportDialog() + R.id.menu_text_toc_rule -> startActivity() R.id.menu_sort_manual -> { item.isChecked = true sortCheck(Sort.Default) @@ -338,6 +337,9 @@ class BookSourceActivity : VMBaseActivity viewModel.saveToFile(adapter.selection) { + share(it) + } } return true } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index 82339958f..13a5a6653 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -116,9 +116,6 @@ class RssSourceActivity : VMBaseActivity showImportDialog() R.id.menu_import_qr -> qrCodeResult.launch(null) R.id.menu_group_manage -> showDialogFragment() - R.id.menu_share_source -> viewModel.saveToFile(adapter.selection) { - share(it) - } R.id.menu_import_default -> viewModel.importDefault() R.id.menu_help -> showHelp() else -> if (item.groupId == R.id.source_group) { @@ -134,16 +131,17 @@ class RssSourceActivity : VMBaseActivity viewModel.enableSelection(adapter.selection) R.id.menu_disable_selection -> viewModel.disableSelection(adapter.selection) R.id.menu_del_selection -> viewModel.delSelection(adapter.selection) - R.id.menu_export_selection -> exportResult.launch { - mode = HandleFileContract.EXPORT - fileData = Triple( - "exportRssSource.json", - GSON.toJson(adapter.selection).toByteArray(), - "application/json" - ) - } R.id.menu_top_sel -> viewModel.topSource(*adapter.selection.toTypedArray()) R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.selection.toTypedArray()) + R.id.menu_export_selection -> viewModel.saveToFile(adapter.selection) { file -> + exportResult.launch { + mode = HandleFileContract.EXPORT + fileData = Triple("exportRssSource.json", file, "application/json") + } + } + R.id.menu_share_source -> viewModel.saveToFile(adapter.selection) { + share(it) + } } return true } diff --git a/app/src/main/res/menu/book_source.xml b/app/src/main/res/menu/book_source.xml index 67d58d2d4..b68148cbb 100644 --- a/app/src/main/res/menu/book_source.xml +++ b/app/src/main/res/menu/book_source.xml @@ -89,37 +89,31 @@ diff --git a/app/src/main/res/menu/book_source_sel.xml b/app/src/main/res/menu/book_source_sel.xml index 7d947d35e..f73160d90 100644 --- a/app/src/main/res/menu/book_source_sel.xml +++ b/app/src/main/res/menu/book_source_sel.xml @@ -47,6 +47,11 @@ android:title="@string/export_selection" app:showAsAction="never" /> + + - - diff --git a/app/src/main/res/menu/rss_source_sel.xml b/app/src/main/res/menu/rss_source_sel.xml index 24ea4d598..252927165 100644 --- a/app/src/main/res/menu/rss_source_sel.xml +++ b/app/src/main/res/menu/rss_source_sel.xml @@ -27,4 +27,11 @@ android:title="@string/export_selection" app:showAsAction="never" /> + + + +