Java Code Examples for android.support.v7.app.MediaRouteControllerDialogFragment#show()

The following examples show how to use android.support.v7.app.MediaRouteControllerDialogFragment#show() . 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 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 2
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 3
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 4
Source File: MediaRouteControllerDialogManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected DialogFragment openDialogInternal(FragmentManager fm) {
    if (fm.findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) return null;

    MediaRouteControllerDialogFragment fragment = new MediaRouteControllerDialogFragment() {
        final SystemVisibilitySaver mVisibilitySaver = new SystemVisibilitySaver();

        @Override
        public void onStart() {
            mVisibilitySaver.saveSystemVisibility(getActivity());
            super.onStart();
        }

        @Override
        public void onStop() {
            super.onStop();
            mVisibilitySaver.restoreSystemVisibility(getActivity());
        }

        @Override
        public void onDismiss(DialogInterface dialog) {
            delegate().onDialogCancelled();
            androidMediaRouter().removeCallback(mCallback);
            mDialogFragment = null;
            super.onDismiss(dialog);
        }
    };

    MediaRouteSelector selector = mediaSource().buildRouteSelector();
    if (selector == null) return null;

    androidMediaRouter().addCallback(selector, mCallback);

    fragment.show(fm, DIALOG_FRAGMENT_TAG);
    fm.executePendingTransactions();

    return fragment;
}