diff --git a/src/com/github/nutomic/controldlna/gui/RouteFragment.java b/src/com/github/nutomic/controldlna/gui/RouteFragment.java index d3e7192..1a30012 100644 --- a/src/com/github/nutomic/controldlna/gui/RouteFragment.java +++ b/src/com/github/nutomic/controldlna/gui/RouteFragment.java @@ -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(); diff --git a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java index b518d88..0ae6dd1 100644 --- a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java +++ b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java @@ -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.