|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|