use of com.android.contacts.common.lettertiles.LetterTileDrawable.ContactType in project android_packages_apps_Dialer by LineageOS.
the class StatusBarNotifier method getLargeIconToDisplay.
/**
* Gets a large icon from the contact info object to display in the notification.
*/
private static Bitmap getLargeIconToDisplay(Context context, ContactCacheEntry contactInfo, DialerCall call) {
Resources resources = context.getResources();
Bitmap largeIcon = null;
if (contactInfo.photo != null && (contactInfo.photo instanceof BitmapDrawable)) {
largeIcon = ((BitmapDrawable) contactInfo.photo).getBitmap();
}
if (contactInfo.photo == null) {
int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
int height = (int) resources.getDimension(android.R.dimen.notification_large_icon_height);
@ContactType int contactType = LetterTileDrawable.getContactTypeFromPrimitives(CallerInfoUtils.isVoiceMailNumber(context, call), call.isSpam(), contactInfo.isBusiness, call.getNumberPresentation(), call.isConferenceCall() && !call.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE));
LetterTileDrawable lettertile = new LetterTileDrawable(resources);
lettertile.setCanonicalDialerLetterTileDetails(contactInfo.namePrimary == null ? contactInfo.number : contactInfo.namePrimary, contactInfo.lookupKey, LetterTileDrawable.SHAPE_CIRCLE, contactType);
largeIcon = lettertile.getBitmap(width, height);
}
if (call.isSpam()) {
Drawable drawable = resources.getDrawable(R.drawable.blocked_contact, context.getTheme());
largeIcon = DrawableConverter.drawableToBitmap(drawable);
}
return largeIcon;
}
Aggregations