From 796732f97d7992f9f87ffa5cc91b2734ceb655d0 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 31 Jul 2021 23:36:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BB=E7=95=8C=E9=9D=A2=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=98=BE=E7=A4=BA=E7=9A=84=E6=97=B6=E5=80=99=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E6=8C=89=E9=94=AE=E7=BF=BB=E9=A1=B5=E5=92=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=98=85=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/ReadBookActivity.kt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 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 23bee2fdd..4f754fa1c 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 @@ -125,6 +125,7 @@ class ReadBookActivity : ReadBookBaseActivity(), private var loadStates: Boolean = false override val pageFactory: TextPageFactory get() = binding.readView.pageFactory override val headerHeight: Int get() = binding.readView.curPage.headerHeight + private val menuLayoutIsVisible get() = bottomDialog > 0 || binding.readMenu.isVisible @SuppressLint("ClickableViewAccessibility") override fun onActivityCreated(savedInstanceState: Bundle?) { @@ -330,6 +331,9 @@ class ReadBookActivity : ReadBookBaseActivity(), * 按键事件 */ override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { + if (menuLayoutIsVisible) { + return super.onKeyDown(keyCode, event) + } when { isPrevKey(keyCode) -> { if (keyCode != KeyEvent.KEYCODE_UNKNOWN) { @@ -699,17 +703,19 @@ class ReadBookActivity : ReadBookBaseActivity(), delayMillis = 20 } mHandler.removeCallbacks(autoPageRunnable) - if (binding.readView.isScroll) { - binding.readView.curPage.scroll(-scrollOffset) - } else { - autoPageProgress += scrollOffset - if (autoPageProgress >= binding.readView.height) { - autoPageProgress = 0 - if (!binding.readView.fillPage(PageDirection.NEXT)) { - autoPageStop() - } + if (!menuLayoutIsVisible) { + if (binding.readView.isScroll) { + binding.readView.curPage.scroll(-scrollOffset) } else { - binding.readView.invalidate() + autoPageProgress += scrollOffset + if (autoPageProgress >= binding.readView.height) { + autoPageProgress = 0 + if (!binding.readView.fillPage(PageDirection.NEXT)) { + autoPageStop() + } + } else { + binding.readView.invalidate() + } } } mHandler.postDelayed(autoPageRunnable, delayMillis)