Skip to content

Feat/reorder library tabs#217

Merged
theovilardo merged 7 commits intomasterfrom
feat/reorder-library-tabs
Oct 9, 2025
Merged

Feat/reorder library tabs#217
theovilardo merged 7 commits intomasterfrom
feat/reorder-library-tabs

Conversation

@theovilardo
Copy link
Owner

No description provided.

google-labs-jules bot and others added 6 commits October 9, 2025 12:45
This commit introduces the ability for users to reorder the tabs on the Library screen.

Key changes:
- An "Edit" button has been added to the tab row in `LibraryScreen`.
- Tapping the "Edit" button opens a new bottom sheet (`ReorderTabsSheet`).
- The bottom sheet allows users to drag and drop tabs to change their order, using the `sh.calvin.reorderable` library.
- A "Done" button in the bottom sheet saves the new order. A brief loading indicator is shown for user feedback.
- The tab order is persisted across app restarts using `DataStore` in `UserPreferencesRepository`.
- `PlayerViewModel` has been updated to manage and persist the tab order state.
This commit addresses two distinct UI issues:

1.  **Fixes Reorderable List State:** The `ReorderTabsSheet` is updated to explicitly create a `LazyListState` using `rememberLazyListState()`. This state is then passed to both the `rememberReorderableLazyListState` and the `LazyColumn`. This resolves a bug where the list's scroll position would reset during reordering, ensuring a stable and predictable user experience.

2.  **Corrects `AboutScreen` Padding:** The bottom content padding in the `AboutScreen`'s `LazyColumn` has been adjusted. It now correctly accounts for the height of the `MiniPlayer`, preventing the mini-player from overlapping the last few items on the screen.
…nctionality

This commit addresses feedback on the reorderable library tabs feature.

Key changes:
- **Fix `HorizontalPager` Synchronization:** The `HorizontalPager` in `LibraryScreen.kt` now correctly displays its pages in the order defined by the reordered tabs. All UI components that depend on the page index now derive their content from the dynamic `tabTitles` list, ensuring that the content remains synchronized with the tab order.
- **Add Reset Functionality:** A "Reset" button has been added to the `ReorderTabsSheet`. This allows the user to restore the default tab order. The underlying logic has been implemented in the `PlayerViewModel` and `UserPreferencesRepository` to remove the custom order from `DataStore`.
This commit refines the UI for the reorderable library tabs feature based on user feedback.

Key changes:
- **Styled Edit Button:** The 'Edit' button in the `LibraryScreen`'s `ScrollableTabRow` is now wrapped in the `TabAnimation` composable, making its style consistent with the other tabs. The `TabAnimation` composable was also refactored to accept a generic `@Composable` content lambda for greater flexibility.
- **Redesigned Bottom Sheet:** The `ReorderTabsSheet` has been redesigned to align with the app's Material 3 expressive style. It now includes a prominent title, updated colors, and reorderable items styled to match the `SongPickerBottomSheet`, providing a more cohesive user experience.
…yListState

This commit refactors the `ReorderTabsSheet` to explicitly create and provide a `LazyListState` to `rememberReorderableLazyListState`.

Previously, the reorderable state was implicitly creating and managing its own `LazyListState`. While functional, the updated `reorderable` library documentation recommends creating the state explicitly and passing it to both the `ReorderableLazyListState` and the `LazyColumn`.

This change aligns with the library's best practices, improving clarity and maintainability without altering functionality.
This commit introduces several refinements to the UI and user experience, primarily focusing on the tab reordering feature.

### Key Changes:

1.  **Reorder Tabs UX Improvement:**
    *   The "Reset" button in the `ReorderTabsSheet` has been replaced with an icon button within a new floating toolbar.
    *   A confirmation `AlertDialog` is now displayed before resetting the tab order to prevent accidental changes.
    *   A new `FloatingToolBar` composable has been created to encapsulate the "Reset" and "Done" actions, providing a cleaner and more organized layout.

2.  **UI Cleanup:**
    *   **QueueBottomSheet:** Removed a block of commented-out and redundant code for item clipping and click handling, simplifying the component.
    *   **LyricsSheet:** Fixed an issue where the tab title was not being displayed by correctly placing the `Text` composable within the `TabAnimation`'s content lambda.
    *   **LibraryScreen:** Removed a commented-out `aspectRatio` modifier.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/theovilardo/PixelPlay/blob/1c6d00daff7af733515aa0c5ae9763287f1696c0/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlayerViewModel.kt#L2635-L2639
P1 Badge Load library data based on static indices after tab reorder

The new tab-reordering flow means the first, second, etc. tabs are no longer tied to specific categories. onLibraryTabSelected still switches on the numeric index and triggers loadSongsIfNeeded(), loadAlbumsIfNeeded(), and loadArtistsIfNeeded() for hard-coded indices. If the user moves “Albums” to the first position, selecting that tab will still call loadSongsIfNeeded() and albums never load until they visit whatever index happens to be 1. This leaves reordered tabs showing empty content. Consider branching on the tab identifier (e.g., "ALBUMS") rather than the position.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

@theovilardo theovilardo merged commit 659aff8 into master Oct 9, 2025
@theovilardo
Copy link
Owner Author

💡 Codex Review

https://github.com/theovilardo/PixelPlay/blob/1c6d00daff7af733515aa0c5ae9763287f1696c0/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlayerViewModel.kt#L2635-L2639

P1 Badge Load library data based on static indices after tab reorder
The new tab-reordering flow means the first, second, etc. tabs are no longer tied to specific categories. onLibraryTabSelected still switches on the numeric index and triggers loadSongsIfNeeded(), loadAlbumsIfNeeded(), and loadArtistsIfNeeded() for hard-coded indices. If the user moves “Albums” to the first position, selecting that tab will still call loadSongsIfNeeded() and albums never load until they visit whatever index happens to be 1. This leaves reordered tabs showing empty content. Consider branching on the tab identifier (e.g., "ALBUMS") rather than the position.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

@codex adress this feedback

@chatgpt-codex-connector
Copy link

💡 Codex Review

https://github.com/theovilardo/PixelPlay/blob/659aff8022cdfda6b11780df945d35a1b90e5619/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlayerViewModel.kt#L2635-L2639
P1 Badge Load tabs by identifier instead of position

onLibraryTabSelected still switches on hard-coded numeric indices to decide which lazy loader to trigger. After a user reorders the library tabs, index 0 may point at “Albums” but the code will still call loadSongsIfNeeded() and mark index 0 as loaded, leaving the Albums tab empty until the user visits whatever tab now sits at index 1. The branch should derive the loader from the tab’s identifier (e.g., from libraryTabsFlow) and track loaded tabs by that identifier rather than static positions.


https://github.com/theovilardo/PixelPlay/blob/659aff8022cdfda6b11780df945d35a1b90e5619/app/src/main/java/com/theveloper/pixelplay/presentation/viewmodel/PlayerViewModel.kt#L324-L329
P0 Badge Import decodeFromString for tab order deserialization

libraryTabsFlow uses Json.decodeFromString to parse the saved tab order, but this file only imports encodeToString; the decodeFromString extension is never imported. As written the project will not compile (Unresolved reference: decodeFromString). Add import kotlinx.serialization.decodeFromString (or fully qualify the call) so the new flow builds.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

@theovilardo theovilardo deleted the feat/reorder-library-tabs branch October 16, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant