package g.e.d.c;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.TypedValue;

/* JADX INFO: compiled from: ResourcesCompat.java */
/* JADX INFO: loaded from: classes.dex */
public final class f {

    /* JADX INFO: compiled from: ResourcesCompat.java */
    public static abstract class a {

        /* JADX INFO: renamed from: g.e.d.c.f$a$a, reason: collision with other inner class name */
        /* JADX INFO: compiled from: ResourcesCompat.java */
        class RunnableC0021a implements Runnable {
            final /* synthetic */ Typeface b;

            RunnableC0021a(Typeface typeface) {
                this.b = typeface;
            }

            @Override // java.lang.Runnable
            public void run() {
                a.this.d(this.b);
            }
        }

        /* JADX INFO: compiled from: ResourcesCompat.java */
        class b implements Runnable {
            final /* synthetic */ int b;

            b(int i2) {
                this.b = i2;
            }

            @Override // java.lang.Runnable
            public void run() {
                a.this.c(this.b);
            }
        }

        public final void a(int i2, Handler handler) {
            if (handler == null) {
                handler = new Handler(Looper.getMainLooper());
            }
            handler.post(new b(i2));
        }

        public final void b(Typeface typeface, Handler handler) {
            if (handler == null) {
                handler = new Handler(Looper.getMainLooper());
            }
            handler.post(new RunnableC0021a(typeface));
        }

        public abstract void c(int i2);

        public abstract void d(Typeface typeface);
    }

    public static Drawable a(Resources resources, int i2, Resources.Theme theme) throws Resources.NotFoundException {
        return Build.VERSION.SDK_INT >= 21 ? resources.getDrawable(i2, theme) : resources.getDrawable(i2);
    }

    public static Typeface b(Context context, int i2, TypedValue typedValue, int i3, a aVar) throws Resources.NotFoundException {
        if (context.isRestricted()) {
            return null;
        }
        return c(context, i2, typedValue, i3, aVar, null, true);
    }

    private static Typeface c(Context context, int i2, TypedValue typedValue, int i3, a aVar, Handler handler, boolean z) {
        Resources resources = context.getResources();
        resources.getValue(i2, typedValue, true);
        Typeface typefaceD = d(context, resources, typedValue, i2, i3, aVar, handler, z);
        if (typefaceD != null || aVar != null) {
            return typefaceD;
        }
        throw new Resources.NotFoundException("Font resource ID #0x" + Integer.toHexString(i2) + " could not be retrieved.");
    }

    /* JADX WARN: Removed duplicated region for block: B:35:0x00a3  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    private static android.graphics.Typeface d(android.content.Context r15, android.content.res.Resources r16, android.util.TypedValue r17, int r18, int r19, g.e.d.c.f.a r20, android.os.Handler r21, boolean r22) {
        /*
            Method dump skipped, instruction units count: 214
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.e.d.c.f.d(android.content.Context, android.content.res.Resources, android.util.TypedValue, int, int, g.e.d.c.f$a, android.os.Handler, boolean):android.graphics.Typeface");
    }
}
