Fixed status being polled while playback is paused.
This commit is contained in:
parent
7619bc174a
commit
3589b71da6
2 changed files with 10 additions and 3 deletions
|
@ -388,12 +388,15 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
|
|||
final MediaRouterPlayService s = mMediaRouterPlayService.getService();
|
||||
switch (v.getId()) {
|
||||
case R.id.playpause:
|
||||
if (mPlaying)
|
||||
if (mPlaying) {
|
||||
s.pause();
|
||||
else {
|
||||
mPlayPause.setImageResource(R.drawable.ic_action_play);
|
||||
} else {
|
||||
s.resume();
|
||||
mListView.smoothScrollToPosition(s.getCurrentTrack());
|
||||
mPlayPause.setImageResource(R.drawable.ic_action_pause);
|
||||
}
|
||||
mPlaying = !mPlaying;
|
||||
break;
|
||||
case R.id.shuffle:
|
||||
s.toggleShuffleEnabled();
|
||||
|
|
|
@ -256,6 +256,8 @@ public class MediaRouterPlayService extends Service {
|
|||
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
|
||||
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
|
||||
mMediaRouter.getSelectedRoute().sendControlRequest(intent, null);
|
||||
mPollingStatus = false;
|
||||
stopForeground(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,7 +274,6 @@ public class MediaRouterPlayService extends Service {
|
|||
mPollingStatus = true;
|
||||
new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack)
|
||||
.getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,6 +287,8 @@ public class MediaRouterPlayService extends Service {
|
|||
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
|
||||
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
|
||||
mMediaRouter.getSelectedRoute().sendControlRequest(intent, null);
|
||||
mPollingStatus = false;
|
||||
stopForeground(true);
|
||||
}
|
||||
|
||||
public void seek(int seconds) {
|
||||
|
@ -356,6 +359,7 @@ public class MediaRouterPlayService extends Service {
|
|||
public int getCurrentTrack() {
|
||||
return mCurrentTrack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests playback information every second, as long as RendererFragment
|
||||
* is attached or media is playing.
|
||||
|
|
Reference in a new issue