|
|
@ -280,6 +280,18 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { |
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { |
|
|
|
when (keyCode) { |
|
|
|
when (keyCode) { |
|
|
|
|
|
|
|
getPrefInt(PreferKey.prevKey) -> { |
|
|
|
|
|
|
|
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) { |
|
|
|
|
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.PREV) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getPrefInt(PreferKey.nextKey) -> { |
|
|
|
|
|
|
|
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) { |
|
|
|
|
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
KeyEvent.KEYCODE_VOLUME_UP -> { |
|
|
|
KeyEvent.KEYCODE_VOLUME_UP -> { |
|
|
|
if (volumeKeyPage(PageDelegate.Direction.PREV)) { |
|
|
|
if (volumeKeyPage(PageDelegate.Direction.PREV)) { |
|
|
|
return true |
|
|
|
return true |
|
|
@ -294,18 +306,6 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT) |
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT) |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
getPrefInt(PreferKey.prevKey) -> { |
|
|
|
|
|
|
|
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) { |
|
|
|
|
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.PREV) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getPrefInt(PreferKey.nextKey) -> { |
|
|
|
|
|
|
|
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) { |
|
|
|
|
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return super.onKeyDown(keyCode, event) |
|
|
|
return super.onKeyDown(keyCode, event) |
|
|
|
} |
|
|
|
} |
|
|
|