@@ -283,6 +283,11 @@ public float getInterpolation(float t) {
283283 */
284284 private boolean isTouchNotTriggerScrollStick = false ;
285285
286+ /**
287+ * 判断手指触摸的view是否需要拦截事件
288+ */
289+ private boolean isIntercept = false ;
290+
286291 /**
287292 * 在快速滑动的过程中,触摸停止滑动
288293 */
@@ -647,6 +652,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
647652
648653 mDownLocation [0 ] = ScrollUtils .getRawX (this , ev , actionIndex );
649654 mDownLocation [1 ] = ScrollUtils .getRawY (this , ev , actionIndex );
655+ isIntercept = isIntercept (mDownLocation [0 ], mDownLocation [1 ]);
650656 isTouchNotTriggerScrollStick = ScrollUtils .isTouchNotTriggerScrollStick (this , mDownLocation [0 ], mDownLocation [1 ]);
651657 break ;
652658 case MotionEvent .ACTION_POINTER_DOWN :
@@ -658,6 +664,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
658664 requestDisallowInterceptTouchEvent (false );
659665 mDownLocation [0 ] = ScrollUtils .getRawX (this , ev , actionIndex );
660666 mDownLocation [1 ] = ScrollUtils .getRawY (this , ev , actionIndex );
667+ isIntercept = isIntercept (mDownLocation [0 ], mDownLocation [1 ]);
661668 isTouchNotTriggerScrollStick = ScrollUtils .isTouchNotTriggerScrollStick (this , mDownLocation [0 ], mDownLocation [1 ]);
662669
663670 initAdjustVelocityTrackerIfNotExists ();
@@ -677,7 +684,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
677684 int offsetY = (int ) ev .getY (pointerIndex ) - mEventY ;
678685 int offsetX = (int ) ev .getX (pointerIndex ) - mEventX ;
679686 if (SCROLL_ORIENTATION == SCROLL_NONE
680- && (isIntercept ( ev ) || isIntercept (mDownLocation [ 0 ], mDownLocation [ 1 ] ))) {
687+ && (isIntercept || isIntercept (ev ))) {
681688 if (disableChildHorizontalScroll ) {
682689 if (Math .abs (offsetY ) >= mTouchSlop ) {
683690 SCROLL_ORIENTATION = SCROLL_VERTICAL ;
@@ -723,6 +730,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
723730 mEventX = (int ) ev .getX (newPointerIndex );
724731 mDownLocation [0 ] = ScrollUtils .getRawX (this , ev , newPointerIndex );
725732 mDownLocation [1 ] = ScrollUtils .getRawY (this , ev , newPointerIndex );
733+ isIntercept = isIntercept (mDownLocation [0 ], mDownLocation [1 ]);
726734 isTouchNotTriggerScrollStick = ScrollUtils .isTouchNotTriggerScrollStick (this , mDownLocation [0 ], mDownLocation [1 ]);
727735 }
728736 initAdjustVelocityTrackerIfNotExists ();
@@ -767,6 +775,7 @@ && isIntercept(ev) && Math.abs(yVelocity) >= mMinimumVelocity) {
767775 mDownLocation [0 ] = 0 ;
768776 mDownLocation [1 ] = 0 ;
769777 isTouchNotTriggerScrollStick = false ;
778+ isIntercept = false ;
770779 overSpinner ();
771780 break ;
772781 }
@@ -803,7 +812,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
803812
804813 // 需要拦截事件
805814 if (SCROLL_ORIENTATION != SCROLL_HORIZONTAL
806- && (isIntercept ( ev ) || isIntercept (mDownLocation [ 0 ], mDownLocation [ 1 ] ))) {
815+ && (isIntercept || isIntercept (ev ))) {
807816 return true ;
808817 }
809818 break ;
0 commit comments