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

Commit 47ed514b authored by Pat Manning's avatar Pat Manning
Browse files

Set alpha on background paint and foreground layers, include foreground when mutating drawable.

Test: manual
Bug: 202826469
Change-Id: I9b385c97384749ead68f75c41f20df7627d313b6
parent 19a01e22
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -387,7 +387,8 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            mBgPaint.setColorFilter(cs.mBgFilter);
            mThemedFgColor = cs.mThemedFgColor;

            mFullDrawable = (AdaptiveIconDrawable) mAnimInfo.baseDrawableState.newDrawable();
            mFullDrawable =
                    (AdaptiveIconDrawable) mAnimInfo.baseDrawableState.newDrawable().mutate();
            mFG = (LayerDrawable) mFullDrawable.getForeground();

            // Time needs to be applied here since drawInternal is NOT guaranteed to be called
@@ -396,6 +397,13 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            mCanvasScale = 1 - 2 * mBoundsOffset;
        }

        @Override
        public void setAlpha(int alpha) {
            super.setAlpha(alpha);
            mBgPaint.setAlpha(alpha);
            mFG.setAlpha(alpha);
        }

        @Override
        protected void onBoundsChange(Rect bounds) {
            super.onBoundsChange(bounds);
@@ -434,8 +442,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
        protected void updateFilter() {
            super.updateFilter();
            int alpha = mIsDisabled ? (int) (mDisabledAlpha * FULLY_OPAQUE) : FULLY_OPAQUE;
            mBgPaint.setAlpha(alpha);
            mFG.setAlpha(alpha);
            setAlpha(alpha);
            mBgPaint.setColorFilter(mIsDisabled ? getDisabledColorFilter() : mBgFilter);
            mFG.setColorFilter(mIsDisabled ? getDisabledColorFilter() : null);
        }