android.support.v7.app.MediaRouteDialogFactory Java Examples

The following examples show how to use android.support.v7.app.MediaRouteDialogFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteMediaPlayerController.java    From delion with Apache License 2.0 6 votes vote down vote up
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");
}
 
Example #2
Source File: RemoteMediaPlayerController.java    From delion with Apache License 2.0 6 votes vote down vote up
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");
    }
 
Example #3
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
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");
}
 
Example #4
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
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");
}
 
Example #5
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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");
}
 
Example #6
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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");
}
 
Example #7
Source File: SampleMediaRouterActivity.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
@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;
}
 
Example #8
Source File: DataCastManager.java    From android with Apache License 2.0 4 votes vote down vote up
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
    return null;
}
 
Example #9
Source File: VideoCastManager.java    From android with Apache License 2.0 4 votes vote down vote up
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
    return new VideoMediaRouteDialogFactory();
}
 
Example #10
Source File: DataCastManager.java    From UTubeTV with The Unlicense 4 votes vote down vote up
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
  return null;
}
 
Example #11
Source File: VideoCastManager.java    From UTubeTV with The Unlicense 4 votes vote down vote up
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
  return new VideoMediaRouteDialogFactory();
}
 
Example #12
Source File: BaseCastManager.java    From android with Apache License 2.0 2 votes vote down vote up
/**
 * Subclasses can decide how the Cast Controller Dialog should be built. If this returns
 * <code>null</code>, the default dialog will be shown.
 *
 * @return
 */
abstract MediaRouteDialogFactory getMediaRouteDialogFactory();
 
Example #13
Source File: BaseCastManager.java    From UTubeTV with The Unlicense 2 votes vote down vote up
/**
 * Subclasses can decide how the Cast Controller Dialog should be built. If this returns
 * <code>null</code>, the default dialog will be shown.
 */
abstract MediaRouteDialogFactory getMediaRouteDialogFactory();