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

Commit cdaf6e7b authored by Fabio Muratori's avatar Fabio Muratori Committed by Android (Google) Code Review
Browse files

Merge "Fix size of touch target for collapse menu button in application menu" into main

parents 6bd1cdb6 f7311df2
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -53,15 +53,12 @@

        <com.android.wm.shell.windowdecor.HandleMenuImageButton
            android:id="@+id/collapse_menu_button"
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginStart="14dp"
            android:padding="16dp"
            android:contentDescription="@string/collapse_menu_text"
            android:src="@drawable/ic_baseline_expand_more_24"
            android:src="@drawable/ic_baseline_expand_more_16"
            android:rotation="180"
            android:tint="@androidprv:color/materialColorOnSurface"
            android:background="?android:selectableItemBackgroundBorderless"/>
            style="@style/DesktopModeHandleMenuWindowingButton"/>
    </LinearLayout>

    <LinearLayout
+3 −3
Original line number Diff line number Diff line
@@ -619,13 +619,13 @@
    <dimen name="desktop_mode_header_app_chip_ripple_inset_vertical">4dp</dimen>

     <!-- The corner radius of the windowing actions pill buttons's ripple drawable -->
     <dimen name="desktop_mode_handle_menu_windowing_action_ripple_radius">24dp</dimen>
     <dimen name="desktop_mode_handle_menu_icon_button_ripple_radius">24dp</dimen>
     <!-- The horizontal/vertical inset to apply to the ripple drawable effect of windowing
     actions pill central buttons -->
     <dimen name="desktop_mode_handle_menu_windowing_action_ripple_inset_base">2dp</dimen>
     <dimen name="desktop_mode_handle_menu_icon_button_ripple_inset_base">2dp</dimen>
     <!-- The horizontal/vertical vertical inset to apply to the ripple drawable effect of windowing
     actions pill edge buttons -->
     <dimen name="desktop_mode_handle_menu_windowing_action_ripple_inset_shift">4dp</dimen>
     <dimen name="desktop_mode_handle_menu_icon_button_ripple_inset_shift">4dp</dimen>

    <!-- The corner radius of the minimize button's ripple drawable -->
    <dimen name="desktop_mode_header_minimize_ripple_radius">18dp</dimen>
+30 −42
Original line number Diff line number Diff line
@@ -471,32 +471,20 @@ class HandleMenu(
        val rootView = LayoutInflater.from(context)
            .inflate(R.layout.desktop_mode_window_decor_handle_menu, null /* root */) as View

        private val windowingButtonRippleRadius = context.resources
            .getDimensionPixelSize(R.dimen.desktop_mode_handle_menu_windowing_action_ripple_radius)
        private val windowingButtonDrawableInsets = DrawableInsets(
            vertical = context.resources
                .getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_windowing_action_ripple_inset_base),
            horizontal = context.resources
                .getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_windowing_action_ripple_inset_base)
        )
        private val windowingButtonDrawableInsetsLeft = DrawableInsets(
            vertical = context.resources
                .getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_windowing_action_ripple_inset_base),
            horizontalLeft = context.resources
                .getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_windowing_action_ripple_inset_shift),
        )
        private val windowingButtonDrawableInsetsRight = DrawableInsets(
            vertical = context.resources
                .getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_windowing_action_ripple_inset_base),
            horizontalRight = context.resources
                .getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_windowing_action_ripple_inset_shift)
        )
        // Insets for ripple effect of App Info Pill. and Windowing Pill. buttons
        val iconButtondrawableShiftInset = context.resources.getDimensionPixelSize(
            R.dimen.desktop_mode_handle_menu_icon_button_ripple_inset_shift)
        val iconButtondrawableBaseInset = context.resources.getDimensionPixelSize(
            R.dimen.desktop_mode_handle_menu_icon_button_ripple_inset_base)
        private val iconButtonRippleRadius = context.resources.getDimensionPixelSize(
            R.dimen.desktop_mode_handle_menu_icon_button_ripple_radius)
        private val iconButtonDrawableInsetsBase = DrawableInsets(t=iconButtondrawableBaseInset,
            b=iconButtondrawableBaseInset, l=iconButtondrawableBaseInset,
            r=iconButtondrawableBaseInset)
        private val iconButtonDrawableInsetsLeft = DrawableInsets(t=iconButtondrawableBaseInset,
            b=iconButtondrawableBaseInset, l=iconButtondrawableShiftInset, r=0)
        private val iconButtonDrawableInsetsRight = DrawableInsets(t=iconButtondrawableBaseInset,
            b=iconButtondrawableBaseInset, l=0, r=iconButtondrawableShiftInset)

        // App Info Pill.
        private val appInfoPill = rootView.requireViewById<View>(R.id.app_info_pill)
@@ -713,6 +701,12 @@ class HandleMenu(
            collapseMenuButton.apply {
                imageTintList = ColorStateList.valueOf(style.textColor)
                this.taskInfo = this@HandleMenuView.taskInfo

                background = createRippleDrawable(
                    color = style.textColor,
                    cornerRadius = iconButtonRippleRadius,
                    drawableInsets = iconButtonDrawableInsetsBase
                )
            }
            appNameView.setTextColor(style.textColor)
            appNameView.startMarquee()
@@ -740,21 +734,15 @@ class HandleMenu(
            desktopBtn.isEnabled = !taskInfo.isFreeform
            desktopBtn.imageTintList = style.windowingButtonColor

            val startInsets = if (context.isRtl) {
                windowingButtonDrawableInsetsRight
            } else {
                windowingButtonDrawableInsetsLeft
            }
            val endInsets = if (context.isRtl) {
                windowingButtonDrawableInsetsLeft
            } else {
                windowingButtonDrawableInsetsRight
            }
            val startInsets = if (context.isRtl) iconButtonDrawableInsetsRight
                else iconButtonDrawableInsetsLeft
            val endInsets = if (context.isRtl) iconButtonDrawableInsetsLeft
                else iconButtonDrawableInsetsRight

            fullscreenBtn.apply {
                background = createRippleDrawable(
                    color = style.textColor,
                    cornerRadius = windowingButtonRippleRadius,
                    cornerRadius = iconButtonRippleRadius,
                    drawableInsets = startInsets
                )
            }
@@ -762,23 +750,23 @@ class HandleMenu(
            splitscreenBtn.apply {
                background = createRippleDrawable(
                    color = style.textColor,
                    cornerRadius = windowingButtonRippleRadius,
                    drawableInsets = windowingButtonDrawableInsets
                    cornerRadius = iconButtonRippleRadius,
                    drawableInsets = iconButtonDrawableInsetsBase
                )
            }

            floatingBtn.apply {
                background = createRippleDrawable(
                    color = style.textColor,
                    cornerRadius = windowingButtonRippleRadius,
                    drawableInsets = windowingButtonDrawableInsets
                    cornerRadius = iconButtonRippleRadius,
                    drawableInsets = iconButtonDrawableInsetsBase
                )
            }

            desktopBtn.apply {
                background = createRippleDrawable(
                    color = style.textColor,
                    cornerRadius = windowingButtonRippleRadius,
                    cornerRadius = iconButtonRippleRadius,
                    drawableInsets = endInsets
                )
            }