pull/2046/head
kunfei 2 years ago
parent 7746b7d53b
commit 1723cbe555
  1. 10
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -207,22 +207,20 @@ class ReadBookActivity : BaseReadBookActivity(),
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.book_read, menu) menuInflater.inflate(R.menu.book_read, menu)
menu.iconItemOnLongClick(R.id.menu_change_source) { menu.iconItemOnLongClick(R.id.menu_change_source) {
val changeSourceMenu = changeSourceMenu ?: PopupMenu(this, it).apply { PopupMenu(this, it).apply {
inflate(R.menu.book_read_change_source) inflate(R.menu.book_read_change_source)
this.menu.applyOpenTint(this@ReadBookActivity) this.menu.applyOpenTint(this@ReadBookActivity)
setOnMenuItemClickListener(this@ReadBookActivity) setOnMenuItemClickListener(this@ReadBookActivity)
changeSourceMenu = this changeSourceMenu = this
} }.show()
changeSourceMenu.show()
} }
menu.iconItemOnLongClick(R.id.menu_refresh) { menu.iconItemOnLongClick(R.id.menu_refresh) {
val refreshMenu = refreshMenu ?: PopupMenu(this, it).apply { PopupMenu(this, it).apply {
inflate(R.menu.book_read_refresh) inflate(R.menu.book_read_refresh)
this.menu.applyOpenTint(this@ReadBookActivity) this.menu.applyOpenTint(this@ReadBookActivity)
setOnMenuItemClickListener(this@ReadBookActivity) setOnMenuItemClickListener(this@ReadBookActivity)
refreshMenu = this refreshMenu = this
} }.show()
refreshMenu.show()
} }
return super.onCompatCreateOptionsMenu(menu) return super.onCompatCreateOptionsMenu(menu)
} }

Loading…
Cancel
Save