Fix bookmark action in reader
This commit is contained in:
@@ -212,6 +212,7 @@ class ReaderActivity :
|
||||
viewBinding.toastView.hide()
|
||||
}
|
||||
viewBinding.toolbarBottom.invalidateMenu()
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
override fun onGridTouch(area: TapGridArea): Boolean {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/action_bookmark"
|
||||
android:enabled="false"
|
||||
android:icon="@drawable/ic_bookmark"
|
||||
android:title="@string/bookmark_add"
|
||||
android:visible="false"
|
||||
app:showAsAction="always"
|
||||
tools:visible="true" />
|
||||
app:showAsAction="always" />
|
||||
|
||||
</menu>
|
||||
|
||||
Reference in New Issue
Block a user