RoundedImageView.java
7.57 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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
package com.makeramen;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
public class RoundedImageView
extends ImageView
{
public static final float DEFAULT_BORDER_WIDTH = 0.0F;
public static final float DEFAULT_RADIUS = 0.0F;
public static final String TAG = "RoundedImageView";
private static final ImageView.ScaleType[] b;
private float c = 0.0F;
private float d = 0.0F;
private ColorStateList e = ColorStateList.valueOf(-16777216);
private boolean f = false;
private boolean g = false;
private int h;
private Drawable i;
private Drawable j;
private ImageView.ScaleType k;
static
{
if (!RoundedImageView.class.desiredAssertionStatus()) {}
for (boolean bool = true;; bool = false)
{
a = bool;
b = new ImageView.ScaleType[] { ImageView.ScaleType.MATRIX, ImageView.ScaleType.FIT_XY, ImageView.ScaleType.FIT_START, ImageView.ScaleType.FIT_CENTER, ImageView.ScaleType.FIT_END, ImageView.ScaleType.CENTER, ImageView.ScaleType.CENTER_CROP, ImageView.ScaleType.CENTER_INSIDE };
return;
}
}
public RoundedImageView(Context paramContext)
{
super(paramContext);
}
public RoundedImageView(Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, 0);
}
public RoundedImageView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
paramContext = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.RoundedImageView, paramInt, 0);
paramInt = paramContext.getInt(0, -1);
if (paramInt >= 0) {
setScaleType(b[paramInt]);
}
for (;;)
{
this.c = paramContext.getDimensionPixelSize(1, -1);
this.d = paramContext.getDimensionPixelSize(2, -1);
if (this.c < 0.0F) {
this.c = 0.0F;
}
if (this.d < 0.0F) {
this.d = 0.0F;
}
this.e = paramContext.getColorStateList(3);
if (this.e == null) {
this.e = ColorStateList.valueOf(-16777216);
}
this.g = paramContext.getBoolean(4, false);
this.f = paramContext.getBoolean(5, false);
b();
a(true);
paramContext.recycle();
return;
setScaleType(ImageView.ScaleType.FIT_CENTER);
}
}
private Drawable a()
{
Object localObject3 = null;
Resources localResources = getResources();
if (localResources == null) {
return null;
}
Object localObject1 = localObject3;
if (this.h != 0) {}
try
{
localObject1 = localResources.getDrawable(this.h);
return RoundedDrawable.fromDrawable((Drawable)localObject1);
}
catch (Exception localException)
{
for (;;)
{
Log.w("RoundedImageView", "Unable to find resource: " + this.h, localException);
this.h = 0;
Object localObject2 = localObject3;
}
}
}
private void a(Drawable paramDrawable)
{
if (paramDrawable == null) {}
for (;;)
{
return;
if ((paramDrawable instanceof RoundedDrawable))
{
((RoundedDrawable)paramDrawable).setScaleType(this.k).setCornerRadius(this.c).setBorderWidth(this.d).setBorderColor(this.e).setOval(this.f);
return;
}
if ((paramDrawable instanceof LayerDrawable))
{
paramDrawable = (LayerDrawable)paramDrawable;
int m = 0;
int n = paramDrawable.getNumberOfLayers();
while (m < n)
{
a(paramDrawable.getDrawable(m));
m += 1;
}
}
}
}
private void a(boolean paramBoolean)
{
if (this.g)
{
if (paramBoolean) {
this.j = RoundedDrawable.fromDrawable(this.j);
}
a(this.j);
}
}
private void b()
{
a(this.i);
}
protected void drawableStateChanged()
{
super.drawableStateChanged();
invalidate();
}
public int getBorderColor()
{
return this.e.getDefaultColor();
}
public ColorStateList getBorderColors()
{
return this.e;
}
public float getBorderWidth()
{
return this.d;
}
public float getCornerRadius()
{
return this.c;
}
public ImageView.ScaleType getScaleType()
{
return this.k;
}
public boolean isMutateBackground()
{
return this.g;
}
public boolean isOval()
{
return this.f;
}
public void setBackground(Drawable paramDrawable)
{
setBackgroundDrawable(paramDrawable);
}
@Deprecated
public void setBackgroundDrawable(Drawable paramDrawable)
{
this.j = paramDrawable;
a(true);
super.setBackgroundDrawable(this.j);
}
public void setBorderColor(int paramInt)
{
setBorderColor(ColorStateList.valueOf(paramInt));
}
public void setBorderColor(ColorStateList paramColorStateList)
{
if (this.e.equals(paramColorStateList)) {
return;
}
if (paramColorStateList != null) {}
for (;;)
{
this.e = paramColorStateList;
b();
a(false);
if (this.d <= 0.0F) {
break;
}
invalidate();
return;
paramColorStateList = ColorStateList.valueOf(-16777216);
}
}
public void setBorderWidth(float paramFloat)
{
if (this.d == paramFloat) {
return;
}
this.d = paramFloat;
b();
a(false);
invalidate();
}
public void setBorderWidth(int paramInt)
{
setBorderWidth(getResources().getDimension(paramInt));
}
public void setCornerRadius(float paramFloat)
{
if (this.c == paramFloat) {
return;
}
this.c = paramFloat;
b();
a(false);
}
public void setCornerRadius(int paramInt)
{
setCornerRadius(getResources().getDimension(paramInt));
}
public void setImageBitmap(Bitmap paramBitmap)
{
this.h = 0;
this.i = RoundedDrawable.fromBitmap(paramBitmap);
b();
super.setImageDrawable(this.i);
}
public void setImageDrawable(Drawable paramDrawable)
{
this.h = 0;
this.i = RoundedDrawable.fromDrawable(paramDrawable);
b();
super.setImageDrawable(this.i);
}
public void setImageResource(int paramInt)
{
if (this.h != paramInt)
{
this.h = paramInt;
this.i = a();
b();
super.setImageDrawable(this.i);
}
}
public void setImageURI(Uri paramUri)
{
super.setImageURI(paramUri);
setImageDrawable(getDrawable());
}
public void setMutateBackground(boolean paramBoolean)
{
if (this.g == paramBoolean) {
return;
}
this.g = paramBoolean;
a(true);
invalidate();
}
public void setOval(boolean paramBoolean)
{
this.f = paramBoolean;
b();
a(false);
invalidate();
}
public void setScaleType(ImageView.ScaleType paramScaleType)
{
if ((!a) && (paramScaleType == null)) {
throw new AssertionError();
}
if (this.k != paramScaleType)
{
this.k = paramScaleType;
switch (1.a[paramScaleType.ordinal()])
{
default:
super.setScaleType(paramScaleType);
}
}
for (;;)
{
b();
a(false);
invalidate();
return;
super.setScaleType(ImageView.ScaleType.FIT_XY);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/makeramen/RoundedImageView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/