Handle randomization of broken songs correctly
The old code didn't update the song in the timeline, which lead to some interesting issues.
This commit is contained in:
parent
7156d11ea1
commit
338974def5
@ -171,6 +171,27 @@ public class Song implements Parcelable {
|
||||
albumId = cursor.getLong(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the fields from the given Song to this Song.
|
||||
*
|
||||
* @param other The Song to copy from.
|
||||
*/
|
||||
public void copy(Song other)
|
||||
{
|
||||
if (other == null) {
|
||||
id = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
id = other.id;
|
||||
albumId = other.albumId;
|
||||
path = other.path;
|
||||
title = other.title;
|
||||
album = other.album;
|
||||
artist = other.artist;
|
||||
flags = other.flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the MediaStore, if necessary, to fill this Song's fields.
|
||||
*
|
||||
|
@ -329,7 +329,7 @@ public final class SongTimeline {
|
||||
}
|
||||
|
||||
if (song == null || !song.query(false)) {
|
||||
song = Song.randomSong();
|
||||
song.copy(Song.randomSong());
|
||||
if (song == null || !song.query(false))
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user