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

Commit dbaba7a2 authored by Jorge Gil's avatar Jorge Gil
Browse files

Update Maximize Menu UI

1) Change "Snap Screen" test to "Resize"
2) Change menu's corner radius to 16dp
3) Fix RTL spacing in snap left/right options
4) Update immersive button fill
5) Update restore button fill
6) Use different border color for inactive options

Fix: 376075104
Fix: 356210491
Flag: EXEMPT bug fix
Test: atest WMShellUnitTests
Change-Id: I3b887cd6d8f4a33af748e423ef80c2faf64b7153
parent 662f37ea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@
                    style="?android:attr/buttonBarButtonStyle"
                    android:layout_width="41dp"
                    android:layout_height="@dimen/desktop_mode_maximize_menu_button_height"
                    android:layout_marginRight="4dp"
                    android:layout_marginEnd="4dp"
                    android:background="@drawable/desktop_mode_maximize_menu_button_background"
                    android:importantForAccessibility="yes"
                    android:contentDescription="@string/desktop_mode_maximize_menu_snap_left_button_text"
+3 −5
Original line number Diff line number Diff line
@@ -504,17 +504,15 @@
    <dimen name="desktop_mode_maximize_menu_buttons_fill_radius">4dp</dimen>
    <!-- The padding between the outline and fill of the maximize menu snap and maximize buttons. -->
    <dimen name="desktop_mode_maximize_menu_snap_and_maximize_buttons_fill_padding">4dp</dimen>
    <!-- The padding between the outline and fill of the maximize menu snap and maximize buttons. -->
    <dimen name="desktop_mode_maximize_menu_snap_and_maximize_buttons_fill_padding_bottom">8dp</dimen>
    <!-- The vertical padding between the outline and fill of the maximize menu restore button. -->
    <dimen name="desktop_mode_maximize_menu_restore_button_fill_vertical_padding">13dp</dimen>
    <!-- The horizontal padding between the outline and fill of the maximize menu restore button. -->
    <dimen name="desktop_mode_maximize_menu_restore_button_fill_horizontal_padding">21dp</dimen>
    <dimen name="desktop_mode_maximize_menu_restore_button_fill_horizontal_padding">15dp</dimen>
    <!-- The padding between the outline and fill of the maximize menu immersive button. -->
    <dimen name="desktop_mode_maximize_menu_immersive_button_fill_padding">4dp</dimen>
    <dimen name="desktop_mode_maximize_menu_immersive_button_fill_padding">0dp</dimen>

    <!-- The corner radius of the maximize menu. -->
    <dimen name="desktop_mode_maximize_menu_corner_radius">8dp</dimen>
    <dimen name="desktop_mode_maximize_menu_corner_radius">16dp</dimen>

    <!-- The radius of the Maximize menu shadow. -->
    <dimen name="desktop_mode_maximize_menu_shadow_radius">8dp</dimen>
+1 −1
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@
    <!-- Maximize menu maximize button string. -->
    <string name="desktop_mode_maximize_menu_maximize_text">Maximize Screen</string>
    <!-- Maximize menu snap buttons string. -->
    <string name="desktop_mode_maximize_menu_snap_text">Snap Screen</string>
    <string name="desktop_mode_maximize_menu_snap_text">Resize</string>
    <!-- Snap resizing non-resizable string. -->
    <string name="desktop_mode_non_resizable_snap_text">App can\'t be moved here</string>
    <!-- Accessibility text for the Maximize Menu's immersive button [CHAR LIMIT=NONE] -->
+11 −9
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalViewHo
import com.android.wm.shell.windowdecor.common.DecorThemeUtil
import com.android.wm.shell.windowdecor.common.OPACITY_12
import com.android.wm.shell.windowdecor.common.OPACITY_40
import com.android.wm.shell.windowdecor.common.OPACITY_60
import com.android.wm.shell.windowdecor.common.withAlpha
import java.util.function.Supplier

@@ -310,8 +311,6 @@ class MaximizeMenu(
            .desktop_mode_maximize_menu_immersive_button_fill_padding)
        private val maximizeFillPaddingDefault = context.resources.getDimensionPixelSize(R.dimen
            .desktop_mode_maximize_menu_snap_and_maximize_buttons_fill_padding)
        private val maximizeFillPaddingBottom = context.resources.getDimensionPixelSize(R.dimen
            .desktop_mode_maximize_menu_snap_and_maximize_buttons_fill_padding_bottom)
        private val maximizeRestoreFillPaddingVertical = context.resources.getDimensionPixelSize(
            R.dimen.desktop_mode_maximize_menu_restore_button_fill_vertical_padding)
        private val maximizeRestoreFillPaddingHorizontal = context.resources.getDimensionPixelSize(
@@ -320,7 +319,7 @@ class MaximizeMenu(
            maximizeFillPaddingDefault,
            maximizeFillPaddingDefault,
            maximizeFillPaddingDefault,
            maximizeFillPaddingBottom
            maximizeFillPaddingDefault
        )
        private val maximizeRestoreFillPaddingRect = Rect(
            maximizeRestoreFillPaddingHorizontal,
@@ -684,7 +683,7 @@ class MaximizeMenu(
                    inactiveSnapSideColor = colorScheme.outlineVariant.toArgb(),
                    semiActiveSnapSideColor = colorScheme.primary.toArgb().withAlpha(OPACITY_40),
                    activeSnapSideColor = colorScheme.primary.toArgb(),
                    inactiveStrokeColor = colorScheme.outlineVariant.toArgb(),
                    inactiveStrokeColor = colorScheme.outlineVariant.toArgb().withAlpha(OPACITY_60),
                    activeStrokeColor = colorScheme.primary.toArgb(),
                    inactiveBackgroundColor = menuBackgroundColor,
                    activeBackgroundColor = colorScheme.primary.toArgb().withAlpha(OPACITY_12)
@@ -753,7 +752,8 @@ class MaximizeMenu(
            val activeStrokeAndFill = colorScheme.primary.toArgb()
            val activeBackground = colorScheme.primary.toArgb().withAlpha(OPACITY_12)
            val activeDrawable = createMaximizeOrImmersiveButtonDrawable(
                strokeAndFillColor = activeStrokeAndFill,
                strokeColor = activeStrokeAndFill,
                fillColor = activeStrokeAndFill,
                backgroundColor = activeBackground,
                // Add a mask with the menu background's color because the active background color is
                // semi transparent, otherwise the transparency will reveal the stroke/fill color
@@ -770,7 +770,8 @@ class MaximizeMenu(
                addState(
                    StateSet.WILD_CARD,
                    createMaximizeOrImmersiveButtonDrawable(
                        strokeAndFillColor = colorScheme.outlineVariant.toArgb(),
                        strokeColor = colorScheme.outlineVariant.toArgb().withAlpha(OPACITY_60),
                        fillColor = colorScheme.outlineVariant.toArgb(),
                        backgroundColor = colorScheme.surfaceContainerLow.toArgb(),
                        backgroundMask = null, // not needed because the bg color is fully opaque
                        fillPadding = fillPadding,
@@ -780,7 +781,8 @@ class MaximizeMenu(
        }

        private fun createMaximizeOrImmersiveButtonDrawable(
            @ColorInt strokeAndFillColor: Int,
            @ColorInt strokeColor: Int,
            @ColorInt fillColor: Int,
            @ColorInt backgroundColor: Int,
            @ColorInt backgroundMask: Int?,
            fillPadding: Rect,
@@ -794,7 +796,7 @@ class MaximizeMenu(
                    null /* inset */,
                    null /* innerRadii */
                )
                paint.color = strokeAndFillColor
                paint.color = strokeColor
                paint.style = Paint.Style.FILL
            })
            // Second layer, a mask for the next (background) layer if needed because of
@@ -829,7 +831,7 @@ class MaximizeMenu(
                    null /* inset */,
                    null /* innerRadii */
                )
                paint.color = strokeAndFillColor
                paint.color = fillColor
                paint.style = Paint.Style.FILL
            })

+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ const val OPACITY_12 = 31
const val OPACITY_15 = 38
const val OPACITY_40 = 102
const val OPACITY_55 = 140
const val OPACITY_60 = 153
const val OPACITY_65 = 166

/**