Optimize player sheet animations for smoother transitions#488
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| LaunchedEffect(showPlayerContentArea, currentSheetContentState) { | ||
| val targetFraction = | ||
| if (showPlayerContentArea && currentSheetContentState == PlayerSheetState.EXPANDED) 1f else 0f | ||
| val targetExpanded = showPlayerContentArea && currentSheetContentState == PlayerSheetState.EXPANDED | ||
|
|
||
| playerContentExpansionFraction.animateTo( | ||
| targetValue = targetFraction, | ||
| animationSpec = tween( | ||
| durationMillis = ANIMATION_DURATION_MS, | ||
| easing = FastOutSlowInEasing | ||
| ) | ||
| ) | ||
| animatePlayerSheet(targetExpanded = targetExpanded) |
There was a problem hiding this comment.
Sheet translation ignores new collapsed target
The new animatePlayerSheet helper is now the only place updating currentSheetTranslationY, and the surrounding LaunchedEffect is keyed only on showPlayerContentArea and currentSheetContentState. When sheetCollapsedTargetY changes while the sheet state stays the same (e.g., MainActivity recomputes it when the current route hides the mini player or bottom padding changes), this effect never re-runs, so the animatable stays at the old offset and the sheet renders at the wrong Y until the user drags or toggles the sheet. The removed LaunchedEffect(... sheetCollapsedTargetY, sheetExpandedTargetY) used to retarget the translation for these layout changes; with it gone, collapsed/expanded positions no longer track their moving targets.
Useful? React with 👍 / 👎.
The `kotlinx.coroutines.sync.MutatorMutex` import was removed as `androidx.compose.foundation.MutatorMutex` is already imported and used in `UnifiedPlayerSheet.kt`.
Summary
Testing
Codex Task