NavigationView.java
11 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
package android.support.design.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources.Theme;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
import android.support.design.R.style;
import android.support.design.R.styleable;
import android.support.design.internal.NavigationMenu;
import android.support.design.internal.NavigationMenuPresenter;
import android.support.design.internal.ScrimInsetsFrameLayout;
import android.support.v4.content.ContextCompat;
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.WindowInsetsCompat;
import android.support.v7.appcompat.R.attr;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.view.SupportMenuInflater;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuBuilder.Callback;
import android.support.v7.view.menu.MenuItemImpl;
import android.support.v7.widget.TintTypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.MeasureSpec;
import r;
public class NavigationView
extends ScrimInsetsFrameLayout
{
private static final int[] d = { 16842912 };
private static final int[] e = { -16842910 };
OnNavigationItemSelectedListener c;
private final NavigationMenu f;
private final NavigationMenuPresenter g = new NavigationMenuPresenter();
private int h;
private MenuInflater i;
public NavigationView(Context paramContext)
{
this(paramContext, null);
}
public NavigationView(Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, 0);
}
public NavigationView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
r.a(paramContext);
this.f = new NavigationMenu(paramContext);
TintTypedArray localTintTypedArray = TintTypedArray.obtainStyledAttributes(paramContext, paramAttributeSet, R.styleable.NavigationView, paramInt, R.style.Widget_Design_NavigationView);
ViewCompat.setBackground(this, localTintTypedArray.getDrawable(R.styleable.NavigationView_android_background));
if (localTintTypedArray.hasValue(R.styleable.NavigationView_elevation)) {
ViewCompat.setElevation(this, localTintTypedArray.getDimensionPixelSize(R.styleable.NavigationView_elevation, 0));
}
ViewCompat.setFitsSystemWindows(this, localTintTypedArray.getBoolean(R.styleable.NavigationView_android_fitsSystemWindows, false));
this.h = localTintTypedArray.getDimensionPixelSize(R.styleable.NavigationView_android_maxWidth, 0);
ColorStateList localColorStateList;
if (localTintTypedArray.hasValue(R.styleable.NavigationView_itemIconTint))
{
localColorStateList = localTintTypedArray.getColorStateList(R.styleable.NavigationView_itemIconTint);
if (!localTintTypedArray.hasValue(R.styleable.NavigationView_itemTextAppearance)) {
break label376;
}
paramInt = localTintTypedArray.getResourceId(R.styleable.NavigationView_itemTextAppearance, 0);
}
for (int j = 1;; j = 0)
{
paramAttributeSet = null;
if (localTintTypedArray.hasValue(R.styleable.NavigationView_itemTextColor)) {
paramAttributeSet = localTintTypedArray.getColorStateList(R.styleable.NavigationView_itemTextColor);
}
Object localObject = paramAttributeSet;
if (j == 0)
{
localObject = paramAttributeSet;
if (paramAttributeSet == null) {
localObject = a(16842806);
}
}
paramAttributeSet = localTintTypedArray.getDrawable(R.styleable.NavigationView_itemBackground);
this.f.setCallback(new MenuBuilder.Callback()
{
public final boolean onMenuItemSelected(MenuBuilder paramAnonymousMenuBuilder, MenuItem paramAnonymousMenuItem)
{
return (NavigationView.this.c != null) && (NavigationView.this.c.onNavigationItemSelected(paramAnonymousMenuItem));
}
public final void onMenuModeChange(MenuBuilder paramAnonymousMenuBuilder) {}
});
this.g.setId(1);
this.g.initForMenu(paramContext, this.f);
this.g.setItemIconTintList(localColorStateList);
if (j != 0) {
this.g.setItemTextAppearance(paramInt);
}
this.g.setItemTextColor((ColorStateList)localObject);
this.g.setItemBackground(paramAttributeSet);
this.f.addMenuPresenter(this.g);
addView((View)this.g.getMenuView(this));
if (localTintTypedArray.hasValue(R.styleable.NavigationView_menu)) {
inflateMenu(localTintTypedArray.getResourceId(R.styleable.NavigationView_menu, 0));
}
if (localTintTypedArray.hasValue(R.styleable.NavigationView_headerLayout)) {
inflateHeaderView(localTintTypedArray.getResourceId(R.styleable.NavigationView_headerLayout, 0));
}
localTintTypedArray.recycle();
return;
localColorStateList = a(16842808);
break;
label376:
paramInt = 0;
}
}
private ColorStateList a(int paramInt)
{
Object localObject = new TypedValue();
if (!getContext().getTheme().resolveAttribute(paramInt, (TypedValue)localObject, true)) {}
ColorStateList localColorStateList;
do
{
return null;
localColorStateList = AppCompatResources.getColorStateList(getContext(), ((TypedValue)localObject).resourceId);
} while (!getContext().getTheme().resolveAttribute(R.attr.colorPrimary, (TypedValue)localObject, true));
paramInt = ((TypedValue)localObject).data;
int j = localColorStateList.getDefaultColor();
localObject = e;
int[] arrayOfInt1 = d;
int[] arrayOfInt2 = EMPTY_STATE_SET;
int k = localColorStateList.getColorForState(e, j);
return new ColorStateList(new int[][] { localObject, arrayOfInt1, arrayOfInt2 }, new int[] { k, paramInt, j });
}
private MenuInflater getMenuInflater()
{
if (this.i == null) {
this.i = new SupportMenuInflater(getContext());
}
return this.i;
}
public void addHeaderView(@NonNull View paramView)
{
this.g.addHeaderView(paramView);
}
public int getHeaderCount()
{
return this.g.getHeaderCount();
}
public View getHeaderView(int paramInt)
{
return this.g.getHeaderView(paramInt);
}
@Nullable
public Drawable getItemBackground()
{
return this.g.getItemBackground();
}
@Nullable
public ColorStateList getItemIconTintList()
{
return this.g.getItemTintList();
}
@Nullable
public ColorStateList getItemTextColor()
{
return this.g.getItemTextColor();
}
public Menu getMenu()
{
return this.f;
}
public View inflateHeaderView(@LayoutRes int paramInt)
{
return this.g.inflateHeaderView(paramInt);
}
public void inflateMenu(int paramInt)
{
this.g.setUpdateSuspended(true);
getMenuInflater().inflate(paramInt, this.f);
this.g.setUpdateSuspended(false);
this.g.updateMenuView(false);
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
protected void onInsetsChanged(WindowInsetsCompat paramWindowInsetsCompat)
{
this.g.dispatchApplyWindowInsets(paramWindowInsetsCompat);
}
protected void onMeasure(int paramInt1, int paramInt2)
{
int j = paramInt1;
switch (View.MeasureSpec.getMode(paramInt1))
{
default:
j = paramInt1;
}
for (;;)
{
super.onMeasure(j, paramInt2);
return;
j = View.MeasureSpec.makeMeasureSpec(Math.min(View.MeasureSpec.getSize(paramInt1), this.h), 1073741824);
continue;
j = View.MeasureSpec.makeMeasureSpec(this.h, 1073741824);
}
}
protected void onRestoreInstanceState(Parcelable paramParcelable)
{
if (!(paramParcelable instanceof SavedState))
{
super.onRestoreInstanceState(paramParcelable);
return;
}
paramParcelable = (SavedState)paramParcelable;
super.onRestoreInstanceState(paramParcelable.getSuperState());
this.f.restorePresenterStates(paramParcelable.menuState);
}
protected Parcelable onSaveInstanceState()
{
SavedState localSavedState = new SavedState(super.onSaveInstanceState());
localSavedState.menuState = new Bundle();
this.f.savePresenterStates(localSavedState.menuState);
return localSavedState;
}
public void removeHeaderView(@NonNull View paramView)
{
this.g.removeHeaderView(paramView);
}
public void setCheckedItem(@IdRes int paramInt)
{
MenuItem localMenuItem = this.f.findItem(paramInt);
if (localMenuItem != null) {
this.g.setCheckedItem((MenuItemImpl)localMenuItem);
}
}
public void setItemBackground(@Nullable Drawable paramDrawable)
{
this.g.setItemBackground(paramDrawable);
}
public void setItemBackgroundResource(@DrawableRes int paramInt)
{
setItemBackground(ContextCompat.getDrawable(getContext(), paramInt));
}
public void setItemIconTintList(@Nullable ColorStateList paramColorStateList)
{
this.g.setItemIconTintList(paramColorStateList);
}
public void setItemTextAppearance(@StyleRes int paramInt)
{
this.g.setItemTextAppearance(paramInt);
}
public void setItemTextColor(@Nullable ColorStateList paramColorStateList)
{
this.g.setItemTextColor(paramColorStateList);
}
public void setNavigationItemSelectedListener(@Nullable OnNavigationItemSelectedListener paramOnNavigationItemSelectedListener)
{
this.c = paramOnNavigationItemSelectedListener;
}
public static abstract interface OnNavigationItemSelectedListener
{
public abstract boolean onNavigationItemSelected(@NonNull MenuItem paramMenuItem);
}
public static class SavedState
extends AbsSavedState
{
public static final Parcelable.Creator<SavedState> CREATOR = ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks() {});
public Bundle menuState;
public SavedState(Parcel paramParcel, ClassLoader paramClassLoader)
{
super(paramClassLoader);
this.menuState = paramParcel.readBundle(paramClassLoader);
}
public SavedState(Parcelable paramParcelable)
{
super();
}
public void writeToParcel(@NonNull Parcel paramParcel, int paramInt)
{
super.writeToParcel(paramParcel, paramInt);
paramParcel.writeBundle(this.menuState);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/widget/NavigationView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/