-
-
Notifications
You must be signed in to change notification settings - Fork 302
Description
I have tried :
@composable
fun ComposableCropImageView(position: Int, setCropImageView: (CropImageView) -> Unit, force16_9: Boolean){
// Image Cropper fill the remaining available height
AndroidView(
factory = { context ->
Log.d(TAG, "in factory")
val uri = getPhotoUri(position)
var anaBitmap = getAnaBitmap(uri)
if (isHalfWidth){
anaBitmap = anaBitmap.scale(anaBitmap.width * 2, anaBitmap.height, false)
}
Log.d(TAG, "HERE")
CropImageView(context).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
setImageBitmap(anaBitmap)
setOnCropWindowChangedListener { onCropWindowChangedCallback(cropRect) }
setCropImageView(this) // Store the instance
Log.d(TAG, "end factory")
}
},
modifier = Modifier
.fillMaxSize(),
update = {cropImageView ->
Log.d(TAG, "start update")
if (force16_9) {
cropImageView.setAspectRatio(16, 9)
cropImageView.setFixedAspectRatio(true)
sharedViewModel.setCropAspectRatio16x9(true)
}
else {
cropImageView.setFixedAspectRatio(false)
sharedViewModel.setCropAspectRatio16x9(false)
}
Log.d(TAG, "end update")
}
)
}
but adding this Composable to my screen makes a timeout while composition. and then a crash and a tombstone file.