Fixed notification being permanently updated.

This commit is contained in:
Felix Ableitner 2013-12-10 00:39:05 +01:00
parent 5b1b539083
commit 484fbe3bdd

View file

@ -227,6 +227,9 @@ public class MediaRouterPlayService extends Service {
mSessionId = data.getString(MediaControlIntent.EXTRA_SESSION_ID); mSessionId = data.getString(MediaControlIntent.EXTRA_SESSION_ID);
mItemId = data.getString(MediaControlIntent.EXTRA_ITEM_ID); mItemId = data.getString(MediaControlIntent.EXTRA_ITEM_ID);
mPollingStatus = true; mPollingStatus = true;
new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack)
.getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class));
} }
}); });
} }
@ -306,16 +309,14 @@ public class MediaRouterPlayService extends Service {
new ControlRequestCallback() { new ControlRequestCallback() {
@Override @Override
public void onResult(Bundle data) { public void onResult(Bundle data) {
MediaItemStatus status = MediaItemStatus.fromBundle(data); MediaItemStatus status = MediaItemStatus.fromBundle(data);
if (mRouterFragment.get() != null) if (mRouterFragment.get() != null)
mRouterFragment.get().receivePlaybackStatus(status); mRouterFragment.get().receivePlaybackStatus(status);
if (status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_PENDING && if (status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_PENDING &&
status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_BUFFERING && status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_BUFFERING &&
status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_PLAYING) status.getPlaybackState() != MediaItemStatus.PLAYBACK_STATE_PLAYING)
stopForeground(true); stopForeground(true);
else
new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack)
.getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class));
if (status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_FINISHED) { if (status.getPlaybackState() == MediaItemStatus.PLAYBACK_STATE_FINISHED) {
if (mCurrentTrack + 1 < mPlaylist.size()) if (mCurrentTrack + 1 < mPlaylist.size())