From 445a9e2f13442b16ee6042c86abe3d3a6a3b486f Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 20 Oct 2020 22:53:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 12 ++++++------ app/src/main/res/layout/dialog_page_key.xml | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) 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" />