Optim/unified player sheet arch redesign#1013
Merged
theovilardo merged 3 commits intomasterfrom Feb 9, 2026
Merged
Conversation
…for V2 implementation
- **Architecture & Modularity**:
- Introduces `UnifiedPlayerSheetV2` as a rewrite host behind an experimental toggle in settings.
- Extracts UI layers into `UnifiedPlayerSheetLayers.kt` (Mini, Full, and Prewarm layers) and `UnifiedPlayerOverlaysLayer.kt` (Queue, Song Info, Save Queue, and Cast layers) to decouple rendering from state logic.
- Centralizes queue and song-info interaction wiring into `UnifiedPlayerQueueAndSongInfoHost`.
- **Gesture & Motion Control**:
- Extracts sheet motion logic into `SheetMotionController` to synchronize translation and expansion animations.
- Encapsulates vertical drag behavior into `SheetVerticalDragGestureHandler` and its associated math utility.
- Isolates mini-player horizontal dismiss logic into `MiniPlayerDismissGestureHandler`.
- Implements `playerSheetVerticalDragGesture` and `miniPlayerDismissHorizontalGesture` modifiers for cleaner pointer input handling.
- **Data & State**:
- Optimizes state collection in `UnifiedPlayerSheet` using `PlayerUiSheetSlice` to reduce unnecessary recompositions.
- Updates `UserPreferencesRepository` and `SettingsViewModel` to support the new `use_player_sheet_v2` preference.
- **Settings UI**:
- Adds a "Use Player Sheet V2" switch to the Experimental Settings screen.
- Decouple monolithic UI state into specialized scoped controllers and state holders:
- `QueueSheetController` & `rememberQueueSheetState`: Handles queue visibility, dragging, and snapping logic.
- `SheetVisualState`: Manages derived dimensions, translations, and dynamic corner radii.
- `SheetThemeState`: Encapsulates album art color extraction and mini-player transition animations.
- `SheetInteractionState`: Orchestrates vertical drag gestures and shape definitions.
- `SheetOverlayState`: Tracks keyboard visibility, scrim alpha, and content visibility flags.
- `SheetModalOverlayController`: Manages transient modal states for saving queues and song info.
- Extract functional components for lifecycle and gesture handling:
- `PlayerSheetPredictiveBackHandler`: Isolates predictive back navigation logic.
- `QueueSheetRuntimeEffects`: Handles side effects like haptic feedback and offset synchronization.
- `rememberMiniPlayerDismissGestureHandler`: Simplifies creation of horizontal dismiss logic.
- Simplify `UnifiedPlayerSheet` by replacing inline logic with delegated calls to the new scoped components.
…state management.
- **Cast & Remote Playback**:
- Rewrites `CastPlayer` with a command queueing and retry mechanism to handle remote operations asynchronously and prevent UI stalls.
- Enhances `CastTransferStateHolder` with a recovery system for suspended sessions and an "alignment" logic to ensure the remote player starts on the correct song.
- Implements deep audio MIME type detection (via file signature, `MediaExtractor`, and `MediaMetadataRetriever`) to ensure compatibility with Cast devices.
- Extends `MediaFileHttpServerService` with support for `HEAD` requests, stream revisions (cache busting), and robust error handling for client disconnections.
- Adds fallback logic to query `MediaStore` directly if a requested song is missing from the local repository during a Cast session.
- **UI & State Management**:
- Refactors `UnifiedPlayerSheet` by extract logic into scoped state holders: `rememberCastSheetState`, `rememberFullPlayerVisualState`, `rememberPrewarmFullPlayer`, and `PlayerArtistNavigationEffect`.
- Improves `CastBottomSheet` interaction by disabling the disconnect button during connection attempts and preventing redundant clicks on the active device.
- Synchronizes lyrics loading and theme extraction with remote playback events in `PlayerViewModel`.
- **Data & Performance**:
- Optimizes `MusicDao` by implementing a manual upsert strategy using `IGNORE` and `Update` to handle large metadata syncs more efficiently.
- Enhances `SyncWorker` and `MediaStoreSongRepository` to extract and persist `MIME_TYPE` from MediaStore.
- Adds `release()` calls to `CastPlayer` and `CastStateHolder` to prevent memory leaks during session transitions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.