package l;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.TypedValue;
import androidx.annotation.Nullable;
import androidx.annotation.StyleableRes;

/* JADX INFO: loaded from: classes.dex */
public final class p3 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Context f29808a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final TypedArray f29809b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public TypedValue f29810c;

    public p3(Context context, TypedArray typedArray) {
        this.f29808a = context;
        this.f29809b = typedArray;
    }

    public static p3 d(Context context, AttributeSet attributeSet, int[] iArr, int i10) {
        return new p3(context, context.obtainStyledAttributes(attributeSet, iArr, i10, 0));
    }

    public final ColorStateList a(int i10) {
        int resourceId;
        ColorStateList colorStateList;
        TypedArray typedArray = this.f29809b;
        return (!typedArray.hasValue(i10) || (resourceId = typedArray.getResourceId(i10, 0)) == 0 || (colorStateList = g0.d.getColorStateList(this.f29808a, resourceId)) == null) ? typedArray.getColorStateList(i10) : colorStateList;
    }

    public final Drawable b(int i10) {
        int resourceId;
        TypedArray typedArray = this.f29809b;
        return (!typedArray.hasValue(i10) || (resourceId = typedArray.getResourceId(i10, 0)) == 0) ? typedArray.getDrawable(i10) : f.a.getDrawable(this.f29808a, resourceId);
    }

    public final Drawable c(int i10) {
        int resourceId;
        Drawable drawableF;
        if (!this.f29809b.hasValue(i10) || (resourceId = this.f29809b.getResourceId(i10, 0)) == 0) {
            return null;
        }
        c0 c0VarA = c0.a();
        Context context = this.f29808a;
        synchronized (c0VarA) {
            drawableF = c0VarA.f29657a.f(context, resourceId, true);
        }
        return drawableF;
    }

    public final void e() {
        this.f29809b.recycle();
    }

    @Nullable
    public Typeface getFont(@StyleableRes int i10, int i11, @Nullable i0.p pVar) {
        int resourceId = this.f29809b.getResourceId(i10, 0);
        if (resourceId == 0) {
            return null;
        }
        if (this.f29810c == null) {
            this.f29810c = new TypedValue();
        }
        return i0.r.getFont(this.f29808a, resourceId, this.f29810c, i11, pVar);
    }
}
