From 27e05992f6bca56232a334c6d148ba464b834253 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Mon, 21 Oct 2024 15:04:03 -0400 Subject: [PATCH] Update recent indicators to match spec. Does not implement any animations. Flag: com.android.window.flags.enable_desktop_windowing_taskbar_running_apps Fix: 356394053 Test: go/testedequals Change-Id: If8e319b605beedd0e9b14dc37da1b5ffa12f3c9f --- quickstep/res/values/colors.xml | 1 - quickstep/res/values/dimens.xml | 10 ++- res/values/colors.xml | 1 + res/values/dimens.xml | 2 - src/com/android/launcher3/BubbleTextView.java | 62 +++++++++++-------- 5 files changed, 41 insertions(+), 35 deletions(-) diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml index 4c48bd3f99..62873d6d64 100644 --- a/quickstep/res/values/colors.xml +++ b/quickstep/res/values/colors.xml @@ -31,7 +31,6 @@ #99000000 #EBffffff #99000000 - #646464 #ffffff diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 9836172cb3..5f3500780f 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -356,12 +356,10 @@ 48dp 1dp 72dp - 4dp - 14dp - 2dp - 2dp - 12dp - 2dp + 2dp + 12dp + 4dp + 6dp 12dp diff --git a/res/values/colors.xml b/res/values/colors.xml index 3f8bede23d..1eca88d009 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -90,6 +90,7 @@ #0842A0 #000000 + #000000 #00668B #B5CAD7 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index d1e905da48..731e24e5a2 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -426,9 +426,7 @@ 0dp 0dp 0dp - 0dp 0dp - 0dp 0dp diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 5acff064d3..3c234108fb 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -52,7 +52,6 @@ import android.text.style.ImageSpan; import android.util.AttributeSet; import android.util.Log; import android.util.Property; -import android.util.Size; import android.util.TypedValue; import android.view.KeyEvent; import android.view.MotionEvent; @@ -194,13 +193,15 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, private boolean mForceHideDot; // These fields, related to showing running apps, are only used for Taskbar. - private final Size mRunningAppIndicatorSize; + private final int mRunningAppIndicatorWidth; + private final int mMinimizedAppIndicatorWidth; + private final int mRunningAppIndicatorHeight; private final int mRunningAppIndicatorTopMargin; - private final Size mMinimizedAppIndicatorSize; - private final int mMinimizedAppIndicatorTopMargin; private final Paint mRunningAppIndicatorPaint; private final Rect mRunningAppIconBounds = new Rect(); private RunningAppState mRunningAppState; + private final int mRunningAppIndicatorColor; + private final int mMinimizedAppIndicatorColor; /** * Various options for the running state of an app. @@ -277,22 +278,21 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, defaultIconSize); a.recycle(); - mRunningAppIndicatorSize = new Size( - getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_width), - getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_height)); - mMinimizedAppIndicatorSize = new Size( - getResources().getDimensionPixelSize(R.dimen.taskbar_minimized_app_indicator_width), - getResources().getDimensionPixelSize( - R.dimen.taskbar_minimized_app_indicator_height)); + mRunningAppIndicatorWidth = + getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_width); + mMinimizedAppIndicatorWidth = + getResources().getDimensionPixelSize(R.dimen.taskbar_minimized_app_indicator_width); + mRunningAppIndicatorHeight = + getResources().getDimensionPixelSize(R.dimen.taskbar_running_app_indicator_height); mRunningAppIndicatorTopMargin = getResources().getDimensionPixelSize( R.dimen.taskbar_running_app_indicator_top_margin); - mMinimizedAppIndicatorTopMargin = - getResources().getDimensionPixelSize( - R.dimen.taskbar_minimized_app_indicator_top_margin); + mRunningAppIndicatorPaint = new Paint(); - mRunningAppIndicatorPaint.setColor(getResources().getColor( - R.color.taskbar_running_app_indicator_color, context.getTheme())); + mRunningAppIndicatorColor = getResources().getColor( + R.color.taskbar_running_app_indicator_color, context.getTheme()); + mMinimizedAppIndicatorColor = getResources().getColor( + R.color.taskbar_minimized_app_indicator_color, context.getTheme()); mLongPressHelper = new CheckLongPressHelper(this); @@ -716,16 +716,26 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, return; } getIconBounds(mRunningAppIconBounds); - // TODO(b/333872717): update color, shape, and size of indicator - boolean isMinimized = mRunningAppState == RunningAppState.MINIMIZED; - int indicatorTop = - mRunningAppIconBounds.bottom + (isMinimized ? mMinimizedAppIndicatorTopMargin - : mRunningAppIndicatorTopMargin); - final Size indicatorSize = - isMinimized ? mMinimizedAppIndicatorSize : mRunningAppIndicatorSize; - canvas.drawRect(mRunningAppIconBounds.centerX() - indicatorSize.getWidth() / 2, - indicatorTop, mRunningAppIconBounds.centerX() + indicatorSize.getWidth() / 2, - indicatorTop + indicatorSize.getHeight(), mRunningAppIndicatorPaint); + Utilities.scaleRectAboutCenter( + mRunningAppIconBounds, + IconShape.INSTANCE.get(getContext()).getNormalizationScale()); + + final boolean isMinimized = mRunningAppState == RunningAppState.MINIMIZED; + final int indicatorTop = mRunningAppIconBounds.bottom + mRunningAppIndicatorTopMargin; + final int indicatorWidth = + isMinimized ? mMinimizedAppIndicatorWidth : mRunningAppIndicatorWidth; + final float cornerRadius = mRunningAppIndicatorHeight / 2f; + mRunningAppIndicatorPaint.setColor( + isMinimized ? mMinimizedAppIndicatorColor : mRunningAppIndicatorColor); + + canvas.drawRoundRect( + mRunningAppIconBounds.centerX() - indicatorWidth / 2f, + indicatorTop, + mRunningAppIconBounds.centerX() + indicatorWidth / 2f, + indicatorTop + mRunningAppIndicatorHeight, + cornerRadius, + cornerRadius, + mRunningAppIndicatorPaint); } @Override