private void moveSizeWithFixedAspectRatio(
      RectF rect,
      float x,
      float y,
      RectF bounds,
      int viewWidth,
      int viewHeight,
      float snapMargin,
      float aspectRatio) {
    switch (mType) {
      case TOP_LEFT:
        if (calculateAspectRatio(x, y, rect.right, rect.bottom) < aspectRatio) {
          adjustTop(rect, y, bounds, snapMargin, aspectRatio, true, false);
          adjustLeftByAspectRatio(rect, aspectRatio);
        } else {
          adjustLeft(rect, x, bounds, snapMargin, aspectRatio, true, false);
          adjustTopByAspectRatio(rect, aspectRatio);
        }
        break;
      case TOP_RIGHT:
        if (calculateAspectRatio(rect.left, y, x, rect.bottom) < aspectRatio) {
          adjustTop(rect, y, bounds, snapMargin, aspectRatio, false, true);
          adjustRightByAspectRatio(rect, aspectRatio);
        } else {
          adjustRight(rect, x, bounds, viewWidth, snapMargin, aspectRatio, true, false);
          adjustTopByAspectRatio(rect, aspectRatio);
        }
        break;
      case BOTTOM_LEFT:
        if (calculateAspectRatio(x, rect.top, rect.right, y) < aspectRatio) {
          adjustBottom(rect, y, bounds, viewHeight, snapMargin, aspectRatio, true, false);
          adjustLeftByAspectRatio(rect, aspectRatio);
        } else {
          adjustLeft(rect, x, bounds, snapMargin, aspectRatio, false, true);
          adjustBottomByAspectRatio(rect, aspectRatio);
        }
        break;
      case BOTTOM_RIGHT:
        if (calculateAspectRatio(rect.left, rect.top, x, y) < aspectRatio) {
          adjustBottom(rect, y, bounds, viewHeight, snapMargin, aspectRatio, false, true);
          adjustRightByAspectRatio(rect, aspectRatio);
        } else {
          adjustRight(rect, x, bounds, viewWidth, snapMargin, aspectRatio, false, true);
          adjustBottomByAspectRatio(rect, aspectRatio);
        }
        break;
      case LEFT:
        adjustLeft(rect, x, bounds, snapMargin, aspectRatio, true, true);
        adjustTopBottomByAspectRatio(rect, bounds, aspectRatio);
        break;
      case TOP:
        adjustTop(rect, y, bounds, snapMargin, aspectRatio, true, true);
        adjustLeftRightByAspectRatio(rect, bounds, aspectRatio);
        break;
      case RIGHT:
        adjustRight(rect, x, bounds, viewWidth, snapMargin, aspectRatio, true, true);
        adjustTopBottomByAspectRatio(rect, bounds, aspectRatio);
        break;
      case BOTTOM:
        adjustBottom(rect, y, bounds, viewHeight, snapMargin, aspectRatio, true, true);
        adjustLeftRightByAspectRatio(rect, bounds, aspectRatio);
        break;
      default:
        break;
    }
  }
Change the size of the crop window on the required "primary" edge WITH affect to relevant
"secondary" edge via aspect ratio.<br>
Example: change in the left edge (primary) will affect top and bottom edges (secondary) to
preserve the given aspect ratio.
core/src/main/java/com/theartofdev/edmodo/cropper/CropWindowMoveHandler.java