Java 类android.support.v7.app.MediaRouteDialogFactory 实例源码
项目:chromium-for-android-56-debug-video
文件:RemoteMediaPlayerController.java
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");
}
项目:chromium-for-android-56-debug-video
文件:RemoteMediaPlayerController.java
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");
}
项目:castscreen
文件:CastScreenActivity.java
/**
* 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);
}
}
}
项目:AndroidChromium
文件:RemoteMediaPlayerController.java
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");
}
项目:AndroidChromium
文件:RemoteMediaPlayerController.java
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");
}
项目:Vafrinn
文件:RemoteMediaPlayerController.java
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");
}
项目:Vafrinn
文件:RemoteMediaPlayerController.java
private void showMediaRouteControlDialog(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:MediaRouteControllerDialogFragment") != null) {
Log.w(TAG, "showDialog(): Route controller dialog already showing!");
return;
}
MediaRouteControllerDialogFragment f = factory.onCreateControllerDialogFragment();
f.show(fm, "android.support.v7.mediarouter:MediaRouteControllerDialogFragment");
}
项目:365browser
文件:RemoteMediaPlayerController.java
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");
}
项目:365browser
文件:RemoteMediaPlayerController.java
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");
}
项目:Vafrinn
文件:ChromeMediaRouterDialogController.java
/**
* Shows the {@link MediaRouteChooserDialogFragment} dialog if it's not shown yet.
* @param sourceUrn the URN identifying the media source to filter the devices with.
*/
@CalledByNative
public void createDialog(String sourceUrn) {
if (isShowingDialog()) return;
MediaSource mediaSource = MediaSource.from(sourceUrn);
if (mediaSource == null) return;
FragmentActivity currentActivity =
(FragmentActivity) ApplicationStatus.getLastTrackedFocusedActivity();
if (currentActivity == null) return;
FragmentManager fm = currentActivity.getSupportFragmentManager();
if (fm == null) return;
if (fm.findFragmentByTag(MEDIA_ROUTE_CHOOSER_DIALOG_FRAGMENT) != null) return;
MediaRouteSelector selector = mediaSource.buildRouteSelector();
mAndroidMediaRouter.addCallback(selector, this);
MediaRouteDialogFactory factory = new ChromeMediaRouteDialogFactory();
mChooserDialogFragment = factory.onCreateChooserDialogFragment();
mChooserDialogFragment.setRouteSelector(selector);
mChooserDialogFragment.show(fm, MEDIA_ROUTE_CHOOSER_DIALOG_FRAGMENT);
fm.executePendingTransactions();
Dialog dialog = mChooserDialogFragment.getDialog();
if (dialog == null) {
closeDialog();
return;
}
dialog.setOnDismissListener(this);
}
项目:V.FlyoutTest
文件:SampleMediaRouterActivity.java
@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;
}
项目:vinyl-cast
文件:MainActivity.java
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");
}
项目:Pocket-Plays-for-Twitch
文件:CastConfiguration.java
public MediaRouteDialogFactory getMediaRouteDialogFactory() {
return mMediaRouteDialogFactory;
}
项目:Pocket-Plays-for-Twitch
文件:CastConfiguration.java
/**
* (Optional) Sets the {@link MediaRouteDialogFactory}. This is optional and if not called,
* the default dialog will be used.
*/
public Builder setMediaRouteDialogFactory(MediaRouteDialogFactory factory) {
mMediaRouteDialogFactory = factory;
return this;
}
项目:codelab-chromecast
文件:DataCastManager.java
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return null;
}
项目:codelab-chromecast
文件:VideoCastManager.java
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return new VideoMediaRouteDialogFactory();
}
项目:UTubeTV
文件:DataCastManager.java
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return null;
}
项目:UTubeTV
文件:VideoCastManager.java
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
return new VideoMediaRouteDialogFactory();
}
项目:Jupiter-Broadcasting-Holo
文件:DataCastManager.java
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return null;
}
项目:Jupiter-Broadcasting-Holo
文件:VideoCastManager.java
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
return new VideoMediaRouteDialogFactory();
}
项目:Pocket-Plays-for-Twitch
文件:BaseCastManager.java
/**
* Returns the {@link MediaRouteDialogFactory} that defines the chooser and controller dialogs
* for selecting a route and controlling the route when connected. The default factory will be
* used unless a different one is configured in {@link CastConfiguration}.
*/
private MediaRouteDialogFactory getMediaRouteDialogFactory() {
return mCastConfiguration.getMediaRouteDialogFactory();
}
项目:codelab-chromecast
文件:BaseCastManager.java
/**
* Subclasses can decide how the Cast Controller Dialog should be built. If this returns
* <code>null</code>, the default dialog will be shown.
*/
abstract protected MediaRouteDialogFactory getMediaRouteDialogFactory();
项目:UTubeTV
文件:BaseCastManager.java
/**
* 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();
项目:Jupiter-Broadcasting-Holo
文件:BaseCastManager.java
/**
* 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();