Fixed IllegalStateException when deleting multiple songs

This commit is contained in:
Prathamesh More 2021-11-15 11:26:59 +05:30
parent b2dbfd3083
commit 97c56f9e57
6 changed files with 25 additions and 15 deletions

View file

@ -1190,7 +1190,7 @@ public class MusicService extends MediaBrowserServiceCompat
notifyChange(QUEUE_CHANGED);
}
public void removeSong(@NonNull Song song) {
public void removeSongImpl(@NonNull Song song) {
for (int i = 0; i < playingQueue.size(); i++) {
if (playingQueue.get(i).getId() == song.getId()) {
playingQueue.remove(i);
@ -1202,6 +1202,17 @@ public class MusicService extends MediaBrowserServiceCompat
originalPlayingQueue.remove(i);
}
}
}
public void removeSong(@NonNull Song song) {
removeSongImpl(song);
notifyChange(QUEUE_CHANGED);
}
public void removeSongs(@NonNull List<Song> songs) {
for (Song song : songs) {
removeSongImpl(song);
}
notifyChange(QUEUE_CHANGED);
}