public static void createInstance(Map<String, String> fontsNormal, Map<String, String> fontsBold, Map<String, String> fontsThin, String fontDefault, int cacheSize) { instance = new TypefaceUtil(fontsNormal, fontsBold, fontsThin, fontDefault, cacheSize); }
private Fontify(Builder builder) { fontsNormal = builder.fontsNormal; fontsBold = builder.fontsBold; fontsThin = builder.fontsThin; fontDefault = builder.fontDefault; cacheSize = builder.cacheSize; TypefaceUtil.createInstance(fontsNormal, fontsBold, fontsThin, fontDefault, cacheSize); }
public Typeface getTypeFace(Context context, FontType fontType) { Typeface typeface = null; String langCode = Locale.getDefault().getLanguage(); switch (fontType) { case NORMAL: typeface = getFontNormal(context, langCode); break; case BOLD: typeface = getFontBold(context, langCode); break; case THIN: typeface = getFontThin(context, langCode); break; } return typeface; } }
protected void init(FontType fontType) { Typeface typeface = TypefaceUtil.getInstance().getTypeFace(getContext(), fontType); if (typeface != null) { setTypeface(typeface); } } }
public Typeface getFontNormal(Context context, String langCode) { Typeface typeface = null; if (fontsNormal != null && fontsNormal.get(langCode) != null) { typeface = getTypeFaceForPath(context, fontsNormal.get(langCode)); } if (typeface == null && fontDefault != null) { typeface = getTypeFaceForPath(context, fontDefault); } return typeface; }
protected void init(FontType fontType) { Typeface typeface = TypefaceUtil.getInstance().getTypeFace(getContext(), fontType); if (typeface != null) { setTypeface(typeface); } } }
public Typeface getFontBold(Context context, String langCode) { Typeface typeface = null; if (fontsBold != null && fontsBold.get(langCode) != null) { typeface = getTypeFaceForPath(context, fontsBold.get(langCode)); } if (typeface == null && fontDefault != null) { typeface = getTypeFaceForPath(context, fontDefault); } return typeface; }
protected void init(FontType fontType) { Typeface typeface = TypefaceUtil.getInstance().getTypeFace(getContext(), fontType); if (typeface != null) { setTypeface(typeface); } } }
public Typeface getFontThin(Context context, String langCode) { Typeface typeface = null; if (fontsThin != null && fontsThin.get(langCode) != null) { typeface = getTypeFaceForPath(context, fontsThin.get(langCode)); } if (typeface == null && fontDefault != null) { typeface = getTypeFaceForPath(context, fontDefault); } return typeface; }