summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Andonian <andonian@google.com>2022-03-24 23:49:40 +0000
committerPresubmit Automerger Backend <android-build-presubmit-automerger-backend@system.gserviceaccount.com>2022-03-24 23:49:40 +0000
commit0698ed3a281f633a2e6e62d7423f5403309071c5 (patch)
tree7a9d9b962f49250d25c0f12136d6213030198741
parentc244f5c49a0f72ad830d9b1b4d1515db65479f4d (diff)
parentb4c1fcb51a66c5fa09e1834338981c7294d35f99 (diff)
downloadsystemui-0698ed3a281f633a2e6e62d7423f5403309071c5.tar.gz
[automerge] Update monochrome theme icon notification dot color 2p: b4c1fcb51a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/libs/systemui/+/17225905 Bug: 189498337 Change-Id: Ia1a1f68911d44515e6beca68f464aed23e453e0f
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java21
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java8
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java5
3 files changed, 28 insertions, 6 deletions
diff --git a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
index 473e492..c2a7b33 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
@@ -59,6 +59,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
private static final String TAG = "ClockDrawableWrapper";
private static final boolean DISABLE_SECONDS = true;
+ private static final int NO_COLOR = -1;
// Time after which the clock icon should check for an update. The actual invalidate
// will only happen in case of any change.
@@ -322,16 +323,19 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
@DrawableCreationFlags int creationFlags) {
AnimationInfo info;
Bitmap bg;
+ int themedFgColor;
ColorFilter bgFilter;
if ((creationFlags & FLAG_THEMED) != 0 && themeData != null) {
int[] colors = ThemedIconDrawable.getColors(context);
Drawable tintedDrawable = themeData.baseDrawableState.newDrawable().mutate();
+ themedFgColor = colors[1];
tintedDrawable.setTint(colors[1]);
info = themeData.copyForIcon(tintedDrawable);
bg = themeBackground;
bgFilter = new BlendModeColorFilter(colors[0], BlendMode.SRC_IN);
} else {
info = animInfo;
+ themedFgColor = NO_COLOR;
bg = mFlattenedBackground;
bgFilter = null;
}
@@ -339,7 +343,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
return super.newIcon(context, creationFlags);
}
ClockIconDrawable.ClockConstantState cs = new ClockIconDrawable.ClockConstantState(
- icon, color, boundsOffset, info, bg, bgFilter);
+ icon, color, themedFgColor, boundsOffset, info, bg, bgFilter);
FastBitmapDrawable d = cs.newDrawable();
applyFlags(context, d, creationFlags);
return d;
@@ -366,6 +370,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
private final Bitmap mBG;
private final Paint mBgPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);
+ private final int mThemedFgColor;
private final AdaptiveIconDrawable mFullDrawable;
private final LayerDrawable mFG;
@@ -378,6 +383,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
mBG = cs.mBG;
mBgPaint.setColorFilter(cs.mBgFilter);
+ mThemedFgColor = cs.mThemedFgColor;
mFullDrawable = (AdaptiveIconDrawable) mAnimInfo.baseDrawableState.newDrawable();
mFG = (LayerDrawable) mFullDrawable.getForeground();
@@ -425,6 +431,11 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
}
@Override
+ public int getIconColor() {
+ return isThemed() ? mThemedFgColor : super.getIconColor();
+ }
+
+ @Override
public void run() {
if (mAnimInfo.applyTime(mTime, mFG)) {
invalidateSelf();
@@ -457,8 +468,8 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
@Override
public FastBitmapConstantState newConstantState() {
- return new ClockConstantState(mBitmap, mIconColor, mBoundsOffset, mAnimInfo, mBG,
- mBgPaint.getColorFilter());
+ return new ClockConstantState(mBitmap, mIconColor, mThemedFgColor, mBoundsOffset,
+ mAnimInfo, mBG, mBgPaint.getColorFilter());
}
private static class ClockConstantState extends FastBitmapConstantState {
@@ -467,14 +478,16 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
private final AnimationInfo mAnimInfo;
private final Bitmap mBG;
private final ColorFilter mBgFilter;
+ private final int mThemedFgColor;
- ClockConstantState(Bitmap bitmap, int color,
+ ClockConstantState(Bitmap bitmap, int color, int themedFgColor,
float boundsOffset, AnimationInfo animInfo, Bitmap bg, ColorFilter bgFilter) {
super(bitmap, color);
mBoundsOffset = boundsOffset;
mAnimInfo = animInfo;
mBG = bg;
mBgFilter = bgFilter;
+ mThemedFgColor = themedFgColor;
}
@Override
diff --git a/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java b/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java
index cb74867..c9722c2 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java
@@ -17,6 +17,7 @@
package com.android.launcher3.icons;
import static com.android.launcher3.icons.BaseIconFactory.getBadgeSizeForIconSize;
+import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import android.animation.ObjectAnimator;
import android.graphics.Bitmap;
@@ -35,6 +36,7 @@ import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import androidx.annotation.Nullable;
+import androidx.core.graphics.ColorUtils;
public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
@@ -42,6 +44,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
private static final Interpolator DEACCEL = new DecelerateInterpolator();
private static final float PRESSED_SCALE = 1.1f;
+ public static final int WHITE_SCRIM_ALPHA = 138;
private static final float DISABLED_DESATURATION = 1f;
private static final float DISABLED_BRIGHTNESS = 0.5f;
@@ -128,10 +131,11 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
}
/**
- * Returns the primary icon color
+ * Returns the primary icon color, slightly tinted white
*/
public int getIconColor() {
- return mIconColor;
+ int whiteScrim = setColorAlphaBound(Color.WHITE, WHITE_SCRIM_ALPHA);
+ return ColorUtils.compositeColors(whiteScrim, mIconColor);
}
/**
diff --git a/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java b/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java
index 4a31611..5775e08 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java
@@ -112,4 +112,9 @@ public class ThemedIconDrawable extends FastBitmapDrawable {
}
return colors;
}
+
+ @Override
+ public int getIconColor() {
+ return colorFg;
+ }
}