use of com.android.contacts.common.lettertiles.LetterTileDrawable in project packages_apps_Contacts by AOKP.
the class QuickContactImageView method setImageDrawable.
@Override
public void setImageDrawable(Drawable drawable) {
// There is no way to avoid all this casting. Blending modes aren't equally
// supported for all drawable types.
final BitmapDrawable bitmapDrawable;
if (drawable == null || drawable instanceof BitmapDrawable) {
bitmapDrawable = (BitmapDrawable) drawable;
} else if (drawable instanceof LetterTileDrawable) {
if (!mIsBusiness) {
bitmapDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.person_white_540dp);
} else {
bitmapDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.generic_business_white_540dp);
}
} else {
throw new IllegalArgumentException("Does not support this type of drawable");
}
mOriginalDrawable = drawable;
mBitmapDrawable = bitmapDrawable;
setTint(mTintColor);
super.setImageDrawable(bitmapDrawable);
}
Aggregations