List of usage examples for android.widget QuickContactBadge setImageDrawable
public void setImageDrawable(@Nullable Drawable drawable)
From source file:com.android.mms.quickmessage.QuickMessage.java
private void updateContactBadge(QuickContactBadge badge, String addr, boolean isSelf) { Drawable avatarDrawable;//w w w .j av a2 s . co m if (isSelf || !TextUtils.isEmpty(addr)) { Contact contact = isSelf ? Contact.getMe(false) : Contact.get(addr, false); avatarDrawable = contact.getAvatar(mContext, mDefaultContactImage); if (isSelf) { badge.assignContactUri(Profile.CONTENT_URI); } else { if (contact.existsInDatabase()) { badge.assignContactUri(contact.getUri()); } else { badge.assignContactFromPhone(contact.getNumber(), true); } } } else { avatarDrawable = mDefaultContactImage; } badge.setImageDrawable(avatarDrawable); }
From source file:com.android.mms.quickmessage.QuickMessagePopup.java
/** * Show the appropriate image for the QuickContact badge * * @param badge//from w w w .j a va 2 s. c o m * @param addr * @param isSelf */ private void updateContactBadge(QuickContactBadge badge, String addr, boolean isSelf) { Drawable avatarDrawable; if (isSelf || !TextUtils.isEmpty(addr)) { Contact contact = isSelf ? Contact.getMe(false) : Contact.get(addr, false); avatarDrawable = contact.getAvatar(mContext, mDefaultContactImage); if (isSelf) { badge.assignContactUri(Profile.CONTENT_URI); } else { if (contact.existsInDatabase()) { badge.assignContactUri(contact.getUri()); } else { badge.assignContactFromPhone(contact.getNumber(), true); } } } else { avatarDrawable = mDefaultContactImage; } badge.setImageDrawable(avatarDrawable); }