private void handleCropWindowChanged(boolean inProgress,boolean animate){
  int width=getWidth();
  int height=getHeight();
  if (mBitmap != null && width > 0 && height > 0) {
    RectF cropRect=mCropOverlayView.getCropWindowRect();
    if (inProgress) {
      if (cropRect.left < 0 || cropRect.top < 0 || cropRect.right > width || cropRect.bottom > height) {
        applyImageMatrix(width,height,false,false);
      }
    }
 else     if (mAutoZoomEnabled || mZoom > 1) {
      float newZoom=0;
      if (mZoom < mMaxZoom && cropRect.width() < width * 0.5f && cropRect.height() < height * 0.5f) {
        newZoom=Math.min(mMaxZoom,Math.min(width / (cropRect.width() / mZoom / 0.64f),height / (cropRect.height() / mZoom / 0.64f)));
      }
      if (mZoom > 1 && (cropRect.width() > width * 0.65f || cropRect.height() > height * 0.65f)) {
        newZoom=Math.max(1,Math.min(width / (cropRect.width() / mZoom / 0.51f),height / (cropRect.height() / mZoom / 0.51f)));
      }
      if (!mAutoZoomEnabled) {
        newZoom=1;
      }
      if (newZoom > 0 && newZoom != mZoom) {
        if (animate) {
          if (mAnimation == null) {
            mAnimation=new CropImageAnimation(mImageView,mCropOverlayView);
          }
          mAnimation.setStartState(mImagePoints,mImageMatrix);
        }
        updateCropRectByZoomChange(newZoom / mZoom);
        mZoom=newZoom;
        applyImageMatrix(width,height,true,animate);
      }
    }
  }
}

private void handleCropWindowChanged ( boolean inProgress , boolean animate ) { int width = getWidth ( ) ; int height = getHeight ( ) ; if ( mBitmap != null && width > 0 && height > 0 ) { RectF cropRect = mCropOverlayView . getCropWindowRect ( ) ; if ( inProgress ) { if ( cropRect . left < 0 || cropRect . top < 0 || cropRect . right > width || cropRect . bottom > height ) { applyImageMatrix ( width , height , false , false ) ; } } else if ( mAutoZoomEnabled || mZoom > 1 ) { float newZoom = 0 ; if ( mZoom < mMaxZoom && cropRect . width ( ) < width * 0.5f && cropRect . height ( ) < height * 0.5f ) { newZoom = Math . min ( mMaxZoom , Math . min ( width / ( cropRect . width ( ) / mZoom / 0.64f ) , height / ( cropRect . height ( ) / mZoom / 0.64f ) ) ) ; } if ( mZoom > 1 && ( cropRect . width ( ) > width * 0.65f || cropRect . height ( ) > height * 0.65f ) ) { newZoom = Math . max ( 1 , Math . min ( width / ( cropRect . width ( ) / mZoom / 0.51f ) , height / ( cropRect . height ( ) / mZoom / 0.51f ) ) ) ; } if ( ! mAutoZoomEnabled ) { newZoom = 1 ; } if ( newZoom > 0 && newZoom != mZoom ) { if ( animate ) { if ( mAnimation == null ) { mAnimation = new CropImageAnimation ( mImageView , mCropOverlayView ) ; } mAnimation . setStartState ( mImagePoints , mImageMatrix ) ; } updateCropRectByZoomChange ( newZoom / mZoom ) ; mZoom = newZoom ; applyImageMatrix ( width , height , true , animate ) ; } } } }
handle crop window change to : < br > 1 . execute auto - zoom - in / out depending on the area covered of cropping window relative to the available view area . < br > 2 . slide the zoomed sub - area if the cropping window is outside of the visible view sub - area . < br >
