diff options
Diffstat (limited to 'core/java/android/widget/MediaControlView2.java')
| -rw-r--r-- | core/java/android/widget/MediaControlView2.java | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/core/java/android/widget/MediaControlView2.java b/core/java/android/widget/MediaControlView2.java index a4da05f8b982..39c23b413cc9 100644 --- a/core/java/android/widget/MediaControlView2.java +++ b/core/java/android/widget/MediaControlView2.java @@ -45,6 +45,19 @@ import java.lang.annotation.RetentionPolicy; * developer needs to manually retrieve a MediaController instance and set it to MediaControlView2 * by calling setController(MediaController controller). * + * <p> + * There is no separate method that handles the show/hide behavior for MediaControlView2. Instead, + * one can directly change the visibility of this view by calling View.setVisibility(int). The + * values supported are View.VISIBLE and View.GONE. + * In addition, the following customizations are supported: + * 1. Modify default timeout value of 2 seconds by calling setTimeout(long). + * 2. Set focus to the play/pause button by calling requestPlayButtonFocus(). + * + * <p> + * It is also possible to add custom buttons with custom icons and actions inside MediaControlView2. + * Those buttons will be shown when the overflow button is clicked. + * See {@link VideoView2#setCustomActions} for more details on how to add. + * * TODO PUBLIC API * @hide */ @@ -165,22 +178,6 @@ public class MediaControlView2 extends FrameLayout { } /** - * Shows the control view on screen. It will disappear automatically after 3 seconds of - * inactivity. - */ - public void show() { - mProvider.show_impl(); - } - - /** - * Shows the control view on screen. It will disappear automatically after {@code timeout} - * milliseconds of inactivity. - */ - public void show(long timeout) { - mProvider.show_impl(timeout); - } - - /** * Returns whether the control view is currently shown or hidden. */ public boolean isShowing() { @@ -188,13 +185,6 @@ public class MediaControlView2 extends FrameLayout { } /** - * Hide the control view from the screen. - */ - public void hide() { - mProvider.hide_impl(); - } - - /** * Changes the visibility state of an individual button. Default value is View.Visible. * * @param button the {@code Button} assigned to individual buttons @@ -217,6 +207,36 @@ public class MediaControlView2 extends FrameLayout { mProvider.setButtonVisibility_impl(button, visibility); } + /** + * Requests focus for the play/pause button. + */ + public void requestPlayButtonFocus() { + mProvider.requestPlayButtonFocus_impl(); + } + + /** + * Sets a new timeout value (in milliseconds) for showing MediaControlView2. The default value + * is set as 2 seconds. + * @param timeout the + */ + public void setTimeout(long timeout) { + mProvider.setTimeout_impl(timeout); + } + + /** + * Retrieves current timeout value (in milliseconds) for showing MediaControlView2. The default + * value is set as 2 seconds. + */ + public long getTimeout() { + return mProvider.getTimeout_impl(); + } + + @Override + public void onVisibilityAggregated(boolean isVisible) { + + mProvider.onVisibilityAggregated_impl(isVisible); + } + @Override protected void onAttachedToWindow() { mProvider.onAttachedToWindow_impl(); |
