diff options
| author | Adam Powell <adamp@google.com> | 2012-06-12 12:46:02 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-12 12:46:02 -0700 |
| commit | 0d637d6f888cdddba554174284fb96f8354a15e4 (patch) | |
| tree | 5071b93217aa4713ba02be7ad3da32341a665f7f /core/java | |
| parent | 11d536b38116e72a40829bd976f9f78f50d53d1a (diff) | |
| parent | 579ec3086c9ce3616735bc3cf63246f052973a7f (diff) | |
| download | frameworks_base-0d637d6f888cdddba554174284fb96f8354a15e4.zip frameworks_base-0d637d6f888cdddba554174284fb96f8354a15e4.tar.gz frameworks_base-0d637d6f888cdddba554174284fb96f8354a15e4.tar.bz2 | |
am 579ec308: Merge "MediaRouter work" into jb-dev
* commit '579ec3086c9ce3616735bc3cf63246f052973a7f':
MediaRouter work
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/MediaRouteActionProvider.java | 11 | ||||
| -rw-r--r-- | core/java/android/app/MediaRouteButton.java | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/core/java/android/app/MediaRouteActionProvider.java b/core/java/android/app/MediaRouteActionProvider.java index 7764ac6..5fe08ec 100644 --- a/core/java/android/app/MediaRouteActionProvider.java +++ b/core/java/android/app/MediaRouteActionProvider.java @@ -33,11 +33,12 @@ public class MediaRouteActionProvider extends ActionProvider { private MediaRouteButton mView; private int mRouteTypes; private final RouterCallback mRouterCallback = new RouterCallback(); + private View.OnClickListener mExtendedSettingsListener; public MediaRouteActionProvider(Context context) { super(context); mContext = context; - mRouter = (MediaRouter)context.getSystemService(Context.MEDIA_ROUTER_SERVICE); + mRouter = (MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE); // Start with live audio by default. // TODO Update this when new route types are added; segment by API level @@ -76,6 +77,7 @@ public class MediaRouteActionProvider extends ActionProvider { mView = new MediaRouteButton(mContext); mMenuItem.setVisible(mRouter.getRouteCount() > 1); mView.setRouteTypes(mRouteTypes); + mView.setExtendedSettingsClickListener(mExtendedSettingsListener); return mView; } @@ -85,6 +87,13 @@ public class MediaRouteActionProvider extends ActionProvider { return true; } + public void setExtendedSettingsClickListener(View.OnClickListener listener) { + mExtendedSettingsListener = listener; + if (mView != null) { + mView.setExtendedSettingsClickListener(listener); + } + } + private class RouterCallback extends MediaRouter.SimpleCallback { @Override public void onRouteAdded(MediaRouter router, RouteInfo info) { diff --git a/core/java/android/app/MediaRouteButton.java b/core/java/android/app/MediaRouteButton.java index 8f9379a..385241c 100644 --- a/core/java/android/app/MediaRouteButton.java +++ b/core/java/android/app/MediaRouteButton.java @@ -43,6 +43,8 @@ public class MediaRouteButton extends View { private int mMinWidth; private int mMinHeight; + private OnClickListener mExtendedSettingsClickListener; + private static final int[] ACTIVATED_STATE_SET = { R.attr.state_activated }; @@ -260,6 +262,11 @@ public class MediaRouteButton extends View { mRemoteIndicator.draw(canvas); } + public void setExtendedSettingsClickListener(OnClickListener listener) { + // TODO: if dialog is already open, propagate so that it updates live. + mExtendedSettingsClickListener = listener; + } + private class MediaRouteCallback extends MediaRouter.SimpleCallback { @Override public void onRouteSelected(MediaRouter router, int type, RouteInfo info) { |
