ActionBarDrawerToggle.java
12.2 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
package android.support.v7.app;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.DrawerLayout.DrawerListener;
import android.support.v7.graphics.drawable.DrawerArrowDrawable;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import fc;
import fc.a;
public class ActionBarDrawerToggle
implements DrawerLayout.DrawerListener
{
boolean a = true;
View.OnClickListener b;
private final Delegate c;
private final DrawerLayout d;
private DrawerArrowDrawable e;
private Drawable f;
private boolean g;
private final int h;
private final int i;
private boolean j = false;
public ActionBarDrawerToggle(Activity paramActivity, DrawerLayout paramDrawerLayout, @StringRes int paramInt1, @StringRes int paramInt2)
{
this(paramActivity, null, paramDrawerLayout, paramInt1, paramInt2);
}
public ActionBarDrawerToggle(Activity paramActivity, DrawerLayout paramDrawerLayout, Toolbar paramToolbar, @StringRes int paramInt1, @StringRes int paramInt2)
{
this(paramActivity, paramToolbar, paramDrawerLayout, paramInt1, paramInt2);
}
private ActionBarDrawerToggle(Activity paramActivity, Toolbar paramToolbar, DrawerLayout paramDrawerLayout, @StringRes int paramInt1, @StringRes int paramInt2)
{
if (paramToolbar != null)
{
this.c = new e(paramToolbar);
paramToolbar.setNavigationOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
if (ActionBarDrawerToggle.this.a) {
ActionBarDrawerToggle.this.a();
}
while (ActionBarDrawerToggle.this.b == null) {
return;
}
ActionBarDrawerToggle.this.b.onClick(paramAnonymousView);
}
});
}
for (;;)
{
this.d = paramDrawerLayout;
this.h = paramInt1;
this.i = paramInt2;
this.e = new DrawerArrowDrawable(this.c.getActionBarThemedContext());
this.f = b();
return;
if ((paramActivity instanceof DelegateProvider)) {
this.c = ((DelegateProvider)paramActivity).getDrawerToggleDelegate();
} else if (Build.VERSION.SDK_INT >= 18) {
this.c = new d(paramActivity);
} else if (Build.VERSION.SDK_INT >= 14) {
this.c = new c(paramActivity);
} else if (Build.VERSION.SDK_INT >= 11) {
this.c = new b(paramActivity);
} else {
this.c = new a(paramActivity);
}
}
}
private void a(float paramFloat)
{
if (paramFloat == 1.0F) {
this.e.setVerticalMirror(true);
}
for (;;)
{
this.e.setProgress(paramFloat);
return;
if (paramFloat == 0.0F) {
this.e.setVerticalMirror(false);
}
}
}
private void a(int paramInt)
{
this.c.setActionBarDescription(paramInt);
}
private void a(Drawable paramDrawable, int paramInt)
{
if ((!this.j) && (!this.c.isNavigationVisible()))
{
Log.w("ActionBarDrawerToggle", "DrawerToggle may not show up because NavigationIcon is not visible. You may need to call actionbar.setDisplayHomeAsUpEnabled(true);");
this.j = true;
}
this.c.setActionBarUpIndicator(paramDrawable, paramInt);
}
private Drawable b()
{
return this.c.getThemeUpIndicator();
}
final void a()
{
int k = this.d.getDrawerLockMode(8388611);
if ((this.d.isDrawerVisible(8388611)) && (k != 2)) {
this.d.closeDrawer(8388611);
}
while (k == 1) {
return;
}
this.d.openDrawer(8388611);
}
@NonNull
public DrawerArrowDrawable getDrawerArrowDrawable()
{
return this.e;
}
public View.OnClickListener getToolbarNavigationClickListener()
{
return this.b;
}
public boolean isDrawerIndicatorEnabled()
{
return this.a;
}
public void onConfigurationChanged(Configuration paramConfiguration)
{
if (!this.g) {
this.f = b();
}
syncState();
}
public void onDrawerClosed(View paramView)
{
a(0.0F);
if (this.a) {
a(this.h);
}
}
public void onDrawerOpened(View paramView)
{
a(1.0F);
if (this.a) {
a(this.i);
}
}
public void onDrawerSlide(View paramView, float paramFloat)
{
a(Math.min(1.0F, Math.max(0.0F, paramFloat)));
}
public void onDrawerStateChanged(int paramInt) {}
public boolean onOptionsItemSelected(MenuItem paramMenuItem)
{
if ((paramMenuItem != null) && (paramMenuItem.getItemId() == 16908332) && (this.a))
{
a();
return true;
}
return false;
}
public void setDrawerArrowDrawable(@NonNull DrawerArrowDrawable paramDrawerArrowDrawable)
{
this.e = paramDrawerArrowDrawable;
syncState();
}
public void setDrawerIndicatorEnabled(boolean paramBoolean)
{
int k;
if (paramBoolean != this.a)
{
if (!paramBoolean) {
break label54;
}
DrawerArrowDrawable localDrawerArrowDrawable = this.e;
if (!this.d.isDrawerOpen(8388611)) {
break label46;
}
k = this.i;
a(localDrawerArrowDrawable, k);
}
for (;;)
{
this.a = paramBoolean;
return;
label46:
k = this.h;
break;
label54:
a(this.f, 0);
}
}
public void setHomeAsUpIndicator(int paramInt)
{
Drawable localDrawable = null;
if (paramInt != 0) {
localDrawable = this.d.getResources().getDrawable(paramInt);
}
setHomeAsUpIndicator(localDrawable);
}
public void setHomeAsUpIndicator(Drawable paramDrawable)
{
if (paramDrawable == null) {
this.f = b();
}
for (this.g = false;; this.g = true)
{
if (!this.a) {
a(this.f, 0);
}
return;
this.f = paramDrawable;
}
}
public void setToolbarNavigationClickListener(View.OnClickListener paramOnClickListener)
{
this.b = paramOnClickListener;
}
public void syncState()
{
DrawerArrowDrawable localDrawerArrowDrawable;
if (this.d.isDrawerOpen(8388611))
{
a(1.0F);
if (this.a)
{
localDrawerArrowDrawable = this.e;
if (!this.d.isDrawerOpen(8388611)) {
break label61;
}
}
}
label61:
for (int k = this.i;; k = this.h)
{
a(localDrawerArrowDrawable, k);
return;
a(0.0F);
break;
}
}
public static abstract interface Delegate
{
public abstract Context getActionBarThemedContext();
public abstract Drawable getThemeUpIndicator();
public abstract boolean isNavigationVisible();
public abstract void setActionBarDescription(@StringRes int paramInt);
public abstract void setActionBarUpIndicator(Drawable paramDrawable, @StringRes int paramInt);
}
public static abstract interface DelegateProvider
{
@Nullable
public abstract ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
}
static final class a
implements ActionBarDrawerToggle.Delegate
{
final Activity a;
a(Activity paramActivity)
{
this.a = paramActivity;
}
public final Context getActionBarThemedContext()
{
return this.a;
}
public final Drawable getThemeUpIndicator()
{
return null;
}
public final boolean isNavigationVisible()
{
return true;
}
public final void setActionBarDescription(@StringRes int paramInt) {}
public final void setActionBarUpIndicator(Drawable paramDrawable, @StringRes int paramInt) {}
}
@TargetApi(11)
@RequiresApi(11)
static class b
implements ActionBarDrawerToggle.Delegate
{
final Activity a;
fc.a b;
b(Activity paramActivity)
{
this.a = paramActivity;
}
public Context getActionBarThemedContext()
{
return this.a;
}
public Drawable getThemeUpIndicator()
{
return fc.a(this.a);
}
public boolean isNavigationVisible()
{
ActionBar localActionBar = this.a.getActionBar();
return (localActionBar != null) && ((localActionBar.getDisplayOptions() & 0x4) != 0);
}
public void setActionBarDescription(int paramInt)
{
this.b = fc.a(this.b, this.a, paramInt);
}
public void setActionBarUpIndicator(Drawable paramDrawable, int paramInt)
{
ActionBar localActionBar = this.a.getActionBar();
if (localActionBar != null)
{
localActionBar.setDisplayShowHomeEnabled(true);
this.b = fc.a(this.a, paramDrawable, paramInt);
localActionBar.setDisplayShowHomeEnabled(false);
}
}
}
@TargetApi(14)
@RequiresApi(14)
static final class c
extends ActionBarDrawerToggle.b
{
c(Activity paramActivity)
{
super();
}
public final Context getActionBarThemedContext()
{
ActionBar localActionBar = this.a.getActionBar();
if (localActionBar != null) {
return localActionBar.getThemedContext();
}
return this.a;
}
}
@TargetApi(18)
@RequiresApi(18)
static final class d
implements ActionBarDrawerToggle.Delegate
{
final Activity a;
d(Activity paramActivity)
{
this.a = paramActivity;
}
public final Context getActionBarThemedContext()
{
ActionBar localActionBar = this.a.getActionBar();
if (localActionBar != null) {
return localActionBar.getThemedContext();
}
return this.a;
}
public final Drawable getThemeUpIndicator()
{
TypedArray localTypedArray = getActionBarThemedContext().obtainStyledAttributes(null, new int[] { 16843531 }, 16843470, 0);
Drawable localDrawable = localTypedArray.getDrawable(0);
localTypedArray.recycle();
return localDrawable;
}
public final boolean isNavigationVisible()
{
ActionBar localActionBar = this.a.getActionBar();
return (localActionBar != null) && ((localActionBar.getDisplayOptions() & 0x4) != 0);
}
public final void setActionBarDescription(int paramInt)
{
ActionBar localActionBar = this.a.getActionBar();
if (localActionBar != null) {
localActionBar.setHomeActionContentDescription(paramInt);
}
}
public final void setActionBarUpIndicator(Drawable paramDrawable, int paramInt)
{
ActionBar localActionBar = this.a.getActionBar();
if (localActionBar != null)
{
localActionBar.setHomeAsUpIndicator(paramDrawable);
localActionBar.setHomeActionContentDescription(paramInt);
}
}
}
static final class e
implements ActionBarDrawerToggle.Delegate
{
final Toolbar a;
final Drawable b;
final CharSequence c;
e(Toolbar paramToolbar)
{
this.a = paramToolbar;
this.b = paramToolbar.getNavigationIcon();
this.c = paramToolbar.getNavigationContentDescription();
}
public final Context getActionBarThemedContext()
{
return this.a.getContext();
}
public final Drawable getThemeUpIndicator()
{
return this.b;
}
public final boolean isNavigationVisible()
{
return true;
}
public final void setActionBarDescription(@StringRes int paramInt)
{
if (paramInt == 0)
{
this.a.setNavigationContentDescription(this.c);
return;
}
this.a.setNavigationContentDescription(paramInt);
}
public final void setActionBarUpIndicator(Drawable paramDrawable, @StringRes int paramInt)
{
this.a.setNavigationIcon(paramDrawable);
setActionBarDescription(paramInt);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/app/ActionBarDrawerToggle.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/