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) {