From 0eb0ba34d826447802691d3c5adaa6f150cf950c Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 20 Nov 2022 13:27:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E7=AD=BE=E6=B7=BB=E5=8A=A0=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/bookmark/AllBookmarkActivity.kt | 23 ++++++++++++++ .../ui/book/bookmark/AllBookmarkViewModel.kt | 31 +++++++++++++++++++ .../legado/app/ui/rss/read/ReadRssActivity.kt | 6 +++- app/src/main/res/menu/bookmark.xml | 8 +++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/menu/bookmark.xml diff --git a/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt b/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt index 1d7eb937b..c2ed19fc9 100644 --- a/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/bookmark/AllBookmarkActivity.kt @@ -1,10 +1,15 @@ package io.legado.app.ui.book.bookmark import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import androidx.activity.viewModels +import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.data.entities.Bookmark import io.legado.app.databinding.ActivityAllBookmarkBinding +import io.legado.app.ui.document.HandleFileContract +import io.legado.app.utils.launch import io.legado.app.utils.showDialogFragment import io.legado.app.utils.viewbindingdelegate.viewBinding @@ -17,6 +22,11 @@ class AllBookmarkActivity : VMBaseActivity + viewModel.saveToFile(uri) + } + } override fun onActivityCreated(savedInstanceState: Bundle?) { initView() @@ -30,6 +40,18 @@ class AllBookmarkActivity : VMBaseActivity exportDir.launch() + } + return super.onCompatOptionsItemSelected(item) + } + override fun onItemClick(bookmark: Bookmark, position: Int) { showDialogFragment(BookmarkDialog(bookmark, position)) } @@ -44,4 +66,5 @@ class AllBookmarkActivity : VMBaseActivity binding.webView.evaluateJavascript("document.documentElement.outerHTML") { val html = StringEscapeUtils.unescapeJson(it) .replace("^\"|\"$".toRegex(), "") - viewModel.readAloud(Jsoup.parse(html).textArray().joinToString("\n")) + viewModel.readAloud( + Jsoup.parse(html) + .textArray() + .joinToString("\n") + ) } } } diff --git a/app/src/main/res/menu/bookmark.xml b/app/src/main/res/menu/bookmark.xml new file mode 100644 index 000000000..f5843a872 --- /dev/null +++ b/app/src/main/res/menu/bookmark.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file