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

Commit 638e5da8 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Change non-adaptive icon background color to 50% white

parent d810366d
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public class AdaptiveIconGenerator {
    private boolean ranLoop;
    private boolean shouldWrap;
    private int backgroundColor = Color.WHITE;
    private boolean useWhiteBackground = true;
    private boolean isFullBleed;
    private boolean noMixinNeeded;
    private boolean fullBleedChecked;
@@ -163,6 +164,15 @@ public class AdaptiveIconGenerator {

        // return early if a mix-in isnt needed
        noMixinNeeded = !isFullBleed && !isBackgroundWhite && almostSquarish && transparentScore <= noMixinScore;

        // Currently, it's set to true so a white background is used for all the icons.
        if(useWhiteBackground) {
            //backgroundColor = Color.WHITE;
            backgroundColor = Color.WHITE & 0x80FFFFFF;
            onExitLoop();
            return;
        }

        if (isFullBleed || noMixinNeeded) {
            backgroundColor = bestRGB;
            onExitLoop();
+1 −2
Original line number Diff line number Diff line
@@ -175,8 +175,7 @@ public class IconsHandler {

        // Search first in cache
        Drawable systemIcon = cacheGetDrawable(key);
        if (systemIcon != null
                && !activityInfo.getApplicationInfo().packageName.equalsIgnoreCase("com.app.restclient")) {
        if (systemIcon != null) {
            return systemIcon;
        }

+5 −26
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ public class AdaptiveIconDrawableCompat extends Drawable implements Drawable.Cal
        // mMaskBitmap bound [0, w] x [0, h]
        mCanvas.setBitmap(mMaskBitmap);
        mPaint.setShader(null);
        mPaint.setColor(0xFFFFFFFF);
        mPaint.setColor(Color.WHITE);
        mCanvas.drawPath(mMask, mPaint);

        // mMask bound [left, top, right, bottom]
@@ -385,7 +385,7 @@ public class AdaptiveIconDrawableCompat extends Drawable implements Drawable.Cal
        }
        if (mLayersShader == null) {
            mCanvas.setBitmap(mLayersBitmap);
            mCanvas.drawColor(Color.BLACK);
            //mCanvas.drawColor(Color.BLACK);
            for (int i = 0; i < LayerState.N_CHILDREN; i++) {
                if (mLayerState.mChildren[i] == null) {
                    continue;
@@ -396,33 +396,12 @@ public class AdaptiveIconDrawableCompat extends Drawable implements Drawable.Cal
                }
            }
            mLayersShader = new BitmapShader(mLayersBitmap, TileMode.CLAMP, TileMode.CLAMP);
            if (mUseMyUglyWorkaround) {
                // TODO: remove this ugly and slow code
                if (mMaskBitmap != null) {
                    int width = mLayersBitmap.getWidth();
                    int height = mLayersBitmap.getHeight();
                    int[] colors = new int[width * height];
                    int[] alphas = new int[width * height];
                    mLayersBitmap.getPixels(colors, 0, width, 0, 0, width, height);
                    mMaskBitmap.getPixels(alphas, 0, width, 0, 0, width, height);
                    int color, alpha, index;
                    for (int i = 0; i < width; i++) {
                        for (int j = 0; j < height; j++) {
                            index = i * height + j;
                            color = colors[index];
                            alpha = alphas[index];
                            colors[index] = color & 0x00FFFFFF | alpha & 0xFF000000;
                        }
                    }
                    mLayersBitmap.setPixels(colors, 0, width, 0, 0, width, height);
                }
            } else {
            mPaint.setShader(mLayersShader);
        }
        }
        if (mMaskBitmap != null) {
            Rect bounds = getBounds();
            canvas.drawBitmap(mUseMyUglyWorkaround ? mLayersBitmap : mMaskBitmap, bounds.left,
            //mPaint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
            canvas.drawBitmap(mMaskBitmap, bounds.left,
                    bounds.top, mPaint);
        }
    }