Methods Summary |
---|
public boolean | isVisible()
return mRouter.isRouteAvailable(mRouteTypes,
MediaRouter.AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE);
|
public android.view.View | onCreateActionView()
throw new UnsupportedOperationException("Use onCreateActionView(MenuItem) instead.");
|
public android.view.View | onCreateActionView(android.view.MenuItem item)
if (mButton != null) {
Log.e(TAG, "onCreateActionView: this ActionProvider is already associated " +
"with a menu item. Don't reuse MediaRouteActionProvider instances! " +
"Abandoning the old one...");
}
mButton = new MediaRouteButton(mContext);
mButton.setCheatSheetEnabled(true);
mButton.setRouteTypes(mRouteTypes);
mButton.setExtendedSettingsClickListener(mExtendedSettingsListener);
mButton.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT));
return mButton;
|
public boolean | onPerformDefaultAction()
if (mButton != null) {
return mButton.showDialogInternal();
}
return false;
|
public boolean | overridesItemVisibility()
return true;
|
private void | refreshRoute()
refreshVisibility();
|
public void | setExtendedSettingsClickListener(View.OnClickListener listener)
mExtendedSettingsListener = listener;
if (mButton != null) {
mButton.setExtendedSettingsClickListener(listener);
}
|
public void | setRouteTypes(int types)Sets the types of routes that will be shown in the media route chooser dialog
launched by this button.
if (mRouteTypes != types) {
// FIXME: We currently have no way of knowing whether the action provider
// is still needed by the UI. Unfortunately this means the action provider
// may leak callbacks until garbage collection occurs. This may result in
// media route providers doing more work than necessary in the short term
// while trying to discover routes that are no longer of interest to the
// application. To solve this problem, the action provider will need some
// indication from the framework that it is being destroyed.
if (mRouteTypes != 0) {
mRouter.removeCallback(mCallback);
}
mRouteTypes = types;
if (types != 0) {
mRouter.addCallback(types, mCallback,
MediaRouter.CALLBACK_FLAG_PASSIVE_DISCOVERY);
}
refreshRoute();
if (mButton != null) {
mButton.setRouteTypes(mRouteTypes);
}
}
|