diff options
2 files changed, 14 insertions, 55 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt index ce786177290f..c544468f5191 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt @@ -39,7 +39,6 @@ import android.widget.ImageButton import android.widget.ImageView import android.widget.LinearLayout import android.widget.Space -import android.widget.TextView import android.window.DesktopModeFlags import android.window.SurfaceSyncGroup import androidx.annotation.StringRes @@ -59,10 +58,10 @@ import com.android.wm.shell.splitscreen.SplitScreenController import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainer import com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalViewContainer import com.android.wm.shell.windowdecor.common.DecorThemeUtil +import com.android.wm.shell.windowdecor.common.DrawableInsets import com.android.wm.shell.windowdecor.common.WindowDecorTaskResourceLoader import com.android.wm.shell.windowdecor.common.calculateMenuPosition -import com.android.wm.shell.windowdecor.common.DrawableInsets -import com.android.wm.shell.windowdecor.common.createRippleDrawable +import com.android.wm.shell.windowdecor.common.createBackgroundDrawable import com.android.wm.shell.windowdecor.extension.isFullscreen import com.android.wm.shell.windowdecor.extension.isMultiWindow import com.android.wm.shell.windowdecor.extension.isPinned @@ -478,13 +477,13 @@ class HandleMenu( 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) + 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) @@ -702,7 +701,7 @@ class HandleMenu( imageTintList = ColorStateList.valueOf(style.textColor) this.taskInfo = this@HandleMenuView.taskInfo - background = createRippleDrawable( + background = createBackgroundDrawable( color = style.textColor, cornerRadius = iconButtonRippleRadius, drawableInsets = iconButtonDrawableInsetsBase @@ -740,7 +739,7 @@ class HandleMenu( else iconButtonDrawableInsetsRight fullscreenBtn.apply { - background = createRippleDrawable( + background = createBackgroundDrawable( color = style.textColor, cornerRadius = iconButtonRippleRadius, drawableInsets = startInsets @@ -748,7 +747,7 @@ class HandleMenu( } splitscreenBtn.apply { - background = createRippleDrawable( + background = createBackgroundDrawable( color = style.textColor, cornerRadius = iconButtonRippleRadius, drawableInsets = iconButtonDrawableInsetsBase @@ -756,7 +755,7 @@ class HandleMenu( } floatingBtn.apply { - background = createRippleDrawable( + background = createBackgroundDrawable( color = style.textColor, cornerRadius = iconButtonRippleRadius, drawableInsets = iconButtonDrawableInsetsBase @@ -764,7 +763,7 @@ class HandleMenu( } desktopBtn.apply { - background = createRippleDrawable( + background = createBackgroundDrawable( color = style.textColor, cornerRadius = iconButtonRippleRadius, drawableInsets = endInsets diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt index f44b15a23b90..f08cfa987cc7 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt @@ -20,7 +20,6 @@ import android.content.res.ColorStateList import android.graphics.Color import android.graphics.drawable.Drawable import android.graphics.drawable.LayerDrawable -import android.graphics.drawable.RippleDrawable import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.RoundRectShape @@ -48,45 +47,6 @@ fun replaceColorAlpha(@ColorInt color: Int, alpha: Int): Int { } /** - * Creates a RippleDrawable with specified color, corner radius, and insets. - */ -fun createRippleDrawable( - @ColorInt color: Int, - cornerRadius: Int, - drawableInsets: DrawableInsets, -): RippleDrawable { - return RippleDrawable( - ColorStateList( - arrayOf( - intArrayOf(android.R.attr.state_hovered), - intArrayOf(android.R.attr.state_pressed), - intArrayOf(), - ), - intArrayOf( - replaceColorAlpha(color, OPACITY_11), - replaceColorAlpha(color, OPACITY_15), - Color.TRANSPARENT, - ) - ), - null /* content */, - LayerDrawable(arrayOf( - ShapeDrawable().apply { - shape = RoundRectShape( - FloatArray(8) { cornerRadius.toFloat() }, - null /* inset */, - null /* innerRadii */ - ) - paint.color = Color.WHITE - } - )).apply { - require(numberOfLayers == 1) { "Must only contain one layer" } - setLayerInset(0 /* index */, - drawableInsets.l, drawableInsets.t, drawableInsets.r, drawableInsets.b) - } - ) -} - -/** * Creates a background drawable with specified color, corner radius, and insets. */ fun createBackgroundDrawable( |