Example #1
0
 public static <T extends View> T apply(T view, Font font) {
   if (view == null || font == null) {
     return view;
   }
   font.mContext = view.getContext();
   applyInternal(view, font);
   return view;
 }
Example #2
0
 @Override
 public Typeface getTypeface(String fontFamily, int fontStyle) {
   if (fontFamily == null) {
     fontFamily = DEFAULT_FONT_FAMILY;
   }
   for (int i = 0; i < mFonts.size(); i++) {
     Font font = mFonts.get(i);
     if ((mAllowAnyFontFamily || fontFamily.equals(font.mFontFamily))
         && font.mFontStyle == fontStyle) {
       return getTypeface(font, fontFamily, fontStyle);
     }
   }
   if (mDefaultFont != null) {
     mDefaultFont.mContext = getContext();
     return getTypeface(mDefaultFont, fontFamily, fontStyle);
   }
   return null;
 }
Example #3
0
 private Typeface getTypeface(Font font, String fontFamily, int fontStyle) {
   font.mContext = getContext();
   return font.getTypeface(fontFamily, fontStyle);
 }