|
|
|
@ -280,6 +280,18 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
|
*/ |
|
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { |
|
|
|
|
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 -> { |
|
|
|
|
if (volumeKeyPage(PageDelegate.Direction.PREV)) { |
|
|
|
|
return true |
|
|
|
@ -294,18 +306,6 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo |
|
|
|
|
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT) |
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|