private void stopDrag(MotionEvent ev){
  mTouchMode=TOUCH_MODE_IDLE;
  boolean commitChange=ev.getAction() == MotionEvent.ACTION_UP && isEnabled();
  cancelSuperTouch(ev);
  if (commitChange) {
    boolean newState;
    mVelocityTracker.computeCurrentVelocity(1000);
    float xvel=mVelocityTracker.getXVelocity();
    if (Math.abs(xvel) > mMinFlingVelocity) {
      newState=xvel > 0;
    }
 else {
      newState=getTargetCheckedState();
    }
    animateThumbToCheckedState(newState);
  }
 else {
    animateThumbToCheckedState(isChecked());
  }
}

private void stopDrag ( MotionEvent ev ) { mTouchMode = TOUCH_MODE_IDLE ; boolean commitChange = ev . getAction ( ) == MotionEvent . ACTION_UP && isEnabled ( ) ; cancelSuperTouch ( ev ) ; if ( commitChange ) { boolean newState ; mVelocityTracker . computeCurrentVelocity ( 1000 ) ; float xvel = mVelocityTracker . getXVelocity ( ) ; if ( Math . abs ( xvel ) > mMinFlingVelocity ) { newState = xvel > 0 ; } else { newState = getTargetCheckedState ( ) ; } animateThumbToCheckedState ( newState ) ; } else { animateThumbToCheckedState ( isChecked ( ) ) ; } }
called from ontouchevent to end a drag operation .
