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

Commit edd22f72 authored by Kazuki Takise's avatar Kazuki Takise
Browse files

Show error icon on "Optimize View" handle menu

The new restart handle menu requires an error icon [1] to get
attention from the user.

This change wraps the restart handle menu with LinearLayout so
we can add the error icon on the right of the pill.

[1] go/handle-menu-error-icon-mock

Flag: com.android.window.flags.enable_restart_menu_for_connected_displays
Bug: 406073194
Test: manual
Change-Id: I9fe3eb1c5d8468cae7afb6458e39d42bf4c9e9ce
parent d72cc8d2
Loading
Loading
Loading
Loading
+27 −6
Original line number Diff line number Diff line
@@ -164,12 +164,33 @@
            android:src="@drawable/desktop_mode_ic_handle_menu_change_aspect_ratio"
            style="@style/DesktopModeHandleMenuActionButton"/>

        <LinearLayout
            android:id="@+id/handle_menu_restart_pill"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.android.wm.shell.windowdecor.HandleMenuActionButton
                android:id="@+id/handle_menu_restart_button"
                android:contentDescription="@string/handle_menu_restart_text"
                android:text="@string/handle_menu_restart_text"
                android:src="@drawable/desktop_mode_ic_handle_menu_restart"
            style="@style/DesktopModeHandleMenuActionButton"/>
                style="@style/DesktopModeHandleMenuActionButton"
                android:layout_width="0dp"
                android:layout_weight="1"/>

            <ImageView
                android:id="@+id/restart_menu_error_icon"
                android:contentDescription="@string/handle_menu_error_icon_text"
                android:layout_gravity="end|center_vertical"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_marginEnd="16dp"
                android:src="@drawable/expand_menu_error"
                android:clickable="false"
                android:focusable="false"
                android:scaleType="centerCrop"/>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
+2 −0
Original line number Diff line number Diff line
@@ -316,6 +316,8 @@
    <string name="change_aspect_ratio_text">Change aspect ratio</string>
    <!-- Accessibility text for the handle menu restart button [CHAR LIMIT=NONE] -->
    <string name="handle_menu_restart_text">Optimize View</string>
    <!-- Accessibility text for the handle menu error icon [CHAR LIMIT=NONE] -->
    <string name="handle_menu_error_icon_text">Error Icon</string>
    <!-- Accessibility text for the handle menu close button [CHAR LIMIT=NONE] -->
    <string name="close_text">Close</string>
    <!-- Accessibility text for the handle menu close menu button [CHAR LIMIT=NONE] -->
+9 −1
Original line number Diff line number Diff line
@@ -573,7 +573,10 @@ class HandleMenu(
            .requireViewById<HandleMenuActionButton>(R.id.manage_windows_button)
        private val changeAspectRatioBtn = moreActionsPill
            .requireViewById<HandleMenuActionButton>(R.id.change_aspect_ratio_button)
        private val restartBtn = moreActionsPill

        // Restart Pill.
        private val restartPill = rootView.requireViewById<View>(R.id.handle_menu_restart_pill)
        private val restartBtn = restartPill
            .requireViewById<HandleMenuActionButton>(R.id.handle_menu_restart_button)

        // Open in Browser/App Pill.
@@ -900,6 +903,11 @@ class HandleMenu(
                        drawableInsets = DrawableInsets())
                }
            }
            // The restart button is nested to show an error icon on the right. Update the
            // visibility of the parent view properly.
            restartPill.apply {
                isGone = !shouldShowRestartButton
            }
        }

        private fun bindOpenInAppOrBrowserPill(style: MenuStyle) {