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


Java MediaRouteActionProvider.setRouteSelector方法代码示例

本文整理汇总了Java中android.support.v7.app.MediaRouteActionProvider.setRouteSelector方法的典型用法代码示例。如果您正苦于以下问题:Java MediaRouteActionProvider.setRouteSelector方法的具体用法?Java MediaRouteActionProvider.setRouteSelector怎么用?Java MediaRouteActionProvider.setRouteSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.app.MediaRouteActionProvider的用法示例。


在下文中一共展示了MediaRouteActionProvider.setRouteSelector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // Inflate the menu and configure the media router action provider.
    getMenuInflater().inflate(R.menu.media_route_menu_item, menu);

    // Attach the MediaRouteSelector to the menu item
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    MediaRouteActionProvider mediaRouteActionProvider =
            (MediaRouteActionProvider)MenuItemCompat.getActionProvider(
                    mediaRouteMenuItem);
    // Attach the MediaRouteSelector that you built in onCreate()
    mediaRouteActionProvider.setRouteSelector(mSelector);

    // Return true to show the menu.
    return true;
}
 
开发者ID:tgbMedia,项目名称:Android-app,代码行数:19,代码来源:VideoPlayerActivity.java

示例2: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.activity_main_actions, menu);

  if (mediaRouteSelector != null) {
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.action_cast);
    if (MenuItemCompat.getActionProvider(
        mediaRouteMenuItem) instanceof MediaRouteActionProvider) {
      MediaRouteActionProvider mediaRouteActionProvider =
          (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
      mediaRouteActionProvider.setRouteSelector(mediaRouteSelector);
    }
  }
  return true;
}
 
开发者ID:ferranpons,项目名称:android-cast-remote-display-sample,代码行数:17,代码来源:MainActivity.java

示例3: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {

    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.main, menu);
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);

    MediaRouteActionProvider mediaRouteActionProvider
            = (MediaRouteActionProvider) MenuItemCompat
            .getActionProvider(mediaRouteMenuItem);

    // Set the MediaRouteActionProvider selector to discover devices.
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);

    return true;
}
 
开发者ID:stantronic,项目名称:PinCast-Sender-Android,代码行数:17,代码来源:PinCastActivity.java

示例4: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的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);

    // Return true to show the menu.
    return true;
}
 
开发者ID:reknih,项目名称:informant-droid,代码行数:17,代码来源:SampleMediaRouterActivity.java

示例5: addMediaRouterButton

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
/**
 * Adds and wires up the Media Router cast button. It returns a reference to the Media Router
 * menu item if the caller needs such reference. It is assumed that the enclosing
 * {@link android.app.Activity} inherits (directly or indirectly) from
 * {@link android.support.v7.app.AppCompatActivity}.
 *
 * @param menu Menu reference
 * @param menuResourceId The resource id of the cast button in the xml menu descriptor file
 */
public final MenuItem addMediaRouterButton(Menu menu, int menuResourceId) {
    MenuItem mediaRouteMenuItem = menu.findItem(menuResourceId);
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider)
            MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    if (getMediaRouteDialogFactory() != null) {
        mediaRouteActionProvider.setDialogFactory(getMediaRouteDialogFactory());
    }
    return mediaRouteMenuItem;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:20,代码来源:BaseCastManager.java

示例6: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.main, menu);

    mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    MediaRouteActionProvider actionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);

    MediaRouteSelector.Builder builder = new MediaRouteSelector.Builder().addControlCategory(OCastMediaRouteProvider.CATEGORY_OCAST);
    MediaRouteSelector customSelector = builder.build();
    actionProvider.setRouteSelector(customSelector);

    return true;
}
 
开发者ID:Orange-OpenSource,项目名称:OCast-Java,代码行数:14,代码来源:MainActivity.java

示例7: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.menu_browse, menu);

    MenuItem mediaRouteMenuItem = menu.findItem(R.id.action_cast);
    MediaRouteActionProvider mediaRouteActionProvider =
            (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    return true;
}
 
开发者ID:felixb,项目名称:basscast,代码行数:11,代码来源:BrowseActivity.java

示例8: addMediaRouterButton

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
/**
 * Adds and wires up the Media Router cast button. It returns a pointer to the Media Router
 * menu item if the caller needs such reference. It is assumed that the enclosing
 * {@link android.app.Activity} inherits (directly or indirectly) from
 * {@link android.support.v7.app.ActionBarActivity}.
 *
 * @param menu
 * @param menuResourceId The resource id of the cast button in the xml menu descriptor file
 */
public MenuItem addMediaRouterButton(Menu menu, int menuResourceId) {
    MenuItem mediaRouteMenuItem = menu.findItem(menuResourceId);
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider)
            MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    if (null != getMediaRouteDialogFactory()) {
        mediaRouteActionProvider.setDialogFactory(getMediaRouteDialogFactory());
    }
    return mediaRouteMenuItem;
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:20,代码来源:BaseCastManager.java

示例9: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.stage_actions, menu);

    // Setup the menu item for connecting to cast devices
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    View mr = menu.findItem(R.id.media_route_menu_item).getActionView();
    if (mr!=null) {
        mr.setFocusable(false);
        mr.setFocusableInTouchMode(false);
    }
    MediaRouteActionProvider mediaRouteActionProvider =
            (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    if (mMediaRouteSelector != null) {
        mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    }

    // Force overflow icon to show, even if hardware key is present
    MenuHandlers.forceOverFlow(StageMode.this, ab, menu);

    // Set up battery monitor
    setUpBatteryMonitor();

    return true;
}
 
开发者ID:thebigg73,项目名称:OpenSongTablet,代码行数:29,代码来源:StageMode.java

示例10: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.presenter_actions, menu);

    // Setup the menu item for connecting to cast devices
    // Setup the menu item for connecting to cast devices
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    View mr = menu.findItem(R.id.media_route_menu_item).getActionView();
    if (mr!=null) {
        mr.setFocusable(false);
        mr.setFocusableInTouchMode(false);
    }
    MediaRouteActionProvider mediaRouteActionProvider =
            (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    if (mMediaRouteSelector != null) {
        mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    }

    // Force overflow icon to show, even if hardware key is present
    MenuHandlers.forceOverFlow(PresenterMode.this, ab, menu);

    // Set up battery monitor
    setUpBatteryMonitor();

    return true;
}
 
开发者ID:thebigg73,项目名称:OpenSongTablet,代码行数:30,代码来源:PresenterMode.java

示例11: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.menu_cast, menu);

    // Step 4 (import the appcompat alternative)
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    return true;
}
 
开发者ID:roys,项目名称:cast-codelab,代码行数:12,代码来源:CastActivity.java

示例12: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu( Menu menu ) {
    super.onCreateOptionsMenu( menu );
    getMenuInflater().inflate( R.menu.main, menu );
    MenuItem mediaRouteMenuItem = menu.findItem( R.id.media_route_menu_item );
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider( mediaRouteMenuItem );
    mediaRouteActionProvider.setRouteSelector( mMediaRouteSelector );
    return true;
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:10,代码来源:MainActivity.java

示例13: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
public final void onCreateOptionsMenu(Menu menu) {
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    MediaRouteActionProvider mediaRouteActionProvider =
            (MediaRouteActionProvider) MenuItemCompat
                    .getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mState.mediaRouteSelector);
}
 
开发者ID:manotaurgames,项目名称:castro-android,代码行数:8,代码来源:CastLogic.java

示例14: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.playermenu, menu);
    MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
    MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
    mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
    final SharedPreferences pref = getPreferences(Context.MODE_PRIVATE);
    return true;
}
 
开发者ID:andrew749,项目名称:Muzik,代码行数:11,代码来源:PlayerActivity.java

示例15: onCreateOptionsMenu

import android.support.v7.app.MediaRouteActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	super.onCreateOptionsMenu(menu);
	getMenuInflater().inflate(R.menu.main, menu);
	MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
	MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat
			.getActionProvider(mediaRouteMenuItem);
	// Set the MediaRouteActionProvider selector for device discovery.
	mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
	return true;
}
 
开发者ID:qhphan,项目名称:dojoandroidcast,代码行数:12,代码来源:MainActivity.java


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