pull/34/head
kunfei 5 years ago
parent 8a653f17ac
commit ff717c16d2
  1. 16
      app/src/main/java/io/legado/app/ui/widget/page/delegate/PageDelegate.kt

@ -274,7 +274,9 @@ abstract class PageDelegate(protected val pageView: PageView) {
if (!isMoved && abs(distanceX) < abs(distanceY)) { if (!isMoved && abs(distanceX) < abs(distanceY)) {
if (distanceY < 0) { if (distanceY < 0) {
if (atTop) { if (atTop) {
curPage?.dispatchTouchEvent(e1.toAction(MotionEvent.ACTION_UP)) val event = e1.toAction(MotionEvent.ACTION_UP)
curPage?.dispatchTouchEvent(event)
event.recycle()
//上一页的参数配置 //上一页的参数配置
direction = Direction.PREV direction = Direction.PREV
//判断是否上一页存在 //判断是否上一页存在
@ -289,7 +291,9 @@ abstract class PageDelegate(protected val pageView: PageView) {
} }
} else { } else {
if (atBottom) { if (atBottom) {
curPage?.dispatchTouchEvent(e1.toAction(MotionEvent.ACTION_UP)) val event = e1.toAction(MotionEvent.ACTION_UP)
curPage?.dispatchTouchEvent(event)
event.recycle()
//进行下一页的配置 //进行下一页的配置
direction = Direction.NEXT direction = Direction.NEXT
//判断是否下一页存在 //判断是否下一页存在
@ -309,8 +313,11 @@ abstract class PageDelegate(protected val pageView: PageView) {
//传递触摸事件到textView //传递触摸事件到textView
curPage?.dispatchTouchEvent(e2) curPage?.dispatchTouchEvent(e2)
} }
} else if (!isMoved && abs(distanceX) > abs(distanceY)) { } else if (!isMoved) {
curPage?.dispatchTouchEvent(e1.toAction(MotionEvent.ACTION_UP)) val event = e1.toAction(MotionEvent.ACTION_UP)
curPage?.dispatchTouchEvent(event)
event.recycle()
if (abs(distanceX) > abs(distanceY)) {
if (distanceX < 0) { if (distanceX < 0) {
//上一页的参数配置 //上一页的参数配置
direction = Direction.PREV direction = Direction.PREV
@ -338,6 +345,7 @@ abstract class PageDelegate(protected val pageView: PageView) {
} }
isMoved = true isMoved = true
} }
}
if (isMoved) { if (isMoved) {
isCancel = if (pageView.isScrollDelegate) { isCancel = if (pageView.isScrollDelegate) {
if (direction == Direction.NEXT) distanceY < 0 else distanceY > 0 if (direction == Direction.NEXT) distanceY < 0 else distanceY > 0

Loading…
Cancel
Save