diff options
| author | Jin Seok Park <jinpark@google.com> | 2018-01-29 19:23:06 +0900 |
|---|---|---|
| committer | Jin Seok Park <jinpark@google.com> | 2018-01-30 10:48:10 +0900 |
| commit | dde80a9cf4111cc4dee1ff3638e383fa59b952d2 (patch) | |
| tree | 4e3c10bc12b95d5f1e8fcbe6c7a9eb2c18823519 /core/java/android/widget/MediaControlView2.java | |
| parent | 752d7ca14c668df04a25e1565d5058ba7dc9ffe8 (diff) | |
Remove show/hide API
This CL removes the show/hide API from MediaControlView2 and instead
provides the developer with the same function by calling
setVisibility(View.VISIBLE | View.GONE), and calling the new APIs
set/getTimeout() and requestPlayButtonFocus(). The original Runnable
code has been moved to onVisibilityAggregated() as per API council's
request.
Test: build
Change-Id: If53fb8849b4e086619a9c93c85e61da70272976e
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(); |
