581 lines
23 KiB
Java
581 lines
23 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.R;
|
|
import android.content.Context;
|
|
import android.content.res.ColorStateList;
|
|
import android.content.res.Resources;
|
|
import android.content.res.XmlResourceParser;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.PorterDuffColorFilter;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.LayerDrawable;
|
|
import android.os.Build;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.util.TypedValue;
|
|
import android.util.Xml;
|
|
import androidx.appcompat.R$attr;
|
|
import androidx.appcompat.R$color;
|
|
import androidx.appcompat.R$drawable;
|
|
import androidx.appcompat.content.res.AppCompatResources;
|
|
import androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat;
|
|
import androidx.collection.ArrayMap;
|
|
import androidx.collection.LongSparseArray;
|
|
import androidx.collection.LruCache;
|
|
import androidx.collection.SparseArrayCompat;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.core.graphics.ColorUtils;
|
|
import androidx.core.graphics.drawable.DrawableCompat;
|
|
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
|
|
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.WeakHashMap;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
import org.xmlpull.v1.XmlPullParserException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class AppCompatDrawableManager {
|
|
private static AppCompatDrawableManager h;
|
|
private WeakHashMap<Context, SparseArrayCompat<ColorStateList>> a;
|
|
private ArrayMap<String, InflateDelegate> b;
|
|
private SparseArrayCompat<String> c;
|
|
private final WeakHashMap<Context, LongSparseArray<WeakReference<Drawable.ConstantState>>> d = new WeakHashMap<>(0);
|
|
private TypedValue e;
|
|
private boolean f;
|
|
private static final PorterDuff.Mode g = PorterDuff.Mode.SRC_IN;
|
|
private static final ColorFilterLruCache i = new ColorFilterLruCache(6);
|
|
private static final int[] j = {R$drawable.abc_textfield_search_default_mtrl_alpha, R$drawable.abc_textfield_default_mtrl_alpha, R$drawable.abc_ab_share_pack_mtrl_alpha};
|
|
private static final int[] k = {R$drawable.abc_ic_commit_search_api_mtrl_alpha, R$drawable.abc_seekbar_tick_mark_material, R$drawable.abc_ic_menu_share_mtrl_alpha, R$drawable.abc_ic_menu_copy_mtrl_am_alpha, R$drawable.abc_ic_menu_cut_mtrl_alpha, R$drawable.abc_ic_menu_selectall_mtrl_alpha, R$drawable.abc_ic_menu_paste_mtrl_am_alpha};
|
|
private static final int[] l = {R$drawable.abc_textfield_activated_mtrl_alpha, R$drawable.abc_textfield_search_activated_mtrl_alpha, R$drawable.abc_cab_background_top_mtrl_alpha, R$drawable.abc_text_cursor_material, R$drawable.abc_text_select_handle_left_mtrl_dark, R$drawable.abc_text_select_handle_middle_mtrl_dark, R$drawable.abc_text_select_handle_right_mtrl_dark, R$drawable.abc_text_select_handle_left_mtrl_light, R$drawable.abc_text_select_handle_middle_mtrl_light, R$drawable.abc_text_select_handle_right_mtrl_light};
|
|
private static final int[] m = {R$drawable.abc_popup_background_mtrl_mult, R$drawable.abc_cab_background_internal_bg, R$drawable.abc_menu_hardkey_panel_mtrl_mult};
|
|
private static final int[] n = {R$drawable.abc_tab_indicator_material, R$drawable.abc_textfield_search_material};
|
|
private static final int[] o = {R$drawable.abc_btn_check_material, R$drawable.abc_btn_radio_material};
|
|
|
|
static class AsldcInflateDelegate implements InflateDelegate {
|
|
AsldcInflateDelegate() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatDrawableManager.InflateDelegate
|
|
public Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
|
try {
|
|
return AnimatedStateListDrawableCompat.b(context, context.getResources(), xmlPullParser, attributeSet, theme);
|
|
} catch (Exception e) {
|
|
Log.e("AsldcInflateDelegate", "Exception while inflating <animated-selector>", e);
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static class AvdcInflateDelegate implements InflateDelegate {
|
|
AvdcInflateDelegate() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatDrawableManager.InflateDelegate
|
|
public Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
|
try {
|
|
return AnimatedVectorDrawableCompat.a(context, context.getResources(), xmlPullParser, attributeSet, theme);
|
|
} catch (Exception e) {
|
|
Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e);
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static class ColorFilterLruCache extends LruCache<Integer, PorterDuffColorFilter> {
|
|
public ColorFilterLruCache(int i) {
|
|
super(i);
|
|
}
|
|
|
|
private static int b(int i, PorterDuff.Mode mode) {
|
|
return ((i + 31) * 31) + mode.hashCode();
|
|
}
|
|
|
|
PorterDuffColorFilter a(int i, PorterDuff.Mode mode) {
|
|
return b(Integer.valueOf(b(i, mode)));
|
|
}
|
|
|
|
PorterDuffColorFilter a(int i, PorterDuff.Mode mode, PorterDuffColorFilter porterDuffColorFilter) {
|
|
return a((ColorFilterLruCache) Integer.valueOf(b(i, mode)), (Integer) porterDuffColorFilter);
|
|
}
|
|
}
|
|
|
|
private interface InflateDelegate {
|
|
Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme);
|
|
}
|
|
|
|
private static class VdcInflateDelegate implements InflateDelegate {
|
|
VdcInflateDelegate() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatDrawableManager.InflateDelegate
|
|
public Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
|
try {
|
|
return VectorDrawableCompat.createFromXmlInner(context.getResources(), xmlPullParser, attributeSet, theme);
|
|
} catch (Exception e) {
|
|
Log.e("VdcInflateDelegate", "Exception while inflating <vector>", e);
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static synchronized AppCompatDrawableManager a() {
|
|
AppCompatDrawableManager appCompatDrawableManager;
|
|
synchronized (AppCompatDrawableManager.class) {
|
|
if (h == null) {
|
|
h = new AppCompatDrawableManager();
|
|
a(h);
|
|
}
|
|
appCompatDrawableManager = h;
|
|
}
|
|
return appCompatDrawableManager;
|
|
}
|
|
|
|
private ColorStateList c(Context context) {
|
|
return c(context, 0);
|
|
}
|
|
|
|
private Drawable d(Context context, int i2) {
|
|
if (this.e == null) {
|
|
this.e = new TypedValue();
|
|
}
|
|
TypedValue typedValue = this.e;
|
|
context.getResources().getValue(i2, typedValue, true);
|
|
long a = a(typedValue);
|
|
Drawable a2 = a(context, a);
|
|
if (a2 != null) {
|
|
return a2;
|
|
}
|
|
if (i2 == R$drawable.abc_cab_background_top_material) {
|
|
a2 = new LayerDrawable(new Drawable[]{a(context, R$drawable.abc_cab_background_internal_bg), a(context, R$drawable.abc_cab_background_top_mtrl_alpha)});
|
|
}
|
|
if (a2 != null) {
|
|
a2.setChangingConfigurations(typedValue.changingConfigurations);
|
|
a(context, a, a2);
|
|
}
|
|
return a2;
|
|
}
|
|
|
|
private ColorStateList e(Context context, int i2) {
|
|
SparseArrayCompat<ColorStateList> sparseArrayCompat;
|
|
WeakHashMap<Context, SparseArrayCompat<ColorStateList>> weakHashMap = this.a;
|
|
if (weakHashMap == null || (sparseArrayCompat = weakHashMap.get(context)) == null) {
|
|
return null;
|
|
}
|
|
return sparseArrayCompat.b(i2);
|
|
}
|
|
|
|
private Drawable f(Context context, int i2) {
|
|
int next;
|
|
ArrayMap<String, InflateDelegate> arrayMap = this.b;
|
|
if (arrayMap == null || arrayMap.isEmpty()) {
|
|
return null;
|
|
}
|
|
SparseArrayCompat<String> sparseArrayCompat = this.c;
|
|
if (sparseArrayCompat != null) {
|
|
String b = sparseArrayCompat.b(i2);
|
|
if ("appcompat_skip_skip".equals(b) || (b != null && this.b.get(b) == null)) {
|
|
return null;
|
|
}
|
|
} else {
|
|
this.c = new SparseArrayCompat<>();
|
|
}
|
|
if (this.e == null) {
|
|
this.e = new TypedValue();
|
|
}
|
|
TypedValue typedValue = this.e;
|
|
Resources resources = context.getResources();
|
|
resources.getValue(i2, typedValue, true);
|
|
long a = a(typedValue);
|
|
Drawable a2 = a(context, a);
|
|
if (a2 != null) {
|
|
return a2;
|
|
}
|
|
CharSequence charSequence = typedValue.string;
|
|
if (charSequence != null && charSequence.toString().endsWith(".xml")) {
|
|
try {
|
|
XmlResourceParser xml = resources.getXml(i2);
|
|
AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
|
|
do {
|
|
next = xml.next();
|
|
if (next == 2) {
|
|
break;
|
|
}
|
|
} while (next != 1);
|
|
if (next != 2) {
|
|
throw new XmlPullParserException("No start tag found");
|
|
}
|
|
String name = xml.getName();
|
|
this.c.a(i2, name);
|
|
InflateDelegate inflateDelegate = this.b.get(name);
|
|
if (inflateDelegate != null) {
|
|
a2 = inflateDelegate.a(context, xml, asAttributeSet, context.getTheme());
|
|
}
|
|
if (a2 != null) {
|
|
a2.setChangingConfigurations(typedValue.changingConfigurations);
|
|
a(context, a, a2);
|
|
}
|
|
} catch (Exception e) {
|
|
Log.e("AppCompatDrawableManag", "Exception while inflating drawable", e);
|
|
}
|
|
}
|
|
if (a2 == null) {
|
|
this.c.a(i2, "appcompat_skip_skip");
|
|
}
|
|
return a2;
|
|
}
|
|
|
|
synchronized ColorStateList b(Context context, int i2) {
|
|
ColorStateList e;
|
|
e = e(context, i2);
|
|
if (e == null) {
|
|
if (i2 == R$drawable.abc_edit_text_material) {
|
|
e = AppCompatResources.b(context, R$color.abc_tint_edittext);
|
|
} else if (i2 == R$drawable.abc_switch_track_mtrl_alpha) {
|
|
e = AppCompatResources.b(context, R$color.abc_tint_switch_track);
|
|
} else if (i2 == R$drawable.abc_switch_thumb_material) {
|
|
e = f(context);
|
|
} else if (i2 == R$drawable.abc_btn_default_mtrl_shape) {
|
|
e = e(context);
|
|
} else if (i2 == R$drawable.abc_btn_borderless_material) {
|
|
e = c(context);
|
|
} else if (i2 == R$drawable.abc_btn_colored_material) {
|
|
e = d(context);
|
|
} else {
|
|
if (i2 != R$drawable.abc_spinner_mtrl_am_alpha && i2 != R$drawable.abc_spinner_textfield_background_material) {
|
|
if (a(k, i2)) {
|
|
e = ThemeUtils.c(context, R$attr.colorControlNormal);
|
|
} else if (a(n, i2)) {
|
|
e = AppCompatResources.b(context, R$color.abc_tint_default);
|
|
} else if (a(o, i2)) {
|
|
e = AppCompatResources.b(context, R$color.abc_tint_btn_checkable);
|
|
} else if (i2 == R$drawable.abc_seekbar_thumb_material) {
|
|
e = AppCompatResources.b(context, R$color.abc_tint_seek_thumb);
|
|
}
|
|
}
|
|
e = AppCompatResources.b(context, R$color.abc_tint_spinner);
|
|
}
|
|
if (e != null) {
|
|
a(context, i2, e);
|
|
}
|
|
}
|
|
return e;
|
|
}
|
|
|
|
private ColorStateList c(Context context, int i2) {
|
|
int b = ThemeUtils.b(context, R$attr.colorControlHighlight);
|
|
return new ColorStateList(new int[][]{ThemeUtils.b, ThemeUtils.d, ThemeUtils.c, ThemeUtils.f}, new int[]{ThemeUtils.a(context, R$attr.colorButtonNormal), ColorUtils.b(b, i2), ColorUtils.b(b, i2), i2});
|
|
}
|
|
|
|
private ColorStateList e(Context context) {
|
|
return c(context, ThemeUtils.b(context, R$attr.colorButtonNormal));
|
|
}
|
|
|
|
private static void a(AppCompatDrawableManager appCompatDrawableManager) {
|
|
if (Build.VERSION.SDK_INT < 24) {
|
|
appCompatDrawableManager.a("vector", new VdcInflateDelegate());
|
|
appCompatDrawableManager.a("animated-vector", new AvdcInflateDelegate());
|
|
appCompatDrawableManager.a("animated-selector", new AsldcInflateDelegate());
|
|
}
|
|
}
|
|
|
|
public synchronized Drawable a(Context context, int i2) {
|
|
return a(context, i2, false);
|
|
}
|
|
|
|
synchronized Drawable a(Context context, int i2, boolean z) {
|
|
Drawable f;
|
|
b(context);
|
|
f = f(context, i2);
|
|
if (f == null) {
|
|
f = d(context, i2);
|
|
}
|
|
if (f == null) {
|
|
f = ContextCompat.c(context, i2);
|
|
}
|
|
if (f != null) {
|
|
f = a(context, i2, z, f);
|
|
}
|
|
if (f != null) {
|
|
DrawableUtils.b(f);
|
|
}
|
|
return f;
|
|
}
|
|
|
|
private ColorStateList d(Context context) {
|
|
return c(context, ThemeUtils.b(context, R$attr.colorAccent));
|
|
}
|
|
|
|
public synchronized void a(Context context) {
|
|
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.d.get(context);
|
|
if (longSparseArray != null) {
|
|
longSparseArray.a();
|
|
}
|
|
}
|
|
|
|
private static long a(TypedValue typedValue) {
|
|
return (typedValue.assetCookie << 32) | typedValue.data;
|
|
}
|
|
|
|
private Drawable a(Context context, int i2, boolean z, Drawable drawable) {
|
|
ColorStateList b = b(context, i2);
|
|
if (b != null) {
|
|
if (DrawableUtils.a(drawable)) {
|
|
drawable = drawable.mutate();
|
|
}
|
|
Drawable h2 = DrawableCompat.h(drawable);
|
|
DrawableCompat.a(h2, b);
|
|
PorterDuff.Mode a = a(i2);
|
|
if (a == null) {
|
|
return h2;
|
|
}
|
|
DrawableCompat.a(h2, a);
|
|
return h2;
|
|
}
|
|
if (i2 == R$drawable.abc_seekbar_track_material) {
|
|
LayerDrawable layerDrawable = (LayerDrawable) drawable;
|
|
a(layerDrawable.findDrawableByLayerId(R.id.background), ThemeUtils.b(context, R$attr.colorControlNormal), g);
|
|
a(layerDrawable.findDrawableByLayerId(R.id.secondaryProgress), ThemeUtils.b(context, R$attr.colorControlNormal), g);
|
|
a(layerDrawable.findDrawableByLayerId(R.id.progress), ThemeUtils.b(context, R$attr.colorControlActivated), g);
|
|
return drawable;
|
|
}
|
|
if (i2 != R$drawable.abc_ratingbar_material && i2 != R$drawable.abc_ratingbar_indicator_material && i2 != R$drawable.abc_ratingbar_small_material) {
|
|
if (a(context, i2, drawable) || !z) {
|
|
return drawable;
|
|
}
|
|
return null;
|
|
}
|
|
LayerDrawable layerDrawable2 = (LayerDrawable) drawable;
|
|
a(layerDrawable2.findDrawableByLayerId(R.id.background), ThemeUtils.a(context, R$attr.colorControlNormal), g);
|
|
a(layerDrawable2.findDrawableByLayerId(R.id.secondaryProgress), ThemeUtils.b(context, R$attr.colorControlActivated), g);
|
|
a(layerDrawable2.findDrawableByLayerId(R.id.progress), ThemeUtils.b(context, R$attr.colorControlActivated), g);
|
|
return drawable;
|
|
}
|
|
|
|
private void b(Context context) {
|
|
if (this.f) {
|
|
return;
|
|
}
|
|
this.f = true;
|
|
Drawable a = a(context, R$drawable.abc_vector_test);
|
|
if (a == null || !a(a)) {
|
|
this.f = false;
|
|
throw new IllegalStateException("This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.");
|
|
}
|
|
}
|
|
|
|
private ColorStateList f(Context context) {
|
|
int[][] iArr = new int[3][];
|
|
int[] iArr2 = new int[3];
|
|
ColorStateList c = ThemeUtils.c(context, R$attr.colorSwitchThumbNormal);
|
|
if (c != null && c.isStateful()) {
|
|
iArr[0] = ThemeUtils.b;
|
|
iArr2[0] = c.getColorForState(iArr[0], 0);
|
|
iArr[1] = ThemeUtils.e;
|
|
iArr2[1] = ThemeUtils.b(context, R$attr.colorControlActivated);
|
|
iArr[2] = ThemeUtils.f;
|
|
iArr2[2] = c.getDefaultColor();
|
|
} else {
|
|
iArr[0] = ThemeUtils.b;
|
|
iArr2[0] = ThemeUtils.a(context, R$attr.colorSwitchThumbNormal);
|
|
iArr[1] = ThemeUtils.e;
|
|
iArr2[1] = ThemeUtils.b(context, R$attr.colorControlActivated);
|
|
iArr[2] = ThemeUtils.f;
|
|
iArr2[2] = ThemeUtils.b(context, R$attr.colorSwitchThumbNormal);
|
|
}
|
|
return new ColorStateList(iArr, iArr2);
|
|
}
|
|
|
|
private synchronized Drawable a(Context context, long j2) {
|
|
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.d.get(context);
|
|
if (longSparseArray == null) {
|
|
return null;
|
|
}
|
|
WeakReference<Drawable.ConstantState> b = longSparseArray.b(j2);
|
|
if (b != null) {
|
|
Drawable.ConstantState constantState = b.get();
|
|
if (constantState != null) {
|
|
return constantState.newDrawable(context.getResources());
|
|
}
|
|
longSparseArray.a(j2);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private synchronized boolean a(Context context, long j2, Drawable drawable) {
|
|
Drawable.ConstantState constantState = drawable.getConstantState();
|
|
if (constantState == null) {
|
|
return false;
|
|
}
|
|
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.d.get(context);
|
|
if (longSparseArray == null) {
|
|
longSparseArray = new LongSparseArray<>();
|
|
this.d.put(context, longSparseArray);
|
|
}
|
|
longSparseArray.c(j2, new WeakReference<>(constantState));
|
|
return true;
|
|
}
|
|
|
|
synchronized Drawable a(Context context, VectorEnabledTintResources vectorEnabledTintResources, int i2) {
|
|
Drawable f = f(context, i2);
|
|
if (f == null) {
|
|
f = vectorEnabledTintResources.a(i2);
|
|
}
|
|
if (f == null) {
|
|
return null;
|
|
}
|
|
return a(context, i2, false, f);
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:14:0x0061 A[RETURN] */
|
|
/* JADX WARN: Removed duplicated region for block: B:6:0x0046 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
static boolean a(android.content.Context r6, int r7, android.graphics.drawable.Drawable r8) {
|
|
/*
|
|
android.graphics.PorterDuff$Mode r0 = androidx.appcompat.widget.AppCompatDrawableManager.g
|
|
int[] r1 = androidx.appcompat.widget.AppCompatDrawableManager.j
|
|
boolean r1 = a(r1, r7)
|
|
r2 = 16842801(0x1010031, float:2.3693695E-38)
|
|
r3 = -1
|
|
r4 = 0
|
|
r5 = 1
|
|
if (r1 == 0) goto L15
|
|
int r2 = androidx.appcompat.R$attr.colorControlNormal
|
|
L12:
|
|
r7 = 1
|
|
r1 = -1
|
|
goto L44
|
|
L15:
|
|
int[] r1 = androidx.appcompat.widget.AppCompatDrawableManager.l
|
|
boolean r1 = a(r1, r7)
|
|
if (r1 == 0) goto L20
|
|
int r2 = androidx.appcompat.R$attr.colorControlActivated
|
|
goto L12
|
|
L20:
|
|
int[] r1 = androidx.appcompat.widget.AppCompatDrawableManager.m
|
|
boolean r1 = a(r1, r7)
|
|
if (r1 == 0) goto L2b
|
|
android.graphics.PorterDuff$Mode r0 = android.graphics.PorterDuff.Mode.MULTIPLY
|
|
goto L12
|
|
L2b:
|
|
int r1 = androidx.appcompat.R$drawable.abc_list_divider_mtrl_alpha
|
|
if (r7 != r1) goto L3c
|
|
r2 = 16842800(0x1010030, float:2.3693693E-38)
|
|
r7 = 1109603123(0x42233333, float:40.8)
|
|
int r7 = java.lang.Math.round(r7)
|
|
r1 = r7
|
|
r7 = 1
|
|
goto L44
|
|
L3c:
|
|
int r1 = androidx.appcompat.R$drawable.abc_dialog_material_background
|
|
if (r7 != r1) goto L41
|
|
goto L12
|
|
L41:
|
|
r7 = 0
|
|
r1 = -1
|
|
r2 = 0
|
|
L44:
|
|
if (r7 == 0) goto L61
|
|
boolean r7 = androidx.appcompat.widget.DrawableUtils.a(r8)
|
|
if (r7 == 0) goto L50
|
|
android.graphics.drawable.Drawable r8 = r8.mutate()
|
|
L50:
|
|
int r6 = androidx.appcompat.widget.ThemeUtils.b(r6, r2)
|
|
android.graphics.PorterDuffColorFilter r6 = a(r6, r0)
|
|
r8.setColorFilter(r6)
|
|
if (r1 == r3) goto L60
|
|
r8.setAlpha(r1)
|
|
L60:
|
|
return r5
|
|
L61:
|
|
return r4
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatDrawableManager.a(android.content.Context, int, android.graphics.drawable.Drawable):boolean");
|
|
}
|
|
|
|
private void a(String str, InflateDelegate inflateDelegate) {
|
|
if (this.b == null) {
|
|
this.b = new ArrayMap<>();
|
|
}
|
|
this.b.put(str, inflateDelegate);
|
|
}
|
|
|
|
private static boolean a(int[] iArr, int i2) {
|
|
for (int i3 : iArr) {
|
|
if (i3 == i2) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
static PorterDuff.Mode a(int i2) {
|
|
if (i2 == R$drawable.abc_switch_thumb_material) {
|
|
return PorterDuff.Mode.MULTIPLY;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private void a(Context context, int i2, ColorStateList colorStateList) {
|
|
if (this.a == null) {
|
|
this.a = new WeakHashMap<>();
|
|
}
|
|
SparseArrayCompat<ColorStateList> sparseArrayCompat = this.a.get(context);
|
|
if (sparseArrayCompat == null) {
|
|
sparseArrayCompat = new SparseArrayCompat<>();
|
|
this.a.put(context, sparseArrayCompat);
|
|
}
|
|
sparseArrayCompat.a(i2, colorStateList);
|
|
}
|
|
|
|
static void a(Drawable drawable, TintInfo tintInfo, int[] iArr) {
|
|
if (DrawableUtils.a(drawable) && drawable.mutate() != drawable) {
|
|
Log.d("AppCompatDrawableManag", "Mutated drawable is not the same instance as the input.");
|
|
return;
|
|
}
|
|
if (tintInfo.d || tintInfo.c) {
|
|
drawable.setColorFilter(a(tintInfo.d ? tintInfo.a : null, tintInfo.c ? tintInfo.b : g, iArr));
|
|
} else {
|
|
drawable.clearColorFilter();
|
|
}
|
|
if (Build.VERSION.SDK_INT <= 23) {
|
|
drawable.invalidateSelf();
|
|
}
|
|
}
|
|
|
|
private static PorterDuffColorFilter a(ColorStateList colorStateList, PorterDuff.Mode mode, int[] iArr) {
|
|
if (colorStateList == null || mode == null) {
|
|
return null;
|
|
}
|
|
return a(colorStateList.getColorForState(iArr, 0), mode);
|
|
}
|
|
|
|
public static synchronized PorterDuffColorFilter a(int i2, PorterDuff.Mode mode) {
|
|
PorterDuffColorFilter a;
|
|
synchronized (AppCompatDrawableManager.class) {
|
|
a = i.a(i2, mode);
|
|
if (a == null) {
|
|
a = new PorterDuffColorFilter(i2, mode);
|
|
i.a(i2, mode, a);
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
private static void a(Drawable drawable, int i2, PorterDuff.Mode mode) {
|
|
if (DrawableUtils.a(drawable)) {
|
|
drawable = drawable.mutate();
|
|
}
|
|
if (mode == null) {
|
|
mode = g;
|
|
}
|
|
drawable.setColorFilter(a(i2, mode));
|
|
}
|
|
|
|
private static boolean a(Drawable drawable) {
|
|
return (drawable instanceof VectorDrawableCompat) || "android.graphics.drawable.VectorDrawable".equals(drawable.getClass().getName());
|
|
}
|
|
}
|