-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource,com.canhub.cropper.CropOverlayView.CropWindowChangeListener
public final class CropImageView extends FrameLayout implements CropOverlayView.CropWindowChangeListener
Custom view that provides cropping capabilities to an image.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumCropImageView.CropShapeThe possible cropping area shape.<br></br> To set square/circle crop shape set aspect ratio to 1:1.
public enumCropImageView.CropCornerShapePossible crop corner shape
public enumCropImageView.ScaleTypeOptions for scaling the bounds of cropping image to the bounds of Crop Image View.<br></br> Note: Some options are affected by auto-zoom, if enabled.
public enumCropImageView.Guidelinespublic enumCropImageView.RequestSizeOptionsPossible options for handling requested width/height for cropping.
public interfaceCropImageView.OnSetCropOverlayReleasedListenerInterface definition for a callback to be invoked when the crop overlay is released.
public interfaceCropImageView.OnSetCropOverlayMovedListenerInterface definition for a callback to be invoked when the crop overlay is released.
public interfaceCropImageView.OnSetCropWindowChangeListenerInterface definition for a callback to be invoked when the crop overlay is released.
public interfaceCropImageView.OnSetImageUriCompleteListenerInterface definition for a callback to be invoked when image async loading is complete.
public interfaceCropImageView.OnCropImageCompleteListenerInterface definition for a callback to be invoked when image async crop is complete.
public classCropImageView.CropResultResult data of crop image.
-
Field Summary
Fields Modifier and Type Field Description private BooleanisSaveBitmapToInstanceStateprivate UriimageUriprivate CropImageView.ScaleTypescaleTypeprivate CropImageView.CropShapecropShapeprivate CropImageView.CropCornerShapecornerShapeprivate BooleanisAutoZoomEnabledprivate IntegermaxZoomprivate IntegerrotatedDegreesprivate final BooleanisFixAspectRatioprivate BooleanisFlippedHorizontallyprivate UricustomOutputUriprivate BooleanisFlippedVerticallyprivate CropImageView.Guidelinesguidelinesprivate final Pair<Integer, Integer>aspectRatioprivate BooleanisShowProgressBarprivate BooleanisShowCropOverlayprivate BooleanisShowCropLabelprivate StringcropLabelTextprivate FloatcropLabelTextSizeprivate IntegercropLabelTextColorprivate IntegerimageResourceprivate final RectwholeImageRectprivate RectcropRectprivate final RectFcropWindowRectprivate final FloatArraycropPointsprivate final BitmapcroppedImage
-
Constructor Summary
Constructors Constructor Description CropImageView(Context context, AttributeSet attrs)CropImageView(Context context)
-
Method Summary
Modifier and Type Method Description final BooleangetIsSaveBitmapToInstanceState()if to save bitmap on save instance state. final UnitsetIsSaveBitmapToInstanceState(@Deprecated(message = This functionality is deprecated, please remove it altogether or create an issue and explain WHY you need this.) Boolean isSaveBitmapToInstanceState)if to save bitmap on save instance state. final UrigetImageUri()The URI that the image was loaded from (if loaded from URI) final UnitsetImageUri(Uri imageUri)final CropImageView.ScaleTypegetScaleType()final UnitsetScaleType(CropImageView.ScaleType scaleType)final CropImageView.CropShapegetCropShape()final UnitsetCropShape(CropImageView.CropShape cropShape)final CropImageView.CropCornerShapegetCornerShape()final UnitsetCornerShape(CropImageView.CropCornerShape cornerShape)final BooleangetIsAutoZoomEnabled()final UnitsetIsAutoZoomEnabled(Boolean isAutoZoomEnabled)final IntegergetMaxZoom()final UnitsetMaxZoom(Integer maxZoom)final IntegergetRotatedDegrees()final UnitsetRotatedDegrees(Integer rotatedDegrees)final BooleangetIsFixAspectRatio()final BooleangetIsFlippedHorizontally()final UnitsetIsFlippedHorizontally(Boolean isFlippedHorizontally)final UrigetCustomOutputUri()The Android Uri to save the cropped image to final UnitsetCustomOutputUri(Uri customOutputUri)The Android Uri to save the cropped image to final BooleangetIsFlippedVertically()final UnitsetIsFlippedVertically(Boolean isFlippedVertically)final CropImageView.GuidelinesgetGuidelines()final UnitsetGuidelines(CropImageView.Guidelines guidelines)final Pair<Integer, Integer>getAspectRatio()final BooleangetIsShowProgressBar()final UnitsetIsShowProgressBar(Boolean isShowProgressBar)final BooleangetIsShowCropOverlay()final UnitsetIsShowCropOverlay(Boolean isShowCropOverlay)final BooleangetIsShowCropLabel()final UnitsetIsShowCropLabel(Boolean isShowCropLabel)final StringgetCropLabelText()final UnitsetCropLabelText(String cropLabelText)final FloatgetCropLabelTextSize()final UnitsetCropLabelTextSize(Float cropLabelTextSize)final IntegergetCropLabelTextColor()final UnitsetCropLabelTextColor(Integer cropLabelTextColor)final IntegergetImageResource()final UnitsetImageResource(Integer imageResource)final RectgetWholeImageRect()final RectgetCropRect()final UnitsetCropRect(Rect cropRect)final RectFgetCropWindowRect()final FloatArraygetCropPoints()final Bitmap-croppedImage()final UnitsetMultiTouchEnabled(Boolean multiTouchEnabled)Set multitouch functionality to enabled/disabled. final UnitsetCenterMoveEnabled(Boolean centerMoveEnabled)Set moving of the crop window by dragging the center to enabled/disabled. final UnitsetMinCropResultSize(Integer minCropResultWidth, Integer minCropResultHeight)the min size the resulting cropping image is allowed to be, affects the cropping window limits (in pixels). final UnitsetMaxCropResultSize(Integer maxCropResultWidth, Integer maxCropResultHeight)the max size the resulting cropping image is allowed to be, affects the cropping window limits (in pixels). final UnitsetFixedAspectRatio(Boolean fixAspectRatio)Sets whether the aspect ratio is fixed or not; true fixes the aspect ratio, while false allows it to be changed. final UnitsetAspectRatio(Integer aspectRatioX, Integer aspectRatioY)Sets the both the X and Y values of the aspectRatio. final UnitsetImageCropOptions(CropImageOptions options)final UnitclearAspectRatio()Clears set aspect ratio values and sets fixed aspect ratio to FALSE. final UnitsetSnapRadius(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. final SizeexpectedImageSize()This returns the expected image size, if cropping the image right now. final UnitresetCropRect()Reset crop window to initial rectangle. final BitmapgetCroppedImage(Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions options)Gets the cropped image based on the current crop window. final BitmapgetCroppedImage(Integer reqWidth, Integer reqHeight)Gets the cropped image based on the current crop window. final BitmapgetCroppedImage(Integer reqWidth)Gets the cropped image based on the current crop window. final BitmapgetCroppedImage()Gets the cropped image based on the current crop window. final UnitcroppedImageAsync(Bitmap.CompressFormat saveCompressFormat, Integer saveCompressQuality, Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions options, Uri customOutputUri)Cropped image based on the current crop window to the given uri. final UnitsetOnSetCropOverlayReleasedListener(CropImageView.OnSetCropOverlayReleasedListener listener)Set the callback t final UnitsetOnSetCropOverlayMovedListener(CropImageView.OnSetCropOverlayMovedListener listener)Set the callback when the cropping is moved final UnitsetOnCropWindowChangedListener(CropImageView.OnSetCropWindowChangeListener listener)Set the callback when the crop window is changed final UnitsetOnSetImageUriCompleteListener(CropImageView.OnSetImageUriCompleteListener listener)Set the callback to be invoked when image async loading setImageUriAsync is complete (successful or failed). final UnitsetOnCropImageCompleteListener(CropImageView.OnCropImageCompleteListener listener)Set the callback to be invoked when image async cropping image croppedImageAsync or croppedImage is complete (successful or failed). final UnitsetImageBitmap(Bitmap bitmap)Sets a Bitmap as the content of the CropImageView. final UnitsetImageBitmap(Bitmap bitmap, ExifInterface exif)Sets a Bitmap and initializes the image rotation according to the EXIT data. final UnitsetImageUriAsync(Uri uri)Sets a bitmap loaded from the given Android URI as the content of the CropImageView. final UnitclearImage()Clear the current image set for cropping. final UnitrotateImage(Integer degrees)Rotates image by the specified number of degrees clockwise. final UnitflipImageHorizontally()Flips the image horizontally. final UnitflipImageVertically()Flips the image vertically. final UnitstartCropWorkerTask(Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions options, Bitmap.CompressFormat saveCompressFormat, Integer saveCompressQuality, Uri customOutputUri)Gets the cropped image based on the current crop window. ParcelableonSaveInstanceState()UnitonRestoreInstanceState(Parcelable state)UnitonCropWindowChanged(Boolean inProgress)Called after a change in crop window rectangle. -
Methods inherited from class android.view.ViewGroup
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateDisplayHash, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDraw -
Methods inherited from class android.widget.FrameLayout
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, drawableStateChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildDrawingOrder, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildWithMargins, measureChildren, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onDescendantInvalidated, onDetachedFromWindow, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout -
Methods inherited from class com.canhub.cropper.CropImageView
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getConsiderGoneChildrenWhenMeasuring, getMeasureAllChildren, setForegroundGravity, setMeasureAllChildren, shouldDelayChildPressedState -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CropImageView
CropImageView(Context context, AttributeSet attrs)
-
CropImageView
CropImageView(Context context)
-
-
Method Detail
-
getIsSaveBitmapToInstanceState
final Boolean getIsSaveBitmapToInstanceState()
if to save bitmap on save instance state.<br></br> It is best to avoid it by using URI in setting image for cropping.<br></br> If false the bitmap is not saved and if restore is required to view will be empty, storing the bitmap requires saving it to file which can be expensive. default: false.
-
setIsSaveBitmapToInstanceState
final Unit setIsSaveBitmapToInstanceState(@Deprecated(message = This functionality is deprecated, please remove it altogether or create an issue and explain WHY you need this.) Boolean isSaveBitmapToInstanceState)
if to save bitmap on save instance state.<br></br> It is best to avoid it by using URI in setting image for cropping.<br></br> If false the bitmap is not saved and if restore is required to view will be empty, storing the bitmap requires saving it to file which can be expensive. default: false.
-
getImageUri
final Uri getImageUri()
The URI that the image was loaded from (if loaded from URI)
-
setImageUri
final Unit setImageUri(Uri imageUri)
-
getScaleType
final CropImageView.ScaleType getScaleType()
-
setScaleType
final Unit setScaleType(CropImageView.ScaleType scaleType)
-
getCropShape
final CropImageView.CropShape getCropShape()
-
setCropShape
final Unit setCropShape(CropImageView.CropShape cropShape)
-
getCornerShape
final CropImageView.CropCornerShape getCornerShape()
-
setCornerShape
final Unit setCornerShape(CropImageView.CropCornerShape cornerShape)
-
getIsAutoZoomEnabled
final Boolean getIsAutoZoomEnabled()
-
setIsAutoZoomEnabled
final Unit setIsAutoZoomEnabled(Boolean isAutoZoomEnabled)
-
getMaxZoom
final Integer getMaxZoom()
-
setMaxZoom
final Unit setMaxZoom(Integer maxZoom)
-
getRotatedDegrees
final Integer getRotatedDegrees()
-
setRotatedDegrees
final Unit setRotatedDegrees(Integer rotatedDegrees)
-
getIsFixAspectRatio
final Boolean getIsFixAspectRatio()
-
getIsFlippedHorizontally
final Boolean getIsFlippedHorizontally()
-
setIsFlippedHorizontally
final Unit setIsFlippedHorizontally(Boolean isFlippedHorizontally)
-
getCustomOutputUri
final Uri getCustomOutputUri()
The Android Uri to save the cropped image to
-
setCustomOutputUri
final Unit setCustomOutputUri(Uri customOutputUri)
The Android Uri to save the cropped image to
-
getIsFlippedVertically
final Boolean getIsFlippedVertically()
-
setIsFlippedVertically
final Unit setIsFlippedVertically(Boolean isFlippedVertically)
-
getGuidelines
final CropImageView.Guidelines getGuidelines()
-
setGuidelines
final Unit setGuidelines(CropImageView.Guidelines guidelines)
-
getAspectRatio
final Pair<Integer, Integer> getAspectRatio()
-
getIsShowProgressBar
final Boolean getIsShowProgressBar()
-
setIsShowProgressBar
final Unit setIsShowProgressBar(Boolean isShowProgressBar)
-
getIsShowCropOverlay
final Boolean getIsShowCropOverlay()
-
setIsShowCropOverlay
final Unit setIsShowCropOverlay(Boolean isShowCropOverlay)
-
getIsShowCropLabel
final Boolean getIsShowCropLabel()
-
setIsShowCropLabel
final Unit setIsShowCropLabel(Boolean isShowCropLabel)
-
getCropLabelText
final String getCropLabelText()
-
setCropLabelText
final Unit setCropLabelText(String cropLabelText)
-
getCropLabelTextSize
final Float getCropLabelTextSize()
-
setCropLabelTextSize
final Unit setCropLabelTextSize(Float cropLabelTextSize)
-
getCropLabelTextColor
final Integer getCropLabelTextColor()
-
setCropLabelTextColor
final Unit setCropLabelTextColor(Integer cropLabelTextColor)
-
getImageResource
final Integer getImageResource()
-
setImageResource
final Unit setImageResource(Integer imageResource)
-
getWholeImageRect
final Rect getWholeImageRect()
-
getCropRect
final Rect getCropRect()
-
setCropRect
final Unit setCropRect(Rect cropRect)
-
getCropWindowRect
final RectF getCropWindowRect()
-
getCropPoints
final FloatArray getCropPoints()
-
-croppedImage
final Bitmap -croppedImage()
-
setMultiTouchEnabled
final Unit setMultiTouchEnabled(Boolean multiTouchEnabled)
Set multitouch functionality to enabled/disabled.
-
setCenterMoveEnabled
final Unit setCenterMoveEnabled(Boolean centerMoveEnabled)
Set moving of the crop window by dragging the center to enabled/disabled.
-
setMinCropResultSize
final Unit 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>
-
setMaxCropResultSize
final Unit 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>
-
setFixedAspectRatio
final Unit setFixedAspectRatio(Boolean fixAspectRatio)
Sets whether the aspect ratio is fixed or not; true fixes the aspect ratio, while false allows it to be changed.
-
setAspectRatio
final Unit setAspectRatio(Integer aspectRatioX, Integer aspectRatioY)
Sets the both the X and Y values of the aspectRatio.<br></br> Sets fixed aspect ratio to TRUE.
aspectRatioX int that specifies the new X value of the aspect ratio aspectRatioY int that specifies the new Y value of the aspect ratio
-
setImageCropOptions
final Unit setImageCropOptions(CropImageOptions options)
-
clearAspectRatio
final Unit clearAspectRatio()
Clears set aspect ratio values and sets fixed aspect ratio to FALSE.
-
setSnapRadius
final Unit 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. (default: 3dp)
-
expectedImageSize
final Size expectedImageSize()
This returns the expected image size, if cropping the image right now.
-
resetCropRect
final Unit resetCropRect()
Reset crop window to initial rectangle.
-
getCroppedImage
@JvmOverloads() final Bitmap getCroppedImage(Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions options)
-
getCroppedImage
@JvmOverloads() final Bitmap getCroppedImage(Integer reqWidth, Integer reqHeight)
-
getCroppedImage
@JvmOverloads() final Bitmap getCroppedImage(Integer reqWidth)
-
getCroppedImage
@JvmOverloads() final Bitmap getCroppedImage()
-
croppedImageAsync
final Unit croppedImageAsync(Bitmap.CompressFormat saveCompressFormat, Integer saveCompressQuality, Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions options, Uri customOutputUri)
Cropped image based on the current crop window to the given uri. The result will be invoked to listener set by setOnCropImageCompleteListener.
saveCompressFormat the compression format to use when writing the image saveCompressQuality the quality (if applicable) to use when writing the image (0 - 100) reqWidth the width to resize the cropped image reqHeight the height to resize the cropped image options the resize method to use, see its documentation
-
setOnSetCropOverlayReleasedListener
final Unit setOnSetCropOverlayReleasedListener(CropImageView.OnSetCropOverlayReleasedListener listener)
Set the callback t
-
setOnSetCropOverlayMovedListener
final Unit setOnSetCropOverlayMovedListener(CropImageView.OnSetCropOverlayMovedListener listener)
Set the callback when the cropping is moved
-
setOnCropWindowChangedListener
final Unit setOnCropWindowChangedListener(CropImageView.OnSetCropWindowChangeListener listener)
Set the callback when the crop window is changed
-
setOnSetImageUriCompleteListener
final Unit setOnSetImageUriCompleteListener(CropImageView.OnSetImageUriCompleteListener listener)
Set the callback to be invoked when image async loading setImageUriAsync is complete (successful or failed).
-
setOnCropImageCompleteListener
final Unit setOnCropImageCompleteListener(CropImageView.OnCropImageCompleteListener listener)
Set the callback to be invoked when image async cropping image croppedImageAsync or croppedImage is complete (successful or failed).
-
setImageBitmap
final Unit setImageBitmap(Bitmap bitmap)
Sets a Bitmap as the content of the CropImageView.
bitmap the Bitmap to set
-
setImageBitmap
final Unit setImageBitmap(Bitmap bitmap, ExifInterface exif)
-
setImageUriAsync
final Unit setImageUriAsync(Uri uri)
Sets a bitmap loaded from the given Android URI as the content of the CropImageView.<br></br> Can be used with URI from gallery or camera source.<br></br> Will rotate the image by exif data.<br></br>
uri the URI to load the image from
-
clearImage
final Unit clearImage()
Clear the current image set for cropping.
-
rotateImage
final Unit rotateImage(Integer degrees)
Rotates image by the specified number of degrees clockwise.<br></br> Negative values represent counter-clockwise rotations.
degrees Integer specifying the number of degrees to rotate.
-
flipImageHorizontally
final Unit flipImageHorizontally()
Flips the image horizontally.
-
flipImageVertically
final Unit flipImageVertically()
Flips the image vertically.
-
startCropWorkerTask
final Unit startCropWorkerTask(Integer reqWidth, Integer reqHeight, CropImageView.RequestSizeOptions options, Bitmap.CompressFormat saveCompressFormat, Integer saveCompressQuality, Uri customOutputUri)
Gets the cropped image based on the current crop window. If (reqWidth,reqHeight) is given AND image is loaded from URI cropping will try to use sample size to fit in the requested width and height down-sampling if possible - optimization to get best size to quality. The result will be invoked to listener set by setOnCropImageCompleteListener.
reqWidth the width to resize the cropped image reqHeight the height to resize the cropped image options the resize method to use on the cropped bitmap saveCompressFormat if saveUri is given, the given compression will be used for saving the image saveCompressQuality if saveUri is given, the given quality will be used for the compression.
-
onSaveInstanceState
Parcelable onSaveInstanceState()
-
onRestoreInstanceState
Unit onRestoreInstanceState(Parcelable state)
-
onCropWindowChanged
Unit onCropWindowChanged(Boolean inProgress)
Called after a change in crop window rectangle.
inProgress if the crop window change operation is still in progress by user touch
-
-
-
-