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

pull/1678/head
kunfei 3 years ago
parent 8a0b89eb97
commit a5a4549167
  1. 26
      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 {
menuInflater.inflate(R.menu.book_read, menu)
menu.findItem(R.id.menu_change_source)?.setOnLongClickListener(menu) {
if (changeSourceMenu == null) {
changeSourceMenu = PopupMenu(this, it).apply {
inflate(R.menu.book_read_change_source)
this.menu.applyOpenTint(this@ReadBookActivity)
setOnMenuItemClickListener(this@ReadBookActivity)
}
val changeSourceMenu = changeSourceMenu ?: PopupMenu(this, it).apply {
inflate(R.menu.book_read_change_source)
this.menu.applyOpenTint(this@ReadBookActivity)
setOnMenuItemClickListener(this@ReadBookActivity)
changeSourceMenu = this
}
changeSourceMenu!!.show()
changeSourceMenu.show()
}
menu.findItem(R.id.menu_refresh)?.setOnLongClickListener(menu) {
if (refreshMenu == null) {
refreshMenu = PopupMenu(this, it).apply {
inflate(R.menu.book_read_refresh)
this.menu.applyOpenTint(this@ReadBookActivity)
setOnMenuItemClickListener(this@ReadBookActivity)
}
val refreshMenu = refreshMenu ?: PopupMenu(this, it).apply {
inflate(R.menu.book_read_refresh)
this.menu.applyOpenTint(this@ReadBookActivity)
setOnMenuItemClickListener(this@ReadBookActivity)
refreshMenu = this
}
refreshMenu!!.show()
refreshMenu.show()
}
return super.onCompatCreateOptionsMenu(menu)
}

Loading…
Cancel
Save