diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 6b518f89a..1fcab63cc 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -313,30 +313,30 @@ class ReadBookActivity : VMBaseActivity(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 } diff --git a/app/src/main/res/layout/dialog_page_key.xml b/app/src/main/res/layout/dialog_page_key.xml index f2e1c8a3a..ebcc8af7f 100644 --- a/app/src/main/res/layout/dialog_page_key.xml +++ b/app/src/main/res/layout/dialog_page_key.xml @@ -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" /> @@ -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" />