VideoView: Change showSubtitle() to get boolean parameter
- Adds VideoView2 attributes
- enableControlView
- showSubtitle (boolean)
- viewType (enum)
- surfaceView
- textureView
- showSubtitle() --> showSubtitle(boolean)
- hideSubtitle() removed.
Test: build
Change-Id: Ib21722af1c9c1caf036e047a18d27d46097e8f03
diff --git a/core/java/android/widget/VideoView2.java b/core/java/android/widget/VideoView2.java
index ac83313..8404223 100644
--- a/core/java/android/widget/VideoView2.java
+++ b/core/java/android/widget/VideoView2.java
@@ -112,14 +112,14 @@
public @interface ViewType {}
/**
- * Indicates video is rendering on SurfaceView
+ * Indicates video is rendering on SurfaceView.
*
* @see #setViewType
*/
public static final int VIEW_TYPE_SURFACEVIEW = 1;
/**
- * Indicates video is rendering on TextureView
+ * Indicates video is rendering on TextureView.
*
* @see #setViewType
*/
@@ -188,18 +188,12 @@
}
/**
- * Starts rendering closed caption or subtitles if there is any. The first subtitle track will
- * be chosen by default if there multiple subtitle tracks exist.
+ * Shows or hides closed caption or subtitles if there is any.
+ * The first subtitle track will be chosen by default if there multiple subtitle tracks exist.
+ * @param show shows closed caption or subtitles if this value is true, or hides.
*/
- public void showSubtitle() {
- mProvider.showSubtitle_impl();
- }
-
- /**
- * Stops showing closed captions or subtitles.
- */
- public void hideSubtitle() {
- mProvider.hideSubtitle_impl();
+ public void showSubtitle(boolean show) {
+ mProvider.showSubtitle_impl(show);
}
/**
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 5184dda..0543305 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -8773,6 +8773,16 @@
<attr name="fontProviderCerts" format="reference" />
</declare-styleable>
+ <!-- Attributes that are read when parsing a tag. -->
+ <declare-styleable name="VideoView2">
+ <attr name="enableControlView" format="boolean" />
+ <attr name="showSubtitle" format="boolean" />
+ <attr name="viewType" format="enum">
+ <enum name="surfaceView" value="0" />
+ <enum name="textureView" value="1" />
+ </attr>
+ </declare-styleable>
+
<!-- @hide -->
<declare-styleable name="RecyclerView">
<attr name="layoutManager" format="string" />
diff --git a/media/java/android/media/update/VideoView2Provider.java b/media/java/android/media/update/VideoView2Provider.java
index c5b58f7..10f03d2 100644
--- a/media/java/android/media/update/VideoView2Provider.java
+++ b/media/java/android/media/update/VideoView2Provider.java
@@ -47,8 +47,7 @@
void setMediaControlView2_impl(MediaControlView2 mediaControlView);
MediaController getMediaController_impl();
MediaControlView2 getMediaControlView2_impl();
- void showSubtitle_impl();
- void hideSubtitle_impl();
+ void showSubtitle_impl(boolean show);
// TODO: remove setSpeed_impl once MediaController2 is ready.
void setSpeed_impl(float speed);
void setAudioFocusRequest_impl(int focusGain);