pull/83/head
kunfei 5 years ago
parent c1f51e3bd4
commit 5b7c6bcaab
  1. 5
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt

@ -52,10 +52,13 @@ abstract class BaseActivity(
} ?: super.onCreateOptionsMenu(menu) } ?: super.onCreateOptionsMenu(menu)
} }
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean {
menu?.let {
menu.applyOpenTint(this) menu.applyOpenTint(this)
return super.onMenuOpened(featureId, menu) return super.onMenuOpened(featureId, menu)
} }
return true
}
open fun onCompatCreateOptionsMenu(menu: Menu): Boolean { open fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
return super.onCreateOptionsMenu(menu) return super.onCreateOptionsMenu(menu)

@ -98,8 +98,8 @@ class BookInfoActivity :
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean {
menu.findItem(R.id.menu_can_update)?.isChecked = menu?.findItem(R.id.menu_can_update)?.isChecked =
viewModel.bookData.value?.canUpdate ?: true viewModel.bookData.value?.canUpdate ?: true
return super.onMenuOpened(featureId, menu) return super.onMenuOpened(featureId, menu)
} }

Loading…
Cancel
Save