Search in sources :

Example 11 with LetterTileDrawable

use of com.android.contacts.common.lettertiles.LetterTileDrawable in project packages_apps_Contacts by AOKP.

the class QuickContactImageView method setImageDrawable.

@Override
public void setImageDrawable(Drawable drawable) {
    // There is no way to avoid all this casting. Blending modes aren't equally
    // supported for all drawable types.
    final BitmapDrawable bitmapDrawable;
    if (drawable == null || drawable instanceof BitmapDrawable) {
        bitmapDrawable = (BitmapDrawable) drawable;
    } else if (drawable instanceof LetterTileDrawable) {
        if (!mIsBusiness) {
            bitmapDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.person_white_540dp);
        } else {
            bitmapDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.generic_business_white_540dp);
        }
    } else {
        throw new IllegalArgumentException("Does not support this type of drawable");
    }
    mOriginalDrawable = drawable;
    mBitmapDrawable = bitmapDrawable;
    setTint(mTintColor);
    super.setImageDrawable(bitmapDrawable);
}
Also used : LetterTileDrawable(com.android.contacts.common.lettertiles.LetterTileDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Aggregations

LetterTileDrawable (com.android.contacts.common.lettertiles.LetterTileDrawable)11 Bitmap (android.graphics.Bitmap)4 BitmapDrawable (android.graphics.drawable.BitmapDrawable)3 Drawable (android.graphics.drawable.Drawable)3 LayoutInflater (android.view.LayoutInflater)2 ImageView (android.widget.ImageView)2 ContactInfo (com.android.dialer.calllog.ContactInfo)2 Resources (android.content.res.Resources)1 AdaptiveIconDrawable (android.graphics.drawable.AdaptiveIconDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 RequiresApi (android.support.annotation.RequiresApi)1 RoundedBitmapDrawable (android.support.v4.graphics.drawable.RoundedBitmapDrawable)1 ContactType (com.android.contacts.common.lettertiles.LetterTileDrawable.ContactType)1 MaterialPalette (com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette)1 ContactInfoHelper (com.android.dialer.calllog.ContactInfoHelper)1 ContactInfoHelper (com.android.dialer.phonenumbercache.ContactInfoHelper)1 VisualVoicemailEnabledChecker (com.android.dialer.voicemail.VisualVoicemailEnabledChecker)1 VisualVoicemailEnabledChecker (com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker)1