package q; import android.content.Context; import android.content.res.Resources; import android.graphics.Typeface; import android.os.Build; import android.os.CancellationSignal; import android.os.Handler; import p.e; import p.h; import w.f; /* loaded from: classes.dex */ public abstract class i { /* renamed from: a, reason: collision with root package name */ private static final o f13302a; /* renamed from: b, reason: collision with root package name */ private static final androidx.collection.e f13303b; public static class a extends f.c { /* renamed from: a, reason: collision with root package name */ private h.d f13304a; public a(h.d dVar) { this.f13304a = dVar; } @Override // w.f.c public void a(int i10) { h.d dVar = this.f13304a; if (dVar != null) { dVar.d(i10); } } @Override // w.f.c public void b(Typeface typeface) { h.d dVar = this.f13304a; if (dVar != null) { dVar.e(typeface); } } } static { int i10 = Build.VERSION.SDK_INT; if (i10 >= 29) { f13302a = new n(); } else if (i10 >= 28) { f13302a = new m(); } else if (i10 >= 26) { f13302a = new l(); } else if (i10 < 24 || !k.i()) { f13302a = new j(); } else { f13302a = new k(); } f13303b = new androidx.collection.e(16); } public static Typeface a(Context context, Typeface typeface, int i10) { if (context != null) { return Typeface.create(typeface, i10); } throw new IllegalArgumentException("Context cannot be null"); } public static Typeface b(Context context, CancellationSignal cancellationSignal, f.b[] bVarArr, int i10) { return f13302a.b(context, cancellationSignal, bVarArr, i10); } public static Typeface c(Context context, e.a aVar, Resources resources, int i10, int i11, h.d dVar, Handler handler, boolean z10) { Typeface a10; if (aVar instanceof e.d) { e.d dVar2 = (e.d) aVar; Typeface g10 = g(dVar2.c()); if (g10 != null) { if (dVar != null) { dVar.b(g10, handler); } return g10; } a10 = w.f.a(context, dVar2.b(), i11, !z10 ? dVar != null : dVar2.a() != 0, z10 ? dVar2.d() : -1, h.d.c(handler), new a(dVar)); } else { a10 = f13302a.a(context, (e.b) aVar, resources, i11); if (dVar != null) { if (a10 != null) { dVar.b(a10, handler); } else { dVar.a(-3, handler); } } } if (a10 != null) { f13303b.put(e(resources, i10, i11), a10); } return a10; } public static Typeface d(Context context, Resources resources, int i10, String str, int i11) { Typeface d10 = f13302a.d(context, resources, i10, str, i11); if (d10 != null) { f13303b.put(e(resources, i10, i11), d10); } return d10; } private static String e(Resources resources, int i10, int i11) { return resources.getResourcePackageName(i10) + "-" + i10 + "-" + i11; } public static Typeface f(Resources resources, int i10, int i11) { return (Typeface) f13303b.get(e(resources, i10, i11)); } private static Typeface g(String str) { if (str == null || str.isEmpty()) { return null; } Typeface create = Typeface.create(str, 0); Typeface create2 = Typeface.create(Typeface.DEFAULT, 0); if (create == null || create.equals(create2)) { return null; } return create; } }