From 0cdea9b7d97388a5bbbac358b2af877ee0a2fd85 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 25 Feb 2020 21:52:15 +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 --- .../page/delegate/SimulationPageDelegate.kt | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt index 385ed7140..713748aed 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt @@ -219,18 +219,22 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi } override fun onDraw(canvas: Canvas) { - if (mDirection === Direction.NEXT) { - calcPoints() - drawCurrentPageArea(canvas, curBitmap) - drawNextPageAreaAndShadow(canvas, nextBitmap) - drawCurrentPageShadow(canvas) - drawCurrentBackArea(canvas, curBitmap) - } else { - calcPoints() - drawCurrentPageArea(canvas, prevBitmap) - drawNextPageAreaAndShadow(canvas, curBitmap) - drawCurrentPageShadow(canvas) - drawCurrentBackArea(canvas, prevBitmap) + when (mDirection) { + Direction.NEXT -> { + calcPoints() + drawCurrentPageArea(canvas, curBitmap) + drawNextPageAreaAndShadow(canvas, nextBitmap) + drawCurrentPageShadow(canvas) + drawCurrentBackArea(canvas, curBitmap) + } + Direction.PREV -> { + calcPoints() + drawCurrentPageArea(canvas, prevBitmap) + drawNextPageAreaAndShadow(canvas, curBitmap) + drawCurrentPageShadow(canvas) + drawCurrentBackArea(canvas, prevBitmap) + } + else -> Unit } }