use of com.fsck.k9.view.RecipientSelectView.RecipientCryptoStatus in project k-9 by k9mail.
the class RecipientAdapter method bindView.
public void bindView(View view, Recipient recipient) {
RecipientTokenHolder holder = (RecipientTokenHolder) view.getTag();
holder.name.setText(highlightText(recipient.getDisplayNameOrUnknown(context)));
String address = recipient.address.getAddress();
holder.email.setText(highlightText(address));
setContactPhotoOrPlaceholder(context, holder.photo, recipient);
Integer cryptoStatusRes = null, cryptoStatusColor = null;
RecipientCryptoStatus cryptoStatus = recipient.getCryptoStatus();
switch(cryptoStatus) {
case AVAILABLE_TRUSTED:
{
cryptoStatusRes = R.drawable.status_lock_dots_3;
cryptoStatusColor = ThemeUtils.getStyledColor(context, R.attr.openpgp_green);
break;
}
case AVAILABLE_UNTRUSTED:
{
cryptoStatusRes = R.drawable.status_lock_dots_2;
cryptoStatusColor = ThemeUtils.getStyledColor(context, R.attr.openpgp_orange);
break;
}
case UNAVAILABLE:
{
cryptoStatusRes = R.drawable.status_lock_disabled_dots_1;
cryptoStatusColor = ThemeUtils.getStyledColor(context, R.attr.openpgp_red);
break;
}
}
if (cryptoStatusRes != null) {
Drawable drawable = ContextCompat.getDrawable(context, cryptoStatusRes);
DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable.mutate(), cryptoStatusColor);
holder.cryptoStatusIcon.setImageDrawable(drawable);
holder.cryptoStatus.setVisibility(View.VISIBLE);
} else {
holder.cryptoStatus.setVisibility(View.GONE);
}
}
Aggregations