feat: 优化代码

pull/117/head
kunfei 5 years ago
parent 764c362af1
commit 0cdea9b7d9
  1. 28
      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
}
}

Loading…
Cancel
Save