diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-09 07:15:30 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-09 07:15:30 +0000 |
commit | cae9a70ebc3f82163d9acb7b707c62b63845fefc (patch) | |
tree | f10e837e6886fcd6402c082c296bf68a30cfec27 | |
parent | 713caa43a0377727c7a4ac9345547d2ccc8c98fa (diff) | |
parent | 2e94da8396e178b2a52a1381c67d4c3921a85c5e (diff) | |
download | systemui-android13-mainline-uwb-release.tar.gz |
Snap for 8701348 from 2e94da8396e178b2a52a1381c67d4c3921a85c5e to mainline-uwb-releaseaml_uwb_331910010aml_uwb_331820070aml_uwb_331613010aml_uwb_331611010aml_uwb_331410010aml_uwb_331310030aml_uwb_331115000aml_uwb_331015040aml_uwb_330810010android13-mainline-uwb-release
Change-Id: I06f7495a0ec50fd26fc940c074f68b5282b7a586
5 files changed, 41 insertions, 5 deletions
diff --git a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java index ef1bc3e..d624805 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java +++ b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java @@ -60,7 +60,6 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap private static final boolean DISABLE_SECONDS = true; private static final int NO_COLOR = -1; - private static final int FULLY_OPAQUE = 255; // Time after which the clock icon should check for an update. The actual invalidate // will only happen in case of any change. @@ -390,6 +389,10 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap mFullDrawable = (AdaptiveIconDrawable) mAnimInfo.baseDrawableState.newDrawable(); mFG = (LayerDrawable) mFullDrawable.getForeground(); + + // Time needs to be applied here since drawInternal is NOT guaranteed to be called + // before this foreground drawable is shown on the screen. + mAnimInfo.applyTime(mTime, mFG); mCanvasScale = 1 - 2 * mBoundsOffset; } diff --git a/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java b/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java index 361a7d9..a42232e 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java +++ b/iconloaderlib/src/com/android/launcher3/icons/DotRenderer.java @@ -125,7 +125,7 @@ public class DotRenderer { mCirclePaint.setColor(Color.BLACK); canvas.drawBitmap(mBackgroundWithShadow, mBitmapOffset, mBitmapOffset, mCirclePaint); - mCirclePaint.setColor(params.color); + mCirclePaint.setColor(params.dotColor); canvas.drawCircle(0, 0, mCircleRadius, mCirclePaint); canvas.restore(); } @@ -133,7 +133,10 @@ public class DotRenderer { public static class DrawParams { /** The color (possibly based on the icon) to use for the dot. */ @ViewDebug.ExportedProperty(category = "notification dot", formatToHexString = true) - public int color; + public int dotColor; + /** The color (possibly based on the icon) to use for a predicted app. */ + @ViewDebug.ExportedProperty(category = "notification dot", formatToHexString = true) + public int appColor; /** The bounds of the icon that the dot is drawn on top of. */ @ViewDebug.ExportedProperty(category = "notification dot") public Rect iconBounds = new Rect(); diff --git a/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java b/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java index c9722c2..513a75d 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java +++ b/iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java @@ -48,6 +48,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { private static final float DISABLED_DESATURATION = 1f; private static final float DISABLED_BRIGHTNESS = 0.5f; + protected static final int FULLY_OPAQUE = 255; public static final int CLICK_FEEDBACK_DURATION = 200; @@ -329,6 +330,14 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback { return new ColorMatrixColorFilter(tempFilterMatrix); } + protected static final int getDisabledColor(int color) { + int component = (Color.red(color) + Color.green(color) + Color.blue(color)) / 3; + float scale = 1 - DISABLED_BRIGHTNESS; + int brightnessI = (int) (255 * DISABLED_BRIGHTNESS); + component = Math.min(Math.round(scale * component + brightnessI), FULLY_OPAQUE); + return Color.rgb(component, component, component); + } + /** * Sets the bounds for the badge drawable based on the main icon bounds */ diff --git a/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java b/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java index 2da518e..494d657 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java +++ b/iconloaderlib/src/com/android/launcher3/icons/ThemedIconDrawable.java @@ -24,6 +24,7 @@ import android.graphics.Bitmap; import android.graphics.BlendMode; import android.graphics.BlendModeColorFilter; import android.graphics.Canvas; +import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.Rect; @@ -45,6 +46,8 @@ public class ThemedIconDrawable extends FastBitmapDrawable { private final Bitmap mBgBitmap; private final Paint mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); + private final ColorFilter mBgFilter, mMonoFilter; + protected ThemedIconDrawable(ThemedConstantState constantState) { super(constantState.mBitmap, constantState.colorFg); bitmapInfo = constantState.bitmapInfo; @@ -52,10 +55,12 @@ public class ThemedIconDrawable extends FastBitmapDrawable { colorFg = constantState.colorFg; mMonoIcon = bitmapInfo.mMono; - mMonoPaint.setColorFilter(new BlendModeColorFilter(colorFg, BlendMode.SRC_IN)); + mMonoFilter = new BlendModeColorFilter(colorFg, BlendMode.SRC_IN); + mMonoPaint.setColorFilter(mMonoFilter); mBgBitmap = bitmapInfo.mWhiteShadowLayer; - mBgPaint.setColorFilter(new BlendModeColorFilter(colorBg, BlendMode.SRC_IN)); + mBgFilter = new BlendModeColorFilter(colorBg, BlendMode.SRC_IN); + mBgPaint.setColorFilter(mBgFilter); } @Override @@ -65,6 +70,19 @@ public class ThemedIconDrawable extends FastBitmapDrawable { } @Override + protected void updateFilter() { + super.updateFilter(); + int alpha = mIsDisabled ? (int) (mDisabledAlpha * FULLY_OPAQUE) : FULLY_OPAQUE; + mBgPaint.setAlpha(alpha); + mBgPaint.setColorFilter(mIsDisabled ? new BlendModeColorFilter( + getDisabledColor(colorBg), BlendMode.SRC_IN) : mBgFilter); + + mMonoPaint.setAlpha(alpha); + mMonoPaint.setColorFilter(mIsDisabled ? new BlendModeColorFilter( + getDisabledColor(colorFg), BlendMode.SRC_IN) : mMonoFilter); + } + + @Override public boolean isThemed() { return true; } diff --git a/searchuilib/src/com/android/app/search/LayoutType.java b/searchuilib/src/com/android/app/search/LayoutType.java index 0a8c8ad..d7c28ab 100644 --- a/searchuilib/src/com/android/app/search/LayoutType.java +++ b/searchuilib/src/com/android/app/search/LayoutType.java @@ -73,4 +73,7 @@ public class LayoutType { // layout representing quick calculations public static final String CALCULATOR = "calculator"; + + // layout for the section header + public static final String SECTION_HEADER = "section_header"; } |