use of org.awesomeapp.messenger.ui.widgets.RoundedAvatarDrawable in project Zom-Android by zom.
the class MessageListItem method showAvatar.
private void showAvatar(String address, String nickname, boolean isLeft, int presenceStatus) {
if (mHolder.mAvatar == null)
return;
mHolder.mAvatar.setVisibility(View.GONE);
if (address != null && isLeft) {
RoundedAvatarDrawable avatar = null;
try {
avatar = (RoundedAvatarDrawable) DatabaseUtils.getAvatarFromAddress(this.getContext().getContentResolver(), XmppAddress.stripResource(address), ImApp.SMALL_AVATAR_WIDTH, ImApp.SMALL_AVATAR_HEIGHT);
} catch (Exception e) {
}
if (avatar != null) {
mHolder.mAvatar.setVisibility(View.VISIBLE);
mHolder.mAvatar.setImageDrawable(avatar);
// setAvatarBorder(presenceStatus, avatar);
} else {
// int color = getAvatarBorder(presenceStatus);
int padding = 24;
if (nickname.length() > 0) {
LetterAvatar lavatar = new LetterAvatar(getContext(), nickname, padding);
mHolder.mAvatar.setVisibility(View.VISIBLE);
mHolder.mAvatar.setImageDrawable(lavatar);
}
}
}
}
Aggregations