예제 #1
0
  @Override
  public void onFling(float startX, float startY, float velocityX, float velocityY) {
    DraweeView<GenericDraweeHierarchy> draweeView = getDraweeView();
    if (draweeView == null) {
      return;
    }

    mCurrentFlingRunnable = new FlingRunnable(draweeView.getContext());
    mCurrentFlingRunnable.fling(getViewWidth(), getViewHeight(), (int) velocityX, (int) velocityY);
    draweeView.post(mCurrentFlingRunnable);
  }
예제 #2
0
  private void checkMinScale() {
    DraweeView<GenericDraweeHierarchy> draweeView = getDraweeView();
    if (draweeView == null) {
      return;
    }

    if (getScale() < mMinScale) {
      RectF rect = getDisplayRect();
      if (null != rect) {
        draweeView.post(
            new AnimatedZoomRunnable(getScale(), mMinScale, rect.centerX(), rect.centerY()));
      }
    }
  }
예제 #3
0
  @Override
  public void setScale(float scale, float focalX, float focalY, boolean animate) {
    DraweeView<GenericDraweeHierarchy> draweeView = getDraweeView();

    if (draweeView == null || scale < mMinScale || scale > mMaxScale) {
      return;
    }

    if (animate) {
      draweeView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
    } else {
      mMatrix.setScale(scale, scale, focalX, focalY);
      checkMatrixAndInvalidate();
    }
  }