mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Fix instant mix overriding added value in songs
This commit is contained in:
parent
7576fbb75b
commit
308ddf6c7c
9 changed files with 124 additions and 75 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package com.cappielloantonio.play.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.cappielloantonio.play.model.Queue;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
|
||||
|
|
@ -7,9 +9,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class QueueUtil {
|
||||
public static Queue getQueueElementFromSong(Song song) {
|
||||
return new Queue(0, song.getId());
|
||||
}
|
||||
private static final String TAG = "QueueUtil";
|
||||
|
||||
public static Queue getQueueElementFromSong(Song song, int startingPosition) {
|
||||
return new Queue(startingPosition, song.getId());
|
||||
|
|
@ -27,15 +27,28 @@ public class QueueUtil {
|
|||
return queue;
|
||||
}
|
||||
|
||||
public static List<Queue> getQueueElementsFromSongs(List<Song> songs, int startingPosition) {
|
||||
int counter = startingPosition;
|
||||
List<Queue> queue = new ArrayList<>();
|
||||
public static List<String> getIDsFromSongs(List<Song> songs) {
|
||||
List<String> IDs = new ArrayList<>();
|
||||
|
||||
for(Song song: songs) {
|
||||
queue.add(new Queue(counter, song.getId()));
|
||||
counter++;
|
||||
IDs.add(song.getId());
|
||||
}
|
||||
|
||||
return queue;
|
||||
return IDs;
|
||||
}
|
||||
|
||||
public static List<Song> orderSongByIdList(List<String> IDs, List<Song> songs) {
|
||||
List<Song> orderedSong = new ArrayList<>();
|
||||
|
||||
for(String ID: IDs) {
|
||||
for(Song song: songs) {
|
||||
if(ID.equals(song.getId())) {
|
||||
orderedSong.add(song);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return orderedSong;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue