Ejemplo n.º 1
0
    @Override
    public void run() {
      if (mScroller.isFinished()) {
        return; // remaining post that should not be handled
      }

      ImageView imageView = getImageView();
      if (null != imageView && mScroller.computeScrollOffset()) {

        final int newX = mScroller.getCurrX();
        final int newY = mScroller.getCurrY();

        if (DEBUG) {
          LogManager.getLogger()
              .d(
                  LOG_TAG,
                  "fling run(). CurrentX:"
                      + mCurrentX
                      + " CurrentY:"
                      + mCurrentY
                      + " NewX:"
                      + newX
                      + " NewY:"
                      + newY);
        }

        mSuppMatrix.postTranslate(mCurrentX - newX, mCurrentY - newY);
        setImageViewMatrix(getDrawMatrix());

        mCurrentX = newX;
        mCurrentY = newY;

        // Post On animation
        Compat.postOnAnimation(imageView, this);
      }
    }