@Override public MediaRouteControllerDialogFragment onCreateControllerDialogFragment() { return new MediaRouteControllerDialogFragment() { final SystemVisibilitySaver mVisibilitySaver = new SystemVisibilitySaver(); @Override public Dialog onCreateDialog(Bundle saved) { mVisibilitySaver.saveSystemVisibility(getActivity()); return new MediaRouteControllerDialog(getActivity()); } @Override public void onStop() { super.onStop(); mVisibilitySaver.restoreSystemVisibility(getActivity()); } }; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Be sure to call the super class. super.onCreateOptionsMenu(menu); // Inflate the menu and configure the media router action provider. getMenuInflater().inflate(R.menu.sample_media_router_menu, menu); MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item); MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider)MenuItemCompat.getActionProvider(mediaRouteMenuItem); mediaRouteActionProvider.setRouteSelector(mSelector); mediaRouteActionProvider.setDialogFactory(new MediaRouteDialogFactory() { @Override public MediaRouteControllerDialogFragment onCreateControllerDialogFragment() { return new MediaRouteControllerDialogFragment() { @Override public MediaRouteControllerDialog onCreateControllerDialog( Context context, Bundle savedInstanceState) { mControllerDialog = new SampleMediaRouteControllerDialog( context, mSessionManager, mPlayer); return mControllerDialog; } }; } }); // Return true to show the menu. return true; }
@Override public Dialog onCreateDialog(Bundle saved) { mVisibilitySaver.saveSystemVisibility(getActivity()); return new MediaRouteControllerDialog(getActivity()); }
@Override public MediaRouteControllerDialog onCreateControllerDialog(Context context, Bundle savedInstanceState) { return new MediaRouteControllerDialog(context, ThemeUtil.getThemeRes(context)); }