本文整理汇总了Java中android.support.v7.app.MediaRouteDialogFactory类的典型用法代码示例。如果您正苦于以下问题:Java MediaRouteDialogFactory类的具体用法?Java MediaRouteDialogFactory怎么用?Java MediaRouteDialogFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaRouteDialogFactory类属于android.support.v7.app包,在下文中一共展示了MediaRouteDialogFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMediaRouteDialog
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
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");
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:RemoteMediaPlayerController.java
示例2: showMediaRouteControlDialog
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
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");
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:RemoteMediaPlayerController.java
示例3: onActivityResult
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
/**
* 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);
}
}
}
示例4: showMediaRouteDialog
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
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");
}
示例5: showMediaRouteControlDialog
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
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");
}
示例6: createDialog
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
/**
* 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);
}
示例7: onCreateOptionsMenu
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@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;
}
示例8: openCastDialog
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
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");
}
示例9: getMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
public MediaRouteDialogFactory getMediaRouteDialogFactory() {
return mMediaRouteDialogFactory;
}
示例10: setMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
/**
* (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;
}
示例11: getMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return null;
}
示例12: getMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return new VideoMediaRouteDialogFactory();
}
示例13: getMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
return null;
}
示例14: getMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
return new VideoMediaRouteDialogFactory();
}
示例15: getMediaRouteDialogFactory
import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
return new VideoMediaRouteDialogFactory();
}