AvatarBuilderPreviewView.java
17.8 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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
package com.bitstrips.imoji.abv3.preview;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.support.v4.view.GestureDetectorCompat;
import android.util.AttributeSet;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import java.util.ArrayList;
public class AvatarBuilderPreviewView
extends View
{
public static final float BACKGROUND_BODY_OFFSET = 0.2F;
private static final String a = AvatarBuilderPreviewView.class.getSimpleName();
private AvatarBuilderPreviewMode b;
private AvatarBuilderPreviewListener c;
private int d;
private int e;
private int f;
private int g;
private int h;
private int i;
private int j;
private boolean k;
private AnimatorSet l;
private AvatarBuilderPreviewDecorator m;
private AvatarBuilderPreviewFlash n;
private GestureDetectorCompat o;
private boolean p;
private ObjectAnimator q;
public AvatarBuilderPreviewView(Context paramContext)
{
super(paramContext);
b();
}
public AvatarBuilderPreviewView(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
b();
}
private void a(AnimatorSet paramAnimatorSet, boolean paramBoolean)
{
if (this.l != null) {
this.l.cancel();
}
this.l = paramAnimatorSet;
((ObjectAnimator)paramAnimatorSet.getChildAnimations().get(0)).addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
{
public final void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
{
AvatarBuilderPreviewView.this.invalidate();
}
});
if (paramBoolean) {}
for (long l1 = 250L;; l1 = 0L)
{
paramAnimatorSet.setDuration(l1);
paramAnimatorSet.start();
return;
}
}
private void a(boolean paramBoolean)
{
switch (5.a[this.b.ordinal()])
{
}
for (;;)
{
invalidate();
return;
setPreviewFullScreen(paramBoolean);
continue;
setSplitView(paramBoolean);
continue;
setUserImageFullScreen(paramBoolean);
continue;
setPreviewFullScreenBody(paramBoolean);
}
}
private void b()
{
this.d = getResources().getDimensionPixelSize(2131361928);
this.e = getResources().getDimensionPixelSize(2131361927);
this.f = getResources().getDimensionPixelSize(2131361924);
this.g = getResources().getDimensionPixelSize(2131361926);
this.h = getResources().getDimensionPixelSize(2131361925);
this.i = getResources().getDimensionPixelSize(2131361922);
this.j = getResources().getDimensionPixelSize(2131361923);
setOnTouchListener(new View.OnTouchListener()
{
public final boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent)
{
AvatarBuilderPreviewView.a(AvatarBuilderPreviewView.this).onTouchEvent(paramAnonymousMotionEvent);
return true;
}
});
this.m = new AvatarBuilderPreviewDecorator(this);
this.n = new AvatarBuilderPreviewFlash(this);
setPreviewMode(AvatarBuilderPreviewMode.PREVIEW_FULL_SCREEN);
this.o = new GestureDetectorCompat(getContext(), new GestureDetector.OnGestureListener()
{
public final boolean onDown(MotionEvent paramAnonymousMotionEvent)
{
return true;
}
public final boolean onFling(MotionEvent paramAnonymousMotionEvent1, MotionEvent paramAnonymousMotionEvent2, float paramAnonymousFloat1, float paramAnonymousFloat2)
{
if ((paramAnonymousMotionEvent1.getX() - paramAnonymousMotionEvent2.getX() > AvatarBuilderPreviewView.d(AvatarBuilderPreviewView.this)) && (Math.abs(paramAnonymousFloat1) > AvatarBuilderPreviewView.e(AvatarBuilderPreviewView.this)))
{
AvatarBuilderPreviewView.a();
if (AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this) != null) {
AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this).onPreviewRightToLeftSwipe();
}
}
do
{
return true;
if ((paramAnonymousMotionEvent2.getX() - paramAnonymousMotionEvent1.getX() <= AvatarBuilderPreviewView.d(AvatarBuilderPreviewView.this)) || (Math.abs(paramAnonymousFloat1) <= AvatarBuilderPreviewView.e(AvatarBuilderPreviewView.this))) {
break;
}
AvatarBuilderPreviewView.a();
} while (AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this) == null);
AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this).onPreviewLeftToRightSwipe();
return true;
return false;
}
public final void onLongPress(MotionEvent paramAnonymousMotionEvent)
{
float f1 = paramAnonymousMotionEvent.getX();
float f2 = paramAnonymousMotionEvent.getY();
AvatarBuilderPreviewView.a();
if ((AvatarBuilderPreviewView.a(AvatarBuilderPreviewView.this, f1, f2)) && (AvatarBuilderPreviewView.this.hasUserImage()) && (AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this) != null)) {
AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this).onPreviewUserImageLongPress();
}
}
public final boolean onScroll(MotionEvent paramAnonymousMotionEvent1, MotionEvent paramAnonymousMotionEvent2, float paramAnonymousFloat1, float paramAnonymousFloat2)
{
return false;
}
public final void onShowPress(MotionEvent paramAnonymousMotionEvent) {}
public final boolean onSingleTapUp(MotionEvent paramAnonymousMotionEvent)
{
float f1 = paramAnonymousMotionEvent.getX();
float f2 = paramAnonymousMotionEvent.getY();
AvatarBuilderPreviewView.a();
new StringBuilder("onSingleTapUp x: ").append(f1).append(" y: ").append(f2);
switch (AvatarBuilderPreviewView.5.a[AvatarBuilderPreviewView.b(AvatarBuilderPreviewView.this).ordinal()])
{
}
for (;;)
{
return true;
if (AvatarBuilderPreviewView.a(AvatarBuilderPreviewView.this, f1, f2)) {
if (AvatarBuilderPreviewView.this.hasUserImage())
{
AvatarBuilderPreviewView.this.setPreviewMode(AvatarBuilderPreviewMode.SPLIT_VIEW);
}
else if (AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this) != null)
{
AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this).onPreviewPlaceholderTap();
continue;
if (AvatarBuilderPreviewView.a(AvatarBuilderPreviewView.this, f1, f2))
{
if (AvatarBuilderPreviewView.this.hasUserImage()) {
AvatarBuilderPreviewView.this.setPreviewMode(AvatarBuilderPreviewMode.PREVIEW_MINIMIZED);
} else if (AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this) != null) {
AvatarBuilderPreviewView.c(AvatarBuilderPreviewView.this).onPreviewPlaceholderTap();
}
}
else if (AvatarBuilderPreviewView.b(AvatarBuilderPreviewView.this, f1, f2))
{
AvatarBuilderPreviewView.this.setPreviewMode(AvatarBuilderPreviewMode.PREVIEW_FULL_SCREEN);
continue;
if (AvatarBuilderPreviewView.b(AvatarBuilderPreviewView.this, f1, f2)) {
AvatarBuilderPreviewView.this.setPreviewMode(AvatarBuilderPreviewMode.SPLIT_VIEW);
}
}
}
}
}
}
});
}
private void setPreviewFullScreen(boolean paramBoolean)
{
int i1 = getWidth();
int i2 = getHeight();
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { ObjectAnimator.ofFloat(this.m, "previewLeft", new float[] { this.m.getPreviewLeft(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewRight", new float[] { this.m.getPreviewRight(), i1 }), ObjectAnimator.ofFloat(this.m, "previewTop", new float[] { this.m.getPreviewTop(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewBottom", new float[] { this.m.getPreviewBottom(), i2 }), ObjectAnimator.ofFloat(this.m, "previewTopOffset", new float[] { this.m.getPreviewTopOffset(), this.f }), ObjectAnimator.ofFloat(this.m, "userImageLeft", new float[] { this.m.getUserImageLeft(), this.e }), ObjectAnimator.ofFloat(this.m, "userImageRight", new float[] { this.m.getUserImageRight(), this.e + this.d }), ObjectAnimator.ofFloat(this.m, "userImageTop", new float[] { this.m.getUserImageTop(), i2 - this.e - this.d }), ObjectAnimator.ofFloat(this.m, "userImageBottom", new float[] { this.m.getUserImageBottom(), i2 - this.e }), ObjectAnimator.ofFloat(this.m, "userImageCircleRadiusPercentage", new float[] { this.m.getUserImageCircleRadiusPercentage(), 0.5F }), ObjectAnimator.ofFloat(this.m, "previewCircleRadiusPercentage", new float[] { this.m.getPreviewCircleRadiusPercentage(), 0.0F }), ObjectAnimator.ofFloat(this.m, "backgroundOffset", new float[] { this.m.getBackgroundOffset(), 0.0F }), ObjectAnimator.ofFloat(this.m, "minimizedBackgroundOpacity", new float[] { this.m.getMinimizedBackgroundOpacity(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewZoom", new float[] { this.m.getPreviewZoom(), 2.3F }), ObjectAnimator.ofFloat(this.m, "userImageHiddenOffset", new float[] { this.m.getUserImageHiddenOffset(), 0.0F }) });
a(localAnimatorSet, paramBoolean);
}
private void setPreviewFullScreenBody(boolean paramBoolean)
{
int i1 = getWidth();
int i2 = getHeight();
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { ObjectAnimator.ofFloat(this.m, "previewLeft", new float[] { this.m.getPreviewLeft(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewRight", new float[] { this.m.getPreviewRight(), i1 }), ObjectAnimator.ofFloat(this.m, "previewTop", new float[] { this.m.getPreviewTop(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewBottom", new float[] { this.m.getPreviewBottom(), i2 }), ObjectAnimator.ofFloat(this.m, "previewTopOffset", new float[] { this.m.getPreviewTopOffset(), this.f }), ObjectAnimator.ofFloat(this.m, "userImageLeft", new float[] { this.m.getUserImageLeft(), this.e }), ObjectAnimator.ofFloat(this.m, "userImageRight", new float[] { this.m.getUserImageRight(), this.e + this.d }), ObjectAnimator.ofFloat(this.m, "userImageTop", new float[] { this.m.getUserImageTop(), i2 - this.e - this.d }), ObjectAnimator.ofFloat(this.m, "userImageBottom", new float[] { this.m.getUserImageBottom(), i2 - this.e }), ObjectAnimator.ofFloat(this.m, "userImageCircleRadiusPercentage", new float[] { this.m.getUserImageCircleRadiusPercentage(), 0.5F }), ObjectAnimator.ofFloat(this.m, "previewCircleRadiusPercentage", new float[] { this.m.getPreviewCircleRadiusPercentage(), 0.0F }), ObjectAnimator.ofFloat(this.m, "backgroundOffset", new float[] { this.m.getBackgroundOffset(), 0.2F }), ObjectAnimator.ofFloat(this.m, "minimizedBackgroundOpacity", new float[] { this.m.getMinimizedBackgroundOpacity(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewZoom", new float[] { this.m.getPreviewZoom(), 1.0F }), ObjectAnimator.ofFloat(this.m, "userImageHiddenOffset", new float[] { this.m.getUserImageHiddenOffset(), 2.0F }) });
a(localAnimatorSet, paramBoolean);
}
private void setSplitView(boolean paramBoolean)
{
int i1 = getWidth();
int i2 = getHeight();
int i3 = i1 / 2;
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { ObjectAnimator.ofFloat(this.m, "previewLeft", new float[] { this.m.getPreviewLeft(), i3 }), ObjectAnimator.ofFloat(this.m, "previewRight", new float[] { this.m.getPreviewRight(), i1 }), ObjectAnimator.ofFloat(this.m, "previewTop", new float[] { this.m.getPreviewTop(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewBottom", new float[] { this.m.getPreviewBottom(), i2 }), ObjectAnimator.ofFloat(this.m, "previewTopOffset", new float[] { this.m.getPreviewTopOffset(), this.g }), ObjectAnimator.ofFloat(this.m, "userImageLeft", new float[] { this.m.getUserImageLeft(), 0.0F }), ObjectAnimator.ofFloat(this.m, "userImageRight", new float[] { this.m.getUserImageRight(), i3 }), ObjectAnimator.ofFloat(this.m, "userImageTop", new float[] { this.m.getUserImageTop(), 0.0F }), ObjectAnimator.ofFloat(this.m, "userImageBottom", new float[] { this.m.getUserImageBottom(), i2 }), ObjectAnimator.ofFloat(this.m, "userImageCircleRadiusPercentage", new float[] { this.m.getUserImageCircleRadiusPercentage(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewCircleRadiusPercentage", new float[] { this.m.getPreviewCircleRadiusPercentage(), 0.0F }), ObjectAnimator.ofFloat(this.m, "backgroundOffset", new float[] { this.m.getBackgroundOffset(), 0.0F }), ObjectAnimator.ofFloat(this.m, "minimizedBackgroundOpacity", new float[] { this.m.getMinimizedBackgroundOpacity(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewZoom", new float[] { this.m.getPreviewZoom(), 1.5F }), ObjectAnimator.ofFloat(this.m, "userImageHiddenOffset", new float[] { this.m.getUserImageHiddenOffset(), 0.0F }) });
a(localAnimatorSet, paramBoolean);
}
private void setUserImageFullScreen(boolean paramBoolean)
{
int i1 = getWidth();
int i2 = getHeight();
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { ObjectAnimator.ofFloat(this.m, "previewLeft", new float[] { this.m.getPreviewLeft(), i1 - this.e - this.d }), ObjectAnimator.ofFloat(this.m, "previewRight", new float[] { this.m.getPreviewRight(), i1 - this.e }), ObjectAnimator.ofFloat(this.m, "previewTop", new float[] { this.m.getPreviewTop(), this.m.getPreviewBottom() - this.d }), ObjectAnimator.ofFloat(this.m, "previewBottom", new float[] { this.m.getPreviewBottom(), i2 - this.e }), ObjectAnimator.ofFloat(this.m, "previewTopOffset", new float[] { this.m.getPreviewTopOffset(), this.h }), ObjectAnimator.ofFloat(this.m, "userImageLeft", new float[] { this.m.getUserImageLeft(), 0.0F }), ObjectAnimator.ofFloat(this.m, "userImageRight", new float[] { this.m.getUserImageRight(), i1 }), ObjectAnimator.ofFloat(this.m, "userImageTop", new float[] { this.m.getUserImageTop(), 0.0F }), ObjectAnimator.ofFloat(this.m, "userImageBottom", new float[] { this.m.getUserImageBottom(), i2 }), ObjectAnimator.ofFloat(this.m, "userImageCircleRadiusPercentage", new float[] { this.m.getUserImageCircleRadiusPercentage(), 0.0F }), ObjectAnimator.ofFloat(this.m, "previewCircleRadiusPercentage", new float[] { this.m.getPreviewCircleRadiusPercentage(), 0.5F }), ObjectAnimator.ofFloat(this.m, "backgroundOffset", new float[] { this.m.getBackgroundOffset(), 0.0F }), ObjectAnimator.ofFloat(this.m, "minimizedBackgroundOpacity", new float[] { this.m.getMinimizedBackgroundOpacity(), 1.0F }), ObjectAnimator.ofFloat(this.m, "previewZoom", new float[] { this.m.getPreviewZoom(), 2.3F }), ObjectAnimator.ofFloat(this.m, "userImageHiddenOffset", new float[] { this.m.getUserImageHiddenOffset(), 0.0F }) });
a(localAnimatorSet, paramBoolean);
}
public void animateFlashes()
{
this.n.startAnimation();
}
public void draw(Canvas paramCanvas)
{
super.draw(paramCanvas);
AvatarBuilderPreviewDecorator localAvatarBuilderPreviewDecorator = this.m;
if (this.b == AvatarBuilderPreviewMode.PREVIEW_FULL_SCREEN) {}
for (boolean bool = true;; bool = false)
{
localAvatarBuilderPreviewDecorator.draw(paramCanvas, bool, this.k);
this.n.draw(paramCanvas);
return;
}
}
public AvatarBuilderPreviewMode getPreviewMode()
{
return this.b;
}
public boolean hasUserImage()
{
return this.m.getUserImage() != null;
}
public void onSizeChanged(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
a(false);
}
public void setAnimationsEnabled(boolean paramBoolean)
{
this.p = paramBoolean;
}
public void setBrandBackground(Bitmap paramBitmap)
{
this.m.setBrandBackgroundImage(paramBitmap);
invalidate();
}
public void setFullBodyPreviewDecorator(boolean paramBoolean)
{
this.m.setFullBodyPreview(paramBoolean);
}
public void setListener(AvatarBuilderPreviewListener paramAvatarBuilderPreviewListener)
{
this.c = paramAvatarBuilderPreviewListener;
}
public void setPreview(Bitmap paramBitmap)
{
this.m.setPreviewImage(paramBitmap);
invalidate();
}
public void setPreviewMode(AvatarBuilderPreviewMode paramAvatarBuilderPreviewMode)
{
if (paramAvatarBuilderPreviewMode == this.b) {
return;
}
this.b = paramAvatarBuilderPreviewMode;
if (this.c != null) {
this.c.onPreviewModeChanged(this.b);
}
a(this.p);
}
public void setUserImage(Bitmap paramBitmap)
{
this.m.setUserImage(paramBitmap);
invalidate();
}
public void setUserImageEnabled(boolean paramBoolean)
{
this.k = paramBoolean;
invalidate();
}
public void startLoading()
{
if (this.q != null) {
this.q.cancel();
}
this.q = ((ObjectAnimator)AnimatorInflater.loadAnimator(getContext(), 2131034112));
this.q.setTarget(this.m);
this.q.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
{
public final void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
{
AvatarBuilderPreviewView.this.invalidate();
}
});
this.q.start();
}
public void stopFlashes()
{
this.n.stopAnimation();
}
public void stopLoading()
{
if (this.q != null)
{
this.q.cancel();
this.q = null;
this.m.setTint(0.0F);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/preview/AvatarBuilderPreviewView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/