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

Commit 3abf336c authored by Gabriele M's avatar Gabriele M
Browse files

Update tint of resource icons of third party QS tiles

Since commit d2274f84
("Fix animations for app QS tiles."), the tint of resource icons of
third party tiles doesn't change when the tile status changes. Keep
track of the tint so that changing the status of the icon will cause
an update of the icon.

BUGBASH-1239

Change-Id: Ib2a91a00b6912ae85f37dd096e62bb6b979e9fc7
parent 782b2900
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -493,15 +493,18 @@ public abstract class QSTile<TState extends State> {

    public static class DrawableIconWithRes extends DrawableIcon {
        private final int mId;
        private final int mColor;

        public DrawableIconWithRes(Drawable drawable, int id) {
        public DrawableIconWithRes(Drawable drawable, int id, int color) {
            super(drawable);
            mId = id;
            mColor = color;
        }

        @Override
        public boolean equals(Object o) {
            return o instanceof DrawableIconWithRes && ((DrawableIconWithRes) o).mId == mId;
            return o instanceof DrawableIconWithRes && ((DrawableIconWithRes) o).mId == mId &&
                    ((DrawableIconWithRes) o).mColor == mColor;
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -302,8 +302,8 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
        }
        int color = mContext.getColor(getColor(tileState));
        drawable.setTint(color);
        state.icon = mHasRes ? new DrawableIconWithRes(drawable, icon.getResId())
                : new DrawableIcon(drawable);
        state.icon = mHasRes ? new DrawableIconWithRes(
                drawable, icon.getResId(), color) : new DrawableIcon(drawable);
        state.label = mTile.getLabel();
        if (tileState == Tile.STATE_UNAVAILABLE) {
            state.label = new SpannableStringBuilder().append(state.label,