Skip to content

Fix/unified player sheet lagging recomposition fix#921

Merged
theovilardo merged 4 commits intomasterfrom
fix/unified-player-sheet-lagging-recomposition-fix
Jan 26, 2026
Merged

Fix/unified player sheet lagging recomposition fix#921
theovilardo merged 4 commits intomasterfrom
fix/unified-player-sheet-lagging-recomposition-fix

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

  • Improved recompositions and optimized UnifiedPlayerSheet
  • Added new Slider style for M3E

- **Preferences & Data**:
    - Adds `USE_SMOOTH_CORNERS` to `UserPreferencesRepository` to allow users to toggle between smooth (superellipse) and standard rounded corners.
    - Implements `useSmoothCornersFlow` and `setUseSmoothCorners` in both `UserPreferencesRepository` and `SettingsViewModel`.
- **UI & Player**:
    - **UnifiedPlayerSheet**: Updates the player sheet to dynamically switch between `AbsoluteSmoothCornerShape` and `RoundedCornerShape` based on user preference. Logic ensures smooth shapes are disabled during active dragging or expansion animations to maintain performance.
    - **PlayerInternalNavigationBar**: Adjusts top padding for the `FULL_WIDTH` navigation bar style for a more compact layout.
- **Settings**:
    - Adds a new "Use Smooth Corners" toggle in the Appearance settings category, including a subtitle explaining the aesthetic benefit versus potential performance impact on low-end devices.
    - Integrates the new preference into `PlayerViewModel` for real-time UI updates within the player.
…t` by reducing unnecessary recompositions through granular state observation and state masking.

- **UnifiedPlayerSheet**:
    - Introduced `infrequentPlayerState` which masks volatile `currentPosition` updates, preventing the entire sheet from recomposing every second.
    - Implemented `positionToDisplayProvider` and other state providers to defer state reading to the specific sub-components that require it.
    - Refactored logic to use `infrequentPlayerState` for stable properties like `isPlaying`, `repeatMode`, and `isShuffleEnabled`.
    - Improved `showPlayerContentArea` derived state by using explicit keys to minimize recalculations.

- **FullPlayerContent**:
    - Replaced direct `stablePlayerState` collection with functional providers (`repeatModeProvider`, `totalDurationProvider`, `lyricsProvider`, etc.) to isolate UI updates.
    - Updated `FetchLyricsDialog` and `ExpandedControls` to utilize passed-in state providers instead of observing global state flows.
    - Optimized the pre-warming logic to use the new masked state, reducing jank when transitioning between tracks.

- **Internal State Logic**:
    - Refined the synchronization between remote and local playback positions using a distinct-until-changed mapping to ensure UI stability.
### Enhance Player UI performance and introduce expressive wavy slider

- **New Components**:
    - Introduces `WavySliderExpressive`, a Material 3-styled progress slider with an animated wave effect that flattens during interaction and supports a pill-to-line thumb morph.
- **Player Performance & Optimization**:
    - **UnifiedPlayerSheet**: Refactors Z-index and offset logic using `derivedStateOf` to prevent unnecessary recompositions during sheet expansion.
    - **FullPlayerContent**: Optimizes progress tracking by replacing `Animatable` with a direct state-derivation strategy and an "optimistic seek" mechanism to eliminate position snap-back.
    - **ComposeLoader**: Updates `rememberSmoothProgress` to return `State` objects, allowing UI components to observe progress changes without triggering full-scope recompositions.
    - **QueueBottomSheet**: Implements `remember` blocks for all callback lambdas and converts several properties (timer, play count) to `State` parameters to stabilize the UI.
- **Bug Fixes & Stability**:
    - Fixes "stepping" lag in the full player progress bar by isolating slider and label updates into dedicated components (`EfficientSlider`, `EfficientTimeLabels`).
    - Improves `QueueBottomSheet` visibility logic to ensure the sheet correctly re-measures on configuration changes (e.g., rotation).
    - Refines `HomeScreen` shuffle state observation to use `distinctUntilChanged`, reducing redundant UI refreshes.
- **UI/UX**:
    - Implements smoother alpha and scaling transitions between the mini-player and full-player views based on expansion fraction.
- **FullPlayerContent**:
    - Updates `WavySliderExpressive` integration to use explicit imports and adds horizontal padding for better alignment within the player UI.
- **WavySliderExpressive**:
    - Increases default `strokeWidth` to `5.dp` for better visibility.
    - Adjusts track geometry by reducing the `gapSize` and setting a fixed `stopSize` of `3.dp` to refine the visual transition between the thumb and the wavy track.
@theovilardo theovilardo merged commit de9b4c9 into master Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant