Fixed
Status Update
Comments
hu...@google.com <hu...@google.com>
js...@google.com <js...@google.com>
js...@google.com <js...@google.com>
js...@google.com <js...@google.com>
an...@google.com <an...@google.com> #2
There's some code in the tracers:
com.swissborg.app.common.compose.navigation.NavigationAnimationsKt$offsetXFactor$1 in invoke-3p2s80s at line 24
com.swissborg.app.common.compose.navigation.NavigationAnimationsKt$offsetXFactor$1 in invoke at line 23
Woudl you be able to link it or provide a similar code to what you have to help us debug further? How offsetXFactor looks like as well as your custom navigation logic and how it swaps the screens
an...@google.com <an...@google.com> #3
this is how offsetXFactor looks like:
```
private fun Modifier.offsetXFactor(
offsetX: (fullWidth: Int) -> Int,
factor: Float,
): Modifier = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
placeable.placeRelative(
x = lerp(0f, offsetX(placeable.width).toFloat(), factor).toInt(),
y = 0,
)
}
}
```
and this is how we swap the screens:
```
fun slideHorizontally(
offsetX: (fullWidth: Int) -> Int,
animationSpec: FiniteAnimationSpec<Float> = tween(),
): StackAnimator = stackAnimator(animationSpec = animationSpec) { factor, _, content ->
content(Modifier.offsetXFactor(offsetX, factor))
}
```
we use different enter/exit transition animations, i.e.
```
open fun enterTransition(): StackAnimator = slideHorizontally(
offsetX = { it },
animationSpec = tween(ScreenTransitionAnimationDuration),
)
```
```
private fun Modifier.offsetXFactor(
offsetX: (fullWidth: Int) -> Int,
factor: Float,
): Modifier = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
placeable.placeRelative(
x = lerp(0f, offsetX(placeable.width).toFloat(), factor).toInt(),
y = 0,
)
}
}
```
and this is how we swap the screens:
```
fun slideHorizontally(
offsetX: (fullWidth: Int) -> Int,
animationSpec: FiniteAnimationSpec<Float> = tween(),
): StackAnimator = stackAnimator(animationSpec = animationSpec) { factor, _, content ->
content(Modifier.offsetXFactor(offsetX, factor))
}
```
we use different enter/exit transition animations, i.e.
```
open fun enterTransition(): StackAnimator = slideHorizontally(
offsetX = { it },
animationSpec = tween(ScreenTransitionAnimationDuration),
)
```
Description
When @Parcelize support was added for sealed classes the final implementation also included support for sealed interfaces , however Lint still gives the following warning for deriving classes:
Sample snippet:
This warning was fixed for the sealed class case in a previous issue , but sealed interfaces still report the warning, requiring the annotation on each child to remove the warning despite the code running successfully with just the parent annotation.
Studio Build: #AI-242.23339.11.2421.12483815
Version of Gradle Plugin: 8.3.1
Version of Gradle: 8.11
OS: MacOS 15.2