pull/66/head
kunfei 5 years ago
parent 86049f4208
commit 3c22a6a02f
  1. 9
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -239,6 +239,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
return super.onKeyDown(keyCode, event)
}
/**
* 长按事件
*/
override fun onKeyLongPress(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
@ -249,6 +252,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
return super.onKeyLongPress(keyCode, event)
}
/**
* 松开按键事件
*/
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_VOLUME_UP, KeyEvent.KEYCODE_VOLUME_DOWN -> {
@ -274,6 +280,9 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
return super.onKeyUp(keyCode, event)
}
/**
* 音量键翻页
*/
private fun volumeKeyPage(direction: PageDelegate.Direction): Boolean {
if (!read_menu.isVisible) {
if (getPrefBoolean("volumeKeyPage", true)) {

Loading…
Cancel
Save