From c6b5ec21f22b1170846f52781c712956ce8e6247 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Sep 2019 19:55:30 +0800 Subject: [PATCH] up --- .../app/ui/widget/page/ContentTextView.kt | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt index 986fbeefd..de0027c8f 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt @@ -125,31 +125,29 @@ class ContentTextView : AppCompatTextView { } MotionEvent.ACTION_MOVE -> { val index = event.findPointerIndex(mScrollPointerId) - if (index < 0) { - return false - } - - val y = (event.getY(index) + 0.5f).toInt() - var dy = mLastTouchY - y - - if (mScrollState != scrollStateDragging) { - var startScroll = false - - if (abs(dy) > mTouchSlop) { - if (dy > 0) { - dy -= mTouchSlop - } else { - dy += mTouchSlop + if (index > 0) { + val y = (event.getY(index) + 0.5f).toInt() + var dy = mLastTouchY - y + + if (mScrollState != scrollStateDragging) { + var startScroll = false + + if (abs(dy) > mTouchSlop) { + if (dy > 0) { + dy -= mTouchSlop + } else { + dy += mTouchSlop + } + startScroll = true + } + if (startScroll) { + setScrollState(scrollStateDragging) } - startScroll = true - } - if (startScroll) { - setScrollState(scrollStateDragging) } - } - if (mScrollState == scrollStateDragging) { - mLastTouchY = y + if (mScrollState == scrollStateDragging) { + mLastTouchY = y + } } } MotionEvent.ACTION_POINTER_UP -> {