Skip to content

Fix shuffle queue not being full length and not random.#133

Merged
theovilardo merged 6 commits intotheovilardo:masterfrom
ColbyCabrera:fix/shuffle-queue
Sep 9, 2025
Merged

Fix shuffle queue not being full length and not random.#133
theovilardo merged 6 commits intotheovilardo:masterfrom
ColbyCabrera:fix/shuffle-queue

Conversation

@ColbyCabrera
Copy link
Copy Markdown
Contributor

The shuffle queue in my last PR had a regression from the jules bot that slipped though the cracks (sorry I should have tested more thoroughly). This fixes that issue and the chosen song is now properly pushed to the front of queue.

google-labs-jules bot and others added 6 commits September 8, 2025 23:00
The album art in the Glance widget was being manually scaled to the exact dimensions of its container, ignoring the original aspect ratio. This caused the image to appear warped or stretched in non-square widget sizes.

This commit removes the manual `Bitmap.scale()` call and relies on the `Image` composable's `ContentScale.Crop` to handle scaling correctly. `ContentScale.Crop` ensures the aspect ratio is preserved while the image fills its bounds, preventing any distortion.
This commit removes an obsolete comment related to bitmap scaling in the `PixelPlayGlanceWidget.kt` file. The comment indicated that bitmap scaling was no longer handled in that specific code block, which is now the default behavior.
This commit introduces minor refactoring to the `PixelPlayGlanceWidget`.

Key changes:
- **Import Order:** The import statement for `androidx.glance.unit.ColorProvider` has been moved to align with standard import ordering.
- **Divider Color:** The `dividerColor` variable was removed and its `ColorProvider` value is now directly applied to the background modifier of a `Box` used as a divider. This simplifies the code by removing an intermediate variable.
- **Padding:** A comment indicating a fix for applying padding to an outer `Box` has been updated to reflect the change more accurately.
This commit refactors the shuffle functionality in `PlayerViewModel.kt` to ensure the queue is the full length of all the songs in the playlist. It also introduces some debug logging to aid in troubleshooting shuffle and queue management.

Key changes:
- **Shuffle Logic:**
    - `shuffleAllSongs()` now shuffles the entire list of songs first and then picks the first song from this shuffled list to start playback. This ensures the first song played is also part of the random sequence.
    - `createShuffledQueue()` now directly shuffles the input list and logs the chosen first song.
    - In `onShuffleModeEnabledChanged`, when the player is empty and shuffle is enabled, a new shuffled queue is created and played only if the `_masterAllSongs` list is not empty.
- **Debug Logging:**
    - Added "ShuffleDebug" logs to `shuffleAllSongs()`, `showAndPlaySong()`, `playAlbum()`, `playArtist()`, `onShuffleModeEnabledChanged()`, and `createShuffledQueue()` to track the flow of shuffle operations and queue creation.
- **Minor Log Update:**
    - Corrected an indentation issue in a log message within `preloadThemesAndInitialData()`.
@theovilardo theovilardo merged commit 8b5f21c into theovilardo:master Sep 9, 2025
@ColbyCabrera ColbyCabrera deleted the fix/shuffle-queue branch September 10, 2025 17:55
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.

2 participants