hi all, i'm trying to interop with an android view...
# compose
s
hi all, i'm trying to interop with an android view inside of compose, specifically this library Konfetti. It's not filling the screen, nor is the animation playing - this is what i have so far:
Copy code
@Composable
fun Confetti() {
    val context = ContextAmbient.current
    val konfettiView = remember {
        KonfettiView(context).apply {
            build()
                .addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
                .setDirection(0.0, 359.0)
                .setSpeed(1f, 5f)
                .setFadeOutEnabled(true)
                .setTimeToLive(2000L)
                .addShapes(Square, Circle)
                .addSizes(Size(12))
                .setPosition(-50f, 500 + 50f, -50f, -50f)
                .streamFor(300, 5000L)
        }
    }
    
    AndroidView({ konfettiView }, modifier = Modifier.fillMaxSize()) { view ->
        // Do something here?
    }
}
really hard to understand what's going wrong here! any advice?
can I offer a bounty to get help? say $100 venmo?
z
I don’t have the solution. But it might help you to find the right direction. I have added a clickable modifier. Now whenever I tap on the screen then the animation get executed for a second and stops. This is weird.
Copy code
@Composable
fun Greeting(name: String) {
    AndroidView(
            viewBlock = {
                KonfettiView(it)
            },
            modifier = Modifier.fillMaxSize()
                    .clickable(onClick = { })
    ) {

        it.build()
                .addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
                .setDirection(0.0, 359.0)
                .setSpeed(1f, 5f)
                .setFadeOutEnabled(true)
                .setTimeToLive(2000L)
                .addShapes(Shape.Square, Shape.Circle)
                .addSizes(Size(12))
                .setPosition(-50f, 500 + 50f, -50f, -50f)
                .streamFor(particlesPerSecond = 300, emittingTime = StreamEmitter.INDEFINITE)

    }
}
s
i'm getting the same behavior, very weird!
as long as i keep tapping, it continues to play
maybe @Ian Lake or @Leland Richardson [G] has an idea as to why animations would only play during the onClick animation?
z
This sounds like a bug. Did you file a bug?
s
i don't know enough about compose to know for sure if it's a bug or if i'm not understanding how interop works. should i file anyway?
a
Please file. I presume that KonfettiView is calling
View.invalidate()
on itself to perform its animation and that isn't happening as expected here for whatever reason. @Mihai Popa might be interested to take a look next week
m
@Sam this certainly looks like a bug, please file a bug unless you have already done so, and I will take a look
s
hi @Mihai Popa where is the best place to file a bug?
z
there’s a link in the channel topic
s
ok my first time, i have a bunch besides this one that might be helpful
z
is there any progress on this? I am having an issue which might be similar with this: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1606422344290000