BaseTransientBottomBar.java
14.5 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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
package android.support.design.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build.VERSION;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.design.R.anim;
import android.support.design.R.layout;
import android.support.design.R.styleable;
import android.support.v4.view.OnApplyWindowInsetsListener;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
import android.support.v4.view.WindowInsetsCompat;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import c;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import p;
import p.a;
import p.b;
import r;
public abstract class BaseTransientBottomBar<B extends BaseTransientBottomBar<B>>
{
public static final int LENGTH_INDEFINITE = -2;
public static final int LENGTH_LONG = 0;
public static final int LENGTH_SHORT = -1;
static final Handler a = new Handler(Looper.getMainLooper(), new Handler.Callback()
{
public final boolean handleMessage(Message paramAnonymousMessage)
{
switch (paramAnonymousMessage.what)
{
default:
return false;
case 0:
paramAnonymousMessage = (BaseTransientBottomBar)paramAnonymousMessage.obj;
if (paramAnonymousMessage.c.getParent() == null)
{
localObject = paramAnonymousMessage.c.getLayoutParams();
if ((localObject instanceof CoordinatorLayout.LayoutParams))
{
localObject = (CoordinatorLayout.LayoutParams)localObject;
BaseTransientBottomBar.a locala = new BaseTransientBottomBar.a(paramAnonymousMessage);
locala.setStartAlphaSwipeDistance(0.1F);
locala.setEndAlphaSwipeDistance(0.6F);
locala.setSwipeDirection(0);
locala.setListener(new BaseTransientBottomBar.5(paramAnonymousMessage));
((CoordinatorLayout.LayoutParams)localObject).setBehavior(locala);
((CoordinatorLayout.LayoutParams)localObject).insetEdge = 80;
}
paramAnonymousMessage.b.addView(paramAnonymousMessage.c);
}
paramAnonymousMessage.c.setOnAttachStateChangeListener(new BaseTransientBottomBar.6(paramAnonymousMessage));
if (ViewCompat.isLaidOut(paramAnonymousMessage.c)) {
if (paramAnonymousMessage.c()) {
paramAnonymousMessage.a();
}
}
for (;;)
{
return true;
paramAnonymousMessage.b();
continue;
paramAnonymousMessage.c.setOnLayoutChangeListener(new BaseTransientBottomBar.7(paramAnonymousMessage));
}
}
Object localObject = (BaseTransientBottomBar)paramAnonymousMessage.obj;
int i = paramAnonymousMessage.arg1;
if ((((BaseTransientBottomBar)localObject).c()) && (((BaseTransientBottomBar)localObject).c.getVisibility() == 0)) {
if (Build.VERSION.SDK_INT >= 14) {
ViewCompat.animate(((BaseTransientBottomBar)localObject).c).translationY(((BaseTransientBottomBar)localObject).c.getHeight()).setInterpolator(c.b).setDuration(250L).setListener(new BaseTransientBottomBar.10((BaseTransientBottomBar)localObject, i)).start();
}
}
for (;;)
{
return true;
paramAnonymousMessage = AnimationUtils.loadAnimation(((BaseTransientBottomBar)localObject).c.getContext(), R.anim.design_snackbar_out);
paramAnonymousMessage.setInterpolator(c.b);
paramAnonymousMessage.setDuration(250L);
paramAnonymousMessage.setAnimationListener(new BaseTransientBottomBar.2((BaseTransientBottomBar)localObject, i));
((BaseTransientBottomBar)localObject).c.startAnimation(paramAnonymousMessage);
continue;
((BaseTransientBottomBar)localObject).b(i);
}
}
});
final ViewGroup b;
final d c;
final p.a d = new p.a()
{
public final void a()
{
BaseTransientBottomBar.a.sendMessage(BaseTransientBottomBar.a.obtainMessage(0, BaseTransientBottomBar.this));
}
public final void a(int paramAnonymousInt)
{
BaseTransientBottomBar.a.sendMessage(BaseTransientBottomBar.a.obtainMessage(1, paramAnonymousInt, 0, BaseTransientBottomBar.this));
}
};
private final Context e;
private final ContentViewCallback f;
private int g;
private List<BaseCallback<B>> h;
private final AccessibilityManager i;
protected BaseTransientBottomBar(@NonNull ViewGroup paramViewGroup, @NonNull View paramView, @NonNull ContentViewCallback paramContentViewCallback)
{
if (paramViewGroup == null) {
throw new IllegalArgumentException("Transient bottom bar must have non-null parent");
}
if (paramView == null) {
throw new IllegalArgumentException("Transient bottom bar must have non-null content");
}
if (paramContentViewCallback == null) {
throw new IllegalArgumentException("Transient bottom bar must have non-null callback");
}
this.b = paramViewGroup;
this.f = paramContentViewCallback;
this.e = paramViewGroup.getContext();
r.a(this.e);
this.c = ((d)LayoutInflater.from(this.e).inflate(R.layout.design_layout_snackbar, this.b, false));
this.c.addView(paramView);
ViewCompat.setAccessibilityLiveRegion(this.c, 1);
ViewCompat.setImportantForAccessibility(this.c, 1);
ViewCompat.setFitsSystemWindows(this.c, true);
ViewCompat.setOnApplyWindowInsetsListener(this.c, new OnApplyWindowInsetsListener()
{
public final WindowInsetsCompat onApplyWindowInsets(View paramAnonymousView, WindowInsetsCompat paramAnonymousWindowInsetsCompat)
{
paramAnonymousView.setPadding(paramAnonymousView.getPaddingLeft(), paramAnonymousView.getPaddingTop(), paramAnonymousView.getPaddingRight(), paramAnonymousWindowInsetsCompat.getSystemWindowInsetBottom());
return paramAnonymousWindowInsetsCompat;
}
});
this.i = ((AccessibilityManager)this.e.getSystemService("accessibility"));
}
final void a()
{
if (Build.VERSION.SDK_INT >= 14)
{
ViewCompat.setTranslationY(this.c, this.c.getHeight());
ViewCompat.animate(this.c).translationY(0.0F).setInterpolator(c.b).setDuration(250L).setListener(new ViewPropertyAnimatorListenerAdapter()
{
public final void onAnimationEnd(View paramAnonymousView)
{
BaseTransientBottomBar.this.b();
}
public final void onAnimationStart(View paramAnonymousView)
{
BaseTransientBottomBar.a(BaseTransientBottomBar.this).animateContentIn(70, 180);
}
}).start();
return;
}
Animation localAnimation = AnimationUtils.loadAnimation(this.c.getContext(), R.anim.design_snackbar_in);
localAnimation.setInterpolator(c.b);
localAnimation.setDuration(250L);
localAnimation.setAnimationListener(new Animation.AnimationListener()
{
public final void onAnimationEnd(Animation paramAnonymousAnimation)
{
BaseTransientBottomBar.this.b();
}
public final void onAnimationRepeat(Animation paramAnonymousAnimation) {}
public final void onAnimationStart(Animation paramAnonymousAnimation) {}
});
this.c.startAnimation(localAnimation);
}
final void a(int paramInt)
{
p localp = p.a();
p.a locala = this.d;
synchronized (localp.a)
{
if (localp.e(locala)) {
localp.a(localp.c, paramInt);
}
while (!localp.f(locala)) {
return;
}
localp.a(localp.d, paramInt);
}
}
@NonNull
public B addCallback(@NonNull BaseCallback<B> paramBaseCallback)
{
if (paramBaseCallback == null) {
return this;
}
if (this.h == null) {
this.h = new ArrayList();
}
this.h.add(paramBaseCallback);
return this;
}
final void b()
{
p localp = p.a();
p.a locala = this.d;
synchronized (localp.a)
{
if (localp.e(locala)) {
localp.a(localp.c);
}
if (this.h != null)
{
int j = this.h.size() - 1;
if (j >= 0)
{
((BaseCallback)this.h.get(j)).onShown(this);
j -= 1;
}
}
}
}
final void b(int paramInt)
{
p localp = p.a();
p.a locala = this.d;
synchronized (localp.a)
{
if (localp.e(locala))
{
localp.c = null;
if (localp.d != null) {
localp.b();
}
}
if (this.h != null)
{
int j = this.h.size() - 1;
if (j >= 0)
{
((BaseCallback)this.h.get(j)).onDismissed(this, paramInt);
j -= 1;
}
}
}
if (Build.VERSION.SDK_INT < 11) {
this.c.setVisibility(8);
}
??? = this.c.getParent();
if ((??? instanceof ViewGroup)) {
((ViewGroup)???).removeView(this.c);
}
}
final boolean c()
{
return !this.i.isEnabled();
}
public void dismiss()
{
a(3);
}
@NonNull
public Context getContext()
{
return this.e;
}
public int getDuration()
{
return this.g;
}
@NonNull
public View getView()
{
return this.c;
}
public boolean isShown()
{
return p.a().c(this.d);
}
public boolean isShownOrQueued()
{
return p.a().d(this.d);
}
@NonNull
public B removeCallback(@NonNull BaseCallback<B> paramBaseCallback)
{
if (paramBaseCallback == null) {}
while (this.h == null) {
return this;
}
this.h.remove(paramBaseCallback);
return this;
}
@NonNull
public B setDuration(int paramInt)
{
this.g = paramInt;
return this;
}
public void show()
{
p localp = p.a();
int j = this.g;
p.a locala = this.d;
for (;;)
{
synchronized (localp.a)
{
if (localp.e(locala))
{
localp.c.b = j;
localp.b.removeCallbacksAndMessages(localp.c);
localp.a(localp.c);
return;
}
if (localp.f(locala))
{
localp.d.b = j;
if ((localp.c == null) || (!localp.a(localp.c, 4))) {
break;
}
return;
}
}
((p)localObject2).d = new p.b(j, locala);
}
((p)localObject2).c = null;
((p)localObject2).b();
}
public static abstract class BaseCallback<B>
{
public static final int DISMISS_EVENT_ACTION = 1;
public static final int DISMISS_EVENT_CONSECUTIVE = 4;
public static final int DISMISS_EVENT_MANUAL = 3;
public static final int DISMISS_EVENT_SWIPE = 0;
public static final int DISMISS_EVENT_TIMEOUT = 2;
public void onDismissed(B paramB, int paramInt) {}
public void onShown(B paramB) {}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface DismissEvent {}
}
public static abstract interface ContentViewCallback
{
public abstract void animateContentIn(int paramInt1, int paramInt2);
public abstract void animateContentOut(int paramInt1, int paramInt2);
}
@Retention(RetentionPolicy.SOURCE)
@IntRange(from=1L)
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static @interface Duration {}
final class a
extends SwipeDismissBehavior<BaseTransientBottomBar.d>
{
a() {}
private boolean a(CoordinatorLayout paramCoordinatorLayout, BaseTransientBottomBar.d paramd, MotionEvent paramMotionEvent)
{
if (paramCoordinatorLayout.isPointInChildBounds(paramd, (int)paramMotionEvent.getX(), (int)paramMotionEvent.getY())) {
switch (paramMotionEvent.getActionMasked())
{
}
}
for (;;)
{
return super.onInterceptTouchEvent(paramCoordinatorLayout, paramd, paramMotionEvent);
p.a().a(BaseTransientBottomBar.this.d);
continue;
p.a().b(BaseTransientBottomBar.this.d);
}
}
public final boolean canSwipeDismissView(View paramView)
{
return paramView instanceof BaseTransientBottomBar.d;
}
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
static abstract interface b
{
public abstract void a();
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
static abstract interface c
{
public abstract void a();
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
static class d
extends FrameLayout
{
private BaseTransientBottomBar.c a;
private BaseTransientBottomBar.b b;
d(Context paramContext)
{
this(paramContext, null);
}
d(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramAttributeSet);
paramContext = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.SnackbarLayout);
if (paramContext.hasValue(R.styleable.SnackbarLayout_elevation)) {
ViewCompat.setElevation(this, paramContext.getDimensionPixelSize(R.styleable.SnackbarLayout_elevation, 0));
}
paramContext.recycle();
setClickable(true);
}
protected void onAttachedToWindow()
{
super.onAttachedToWindow();
ViewCompat.requestApplyInsets(this);
}
protected void onDetachedFromWindow()
{
super.onDetachedFromWindow();
if (this.b != null) {
this.b.a();
}
}
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
if (this.a != null) {
this.a.a();
}
}
void setOnAttachStateChangeListener(BaseTransientBottomBar.b paramb)
{
this.b = paramb;
}
void setOnLayoutChangeListener(BaseTransientBottomBar.c paramc)
{
this.a = paramc;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/widget/BaseTransientBottomBar.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/