Methods Summary |
---|
public int | getRouteTypes()Gets the media route types for filtering the routes that the user can
select using the media route chooser dialog.
return mRouteTypes;
|
public void | onAttachedToWindow()
super.onAttachedToWindow();
mAttachedToWindow = true;
mRouter.addCallback(mRouteTypes, mCallback, MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN);
refreshRoutes();
|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
setContentView(R.layout.media_route_chooser_dialog);
setTitle(mRouteTypes == MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY
? R.string.media_route_chooser_title_for_remote_display
: R.string.media_route_chooser_title);
// Must be called after setContentView.
getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
R.drawable.ic_media_route_off_holo_dark);
mAdapter = new RouteAdapter(getContext());
mListView = (ListView)findViewById(R.id.media_route_list);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(mAdapter);
mListView.setEmptyView(findViewById(android.R.id.empty));
mExtendedSettingsButton = (Button)findViewById(R.id.media_route_extended_settings_button);
updateExtendedSettingsButton();
|
public void | onDetachedFromWindow()
mAttachedToWindow = false;
mRouter.removeCallback(mCallback);
super.onDetachedFromWindow();
|
public boolean | onFilterRoute(android.media.MediaRouter.RouteInfo route)Returns true if the route should be included in the list.
The default implementation returns true for enabled non-default routes that
match the route types. Subclasses can override this method to filter routes
differently.
return !route.isDefault() && route.isEnabled() && route.matchesTypes(mRouteTypes);
|
public void | refreshRoutes()Refreshes the list of routes that are shown in the chooser dialog.
if (mAttachedToWindow) {
mAdapter.update();
}
|
public void | setExtendedSettingsClickListener(View.OnClickListener listener)
if (listener != mExtendedSettingsClickListener) {
mExtendedSettingsClickListener = listener;
updateExtendedSettingsButton();
}
|
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) {
mRouteTypes = types;
if (mAttachedToWindow) {
mRouter.removeCallback(mCallback);
mRouter.addCallback(types, mCallback,
MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN);
}
refreshRoutes();
}
|
private void | updateExtendedSettingsButton()
if (mExtendedSettingsButton != null) {
mExtendedSettingsButton.setOnClickListener(mExtendedSettingsClickListener);
mExtendedSettingsButton.setVisibility(
mExtendedSettingsClickListener != null ? View.VISIBLE : View.GONE);
}
|