pull/52/head
kunfei 5 years ago
parent e96ac0a05a
commit 9ca429e6e2
  1. 11
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  2. 3
      app/src/main/res/menu/book_info.xml

@ -76,10 +76,21 @@ class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(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)

@ -15,7 +15,8 @@
<item
android:id="@+id/menu_can_update"
android:title="禁止更新"
android:title="允许更新"
android:checkable="true"
app:showAsAction="never" />
</menu>
Loading…
Cancel
Save