From 02cf8d022b68896d77b3759498d820b0068a93c5 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 20 Sep 2019 15:14:53 +0800 Subject: [PATCH] up --- .../ui/widget/page/delegate/CoverPageDelegate.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/delegate/CoverPageDelegate.kt b/app/src/main/java/io/legado/app/ui/widget/page/delegate/CoverPageDelegate.kt index 011e7c53f..af4f368aa 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/delegate/CoverPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/delegate/CoverPageDelegate.kt @@ -57,11 +57,15 @@ class CoverPageDelegate(pageView: PageView) : PageDelegate(pageView) { val distanceX = if (offsetX > 0) offsetX - viewWidth else offsetX + viewWidth bitmap?.let { - if (distanceX < 0) { - bitmapMatrix.setTranslate(distanceX, 0.toFloat()) - canvas.drawBitmap(it, bitmapMatrix, null) - } else { - curPage?.translationX = offsetX + when (direction) { + Direction.PREV -> { + bitmapMatrix.setTranslate(distanceX, 0.toFloat()) + canvas.drawBitmap(it, bitmapMatrix, null) + } + Direction.NEXT -> { + curPage?.translationX = offsetX + } + Direction.NONE -> Unit } addShadow(distanceX.toInt(), canvas) } @@ -71,7 +75,7 @@ class CoverPageDelegate(pageView: PageView) : PageDelegate(pageView) { if (left < 0) { shadowDrawableR.setBounds(left + viewWidth, 0, left + viewWidth + 30, viewHeight) shadowDrawableR.draw(canvas) - } else { + } else if (left > 0) { shadowDrawableR.setBounds(left, 0, left + 30, viewHeight) shadowDrawableR.draw(canvas) }