Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4c1fcb5 authored by Stefan Andonian's avatar Stefan Andonian
Browse files

Update monochrome theme icon notification dot color

Bug: 189498337
Test: Hard-coded the notification dots to be visible, and verified they were the correct color.
Screenshot: https://screenshot.googleplex.com/AVbbW6P2bm6jYNS
Change-Id: I38a78cda056273eb300d458e663f79ccdd28f36a
parent 84858344
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -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();
@@ -424,6 +430,11 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            mFullDrawable.setColorFilter(mPaint.getColorFilter());
        }

        @Override
        public int getIconColor() {
            return isThemed() ? mThemedFgColor : super.getIconColor();
        }

        @Override
        public void run() {
            if (mAnimInfo.applyTime(mTime, mFG)) {
@@ -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
+6 −2
Original line number Diff line number Diff line
@@ -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);
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -112,4 +112,9 @@ public class ThemedIconDrawable extends FastBitmapDrawable {
        }
        return colors;
    }

    @Override
    public int getIconColor() {
        return colorFg;
    }
}