use of android.support.v7.app.MediaRouteControllerDialogFragment in project AntennaPod by AntennaPod.
the class SwitchableMediaRouteActionProvider method onPerformDefaultAction.
@Override
public boolean onPerformDefaultAction() {
if (!super.onPerformDefaultAction()) {
// there is no button, but we should still show the dialog if it's the case.
if (!isVisible()) {
return false;
}
FragmentManager fm = getFragmentManager();
if (fm == null) {
return false;
}
MediaRouter.RouteInfo route = MediaRouter.getInstance(getContext()).getSelectedRoute();
if (route.isDefault() || !route.matchesSelector(getRouteSelector())) {
if (fm.findFragmentByTag(CHOOSER_FRAGMENT_TAG) != null) {
Log.w(TAG, "showDialog(): Route chooser dialog already showing!");
return false;
}
MediaRouteChooserDialogFragment f = getDialogFactory().onCreateChooserDialogFragment();
f.setRouteSelector(getRouteSelector());
f.show(fm, CHOOSER_FRAGMENT_TAG);
} else {
if (fm.findFragmentByTag(CONTROLLER_FRAGMENT_TAG) != null) {
Log.w(TAG, "showDialog(): Route controller dialog already showing!");
return false;
}
MediaRouteControllerDialogFragment f = getDialogFactory().onCreateControllerDialogFragment();
f.show(fm, CONTROLLER_FRAGMENT_TAG);
}
return true;
} else {
return true;
}
}
use of android.support.v7.app.MediaRouteControllerDialogFragment in project AndroidChromium by JackyAndroid.
the class RemoteMediaPlayerController method showMediaRouteControlDialog.
private void showMediaRouteControlDialog(Activity activity) {
FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
if (fm == null) {
throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
}
MediaRouteDialogFactory factory = new MediaRouteControllerDialogFactory();
if (fm.findFragmentByTag("android.support.v7.mediarouter:MediaRouteControllerDialogFragment") != null) {
Log.w(TAG, "showDialog(): Route controller dialog already showing!");
return;
}
MediaRouteControllerDialogFragment f = factory.onCreateControllerDialogFragment();
f.show(fm, "android.support.v7.mediarouter:MediaRouteControllerDialogFragment");
}
use of android.support.v7.app.MediaRouteControllerDialogFragment in project AndroidChromium by JackyAndroid.
the class RemoteMediaPlayerController method showMediaRouteControlDialog.
private void showMediaRouteControlDialog(MediaStateListener player, Activity activity) {
FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
if (fm == null) {
throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
}
MediaRouteDialogFactory factory = new MediaRouteControllerDialogFactory(player);
if (fm.findFragmentByTag("android.support.v7.mediarouter:MediaRouteControllerDialogFragment") != null) {
Log.w(TAG, "showDialog(): Route controller dialog already showing!");
return;
}
MediaRouteControllerDialogFragment f = factory.onCreateControllerDialogFragment();
f.show(fm, "android.support.v7.mediarouter:MediaRouteControllerDialogFragment");
}
Aggregations