pull/436/head
gedoor 4 years ago
parent cfa8460e1d
commit 445a9e2f13
  1. 12
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  2. 2
      app/src/main/res/layout/dialog_page_key.xml

@ -313,30 +313,30 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
* 按键事件
*/
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
getPrefInt(PreferKey.prevKeys) -> {
when {
getPrefString(PreferKey.prevKeys)?.contains(keyCode.toString()) == true -> {
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) {
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.PREV)
return true
}
}
getPrefInt(PreferKey.nextKeys) -> {
getPrefString(PreferKey.nextKeys)?.contains(keyCode.toString()) == true -> {
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) {
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT)
return true
}
}
KeyEvent.KEYCODE_VOLUME_UP -> {
keyCode == KeyEvent.KEYCODE_VOLUME_UP -> {
if (volumeKeyPage(PageDelegate.Direction.PREV)) {
return true
}
}
KeyEvent.KEYCODE_VOLUME_DOWN -> {
keyCode == KeyEvent.KEYCODE_VOLUME_DOWN -> {
if (volumeKeyPage(PageDelegate.Direction.NEXT)) {
return true
}
}
KeyEvent.KEYCODE_SPACE -> {
keyCode == KeyEvent.KEYCODE_SPACE -> {
page_view.pageDelegate?.keyTurnPage(PageDelegate.Direction.NEXT)
return true
}

@ -26,7 +26,6 @@
android:id="@+id/et_prev"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:singleLine="true" />
</io.legado.app.ui.widget.text.TextInputLayout>
@ -41,7 +40,6 @@
android:id="@+id/et_next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:singleLine="true" />
</io.legado.app.ui.widget.text.TextInputLayout>

Loading…
Cancel
Save