33import android .content .Context ;
44import android .os .Build ;
55import android .support .annotation .NonNull ;
6- import android .telephony .TelephonyManager ;
76import android .view .MotionEvent ;
87import android .view .VelocityTracker ;
98import android .view .ViewGroup ;
@@ -127,7 +126,9 @@ public boolean onTouch(View view, MotionEvent evt) {
127126 private void onDown (MotionEvent evt ) {
128127 beginPoint .x = lastPoint .x = evt .getX ();
129128 beginPoint .y = lastPoint .y = evt .getY ();
130- cancelAllAnimations ();
129+ if (cancelAllAnimations ()) {
130+ this .dragging = true ;
131+ }
131132 if (momentumScrolling ) {
132133 momentumScrolling = false ;
133134 sendEvent ("onMomentumScrollEnd" , null );
@@ -150,7 +151,7 @@ private void onUp(MotionEvent evt) {
150151 tracker .computeCurrentVelocity (1 );
151152 float vy = tracker .getYVelocity ();
152153 float vx = tracker .getXVelocity ();
153- if (inverted && Build .VERSION .SDK_INT >= 28 ) {
154+ if (inverted && Build .VERSION .SDK_INT >= 28 ) {
154155 vx = -vx ;
155156 vy = -vy ;
156157 }
@@ -371,15 +372,17 @@ protected void onUpdate(float value) {
371372 verticalAnimation .start ();
372373 }
373374
374- private void cancelAllAnimations () {
375+ private boolean cancelAllAnimations () {
376+ boolean cancel = false ;
375377 if (verticalAnimation != null ) {
376- verticalAnimation .cancel ();
378+ cancel = verticalAnimation .cancel ();
377379 verticalAnimation = null ;
378380 }
379381 if (horizontalAnimation != null ) {
380- horizontalAnimation .cancel ();
382+ cancel = horizontalAnimation .cancel ();
381383 horizontalAnimation = null ;
382384 }
385+ return cancel ;
383386 }
384387
385388
0 commit comments