From fa8d85e72107dcb0362fcded0c05ec632bc5b57a Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 14 Sep 2021 20:07:43 +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 --- .../app/ui/book/read/config/SpeakEngineDialog.kt | 6 ++++++ .../app/ui/book/source/manage/BookSourceActivity.kt | 6 ++++++ .../app/ui/main/bookshelf/BaseBookshelfFragment.kt | 10 ++++++++-- .../io/legado/app/ui/replace/ReplaceRuleActivity.kt | 10 ++++++++-- .../app/ui/rss/source/manage/RssSourceActivity.kt | 10 ++++++++-- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt index 5769f9ed7..5739eb98c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt @@ -21,6 +21,7 @@ import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.databinding.DialogHttpTtsEditBinding import io.legado.app.databinding.DialogRecyclerViewBinding import io.legado.app.databinding.ItemHttpTtsBinding +import io.legado.app.help.DirectLinkUpload import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.primaryColor @@ -49,6 +50,11 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener private val exportDirResult = registerForActivityResult(HandleFileContract()) { uri -> uri ?: return@registerForActivityResult alert(R.string.export_success) { + if (uri.toString().isAbsUrl()) { + DirectLinkUpload.getSummary()?.let { summary -> + setMessage(summary) + } + } val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.hint = getString(R.string.path) editView.setText(uri.toString()) 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 a8ff7d579..8234880ae 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 @@ -20,6 +20,7 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.BookSource import io.legado.app.databinding.ActivityBookSourceBinding import io.legado.app.databinding.DialogEditTextBinding +import io.legado.app.help.DirectLinkUpload import io.legado.app.help.LocalConfig import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.ATH @@ -76,6 +77,11 @@ class BookSourceActivity : VMBaseActivity uri ?: return@registerForActivityResult alert(R.string.export_success) { + if (uri.toString().isAbsUrl()) { + DirectLinkUpload.getSummary()?.let { summary -> + setMessage(summary) + } + } val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.hint = getString(R.string.path) editView.setText(uri.toString()) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt index dd75f9f9f..9090cd5b3 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt @@ -13,6 +13,7 @@ import io.legado.app.data.entities.Book import io.legado.app.databinding.DialogBookshelfConfigBinding import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.help.AppConfig +import io.legado.app.help.DirectLinkUpload import io.legado.app.lib.dialogs.alert import io.legado.app.ui.about.AppLogDialog import io.legado.app.ui.book.arrange.ArrangeBookActivity @@ -34,9 +35,14 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment alert(R.string.export_success) { + if (uri.toString().isAbsUrl()) { + DirectLinkUpload.getSummary()?.let { summary -> + setMessage(summary) + } + } val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.hint = getString(R.string.path) editView.setText(uri.toString()) @@ -74,7 +80,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment viewModel.exportBookshelf(books) { - exportBookshelf.launch { + exportResult.launch { mode = HandleFileContract.EXPORT fileData = Triple( "bookshelf.json", diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt index 33c74842a..44bd93807 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt @@ -20,6 +20,7 @@ import io.legado.app.data.entities.ReplaceRule import io.legado.app.databinding.ActivityReplaceRuleBinding import io.legado.app.databinding.DialogEditTextBinding import io.legado.app.help.ContentProcessor +import io.legado.app.help.DirectLinkUpload import io.legado.app.help.coroutine.Coroutine import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.ATH @@ -77,9 +78,14 @@ class ReplaceRuleActivity : VMBaseActivity + private val exportResult = registerForActivityResult(HandleFileContract()) { uri -> uri ?: return@registerForActivityResult alert(R.string.export_success) { + if (uri.toString().isAbsUrl()) { + DirectLinkUpload.getSummary()?.let { summary -> + setMessage(summary) + } + } val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.hint = getString(R.string.path) editView.setText(uri.toString()) @@ -230,7 +236,7 @@ class ReplaceRuleActivity : VMBaseActivity viewModel.disableSelection(adapter.selection) R.id.menu_top_sel -> viewModel.topSelect(adapter.selection) R.id.menu_bottom_sel -> viewModel.bottomSelect(adapter.selection) - R.id.menu_export_selection -> exportDir.launch { + R.id.menu_export_selection -> exportResult.launch { mode = HandleFileContract.EXPORT fileData = Triple( "exportReplaceRule.json", 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 4d703879e..61ca9c95a 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 @@ -17,6 +17,7 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.RssSource import io.legado.app.databinding.ActivityRssSourceBinding import io.legado.app.databinding.DialogEditTextBinding +import io.legado.app.help.DirectLinkUpload import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.primaryTextColor @@ -63,9 +64,14 @@ class RssSourceActivity : VMBaseActivity + private val exportResult = registerForActivityResult(HandleFileContract()) { uri -> uri ?: return@registerForActivityResult alert(R.string.export_success) { + if (uri.toString().isAbsUrl()) { + DirectLinkUpload.getSummary()?.let { summary -> + setMessage(summary) + } + } val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { editView.hint = getString(R.string.path) editView.setText(uri.toString()) @@ -125,7 +131,7 @@ 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 -> exportDir.launch { + R.id.menu_export_selection -> exportResult.launch { mode = HandleFileContract.EXPORT fileData = Triple( "exportRssSource.json",