当前位置: 首页>>代码示例>>Java>>正文


Java MediaRouteDialogFactory类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:ankyl,项目名称:castscreen,代码行数:28,代码来源:CastScreenActivity.java

示例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");
    }
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:20,代码来源:RemoteMediaPlayerController.java

示例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");
    }
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:18,代码来源:RemoteMediaPlayerController.java

示例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);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:38,代码来源:ChromeMediaRouterDialogController.java

示例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;
}
 
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:31,代码来源:SampleMediaRouterActivity.java

示例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");
}
 
开发者ID:aschober,项目名称:vinyl-cast,代码行数:7,代码来源:MainActivity.java

示例9: getMediaRouteDialogFactory

import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
public MediaRouteDialogFactory getMediaRouteDialogFactory() {
    return mMediaRouteDialogFactory;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:4,代码来源:CastConfiguration.java

示例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;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:9,代码来源:CastConfiguration.java

示例11: getMediaRouteDialogFactory

import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
    return null;
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:5,代码来源:DataCastManager.java

示例12: getMediaRouteDialogFactory

import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
    return new VideoMediaRouteDialogFactory();
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:5,代码来源:VideoCastManager.java

示例13: getMediaRouteDialogFactory

import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
protected MediaRouteDialogFactory getMediaRouteDialogFactory() {
  return null;
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:5,代码来源:DataCastManager.java

示例14: getMediaRouteDialogFactory

import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
  return new VideoMediaRouteDialogFactory();
}
 
开发者ID:sgehrman,项目名称:UTubeTV,代码行数:5,代码来源:VideoCastManager.java

示例15: getMediaRouteDialogFactory

import android.support.v7.app.MediaRouteDialogFactory; //导入依赖的package包/类
@Override
MediaRouteDialogFactory getMediaRouteDialogFactory() {
    return new VideoMediaRouteDialogFactory();
}
 
开发者ID:TByron,项目名称:Jupiter-Broadcasting-Holo,代码行数:5,代码来源:VideoCastManager.java


注:本文中的android.support.v7.app.MediaRouteDialogFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。