diff --git a/libs/WindowManager/Shell/res/layout/tv_pip_menu.xml b/libs/WindowManager/Shell/res/layout/tv_pip_menu.xml index 5413213356a8c..90c923ae5c832 100644 --- a/libs/WindowManager/Shell/res/layout/tv_pip_menu.xml +++ b/libs/WindowManager/Shell/res/layout/tv_pip_menu.xml @@ -68,6 +68,15 @@ android:src="@drawable/pip_ic_fullscreen_white" android:text="@string/pip_fullscreen" /> + + + + - - - - diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java index 9e2d130669615..f3b3145c9103a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java @@ -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 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++;