diff options
author | Brian Attwell <brianattwell@google.com> | 2014-09-03 22:34:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-03 22:34:24 +0000 |
commit | d2daa2b9cd691ae5f33605027b77e33d3053a688 (patch) | |
tree | e728ea346c690d81d3c8f3f1413b1eb7df169fca /src/com/android/contacts/widget | |
parent | 0f2d43d8e755854b6120aabf0d71d872289913a0 (diff) | |
parent | 5c748642f7a2c88d8ceb5154c9c2803d3f297926 (diff) | |
download | Contacts-d2daa2b9cd691ae5f33605027b77e33d3053a688.tar.gz |
Merge "Draw background behind contact photo when needed" into lmp-dev
Diffstat (limited to 'src/com/android/contacts/widget')
-rw-r--r-- | src/com/android/contacts/widget/QuickContactImageView.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/contacts/widget/QuickContactImageView.java b/src/com/android/contacts/widget/QuickContactImageView.java index ff9e799f8..a8f0b10f1 100644 --- a/src/com/android/contacts/widget/QuickContactImageView.java +++ b/src/com/android/contacts/widget/QuickContactImageView.java @@ -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); } |