76 lines
2.1 KiB
Java
76 lines
2.1 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.R;
|
|
import android.content.Context;
|
|
import android.content.res.ColorStateList;
|
|
import android.graphics.Color;
|
|
import android.util.AttributeSet;
|
|
import android.util.TypedValue;
|
|
import androidx.core.graphics.ColorUtils;
|
|
|
|
/* loaded from: classes.dex */
|
|
class ThemeUtils {
|
|
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;
|
|
static final int[] e;
|
|
static final int[] f;
|
|
private static final int[] g;
|
|
|
|
static {
|
|
new int[1][0] = 16843518;
|
|
d = new int[]{R.attr.state_pressed};
|
|
e = new int[]{R.attr.state_checked};
|
|
new int[1][0] = 16842913;
|
|
f = new int[0];
|
|
g = new int[1];
|
|
}
|
|
|
|
public static int a(Context context, int i) {
|
|
ColorStateList c2 = c(context, i);
|
|
if (c2 != null && c2.isStateful()) {
|
|
return c2.getColorForState(b, c2.getDefaultColor());
|
|
}
|
|
TypedValue a2 = a();
|
|
context.getTheme().resolveAttribute(R.attr.disabledAlpha, a2, true);
|
|
return a(context, i, a2.getFloat());
|
|
}
|
|
|
|
public static int b(Context context, int i) {
|
|
int[] iArr = g;
|
|
iArr[0] = i;
|
|
TintTypedArray a2 = TintTypedArray.a(context, (AttributeSet) null, iArr);
|
|
try {
|
|
return a2.a(0, 0);
|
|
} finally {
|
|
a2.a();
|
|
}
|
|
}
|
|
|
|
public static ColorStateList c(Context context, int i) {
|
|
int[] iArr = g;
|
|
iArr[0] = i;
|
|
TintTypedArray a2 = TintTypedArray.a(context, (AttributeSet) null, iArr);
|
|
try {
|
|
return a2.a(0);
|
|
} finally {
|
|
a2.a();
|
|
}
|
|
}
|
|
|
|
private static TypedValue a() {
|
|
TypedValue typedValue = a.get();
|
|
if (typedValue != null) {
|
|
return typedValue;
|
|
}
|
|
TypedValue typedValue2 = new TypedValue();
|
|
a.set(typedValue2);
|
|
return typedValue2;
|
|
}
|
|
|
|
static int a(Context context, int i, float f2) {
|
|
return ColorUtils.c(b(context, i), Math.round(Color.alpha(r0) * f2));
|
|
}
|
|
}
|