From 2868b89c38e2d39ad794c11a7a4d7250a2ca02ab Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 6 Mar 2020 18:26:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/page/delegate/CoverPageDelegate.kt | 6 ++++-- .../legado/app/ui/book/read/page/delegate/PageDelegate.kt | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/CoverPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/CoverPageDelegate.kt index c973fc87c..05437cd70 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/CoverPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/CoverPageDelegate.kt @@ -18,14 +18,16 @@ class CoverPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) { } override fun onDraw(canvas: Canvas) { + if (!isRunning) return val offsetX = touchX - startX if ((mDirection == Direction.NEXT && offsetX > 0) || (mDirection == Direction.PREV && offsetX < 0) - ) return + ) { + return + } val distanceX = if (offsetX > 0) offsetX - viewWidth else offsetX + viewWidth - if (!isRunning) return if (mDirection == Direction.PREV) { bitmapMatrix.setTranslate(distanceX, 0.toFloat()) curBitmap?.let { canvas.drawBitmap(it, 0f, 0f, null) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt index 125d6bb5f..044da0df1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt @@ -128,9 +128,11 @@ abstract class PageDelegate(protected val pageView: PageView) : private fun stopScroll() { isMoved = false - isRunning = false isStarted = false - pageView.invalidate() + pageView.post { + isRunning = false + pageView.invalidate() + } } open fun setViewSize(width: Int, height: Int) {