Fix crash on select dupe song in playlist #950
Merged
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.
Fixes #936
This is quite a big change, involving the introduction of unique and stable ID for each song in a static playlist (on the same idea that @Octoton implemented on the playing queue with the
IndexedSong
class).To support this, I needed to change the API of multiple classes, from using
ArrayList<Song>
toList<? extends Song>
.I took the opportunity to do some cleanup and limited the concept of
IndexedSong
to only where it's necessary.--
Note that with this PR, if one select a duplicated item in a playlist, both copies will be selected. Any subsequent action on the selection (i.e. remove from playlist) will be applied to all the dupes (i.e. all occurence of the selected song will be removed).
Quite counter-intuitive for me.
Another PR (with important refactoring on the handling of multi-select in the case of dupe) will be proposed to handle this part. Relevant code are in https://github.com/VinylMusicPlayer/VinylMusicPlayer/tree/refactor-multi-select