Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fa80643 authored by Insun Kang's avatar Insun Kang
Browse files

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
parent 2a9cd149
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -112,14 +112,14 @@ public class VideoView2 extends FrameLayout {
    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 @@ public class VideoView2 extends FrameLayout {
    }

    /**
     * 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);
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -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" />
+1 −2
Original line number Diff line number Diff line
@@ -47,8 +47,7 @@ public interface VideoView2Provider extends ViewProvider {
    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);