コード例 #1
0
    @Override
    public void run() {
      ImageView imageView = getImageView();
      if (null != imageView && mScroller.computeScrollOffset()) {

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

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

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

        mCurrentX = newX;
        mCurrentY = newY;

        // Post On animation
        Compat.postOnAnimation(imageView, this);
      }
    }
コード例 #2
0
    @Override
    public void run() {
      ImageView imageView = getImageView();
      if (imageView == null) {
        return;
      }

      float t = interpolate();
      float scale = mZoomStart + t * (mZoomEnd - mZoomStart);
      float deltaScale = scale / getScale();

      onScale(deltaScale, mFocalX, mFocalY);

      // We haven't hit our target scale yet, so post ourselves again
      if (t < 1f) {
        Compat.postOnAnimation(imageView, this);
      }
    }
コード例 #3
0
ファイル: PhotoViewAttacher.java プロジェクト: keqizwl/volley
    @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);
      }
    }
コード例 #4
0
    public void run() {
      ImageView imageView = getImageView();

      if (null != imageView) {
        mSuppMatrix.postScale(mDeltaScale, mDeltaScale, mFocalX, mFocalY);
        checkAndDisplayMatrix();

        final float currentScale = getScale();

        if ((mDeltaScale > 1f && currentScale < mTargetZoom)
            || (mDeltaScale < 1f && mTargetZoom < currentScale)) {
          // We haven't hit our target scale yet, so post ourselves
          // again
          Compat.postOnAnimation(imageView, this);

        } else {
          // We've scaled past our target zoom, so calculate the
          // necessary scale so we're back at target zoom
          final float delta = mTargetZoom / currentScale;
          mSuppMatrix.postScale(delta, delta, mFocalX, mFocalY);
          checkAndDisplayMatrix();
        }
      }
    }