Java 类android.support.v7.app.MediaRouteButton 实例源码
项目:FireCast
文件:SetupCastSessionActivity.java
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);
}
项目:UTubeTV
文件:BaseCastManager.java
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);
}
}
}
项目:MyAnimeViewer
文件:VideoDetailsFragment.java
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;
}
项目:MyAnimeViewer
文件:OfflineVideoDetailsFragment.java
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;
}
项目:MyAnimeViewer
文件:VideoPlayerActivity.java
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;
}
项目:android-tibits
文件:MainActivity.java
@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);
}
项目:MrinalMusicPlayer
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:MyGaana-Universal
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:FMTech
文件:bgs.java
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());
}
项目:android-UniversalMusicPlayer
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:torrenttunes-android
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:codelab-chromecast
文件:VideoBrowserActivity.java
/**
* 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();
}
}
项目:codelab-chromecast
文件:VideoBrowserActivity.java
/**
* 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();
}
}
项目:codelab-chromecast
文件:VideoBrowserActivity.java
/**
* 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();
}
}
项目:Loop
文件:VideoDetailsFragment.java
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;
}
项目:UniversalMusicPlayer
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:MusicFromChina
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:UniversalAndroidMusicPlayer
文件:ActionBarCastActivity.java
/**
* 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();
}
}
项目:bitcast
文件:Bitcast.java
/**
* 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();
}
});
}
项目:ponyville-live-android
文件:ActionBarCastActivity.java
/**
* 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
}
}
项目:cast-android-sample
文件:CastSampleActivity.java
/**
* 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();
}
项目:cast-android-sample-android-studio
文件:CastSampleActivity.java
/**
* 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();
}
项目:aos-Video
文件:ArchosMediaRouteActionProvider.java
public MediaRouteButton onCreateMediaRouteButton() {
return new ArchosMediaRouteButton(getContext());
}
项目:Pocket-Plays-for-Twitch
文件:IntroductoryOverlay.java
/**
* Set the {@link MediaRouteButton} that the ovelay should focus on.
*/
public Builder setMediaRouteButton(MediaRouteButton button) {
mView = button;
return this;
}
项目:Casty
文件:MainActivity.java
private void setUpMediaRouteButton() {
MediaRouteButton mediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
casty.setUpMediaRouteButton(mediaRouteButton);
}
项目:Casty
文件:CastyNoOp.java
@Override
public void setUpMediaRouteButton(@NonNull MediaRouteButton mediaRouteButton) {
//no-op
}
项目:FMTech
文件:jqh.java
public final void a(MediaRouteButton paramMediaRouteButton)
{
paramMediaRouteButton.a(this.i);
paramMediaRouteButton.a(wa.a);
}
项目:Popeens-DSub
文件:NowPlayingFragment.java
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
DownloadService downloadService = getDownloadService();
if(Util.isOffline(context)) {
menuInflater.inflate(R.menu.nowplaying_offline, menu);
} else {
menuInflater.inflate(R.menu.nowplaying, menu);
}
if(downloadService != null && downloadService.getSleepTimer()) {
int timeRemaining = downloadService.getSleepTimeRemaining();
timerMenu = menu.findItem(R.id.menu_toggle_timer);
if(timeRemaining > 1){
timerMenu.setTitle(context.getResources().getString(R.string.download_stop_time_remaining, Util.formatDuration(timeRemaining)));
} else {
timerMenu.setTitle(R.string.menu_set_timer);
}
}
if(downloadService != null && downloadService.getKeepScreenOn()) {
menu.findItem(R.id.menu_screen_on_off).setChecked(true);
}
if(downloadService != null && downloadService.isRemovePlayed()) {
menu.findItem(R.id.menu_remove_played).setChecked(true);
}
boolean equalizerAvailable = downloadService != null && downloadService.getEqualizerAvailable();
boolean isRemoteEnabled = downloadService != null && downloadService.isRemoteEnabled();
if(equalizerAvailable && !isRemoteEnabled) {
SharedPreferences prefs = Util.getPreferences(context);
boolean equalizerOn = prefs.getBoolean(Constants.PREFERENCES_EQUALIZER_ON, false);
if (equalizerOn && downloadService != null) {
if(downloadService.getEqualizerController() != null && downloadService.getEqualizerController().isEnabled()) {
menu.findItem(R.id.menu_equalizer).setChecked(true);
}
}
} else {
menu.removeItem(R.id.menu_equalizer);
}
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M || isRemoteEnabled) {
playbackSpeedButton.setVisibility(View.GONE);
} else {
playbackSpeedButton.setVisibility(View.VISIBLE);
}
if(downloadService != null) {
MenuItem mediaRouteItem = menu.findItem(R.id.menu_mediaroute);
if(mediaRouteItem != null) {
MediaRouteButton mediaRouteButton = (MediaRouteButton) MenuItemCompat.getActionView(mediaRouteItem);
mediaRouteButton.setDialogFactory(new CustomMediaRouteDialogFactory());
mediaRouteButton.setRouteSelector(downloadService.getRemoteSelector());
}
if(downloadService.isCurrentPlayingSingle()) {
if(!Util.isOffline(context)) {
menu.removeItem(R.id.menu_save_playlist);
}
menu.removeItem(R.id.menu_batch_mode);
menu.removeItem(R.id.menu_remove_played);
}
}
if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_BATCH_MODE, false)) {
menu.findItem(R.id.menu_batch_mode).setChecked(true);
}
}
项目:cast-any
文件:CastActivity.java
/**
* 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);
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));
mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause_button);
mStopButton = (ImageButton) findViewById(R.id.stop_button);
initButtons();
myThread = null;
Runnable runnable = new StatusRunner();
myThread = new Thread(runnable);
logVIfEnabled(TAG, "Starting statusRunner thread");
myThread.start();
Intent intent = getIntent();
String url = intent.getStringExtra("MEDIA_URL");
urls = intent.getStringArrayListExtra("MEDIA_URL_LIST");
if (urls == null || urls.size() == 0) {
urls = new ArrayList<String>();
urls.add(url);
}
title = intent.getStringExtra("MEDIA_TITLE");
if (title == null || title.isEmpty())
title = urls.get(0);
this.mediaSelected(new CastMedia(title, urls.get(0)));
nextUrl++;
}
项目:Pocket-Plays-for-Twitch
文件:BaseCastManager.java
/**
* Adds and wires up the {@link android.support.v7.app.MediaRouteButton} instance that is passed
* as an argument. This requires that
* <ul>
* <li>The enclosing {@link android.app.Activity} inherits (directly or indirectly) from
* {@link android.support.v4.app.FragmentActivity}</li>
* <li>User adds the {@link android.support.v7.app.MediaRouteButton} to the layout and passes a
* reference to that instance to this method</li>
* <li>User is in charge of controlling the visibility of this button. However, this library
* makes it easier to do so: use the callback <code>onCastAvailabilityChanged(boolean)</code>
* to change the visibility of the button in your client. For example, extend
* {@link com.google.android.libraries.cast.companionlibrary.cast.callbacks.VideoCastConsumerImpl}
* and override that method:
*
* <pre>
public void onCastAvailabilityChanged(boolean castPresent) {
mMediaRouteButton.setVisibility(castPresent ? View.VISIBLE : View.INVISIBLE);
}
* </pre>
* </li>
* </ul>
*/
public final void addMediaRouterButton(MediaRouteButton button) {
button.setRouteSelector(mMediaRouteSelector);
if (getMediaRouteDialogFactory() != null) {
button.setDialogFactory(getMediaRouteDialogFactory());
}
}
项目:codelab-chromecast
文件:BaseCastManager.java
/**
* Adds and wires up the {@link android.support.v7.app.MediaRouteButton} instance that is
* passed as an argument. This requires that
* <ul>
* <li>The enclosing {@link android.app.Activity} inherits (directly or indirectly) from
* {@link android.support.v4.app.FragmentActivity}</li>
* <li>User adds the {@link android.support.v7.app.MediaRouteButton} to the layout and
* pass a reference to that instance to this method</li>
* <li>User is in charge of controlling the visibility of this button. However, this
* library makes it easier to do so: use the callback
* <code>onCastAvailabilityChanged(boolean)</code> to change the visibility of the button in
* your client. For example, extend
* {@link com.google.sample.castcompanionlibrary.cast.callbacks.VideoCastConsumerImpl}
* and override that method:
* <pre>
* {@code
* public void onCastAvailabilityChanged(boolean castPresent) {
* mMediaRouteButton.setVisibility(castPresent ? View.VISIBLE : View.INVISIBLE);
* }
* }
* </pre>
* </li>
* </ul>
*/
public MediaRouteButton addMediaRouterButton(MediaRouteButton button) {
button.setRouteSelector(mMediaRouteSelector);
if (null != getMediaRouteDialogFactory()) {
button.setDialogFactory(getMediaRouteDialogFactory());
}
return button;
}
项目:Jupiter-Broadcasting-Holo
文件:BaseCastManager.java
/**
* Adds and wires up the {@link android.support.v7.app.MediaRouteButton} instance that is passed
* as an argument. This requires that
* <ul>
* <li>The enclosing {@link android.app.Activity} inherits (directly or indirectly) from
* {@link android.support.v4.app.FragmentActivity}</li>
* <li>User adds the {@link android.support.v7.app.MediaRouteButton} to the layout and
* pass a reference to that instance to this method</li>
* <li>User is in charge of controlling the visibility of this button. However, this
* library makes it easier to do so: use the callback
* <code>onCastAvailabilityChanged(boolean)</code> to change the visibility of the button in
* your client. For example, extend
* {@link com.google.sample.castcompanionlibrary.cast.callbacks.VideoCastConsumerImpl}
* and override that method:
* <pre>
{@code
public void onCastAvailabilityChanged(boolean castPresent) {
mMediaRouteButton.setVisibility(castPresent ? View.VISIBLE : View.INVISIBLE);
}
}
* </pre>
* </li>
* </ul>
* @param button
* @return
*/
public MediaRouteButton addMediaRouterButton(MediaRouteButton button) {
button.setRouteSelector(mMediaRouteSelector);
if (null != getMediaRouteDialogFactory()) {
button.setDialogFactory(getMediaRouteDialogFactory());
}
return button;
}
项目:Casty
文件:Casty.java
/**
* Makes {@link MediaRouteButton} react to discovery events.
* Must be run on UiThread.
*
* @param mediaRouteButton Button to be set up
*/
@UiThread
public void setUpMediaRouteButton(@NonNull MediaRouteButton mediaRouteButton) {
CastButtonFactory.setUpMediaRouteButton(activity, mediaRouteButton);
}
项目:FMTech
文件:jqb.java
public void a(MediaRouteButton paramMediaRouteButton) {}