https://kotlinlang.org logo
Title
a

agrosner

08/17/2022, 1:23 PM
we remember our own custom indication instance:
@Composable
    override fun rememberUpdatedInstance(interactionSource: InteractionSource): IndicationInstance {
    
//..
remember(interactionSource) {
            PressableIndicationInstance(
                isPressed = isPressed,
                cornerRadiusSizeInPx = cornerRadiusSize,
                scale = scale,
                overlayColor = color,
                overlayOpacity = config.overlayOpacity,
                hasOverlay = config.hasOverlay
            )
        }
}
nothing too crazy.
our indication instance draws this:
override fun ContentDrawScope.drawIndication() {
            if (isPressed.value) {
                scale(scale = scale.value) {
                    (this as ContentDrawScope).drawContent()
                    val color = overlayColor.copy(alpha = overlayOpacity)
                    val style = if (hasOverlay) Fill else Stroke()
                    if (cornerRadiusSizeInPx == 0.0f) {
                        drawRect(color = color, size = size, style = style)
                    } else {
                        drawRoundRect(
                            color = color,
                            size = size,
                            cornerRadius = CornerRadius(
                                cornerRadiusSizeInPx,
                                cornerRadiusSizeInPx,
                            ),
                            style = style
                        )
                    }
                }
            } else {
                drawContent()
            }
        }
nothing crazy. and its provided as a composition local
how does one go about debugging it?
it happens in these steps (when inside a fragment):
ON_CREATE
 ON_START 
 ON_RESUME
 ON_PAUSE 
 ON_STOP
 ON_START 
 ON_RESUME
after second resume from stop, crash