Fixed crash on screen rotation in playlist view.

This commit is contained in:
Felix Ableitner 2014-02-01 22:24:24 +01:00
parent 8b9359ba4f
commit b037a17f2a
2 changed files with 8 additions and 4 deletions

View file

@ -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");
}
}

View file

@ -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;
}
}