BaseMenuPresenter.java
5.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
package android.support.v7.view.menu;
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public abstract class BaseMenuPresenter
implements MenuPresenter
{
private MenuPresenter.Callback a;
private int b;
private int c;
private int d;
protected Context mContext;
protected LayoutInflater mInflater;
protected MenuBuilder mMenu;
protected MenuView mMenuView;
protected Context mSystemContext;
protected LayoutInflater mSystemInflater;
public BaseMenuPresenter(Context paramContext, int paramInt1, int paramInt2)
{
this.mSystemContext = paramContext;
this.mSystemInflater = LayoutInflater.from(paramContext);
this.b = paramInt1;
this.c = paramInt2;
}
protected void addItemView(View paramView, int paramInt)
{
ViewGroup localViewGroup = (ViewGroup)paramView.getParent();
if (localViewGroup != null) {
localViewGroup.removeView(paramView);
}
((ViewGroup)this.mMenuView).addView(paramView, paramInt);
}
public abstract void bindItemView(MenuItemImpl paramMenuItemImpl, MenuView.ItemView paramItemView);
public boolean collapseItemActionView(MenuBuilder paramMenuBuilder, MenuItemImpl paramMenuItemImpl)
{
return false;
}
public MenuView.ItemView createItemView(ViewGroup paramViewGroup)
{
return (MenuView.ItemView)this.mSystemInflater.inflate(this.c, paramViewGroup, false);
}
public boolean expandItemActionView(MenuBuilder paramMenuBuilder, MenuItemImpl paramMenuItemImpl)
{
return false;
}
public boolean filterLeftoverView(ViewGroup paramViewGroup, int paramInt)
{
paramViewGroup.removeViewAt(paramInt);
return true;
}
public boolean flagActionItems()
{
return false;
}
public MenuPresenter.Callback getCallback()
{
return this.a;
}
public int getId()
{
return this.d;
}
public View getItemView(MenuItemImpl paramMenuItemImpl, View paramView, ViewGroup paramViewGroup)
{
if ((paramView instanceof MenuView.ItemView)) {}
for (paramView = (MenuView.ItemView)paramView;; paramView = createItemView(paramViewGroup))
{
bindItemView(paramMenuItemImpl, paramView);
return (View)paramView;
}
}
public MenuView getMenuView(ViewGroup paramViewGroup)
{
if (this.mMenuView == null)
{
this.mMenuView = ((MenuView)this.mSystemInflater.inflate(this.b, paramViewGroup, false));
this.mMenuView.initialize(this.mMenu);
updateMenuView(true);
}
return this.mMenuView;
}
public void initForMenu(Context paramContext, MenuBuilder paramMenuBuilder)
{
this.mContext = paramContext;
this.mInflater = LayoutInflater.from(this.mContext);
this.mMenu = paramMenuBuilder;
}
public void onCloseMenu(MenuBuilder paramMenuBuilder, boolean paramBoolean)
{
if (this.a != null) {
this.a.onCloseMenu(paramMenuBuilder, paramBoolean);
}
}
public boolean onSubMenuSelected(SubMenuBuilder paramSubMenuBuilder)
{
if (this.a != null) {
return this.a.onOpenSubMenu(paramSubMenuBuilder);
}
return false;
}
public void setCallback(MenuPresenter.Callback paramCallback)
{
this.a = paramCallback;
}
public void setId(int paramInt)
{
this.d = paramInt;
}
public boolean shouldIncludeItem(int paramInt, MenuItemImpl paramMenuItemImpl)
{
return true;
}
public void updateMenuView(boolean paramBoolean)
{
ViewGroup localViewGroup = (ViewGroup)this.mMenuView;
if (localViewGroup == null) {}
label198:
label204:
for (;;)
{
return;
int j;
if (this.mMenu != null)
{
this.mMenu.flagActionItems();
ArrayList localArrayList = this.mMenu.getVisibleItems();
int m = localArrayList.size();
int k = 0;
int i = 0;
j = i;
if (k < m)
{
MenuItemImpl localMenuItemImpl2 = (MenuItemImpl)localArrayList.get(k);
if (!shouldIncludeItem(i, localMenuItemImpl2)) {
break label198;
}
View localView1 = localViewGroup.getChildAt(i);
if ((localView1 instanceof MenuView.ItemView)) {}
for (MenuItemImpl localMenuItemImpl1 = ((MenuView.ItemView)localView1).getItemData();; localMenuItemImpl1 = null)
{
View localView2 = getItemView(localMenuItemImpl2, localView1, localViewGroup);
if (localMenuItemImpl2 != localMenuItemImpl1)
{
localView2.setPressed(false);
ViewCompat.jumpDrawablesToCurrentState(localView2);
}
if (localView2 != localView1) {
addItemView(localView2, i);
}
i += 1;
k += 1;
break;
}
}
}
for (;;)
{
if (j >= localViewGroup.getChildCount()) {
break label204;
}
if (!filterLeftoverView(localViewGroup, j))
{
j += 1;
continue;
break;
j = 0;
}
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/view/menu/BaseMenuPresenter.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/