package androidx.appcompat.widget;

import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.util.TypedValue;

/* JADX INFO: compiled from: ThemeUtils.java */
/* JADX INFO: loaded from: classes.dex */
class o0 {
    private static final ThreadLocal<TypedValue> a = new ThreadLocal<>();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    static final int[] f480b = {-16842910};

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    static final int[] f481c = {R.attr.state_focused};

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    static final int[] f482d = {R.attr.state_pressed};

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    static final int[] f483e = {R.attr.state_checked};

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    static final int[] f484f = new int[0];

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private static final int[] f485g = new int[1];

    public static int a(Context context, int i2) {
        ColorStateList colorStateListD = d(context, i2);
        if (colorStateListD != null && colorStateListD.isStateful()) {
            return colorStateListD.getColorForState(f480b, colorStateListD.getDefaultColor());
        }
        TypedValue typedValueE = e();
        context.getTheme().resolveAttribute(R.attr.disabledAlpha, typedValueE, true);
        return c(context, i2, typedValueE.getFloat());
    }

    public static int b(Context context, int i2) {
        int[] iArr = f485g;
        iArr[0] = i2;
        t0 t0VarS = t0.s(context, null, iArr);
        try {
            return t0VarS.b(0, 0);
        } finally {
            t0VarS.u();
        }
    }

    static int c(Context context, int i2, float f2) {
        return c.f.e.a.d(b(context, i2), Math.round(Color.alpha(r0) * f2));
    }

    public static ColorStateList d(Context context, int i2) {
        int[] iArr = f485g;
        iArr[0] = i2;
        t0 t0VarS = t0.s(context, null, iArr);
        try {
            return t0VarS.c(0);
        } finally {
            t0VarS.u();
        }
    }

    private static TypedValue e() {
        TypedValue typedValue = a.get();
        if (typedValue != null) {
            return typedValue;
        }
        TypedValue typedValue2 = new TypedValue();
        a.set(typedValue2);
        return typedValue2;
    }
}
