-
public final class CropImageContractOptionsOptions to customize the activity opened by CropImageContract. Conveniently created by the options method.
-
-
Field Summary
Fields Modifier and Type Field Description private final Uriuriprivate final CropImageOptionscropImageOptions
-
Constructor Summary
Constructors Constructor Description CropImageContractOptions(Uri uri, CropImageOptions cropImageOptions)
-
Method Summary
Modifier and Type Method Description final UrigetUri()final CropImageOptionsgetCropImageOptions()final CropImageContractOptionssetImageSource(Boolean includeGallery, Boolean includeCamera)When library is responsible for fetching the image you can decide which source you wanna let the user choose. final CropImageContractOptionssetCropShape(CropImageView.CropShape cropShape)The shape of the cropping window. final CropImageContractOptionssetCropCornerShape(CropImageView.CropCornerShape cornerShape)To set the shape of the cropper corner (RECTANGLE / OVAL) Default: RECTANGLE final CropImageContractOptionssetCircleCornerFillColor(Integer circleFillColorHexValue)To set the fill color of the Oval crop corner final CropImageContractOptionssetCropCornerRadius(Float cornerRadius)To set the Oval crop corner radius Default is 10 final CropImageContractOptionssetSnapRadius(Float snapRadius)An edge of the crop window will snap to the corresponding edge of a specified bounding box when the crop window edge is less than or equal to this distance (in pixels) away from the bounding box edge (in pixels). final CropImageContractOptionssetTouchRadius(Float touchRadius)The radius of the touchable area around the handle (in pixels). final CropImageContractOptionssetGuidelines(CropImageView.Guidelines guidelines)whether the guidelines should be on, off, or only showing when resizing. final CropImageContractOptionssetScaleType(CropImageView.ScaleType scaleType)The initial scale type of the image in the crop image view<br></br>Default: FIT_CENTER final CropImageContractOptionssetShowCropOverlay(Boolean showCropOverlay)if to show crop overlay UI what contains the crop window UI surrounded by background over the cropping image. final CropImageContractOptionssetShowCropLabel(Boolean showCropLabel)final CropImageContractOptionssetAutoZoomEnabled(Boolean autoZoomEnabled)if auto-zoom functionality is enabled. final CropImageContractOptionssetMultiTouchEnabled(Boolean multiTouchEnabled)if multi touch functionality is enabled. final CropImageContractOptionssetCenterMoveEnabled(Boolean centerMoveEnabled)if the crop window can be moved by dragging the center. final CropImageContractOptionssetMaxZoom(Integer maxZoom)The max zoom allowed during cropping. final CropImageContractOptionssetInitialCropWindowPaddingRatio(Float initialCropWindowPaddingRatio)The initial crop window padding from image borders in percentage of the cropping image dimensions. final CropImageContractOptionssetFixAspectRatio(Boolean fixAspectRatio)whether the width to height aspect ratio should be maintained or free to change. final CropImageContractOptionssetAspectRatio(Integer aspectRatioX, Integer aspectRatioY)the X,Y value of the aspect ratio. final CropImageContractOptionssetBorderLineThickness(Float borderLineThickness)the thickness of the guidelines lines (in pixels). final CropImageContractOptionssetBorderLineColor(Integer borderLineColor)the color of the guidelines lines. final CropImageContractOptionssetBorderCornerThickness(Float borderCornerThickness)thickness of the corner line (in pixels). final CropImageContractOptionssetBorderCornerOffset(Float borderCornerOffset)the offset of corner line from crop window border (in pixels). final CropImageContractOptionssetBorderCornerLength(Float borderCornerLength)the length of the corner line away from the corner (in pixels). final CropImageContractOptionssetBorderCornerColor(Integer borderCornerColor)the color of the corner line. final CropImageContractOptionssetGuidelinesThickness(Float guidelinesThickness)the thickness of the guidelines lines (in pixels). final CropImageContractOptionssetGuidelinesColor(Integer guidelinesColor)the color of the guidelines lines. final CropImageContractOptionssetBackgroundColor(Integer backgroundColor)the color of the overlay background around the crop window cover the image parts not in the crop window. final CropImageContractOptionssetMinCropWindowSize(Integer minCropWindowWidth, Integer minCropWindowHeight)the min size the crop window is allowed to be (in pixels). final CropImageContractOptionssetMinCropResultSize(Integer minCropResultWidth, Integer minCropResultHeight)the min size the resulting cropping image is allowed to be, affects the cropping window limits (in pixels). final CropImageContractOptionssetMaxCropResultSize(Integer maxCropResultWidth, Integer maxCropResultHeight)the max size the resulting cropping image is allowed to be, affects the cropping window limits (in pixels). final CropImageContractOptionssetActivityTitle(CharSequence activityTitle)the title of the CropImageActivity. final CropImageContractOptionssetActivityMenuIconColor(Integer activityMenuIconColor)the color to use for action bar items icons. final CropImageContractOptionssetActivityMenuTextColor(Integer activityMenuTextColor)the color to use for action bar items texts. final CropImageContractOptionssetOutputUri(Uri outputUri)the Android Uri to save the cropped image to. final CropImageContractOptionssetOutputCompressFormat(Bitmap.CompressFormat outputCompressFormat)the compression format to use when writting the image. final CropImageContractOptionssetOutputCompressQuality(Integer outputCompressQuality)the quality (if applicable) to use when writting the image (0 - 100). final CropImageContractOptionssetRequestedSize(Integer reqWidth, Integer reqHeight)the size to resize the cropped image to. final CropImageContractOptionssetRequestedSize(Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions reqSizeOptions)the size to resize the cropped image to. final CropImageContractOptionssetNoOutputImage(Boolean noOutputImage)if the result of crop image activity should not save the cropped image bitmap. final CropImageContractOptionssetInitialCropWindowRectangle(Rect initialCropWindowRectangle)the initial rectangle to set on the cropping image after loading. final CropImageContractOptionssetInitialRotation(Integer initialRotation)the initial rotation to set on the cropping image after loading (0-360 degrees clockwise). final CropImageContractOptionssetAllowRotation(Boolean allowRotation)if to allow rotation during cropping. final CropImageContractOptionssetAllowFlipping(Boolean allowFlipping)if to allow flipping during cropping. final CropImageContractOptionssetAllowCounterRotation(Boolean allowCounterRotation)if to allow counter-clockwise rotation during cropping. final CropImageContractOptionssetRotationDegrees(Integer rotationDegrees)The amount of degreees to rotate clockwise or counter-clockwise (0-360). final CropImageContractOptionssetFlipHorizontally(Boolean flipHorizontally)whether the image should be flipped horizontally. final CropImageContractOptionssetFlipVertically(Boolean flipVertically)whether the image should be flipped vertically. final CropImageContractOptionssetCropMenuCropButtonTitle(CharSequence title)optional, set crop menu crop button title. final CropImageContractOptionssetCropMenuCropButtonIcon(@DrawableRes() Integer drawableResource)Image resource id to use for crop icon instead of text. final CropImageContractOptionssetSkipEditing(Boolean skipEditing)Set whether the cropping option should be allowed or skipped entirely. final <ERROR CLASS>setShowIntentChooser(Boolean showIntentChooser)Shows an intent chooser instead of the alert dialog when choosing an image source. final <ERROR CLASS>setIntentChooserTitle(String intentChooserTitle)Sets a custom title for the intent chooser final <ERROR CLASS>setIntentChooserPriorityList(List<String> priorityAppPackages)This takes the given app package list (list of app package names) and displays them first among the list of apps available final <ERROR CLASS>setActivityBackgroundColor(@ColorInt() Integer color)Sets the background color of the Crop Image Activity screen. final <ERROR CLASS>setToolbarColor(@ColorInt() Integer color)Sets the toolbar color of the Crop Image Activity screen. final <ERROR CLASS>setToolbarTitleColor(@ColorInt() Integer color)Sets the toolbar color of the Crop Image Activity screen. final <ERROR CLASS>setToolbarBackButtonColor(@ColorInt() Integer color)Sets the toolbar back button color of the Crop Image Activity screen. final <ERROR CLASS>setToolbarTintColor(@ColorInt() Integer color)Sets the tint color for all items on the toolbar of the Crop Image Activity screen. -
-
Constructor Detail
-
CropImageContractOptions
CropImageContractOptions(Uri uri, CropImageOptions cropImageOptions)
-
-
Method Detail
-
getCropImageOptions
final CropImageOptions getCropImageOptions()
-
setImageSource
final CropImageContractOptions setImageSource(Boolean includeGallery, Boolean includeCamera)
When library is responsible for fetching the image you can decide which source you wanna let the user choose. Both or just one of them
Attention: Make them both
Falsecan cause unexpected behaviorDefault values:
True
-
setCropShape
final CropImageContractOptions setCropShape(CropImageView.CropShape cropShape)
The shape of the cropping window.<br></br> To set square/circle crop shape set aspect ratio to 1:1.<br></br>Default: RECTANGLE
When setting RECTANGLE_VERTICAL_ONLY or RECTANGLE_HORIZONTAL_ONLY you may also want to use a free aspect ratio (to allow the crop window to change in the desired dimension whilst staying the same in the other dimension) and have the initial crop window cover the entire image (so that the crop window has no space to move in the other dimension). These can be done with setFixAspectRatio } (with argument
false) and setInitialCropWindowPaddingRatio (with argument `0f).
-
setCropCornerShape
final CropImageContractOptions setCropCornerShape(CropImageView.CropCornerShape cornerShape)
To set the shape of the cropper corner (RECTANGLE / OVAL) Default: RECTANGLE
-
setCircleCornerFillColor
final CropImageContractOptions setCircleCornerFillColor(Integer circleFillColorHexValue)
To set the fill color of the Oval crop corner
- Parameters:
circleFillColorHexValue- Hex value of the color (Default is WHITE)
-
setCropCornerRadius
final CropImageContractOptions setCropCornerRadius(Float cornerRadius)
To set the Oval crop corner radius Default is 10
-
setSnapRadius
final CropImageContractOptions setSnapRadius(Float snapRadius)
An edge of the crop window will snap to the corresponding edge of a specified bounding box when the crop window edge is less than or equal to this distance (in pixels) away from the bounding box edge (in pixels).<br></br>Default: 3dp
-
setTouchRadius
final CropImageContractOptions setTouchRadius(Float touchRadius)
The radius of the touchable area around the handle (in pixels).<br></br> We are basing this value off of the recommended 48dp Rhythm.<br></br> See: http://developer.android.com/design/style/metrics-grids.html#48dp-rhythm<br></br> Default: 48dp
-
setGuidelines
final CropImageContractOptions setGuidelines(CropImageView.Guidelines guidelines)
whether the guidelines should be on, off, or only showing when resizing.<br></br>Default: ON_TOUCH
-
setScaleType
final CropImageContractOptions setScaleType(CropImageView.ScaleType scaleType)
The initial scale type of the image in the crop image view<br></br>Default: FIT_CENTER
-
setShowCropOverlay
final CropImageContractOptions setShowCropOverlay(Boolean showCropOverlay)
if to show crop overlay UI what contains the crop window UI surrounded by background over the cropping image.<br></br>default: true, may disable for animation or frame transition.
-
setShowCropLabel
final CropImageContractOptions setShowCropLabel(Boolean showCropLabel)
-
setAutoZoomEnabled
final CropImageContractOptions setAutoZoomEnabled(Boolean autoZoomEnabled)
if auto-zoom functionality is enabled.<br></br> default: true.
-
setMultiTouchEnabled
final CropImageContractOptions setMultiTouchEnabled(Boolean multiTouchEnabled)
if multi touch functionality is enabled.<br></br> default: true.
-
setCenterMoveEnabled
final CropImageContractOptions setCenterMoveEnabled(Boolean centerMoveEnabled)
if the crop window can be moved by dragging the center.<br></br> default: true
-
setMaxZoom
final CropImageContractOptions setMaxZoom(Integer maxZoom)
The max zoom allowed during cropping.<br></br>Default: 4
-
setInitialCropWindowPaddingRatio
final CropImageContractOptions setInitialCropWindowPaddingRatio(Float initialCropWindowPaddingRatio)
The initial crop window padding from image borders in percentage of the cropping image dimensions.<br></br>Default: 0.1
-
setFixAspectRatio
final CropImageContractOptions setFixAspectRatio(Boolean fixAspectRatio)
whether the width to height aspect ratio should be maintained or free to change.<br></br>Default: false
-
setAspectRatio
final CropImageContractOptions setAspectRatio(Integer aspectRatioX, Integer aspectRatioY)
the X,Y value of the aspect ratio.<br></br> Also sets fixes aspect ratio to TRUE.<br></br>Default: 1/1
- Parameters:
aspectRatioX- the widthaspectRatioY- the height
-
setBorderLineThickness
final CropImageContractOptions setBorderLineThickness(Float borderLineThickness)
the thickness of the guidelines lines (in pixels).<br></br>Default: 3dp
-
setBorderLineColor
final CropImageContractOptions setBorderLineColor(Integer borderLineColor)
the color of the guidelines lines.<br></br>Default: Color.argb(170, 255, 255, 255)
-
setBorderCornerThickness
final CropImageContractOptions setBorderCornerThickness(Float borderCornerThickness)
thickness of the corner line (in pixels).<br></br>Default: 2dp
-
setBorderCornerOffset
final CropImageContractOptions setBorderCornerOffset(Float borderCornerOffset)
the offset of corner line from crop window border (in pixels).<br></br>Default: 5dp
-
setBorderCornerLength
final CropImageContractOptions setBorderCornerLength(Float borderCornerLength)
the length of the corner line away from the corner (in pixels).<br></br>Default: 14dp
-
setBorderCornerColor
final CropImageContractOptions setBorderCornerColor(Integer borderCornerColor)
the color of the corner line.<br></br>Default: WHITE
-
setGuidelinesThickness
final CropImageContractOptions setGuidelinesThickness(Float guidelinesThickness)
the thickness of the guidelines lines (in pixels).<br></br>Default: 1dp
-
setGuidelinesColor
final CropImageContractOptions setGuidelinesColor(Integer guidelinesColor)
the color of the guidelines lines.<br></br>Default: Color.argb(170, 255, 255, 255)
-
setBackgroundColor
final CropImageContractOptions setBackgroundColor(Integer backgroundColor)
the color of the overlay background around the crop window cover the image parts not in the crop window.<br></br>Default: Color.argb(119, 0, 0, 0)
-
setMinCropWindowSize
final CropImageContractOptions setMinCropWindowSize(Integer minCropWindowWidth, Integer minCropWindowHeight)
the min size the crop window is allowed to be (in pixels).<br></br>Default: 42dp, 42dp
-
setMinCropResultSize
final CropImageContractOptions setMinCropResultSize(Integer minCropResultWidth, Integer minCropResultHeight)
the min size the resulting cropping image is allowed to be, affects the cropping window limits (in pixels).<br></br>Default: 40px, 40px
-
setMaxCropResultSize
final CropImageContractOptions setMaxCropResultSize(Integer maxCropResultWidth, Integer maxCropResultHeight)
the max size the resulting cropping image is allowed to be, affects the cropping window limits (in pixels).<br></br>Default: 99999, 99999
-
setActivityTitle
final CropImageContractOptions setActivityTitle(CharSequence activityTitle)
the title of the CropImageActivity.<br></br>Default: ""
-
setActivityMenuIconColor
final CropImageContractOptions setActivityMenuIconColor(Integer activityMenuIconColor)
the color to use for action bar items icons.<br></br>Default: NONE
-
setActivityMenuTextColor
final CropImageContractOptions setActivityMenuTextColor(Integer activityMenuTextColor)
the color to use for action bar items texts.<br></br>Default: NONE
-
setOutputUri
final CropImageContractOptions setOutputUri(Uri outputUri)
the Android Uri to save the cropped image to.<br></br>Default: NONE, will create a temp file
-
setOutputCompressFormat
final CropImageContractOptions setOutputCompressFormat(Bitmap.CompressFormat outputCompressFormat)
the compression format to use when writting the image.<br></br>Default: JPEG
-
setOutputCompressQuality
final CropImageContractOptions setOutputCompressQuality(Integer outputCompressQuality)
the quality (if applicable) to use when writting the image (0 - 100).<br></br>Default: 90
-
setRequestedSize
final CropImageContractOptions setRequestedSize(Integer reqWidth, Integer reqHeight)
the size to resize the cropped image to.<br></br> Uses CropImageView.RequestSizeOptions.RESIZE_INSIDE option.<br></br>Default: 0, 0 - not set, will not resize
-
setRequestedSize
final CropImageContractOptions setRequestedSize(Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions reqSizeOptions)
the size to resize the cropped image to.<br></br>Default: 0, 0 - not set, will not resize
-
setNoOutputImage
final CropImageContractOptions setNoOutputImage(Boolean noOutputImage)
if the result of crop image activity should not save the cropped image bitmap.<br></br> Used if you want to crop the image manually and need only the crop rectangle and rotation data.<br></br>Default: false
-
setInitialCropWindowRectangle
final CropImageContractOptions setInitialCropWindowRectangle(Rect initialCropWindowRectangle)
the initial rectangle to set on the cropping image after loading.<br></br>Default: NONE - will initialize using initial crop window padding ratio
-
setInitialRotation
final CropImageContractOptions setInitialRotation(Integer initialRotation)
the initial rotation to set on the cropping image after loading (0-360 degrees clockwise). <br></br>Default: NONE - will read image exif data
-
setAllowRotation
final CropImageContractOptions setAllowRotation(Boolean allowRotation)
if to allow rotation during cropping.<br></br>Default: true
-
setAllowFlipping
final CropImageContractOptions setAllowFlipping(Boolean allowFlipping)
if to allow flipping during cropping.<br></br>Default: true
-
setAllowCounterRotation
final CropImageContractOptions setAllowCounterRotation(Boolean allowCounterRotation)
if to allow counter-clockwise rotation during cropping.<br></br> Note: if rotation is disabled this option has no effect.<br></br>Default: false
-
setRotationDegrees
final CropImageContractOptions setRotationDegrees(Integer rotationDegrees)
The amount of degreees to rotate clockwise or counter-clockwise (0-360).<br></br>Default: 90
-
setFlipHorizontally
final CropImageContractOptions setFlipHorizontally(Boolean flipHorizontally)
whether the image should be flipped horizontally.<br></br>Default: false
-
setFlipVertically
final CropImageContractOptions setFlipVertically(Boolean flipVertically)
whether the image should be flipped vertically.<br></br>Default: false
-
setCropMenuCropButtonTitle
final CropImageContractOptions setCropMenuCropButtonTitle(CharSequence title)
optional, set crop menu crop button title.<br></br>Default: null, will use resource string: crop_image_menu_crop
-
setCropMenuCropButtonIcon
final CropImageContractOptions setCropMenuCropButtonIcon(@DrawableRes() Integer drawableResource)
Image resource id to use for crop icon instead of text.<br></br>Default: 0
-
setSkipEditing
final CropImageContractOptions setSkipEditing(Boolean skipEditing)
Set whether the cropping option should be allowed or skipped entirely.<br></br>Default: false
-
setShowIntentChooser
final <ERROR CLASS> setShowIntentChooser(Boolean showIntentChooser)
Shows an intent chooser instead of the alert dialog when choosing an image source.
Default: false
Note: To show the camera app as an option in Intent chooser you will need to add the camera permission ("android.permission.CAMERA") to your manifest file.
-
setIntentChooserTitle
final <ERROR CLASS> setIntentChooserTitle(String intentChooserTitle)
Sets a custom title for the intent chooser
-
setIntentChooserPriorityList
final <ERROR CLASS> setIntentChooserPriorityList(List<String> priorityAppPackages)
This takes the given app package list (list of app package names) and displays them first among the list of apps available
- Parameters:
priorityAppPackages- accepts a list of strings of app package names Apps are displayed in the order you pass them if they are available on your deviceNote: If you pass an empty list here there will be no sorting of the apps list shown in the intent chooser.
-
setActivityBackgroundColor
final <ERROR CLASS> setActivityBackgroundColor(@ColorInt() Integer color)
Sets the background color of the Crop Image Activity screen.
-
setToolbarColor
final <ERROR CLASS> setToolbarColor(@ColorInt() Integer color)
Sets the toolbar color of the Crop Image Activity screen.
-
setToolbarTitleColor
final <ERROR CLASS> setToolbarTitleColor(@ColorInt() Integer color)
Sets the toolbar color of the Crop Image Activity screen.
-
setToolbarBackButtonColor
final <ERROR CLASS> setToolbarBackButtonColor(@ColorInt() Integer color)
Sets the toolbar back button color of the Crop Image Activity screen.
-
setToolbarTintColor
final <ERROR CLASS> setToolbarTintColor(@ColorInt() Integer color)
Sets the tint color for all items on the toolbar of the Crop Image Activity screen. This includes setting the colors of the following together
Toolbar back button
Toolbar text
Toolbar menu icon color
Toolbar menu text color
-
-
-
-