I am using CanHub image cropper in Jetpack Compose like this:
val profilePictureCropLauncher = rememberLauncherForActivityResult(
CropImageContract()
) { result ->
if (result.isSuccessful) {
profilePicturePath = result.uriContent!!
} else {
val exception = result.error
}
}
val profilePictureSelectorLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.GetContent()
) { uri ->
profilePictureCropLauncher.launch(
CropImageContractOptions(
uri,
CropImageOptions(
fixAspectRatio = true,
outputCompressFormat = Bitmap.CompressFormat.PNG
)
)
)
}
...
...
profilePictureSelectorLauncher.launch("image/*")
Where I first select an image from gallery/camera, then pass it to the CanHub cropping activity. However, in the crop activity, there is no button to confirm the crop.
Is there some code I'm missing? Thanks
Ok, I figured out the problem: I set my default AppTheme to a custom one that didn't have an action bar, I just had to explicitly declare CropImageActivity with a theme that had one, like Theme.AppCompat.