FileDocCategorySizeDatePackage
MediaRouteChooserDialogFragment.javaAPI DocAndroid 5.1 API3650Thu Mar 12 22:22:56 GMT 2015android.support.v7.app

MediaRouteChooserDialogFragment

public class MediaRouteChooserDialogFragment extends android.support.v4.app.DialogFragment
Media route chooser dialog fragment.

Creates a {@link MediaRouteChooserDialog}. The application may subclass this dialog fragment to customize the media route chooser dialog.

Fields Summary
private final String
ARGUMENT_SELECTOR
private android.support.v7.media.MediaRouteSelector
mSelector
Constructors Summary
public MediaRouteChooserDialogFragment()
Creates a media route chooser dialog fragment.

All subclasses of this class must also possess a default constructor.


                             
      
        setCancelable(true);
    
Methods Summary
private voidensureRouteSelector()

        if (mSelector == null) {
            Bundle args = getArguments();
            if (args != null) {
                mSelector = MediaRouteSelector.fromBundle(args.getBundle(ARGUMENT_SELECTOR));
            }
            if (mSelector == null) {
                mSelector = MediaRouteSelector.EMPTY;
            }
        }
    
public android.support.v7.media.MediaRouteSelectorgetRouteSelector()
Gets the media route selector for filtering the routes that the user can select.

return
The selector, never null.

        ensureRouteSelector();
        return mSelector;
    
public MediaRouteChooserDialogonCreateChooserDialog(android.content.Context context, android.os.Bundle savedInstanceState)
Called when the chooser dialog is being created.

Subclasses may override this method to customize the dialog.

        return new MediaRouteChooserDialog(context);
    
public android.app.DialogonCreateDialog(android.os.Bundle savedInstanceState)

        MediaRouteChooserDialog dialog = onCreateChooserDialog(getActivity(), savedInstanceState);
        dialog.setRouteSelector(getRouteSelector());
        return dialog;
    
public voidsetRouteSelector(android.support.v7.media.MediaRouteSelector selector)
Sets the media route selector for filtering the routes that the user can select. This method must be called before the fragment is added.

param
selector The selector to set.

        if (selector == null) {
            throw new IllegalArgumentException("selector must not be null");
        }

        ensureRouteSelector();
        if (!mSelector.equals(selector)) {
            mSelector = selector;

            Bundle args = getArguments();
            if (args == null) {
                args = new Bundle();
            }
            args.putBundle(ARGUMENT_SELECTOR, selector.asBundle());
            setArguments(args);

            MediaRouteChooserDialog dialog = (MediaRouteChooserDialog)getDialog();
            if (dialog != null) {
                dialog.setRouteSelector(selector);
            }
        }