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

Commit 2a3d0456 authored by Jacqueline Bronger's avatar Jacqueline Bronger
Browse files

Reorder PiP menu buttons.

Order: fullscreen, close, app actions, system actions

Bug: 228050454
Test: manual
Change-Id: I14f6bf1ad9a900daa8b4b33b2be29896c5691149
parent 2f757eec
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -68,6 +68,15 @@
                android:src="@drawable/pip_ic_fullscreen_white"
                android:text="@string/pip_fullscreen" />

            <com.android.wm.shell.pip.tv.TvPipMenuActionButton
                android:id="@+id/tv_pip_menu_close_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/pip_ic_close_white"
                android:text="@string/pip_close" />

            <!-- More TvPipMenuActionButtons may be added here at runtime. -->

            <com.android.wm.shell.pip.tv.TvPipMenuActionButton
                android:id="@+id/tv_pip_menu_move_button"
                android:layout_width="wrap_content"
@@ -83,15 +92,6 @@
                android:visibility="gone"
                android:text="@string/pip_collapse" />

            <com.android.wm.shell.pip.tv.TvPipMenuActionButton
                android:id="@+id/tv_pip_menu_close_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/pip_ic_close_white"
                android:text="@string/pip_close" />

            <!-- More TvPipMenuActionButtons may be added here at runtime. -->

            <Space
                android:layout_width="@dimen/pip_menu_button_wrapper_margin"
                android:layout_height="@dimen/pip_menu_button_wrapper_margin"/>
+11 −2
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
    private static final String TAG = "TvPipMenuView";
    private static final boolean DEBUG = TvPipController.DEBUG;

    private static final int FIRST_CUSTOM_ACTION_POSITION = 3;

    @Nullable
    private Listener mListener;

@@ -485,6 +487,13 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
                });
    }

    /**
     * Button order:
     * - Fullscreen
     * - Close
     * - Custom actions (app or media actions)
     * - System actions
     */
    void setAdditionalActions(List<RemoteAction> actions, RemoteAction closeAction,
            Handler mainHandler) {
        if (DEBUG) {
@@ -507,13 +516,13 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
        final int actionsNumber = actions.size();
        int buttonsNumber = mAdditionalButtons.size();
        if (actionsNumber > buttonsNumber) {
            // Add buttons until we have enough to display all of the actions.
            // Add buttons until we have enough to display all the actions.
            while (actionsNumber > buttonsNumber) {
                TvPipMenuActionButton button = new TvPipMenuActionButton(mContext);
                button.setOnClickListener(this);

                mActionButtonsContainer.addView(button,
                        mActionButtonsContainer.getChildCount() - 1);
                        FIRST_CUSTOM_ACTION_POSITION + buttonsNumber);
                mAdditionalButtons.add(button);

                buttonsNumber++;