gv.java
8.54 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
import android.annotation.TargetApi;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Path.FillType;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.Drawable;
import android.support.annotation.RequiresApi;
import android.support.v7.cardview.R.color;
import android.support.v7.cardview.R.dimen;
@TargetApi(9)
@RequiresApi(9)
final class gv
extends Drawable
{
static final double a = Math.cos(Math.toRadians(45.0D));
static gv.a c;
final int b;
Paint d;
Paint e;
Paint f;
final RectF g;
float h;
Path i;
float j;
float k;
float l;
float m;
ColorStateList n;
boolean o = true;
private final int p;
private final int q;
private boolean r = true;
private boolean s = false;
gv(Resources paramResources, ColorStateList paramColorStateList, float paramFloat1, float paramFloat2, float paramFloat3)
{
this.p = paramResources.getColor(R.color.cardview_shadow_start_color);
this.q = paramResources.getColor(R.color.cardview_shadow_end_color);
this.b = paramResources.getDimensionPixelSize(R.dimen.cardview_compat_inset_shadow);
this.d = new Paint(5);
a(paramColorStateList);
this.e = new Paint(5);
this.e.setStyle(Paint.Style.FILL);
this.h = ((int)(0.5F + paramFloat1));
this.g = new RectF();
this.f = new Paint(this.e);
this.f.setAntiAlias(false);
a(paramFloat2, paramFloat3);
}
static float a(float paramFloat1, float paramFloat2, boolean paramBoolean)
{
if (paramBoolean) {
return (float)(1.5F * paramFloat1 + (1.0D - a) * paramFloat2);
}
return 1.5F * paramFloat1;
}
private static int a(float paramFloat)
{
int i2 = (int)(0.5F + paramFloat);
int i1 = i2;
if (i2 % 2 == 1) {
i1 = i2 - 1;
}
return i1;
}
static float b(float paramFloat1, float paramFloat2, boolean paramBoolean)
{
float f1 = paramFloat1;
if (paramBoolean) {
f1 = (float)(paramFloat1 + (1.0D - a) * paramFloat2);
}
return f1;
}
final void a(float paramFloat1, float paramFloat2)
{
if (paramFloat1 < 0.0F) {
throw new IllegalArgumentException("Invalid shadow size " + paramFloat1 + ". Must be >= 0");
}
if (paramFloat2 < 0.0F) {
throw new IllegalArgumentException("Invalid max shadow size " + paramFloat2 + ". Must be >= 0");
}
float f1 = a(paramFloat1);
paramFloat2 = a(paramFloat2);
paramFloat1 = f1;
if (f1 > paramFloat2)
{
if (!this.s) {
this.s = true;
}
paramFloat1 = paramFloat2;
}
if ((this.m == paramFloat1) && (this.k == paramFloat2)) {
return;
}
this.m = paramFloat1;
this.k = paramFloat2;
this.l = ((int)(paramFloat1 * 1.5F + this.b + 0.5F));
this.j = (this.b + paramFloat2);
this.o = true;
invalidateSelf();
}
final void a(ColorStateList paramColorStateList)
{
ColorStateList localColorStateList = paramColorStateList;
if (paramColorStateList == null) {
localColorStateList = ColorStateList.valueOf(0);
}
this.n = localColorStateList;
this.d.setColor(this.n.getColorForState(getState(), this.n.getDefaultColor()));
}
public final void a(boolean paramBoolean)
{
this.r = paramBoolean;
invalidateSelf();
}
public final void draw(Canvas paramCanvas)
{
int i2 = 1;
float f1;
float f2;
float f3;
int i1;
int i3;
float f4;
if (this.o)
{
Object localObject1 = getBounds();
f1 = this.k * 1.5F;
this.g.set(((Rect)localObject1).left + this.k, ((Rect)localObject1).top + f1, ((Rect)localObject1).right - this.k, ((Rect)localObject1).bottom - f1);
localObject1 = new RectF(-this.h, -this.h, this.h, this.h);
Object localObject2 = new RectF((RectF)localObject1);
((RectF)localObject2).inset(-this.l, -this.l);
if (this.i == null)
{
this.i = new Path();
this.i.setFillType(Path.FillType.EVEN_ODD);
this.i.moveTo(-this.h, 0.0F);
this.i.rLineTo(-this.l, 0.0F);
this.i.arcTo((RectF)localObject2, 180.0F, 90.0F, false);
this.i.arcTo((RectF)localObject1, 270.0F, -90.0F, false);
this.i.close();
f1 = this.h / (this.h + this.l);
localObject1 = this.e;
f2 = this.h;
f3 = this.l;
i1 = this.p;
i3 = this.p;
int i4 = this.q;
localObject2 = Shader.TileMode.CLAMP;
((Paint)localObject1).setShader(new RadialGradient(0.0F, 0.0F, f2 + f3, new int[] { i1, i3, i4 }, new float[] { 0.0F, f1, 1.0F }, (Shader.TileMode)localObject2));
localObject1 = this.f;
f1 = -this.h;
f2 = this.l;
f3 = -this.h;
f4 = this.l;
i1 = this.p;
i3 = this.p;
i4 = this.q;
localObject2 = Shader.TileMode.CLAMP;
((Paint)localObject1).setShader(new LinearGradient(0.0F, f1 + f2, 0.0F, f3 - f4, new int[] { i1, i3, i4 }, new float[] { 0.0F, 0.5F, 1.0F }, (Shader.TileMode)localObject2));
this.f.setAntiAlias(false);
this.o = false;
}
}
else
{
paramCanvas.translate(0.0F, this.m / 2.0F);
f1 = -this.h - this.l;
f2 = this.h + this.b + this.m / 2.0F;
if (this.g.width() - 2.0F * f2 <= 0.0F) {
break label906;
}
i1 = 1;
label506:
if (this.g.height() - 2.0F * f2 <= 0.0F) {
break label912;
}
}
for (;;)
{
i3 = paramCanvas.save();
paramCanvas.translate(this.g.left + f2, this.g.top + f2);
paramCanvas.drawPath(this.i, this.e);
if (i1 != 0) {
paramCanvas.drawRect(0.0F, f1, this.g.width() - 2.0F * f2, -this.h, this.f);
}
paramCanvas.restoreToCount(i3);
i3 = paramCanvas.save();
paramCanvas.translate(this.g.right - f2, this.g.bottom - f2);
paramCanvas.rotate(180.0F);
paramCanvas.drawPath(this.i, this.e);
if (i1 != 0)
{
f3 = this.g.width();
f4 = -this.h;
paramCanvas.drawRect(0.0F, f1, f3 - 2.0F * f2, this.l + f4, this.f);
}
paramCanvas.restoreToCount(i3);
i1 = paramCanvas.save();
paramCanvas.translate(this.g.left + f2, this.g.bottom - f2);
paramCanvas.rotate(270.0F);
paramCanvas.drawPath(this.i, this.e);
if (i2 != 0) {
paramCanvas.drawRect(0.0F, f1, this.g.height() - 2.0F * f2, -this.h, this.f);
}
paramCanvas.restoreToCount(i1);
i1 = paramCanvas.save();
paramCanvas.translate(this.g.right - f2, this.g.top + f2);
paramCanvas.rotate(90.0F);
paramCanvas.drawPath(this.i, this.e);
if (i2 != 0) {
paramCanvas.drawRect(0.0F, f1, this.g.height() - 2.0F * f2, -this.h, this.f);
}
paramCanvas.restoreToCount(i1);
paramCanvas.translate(0.0F, -this.m / 2.0F);
c.a(paramCanvas, this.g, this.h, this.d);
return;
this.i.reset();
break;
label906:
i1 = 0;
break label506;
label912:
i2 = 0;
}
}
public final int getOpacity()
{
return -3;
}
public final boolean getPadding(Rect paramRect)
{
int i1 = (int)Math.ceil(a(this.k, this.h, this.r));
int i2 = (int)Math.ceil(b(this.k, this.h, this.r));
paramRect.set(i2, i1, i2, i1);
return true;
}
public final boolean isStateful()
{
return ((this.n != null) && (this.n.isStateful())) || (super.isStateful());
}
protected final void onBoundsChange(Rect paramRect)
{
super.onBoundsChange(paramRect);
this.o = true;
}
protected final boolean onStateChange(int[] paramArrayOfInt)
{
int i1 = this.n.getColorForState(paramArrayOfInt, this.n.getDefaultColor());
if (this.d.getColor() == i1) {
return false;
}
this.d.setColor(i1);
this.o = true;
invalidateSelf();
return true;
}
public final void setAlpha(int paramInt)
{
this.d.setAlpha(paramInt);
this.e.setAlpha(paramInt);
this.f.setAlpha(paramInt);
}
public final void setColorFilter(ColorFilter paramColorFilter)
{
this.d.setColorFilter(paramColorFilter);
}
static abstract interface a
{
public abstract void a(Canvas paramCanvas, RectF paramRectF, float paramFloat, Paint paramPaint);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/gv.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/