diff options
| author | Hyundo Moon <hdmoon@google.com> | 2018-01-24 11:16:19 +0900 |
|---|---|---|
| committer | Hyundo Moon <hdmoon@google.com> | 2018-01-24 19:07:38 +0900 |
| commit | efeb45eabd6b9b2bcb8390e4140c615967c70dda (patch) | |
| tree | 4cae7eb0f6bb84f614f993a34d09fa6175236d66 /core/java/android/widget/MediaControlView2.java | |
| parent | 449e7d62a5db0cb1a925ee9d9265594b993ac419 (diff) | |
Put latest MediaControlView2/VideoView2 code
This CL brings latest MediaControlView2/VideoView2 code from
experimental, and it does the following:
- Fullscreen button support (ag/3490251)
- Set prev/next listener and controlling button visibility (ag/3498244)
Test: Ran VideoViewTest app
Change-Id: I1a64a9c98dcc625b504785728673edbee7b6935d
Diffstat (limited to 'core/java/android/widget/MediaControlView2.java')
| -rw-r--r-- | core/java/android/widget/MediaControlView2.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/core/java/android/widget/MediaControlView2.java b/core/java/android/widget/MediaControlView2.java index 42ba61b1b933..f0a27286ea5e 100644 --- a/core/java/android/widget/MediaControlView2.java +++ b/core/java/android/widget/MediaControlView2.java @@ -26,6 +26,7 @@ import android.media.update.ViewProvider; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; +import android.view.View; /** * A View that contains the controls for MediaPlayer2. @@ -47,6 +48,19 @@ import android.view.MotionEvent; * @hide */ public class MediaControlView2 extends FrameLayout { + // TODO: should overflow button be included? + public static final int BUTTON_PLAY_PAUSE = 1; + public static final int BUTTON_FFWD = 2; + public static final int BUTTON_REW = 3; + public static final int BUTTON_NEXT = 4; + public static final int BUTTON_PREV = 5; + public static final int BUTTON_SUBTITLE = 6; + public static final int BUTTON_FULL_SCREEN = 7; + public static final int BUTTON_OVERFLOW = 8; + public static final int BUTTON_MUTE = 9; + public static final int BUTTON_ASPECT_RATIO = 10; + public static final int BUTTON_SETTINGS = 11; + private final MediaControlView2Provider mProvider; public MediaControlView2(@NonNull Context context) { @@ -172,10 +186,33 @@ public class MediaControlView2 extends FrameLayout { mProvider.hideSubtitle_impl(); } + /** + * Set listeners for previous and next buttons to customize the behavior of clicking them. + * The UI for these buttons are provided as default and will be automatically displayed when + * this method is called. + * + * @param next Listener for clicking next button + * @param prev Listener for clicking previous button + */ + public void setPrevNextListeners(View.OnClickListener next, View.OnClickListener prev) { + mProvider.setPrevNextListeners_impl(next, prev); + } + + /** + * Hides the specified button from view. + * + * @param button the constant integer assigned to individual buttons + * @param visible whether the button should be visible or not + */ + public void setButtonVisibility(int button, boolean visible) { + mProvider.setButtonVisibility_impl(button, visible); + } + @Override protected void onAttachedToWindow() { mProvider.onAttachedToWindow_impl(); } + @Override protected void onDetachedFromWindow() { mProvider.onDetachedFromWindow_impl(); |
