Skip to content

Optim/unified player sheet arch redesign#1013

Merged
theovilardo merged 3 commits intomasterfrom
optim/unified-player-sheet-arch-redesign
Feb 9, 2026
Merged

Optim/unified player sheet arch redesign#1013
theovilardo merged 3 commits intomasterfrom
optim/unified-player-sheet-arch-redesign

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

No description provided.

…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.
@theovilardo theovilardo merged commit d1d02fb into master Feb 9, 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