From d54cbe958ee6afe47a12e9a3478bf06ab47ea974 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 8 Sep 2021 23:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B7=BB=E5=8A=A0=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/rss/read/ReadRssActivity.kt | 9 +++++++++ app/src/main/res/menu/rss_read.xml | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index 64448eb51..2666e07ed 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -24,6 +24,7 @@ import io.legado.app.lib.theme.primaryTextColor import io.legado.app.model.Download import io.legado.app.ui.association.OnLineImportActivity import io.legado.app.ui.document.HandleFileContract +import io.legado.app.ui.login.SourceLoginActivity import io.legado.app.utils.* import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.launch @@ -84,6 +85,11 @@ class ReadRssActivity : VMBaseActivity return super.onPrepareOptionsMenu(menu) } + override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { + menu.findItem(R.id.menu_login)?.isVisible = !viewModel.rssSource?.loginUrl.isNullOrBlank() + return super.onMenuOpened(featureId, menu) + } + override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.menu_rss_refresh -> viewModel.refresh() @@ -92,6 +98,9 @@ class ReadRssActivity : VMBaseActivity share(it.link) } ?: toastOnUi(R.string.null_url) R.id.menu_aloud -> readAloud() + R.id.menu_login -> startActivity { + putExtra("sourceUrl", viewModel.rssSource?.loginUrl) + } } return super.onCompatOptionsItemSelected(item) } diff --git a/app/src/main/res/menu/rss_read.xml b/app/src/main/res/menu/rss_read.xml index 062830439..f2c44b0f6 100644 --- a/app/src/main/res/menu/rss_read.xml +++ b/app/src/main/res/menu/rss_read.xml @@ -25,4 +25,9 @@ android:icon="@drawable/ic_volume_up" app:showAsAction="ifRoom" /> + + \ No newline at end of file