private void adjustBottom(RectF rect,float bottom,RectF bounds,int viewHeight,float snapMargin,float aspectRatio,boolean leftMoves,boolean rightMoves){
  float newBottom=bottom;
  if (newBottom > viewHeight) {
    newBottom=viewHeight + (newBottom - viewHeight) / 1.05f;
    mTouchOffset.y-=(newBottom - viewHeight) / 1.1f;
  }
  if (newBottom > bounds.bottom) {
    mTouchOffset.y-=(newBottom - bounds.bottom) / 2f;
  }
  if (bounds.bottom - newBottom < snapMargin) {
    newBottom=bounds.bottom;
  }
  if (newBottom - rect.top < mMinCropHeight) {
    newBottom=rect.top + mMinCropHeight;
  }
  if (newBottom - rect.top > mMaxCropHeight) {
    newBottom=rect.top + mMaxCropHeight;
  }
  if (bounds.bottom - newBottom < snapMargin) {
    newBottom=bounds.bottom;
  }
  if (aspectRatio > 0) {
    float newWidth=(newBottom - rect.top) * aspectRatio;
    if (newWidth < mMinCropWidth) {
      newBottom=Math.min(bounds.bottom,rect.top + mMinCropWidth / aspectRatio);
      newWidth=(newBottom - rect.top) * aspectRatio;
    }
    if (newWidth > mMaxCropWidth) {
      newBottom=Math.min(bounds.bottom,rect.top + mMaxCropWidth / aspectRatio);
      newWidth=(newBottom - rect.top) * aspectRatio;
    }
    if (leftMoves && rightMoves) {
      newBottom=Math.min(newBottom,Math.min(bounds.bottom,rect.top + bounds.width() / aspectRatio));
    }
 else {
      if (leftMoves && rect.right - newWidth < bounds.left) {
        newBottom=Math.min(bounds.bottom,rect.top + (rect.right - bounds.left) / aspectRatio);
        newWidth=(newBottom - rect.top) * aspectRatio;
      }
      if (rightMoves && rect.left + newWidth > bounds.right) {
        newBottom=Math.min(newBottom,Math.min(bounds.bottom,rect.top + (bounds.right - rect.left) / aspectRatio));
      }
    }
  }
  rect.bottom=newBottom;
}

private void adjustBottom ( RectF rect , float bottom , RectF bounds , int viewHeight , float snapMargin , float aspectRatio , boolean leftMoves , boolean rightMoves ) { float newBottom = bottom ; if ( newBottom > viewHeight ) { newBottom = viewHeight + ( newBottom - viewHeight ) / 1.05f ; mTouchOffset . y -= ( newBottom - viewHeight ) / 1.1f ; } if ( newBottom > bounds . bottom ) { mTouchOffset . y -= ( newBottom - bounds . bottom ) / 2f ; } if ( bounds . bottom - newBottom < snapMargin ) { newBottom = bounds . bottom ; } if ( newBottom - rect . top < mMinCropHeight ) { newBottom = rect . top + mMinCropHeight ; } if ( newBottom - rect . top > mMaxCropHeight ) { newBottom = rect . top + mMaxCropHeight ; } if ( bounds . bottom - newBottom < snapMargin ) { newBottom = bounds . bottom ; } if ( aspectRatio > 0 ) { float newWidth = ( newBottom - rect . top ) * aspectRatio ; if ( newWidth < mMinCropWidth ) { newBottom = Math . min ( bounds . bottom , rect . top + mMinCropWidth / aspectRatio ) ; newWidth = ( newBottom - rect . top ) * aspectRatio ; } if ( newWidth > mMaxCropWidth ) { newBottom = Math . min ( bounds . bottom , rect . top + mMaxCropWidth / aspectRatio ) ; newWidth = ( newBottom - rect . top ) * aspectRatio ; } if ( leftMoves && rightMoves ) { newBottom = Math . min ( newBottom , Math . min ( bounds . bottom , rect . top + bounds . width ( ) / aspectRatio ) ) ; } else { if ( leftMoves && rect . right - newWidth < bounds . left ) { newBottom = Math . min ( bounds . bottom , rect . top + ( rect . right - bounds . left ) / aspectRatio ) ; newWidth = ( newBottom - rect . top ) * aspectRatio ; } if ( rightMoves && rect . left + newWidth > bounds . right ) { newBottom = Math . min ( newBottom , Math . min ( bounds . bottom , rect . top + ( bounds . right - rect . left ) / aspectRatio ) ) ; } } } rect . bottom = newBottom ; }
get the resulting y - position of the bottom edge of the crop window given the handle ' s position and the image ' s bounding box and snap radius .
