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
diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml
index 4c48bd3..62873d6 100644
--- a/quickstep/res/values/colors.xml
+++ b/quickstep/res/values/colors.xml
@@ -31,7 +31,6 @@
<color name="taskbar_nav_icon_dark_color_on_home">#99000000</color>
<color name="taskbar_stashed_handle_light_color">#EBffffff</color>
<color name="taskbar_stashed_handle_dark_color">#99000000</color>
- <color name="taskbar_running_app_indicator_color">#646464</color>
<!-- Floating rotation button -->
<color name="floating_rotation_button_light_color">#ffffff</color>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 9836172..5f35007 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -356,12 +356,10 @@
<dimen name="taskbar_back_button_suw_start_margin">48dp</dimen>
<dimen name="taskbar_back_button_suw_bottom_margin">1dp</dimen>
<dimen name="taskbar_back_button_suw_height">72dp</dimen>
- <dimen name="taskbar_running_app_indicator_height">4dp</dimen>
- <dimen name="taskbar_running_app_indicator_width">14dp</dimen>
- <dimen name="taskbar_running_app_indicator_top_margin">2dp</dimen>
- <dimen name="taskbar_minimized_app_indicator_height">2dp</dimen>
- <dimen name="taskbar_minimized_app_indicator_width">12dp</dimen>
- <dimen name="taskbar_minimized_app_indicator_top_margin">2dp</dimen>
+ <dimen name="taskbar_running_app_indicator_height">2dp</dimen>
+ <dimen name="taskbar_running_app_indicator_width">12dp</dimen>
+ <dimen name="taskbar_running_app_indicator_top_margin">4dp</dimen>
+ <dimen name="taskbar_minimized_app_indicator_width">6dp</dimen>
<!-- Transient taskbar -->
<dimen name="transient_taskbar_padding">12dp</dimen>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 3f8bede..1eca88d 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -90,6 +90,7 @@
<color name="drop_target_hover_button_color_dark">#0842A0</color>
<color name="taskbar_running_app_indicator_color">#000000</color>
+ <color name="taskbar_minimized_app_indicator_color">#000000</color>
<color name="preload_icon_accent_color_light">#00668B</color>
<color name="preload_icon_background_color_light">#B5CAD7</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d1e905d..731e24e 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -426,9 +426,7 @@
<dimen name="taskbar_running_app_indicator_height">0dp</dimen>
<dimen name="taskbar_running_app_indicator_width">0dp</dimen>
<dimen name="taskbar_running_app_indicator_top_margin">0dp</dimen>
- <dimen name="taskbar_minimized_app_indicator_height">0dp</dimen>
<dimen name="taskbar_minimized_app_indicator_width">0dp</dimen>
- <dimen name="taskbar_minimized_app_indicator_top_margin">0dp</dimen>
<!-- Transient taskbar (placeholders to compile in Launcher3 without Quickstep) -->
<dimen name="transient_taskbar_padding">0dp</dimen>
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 5acff06..3c23410 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -52,7 +52,6 @@
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 @@
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 @@
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 @@
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