/**
   * Handles Touch event
   *
   * @param event the motion event
   * @return
   */
  public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        lastTouchedPosition = getMotionEventPosition(event);
        scroller.forceFinished(true);
        clearMessages();
        listener.onTouch();
        break;

      case MotionEvent.ACTION_UP:
        if (scroller.isFinished()) listener.onTouchUp();
        break;

      case MotionEvent.ACTION_MOVE:
        // perform scrolling
        int distance = (int) (getMotionEventPosition(event) - lastTouchedPosition);
        if (distance != 0) {
          startScrolling();
          listener.onScroll(distance);
          lastTouchedPosition = getMotionEventPosition(event);
        }
        break;
    }

    if (!gestureDetector.onTouchEvent(event) && event.getAction() == MotionEvent.ACTION_UP) {
      justify();
    }

    return true;
  }
 /**
  * Scroll the spinnerwheel
  *
  * @param distance the scrolling distance
  * @param time the scrolling duration
  */
 public void scroll(int distance, int time) {
   scroller.forceFinished(true);
   lastScrollPosition = 0;
   scrollerStartScroll(distance, time != 0 ? time : SCROLLING_DURATION);
   setNextMessage(MESSAGE_SCROLL);
   startScrolling();
 }