mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-01 23:13:36 +00:00
Fix instant mix overriding added value in songs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user