karandeep singh
01/05/2024, 3:03 PMFatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=101; index=-12
at androidx.compose.animation.AndroidFlingSpline.flingPosition(SplineBasedDecay.kt:96)
at androidx.compose.animation.FlingCalculator$FlingInfo.position(FlingCalculator.java:120)
at androidx.compose.animation.SplineBasedFloatDecayAnimationSpec.getValueFromNanos(SplineBasedFloatDecayAnimationSpec.kt:51)
at androidx.compose.animation.core.VectorizedFloatDecaySpec.getValueFromNanos(VectorizedFloatDecaySpec.java:144)
at androidx.compose.animation.core.DecayAnimation.getValueFromNanos(Animation.kt:401)
karandeep singh
01/05/2024, 3:04 PMDoris Liu
01/05/2024, 7:03 PMkarandeep singh
01/09/2024, 6:11 AMLaunchedEffect(key1 = Unit, block = {
var lastFrameTime = 0L
withFrameNanos { frameTimeNanos ->
if (frameTimeNanos < lastFrameTime) {
Timber.tag("compose_debug").v("last_frame_time: $lastFrameTime : current_frame_time: $frameTimeNanos : decreasing frame time")
}
lastFrameTime = frameTimeNanos
}
})
something like this would work @Doris Liu?Doris Liu
01/09/2024, 5:34 PMwithFrameNanos
so that we can inspect consecutive frame callbacks during the animation. With that said, you might also want to time bound the while loop so that frame callbacks are only requested as needed (i.e. during the fling animation).karandeep singh
01/09/2024, 6:23 PMDoris Liu
01/09/2024, 7:38 PMshould we log this in when scroll is in progress?Logging based on
isScrollInProgress
might be the easier way to do it. The LaunchedEffect
could key on it so the job gets canceled when scrolling finishes, like:
LaunchedEffect(state.isScrollInProgress) {
if (state.isScrollInProgress) { // while-loop goes here }
}