AppCompatResources.java
4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package android.support.v7.content.res;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.AppCompatDrawableManager;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import fp;
import java.util.WeakHashMap;
import org.xmlpull.v1.XmlPullParser;
public final class AppCompatResources
{
private static final ThreadLocal<TypedValue> a = new ThreadLocal();
private static final WeakHashMap<Context, SparseArray<a>> b = new WeakHashMap(0);
private static final Object c = new Object();
@Nullable
private static ColorStateList a(Context paramContext, int paramInt)
{
Resources localResources = paramContext.getResources();
Object localObject2 = (TypedValue)a.get();
Object localObject1 = localObject2;
if (localObject2 == null)
{
localObject1 = new TypedValue();
a.set(localObject1);
}
localResources.getValue(paramInt, (TypedValue)localObject1, true);
if ((((TypedValue)localObject1).type >= 28) && (((TypedValue)localObject1).type <= 31)) {}
for (int i = 1; i != 0; i = 0) {
return null;
}
localObject1 = paramContext.getResources();
localObject2 = ((Resources)localObject1).getXml(paramInt);
try
{
paramContext = fp.a((Resources)localObject1, (XmlPullParser)localObject2, paramContext.getTheme());
return paramContext;
}
catch (Exception paramContext)
{
Log.e("AppCompatResources", "Failed to inflate ColorStateList, leaving it to the framework", paramContext);
}
return null;
}
@Nullable
private static ColorStateList b(@NonNull Context paramContext, @ColorRes int paramInt)
{
synchronized (c)
{
SparseArray localSparseArray = (SparseArray)b.get(paramContext);
if ((localSparseArray != null) && (localSparseArray.size() > 0))
{
a locala = (a)localSparseArray.get(paramInt);
if (locala != null)
{
if (locala.b.equals(paramContext.getResources().getConfiguration()))
{
paramContext = locala.a;
return paramContext;
}
localSparseArray.remove(paramInt);
}
}
return null;
}
}
public static ColorStateList getColorStateList(@NonNull Context paramContext, @ColorRes int paramInt)
{
Object localObject1;
if (Build.VERSION.SDK_INT >= 23) {
localObject1 = paramContext.getColorStateList(paramInt);
}
Object localObject2;
do
{
return (ColorStateList)localObject1;
localObject2 = b(paramContext, paramInt);
localObject1 = localObject2;
} while (localObject2 != null);
ColorStateList localColorStateList = a(paramContext, paramInt);
if (localColorStateList != null) {
synchronized (c)
{
localObject2 = (SparseArray)b.get(paramContext);
localObject1 = localObject2;
if (localObject2 == null)
{
localObject1 = new SparseArray();
b.put(paramContext, localObject1);
}
((SparseArray)localObject1).append(paramInt, new a(localColorStateList, paramContext.getResources().getConfiguration()));
return localColorStateList;
}
}
return ContextCompat.getColorStateList(paramContext, paramInt);
}
@Nullable
public static Drawable getDrawable(@NonNull Context paramContext, @DrawableRes int paramInt)
{
return AppCompatDrawableManager.get().getDrawable(paramContext, paramInt);
}
static final class a
{
final ColorStateList a;
final Configuration b;
a(@NonNull ColorStateList paramColorStateList, @NonNull Configuration paramConfiguration)
{
this.a = paramColorStateList;
this.b = paramConfiguration;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/content/res/AppCompatResources.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/