Some updates on the compose rewrite of an app from...
# compose
a
Some updates on the compose rewrite of an app from work ๐Ÿคญ๐Ÿคญ
๐Ÿ‘ 4
๐Ÿ™Œ๐Ÿผ 2
jetpack compose 10
๐ŸŽ‰ 6
๐Ÿ™Œ 5
๐Ÿ‘๐Ÿผ 1
There is support for account manager here too, just need to rewire it
This is very much a side project at the moment, but once it's fully featured, we plan on presenting this to head of product, kind of a skunk works type project
๐Ÿ‘Œ 2
s
And did you use compose navigation or stick with fragments and the UI was just compose?
a
Not using compose navigation, I wrote a small navigation system inspired by voyager and react-navigation
๐Ÿ™Œ 1
k
Nice transitions between screens. It reminds me iOSโ€™s native push animation
a
Thanks! @KamilH
i
Can you share your navigation system? I'd like to take a look at it
s
๐ŸŒŸ 1
a
@ildar.i [Android] a lot of it is modeled after voyager and react navigation
e
Those pulse animations look sweet
a
Thanks, a little bit of canvas and some math ๐Ÿ˜‰
Copy code
@Composable
fun Pulse(
    modifier: Modifier = Modifier,
    tint: Color = LocalContentColor.current,
    active: Boolean = true,
    bounded: Boolean = true,
    count: Int = 3,
    duration: Int = 1000,
) {
    if (!active) return

    val infiniteTransition = rememberInfiniteTransition()
    val pulses = buildList {
        for (i in 0 until count) {
            add(infiniteTransition.animateFloat(
                initialValue = 0F,
                targetValue = 1F,
                animationSpec = infiniteRepeatable(
                    animation = tween(duration * count, easing = FastOutSlowInEasing),
                    initialStartOffset = StartOffset(i * duration),
                )
            ))
        }
    }

    Canvas(modifier.then(if (bounded) Modifier.clipToBounds() else Modifier)) {
        val (a, b) = size
        val r = sqrt(a.pow(2) + b.pow(2)) / 2

        pulses.forEach {
            val progress = it.value

            scale(progress) {
                drawCircle(color.copy(alpha = (1F - progress) * 0.12F), r)
            }
        }
    }
}
๐Ÿ‘ 3
โค๏ธ 2
K 2
today i learned 1
Not sure if this is optimal, but if theres any way to squeeze more perf out of this, do tell ๐Ÿ™‚
m
Looking at it I thought you are just triggering the default touch ripple.
a
Not sure how much control Iโ€™d have using the normal touch ripples
Plus accessibility, would I have to trigger a click, vs another option?
m
I haven't looked how the ripple Indication is implemented in Compose, so no clue! The effect just looks like it so if I was going to implement it I would probably look there first. But going with Canvas definitely gives you better control.
a
The ripple indication refers to how android draws them internally afaik