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

Commit 5c748642 authored by Brian Attwell's avatar Brian Attwell
Browse files

Draw background behind contact photo when needed

When the contact photo might contain some transparent
pixels, draw a background behind the contact photo.

Bug: 17373093
Bug: 17107394
Change-Id: I3f911a80f4822e6429f8006c6711ef020373a271
parent 1deb532f
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import com.android.contacts.R;
public class QuickContactImageView extends ImageView {

    private Drawable mOriginalDrawable;
    private BitmapDrawable mBitmapDrawable;
    private int mTintColor;
    private boolean mIsBusiness;

    public QuickContactImageView(Context context) {
@@ -43,11 +45,13 @@ public class QuickContactImageView extends ImageView {
    }

    public void setTint(int color) {
        if (isBasedOffLetterTile()) {
        if (mBitmapDrawable == null || mBitmapDrawable.getBitmap() == null
                || mBitmapDrawable.getBitmap().hasAlpha()) {
            setBackgroundColor(color);
        } else {
            setBackground(null);
        }
        mTintColor = color;
        postInvalidate();
    }

@@ -76,9 +80,11 @@ public class QuickContactImageView extends ImageView {
            }
        } else {
            throw new IllegalArgumentException("Does not support this type of drawable");

        }

        mOriginalDrawable = drawable;
        mBitmapDrawable = bitmapDrawable;
        setTint(mTintColor);
        super.setImageDrawable(bitmapDrawable);
    }