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

Commit c1d61830 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7402811 from fc33a2fa to sc-release

Change-Id: Ieaa9b45941d464d8e58dfb94c44e07239fd0e90a
parents c7728f8e fc33a2fa
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -281,15 +281,22 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
        public final Bitmap mFlattenedBackground;

        public final ThemeData themeData;
        public final ColorFilter bgFilter;

        ClockBitmapInfo(Bitmap icon, int color, float scale, AnimationInfo animInfo,
                Bitmap background, ThemeData themeData) {
            this(icon, color, scale, animInfo, background, themeData, null);
        }

        ClockBitmapInfo(Bitmap icon, int color, float scale, AnimationInfo animInfo,
                Bitmap background, ThemeData themeData, ColorFilter bgFilter) {
            super(icon, color);
            this.scale = scale;
            this.animInfo = animInfo;
            this.offset = (int) Math.ceil(ShadowGenerator.BLUR_FACTOR * icon.getWidth());
            this.mFlattenedBackground = background;
            this.themeData = themeData;
            this.bgFilter = bgFilter;
        }

        @Override
@@ -299,18 +306,9 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
                if (wrapper != null) {
                    int[] colors = getColors(context);
                    ColorFilter bgFilter = new PorterDuffColorFilter(colors[0], Mode.SRC_ATOP);
                    ClockBitmapInfo bitmapInfo = new ClockBitmapInfo(icon, colors[1], scale,
                            wrapper.mAnimationInfo, mFlattenedBackground, themeData) {

                        @Override
                        void drawBackground(Canvas canvas, Rect bounds, Paint paint) {
                            ColorFilter oldFilter = paint.getColorFilter();
                            paint.setColorFilter(bgFilter);
                            super.drawBackground(canvas, bounds, paint);
                            paint.setColorFilter(oldFilter);
                        }
                    };
                    return bitmapInfo.newIcon(context);
                    return new ClockBitmapInfo(icon, colors[1], scale,
                            wrapper.mAnimationInfo, mFlattenedBackground, themeData, bgFilter)
                            .newIcon(context);
                }
            }
            return super.newThemedIcon(context);
@@ -331,7 +329,12 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap

        void drawBackground(Canvas canvas, Rect bounds, Paint paint) {
            // draw the background that is already flattened to a bitmap
            ColorFilter oldFilter = paint.getColorFilter();
            if (bgFilter != null) {
                paint.setColorFilter(bgFilter);
            }
            canvas.drawBitmap(mFlattenedBackground, null, bounds, paint);
            paint.setColorFilter(oldFilter);
        }
    }

@@ -378,6 +381,11 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            reschedule();
        }

        @Override
        public boolean isThemed() {
            return mInfo.bgFilter != null;
        }

        @Override
        protected void updateFilter() {
            super.updateFilter();
+7 −0
Original line number Diff line number Diff line
@@ -120,6 +120,13 @@ public class FastBitmapDrawable extends Drawable {
        return mIconColor;
    }

    /**
     * Returns if this represents a themed icon
     */
    public boolean isThemed() {
        return false;
    }

    @Override
    public void setColorFilter(ColorFilter cf) {
        mColorFilter = cf;
+5 −0
Original line number Diff line number Diff line
@@ -100,6 +100,11 @@ public class ThemedIconDrawable extends FastBitmapDrawable {
        }
    }

    @Override
    public boolean isThemed() {
        return true;
    }

    @Override
    public ConstantState getConstantState() {
        return new ThemedConstantState(bitmapInfo, colorBg, colorFg, mIsDisabled);