-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.content.ComponentCallbacks2,android.view.KeyEvent.Callback,android.view.LayoutInflater.Factory,android.view.LayoutInflater.Factory2,android.view.View.OnCreateContextMenuListener,android.view.Window.Callback,androidx.activity.OnBackPressedDispatcherOwner,androidx.activity.contextaware.ContextAware,androidx.activity.result.ActivityResultCaller,androidx.activity.result.ActivityResultRegistryOwner,androidx.appcompat.app.ActionBarDrawerToggle.DelegateProvider,androidx.appcompat.app.AppCompatCallback,androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback,androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator,androidx.core.app.OnMultiWindowModeChangedProvider,androidx.core.app.OnNewIntentProvider,androidx.core.app.OnPictureInPictureModeChangedProvider,androidx.core.app.TaskStackBuilder.SupportParentable,androidx.core.content.OnConfigurationChangedProvider,androidx.core.content.OnTrimMemoryProvider,androidx.core.view.KeyEventDispatcher.Component,androidx.core.view.MenuHost,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,com.canhub.cropper.CropImageView.OnCropImageCompleteListener,com.canhub.cropper.CropImageView.OnSetImageUriCompleteListener
public class CropImageActivity extends AppCompatActivity implements CropImageView.OnSetImageUriCompleteListener, CropImageView.OnCropImageCompleteListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumCropImageActivity.Source
-
Field Summary
Fields Modifier and Type Field Description private final FragmentControllermFragmentsprivate final LifecycleRegistrymFragmentLifecycleRegistryprivate final BooleanmCreatedprivate final BooleanmResumedprivate final BooleanmStoppedprivate final ContextAwareHelpermContextAwareHelperprivate final SavedStateRegistryControllermSavedStateRegistryControllerprivate final SavedStateRegistrysavedStateRegistry
-
Constructor Summary
Constructors Constructor Description CropImageActivity()
-
Method Summary
Modifier and Type Method Description final SavedStateRegistrygetSavedStateRegistry()UnitonCreate(Bundle savedInstanceState)UnitshowImageSourceDialog(Function1<CropImageActivity.Source, Unit> openSource)This method show the dialog for user source choice, it is an open function so can be overridden and customised with the app layout if you need. UnitonStart()UnitonStop()BooleanonCreateOptionsMenu(Menu menu)BooleanonOptionsItemSelected(MenuItem item)UnitonSetImageUriComplete(CropImageView view, Uri uri, Exception error)Called when a crop image view has completed loading image for cropping. UnitonCropImageComplete(CropImageView view, CropImageView.CropResult result)Called when a crop image view has completed cropping image. UnitcropImage()Execute crop image and save the result tou output uri. UnitsetCropImageView(CropImageView cropImageView)When extending this activity, please set your own ImageCropView UnitrotateImage(Integer degrees)Rotate the image in the crop image view. UnitsetResult(Uri uri, Exception error, Integer sampleSize)Result with cropped image data or error if failed. UnitsetResultCancel()Cancel of cropping activity. IntentgetResultIntent(Uri uri, Exception error, Integer sampleSize)Get intent instance to be used for the result of this activity. UnitupdateMenuItemIconColor(Menu menu, Integer itemId, Integer color)Update the color of a specific menu item to the given color. UnitupdateMenuItemTextColor(Menu menu, Integer itemId, Integer color)Update the color of a specific menu item to the given color. -
Methods inherited from class androidx.core.app.ComponentActivity
closeContextMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, enterPictureInPictureMode, enterPictureInPictureMode, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getOnBackInvokedDispatcher, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSplashScreen, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLaunchedFromBubble, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onApplyThemeResource, onAttachFragment, onAttachedToWindow, onChildTitleChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreatePanelView, onCreateThumbnail, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onGetDirectActions, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onNavigateUp, onNavigateUpFromChild, onOptionsMenuClosed, onPerformDirectAction, onPictureInPictureRequested, onPictureInPictureUiStateChanged, onPostCreate, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRestart, onRestoreInstanceState, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onTopResumedActivityChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, overridePendingTransition, overridePendingTransition, postponeEnterTransition, recreate, registerActivityLifecycleCallbacks, registerComponentCallbacks, registerForContextMenu, releaseInstance, removeDialog, requestDragAndDropPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setContentTransitionManager, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setInheritShowWhenLocked, setIntent, setLocusContext, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRecentsScreenshotEnabled, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setShouldDockBigOverlays, setShowWhenLocked, setTaskDescription, setTitle, setTitle, setTitleColor, setTranslucent, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldDockBigOverlays, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterActivityLifecycleCallbacks, unregisterComponentCallbacks, unregisterForContextMenu -
Methods inherited from class android.app.Activity
applyOverrideConfiguration, getAssets, getTheme, onPointerCaptureChanged, setTheme -
Methods inherited from class com.canhub.cropper.CropImageActivity
addContentView, attachBaseContext, closeOptionsMenu, dispatchKeyEvent, findViewById, getDelegate, getDrawerToggleDelegate, getMenuInflater, getResources, getSupportActionBar, getSupportParentActivityIntent, invalidateOptionsMenu, onConfigurationChanged, onContentChanged, onCreateSupportNavigateUpTaskStack, onDestroy, onKeyDown, onMenuItemSelected, onMenuOpened, onNightModeChanged, onPanelClosed, onPostCreate, onPostResume, onPrepareSupportNavigateUpTaskStack, onSupportActionModeFinished, onSupportActionModeStarted, onSupportContentChanged, onSupportNavigateUp, onTitleChanged, onWindowStartingSupportActionMode, openOptionsMenu, setContentView, setContentView, setContentView, setSupportActionBar, setSupportProgress, setSupportProgressBarIndeterminate, setSupportProgressBarIndeterminateVisibility, setSupportProgressBarVisibility, setTheme, startSupportActionMode, supportInvalidateOptionsMenu, supportNavigateUpTo, supportRequestWindowFeature, supportShouldUpRecreateTask -
Methods inherited from class android.view.ContextThemeWrapper
bindIsolatedService, bindService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterReceiver, updateServiceGroup -
Methods inherited from class android.content.ContextWrapper
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions -
Methods inherited from class androidx.appcompat.app.AppCompatActivity
dispatchFragmentsOnCreateView, dump, getSupportFragmentManager, getSupportLoaderManager, markFragmentsCreated, onActivityResult, onAttachFragment, onCreatePanelMenu, onCreateView, onCreateView, onLowMemory, onMultiWindowModeChanged, onNewIntent, onPause, onPictureInPictureModeChanged, onPrepareOptionsPanel, onPreparePanel, onRequestPermissionsResult, onResume, onResumeFragments, onStateNotSaved, setEnterSharedElementCallback, setExitSharedElementCallback, startActivityFromFragment, startActivityFromFragment, startIntentSenderFromFragment, supportFinishAfterTransition, supportPostponeEnterTransition, supportStartPostponedEnterTransition, validateRequestPermissionsRequestCode -
Methods inherited from class androidx.activity.ComponentActivity
dispatchKeyShortcutEvent, getExtraData, putExtraData, shouldDumpInternalState, superDispatchKeyEvent -
Methods inherited from class androidx.fragment.app.FragmentActivity
addMenuProvider, addMenuProvider, addMenuProvider, addOnConfigurationChangedListener, addOnContextAvailableListener, addOnMultiWindowModeChangedListener, addOnNewIntentListener, addOnPictureInPictureModeChangedListener, addOnTrimMemoryListener, ensureViewModelStore, getActivityResultRegistry, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getLastCustomNonConfigurationInstance, getLifecycle, getOnBackPressedDispatcher, getViewModelStore, invalidateMenu, onBackPressed, onMultiWindowModeChanged, onPictureInPictureModeChanged, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onTrimMemory, peekAvailableContext, registerForActivityResult, registerForActivityResult, removeMenuProvider, removeOnConfigurationChangedListener, removeOnContextAvailableListener, removeOnMultiWindowModeChangedListener, removeOnNewIntentListener, removeOnPictureInPictureModeChangedListener, removeOnTrimMemoryListener, reportFullyDrawn, startActivityForResult, startActivityForResult, startIntentSenderForResult, startIntentSenderForResult -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getSavedStateRegistry
@NonNull() final SavedStateRegistry getSavedStateRegistry()
-
showImageSourceDialog
Unit showImageSourceDialog(Function1<CropImageActivity.Source, Unit> openSource)
This method show the dialog for user source choice, it is an open function so can be overridden and customised with the app layout if you need.
-
onCreateOptionsMenu
Boolean onCreateOptionsMenu(Menu menu)
-
onOptionsItemSelected
Boolean onOptionsItemSelected(MenuItem item)
-
onSetImageUriComplete
Unit onSetImageUriComplete(CropImageView view, Uri uri, Exception error)
Called when a crop image view has completed loading image for cropping.<br></br> If loading failed error parameter will contain the error.
view The crop image view that loading of image was complete. uri the URI of the image that was loading error if error occurred during loading will contain the error, otherwise null.
-
onCropImageComplete
Unit onCropImageComplete(CropImageView view, CropImageView.CropResult result)
Called when a crop image view has completed cropping image.<br></br> Result object contains the cropped bitmap, saved cropped image uri, crop points data or the error occurred during cropping.
view The crop image view that cropping of image was complete. result the crop image result data (with cropped image or error)
-
setCropImageView
Unit setCropImageView(CropImageView cropImageView)
When extending this activity, please set your own ImageCropView
-
rotateImage
Unit rotateImage(Integer degrees)
Rotate the image in the crop image view.
-
setResult
Unit setResult(Uri uri, Exception error, Integer sampleSize)
Result with cropped image data or error if failed.
-
setResultCancel
Unit setResultCancel()
Cancel of cropping activity.
-
getResultIntent
Intent getResultIntent(Uri uri, Exception error, Integer sampleSize)
Get intent instance to be used for the result of this activity.
-
updateMenuItemIconColor
Unit updateMenuItemIconColor(Menu menu, Integer itemId, Integer color)
Update the color of a specific menu item to the given color.
-
updateMenuItemTextColor
Unit updateMenuItemTextColor(Menu menu, Integer itemId, Integer color)
Update the color of a specific menu item to the given color.
-
-
-
-