From 805cc907e25354e81b6834e3604bd5f462b469f4 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 Mar 2020 22:03:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/read/page/delegate/NoAnimPageDelegate.kt | 11 +++-------- .../app/ui/book/read/page/delegate/PageDelegate.kt | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt index 52dc2aeeb..cf18cb1db 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt @@ -1,19 +1,14 @@ package io.legado.app.ui.book.read.page.delegate -import android.graphics.Canvas import io.legado.app.ui.book.read.page.PageView class NoAnimPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) { - override fun onAnimStart() { - startScroll(touchX.toInt(), 0, 0, 0) - } - - override fun onDraw(canvas: Canvas) { - } - override fun onAnimStop() { + override fun onAnimStart() { if (!isCancel) { pageView.fillPage(mDirection) } + stopScroll() } + } \ No newline at end of file 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 e85a073cf..4173ffb09 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 @@ -126,7 +126,7 @@ abstract class PageDelegate(protected val pageView: PageView) : pageView.invalidate() } - private fun stopScroll() { + protected fun stopScroll() { isStarted = false pageView.post { isMoved = false From 5f7c18a781f3c9e8513920db2b8e912d9d3db68d Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 8 Mar 2020 22:08:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/page/delegate/HorizontalPageDelegate.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt index b10503fc8..8fe4fb699 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt @@ -93,7 +93,7 @@ abstract class HorizontalPageDelegate(pageView: PageView) : PageDelegate(pageVie } } if (isMoved) { - isCancel = if (mDirection == Direction.NEXT) touchX > lastX else touchX < lastX + isCancel = if (mDirection == Direction.NEXT) sumX > lastX else sumX < lastX isRunning = true //设置触摸点 setTouchPoint(sumX, sumY)