Merge "API updates for MediaRouter" into jb-dev

This commit is contained in:
Adam Powell
2012-06-14 17:51:25 -07:00
committed by Android (Google) Code Review
5 changed files with 233 additions and 123 deletions

View File

@ -3679,6 +3679,7 @@ package android.app {
public class MediaRouteActionProvider extends android.view.ActionProvider {
ctor public MediaRouteActionProvider(android.content.Context);
method public android.view.View onCreateActionView();
method public void setExtendedSettingsClickListener(android.view.View.OnClickListener);
method public void setRouteTypes(int);
}
@ -3687,7 +3688,9 @@ package android.app {
ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet);
ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int);
method public int getRouteTypes();
method public void setExtendedSettingsClickListener(android.view.View.OnClickListener);
method public void setRouteTypes(int);
method public void showDialog();
}
public class NativeActivity extends android.app.Activity implements android.view.InputQueue.Callback android.view.SurfaceHolder.Callback2 android.view.ViewTreeObserver.OnGlobalLayoutListener {
@ -11511,6 +11514,7 @@ package android.media {
method public void addUserRoute(android.media.MediaRouter.UserRouteInfo);
method public void clearUserRoutes();
method public android.media.MediaRouter.RouteCategory createRouteCategory(java.lang.CharSequence, boolean);
method public android.media.MediaRouter.RouteCategory createRouteCategory(int, boolean);
method public android.media.MediaRouter.UserRouteInfo createUserRoute(android.media.MediaRouter.RouteCategory);
method public android.media.MediaRouter.RouteCategory getCategoryAt(int);
method public int getCategoryCount();
@ -11524,7 +11528,8 @@ package android.media {
field public static final int ROUTE_TYPE_USER = 8388608; // 0x800000
}
public static abstract interface MediaRouter.Callback {
public static abstract class MediaRouter.Callback {
ctor public MediaRouter.Callback();
method public abstract void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
method public abstract void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
method public abstract void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int);
@ -11536,6 +11541,7 @@ package android.media {
public static class MediaRouter.RouteCategory {
method public java.lang.CharSequence getName();
method public java.lang.CharSequence getName(android.content.Context);
method public java.util.List<android.media.MediaRouter.RouteInfo> getRoutes(java.util.List<android.media.MediaRouter.RouteInfo>);
method public int getSupportedTypes();
method public boolean isGroupable();
@ -11548,17 +11554,21 @@ package android.media {
method public int getRouteCount();
method public void removeRoute(android.media.MediaRouter.RouteInfo);
method public void removeRoute(int);
method public void setIconDrawable(android.graphics.drawable.Drawable);
method public void setIconResource(int);
}
public static class MediaRouter.RouteInfo {
method public android.media.MediaRouter.RouteCategory getCategory();
method public android.media.MediaRouter.RouteGroup getGroup();
method public android.graphics.drawable.Drawable getIconDrawable();
method public java.lang.CharSequence getName();
method public java.lang.CharSequence getName(android.content.Context);
method public java.lang.CharSequence getStatus();
method public int getSupportedTypes();
}
public static class MediaRouter.SimpleCallback implements android.media.MediaRouter.Callback {
public static class MediaRouter.SimpleCallback extends android.media.MediaRouter.Callback {
ctor public MediaRouter.SimpleCallback();
method public void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
method public void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
@ -11570,8 +11580,14 @@ package android.media {
}
public static class MediaRouter.UserRouteInfo extends android.media.MediaRouter.RouteInfo {
method public java.lang.Object getTag();
method public void setIconDrawable(android.graphics.drawable.Drawable);
method public void setIconResource(int);
method public void setName(java.lang.CharSequence);
method public void setName(int);
method public void setRemoteControlClient(android.media.RemoteControlClient);
method public void setStatus(java.lang.CharSequence);
method public void setTag(java.lang.Object);
}
public class MediaScannerConnection implements android.content.ServiceConnection {

View File

@ -11514,6 +11514,7 @@ package android.media {
method public void addUserRoute(android.media.MediaRouter.UserRouteInfo);
method public void clearUserRoutes();
method public android.media.MediaRouter.RouteCategory createRouteCategory(java.lang.CharSequence, boolean);
method public android.media.MediaRouter.RouteCategory createRouteCategory(int, boolean);
method public android.media.MediaRouter.UserRouteInfo createUserRoute(android.media.MediaRouter.RouteCategory);
method public android.media.MediaRouter.RouteCategory getCategoryAt(int);
method public int getCategoryCount();
@ -11527,7 +11528,8 @@ package android.media {
field public static final int ROUTE_TYPE_USER = 8388608; // 0x800000
}
public static abstract interface MediaRouter.Callback {
public static abstract class MediaRouter.Callback {
ctor public MediaRouter.Callback();
method public abstract void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
method public abstract void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
method public abstract void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int);
@ -11539,6 +11541,7 @@ package android.media {
public static class MediaRouter.RouteCategory {
method public java.lang.CharSequence getName();
method public java.lang.CharSequence getName(android.content.Context);
method public java.util.List<android.media.MediaRouter.RouteInfo> getRoutes(java.util.List<android.media.MediaRouter.RouteInfo>);
method public int getSupportedTypes();
method public boolean isGroupable();
@ -11560,11 +11563,12 @@ package android.media {
method public android.media.MediaRouter.RouteGroup getGroup();
method public android.graphics.drawable.Drawable getIconDrawable();
method public java.lang.CharSequence getName();
method public java.lang.CharSequence getName(android.content.Context);
method public java.lang.CharSequence getStatus();
method public int getSupportedTypes();
}
public static class MediaRouter.SimpleCallback implements android.media.MediaRouter.Callback {
public static class MediaRouter.SimpleCallback extends android.media.MediaRouter.Callback {
ctor public MediaRouter.SimpleCallback();
method public void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
method public void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
@ -11580,6 +11584,7 @@ package android.media {
method public void setIconDrawable(android.graphics.drawable.Drawable);
method public void setIconResource(int);
method public void setName(java.lang.CharSequence);
method public void setName(int);
method public void setRemoteControlClient(android.media.RemoteControlClient);
method public void setStatus(java.lang.CharSequence);
method public void setTag(java.lang.Object);

View File

@ -103,7 +103,7 @@ public class MediaRouteButton extends View {
if (mToggleMode) {
if (mRemoteActive) {
mRouter.selectRoute(mRouteTypes, mRouter.getSystemAudioRoute());
mRouter.selectRouteInt(mRouteTypes, mRouter.getSystemAudioRoute());
} else {
final int N = mRouter.getRouteCount();
for (int i = 0; i < N; i++) {

View File

@ -77,7 +77,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
private GroupAdapter mGroupAdapter;
private ListView mListView;
static final RouteComparator sComparator = new RouteComparator();
final RouteComparator mComparator = new RouteComparator();
public MediaRouteChooserDialogFragment() {
setStyle(STYLE_NO_TITLE, R.style.Theme_DeviceDefault_Dialog);
@ -100,11 +100,11 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
mLauncherListener.onDetached(this);
}
if (mGroupAdapter != null) {
mRouter.removeCallback(mGroupAdapter);
mRouter.removeCallback(mGroupAdapter.mCallback);
mGroupAdapter = null;
}
if (mAdapter != null) {
mRouter.removeCallback(mAdapter);
mRouter.removeCallback(mAdapter.mCallback);
mAdapter = null;
}
mInflater = null;
@ -146,14 +146,14 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
list.setOnItemClickListener(mAdapter);
mListView = list;
mRouter.addCallback(mRouteTypes, mAdapter);
mRouter.addCallback(mRouteTypes, mAdapter.mCallback);
return layout;
}
void onExpandGroup(RouteGroup info) {
mGroupAdapter = new GroupAdapter(info);
mRouter.addCallback(mRouteTypes, mGroupAdapter);
mRouter.addCallback(mRouteTypes, mGroupAdapter.mCallback);
mListView.setAdapter(mGroupAdapter);
mListView.setOnItemClickListener(mGroupAdapter);
mListView.setItemsCanFocus(false);
@ -172,7 +172,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
mListView.setItemChecked(mAdapter.getSelectedRoutePosition(), true);
mRouter.removeCallback(mGroupAdapter);
mRouter.removeCallback(mGroupAdapter.mCallback);
mGroupAdapter = null;
getDialog().setCanceledOnTouchOutside(true);
@ -205,14 +205,14 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
public int position;
}
private class RouteAdapter extends BaseAdapter implements MediaRouter.Callback,
ListView.OnItemClickListener {
private class RouteAdapter extends BaseAdapter implements ListView.OnItemClickListener {
private static final int VIEW_TOP_HEADER = 0;
private static final int VIEW_SECTION_HEADER = 1;
private static final int VIEW_ROUTE = 2;
private int mSelectedItemPosition;
private final ArrayList<Object> mItems = new ArrayList<Object>();
final MediaRouterCallback mCallback = new MediaRouterCallback();
RouteAdapter() {
update();
@ -333,7 +333,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
void bindItemView(int position, ViewHolder holder) {
RouteInfo info = (RouteInfo) mItems.get(position);
holder.text1.setText(info.getName());
holder.text1.setText(info.getName(getActivity()));
final CharSequence status = info.getStatus();
if (TextUtils.isEmpty(status)) {
holder.text2.setVisibility(View.GONE);
@ -363,13 +363,37 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
void bindHeaderView(int position, ViewHolder holder) {
RouteCategory cat = (RouteCategory) mItems.get(position);
holder.text1.setText(cat.getName());
holder.text1.setText(cat.getName(getActivity()));
}
public int getSelectedRoutePosition() {
return mSelectedItemPosition;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ListView lv = (ListView) parent;
final Object item = getItem(lv.getCheckedItemPosition());
if (!(item instanceof RouteInfo)) {
// Oops. Stale event running around? Skip it.
return;
}
mRouter.selectRouteInt(mRouteTypes, (RouteInfo) item);
dismiss();
}
class ExpandGroupListener implements View.OnClickListener {
int position;
@Override
public void onClick(View v) {
// Assumption: this is only available for the user to click if we're presenting
// a groupable category, where every top-level route in the category is a group.
onExpandGroup((RouteGroup) getItem(position));
}
}
class MediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, int type, RouteInfo info) {
update();
@ -405,33 +429,10 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
public void onRouteUngrouped(MediaRouter router, RouteInfo info, RouteGroup group) {
update();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ListView lv = (ListView) parent;
final Object item = getItem(lv.getCheckedItemPosition());
if (!(item instanceof RouteInfo)) {
// Oops. Stale event running around? Skip it.
return;
}
mRouter.selectRoute(mRouteTypes, (RouteInfo) item);
dismiss();
}
class ExpandGroupListener implements View.OnClickListener {
int position;
@Override
public void onClick(View v) {
// Assumption: this is only available for the user to click if we're presenting
// a groupable category, where every top-level route in the category is a group.
onExpandGroup((RouteGroup) getItem(position));
}
}
}
private class GroupAdapter extends BaseAdapter implements MediaRouter.Callback,
ListView.OnItemClickListener {
private class GroupAdapter extends BaseAdapter implements ListView.OnItemClickListener {
private static final int VIEW_HEADER = 0;
private static final int VIEW_ROUTE = 1;
private static final int VIEW_DONE = 2;
@ -442,6 +443,8 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
private final ArrayList<RouteInfo> mFlatRoutes = new ArrayList<RouteInfo>();
private boolean mIgnoreUpdates;
final MediaRouterCallback mCallback = new MediaRouterCallback();
public GroupAdapter(RouteGroup primary) {
mPrimary = primary;
mCategory = primary.getCategory();
@ -493,7 +496,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
// Sort by name. This will keep the route positions relatively stable even though they
// will be repeatedly added and removed.
Collections.sort(mFlatRoutes, sComparator);
Collections.sort(mFlatRoutes, mComparator);
notifyDataSetChanged();
}
@ -563,7 +566,7 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
void bindItemView(int position, ViewHolder holder) {
RouteInfo info = (RouteInfo) getItem(position);
holder.text1.setText(info.getName());
holder.text1.setText(info.getName(getActivity()));
final CharSequence status = info.getStatus();
if (TextUtils.isEmpty(status)) {
holder.text2.setVisibility(View.GONE);
@ -574,9 +577,56 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
}
void bindHeaderView(int position, ViewHolder holder) {
holder.text1.setText(mCategory.getName());
holder.text1.setText(mCategory.getName(getActivity()));
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (getItemViewType(position) == VIEW_DONE) {
onDoneGrouping();
return;
}
final ListView lv = (ListView) parent;
final RouteInfo route = mFlatRoutes.get(position - 1);
final boolean checked = lv.isItemChecked(position);
mIgnoreUpdates = true;
RouteGroup oldGroup = route.getGroup();
if (checked && oldGroup != mPrimary) {
// Assumption: in a groupable category oldGroup will never be null.
oldGroup.removeRoute(route);
// If the group is now empty, remove the group too.
if (oldGroup.getRouteCount() == 0) {
if (mRouter.getSelectedRoute(mRouteTypes) == oldGroup) {
// Old group was selected but is now empty. Select the group
// we're manipulating since that's where the last route went.
mRouter.selectRouteInt(mRouteTypes, mPrimary);
}
mRouter.removeRouteInt(oldGroup);
}
mPrimary.addRoute(route);
} else if (!checked) {
if (mPrimary.getRouteCount() > 1) {
mPrimary.removeRoute(route);
// In a groupable category this will add the route into its own new group.
mRouter.addRouteInt(route);
} else {
// We're about to remove the last route.
// Don't let this happen, as it would be silly.
// Turn the checkmark back on again. Silly user!
lv.setItemChecked(position, true);
}
}
mIgnoreUpdates = false;
update();
initCheckedItems();
}
class MediaRouterCallback extends MediaRouter.Callback {
@Override
public void onRouteSelected(MediaRouter router, int type, RouteInfo info) {
}
@ -608,7 +658,8 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
}
@Override
public void onRouteGrouped(MediaRouter router, RouteInfo info, RouteGroup group, int index) {
public void onRouteGrouped(MediaRouter router, RouteInfo info, RouteGroup group,
int index) {
update();
initCheckedItems();
}
@ -618,58 +669,14 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
update();
initCheckedItems();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (getItemViewType(position) == VIEW_DONE) {
onDoneGrouping();
return;
}
final ListView lv = (ListView) parent;
final RouteInfo route = mFlatRoutes.get(position - 1);
final boolean checked = lv.isItemChecked(position);
mIgnoreUpdates = true;
RouteGroup oldGroup = route.getGroup();
if (checked && oldGroup != mPrimary) {
// Assumption: in a groupable category oldGroup will never be null.
oldGroup.removeRoute(route);
// If the group is now empty, remove the group too.
if (oldGroup.getRouteCount() == 0) {
if (mRouter.getSelectedRoute(mRouteTypes) == oldGroup) {
// Old group was selected but is now empty. Select the group
// we're manipulating since that's where the last route went.
mRouter.selectRoute(mRouteTypes, mPrimary);
}
mRouter.removeRouteInt(oldGroup);
}
mPrimary.addRoute(route);
} else if (!checked) {
if (mPrimary.getRouteCount() > 1) {
mPrimary.removeRoute(route);
// In a groupable category this will add the route into its own new group.
mRouter.addRouteInt(route);
} else {
// We're about to remove the last route.
// Don't let this happen, as it would be silly.
// Turn the checkmark back on again. Silly user!
lv.setItemChecked(position, true);
}
}
mIgnoreUpdates = false;
update();
initCheckedItems();
}
}
static class RouteComparator implements Comparator<RouteInfo> {
class RouteComparator implements Comparator<RouteInfo> {
@Override
public int compare(RouteInfo lhs, RouteInfo rhs) {
return lhs.getName().toString().compareTo(rhs.getName().toString());
return lhs.getName(getActivity()).toString()
.compareTo(rhs.getName(getActivity()).toString());
}
}

View File

@ -83,8 +83,7 @@ public class MediaRouter {
// Called after sStatic is initialized
void initDefaultRoutes() {
mDefaultAudio = new RouteInfo(mSystemCategory);
mDefaultAudio.mName = mResources.getText(
com.android.internal.R.string.default_audio_route_name);
mDefaultAudio.mNameResId = com.android.internal.R.string.default_audio_route_name;
mDefaultAudio.mSupportedTypes = ROUTE_TYPE_LIVE_AUDIO;
addRoute(mDefaultAudio);
}
@ -156,10 +155,15 @@ public class MediaRouter {
}
static void onHeadphonesPlugged(boolean headphonesPresent, String headphonesName) {
sStatic.mDefaultAudio.mName = headphonesPresent
? headphonesName
: sStatic.mResources.getText(
com.android.internal.R.string.default_audio_route_name);
if (headphonesPresent) {
sStatic.mDefaultAudio.mName = headphonesName;
sStatic.mDefaultAudio.mNameResId = 0;
} else {
sStatic.mDefaultAudio.mName = null;
sStatic.mDefaultAudio.mNameResId =
com.android.internal.R.string.default_audio_route_name;
}
dispatchRouteChanged(sStatic.mDefaultAudio);
}
@ -207,11 +211,25 @@ public class MediaRouter {
* @param route Route to select
*/
public void selectRoute(int types, RouteInfo route) {
// Applications shouldn't programmatically change anything but user routes.
types &= ROUTE_TYPE_USER;
selectRouteStatic(types, route);
}
/**
* @hide internal use
*/
public void selectRouteInt(int types, RouteInfo route) {
selectRouteStatic(types, route);
}
static void selectRouteStatic(int types, RouteInfo route) {
if (sStatic.mSelectedRoute == route) return;
if ((route.getSupportedTypes() & types) == 0) {
Log.w(TAG, "selectRoute ignored; cannot select route with supported types " +
typesToString(route.getSupportedTypes()) + " into route types " +
typesToString(types));
}
if (sStatic.mSelectedRoute != null) {
// TODO filter types properly
@ -425,6 +443,17 @@ public class MediaRouter {
return new RouteCategory(name, ROUTE_TYPE_USER, isGroupable);
}
/**
* Create a new route category. Each route must belong to a category.
*
* @param nameResId Resource ID of the name of the new category
* @param isGroupable true if routes in this category may be grouped with one another
* @return the new RouteCategory
*/
public RouteCategory createRouteCategory(int nameResId, boolean isGroupable) {
return new RouteCategory(nameResId, ROUTE_TYPE_USER, isGroupable);
}
static void updateRoute(final RouteInfo info) {
dispatchRouteChanged(info);
}
@ -501,8 +530,7 @@ public class MediaRouter {
static void onA2dpDeviceConnected() {
final RouteInfo info = new RouteInfo(sStatic.mSystemCategory);
info.mName = sStatic.mResources.getString(
com.android.internal.R.string.bluetooth_a2dp_audio_route_name);
info.mNameResId = com.android.internal.R.string.bluetooth_a2dp_audio_route_name;
sStatic.mBluetoothA2dpRoute = info;
addRoute(sStatic.mBluetoothA2dpRoute);
}
@ -517,6 +545,7 @@ public class MediaRouter {
*/
public static class RouteInfo {
CharSequence mName;
int mNameResId;
private CharSequence mStatus;
int mSupportedTypes;
RouteGroup mGroup;
@ -532,6 +561,24 @@ public class MediaRouter {
* to users who may select this as the active route.
*/
public CharSequence getName() {
return getName(sStatic.mResources);
}
/**
* Return the properly localized/resource selected name of this route.
*
* @param context Context used to resolve the correct configuration to load
* @return The user-friendly name of the media route. This is the string presented
* to users who may select this as the active route.
*/
public CharSequence getName(Context context) {
return getName(context.getResources());
}
CharSequence getName(Resources res) {
if (mNameResId != 0) {
return mName = res.getText(mNameResId);
}
return mName;
}
@ -621,6 +668,16 @@ public class MediaRouter {
routeUpdated();
}
/**
* Set the user-visible name of this route.
* @param resId Resource ID of the name to display to the user to describe this route
*/
public void setName(int resId) {
mNameResId = resId;
mName = null;
routeUpdated();
}
/**
* Set the current user-visible status for this route.
* @param status Status to display to the user to describe what the endpoint
@ -700,9 +757,9 @@ public class MediaRouter {
mGroup = this;
}
public CharSequence getName() {
CharSequence getName(Resources res) {
if (mUpdateName) updateName();
return super.getName();
return super.getName(res);
}
/**
@ -870,6 +927,7 @@ public class MediaRouter {
*/
public static class RouteCategory {
CharSequence mName;
int mNameResId;
int mTypes;
final boolean mGroupable;
@ -879,10 +937,33 @@ public class MediaRouter {
mGroupable = groupable;
}
RouteCategory(int nameResId, int types, boolean groupable) {
mNameResId = nameResId;
mTypes = types;
mGroupable = groupable;
}
/**
* @return the name of this route category
*/
public CharSequence getName() {
return getName(sStatic.mResources);
}
/**
* Return the properly localized/configuration dependent name of this RouteCategory.
*
* @param context Context to resolve name resources
* @return the name of this route category
*/
public CharSequence getName(Context context) {
return getName(context.getResources());
}
CharSequence getName(Resources res) {
if (mNameResId != 0) {
return res.getText(mNameResId);
}
return mName;
}
@ -963,7 +1044,7 @@ public class MediaRouter {
* @see MediaRouter#addCallback(int, Callback)
* @see MediaRouter#removeCallback(Callback)
*/
public interface Callback {
public static abstract class Callback {
/**
* Called when the supplied route becomes selected as the active route
* for the given route type.
@ -972,7 +1053,7 @@ public class MediaRouter {
* @param type Type flag set indicating the routes that have been selected
* @param info Route that has been selected for the given route types
*/
public void onRouteSelected(MediaRouter router, int type, RouteInfo info);
public abstract void onRouteSelected(MediaRouter router, int type, RouteInfo info);
/**
* Called when the supplied route becomes unselected as the active route
@ -982,7 +1063,7 @@ public class MediaRouter {
* @param type Type flag set indicating the routes that have been unselected
* @param info Route that has been unselected for the given route types
*/
public void onRouteUnselected(MediaRouter router, int type, RouteInfo info);
public abstract void onRouteUnselected(MediaRouter router, int type, RouteInfo info);
/**
* Called when a route for the specified type was added.
@ -990,7 +1071,7 @@ public class MediaRouter {
* @param router the MediaRouter reporting the event
* @param info Route that has become available for use
*/
public void onRouteAdded(MediaRouter router, RouteInfo info);
public abstract void onRouteAdded(MediaRouter router, RouteInfo info);
/**
* Called when a route for the specified type was removed.
@ -998,7 +1079,7 @@ public class MediaRouter {
* @param router the MediaRouter reporting the event
* @param info Route that has been removed from availability
*/
public void onRouteRemoved(MediaRouter router, RouteInfo info);
public abstract void onRouteRemoved(MediaRouter router, RouteInfo info);
/**
* Called when an aspect of the indicated route has changed.
@ -1009,7 +1090,7 @@ public class MediaRouter {
* @param router the MediaRouter reporting the event
* @param info The route that was changed
*/
public void onRouteChanged(MediaRouter router, RouteInfo info);
public abstract void onRouteChanged(MediaRouter router, RouteInfo info);
/**
* Called when a route is added to a group.
@ -1019,7 +1100,8 @@ public class MediaRouter {
* @param group The group the route was added to
* @param index The route index within group that info was added at
*/
public void onRouteGrouped(MediaRouter router, RouteInfo info, RouteGroup group, int index);
public abstract void onRouteGrouped(MediaRouter router, RouteInfo info, RouteGroup group,
int index);
/**
* Called when a route is removed from a group.
@ -1028,15 +1110,15 @@ public class MediaRouter {
* @param info The route that was removed
* @param group The group the route was removed from
*/
public void onRouteUngrouped(MediaRouter router, RouteInfo info, RouteGroup group);
public abstract void onRouteUngrouped(MediaRouter router, RouteInfo info, RouteGroup group);
}
/**
* Stub implementation of the {@link MediaRouter.Callback} interface.
* Each interface method is defined as a no-op. Override just the ones
* Stub implementation of {@link MediaRouter.Callback}.
* Each abstract method is defined as a no-op. Override just the ones
* you need.
*/
public static class SimpleCallback implements Callback {
public static class SimpleCallback extends Callback {
@Override
public void onRouteSelected(MediaRouter router, int type, RouteInfo info) {