本文整理汇总了Java中android.support.v7.app.MediaRouteButton类的典型用法代码示例。如果您正苦于以下问题:Java MediaRouteButton类的具体用法?Java MediaRouteButton怎么用?Java MediaRouteButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaRouteButton类属于android.support.v7.app包,在下文中一共展示了MediaRouteButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startDeviceScan
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
private void startDeviceScan() {
MediaRouteHelper.registerMinimalMediaRouteProvider(
mService.getCastContext(), this);
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = MediaRouteHelper.buildMediaRouteSelector(
MediaRouteHelper.CATEGORY_CAST, null, null);
mMediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
// mMediaRouteButton.setDialogFactory(mDialogFactory);
mMediaRouterCallback = new MyMediaRouterCallback();
mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback,
MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
}
示例2: addMediaRouterButton
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
public void addMediaRouterButton(Menu menu, int menuResourceId, Activity activity, boolean disabled) {
MenuItem item = menu.findItem(menuResourceId);
if (item != null) {
if (disabled) {
item.setVisible(false);
} else {
MediaRouteButton button = new MediaRouteButton(activity); // don't pass mContext, it needs a real activity or it's fucked
button.setRouteSelector(mMediaRouteSelector);
if (null != getMediaRouteDialogFactory()) {
button.setDialogFactory(getMediaRouteDialogFactory());
}
item.setActionView(button);
}
}
}
示例3: getRemoteIndicatorDrawable
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
private Drawable getRemoteIndicatorDrawable() {
@SuppressLint("RestrictedApi") Context castContext = new ContextThemeWrapper(getContext(), android.support.v7.mediarouter.R.style.Theme_MediaRouter);
TypedArray a = castContext.obtainStyledAttributes(null,
android.support.v7.mediarouter.R.styleable.MediaRouteButton, android.support.v7.mediarouter.R.attr.mediaRouteButtonStyle, 0);
Drawable remoteIndicatorDrawable = a.getDrawable(
android.support.v7.mediarouter.R.styleable.MediaRouteButton_externalRouteEnabledDrawable);
a.recycle();
return remoteIndicatorDrawable;
}
示例4: getRemoteIndicatorDrawable
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
private Drawable getRemoteIndicatorDrawable() {
@SuppressLint("RestrictedApi") Context castContext = new ContextThemeWrapper(this, android.support.v7.mediarouter.R.style.Theme_MediaRouter);
TypedArray a = castContext.obtainStyledAttributes(null,
android.support.v7.mediarouter.R.styleable.MediaRouteButton, android.support.v7.mediarouter.R.attr.mediaRouteButtonStyle, 0);
Drawable remoteIndicatorDrawable = a.getDrawable(
android.support.v7.mediarouter.R.styleable.MediaRouteButton_externalRouteEnabledDrawable);
a.recycle();
return remoteIndicatorDrawable;
}
示例5: onCreate
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setSupportActionBar((Toolbar)findViewById(R.id.toolbar));
mVideoCastManager = VideoCastManager.getInstance();
mExternalRouteEnabledDrawable = ColorCastUtil.getMediaRouteButtonDrawable(MainActivity.this);
//MediaRouterButton in layout
mLayoutMediaRouteButton = (MediaRouteButton)findViewById(R.id.media_route_button);
mVideoCastManager.addMediaRouterButton(mLayoutMediaRouteButton);
}
示例6: showFtu
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* Shows the Cast First Time User experience to the user (an overlay that explains what is
* the Cast icon)
*/
private void showFtu() {
Menu menu = mToolbar.getMenu();
View view = menu.findItem(R.id.media_route_menu_item).getActionView();
if (view != null && view instanceof MediaRouteButton) {
new ShowcaseView.Builder(this)
.setTarget(new ViewTarget(view))
.setContentTitle(R.string.touch_to_cast)
.hideOnTouchOutside()
.build();
}
}
示例7: a
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
public final void a(Menu paramMenu)
{
Context localContext = this.b;
if (this.a == -1) {
return;
}
MenuItem localMenuItem = paramMenu.findItem(this.c);
jqb localjqb = (jqb)mbb.a(localContext, jqb.class);
localjqb.a((MediaRouteButton)mm.a(localMenuItem));
localMenuItem.setVisible(localjqb.a());
}
示例8: showFtu
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* Shows the Cast First Time User experience to the user (an overlay that explains what is
* the Cast icon)
*/
private void showFtu() {
Menu menu = mToolbar.getMenu();
View view = menu.findItem(R.id.media_route_menu_item).getActionView();
if (view != null && view instanceof MediaRouteButton) {
IntroductoryOverlay overlay = new IntroductoryOverlay.Builder(this, mMediaRouteMenuItem)
.setTitleText(R.string.touch_to_cast)
.setSingleTime()
.build();
overlay.show();
}
}
示例9: showFtu
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* The getActionView() method used in this method requires API 11 or above. If one needs to
* extend this below that version, one possible solution could be using reflection and such.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void showFtu() {
Menu menu = mToolbar.getMenu();
View view = menu.findItem(R.id.media_route_menu_item).getActionView();
if (view != null && view instanceof MediaRouteButton) {
new ShowcaseView.Builder(this)
.setTarget(new ViewTarget(view))
.setContentTitle(R.string.touch_to_cast)
.build();
}
}
示例10: getRemoteIndicatorDrawable
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
private Drawable getRemoteIndicatorDrawable(){
Context castContext = new ContextThemeWrapper(getContext(), android.support.v7.mediarouter.R.style.Theme_MediaRouter);
TypedArray a = castContext.obtainStyledAttributes(null,
android.support.v7.mediarouter.R.styleable.MediaRouteButton, android.support.v7.mediarouter.R.attr.mediaRouteButtonStyle, 0);
Drawable remoteIndicatorDrawable = a.getDrawable(
android.support.v7.mediarouter.R.styleable.MediaRouteButton_externalRouteEnabledDrawable);
a.recycle();
return remoteIndicatorDrawable;
}
示例11: onCreate
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = new MediaRouteSelector.Builder()
.addControlCategory(CastMediaControlIntent.categoryForCast(APP_ID))
.build();
final android.support.v7.app.MediaRouteButton button
= (MediaRouteButton) findViewById(R.id.main_button);
mMediaRouterCallback = new RouterCallback();
mConnectionFailedListener = new ConnectionFailedListener();
mConnectionCallbacks = new ConnectionCallbacks();
mCastClientListener = new CastListener();
button.setRouteSelector(mMediaRouteSelector);
Button otherButton = (Button) findViewById(R.id.start);
otherButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
button.showDialog();
}
});
}
示例12: showFtu
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* The first time the app opens, we wanna
* highlight that sexy cast button
*/
private void showFtu() {
Menu menu = toolbar.getMenu();
View view = menu.findItem(R.id.action_cast).getActionView();
if (view != null && view instanceof MediaRouteButton) {
// TODO: ShowcaseView
}
}
示例13: onCreate
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* Initializes MediaRouter information and prepares for Cast device detection upon creating
* this activity.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
logVIfEnabled(TAG, "onCreate called");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cast_sample);
mCastContext = new CastContext(getApplicationContext());
mMedia = new CastMedia(null, null);
mMetaData = new ContentMetadata();
mDialogFactory = new SampleMediaRouteDialogFactory();
MediaRouteHelper.registerMinimalMediaRouteProvider(mCastContext, this);
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = MediaRouteHelper
.buildMediaRouteSelector(MediaRouteHelper.CATEGORY_CAST);
mMediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
mMediaRouteButton.setDialogFactory(mDialogFactory);
mMediaRouterCallback = new MyMediaRouterCallback();
mStatusText = (TextView) findViewById(R.id.play_status_text);
mCurrentlyPlaying = (TextView) findViewById(R.id.currently_playing);
mCurrentlyPlaying.setText(getString(R.string.tap_to_select));
mMediaSelectionDialog = new MediaSelectionDialog(this);
mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause_button);
mStopButton = (ImageButton) findViewById(R.id.stop_button);
initButtons();
Thread myThread = null;
Runnable runnable = new StatusRunner();
myThread = new Thread(runnable);
logVIfEnabled(TAG, "Starting statusRunner thread");
myThread.start();
}
示例14: onCreate
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
/**
* Initializes MediaRouter information and prepares for Cast device detection upon creating
* this activity.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
logVIfEnabled(TAG, "onCreate called");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cast_sample);
mCastContext = new CastContext(getApplicationContext());
mMedia = new CastMedia(null, null);
mMetaData = new ContentMetadata();
mDialogFactory = new SampleMediaRouteDialogFactory();
MediaRouteHelper.registerMinimalMediaRouteProvider(mCastContext, this);
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = MediaRouteHelper
.buildMediaRouteSelector(MediaRouteHelper.CATEGORY_CAST,
getResources().getString(R.string.app_name), null);
mMediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
mMediaRouteButton.setDialogFactory(mDialogFactory);
mMediaRouterCallback = new MyMediaRouterCallback();
mStatusText = (TextView) findViewById(R.id.play_status_text);
mCurrentlyPlaying = (TextView) findViewById(R.id.currently_playing);
mCurrentlyPlaying.setText(getString(R.string.tap_to_select));
mMediaSelectionDialog = new MediaSelectionDialog(this);
mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause_button);
mStopButton = (ImageButton) findViewById(R.id.stop_button);
initButtons();
Thread myThread = null;
Runnable runnable = new StatusRunner();
myThread = new Thread(runnable);
logVIfEnabled(TAG, "Starting statusRunner thread");
myThread.start();
}
示例15: onCreateMediaRouteButton
import android.support.v7.app.MediaRouteButton; //导入依赖的package包/类
public MediaRouteButton onCreateMediaRouteButton() {
return new ArchosMediaRouteButton(getContext());
}