Search in sources :

Example 1 with IconFontDescriptorWrapper

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;
}
Also used : IconFontDescriptorWrapper(com.joanzapata.iconify.internal.IconFontDescriptorWrapper) CheckResult(android.support.annotation.CheckResult) Nullable(android.support.annotation.Nullable)

Example 2 with IconFontDescriptorWrapper

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);
}
Also used : IconFontDescriptorWrapper(com.joanzapata.iconify.internal.IconFontDescriptorWrapper) TextPaint(android.text.TextPaint)

Example 3 with IconFontDescriptorWrapper

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;
}
Also used : IconFontDescriptorWrapper(com.joanzapata.iconify.internal.IconFontDescriptorWrapper)

Aggregations

IconFontDescriptorWrapper (com.joanzapata.iconify.internal.IconFontDescriptorWrapper)3 CheckResult (android.support.annotation.CheckResult)1 Nullable (android.support.annotation.Nullable)1 TextPaint (android.text.TextPaint)1