Search in sources :

Example 1 with ContactType

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;
}
Also used : Bitmap(android.graphics.Bitmap) ContactType(com.android.contacts.common.lettertiles.LetterTileDrawable.ContactType) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) LetterTileDrawable(com.android.contacts.common.lettertiles.LetterTileDrawable) LetterTileDrawable(com.android.contacts.common.lettertiles.LetterTileDrawable) Resources(android.content.res.Resources) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Aggregations

Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 LetterTileDrawable (com.android.contacts.common.lettertiles.LetterTileDrawable)1 ContactType (com.android.contacts.common.lettertiles.LetterTileDrawable.ContactType)1