@Override
 protected void onDetachedFromWindow() {
   cancelDragging();
   super.onDetachedFromWindow();
 }
 /*
  * Determines if we should change the touch state to start scrolling after the
  * user moves their touch point too far.
  */
 protected void determineScrollingStart(MotionEvent ev) {
   if (!mIsDragging) super.determineScrollingStart(ev);
 }