From 9ca429e6e2ffb59688a1ebc49208c5aaf81422f0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 4 Dec 2019 20:02:29 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/book/info/BookInfoActivity.kt | 11 +++++++++++ app/src/main/res/menu/book_info.xml | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index d7cd4637d..cf89e975c 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -76,10 +76,21 @@ class BookInfoActivity : VMBaseActivity(R.layout.activity_boo viewModel.loadBookInfo(it) } } + R.id.menu_can_update -> { + viewModel.bookData.value?.let { + it.canUpdate = !it.canUpdate + } + } } return super.onCompatOptionsItemSelected(item) } + override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean { + menu?.findItem(R.id.menu_can_update)?.isChecked = + viewModel.bookData.value?.canUpdate ?: true + return super.onMenuOpened(featureId, menu) + } + private fun showBook(book: Book) { tv_name.text = book.name tv_author.text = getString(R.string.author_show, book.author) diff --git a/app/src/main/res/menu/book_info.xml b/app/src/main/res/menu/book_info.xml index 75bf8d6db..2f36f90b4 100644 --- a/app/src/main/res/menu/book_info.xml +++ b/app/src/main/res/menu/book_info.xml @@ -15,7 +15,8 @@ \ No newline at end of file