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<>();
    static final int[] b = {-16842910};
    static final int[] c = {R.attr.state_focused};
    static final int[] d = {R.attr.state_pressed};
    static final int[] e = {R.attr.state_checked};
    static final int[] f = new int[0];

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

    public static int a(Context context, int i2) {
        ColorStateList colorStateListD = d(context, i2);
        if (colorStateListD != null && colorStateListD.isStateful()) {
            return colorStateListD.getColorForState(b, 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 = f194g;
        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 g.e.e.a.d(b(context, i2), Math.round(Color.alpha(r0) * f2));
    }

    public static ColorStateList d(Context context, int i2) {
        int[] iArr = f194g;
        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;
    }
}
