ucrop/src/main/java/com/yalantis/ucrop/UCropActivity.java
/**
     * This method extracts {@link com.yalantis.ucrop.UCrop.Options #optionsBundle} from incoming intent
     * and setups Activity, {@link OverlayView} and {@link CropImageView} properly.
     */
This method extracts  com.yalantis.ucrop.UCrop.Options #optionsBundle from incoming intent
and setups Activity,  OverlayView and  CropImageView properly.
This method extracts com . yalantis . ucrop . UCrop . Options #optionsBundle from incoming intent and setups Activity OverlayView and CropImageView properly .
@SuppressWarnings("deprecation")
    private void processOptions(@NonNull Intent intent) {
        String compressionFormatName = intent.getStringExtra(UCrop.Options.EXTRA_COMPRESSION_FORMAT_NAME);
        Bitmap.CompressFormat compressFormat = null;
        if (!TextUtils.isEmpty(compressionFormatName)) {
            compressFormat = Bitmap.CompressFormat.valueOf(compressionFormatName);
        }
        mCompressFormat = (compressFormat == null) ? DEFAULT_COMPRESS_FORMAT : compressFormat;
        mCompressQuality = intent.getIntExtra(UCrop.Options.EXTRA_COMPRESSION_QUALITY, UCropActivity.DEFAULT_COMPRESS_QUALITY);
        int[] allowedGestures = intent.getIntArrayExtra(UCrop.Options.EXTRA_ALLOWED_GESTURES);
        if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
            mAllowedGestures = allowedGestures;
        }
        mGestureCropImageView.setMaxBitmapSize(intent.getIntExtra(UCrop.Options.EXTRA_MAX_BITMAP_SIZE, CropImageView.DEFAULT_MAX_BITMAP_SIZE));
        mGestureCropImageView.setMaxScaleMultiplier(intent.getFloatExtra(UCrop.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER));
        mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(intent.getIntExtra(UCrop.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION));
        mOverlayView.setFreestyleCropEnabled(intent.getBooleanExtra(UCrop.Options.EXTRA_FREE_STYLE_CROP, OverlayView.DEFAULT_FREESTYLE_CROP_MODE != OverlayView.FREESTYLE_CROP_MODE_DISABLE));
        mOverlayView.setDimmedColor(intent.getIntExtra(UCrop.Options.EXTRA_DIMMED_LAYER_COLOR, getResources().getColor(R.color.ucrop_color_default_dimmed)));
        mOverlayView.setCircleDimmedLayer(intent.getBooleanExtra(UCrop.Options.EXTRA_CIRCLE_DIMMED_LAYER, OverlayView.DEFAULT_CIRCLE_DIMMED_LAYER));
        mOverlayView.setShowCropFrame(intent.getBooleanExtra(UCrop.Options.EXTRA_SHOW_CROP_FRAME, OverlayView.DEFAULT_SHOW_CROP_FRAME));
        mOverlayView.setCropFrameColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_FRAME_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame)));
        mOverlayView.setCropFrameStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width)));
        mOverlayView.setShowCropGrid(intent.getBooleanExtra(UCrop.Options.EXTRA_SHOW_CROP_GRID, OverlayView.DEFAULT_SHOW_CROP_GRID));
        mOverlayView.setCropGridRowCount(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_ROW_COUNT, OverlayView.DEFAULT_CROP_GRID_ROW_COUNT));
        mOverlayView.setCropGridColumnCount(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_COLUMN_COUNT, OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT));
        mOverlayView.setCropGridColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid)));
        mOverlayView.setCropGridCornerColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_CORNER_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid)));
        mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width)));
        float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, 0);
        float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, 0);
        int aspectRationSelectedByDefault = intent.getIntExtra(UCrop.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0);
        ArrayList<AspectRatio> aspectRatioList = intent.getParcelableArrayListExtra(UCrop.Options.EXTRA_ASPECT_RATIO_OPTIONS);
        if (aspectRatioX > 0 && aspectRatioY > 0) {
            if (mWrapperStateAspectRatio != null) {
                mWrapperStateAspectRatio.setVisibility(View.GONE);
            }
            mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY);
        } else if (aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList.size()) {
            mGestureCropImageView.setTargetAspectRatio(aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() /
                    aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY());
        } else {
            mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO);
        }
        int maxSizeX = intent.getIntExtra(UCrop.EXTRA_MAX_SIZE_X, 0);
        int maxSizeY = intent.getIntExtra(UCrop.EXTRA_MAX_SIZE_Y, 0);
        if (maxSizeX > 0 && maxSizeY > 0) {
            mGestureCropImageView.setMaxResultImageSizeX(maxSizeX);
            mGestureCropImageView.setMaxResultImageSizeY(maxSizeY);
        }
        mWrapperStateBrightness.setVisibility(getIntent().getBooleanExtra(UCrop.Options.EXTRA_BRIGHTNESS, true) ? View.VISIBLE : View.GONE);
        mWrapperStateContrast.setVisibility(getIntent().getBooleanExtra(UCrop.Options.EXTRA_CONTRAST, true) ? View.VISIBLE : View.GONE);
        mWrapperStateSaturation.setVisibility(getIntent().getBooleanExtra(UCrop.Options.EXTRA_SATURATION, true) ? View.VISIBLE : View.GONE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && getIntent().getBooleanExtra(UCrop.Options.EXTRA_SHARPNESS, true)) {
            mWrapperStateSharpness.setVisibility(View.VISIBLE);
        } else {
            mWrapperStateSharpness.setVisibility(View.GONE);
        }
    }
@ SuppressWarnings ( "deprecation" ) private void processOptions ( @ NonNull Intent intent ) { String compressionFormatName = intent . getStringExtra ( UCrop . Options . EXTRA_COMPRESSION_FORMAT_NAME ) ; Bitmap . CompressFormat compressFormat = null ; if ( ! TextUtils . isEmpty ( compressionFormatName ) ) { compressFormat = Bitmap . CompressFormat . valueOf ( compressionFormatName ) ; } mCompressFormat = ( compressFormat == null ) ? DEFAULT_COMPRESS_FORMAT : compressFormat ; mCompressQuality = intent . getIntExtra ( UCrop . Options . EXTRA_COMPRESSION_QUALITY , UCropActivity . DEFAULT_COMPRESS_QUALITY ) ; int [ ] allowedGestures = intent . getIntArrayExtra ( UCrop . Options . EXTRA_ALLOWED_GESTURES ) ; if ( allowedGestures != null && allowedGestures . length == TABS_COUNT ) { mAllowedGestures = allowedGestures ; } mGestureCropImageView . setMaxBitmapSize ( intent . getIntExtra ( UCrop . Options . EXTRA_MAX_BITMAP_SIZE , CropImageView . DEFAULT_MAX_BITMAP_SIZE ) ) ; mGestureCropImageView . setMaxScaleMultiplier ( intent . getFloatExtra ( UCrop . Options . EXTRA_MAX_SCALE_MULTIPLIER , CropImageView . DEFAULT_MAX_SCALE_MULTIPLIER ) ) ; mGestureCropImageView . setImageToWrapCropBoundsAnimDuration ( intent . getIntExtra ( UCrop . Options . EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION , CropImageView . DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION ) ) ; mOverlayView . setFreestyleCropEnabled ( intent . getBooleanExtra ( UCrop . Options . EXTRA_FREE_STYLE_CROP , OverlayView . DEFAULT_FREESTYLE_CROP_MODE != OverlayView . FREESTYLE_CROP_MODE_DISABLE ) ) ; mOverlayView . setDimmedColor ( intent . getIntExtra ( UCrop . Options . EXTRA_DIMMED_LAYER_COLOR , getResources ( ) . getColor ( R . color . ucrop_color_default_dimmed ) ) ) ; mOverlayView . setCircleDimmedLayer ( intent . getBooleanExtra ( UCrop . Options . EXTRA_CIRCLE_DIMMED_LAYER , OverlayView . DEFAULT_CIRCLE_DIMMED_LAYER ) ) ; mOverlayView . setShowCropFrame ( intent . getBooleanExtra ( UCrop . Options . EXTRA_SHOW_CROP_FRAME , OverlayView . DEFAULT_SHOW_CROP_FRAME ) ) ; mOverlayView . setCropFrameColor ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_FRAME_COLOR , getResources ( ) . getColor ( R . color . ucrop_color_default_crop_frame ) ) ) ; mOverlayView . setCropFrameStrokeWidth ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_FRAME_STROKE_WIDTH , getResources ( ) . getDimensionPixelSize ( R . dimen . ucrop_default_crop_frame_stoke_width ) ) ) ; mOverlayView . setShowCropGrid ( intent . getBooleanExtra ( UCrop . Options . EXTRA_SHOW_CROP_GRID , OverlayView . DEFAULT_SHOW_CROP_GRID ) ) ; mOverlayView . setCropGridRowCount ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_GRID_ROW_COUNT , OverlayView . DEFAULT_CROP_GRID_ROW_COUNT ) ) ; mOverlayView . setCropGridColumnCount ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_GRID_COLUMN_COUNT , OverlayView . DEFAULT_CROP_GRID_COLUMN_COUNT ) ) ; mOverlayView . setCropGridColor ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_GRID_COLOR , getResources ( ) . getColor ( R . color . ucrop_color_default_crop_grid ) ) ) ; mOverlayView . setCropGridCornerColor ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_GRID_CORNER_COLOR , getResources ( ) . getColor ( R . color . ucrop_color_default_crop_grid ) ) ) ; mOverlayView . setCropGridStrokeWidth ( intent . getIntExtra ( UCrop . Options . EXTRA_CROP_GRID_STROKE_WIDTH , getResources ( ) . getDimensionPixelSize ( R . dimen . ucrop_default_crop_grid_stoke_width ) ) ) ; float aspectRatioX = intent . getFloatExtra ( UCrop . EXTRA_ASPECT_RATIO_X , 0 ) ; float aspectRatioY = intent . getFloatExtra ( UCrop . EXTRA_ASPECT_RATIO_Y , 0 ) ; int aspectRationSelectedByDefault = intent . getIntExtra ( UCrop . Options . EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT , 0 ) ; ArrayList < AspectRatio > aspectRatioList = intent . getParcelableArrayListExtra ( UCrop . Options . EXTRA_ASPECT_RATIO_OPTIONS ) ; if ( aspectRatioX > 0 && aspectRatioY > 0 ) { if ( mWrapperStateAspectRatio != null ) { mWrapperStateAspectRatio . setVisibility ( View . GONE ) ; } mGestureCropImageView . setTargetAspectRatio ( aspectRatioX / aspectRatioY ) ; } else if ( aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList . size ( ) ) { mGestureCropImageView . setTargetAspectRatio ( aspectRatioList . get ( aspectRationSelectedByDefault ) . getAspectRatioX ( ) / aspectRatioList . get ( aspectRationSelectedByDefault ) . getAspectRatioY ( ) ) ; } else { mGestureCropImageView . setTargetAspectRatio ( CropImageView . SOURCE_IMAGE_ASPECT_RATIO ) ; } int maxSizeX = intent . getIntExtra ( UCrop . EXTRA_MAX_SIZE_X , 0 ) ; int maxSizeY = intent . getIntExtra ( UCrop . EXTRA_MAX_SIZE_Y , 0 ) ; if ( maxSizeX > 0 && maxSizeY > 0 ) { mGestureCropImageView . setMaxResultImageSizeX ( maxSizeX ) ; mGestureCropImageView . setMaxResultImageSizeY ( maxSizeY ) ; } mWrapperStateBrightness . setVisibility ( getIntent ( ) . getBooleanExtra ( UCrop . Options . EXTRA_BRIGHTNESS , true ) ? View . VISIBLE : View . GONE ) ; mWrapperStateContrast . setVisibility ( getIntent ( ) . getBooleanExtra ( UCrop . Options . EXTRA_CONTRAST , true ) ? View . VISIBLE : View . GONE ) ; mWrapperStateSaturation . setVisibility ( getIntent ( ) . getBooleanExtra ( UCrop . Options . EXTRA_SATURATION , true ) ? View . VISIBLE : View . GONE ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR1 && getIntent ( ) . getBooleanExtra ( UCrop . Options . EXTRA_SHARPNESS , true ) ) { mWrapperStateSharpness . setVisibility ( View . VISIBLE ) ; } else { mWrapperStateSharpness . setVisibility ( View . GONE ) ; } }
This method extracts {@link com.yalantis.ucrop.UCrop.Options #optionsBundle} from incoming intent
 and setups Activity, {@link OverlayView} and {@link CropImageView} properly.
This method extracts { @link com . yalantis . ucrop . UCrop . Options #optionsBundle } from incoming intent and setups Activity { @link OverlayView } and { @link CropImageView } properly .
// Bitmap compression options // Gestures options // Crop image view options // Overlay view options // Aspect ratio options // Result bitmap max size options