21 lines
493 B
Kotlin
21 lines
493 B
Kotlin
|
package code.name.monkey.retromusic.helper
|
||
|
|
||
|
import code.name.monkey.retromusic.model.Song
|
||
|
|
||
|
import java.util.Collections
|
||
|
|
||
|
|
||
|
object ShuffleHelper {
|
||
|
|
||
|
fun makeShuffleList(listToShuffle: MutableList<Song>, current: Int) {
|
||
|
if (listToShuffle.isEmpty()) return
|
||
|
if (current >= 0) {
|
||
|
val song = listToShuffle.removeAt(current)
|
||
|
listToShuffle.shuffle()
|
||
|
listToShuffle.add(0, song)
|
||
|
} else {
|
||
|
listToShuffle.shuffle()
|
||
|
}
|
||
|
}
|
||
|
}
|