Example #1
0
    /**
     * 描述:TODO
     *
     * @see java.lang.Runnable#run()
     * @author: zhaoqp
     * @date:2013-11-28 上午11:14:35
     * @version v1.0
     */
    public void run() {
      if (CarouselView.this.getChildCount() == 0) {
        endFling(true);
        return;
      }

      mShouldStopFling = false;

      final Rotator rotator;
      final float angle;
      boolean more;
      synchronized (this) {
        rotator = mRotator;
        more = rotator.computeAngleOffset();
        angle = rotator.getCurrAngle();
      }

      // Flip sign to convert finger direction to list items direction
      // (e.g. finger moving down means list is moving towards the top)
      float delta = mLastFlingAngle - angle;

      //////// Shoud be reworked
      trackMotionScroll(delta);

      if (more && !mShouldStopFling) {
        mLastFlingAngle = angle;
        post(this);
      } else {
        mLastFlingAngle = 0.0f;
        endFling(true);
      }
    }