Add isEmpty() call to Song

This commit is contained in:
Adrian Ulrich 2015-10-07 09:40:58 +02:00
parent e4855e51eb
commit 052365c872
3 changed files with 3 additions and 3 deletions

View File

@ -423,7 +423,7 @@ public class MediaUtils {
}
cursor.close();
}
return song.id == -1 ? null : song;
return song.isEmpty() ? null : song;
}
/**

View File

@ -1279,7 +1279,7 @@ public final class PlaybackService extends Service
else
song = mTimeline.shiftCurrentSong(delta);
mCurrentSong = song;
if (song == null || song.id == -1 || song.path == null) {
if (song == null || song.isEmpty()) {
if (MediaUtils.isSongAvailable(getContentResolver())) {
int flag = finishAction(mState) == SongTimeline.FINISH_RANDOM ? FLAG_ERROR : FLAG_EMPTY_QUEUE;
synchronized (mStateLock) {

View File

@ -87,7 +87,7 @@ public class RemoteControl {
remote.setPlaybackState(isPlaying ? RemoteControlClient.PLAYSTATE_PLAYING : RemoteControlClient.PLAYSTATE_PAUSED);
RemoteControlClient.MetadataEditor editor = remote.editMetadata(true);
if (song != null && song.id != -1) {
if (song != null && song.isEmpty() == false) {
editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, song.artist);
editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, song.album);
editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, song.title);