feat: 优化代码

pull/105/head
kunfei 5 years ago
parent b1ffc9a7aa
commit 7dd6dc3a6a
  1. 6
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt

@ -106,19 +106,17 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi
override fun setDirection(direction: Direction) { override fun setDirection(direction: Direction) {
super.setDirection(direction) super.setDirection(direction)
when (direction) { when (direction) {
Direction.PREV -> { Direction.PREV ->
//上一页滑动不出现对角 //上一页滑动不出现对角
if (startX > viewWidth / 2.0) { if (startX > viewWidth / 2.0) {
calcCornerXY(startX, viewHeight.toFloat()) calcCornerXY(startX, viewHeight.toFloat())
} else { } else {
calcCornerXY(viewWidth - startX, viewHeight.toFloat()) calcCornerXY(viewWidth - startX, viewHeight.toFloat())
} }
} Direction.NEXT ->
Direction.NEXT -> {
if (viewWidth / 2.0 > startX) { if (viewWidth / 2.0 > startX) {
calcCornerXY(viewWidth - startX, startY) calcCornerXY(viewWidth - startX, startY)
} }
}
else -> Unit else -> Unit
} }
} }

Loading…
Cancel
Save