@Override
  public boolean onTouchEvent(MotionEvent ev) {
    super.onTouchEvent(ev);

    if (velocityTracker == null) {
      velocityTracker = VelocityTracker.obtain();
    }
    velocityTracker.addMovement(ev);

    switch (ev.getAction()) {
      case MotionEvent.ACTION_DOWN:
        Log.d("ZoomRoll", "MotionEvent.ACTION_DOWN-----------1");
        if (!scroller.isFinished()) {
          scroller.abortAnimation();
          zoomModel.commit();
        }

        lastX = ev.getX();
        break;
      case MotionEvent.ACTION_MOVE:
        Log.d("ZoomRoll", "MotionEvent.ACTION_MOVE-----------2");
        setCurrentValue(getCurrentValue() - (ev.getX() - lastX));

        lastX = ev.getX();
        break;
      case MotionEvent.ACTION_UP:
        Log.d("ZoomRoll", "MotionEvent.ACTION_UP-----------3");
        velocityTracker.computeCurrentVelocity(1000);
        scroller.fling(
            (int) getCurrentValue(),
            0,
            (int) -velocityTracker.getXVelocity(),
            0,
            0,
            MAX_VALUE,
            0,
            0);
        velocityTracker.recycle();
        velocityTracker = null;

        if (!scroller.computeScrollOffset()) {
          zoomModel.commit();
        }
        break;
    }
    invalidate();
    return true;
  }
 @Override
 public void computeScroll() {
   if (scroller.computeScrollOffset()) {
     setCurrentValue(scroller.getCurrX());
     invalidate();
   } else {
     zoomModel.commit();
   }
 }