From ab2235d65dab068b8ace0974b8fe3736977fe735 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 19 Feb 2020 20:29:43 +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 | 56 ++++++++----------- 1 file changed, 24 insertions(+), 32 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 f149c9229..0f3f625e2 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 @@ -263,14 +263,13 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mFolderShadowDrawable = mFolderShadowDrawableRL } canvas.save() - kotlin.runCatching { - canvas.clipPath(mPath0) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - canvas.clipPath(mPath1) - } else { - canvas.clipPath(mPath1, Region.Op.INTERSECT) - } + canvas.clipPath(mPath0) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + canvas.clipPath(mPath1) + } else { + canvas.clipPath(mPath1, Region.Op.INTERSECT) } + mPaint.colorFilter = mColorMatrixFilter val dis = hypot( mCornerX - mBezierControl1.x.toDouble(), @@ -322,14 +321,13 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mPath1.lineTo(mBezierStart1.x, mBezierStart1.y) mPath1.close() canvas.save() - kotlin.runCatching { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - canvas.clipOutPath(mPath0) - } else { - canvas.clipPath(mPath0, Region.Op.XOR) - } - canvas.clipPath(mPath1, Region.Op.INTERSECT) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + canvas.clipOutPath(mPath0) + } else { + canvas.clipPath(mPath0, Region.Op.XOR) } + canvas.clipPath(mPath1, Region.Op.INTERSECT) + var leftX: Int var rightX: Int var mCurrentPageShadow: GradientDrawable @@ -362,14 +360,13 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mPath1.lineTo(mBezierStart2.x, mBezierStart2.y) mPath1.close() canvas.save() - kotlin.runCatching { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - canvas.clipOutPath(mPath0) - } else { - canvas.clipPath(mPath0, Region.Op.XOR) - } - canvas.clipPath(mPath1) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + canvas.clipOutPath(mPath0) + } else { + canvas.clipPath(mPath0, Region.Op.XOR) } + canvas.clipPath(mPath1) + if (mIsRtOrLb) { leftX = mBezierControl2.y.toInt() rightX = mBezierControl2.y.toInt() + 25 @@ -431,15 +428,12 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mBackShadowDrawable = mBackShadowDrawableRL } canvas.save() - kotlin.runCatching { - canvas.clipPath(mPath0) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - canvas.clipPath(mPath1) - } else { - canvas.clipPath(mPath1, Region.Op.INTERSECT) - } + canvas.clipPath(mPath0) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + canvas.clipPath(mPath1) + } else { + canvas.clipPath(mPath1, Region.Op.INTERSECT) } - canvas.drawBitmap(bitmap, 0f, 0f, null) canvas.rotate(mDegrees, mBezierStart1.x, mBezierStart1.y) mBackShadowDrawable.setBounds( @@ -471,9 +465,7 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi canvas.clipPath(path, Region.Op.XOR) } canvas.drawBitmap(bitmap, 0f, 0f, null) - kotlin.runCatching { - canvas.restore() - } + canvas.restore() } /**