use of com.joanzapata.iconify.internal.IconFontDescriptorWrapper in project edx-app-android by edx.
the class Iconify method findIconForKey.
/**
* Retrieve an icon from a key,
* @return The icon, or null if no icon matches the key.
*/
@CheckResult
@Nullable
static Icon findIconForKey(@NonNull String iconKey) {
for (int i = 0, iconFontDescriptorsSize = iconFontDescriptors.size(); i < iconFontDescriptorsSize; i++) {
IconFontDescriptorWrapper iconFontDescriptor = iconFontDescriptors.get(i);
Icon icon = iconFontDescriptor.getIcon(iconKey);
if (icon != null)
return icon;
}
return null;
}
use of com.joanzapata.iconify.internal.IconFontDescriptorWrapper in project android-iconify by JoanZapata.
the class IconDrawable method init.
private void init(Context context, Icon icon) {
this.context = context;
this.icon = icon;
paint = new TextPaint();
IconFontDescriptorWrapper descriptor = Iconify.findTypefaceOf(icon);
if (descriptor == null) {
throw new IllegalStateException("Unable to find the module associated " + "with icon " + icon.key() + ", have you registered the module " + "you are trying to use with Iconify.with(...) in your Application?");
}
paint.setTypeface(descriptor.getTypeface(context));
paint.setStyle(Paint.Style.FILL);
paint.setTextAlign(Paint.Align.CENTER);
paint.setUnderlineText(false);
paint.setColor(Color.BLACK);
paint.setAntiAlias(true);
}
use of com.joanzapata.iconify.internal.IconFontDescriptorWrapper in project android-iconify by JoanZapata.
the class Iconify method findIconForKey.
/**
* Retrieve an icon from a key,
* @return The icon, or null if no icon matches the key.
*/
public static Icon findIconForKey(String iconKey) {
for (int i = 0, iconFontDescriptorsSize = iconFontDescriptors.size(); i < iconFontDescriptorsSize; i++) {
IconFontDescriptorWrapper iconFontDescriptor = iconFontDescriptors.get(i);
Icon icon = iconFontDescriptor.getIcon(iconKey);
if (icon != null)
return icon;
}
return null;
}
Aggregations