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();
|
final MediaRouterPlayService s = mMediaRouterPlayService.getService();
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.playpause:
|
case R.id.playpause:
|
||||||
if (mPlaying)
|
if (mPlaying) {
|
||||||
s.pause();
|
s.pause();
|
||||||
else {
|
mPlayPause.setImageResource(R.drawable.ic_action_play);
|
||||||
|
} else {
|
||||||
s.resume();
|
s.resume();
|
||||||
mListView.smoothScrollToPosition(s.getCurrentTrack());
|
mListView.smoothScrollToPosition(s.getCurrentTrack());
|
||||||
|
mPlayPause.setImageResource(R.drawable.ic_action_pause);
|
||||||
}
|
}
|
||||||
|
mPlaying = !mPlaying;
|
||||||
break;
|
break;
|
||||||
case R.id.shuffle:
|
case R.id.shuffle:
|
||||||
s.toggleShuffleEnabled();
|
s.toggleShuffleEnabled();
|
||||||
|
|
|
@ -256,6 +256,8 @@ public class MediaRouterPlayService extends Service {
|
||||||
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
|
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
|
||||||
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
|
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
|
||||||
mMediaRouter.getSelectedRoute().sendControlRequest(intent, null);
|
mMediaRouter.getSelectedRoute().sendControlRequest(intent, null);
|
||||||
|
mPollingStatus = false;
|
||||||
|
stopForeground(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +274,6 @@ public class MediaRouterPlayService extends Service {
|
||||||
mPollingStatus = true;
|
mPollingStatus = true;
|
||||||
new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack)
|
new CreateNotificationTask().execute(mPlaylist.get(mCurrentTrack)
|
||||||
.getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class));
|
.getFirstPropertyValue(DIDLObject.Property.UPNP.ALBUM_ART_URI.class));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,6 +287,8 @@ public class MediaRouterPlayService extends Service {
|
||||||
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
|
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
|
||||||
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
|
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
|
||||||
mMediaRouter.getSelectedRoute().sendControlRequest(intent, null);
|
mMediaRouter.getSelectedRoute().sendControlRequest(intent, null);
|
||||||
|
mPollingStatus = false;
|
||||||
|
stopForeground(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void seek(int seconds) {
|
public void seek(int seconds) {
|
||||||
|
@ -356,6 +359,7 @@ public class MediaRouterPlayService extends Service {
|
||||||
public int getCurrentTrack() {
|
public int getCurrentTrack() {
|
||||||
return mCurrentTrack;
|
return mCurrentTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests playback information every second, as long as RendererFragment
|
* Requests playback information every second, as long as RendererFragment
|
||||||
* is attached or media is playing.
|
* is attached or media is playing.
|
||||||
|
|
Reference in a new issue