feat: sort playlists alphabetically in "Add to playlist" dialog#5910
Open
eran132 wants to merge 1 commit into
Open
feat: sort playlists alphabetically in "Add to playlist" dialog#5910eran132 wants to merge 1 commit into
eran132 wants to merge 1 commit into
Conversation
The "Add to playlist" context menu listed playlists in most-recently-used order, so a playlist's position kept changing between invocations, making it hard to locate the less-recently-used ones. Sort the list alphabetically by title (case-insensitive) before building the dialog so each playlist keeps a stable, predictable position. The input list is copied first to avoid mutating the caller's list. Closes yuliskov#5904 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR changes playlist option ordering in the playlist dialog by sorting playlists alphabetically to keep their positions stable across openings.
Changes:
- Copy
playlistInfosinto a new list and sort it case-insensitively by title before rendering options. - Add an inline comment referencing issue #5904 to document the intent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1095
to
+1102
| // Sort playlists alphabetically so their position stays stable instead of | ||
| // shuffling around in most-recently-used order (see issue #5904). | ||
| List<PlaylistInfo> sortedPlaylistInfos = new ArrayList<>(playlistInfos); | ||
| Collections.sort(sortedPlaylistInfos, (info1, info2) -> { | ||
| String title1 = info1.getTitle() != null ? info1.getTitle() : ""; | ||
| String title2 = info2.getTitle() != null ? info2.getTitle() : ""; | ||
| return title1.compareToIgnoreCase(title2); | ||
| }); |
Comment on lines
+1097
to
+1102
| List<PlaylistInfo> sortedPlaylistInfos = new ArrayList<>(playlistInfos); | ||
| Collections.sort(sortedPlaylistInfos, (info1, info2) -> { | ||
| String title1 = info1.getTitle() != null ? info1.getTitle() : ""; | ||
| String title2 = info2.getTitle() != null ? info2.getTitle() : ""; | ||
| return title1.compareToIgnoreCase(title2); | ||
| }); |
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.
What
Sorts the playlists in the Add to playlist context menu alphabetically by title, instead of showing them in most-recently-used (MRU) order.
Why
Requested in #5904. Because the list was ordered by recent use, a given playlist's position kept changing every time you opened the menu, so you could never build muscle memory for where a playlist sits — and the less-recently-used ones were the hardest to find. Sorting alphabetically gives every playlist a stable, predictable position.
How
In
AppDialogUtil.appendPlaylistDialogContent(), the playlist list is copied and sorted case-insensitively by title before the dialog options are built. Copying first avoids mutating the caller's list.nulltitles are treated as empty strings to stay null-safe.One file changed, +10/-1.
Testing
Built locally:
./gradlew :common:compileStstableDebugJavaWithJavac→ BUILD SUCCESSFUL (JDK 17, AGP 7.4.2, compileSdk 34).Closes #5904
🤖 Generated with Claude Code