From 09bf55bcf4ae484abe03e9377a6158984ecb72bd Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Sep 2019 13:57:19 +0800 Subject: [PATCH] up --- .../io/legado/app/ui/widget/page/ContentTextView.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 fd406ea57..7b6665219 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 @@ -27,6 +27,7 @@ class ContentTextView : AppCompatTextView { private val scrollStateDragging = 1 val scrollStateSettling = 2 + private val mViewFling: ViewFling by lazy { ViewFling() } private var velocityTracker: VelocityTracker? = null private var mScrollState = scrollStateIdle private var mScrollPointerId = -1 @@ -34,7 +35,7 @@ class ContentTextView : AppCompatTextView { private var mTouchSlop: Int = 0 private var mMinFlingVelocity: Int = 0 private var mMaxFlingVelocity: Int = 0 - private val mViewFling = ViewFling() + //滑动距离的最大边界 private var mOffsetHeight: Int = 0 @@ -80,13 +81,8 @@ class ContentTextView : AppCompatTextView { initOffsetHeight() } - override fun onTextChanged( - text: CharSequence, - start: Int, - lengthBefore: Int, - lengthAfter: Int - ) { - super.onTextChanged(text, start, lengthBefore, lengthAfter) + override fun setText(text: CharSequence?, type: BufferType?) { + super.setText(text, type) initOffsetHeight() }