diff options
| author | Jin Seok Park <jinpark@google.com> | 2018-01-24 16:46:44 +0900 |
|---|---|---|
| committer | Insun Kang <insun@google.com> | 2018-02-28 05:06:10 +0000 |
| commit | a64d4b98b54d6e03db993efa1e0d8bd0ba855f90 (patch) | |
| tree | 7273864143b70f60f2840470ac7d4d5d453df2d7 /core/java/android/widget/MediaControlView2.java | |
| parent | 6d925591c48498b93514b8301c8ed3392c30f389 (diff) | |
Unhide MediaControlView2 APIs
Test: make update-api
Bug: 64293205
Change-Id: Ia202a7fc1f8733cc2d95d13e7126916affe4f52e
Diffstat (limited to 'core/java/android/widget/MediaControlView2.java')
| -rw-r--r-- | core/java/android/widget/MediaControlView2.java | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/core/java/android/widget/MediaControlView2.java b/core/java/android/widget/MediaControlView2.java index 273b9edb4629..4fb303e14990 100644 --- a/core/java/android/widget/MediaControlView2.java +++ b/core/java/android/widget/MediaControlView2.java @@ -20,15 +20,18 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; +import android.media.SessionToken2; import android.media.session.MediaController; import android.media.update.ApiLoader; import android.media.update.MediaControlView2Provider; import android.media.update.ViewGroupHelper; import android.util.AttributeSet; +import android.view.View; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +// TODO: Use link annotation to refer VideoView2 once VideoView2 became unhidden. /** * A View that contains the controls for MediaPlayer2. * It provides a wide range of UI including buttons such as "Play/Pause", "Rewind", "Fast Forward", @@ -55,10 +58,7 @@ import java.lang.annotation.RetentionPolicy; * <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 + * See VideoView2#setCustomActions for more details on how to add. */ public class MediaControlView2 extends ViewGroupHelper<MediaControlView2Provider> { /** @hide */ @@ -137,16 +137,18 @@ public class MediaControlView2 extends ViewGroupHelper<MediaControlView2Provider /** * String for receiving command to show subtitle from MediaSession. Can be checked by * implementing {@link android.media.session.MediaSession.Callback#onCommand} + * @hide */ public static final String COMMAND_SHOW_SUBTITLE = "showSubtitle"; /** * String for receiving command to hide subtitle from MediaSession. Can be checked by * implementing {@link android.media.session.MediaSession.Callback#onCommand} + * @hide */ public static final String COMMAND_HIDE_SUBTITLE = "hideSubtitle"; + /** - * String for receiving command to set fullscreen from MediaSession. Can be checked by - * implementing {@link android.media.session.MediaSession.Callback#onCommand} + * @hide TODO: remove once the implementation is revised */ public static final String COMMAND_SET_FULLSCREEN = "setFullscreen"; @@ -174,10 +176,24 @@ public class MediaControlView2 extends ViewGroupHelper<MediaControlView2Provider } /** - * Sets MediaController instance to control corresponding MediaSession. + * Sets MediaSession2 token to control corresponding MediaSession2. + */ + public void setMediaSessionToken(SessionToken2 token) { + mProvider.setMediaSessionToken_impl(token); + } + + /** + * Registers a callback to be invoked when the fullscreen mode should be changed. + * @param l The callback that will be run + */ + public void setOnFullScreenListener(OnFullScreenListener l) { + mProvider.setOnFullScreenListener_impl(l); + } + + /** + * @hide TODO: remove once the implementation is revised */ public void setController(MediaController controller) { - mProvider.setController_impl(controller); } /** @@ -215,4 +231,15 @@ public class MediaControlView2 extends ViewGroupHelper<MediaControlView2Provider protected void onLayout(boolean changed, int l, int t, int r, int b) { mProvider.onLayout_impl(changed, l, t, r, b); } + + /** + * Interface definition of a callback to be invoked to inform the fullscreen mode is changed. + * Application should handle the fullscreen mode accordingly. + */ + public interface OnFullScreenListener { + /** + * Called to indicate a fullscreen mode change. + */ + void onFullScreen(View view, boolean fullScreen); + } } |
