Optimize UnifiedPlayerSheet animations#617
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
…y shadows, and eliminate composition churn
…vider and graphicsLayer
* Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer while keeping `AbsoluteSmoothCornerShape` for the visible background. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Fixed compilation issues related to `TopAppBar` and `Scaffold` parameter usage.
…error * Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer while keeping `AbsoluteSmoothCornerShape` for the visible background. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Fixed `Unresolved reference: expansionFraction` compilation error in `FullPlayerContent.kt` by using `expansionFractionProvider` inside `graphicsLayer`.
…atures * Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Restored "Delay Content" functionality: Updated `FullPlayerContent` to respect `FullPlayerLoadingTweaks` by dynamically adjusting alpha start thresholds (e.g., 0.95f) when delay is enabled. * Fixed `Unresolved reference: expansionFraction` compilation error.
…aceholders * Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Restored "Delay Content" features: Added `DelayedContent` composable wrapper and implemented `ShimmerBox` placeholders for Album, Controls, Metadata, and Progress. * Fixed `Unresolved reference: expansionFraction` compilation error. * Fixed regression where TopAppBar disappeared when "Delay All" was enabled; it now remains visible during transitions.
* Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Restored "Delay Content" features with `DelayedContent` wrapper. * Restored exact dimensions and padding for Placeholders (`ShimmerBox`) to match real content (`AlbumCover`, `Controls`, `Metadata`, `Progress`) precisely, as requested. * Fixed `Unresolved reference: expansionFraction` compilation error.
…roll fix * Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Restored "Delay Content" features with `DelayedContent` wrapper and updated threshold (0.85f -> 1.0f) for smoother, less abrupt transitions. * Restored exact dimensions and padding for Placeholders (`ShimmerBox`) to match real content precisely. * Fixed `AutoScrollingTextOnDemand` broken by the optimization: updated it to accept `expansionFractionProvider` and use `derivedStateOf` to correctly trigger scrolling only when fully expanded (> 0.99f). * Fixed `Unresolved reference: expansionFraction` compilation error.
…holders * Refactored `UnifiedPlayerSheet` to use `Modifier.offset` instead of `Modifier.height` for expansion, eliminating layout thrashing. * Updated `FullPlayerContent` to accept expansion fraction as a provider lambda `() -> Float` to prevent expensive recompositions during drag. * Moved staggered animations (alpha, translation) into `Modifier.graphicsLayer`. * Optimized shadow rendering by using `RoundedCornerShape` for the shadow layer. * Implemented `zIndex` and off-screen offset logic to ensure correct interactivity of MiniPlayer and underlying content. * Restored "Delay Content" features with `DelayedContent` wrapper and updated threshold for smoother transitions. * Replaced `ShimmerBox` placeholders with simpler, static `PlaceholderBox` composables using `Surface` and `RoundedCornerShape`, matching the exact requested design and layout. * Updated `FullPlayerLoadingTweaks` to disable `showPlaceholders` by default. * Fixed `AutoScrollingTextOnDemand` to work with the provider-based state. * Fixed `Unresolved reference: expansionFraction` compilation error.
…eter
Updates the `MarqueeText` composable in `LibraryScreen.kt` to align with a recent API change.
- The `expansionFraction` parameter, which previously accepted a `Float`, is now changed to `expansionFractionProvider`, which accepts a lambda `() -> Float`.
- The implementation is updated from `expansionFraction = 1f` to `expansionFractionProvider = { 1f }` to match the new function signature.
This change optimizes the performance of the
UnifiedPlayerSheetexpansion and collapse animations, specifically targeting lag on mid/low-end devices.Key changes:
Modifier.height(animated...)on the rootSurfacewith a fixed-height strategy (.fillMaxWidth().height(containerHeight)) combined withModifier.offset. This prevents the entire player hierarchy from being re-measured and re-laid out on every frame of the animation, moving the workload to the placement/draw phase.AbsoluteSmoothCornerShape(which generates a complex Path every frame) withRoundedCornerShapein the.shadow()modifier. The visual background (.backgroundand.clip) retains the high-qualityAbsoluteSmoothCornerShapeto preserve the design intent, while the shadow uses the cheaper primitive for GPU efficiency.FullPlayerContentthat were initially considered for removal, ensuring the UX remains fluid and rich.Included a
PERFORMANCE_ANALYSIS.mddetailing the diagnosis and strategy.PR created automatically by Jules for task 2316053300601963138 started by @theovilardo