单章换源和更多刷新放到长按里面

pull/1678/head
kunfei 3 years ago
parent 8a0b89eb97
commit a5a4549167
  1. 14
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -198,24 +198,22 @@ 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.findItem(R.id.menu_change_source)?.setOnLongClickListener(menu) { menu.findItem(R.id.menu_change_source)?.setOnLongClickListener(menu) {
if (changeSourceMenu == null) { val changeSourceMenu = changeSourceMenu ?: PopupMenu(this, it).apply {
changeSourceMenu = 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.show()
changeSourceMenu!!.show()
} }
menu.findItem(R.id.menu_refresh)?.setOnLongClickListener(menu) { menu.findItem(R.id.menu_refresh)?.setOnLongClickListener(menu) {
if (refreshMenu == null) { val refreshMenu = refreshMenu ?: PopupMenu(this, it).apply {
refreshMenu = 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.show()
refreshMenu!!.show()
} }
return super.onCompatCreateOptionsMenu(menu) return super.onCompatCreateOptionsMenu(menu)
} }

Loading…
Cancel
Save