From 324bfc733b43552565717154e99d892faa00460e Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 25 Apr 2024 08:56:37 +0300 Subject: [PATCH] Fix bookmark action in reader --- .../kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt | 1 + .../org/koitharu/kotatsu/reader/ui/ReaderTopMenuProvider.kt | 2 +- app/src/main/res/menu/opt_reader_top.xml | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt index 67407a1ff..531143550 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderActivity.kt @@ -212,6 +212,7 @@ class ReaderActivity : viewBinding.toastView.hide() } viewBinding.toolbarBottom.invalidateMenu() + invalidateOptionsMenu() } override fun onGridTouch(area: TapGridArea): Boolean { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderTopMenuProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderTopMenuProvider.kt index 794be3671..e2fa85e0a 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderTopMenuProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderTopMenuProvider.kt @@ -19,7 +19,7 @@ class ReaderTopMenuProvider( override fun onPrepareMenu(menu: Menu) { menu.findItem(R.id.action_bookmark)?.let { bookmarkItem -> val hasPages = viewModel.content.value.pages.isNotEmpty() - bookmarkItem.isVisible = hasPages + bookmarkItem.isEnabled = hasPages if (hasPages) { val hasBookmark = viewModel.isBookmarkAdded.value bookmarkItem.setTitle(if (hasBookmark) R.string.bookmark_remove else R.string.bookmark_add) diff --git a/app/src/main/res/menu/opt_reader_top.xml b/app/src/main/res/menu/opt_reader_top.xml index 3b90d1957..6d7c73374 100644 --- a/app/src/main/res/menu/opt_reader_top.xml +++ b/app/src/main/res/menu/opt_reader_top.xml @@ -7,10 +7,9 @@ + app:showAsAction="always" />