ActionBarOverlayLayout.java
18.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
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
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
package android.support.v7.widget;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
import android.support.v4.view.NestedScrollingParent;
import android.support.v4.view.NestedScrollingParentHelper;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
import android.support.v4.widget.ScrollerCompat;
import android.support.v7.appcompat.R.attr;
import android.support.v7.appcompat.R.id;
import android.support.v7.view.menu.MenuPresenter.Callback;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.Window.Callback;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class ActionBarOverlayLayout
extends ViewGroup
implements NestedScrollingParent, DecorContentParent
{
static final int[] e = { R.attr.actionBarSize, 16842841 };
private final Runnable A = new Runnable()
{
public final void run()
{
ActionBarOverlayLayout.this.a();
ActionBarOverlayLayout.this.c = ViewCompat.animate(ActionBarOverlayLayout.this.a).translationY(-ActionBarOverlayLayout.this.a.getHeight()).setListener(ActionBarOverlayLayout.this.d);
}
};
private final NestedScrollingParentHelper B;
ActionBarContainer a;
boolean b;
ViewPropertyAnimatorCompat c;
final ViewPropertyAnimatorListener d = new ViewPropertyAnimatorListenerAdapter()
{
public final void onAnimationCancel(View paramAnonymousView)
{
ActionBarOverlayLayout.this.c = null;
ActionBarOverlayLayout.this.b = false;
}
public final void onAnimationEnd(View paramAnonymousView)
{
ActionBarOverlayLayout.this.c = null;
ActionBarOverlayLayout.this.b = false;
}
};
private int f;
private int g = 0;
private ContentFrameLayout h;
private DecorToolbar i;
private Drawable j;
private boolean k;
private boolean l;
private boolean m;
private boolean n;
private int o;
private int p;
private final Rect q = new Rect();
private final Rect r = new Rect();
private final Rect s = new Rect();
private final Rect t = new Rect();
private final Rect u = new Rect();
private final Rect v = new Rect();
private ActionBarVisibilityCallback w;
private final int x = 600;
private ScrollerCompat y;
private final Runnable z = new Runnable()
{
public final void run()
{
ActionBarOverlayLayout.this.a();
ActionBarOverlayLayout.this.c = ViewCompat.animate(ActionBarOverlayLayout.this.a).translationY(0.0F).setListener(ActionBarOverlayLayout.this.d);
}
};
public ActionBarOverlayLayout(Context paramContext)
{
this(paramContext, null);
}
public ActionBarOverlayLayout(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramContext, paramAttributeSet);
a(paramContext);
this.B = new NestedScrollingParentHelper(this);
}
private void a(Context paramContext)
{
boolean bool2 = true;
TypedArray localTypedArray = getContext().getTheme().obtainStyledAttributes(e);
this.f = localTypedArray.getDimensionPixelSize(0, 0);
this.j = localTypedArray.getDrawable(1);
if (this.j == null)
{
bool1 = true;
setWillNotDraw(bool1);
localTypedArray.recycle();
if (paramContext.getApplicationInfo().targetSdkVersion >= 19) {
break label90;
}
}
label90:
for (boolean bool1 = bool2;; bool1 = false)
{
this.k = bool1;
this.y = ScrollerCompat.create(paramContext);
return;
bool1 = false;
break;
}
}
private static boolean a(View paramView, Rect paramRect, boolean paramBoolean)
{
boolean bool = false;
paramView = (LayoutParams)paramView.getLayoutParams();
if (paramView.leftMargin != paramRect.left)
{
paramView.leftMargin = paramRect.left;
bool = true;
}
if (paramView.topMargin != paramRect.top)
{
paramView.topMargin = paramRect.top;
bool = true;
}
if (paramView.rightMargin != paramRect.right)
{
paramView.rightMargin = paramRect.right;
bool = true;
}
if ((paramBoolean) && (paramView.bottomMargin != paramRect.bottom))
{
paramView.bottomMargin = paramRect.bottom;
return true;
}
return bool;
}
private void b()
{
if (this.h == null)
{
this.h = ((ContentFrameLayout)findViewById(R.id.action_bar_activity_content));
this.a = ((ActionBarContainer)findViewById(R.id.action_bar_container));
localObject = findViewById(R.id.action_bar);
if (!(localObject instanceof DecorToolbar)) {
break label61;
}
}
for (Object localObject = (DecorToolbar)localObject;; localObject = ((Toolbar)localObject).getWrapper())
{
this.i = ((DecorToolbar)localObject);
return;
label61:
if (!(localObject instanceof Toolbar)) {
break;
}
}
throw new IllegalStateException("Can't make a decor toolbar out of " + localObject.getClass().getSimpleName());
}
final void a()
{
removeCallbacks(this.z);
removeCallbacks(this.A);
if (this.c != null) {
this.c.cancel();
}
}
public boolean canShowOverflowMenu()
{
b();
return this.i.canShowOverflowMenu();
}
protected boolean checkLayoutParams(ViewGroup.LayoutParams paramLayoutParams)
{
return paramLayoutParams instanceof LayoutParams;
}
public void dismissPopups()
{
b();
this.i.dismissPopupMenus();
}
public void draw(Canvas paramCanvas)
{
super.draw(paramCanvas);
if ((this.j != null) && (!this.k)) {
if (this.a.getVisibility() != 0) {
break label82;
}
}
label82:
for (int i1 = (int)(this.a.getBottom() + ViewCompat.getTranslationY(this.a) + 0.5F);; i1 = 0)
{
this.j.setBounds(0, i1, getWidth(), this.j.getIntrinsicHeight() + i1);
this.j.draw(paramCanvas);
return;
}
}
protected boolean fitSystemWindows(Rect paramRect)
{
b();
ViewCompat.getWindowSystemUiVisibility(this);
boolean bool = a(this.a, paramRect, false);
this.t.set(paramRect);
ViewUtils.computeFitSystemWindows(this, this.t, this.q);
if (!this.r.equals(this.q))
{
this.r.set(this.q);
bool = true;
}
if (bool) {
requestLayout();
}
return true;
}
protected LayoutParams generateDefaultLayoutParams()
{
return new LayoutParams(-1, -1);
}
public LayoutParams generateLayoutParams(AttributeSet paramAttributeSet)
{
return new LayoutParams(getContext(), paramAttributeSet);
}
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams paramLayoutParams)
{
return new LayoutParams(paramLayoutParams);
}
public int getActionBarHideOffset()
{
if (this.a != null) {
return -(int)ViewCompat.getTranslationY(this.a);
}
return 0;
}
public int getNestedScrollAxes()
{
return this.B.getNestedScrollAxes();
}
public CharSequence getTitle()
{
b();
return this.i.getTitle();
}
public boolean hasIcon()
{
b();
return this.i.hasIcon();
}
public boolean hasLogo()
{
b();
return this.i.hasLogo();
}
public boolean hideOverflowMenu()
{
b();
return this.i.hideOverflowMenu();
}
public void initFeature(int paramInt)
{
b();
switch (paramInt)
{
default:
return;
case 2:
this.i.initProgress();
return;
case 5:
this.i.initIndeterminateProgress();
return;
}
setOverlayMode(true);
}
public boolean isHideOnContentScrollEnabled()
{
return this.n;
}
public boolean isInOverlayMode()
{
return this.l;
}
public boolean isOverflowMenuShowPending()
{
b();
return this.i.isOverflowMenuShowPending();
}
public boolean isOverflowMenuShowing()
{
b();
return this.i.isOverflowMenuShowing();
}
protected void onConfigurationChanged(Configuration paramConfiguration)
{
super.onConfigurationChanged(paramConfiguration);
a(getContext());
ViewCompat.requestApplyInsets(this);
}
protected void onDetachedFromWindow()
{
super.onDetachedFromWindow();
a();
}
protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
paramInt2 = getChildCount();
paramInt3 = getPaddingLeft();
getPaddingRight();
paramInt4 = getPaddingTop();
getPaddingBottom();
paramInt1 = 0;
while (paramInt1 < paramInt2)
{
View localView = getChildAt(paramInt1);
if (localView.getVisibility() != 8)
{
LayoutParams localLayoutParams = (LayoutParams)localView.getLayoutParams();
int i1 = localView.getMeasuredWidth();
int i2 = localView.getMeasuredHeight();
int i3 = localLayoutParams.leftMargin + paramInt3;
int i4 = localLayoutParams.topMargin + paramInt4;
localView.layout(i3, i4, i1 + i3, i2 + i4);
}
paramInt1 += 1;
}
}
protected void onMeasure(int paramInt1, int paramInt2)
{
b();
measureChildWithMargins(this.a, paramInt1, 0, paramInt2, 0);
Object localObject = (LayoutParams)this.a.getLayoutParams();
int i6 = Math.max(0, this.a.getMeasuredWidth() + ((LayoutParams)localObject).leftMargin + ((LayoutParams)localObject).rightMargin);
int i1 = this.a.getMeasuredHeight();
int i2 = ((LayoutParams)localObject).topMargin;
int i5 = Math.max(0, ((LayoutParams)localObject).bottomMargin + (i1 + i2));
int i4 = ViewUtils.combineMeasuredStates(0, ViewCompat.getMeasuredState(this.a));
int i3;
if ((ViewCompat.getWindowSystemUiVisibility(this) & 0x100) != 0)
{
i2 = 1;
if (i2 == 0) {
break label444;
}
i3 = this.f;
i1 = i3;
if (this.m)
{
i1 = i3;
if (this.a.getTabContainer() != null) {
i1 = i3 + this.f;
}
}
}
for (;;)
{
label153:
this.s.set(this.q);
this.u.set(this.t);
if ((!this.l) && (i2 == 0))
{
localObject = this.s;
((Rect)localObject).top = (i1 + ((Rect)localObject).top);
localObject = this.s;
}
for (((Rect)localObject).bottom += 0;; ((Rect)localObject).bottom += 0)
{
a(this.h, this.s, true);
if (!this.v.equals(this.u))
{
this.v.set(this.u);
this.h.dispatchFitSystemWindows(this.u);
}
measureChildWithMargins(this.h, paramInt1, 0, paramInt2, 0);
localObject = (LayoutParams)this.h.getLayoutParams();
i1 = Math.max(i6, this.h.getMeasuredWidth() + ((LayoutParams)localObject).leftMargin + ((LayoutParams)localObject).rightMargin);
i2 = this.h.getMeasuredHeight();
i3 = ((LayoutParams)localObject).topMargin;
i2 = Math.max(i5, ((LayoutParams)localObject).bottomMargin + (i2 + i3));
i3 = ViewUtils.combineMeasuredStates(i4, ViewCompat.getMeasuredState(this.h));
i4 = getPaddingLeft();
i5 = getPaddingRight();
i2 = Math.max(i2 + (getPaddingTop() + getPaddingBottom()), getSuggestedMinimumHeight());
setMeasuredDimension(ViewCompat.resolveSizeAndState(Math.max(i1 + (i4 + i5), getSuggestedMinimumWidth()), paramInt1, i3), ViewCompat.resolveSizeAndState(i2, paramInt2, i3 << 16));
return;
i2 = 0;
break;
label444:
if (this.a.getVisibility() == 8) {
break label506;
}
i1 = this.a.getMeasuredHeight();
break label153;
localObject = this.u;
((Rect)localObject).top = (i1 + ((Rect)localObject).top);
localObject = this.u;
}
label506:
i1 = 0;
}
}
public boolean onNestedFling(View paramView, float paramFloat1, float paramFloat2, boolean paramBoolean)
{
int i1 = 0;
if ((!this.n) || (!paramBoolean)) {
return false;
}
this.y.fling(0, 0, 0, (int)paramFloat2, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
if (this.y.getFinalY() > this.a.getHeight()) {
i1 = 1;
}
if (i1 != 0)
{
a();
this.A.run();
}
for (;;)
{
this.b = true;
return true;
a();
this.z.run();
}
}
public boolean onNestedPreFling(View paramView, float paramFloat1, float paramFloat2)
{
return false;
}
public void onNestedPreScroll(View paramView, int paramInt1, int paramInt2, int[] paramArrayOfInt) {}
public void onNestedScroll(View paramView, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
this.o += paramInt2;
setActionBarHideOffset(this.o);
}
public void onNestedScrollAccepted(View paramView1, View paramView2, int paramInt)
{
this.B.onNestedScrollAccepted(paramView1, paramView2, paramInt);
this.o = getActionBarHideOffset();
a();
if (this.w != null) {
this.w.onContentScrollStarted();
}
}
public boolean onStartNestedScroll(View paramView1, View paramView2, int paramInt)
{
if (((paramInt & 0x2) == 0) || (this.a.getVisibility() != 0)) {
return false;
}
return this.n;
}
public void onStopNestedScroll(View paramView)
{
if ((this.n) && (!this.b))
{
if (this.o > this.a.getHeight()) {
break label61;
}
a();
postDelayed(this.z, 600L);
}
for (;;)
{
if (this.w != null) {
this.w.onContentScrollStopped();
}
return;
label61:
a();
postDelayed(this.A, 600L);
}
}
public void onWindowSystemUiVisibilityChanged(int paramInt)
{
boolean bool = true;
if (Build.VERSION.SDK_INT >= 16) {
super.onWindowSystemUiVisibilityChanged(paramInt);
}
b();
int i3 = this.p;
this.p = paramInt;
int i1;
int i2;
if ((paramInt & 0x4) == 0)
{
i1 = 1;
if ((paramInt & 0x100) == 0) {
break label120;
}
i2 = 1;
label49:
if (this.w != null)
{
ActionBarVisibilityCallback localActionBarVisibilityCallback = this.w;
if (i2 != 0) {
break label125;
}
label66:
localActionBarVisibilityCallback.enableContentAnimations(bool);
if ((i1 == 0) && (i2 != 0)) {
break label131;
}
this.w.showForSystem();
}
}
for (;;)
{
if ((((i3 ^ paramInt) & 0x100) != 0) && (this.w != null)) {
ViewCompat.requestApplyInsets(this);
}
return;
i1 = 0;
break;
label120:
i2 = 0;
break label49;
label125:
bool = false;
break label66;
label131:
this.w.hideForSystem();
}
}
protected void onWindowVisibilityChanged(int paramInt)
{
super.onWindowVisibilityChanged(paramInt);
this.g = paramInt;
if (this.w != null) {
this.w.onWindowVisibilityChanged(paramInt);
}
}
public void restoreToolbarHierarchyState(SparseArray<Parcelable> paramSparseArray)
{
b();
this.i.restoreHierarchyState(paramSparseArray);
}
public void saveToolbarHierarchyState(SparseArray<Parcelable> paramSparseArray)
{
b();
this.i.saveHierarchyState(paramSparseArray);
}
public void setActionBarHideOffset(int paramInt)
{
a();
paramInt = Math.max(0, Math.min(paramInt, this.a.getHeight()));
ViewCompat.setTranslationY(this.a, -paramInt);
}
public void setActionBarVisibilityCallback(ActionBarVisibilityCallback paramActionBarVisibilityCallback)
{
this.w = paramActionBarVisibilityCallback;
if (getWindowToken() != null)
{
this.w.onWindowVisibilityChanged(this.g);
if (this.p != 0)
{
onWindowSystemUiVisibilityChanged(this.p);
ViewCompat.requestApplyInsets(this);
}
}
}
public void setHasNonEmbeddedTabs(boolean paramBoolean)
{
this.m = paramBoolean;
}
public void setHideOnContentScrollEnabled(boolean paramBoolean)
{
if (paramBoolean != this.n)
{
this.n = paramBoolean;
if (!paramBoolean)
{
a();
setActionBarHideOffset(0);
}
}
}
public void setIcon(int paramInt)
{
b();
this.i.setIcon(paramInt);
}
public void setIcon(Drawable paramDrawable)
{
b();
this.i.setIcon(paramDrawable);
}
public void setLogo(int paramInt)
{
b();
this.i.setLogo(paramInt);
}
public void setMenu(Menu paramMenu, MenuPresenter.Callback paramCallback)
{
b();
this.i.setMenu(paramMenu, paramCallback);
}
public void setMenuPrepared()
{
b();
this.i.setMenuPrepared();
}
public void setOverlayMode(boolean paramBoolean)
{
this.l = paramBoolean;
if ((paramBoolean) && (getContext().getApplicationInfo().targetSdkVersion < 19)) {}
for (paramBoolean = true;; paramBoolean = false)
{
this.k = paramBoolean;
return;
}
}
public void setShowingForActionMode(boolean paramBoolean) {}
public void setUiOptions(int paramInt) {}
public void setWindowCallback(Window.Callback paramCallback)
{
b();
this.i.setWindowCallback(paramCallback);
}
public void setWindowTitle(CharSequence paramCharSequence)
{
b();
this.i.setWindowTitle(paramCharSequence);
}
public boolean shouldDelayChildPressedState()
{
return false;
}
public boolean showOverflowMenu()
{
b();
return this.i.showOverflowMenu();
}
public static abstract interface ActionBarVisibilityCallback
{
public abstract void enableContentAnimations(boolean paramBoolean);
public abstract void hideForSystem();
public abstract void onContentScrollStarted();
public abstract void onContentScrollStopped();
public abstract void onWindowVisibilityChanged(int paramInt);
public abstract void showForSystem();
}
public static class LayoutParams
extends ViewGroup.MarginLayoutParams
{
public LayoutParams(int paramInt1, int paramInt2)
{
super(paramInt2);
}
public LayoutParams(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramAttributeSet);
}
public LayoutParams(ViewGroup.LayoutParams paramLayoutParams)
{
super();
}
public LayoutParams(ViewGroup.MarginLayoutParams paramMarginLayoutParams)
{
super();
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/widget/ActionBarOverlayLayout.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/