Merged
Conversation
… loading
- **Favorites & Paging**:
- Implements Room-level pagination for "Liked Songs" using `PagingSource` to handle large libraries efficiently.
- Moves favorite songs sorting and filtering to the database level, replacing in-memory transformations.
- Adds `getFavoriteSongCountFlow` and `getPaginatedFavoriteSongs` to `MusicRepository`.
- **Performance & Memory**:
- Adds `SEARCH_RESULTS_LIMIT` to search queries to prevent memory issues with large result sets.
- Updates `PlayerViewModel` to load songs for daily mixes, random playback, and shuffle on-demand from the DB instead of maintaining permanent in-memory subscriptions to the entire library.
- Replaces `allSongs.find` scans with direct Room queries via `observeSong(id)`.
- **Data Consistency**:
- Synchronizes favorite status between Room database and `DataStore` preferences.
- Refactors favorite toggling logic into a unified `setFavoriteStatusEverywhere` method to ensure consistency across the UI and notification service.
- **UI & ViewModels**:
- Updates `LibraryScreen` and `LibraryFavoritesTab` to use `LazyPagingItems` for the Liked Songs tab.
- Polishes UI components in `LibraryScreen` with better scrollbar padding and transition handling.
- Refines folder navigation and multi-selection logic for better responsiveness.
- **Performance & Animations**:
- Implement a "drag pipeline" with frame-paced updates using `withFrameNanos` and `MonotonicFrameClock` to coalesce high-frequency drag deltas.
- Transition from `IntOffset` to `graphicsLayer { translationY = ... }` for sheet movement to avoid frequent recompositions and layout passes.
- Refine expansion/collapse animation durations and easing based on travel fraction for smoother tactile feedback.
- Reduce full-player rescaling depth from `0.95f` to `0.972f` to minimize layout pressure.
- **Queue Bottom Sheet**:
- Refactor `QueueBottomSheet` to use direct queue indexing instead of a paginated `QueueUiItem` wrapper, significantly reducing memory overhead on large queues.
- Optimize song list rendering by using `subList` and `RandomAccess` to avoid unnecessary list copying.
- Implement a local `reorderPreviewOrder` state to handle drag-and-drop reordering smoothly without immediate source-of-truth updates.
- Replace custom `swipeable` implementation with Material 3 `SwipeToDismissBox` for song removal.
- Improve auto-scroll behavior to jump (instead of animate) to the current song for large index gaps.
- **State Management**:
- Move `castSheetOpenFraction` and `queueVisualOpenFraction` to `animateFloatAsState` within dedicated state holders to decouple UI animations from parent recomposition loops.
- Simplify `SheetOverlayState` logic for calculating visibility and expansion fractions.
```
perf: optimize queue management for large collections and refine UI reordering
- **Performance & Scalability**:
- Implement `QueueUtils.buildAnchoredShuffleQueueSuspending` to prevent UI freezes (ANRs) when shuffling large queues (10,000+ songs) by yielding to the dispatcher.
- Introduce `BULK_REPLACE_THRESHOLD` in `PlaybackStateHolder` to switch from individual `moveMediaItem` IPC calls to a single `setMediaItems` call for large queues.
- Standardize shuffle logic across `QueueStateHolder` to use Fisher-Yates via `QueueUtils` for better randomness.
- **Queue UI Refinements**:
- Implement stable key tracking in `QueueBottomSheet` to prevent row state recycling glitches and "snapping" during reorders.
- Add a "grace update" mechanism to keep local reorder previews active until upstream data propagation is confirmed.
- Improve reordering animations using `Modifier.animateItem` with tuned spring specs.
- Revamp "Swipe to Dismiss" in the queue with a custom reveal background, haptic feedback triggers for activation thresholds, and better state synchronization.
- **Queue Management**:
- Update `playerViewModel` calls to use `showAndPlaySong` for unified behavior when triggering playback from overlays and the queue.
- Optimize `remapCommittedKeysForDisplay` in `QueueBottomSheet` with a fast-path for common queue-skip scenarios (suffix matching) to maintain stable keys.
- Refine `displaySongsSignature` calculation to include `queueIndexOffset` and use identity hashing for more accurate state tracking.
- **UI & Animations**:
- Distinguish between reordering and general list updates in `QueueBottomSheet` to apply context-aware animations.
- Use `spring` specs during active reordering for responsiveness and `tween` specs for standard list changes (fade in/out) to improve visual smoothness.
- Defer expensive ID mapping in `LaunchedEffect` to avoid unnecessary computations during rapid queue updates.
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.