@Test public void testCreateFromResourcesFontFile() { Typeface typeface = TypefaceCompat.createFromResourcesFontFile(mContext, mResources, R.font.large_a, "res/font/large_a.ttf", Typeface.NORMAL); assertNotNull(typeface); Typeface cachedTypeface = TypefaceCompat.findFromCache( mResources, R.font.large_a, Typeface.NORMAL); assertNotNull(cachedTypeface); assertEquals(typeface, cachedTypeface); assertEquals(R.font.large_a, getSelectedFontResourceId(typeface)); typeface = TypefaceCompat.createFromResourcesFontFile(mContext, mResources, R.font.large_b, "res/font/large_b.ttf", Typeface.NORMAL); assertNotNull(typeface); cachedTypeface = TypefaceCompat.findFromCache( mResources, R.font.large_b, Typeface.NORMAL); assertNotNull(cachedTypeface); assertEquals(typeface, cachedTypeface); assertEquals(R.font.large_b, getSelectedFontResourceId(typeface)); }
@Nullable public static Typeface createFromResourcesFontFile( @NonNull Context context, @NonNull Resources resources, int id, String path, int style) { Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile( context, resources, id, path, style); if (typeface != null) { final String resourceUid = createResourceUid(resources, id, style); sTypefaceCache.put(resourceUid, typeface); } return typeface; }
TypefaceCompat { @Nullable public static Typeface createFromResourcesFontFile( @NonNull Context context, @NonNull Resources resources, int id, String path, int style) { Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile( context, resources, id, path, style); if (typeface != null) { final String resourceUid = createResourceUid(resources, id, style); sTypefaceCache.put(resourceUid, typeface); } return typeface; } }
TypefaceCompat { @Nullable public static Typeface createFromResourcesFontFile( @NonNull Context context, @NonNull Resources resources, int id, String path, int style) { Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile( context, resources, id, path, style); if (typeface != null) { final String resourceUid = createResourceUid(resources, id, style); sTypefaceCache.put(resourceUid, typeface); } return typeface; } private  TypefaceCompat(); }
TypefaceCompat { @Nullable public static Typeface createFromResourcesFontFile( @NonNull Context context, @NonNull Resources resources, int id, String path, int style) { Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile( context, resources, id, path, style); if (typeface != null) { final String resourceUid = createResourceUid(resources, id, style); sTypefaceCache.put(resourceUid, typeface); } return typeface; } private  TypefaceCompat(); @Nullable static Typeface findFromCache(@NonNull Resources resources, int id, int style); @Nullable static Typeface createFromResourcesFamilyXml(
            @NonNull Context context, @NonNull FamilyResourceEntry entry,
            @NonNull Resources resources, int id, int style,
            @Nullable ResourcesCompat.FontCallback fontCallback, @Nullable Handler handler,
            boolean isRequestFromLayoutInflator); @Nullable static Typeface createFromResourcesFontFile(
            @NonNull Context context, @NonNull Resources resources, int id, String path,
            int style); @Nullable static Typeface createFromFontInfo(@NonNull Context context,
            @Nullable CancellationSignal cancellationSignal, @NonNull FontInfo[] fonts, int style); }
TypefaceCompat { @Nullable public static Typeface createFromResourcesFontFile( @NonNull Context context, @NonNull Resources resources, int id, String path, int style) { Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile( context, resources, id, path, style); if (typeface != null) { final String resourceUid = createResourceUid(resources, id, style); sTypefaceCache.put(resourceUid, typeface); } return typeface; } private  TypefaceCompat(); @Nullable static Typeface findFromCache(@NonNull Resources resources, int id, int style); @Nullable static Typeface createFromResourcesFamilyXml(
            @NonNull Context context, @NonNull FamilyResourceEntry entry,
            @NonNull Resources resources, int id, int style,
            @Nullable ResourcesCompat.FontCallback fontCallback, @Nullable Handler handler,
            boolean isRequestFromLayoutInflator); @Nullable static Typeface createFromResourcesFontFile(
            @NonNull Context context, @NonNull Resources resources, int id, String path,
            int style); @Nullable static Typeface createFromFontInfo(@NonNull Context context,
            @Nullable CancellationSignal cancellationSignal, @NonNull FontInfo[] fonts, int style);  }