Skip to content

Refactor(Library): Replace sort dropdown with bottom sheet#286

Merged
theovilardo merged 1 commit intomasterfrom
fix-new-sorting-m
Oct 23, 2025
Merged

Refactor(Library): Replace sort dropdown with bottom sheet#286
theovilardo merged 1 commit intomasterfrom
fix-new-sorting-m

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

This commit replaces the legacy dropdown menu for sorting in the library with a new LibrarySortBottomSheet. This improves the user experience and modernizes the component.

Key changes include:

  • LibrarySortBottomSheet.kt: New composable for the bottom sheet UI.
  • LibraryActionRow.kt: Removed the DropdownMenu and replaced it with a simple onSortClick callback to trigger the bottom sheet.
  • SortOption.kt: Refactored to include a stable storageKey for persistence, separate from the displayName. A fromStorageKey companion function was added for safe parsing and legacy value migration.
  • ViewModels: PlayerViewModel and PlaylistViewModel are updated to use storageKey for saving sort preferences and to manage the visibility of the new bottom sheet.
  • LibraryScreen.kt: Integrated the LibrarySortBottomSheet and updated the logic to handle its state and actions. The tab management logic was also refactored to use LibraryTabId enum and storageKey for persistence and state handling.
  • UserPreferencesRepository.kt: Added logic to migrate old display name-based sort preferences to the new storage key system.
  • LibraryTabId.kt: Introduced a new enum to represent library tabs with stable storageKey, title, and default SortOption.

This commit replaces the legacy dropdown menu for sorting in the library with a new `LibrarySortBottomSheet`. This improves the user experience and modernizes the component.

Key changes include:
- **`LibrarySortBottomSheet.kt`**: New composable for the bottom sheet UI.
- **`LibraryActionRow.kt`**: Removed the `DropdownMenu` and replaced it with a simple `onSortClick` callback to trigger the bottom sheet.
- **`SortOption.kt`**: Refactored to include a stable `storageKey` for persistence, separate from the `displayName`. A `fromStorageKey` companion function was added for safe parsing and legacy value migration.
- **ViewModels**: `PlayerViewModel` and `PlaylistViewModel` are updated to use `storageKey` for saving sort preferences and to manage the visibility of the new bottom sheet.
- **`LibraryScreen.kt`**: Integrated the `LibrarySortBottomSheet` and updated the logic to handle its state and actions. The tab management logic was also refactored to use `LibraryTabId` enum and `storageKey` for persistence and state handling.
- **`UserPreferencesRepository.kt`**: Added logic to migrate old display name-based sort preferences to the new storage key system.
- **`LibraryTabId.kt`**: Introduced a new enum to represent library tabs with stable `storageKey`, `title`, and default `SortOption`.
@theovilardo theovilardo merged commit 64e89e7 into master Oct 23, 2025
@lostf1sh lostf1sh deleted the fix-new-sorting-m branch January 16, 2026 20:48
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