Java Code Examples for android.support.v7.app.MediaRouteChooserDialogFragment

The following are top voted examples for showing how to use android.support.v7.app.MediaRouteChooserDialogFragment. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: chromium-for-android-56-debug-video   File: RemoteMediaPlayerController.java   View source code 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
Project: castscreen   File: CastScreenActivity.java   View source code 6 votes vote down vote up
/**
 * called after the user finishes the screen capture permissions activity
 * @param requestCode arbitrary int representing why the activity was started
 * @param resultCode int indicating success or failure
 * @param data an Intent representing screen capture permission
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode != SCREEN_CAPTURE_REQUEST) {
        // this request wasn't meant for us
    } else if (resultCode != AppCompatActivity.RESULT_OK) {
        Toast.makeText(this, "Screen casting won't work without capture permission", Toast.LENGTH_LONG).show();
    } else {
        mPermissionsResultCode = resultCode;
        mPermissionsData = data;

        if (mProvider != null && mProvider.getMediaRouteButton() != null) {
            MediaRouteDialogFactory factory = mProvider.getMediaRouteButton().getDialogFactory();
            MediaRouteChooserDialogFragment chooser = factory.onCreateChooserDialogFragment();
            chooser.setRouteSelector(mSelector);
            FragmentManager fm = getSupportFragmentManager();
            chooser.show(fm, CastScreenMediaRouteButton.CHOOSER_TAG);
        } else {
            Log.e(TAG, "Null action provider or route button - " + PLEASE_REPORT_BUG);
        }
    }
}
 
Example 3
Project: AndroidChromium   File: RemoteMediaPlayerController.java   View source code 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
Project: Vafrinn   File: RemoteMediaPlayerController.java   View source code 6 votes vote down vote up
private void showMediaRouteDialog(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 ChromeMediaRouteDialogFactory();

        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 5
Project: Vafrinn   File: ChromeMediaRouteDialogFactory.java   View source code 6 votes vote down vote up
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
    return new MediaRouteChooserDialogFragment() {
        final SystemVisibilitySaver mVisibilitySaver = new SystemVisibilitySaver();

        @Override
        public MediaRouteChooserDialog onCreateChooserDialog(
                Context context, Bundle savedInstanceState) {
            mVisibilitySaver.saveSystemVisibility(getActivity());
            return new MediaRouteChooserDialog(context);
        }

        @Override
        public void onStop() {
            super.onStop();
            mVisibilitySaver.restoreSystemVisibility(getActivity());
        }
    };
}
 
Example 6
Project: 365browser   File: RemoteMediaPlayerController.java   View source code 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 7
Project: vinyl-cast   File: MainActivity.java   View source code 4 votes vote down vote up
private void openCastDialog() {
    final FragmentManager fm = getSupportFragmentManager();
    MediaRouteChooserDialogFragment f = MediaRouteDialogFactory.getDefault().onCreateChooserDialogFragment();
    f.setRouteSelector(CastContext.getSharedInstance(this).getMergedSelector());
    f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment");
}
 
Example 8
Project: chromium-for-android-56-debug-video   File: MediaRouteChooserDialogFactory.java   View source code 4 votes vote down vote up
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
    return new Fragment(mController, mPlayer);
}
 
Example 9
Project: Pocket-Plays-for-Twitch   File: StreamFragment.java   View source code 4 votes vote down vote up
@NonNull
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
	return new CustomMediaRouteChooserDialogFragment();
}
 
Example 10
Project: Pocket-Plays-for-Twitch   File: MainActivity.java   View source code 4 votes vote down vote up
@NonNull
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
	return new CustomMediaRouteChooserDialogFragment();
}
 
Example 11
Project: AndroidChromium   File: MediaRouteChooserDialogFactory.java   View source code 4 votes vote down vote up
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
    return new Fragment(mController, mPlayer);
}
 
Example 12
Project: 365browser   File: MediaRouteChooserDialogFactory.java   View source code 4 votes vote down vote up
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
    return new Fragment(mController, mPlayer);
}
 
Example 13
Project: Popeens-DSub   File: CustomMediaRouteDialogFactory.java   View source code 4 votes vote down vote up
@Override
public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
	return new CustomMediaRouteChooserDialogFragment();
}