BottomNavigationItemView.java
7.93 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
package android.support.design.internal;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.design.R.dimen;
import android.support.design.R.drawable;
import android.support.design.R.id;
import android.support.design.R.layout;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.PointerIconCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.view.menu.MenuItemImpl;
import android.support.v7.view.menu.MenuView.ItemView;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class BottomNavigationItemView
extends FrameLayout
implements MenuView.ItemView
{
public static final int INVALID_ITEM_POSITION = -1;
private static final int[] a = { 16842912 };
private final int b;
private final int c;
private final float d;
private final float e;
private boolean f;
private ImageView g;
private final TextView h;
private final TextView i;
private int j = -1;
private MenuItemImpl k;
private ColorStateList l;
public BottomNavigationItemView(@NonNull Context paramContext)
{
this(paramContext, null);
}
public BottomNavigationItemView(@NonNull Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, 0);
}
public BottomNavigationItemView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
paramAttributeSet = getResources();
paramInt = paramAttributeSet.getDimensionPixelSize(R.dimen.design_bottom_navigation_text_size);
int m = paramAttributeSet.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_text_size);
this.b = paramAttributeSet.getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
this.c = (paramInt - m);
this.d = (m * 1.0F / paramInt);
this.e = (paramInt * 1.0F / m);
LayoutInflater.from(paramContext).inflate(R.layout.design_bottom_navigation_item, this, true);
setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
this.g = ((ImageView)findViewById(R.id.icon));
this.h = ((TextView)findViewById(R.id.smallLabel));
this.i = ((TextView)findViewById(R.id.largeLabel));
}
public MenuItemImpl getItemData()
{
return this.k;
}
public int getItemPosition()
{
return this.j;
}
public void initialize(MenuItemImpl paramMenuItemImpl, int paramInt)
{
this.k = paramMenuItemImpl;
setCheckable(paramMenuItemImpl.isCheckable());
setChecked(paramMenuItemImpl.isChecked());
setEnabled(paramMenuItemImpl.isEnabled());
setIcon(paramMenuItemImpl.getIcon());
setTitle(paramMenuItemImpl.getTitle());
setId(paramMenuItemImpl.getItemId());
}
public int[] onCreateDrawableState(int paramInt)
{
int[] arrayOfInt = super.onCreateDrawableState(paramInt + 1);
if ((this.k != null) && (this.k.isCheckable()) && (this.k.isChecked())) {
mergeDrawableStates(arrayOfInt, a);
}
return arrayOfInt;
}
public boolean prefersCondensedTitle()
{
return false;
}
public void setCheckable(boolean paramBoolean)
{
refreshDrawableState();
}
public void setChecked(boolean paramBoolean)
{
ViewCompat.setPivotX(this.i, this.i.getWidth() / 2);
ViewCompat.setPivotY(this.i, this.i.getBaseline());
ViewCompat.setPivotX(this.h, this.h.getWidth() / 2);
ViewCompat.setPivotY(this.h, this.h.getBaseline());
FrameLayout.LayoutParams localLayoutParams;
if (this.f) {
if (paramBoolean)
{
localLayoutParams = (FrameLayout.LayoutParams)this.g.getLayoutParams();
localLayoutParams.gravity = 49;
localLayoutParams.topMargin = this.b;
this.g.setLayoutParams(localLayoutParams);
this.i.setVisibility(0);
ViewCompat.setScaleX(this.i, 1.0F);
ViewCompat.setScaleY(this.i, 1.0F);
this.h.setVisibility(4);
}
}
for (;;)
{
refreshDrawableState();
return;
localLayoutParams = (FrameLayout.LayoutParams)this.g.getLayoutParams();
localLayoutParams.gravity = 17;
localLayoutParams.topMargin = this.b;
this.g.setLayoutParams(localLayoutParams);
this.i.setVisibility(4);
ViewCompat.setScaleX(this.i, 0.5F);
ViewCompat.setScaleY(this.i, 0.5F);
break;
if (paramBoolean)
{
localLayoutParams = (FrameLayout.LayoutParams)this.g.getLayoutParams();
localLayoutParams.gravity = 49;
localLayoutParams.topMargin = (this.b + this.c);
this.g.setLayoutParams(localLayoutParams);
this.i.setVisibility(0);
this.h.setVisibility(4);
ViewCompat.setScaleX(this.i, 1.0F);
ViewCompat.setScaleY(this.i, 1.0F);
ViewCompat.setScaleX(this.h, this.d);
ViewCompat.setScaleY(this.h, this.d);
}
else
{
localLayoutParams = (FrameLayout.LayoutParams)this.g.getLayoutParams();
localLayoutParams.gravity = 49;
localLayoutParams.topMargin = this.b;
this.g.setLayoutParams(localLayoutParams);
this.i.setVisibility(4);
this.h.setVisibility(0);
ViewCompat.setScaleX(this.i, this.e);
ViewCompat.setScaleY(this.i, this.e);
ViewCompat.setScaleX(this.h, 1.0F);
ViewCompat.setScaleY(this.h, 1.0F);
}
}
}
public void setEnabled(boolean paramBoolean)
{
super.setEnabled(paramBoolean);
this.h.setEnabled(paramBoolean);
this.i.setEnabled(paramBoolean);
this.g.setEnabled(paramBoolean);
if (paramBoolean)
{
ViewCompat.setPointerIcon(this, PointerIconCompat.getSystemIcon(getContext(), 1002));
return;
}
ViewCompat.setPointerIcon(this, null);
}
public void setIcon(Drawable paramDrawable)
{
Object localObject = paramDrawable;
if (paramDrawable != null)
{
localObject = paramDrawable.getConstantState();
if (localObject != null) {
break label40;
}
}
for (;;)
{
localObject = DrawableCompat.wrap(paramDrawable).mutate();
DrawableCompat.setTintList((Drawable)localObject, this.l);
this.g.setImageDrawable((Drawable)localObject);
return;
label40:
paramDrawable = ((Drawable.ConstantState)localObject).newDrawable();
}
}
public void setIconTintList(ColorStateList paramColorStateList)
{
this.l = paramColorStateList;
if (this.k != null) {
setIcon(this.k.getIcon());
}
}
public void setItemBackground(int paramInt)
{
if (paramInt == 0) {}
for (Drawable localDrawable = null;; localDrawable = ContextCompat.getDrawable(getContext(), paramInt))
{
ViewCompat.setBackground(this, localDrawable);
return;
}
}
public void setItemPosition(int paramInt)
{
this.j = paramInt;
}
public void setShiftingMode(boolean paramBoolean)
{
this.f = paramBoolean;
}
public void setShortcut(boolean paramBoolean, char paramChar) {}
public void setTextColor(ColorStateList paramColorStateList)
{
this.h.setTextColor(paramColorStateList);
this.i.setTextColor(paramColorStateList);
}
public void setTitle(CharSequence paramCharSequence)
{
this.h.setText(paramCharSequence);
this.i.setText(paramCharSequence);
}
public boolean showsIcon()
{
return true;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/design/internal/BottomNavigationItemView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/