SupportMenuInflater.java
16 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
package android.support.v7.view;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
import android.support.v4.view.ActionProvider;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.appcompat.R.styleable;
import android.support.v7.view.menu.MenuItemImpl;
import android.support.v7.view.menu.MenuItemWrapperICS;
import android.util.AttributeSet;
import android.util.Log;
import android.view.InflateException;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.SubMenu;
import android.view.View;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class SupportMenuInflater
extends MenuInflater
{
static final Class<?>[] a;
static final Class<?>[] b;
final Object[] c;
final Object[] d;
Context e;
Object f;
static
{
Class[] arrayOfClass = new Class[1];
arrayOfClass[0] = Context.class;
a = arrayOfClass;
b = arrayOfClass;
}
public SupportMenuInflater(Context paramContext)
{
super(paramContext);
this.e = paramContext;
this.c = new Object[] { paramContext };
this.d = this.c;
}
static Object a(Object paramObject)
{
for (;;)
{
if ((paramObject instanceof Activity)) {}
while (!(paramObject instanceof ContextWrapper)) {
return paramObject;
}
paramObject = ((ContextWrapper)paramObject).getBaseContext();
}
}
private void a(XmlPullParser paramXmlPullParser, AttributeSet paramAttributeSet, Menu paramMenu)
throws XmlPullParserException, IOException
{
b localb = new b(paramMenu);
int i = paramXmlPullParser.getEventType();
int j = 0;
paramMenu = null;
Object localObject;
int k;
if (i == 2)
{
localObject = paramXmlPullParser.getName();
if (((String)localObject).equals("menu"))
{
k = paramXmlPullParser.next();
label56:
i = 0;
label59:
if (i != 0) {
return;
}
}
}
switch (k)
{
default:
case 2:
case 3:
for (;;)
{
k = paramXmlPullParser.next();
break label59;
throw new RuntimeException("Expecting menu, got " + (String)localObject);
k = paramXmlPullParser.next();
i = k;
if (k != 1) {
break;
}
break label56;
if (j == 0)
{
localObject = paramXmlPullParser.getName();
if (((String)localObject).equals("group"))
{
localObject = localb.z.e.obtainStyledAttributes(paramAttributeSet, R.styleable.MenuGroup);
localb.b = ((TypedArray)localObject).getResourceId(R.styleable.MenuGroup_android_id, 0);
localb.c = ((TypedArray)localObject).getInt(R.styleable.MenuGroup_android_menuCategory, 0);
localb.d = ((TypedArray)localObject).getInt(R.styleable.MenuGroup_android_orderInCategory, 0);
localb.e = ((TypedArray)localObject).getInt(R.styleable.MenuGroup_android_checkableBehavior, 0);
localb.f = ((TypedArray)localObject).getBoolean(R.styleable.MenuGroup_android_visible, true);
localb.g = ((TypedArray)localObject).getBoolean(R.styleable.MenuGroup_android_enabled, true);
((TypedArray)localObject).recycle();
}
else
{
if (((String)localObject).equals("item"))
{
localObject = localb.z.e.obtainStyledAttributes(paramAttributeSet, R.styleable.MenuItem);
localb.i = ((TypedArray)localObject).getResourceId(R.styleable.MenuItem_android_id, 0);
localb.j = (((TypedArray)localObject).getInt(R.styleable.MenuItem_android_menuCategory, localb.c) & 0xFFFF0000 | ((TypedArray)localObject).getInt(R.styleable.MenuItem_android_orderInCategory, localb.d) & 0xFFFF);
localb.k = ((TypedArray)localObject).getText(R.styleable.MenuItem_android_title);
localb.l = ((TypedArray)localObject).getText(R.styleable.MenuItem_android_titleCondensed);
localb.m = ((TypedArray)localObject).getResourceId(R.styleable.MenuItem_android_icon, 0);
localb.n = b.a(((TypedArray)localObject).getString(R.styleable.MenuItem_android_alphabeticShortcut));
localb.o = b.a(((TypedArray)localObject).getString(R.styleable.MenuItem_android_numericShortcut));
if (((TypedArray)localObject).hasValue(R.styleable.MenuItem_android_checkable)) {
if (((TypedArray)localObject).getBoolean(R.styleable.MenuItem_android_checkable, false))
{
k = 1;
label458:
localb.p = k;
label465:
localb.q = ((TypedArray)localObject).getBoolean(R.styleable.MenuItem_android_checked, false);
localb.r = ((TypedArray)localObject).getBoolean(R.styleable.MenuItem_android_visible, localb.f);
localb.s = ((TypedArray)localObject).getBoolean(R.styleable.MenuItem_android_enabled, localb.g);
localb.t = ((TypedArray)localObject).getInt(R.styleable.MenuItem_showAsAction, -1);
localb.x = ((TypedArray)localObject).getString(R.styleable.MenuItem_android_onClick);
localb.u = ((TypedArray)localObject).getResourceId(R.styleable.MenuItem_actionLayout, 0);
localb.v = ((TypedArray)localObject).getString(R.styleable.MenuItem_actionViewClass);
localb.w = ((TypedArray)localObject).getString(R.styleable.MenuItem_actionProviderClass);
if (localb.w == null) {
break label676;
}
k = 1;
label593:
if ((k == 0) || (localb.u != 0) || (localb.v != null)) {
break label682;
}
}
}
for (localb.y = ((ActionProvider)localb.a(localb.w, b, localb.z.d));; localb.y = null)
{
((TypedArray)localObject).recycle();
localb.h = false;
break;
k = 0;
break label458;
localb.p = localb.e;
break label465;
label676:
k = 0;
break label593;
label682:
if (k != 0) {
Log.w("SupportMenuInflater", "Ignoring attribute 'actionProviderClass'. Action view already specified.");
}
}
}
if (((String)localObject).equals("menu"))
{
a(paramXmlPullParser, paramAttributeSet, localb.b());
}
else
{
j = 1;
paramMenu = (Menu)localObject;
continue;
localObject = paramXmlPullParser.getName();
if ((j != 0) && (((String)localObject).equals(paramMenu)))
{
j = 0;
paramMenu = null;
}
else if (((String)localObject).equals("group"))
{
localb.a();
}
else if (((String)localObject).equals("item"))
{
if (!localb.h) {
if ((localb.y != null) && (localb.y.hasSubMenu()))
{
localb.b();
}
else
{
localb.h = true;
localb.a(localb.a.add(localb.b, localb.i, localb.j, localb.k));
}
}
}
else if (((String)localObject).equals("menu"))
{
i = 1;
}
}
}
}
}
}
throw new RuntimeException("Unexpected end of document");
}
/* Error */
public void inflate(int paramInt, Menu paramMenu)
{
// Byte code:
// 0: aload_2
// 1: instanceof 341
// 4: ifne +10 -> 14
// 7: aload_0
// 8: iload_1
// 9: aload_2
// 10: invokespecial 343 android/view/MenuInflater:inflate (ILandroid/view/Menu;)V
// 13: return
// 14: aconst_null
// 15: astore_3
// 16: aconst_null
// 17: astore 5
// 19: aconst_null
// 20: astore 4
// 22: aload_0
// 23: getfield 40 android/support/v7/view/SupportMenuInflater:e Landroid/content/Context;
// 26: invokevirtual 347 android/content/Context:getResources ()Landroid/content/res/Resources;
// 29: iload_1
// 30: invokevirtual 353 android/content/res/Resources:getLayout (I)Landroid/content/res/XmlResourceParser;
// 33: astore 6
// 35: aload 6
// 37: astore 4
// 39: aload 6
// 41: astore_3
// 42: aload 6
// 44: astore 5
// 46: aload_0
// 47: aload 6
// 49: aload 6
// 51: invokestatic 359 android/util/Xml:asAttributeSet (Lorg/xmlpull/v1/XmlPullParser;)Landroid/util/AttributeSet;
// 54: aload_2
// 55: invokespecial 316 android/support/v7/view/SupportMenuInflater:a (Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;Landroid/view/Menu;)V
// 58: aload 6
// 60: ifnull -47 -> 13
// 63: aload 6
// 65: invokeinterface 364 1 0
// 70: return
// 71: astore_2
// 72: aload 4
// 74: astore_3
// 75: new 366 android/view/InflateException
// 78: dup
// 79: ldc_w 368
// 82: aload_2
// 83: invokespecial 371 android/view/InflateException:<init> (Ljava/lang/String;Ljava/lang/Throwable;)V
// 86: athrow
// 87: astore_2
// 88: aload_3
// 89: ifnull +9 -> 98
// 92: aload_3
// 93: invokeinterface 364 1 0
// 98: aload_2
// 99: athrow
// 100: astore_2
// 101: aload 5
// 103: astore_3
// 104: new 366 android/view/InflateException
// 107: dup
// 108: ldc_w 368
// 111: aload_2
// 112: invokespecial 371 android/view/InflateException:<init> (Ljava/lang/String;Ljava/lang/Throwable;)V
// 115: athrow
// Local variable table:
// start length slot name signature
// 0 116 0 this SupportMenuInflater
// 0 116 1 paramInt int
// 0 116 2 paramMenu Menu
// 15 89 3 localObject1 Object
// 20 53 4 localObject2 Object
// 17 85 5 localObject3 Object
// 33 31 6 localXmlResourceParser android.content.res.XmlResourceParser
// Exception table:
// from to target type
// 22 35 71 org/xmlpull/v1/XmlPullParserException
// 46 58 71 org/xmlpull/v1/XmlPullParserException
// 22 35 87 finally
// 46 58 87 finally
// 75 87 87 finally
// 104 116 87 finally
// 22 35 100 java/io/IOException
// 46 58 100 java/io/IOException
}
static final class a
implements MenuItem.OnMenuItemClickListener
{
private static final Class<?>[] a = { MenuItem.class };
private Object b;
private Method c;
public a(Object paramObject, String paramString)
{
this.b = paramObject;
Class localClass = paramObject.getClass();
try
{
this.c = localClass.getMethod(paramString, a);
return;
}
catch (Exception paramObject)
{
paramString = new InflateException("Couldn't resolve menu item onClick handler " + paramString + " in class " + localClass.getName());
paramString.initCause((Throwable)paramObject);
throw paramString;
}
}
public final boolean onMenuItemClick(MenuItem paramMenuItem)
{
try
{
if (this.c.getReturnType() == Boolean.TYPE) {
return ((Boolean)this.c.invoke(this.b, new Object[] { paramMenuItem })).booleanValue();
}
this.c.invoke(this.b, new Object[] { paramMenuItem });
return true;
}
catch (Exception paramMenuItem)
{
throw new RuntimeException(paramMenuItem);
}
}
}
final class b
{
Menu a;
int b;
int c;
int d;
int e;
boolean f;
boolean g;
boolean h;
int i;
int j;
CharSequence k;
CharSequence l;
int m;
char n;
char o;
int p;
boolean q;
boolean r;
boolean s;
int t;
int u;
String v;
String w;
String x;
ActionProvider y;
public b(Menu paramMenu)
{
this.a = paramMenu;
a();
}
static char a(String paramString)
{
if (paramString == null) {
return '\000';
}
return paramString.charAt(0);
}
final <T> T a(String paramString, Class<?>[] paramArrayOfClass, Object[] paramArrayOfObject)
{
try
{
paramArrayOfClass = SupportMenuInflater.this.e.getClassLoader().loadClass(paramString).getConstructor(paramArrayOfClass);
paramArrayOfClass.setAccessible(true);
paramArrayOfClass = paramArrayOfClass.newInstance(paramArrayOfObject);
return paramArrayOfClass;
}
catch (Exception paramArrayOfClass)
{
Log.w("SupportMenuInflater", "Cannot instantiate class: " + paramString, paramArrayOfClass);
}
return null;
}
public final void a()
{
this.b = 0;
this.c = 0;
this.d = 0;
this.e = 0;
this.f = true;
this.g = true;
}
final void a(MenuItem paramMenuItem)
{
int i1 = 1;
Object localObject = paramMenuItem.setChecked(this.q).setVisible(this.r).setEnabled(this.s);
if (this.p > 0) {}
for (boolean bool = true;; bool = false)
{
((MenuItem)localObject).setCheckable(bool).setTitleCondensed(this.l).setIcon(this.m).setAlphabeticShortcut(this.n).setNumericShortcut(this.o);
if (this.t >= 0) {
MenuItemCompat.setShowAsAction(paramMenuItem, this.t);
}
if (this.x == null) {
break label186;
}
if (!SupportMenuInflater.this.e.isRestricted()) {
break;
}
throw new IllegalStateException("The android:onClick attribute cannot be used within a restricted context");
}
localObject = SupportMenuInflater.this;
if (((SupportMenuInflater)localObject).f == null) {
((SupportMenuInflater)localObject).f = SupportMenuInflater.a(((SupportMenuInflater)localObject).e);
}
paramMenuItem.setOnMenuItemClickListener(new SupportMenuInflater.a(((SupportMenuInflater)localObject).f, this.x));
label186:
if (this.p >= 2)
{
if ((paramMenuItem instanceof MenuItemImpl)) {
((MenuItemImpl)paramMenuItem).setExclusiveCheckable(true);
}
}
else
{
if (this.v == null) {
break label308;
}
MenuItemCompat.setActionView(paramMenuItem, (View)a(this.v, SupportMenuInflater.a, SupportMenuInflater.this.c));
}
for (;;)
{
if (this.u > 0)
{
if (i1 != 0) {
break label297;
}
MenuItemCompat.setActionView(paramMenuItem, this.u);
}
for (;;)
{
if (this.y != null) {
MenuItemCompat.setActionProvider(paramMenuItem, this.y);
}
return;
if (!(paramMenuItem instanceof MenuItemWrapperICS)) {
break;
}
((MenuItemWrapperICS)paramMenuItem).setExclusiveCheckable(true);
break;
label297:
Log.w("SupportMenuInflater", "Ignoring attribute 'itemActionViewLayout'. Action view already specified.");
}
label308:
i1 = 0;
}
}
public final SubMenu b()
{
this.h = true;
SubMenu localSubMenu = this.a.addSubMenu(this.b, this.i, this.j, this.k);
a(localSubMenu.getItem());
return localSubMenu;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/view/SupportMenuInflater.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/