diff --git a/src/com/github/nutomic/controldlna/gui/RouteFragment.java b/src/com/github/nutomic/controldlna/gui/RouteFragment.java index 57df561..6f1dd39 100644 --- a/src/com/github/nutomic/controldlna/gui/RouteFragment.java +++ b/src/com/github/nutomic/controldlna/gui/RouteFragment.java @@ -97,6 +97,8 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements private boolean mPlaying; + private boolean mRestorePlaylistMode; + private RouteAdapter mRouteAdapter; private FileArrayAdapter mPlaylistAdapter; @@ -124,6 +126,8 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements mPlaylistAdapter.add(mMediaRouterPlayService.getService().getPlaylist()); receiveIsPlaying(mMediaRouterPlayService.getService().getCurrentTrack()); applyColors(); + if (mRestorePlaylistMode) + playlistMode(mMediaRouterPlayService.getService().getCurrentRoute()); } public void onServiceDisconnected(ComponentName className) { @@ -203,9 +207,7 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements if (savedInstanceState != null) { mListView.onRestoreInstanceState(savedInstanceState.getParcelable("list_state")); - if (savedInstanceState.getBoolean("route_selected")) - playlistMode(MediaRouter.getInstance(getActivity()) - .getSelectedRoute()); + mRestorePlaylistMode = savedInstanceState.getBoolean("route_selected"); } } diff --git a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java index 4790ec6..10a6171 100644 --- a/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java +++ b/src/com/github/nutomic/controldlna/mediarouter/MediaRouterPlayService.java @@ -156,7 +156,6 @@ public class MediaRouterPlayService extends Service { @Override public void onCreate() { super.onCreate(); - mMediaRouter = MediaRouter.getInstance(this); pollStatus(); } @@ -438,4 +437,7 @@ public class MediaRouterPlayService extends Service { return mRepeat; } + public RouteInfo getCurrentRoute() { + return mCurrentRoute; + } }