pull/38/head
kunfei 5 years ago
parent 6dc231d1c7
commit 0f264eb0ce
  1. 6
      app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt

@ -109,14 +109,11 @@ class ContentTextView : AppCompatTextView {
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent?): Boolean { override fun onTouchEvent(event: MotionEvent?): Boolean {
event?.let { event?.let {
val action = event.action
val vtEvent = MotionEvent.obtain(event)
if (velocityTracker == null) { if (velocityTracker == null) {
velocityTracker = VelocityTracker.obtain() velocityTracker = VelocityTracker.obtain()
} }
velocityTracker?.addMovement(it) velocityTracker?.addMovement(it)
when (action) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
setScrollState(scrollStateIdle) setScrollState(scrollStateIdle)
mLastTouchY = (event.y + 0.5f).toInt() mLastTouchY = (event.y + 0.5f).toInt()
@ -159,7 +156,6 @@ class ContentTextView : AppCompatTextView {
resetTouch() resetTouch()
} }
} }
vtEvent.recycle()
} }
return super.onTouchEvent(event) return super.onTouchEvent(event)
} }

Loading…
Cancel
Save