Search in sources :

Example 1 with MediaRouteDialogFactory

use of android.support.v7.app.MediaRouteDialogFactory in project AndroidChromium by JackyAndroid.

the class RemoteMediaPlayerController method showMediaRouteDialog.

private void showMediaRouteDialog(MediaStateListener player, MediaRouteController controller, Activity activity) {
    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }
    MediaRouteDialogFactory factory = new MediaRouteChooserDialogFactory(player, controller, activity);
    if (fm.findFragmentByTag("android.support.v7.mediarouter:MediaRouteChooserDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route chooser dialog already showing!");
        return;
    }
    MediaRouteChooserDialogFragment f = factory.onCreateChooserDialogFragment();
    f.setRouteSelector(controller.buildMediaRouteSelector());
    f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment");
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MediaRouteDialogFactory(android.support.v7.app.MediaRouteDialogFactory) FragmentActivity(android.support.v4.app.FragmentActivity) MediaRouteChooserDialogFragment(android.support.v7.app.MediaRouteChooserDialogFragment)

Example 2 with MediaRouteDialogFactory

use of android.support.v7.app.MediaRouteDialogFactory 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");
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MediaRouteDialogFactory(android.support.v7.app.MediaRouteDialogFactory) FragmentActivity(android.support.v4.app.FragmentActivity) MediaRouteControllerDialogFragment(android.support.v7.app.MediaRouteControllerDialogFragment)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)2 FragmentManager (android.support.v4.app.FragmentManager)2 MediaRouteDialogFactory (android.support.v7.app.MediaRouteDialogFactory)2 MediaRouteChooserDialogFragment (android.support.v7.app.MediaRouteChooserDialogFragment)1 MediaRouteControllerDialogFragment (android.support.v7.app.MediaRouteControllerDialogFragment)1