BottomNavigationView.java
7.37 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
package android.support.design.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.os.Build.VERSION;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.R.color;
import android.support.design.R.dimen;
import android.support.design.R.style;
import android.support.design.R.styleable;
import android.support.design.internal.BottomNavigationMenu;
import android.support.design.internal.BottomNavigationMenuView;
import android.support.design.internal.BottomNavigationPresenter;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewCompat;
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.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.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import r;
public class BottomNavigationView
extends FrameLayout
{
private static final int[] a = { 16842912 };
private static final int[] b = { -16842910 };
private final MenuBuilder c;
private final BottomNavigationMenuView d;
private final BottomNavigationPresenter e = new BottomNavigationPresenter();
private MenuInflater f;
private OnNavigationItemSelectedListener g;
public BottomNavigationView(Context paramContext)
{
this(paramContext, null);
}
public BottomNavigationView(Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, 0);
}
public BottomNavigationView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
r.a(paramContext);
this.c = new BottomNavigationMenu(paramContext);
this.d = new BottomNavigationMenuView(paramContext);
FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(-2, -2);
localLayoutParams.gravity = 17;
this.d.setLayoutParams(localLayoutParams);
this.e.setBottomNavigationMenuView(this.d);
this.d.setPresenter(this.e);
this.c.addMenuPresenter(this.e);
this.e.initForMenu(getContext(), this.c);
paramAttributeSet = TintTypedArray.obtainStyledAttributes(paramContext, paramAttributeSet, R.styleable.BottomNavigationView, paramInt, R.style.Widget_Design_BottomNavigationView);
if (paramAttributeSet.hasValue(R.styleable.BottomNavigationView_itemIconTint))
{
this.d.setIconTintList(paramAttributeSet.getColorStateList(R.styleable.BottomNavigationView_itemIconTint));
if (!paramAttributeSet.hasValue(R.styleable.BottomNavigationView_itemTextColor)) {
break label345;
}
this.d.setItemTextColor(paramAttributeSet.getColorStateList(R.styleable.BottomNavigationView_itemTextColor));
}
for (;;)
{
if (paramAttributeSet.hasValue(R.styleable.BottomNavigationView_elevation)) {
ViewCompat.setElevation(this, paramAttributeSet.getDimensionPixelSize(R.styleable.BottomNavigationView_elevation, 0));
}
paramInt = paramAttributeSet.getResourceId(R.styleable.BottomNavigationView_itemBackground, 0);
this.d.setItemBackgroundRes(paramInt);
if (paramAttributeSet.hasValue(R.styleable.BottomNavigationView_menu)) {
inflateMenu(paramAttributeSet.getResourceId(R.styleable.BottomNavigationView_menu, 0));
}
paramAttributeSet.recycle();
addView(this.d, localLayoutParams);
if (Build.VERSION.SDK_INT < 21)
{
paramAttributeSet = new View(paramContext);
paramAttributeSet.setBackgroundColor(ContextCompat.getColor(paramContext, R.color.design_bottom_navigation_shadow_color));
paramAttributeSet.setLayoutParams(new FrameLayout.LayoutParams(-1, getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_shadow_height)));
addView(paramAttributeSet);
}
this.c.setCallback(new MenuBuilder.Callback()
{
public final boolean onMenuItemSelected(MenuBuilder paramAnonymousMenuBuilder, MenuItem paramAnonymousMenuItem)
{
return (BottomNavigationView.a(BottomNavigationView.this) != null) && (!BottomNavigationView.a(BottomNavigationView.this).onNavigationItemSelected(paramAnonymousMenuItem));
}
public final void onMenuModeChange(MenuBuilder paramAnonymousMenuBuilder) {}
});
return;
this.d.setIconTintList(a());
break;
label345:
this.d.setItemTextColor(a());
}
}
private ColorStateList a()
{
Object localObject = new TypedValue();
if (!getContext().getTheme().resolveAttribute(16842808, (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));
int i = ((TypedValue)localObject).data;
int j = localColorStateList.getDefaultColor();
localObject = b;
int[] arrayOfInt1 = a;
int[] arrayOfInt2 = EMPTY_STATE_SET;
int k = localColorStateList.getColorForState(b, j);
return new ColorStateList(new int[][] { localObject, arrayOfInt1, arrayOfInt2 }, new int[] { k, i, j });
}
private MenuInflater getMenuInflater()
{
if (this.f == null) {
this.f = new SupportMenuInflater(getContext());
}
return this.f;
}
@DrawableRes
public int getItemBackgroundResource()
{
return this.d.getItemBackgroundRes();
}
@Nullable
public ColorStateList getItemIconTintList()
{
return this.d.getIconTintList();
}
@Nullable
public ColorStateList getItemTextColor()
{
return this.d.getItemTextColor();
}
public int getMaxItemCount()
{
return 5;
}
@NonNull
public Menu getMenu()
{
return this.c;
}
public void inflateMenu(int paramInt)
{
this.e.setUpdateSuspended(true);
getMenuInflater().inflate(paramInt, this.c);
this.e.setUpdateSuspended(false);
this.e.updateMenuView(true);
}
public void setItemBackgroundResource(@DrawableRes int paramInt)
{
this.d.setItemBackgroundRes(paramInt);
}
public void setItemIconTintList(@Nullable ColorStateList paramColorStateList)
{
this.d.setIconTintList(paramColorStateList);
}
public void setItemTextColor(@Nullable ColorStateList paramColorStateList)
{
this.d.setItemTextColor(paramColorStateList);
}
public void setOnNavigationItemSelectedListener(@Nullable OnNavigationItemSelectedListener paramOnNavigationItemSelectedListener)
{
this.g = paramOnNavigationItemSelectedListener;
}
public static abstract interface OnNavigationItemSelectedListener
{
public abstract boolean onNavigationItemSelected(@NonNull MenuItem paramMenuItem);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/widget/BottomNavigationView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/