Skip to content

Commit

Permalink
Fix queue not adding songs when already present
Browse files Browse the repository at this point in the history
Signed-off-by: enricocid <[email protected]>
  • Loading branch information
enricocid committed Mar 10, 2024
1 parent ba6aae9 commit 80bc3be
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -884,13 +884,22 @@ class MainActivity : BaseActivity(), UIControlInterface, MediaControlInterface {
} else {
queueSongs.add(songToQueue)
}
Toast.makeText(
this@MainActivity,
getString(R.string.queue_song_add, songToQueue.title),
Toast.LENGTH_SHORT
).show()
} else {
// song is already present but queue is already started
// move the song next to the played song
if (isQueue != null && !canRestoreQueue && isQueueStarted) {
queueSongs.remove(songToQueue)
val currentPosition = queueSongs.findIndex(currentSong)
queueSongs.add(currentPosition+1, songToQueue)
}
}

Toast.makeText(
this@MainActivity,
getString(R.string.queue_song_add, songToQueue.title),
Toast.LENGTH_SHORT
).show()

if (canRestoreQueue && restoreQueueSong == null) {
restoreQueueSong = songToQueue
}
Expand Down

0 comments on commit 80bc3be

Please sign in to comment.