|
@@ -208,6 +208,11 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
|
|
*/
|
|
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
|
|
menuInflater.inflate(R.menu.reader, menu)
|
|
|
+
|
|
|
+ val isChapterBookmarked = presenter?.getCurrentChapter()?.chapter?.bookmark ?: false
|
|
|
+ menu.findItem(R.id.action_bookmark).isVisible = !isChapterBookmarked
|
|
|
+ menu.findItem(R.id.action_remove_bookmark).isVisible = isChapterBookmarked
|
|
|
+
|
|
|
return true
|
|
|
}
|
|
|
|
|
@@ -217,6 +222,14 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
|
|
*/
|
|
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
|
when (item.itemId) {
|
|
|
+ R.id.action_bookmark -> {
|
|
|
+ presenter.bookmarkCurrentChapter(true)
|
|
|
+ invalidateOptionsMenu()
|
|
|
+ }
|
|
|
+ R.id.action_remove_bookmark -> {
|
|
|
+ presenter.bookmarkCurrentChapter(false)
|
|
|
+ invalidateOptionsMenu()
|
|
|
+ }
|
|
|
R.id.action_settings -> ReaderSettingsSheet(this).show()
|
|
|
R.id.action_custom_filter -> ReaderColorFilterSheet(this).show()
|
|
|
}
|
|
@@ -402,6 +415,9 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
|
|
please_wait.gone()
|
|
|
viewer?.setChapters(viewerChapters)
|
|
|
toolbar.subtitle = viewerChapters.currChapter.chapter.name
|
|
|
+
|
|
|
+ // Invalidate menu to show proper chapter bookmark state
|
|
|
+ invalidateOptionsMenu()
|
|
|
}
|
|
|
|
|
|
/**
|