/** * Builds and returns an icon {@code Drawable} to represent this {@code PhoneAccount} in a user * interface. * * @param phoneAccount the PhoneAccount from which to build the icon. * @param context A {@code Context} to use for loading Drawables. * * @return An icon for this PhoneAccount, or null */ @Nullable public static Drawable createIconDrawable(@Nullable PhoneAccount phoneAccount, @Nullable Context context) { if (phoneAccount == null || context == null) { return null; } if (CompatUtils.isMarshmallowCompatible()) { return createIconDrawableMarshmallow(phoneAccount, context); } if (CompatUtils.isLollipopMr1Compatible()) { return createIconDrawableLollipopMr1(phoneAccount, context); } return null; }
@Nullable private static Drawable createIconDrawableMarshmallow(PhoneAccount phoneAccount, Context context) { Icon accountIcon = getIcon(phoneAccount); if (accountIcon == null) { return null; } return accountIcon.loadDrawable(context); }
account.getAddress().getSchemeSpecificPart())); holder.imageView.setImageDrawable(PhoneAccountCompat.createIconDrawable(account, getContext())); return rowView;