fy.java
7.72 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
import android.content.Context;
import android.content.res.Resources;
import android.os.Parcelable;
import android.support.v7.appcompat.R.dimen;
import android.support.v7.appcompat.R.layout;
import android.support.v7.view.menu.MenuAdapter;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuPopupHelper;
import android.support.v7.view.menu.MenuPresenter;
import android.support.v7.view.menu.MenuPresenter.Callback;
import android.support.v7.view.menu.SubMenuBuilder;
import android.support.v7.widget.MenuPopupWindow;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnKeyListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.TextView;
public final class fy
extends fw
implements MenuPresenter, View.OnKeyListener, AdapterView.OnItemClickListener, PopupWindow.OnDismissListener
{
final MenuPopupWindow a;
View b;
private final Context c;
private final MenuBuilder d;
private final MenuAdapter f;
private final boolean g;
private final int h;
private final int i;
private final int j;
private final ViewTreeObserver.OnGlobalLayoutListener k = new ViewTreeObserver.OnGlobalLayoutListener()
{
public final void onGlobalLayout()
{
if ((fy.this.isShowing()) && (!fy.this.a.isModal()))
{
View localView = fy.this.b;
if ((localView == null) || (!localView.isShown())) {
fy.this.dismiss();
}
}
else
{
return;
}
fy.this.a.show();
}
};
private PopupWindow.OnDismissListener l;
private View m;
private MenuPresenter.Callback n;
private ViewTreeObserver o;
private boolean p;
private boolean q;
private int r;
private int s = 0;
private boolean t;
public fy(Context paramContext, MenuBuilder paramMenuBuilder, View paramView, int paramInt1, int paramInt2, boolean paramBoolean)
{
this.c = paramContext;
this.d = paramMenuBuilder;
this.g = paramBoolean;
this.f = new MenuAdapter(paramMenuBuilder, LayoutInflater.from(paramContext), this.g);
this.i = paramInt1;
this.j = paramInt2;
Resources localResources = paramContext.getResources();
this.h = Math.max(localResources.getDisplayMetrics().widthPixels / 2, localResources.getDimensionPixelSize(R.dimen.abc_config_prefDialogWidth));
this.m = paramView;
this.a = new MenuPopupWindow(this.c, null, this.i, this.j);
paramMenuBuilder.addMenuPresenter(this, paramContext);
}
public final void a(int paramInt)
{
this.s = paramInt;
}
public final void a(MenuBuilder paramMenuBuilder) {}
public final void a(View paramView)
{
this.m = paramView;
}
public final void a(PopupWindow.OnDismissListener paramOnDismissListener)
{
this.l = paramOnDismissListener;
}
public final void a(boolean paramBoolean)
{
this.f.setForceShowIcon(paramBoolean);
}
public final void b(int paramInt)
{
this.a.setHorizontalOffset(paramInt);
}
public final void b(boolean paramBoolean)
{
this.t = paramBoolean;
}
public final void c(int paramInt)
{
this.a.setVerticalOffset(paramInt);
}
public final void dismiss()
{
if (isShowing()) {
this.a.dismiss();
}
}
public final boolean flagActionItems()
{
return false;
}
public final ListView getListView()
{
return this.a.getListView();
}
public final boolean isShowing()
{
return (!this.p) && (this.a.isShowing());
}
public final void onCloseMenu(MenuBuilder paramMenuBuilder, boolean paramBoolean)
{
if (paramMenuBuilder != this.d) {}
do
{
return;
dismiss();
} while (this.n == null);
this.n.onCloseMenu(paramMenuBuilder, paramBoolean);
}
public final void onDismiss()
{
this.p = true;
this.d.close();
if (this.o != null)
{
if (!this.o.isAlive()) {
this.o = this.b.getViewTreeObserver();
}
this.o.removeGlobalOnLayoutListener(this.k);
this.o = null;
}
if (this.l != null) {
this.l.onDismiss();
}
}
public final boolean onKey(View paramView, int paramInt, KeyEvent paramKeyEvent)
{
if ((paramKeyEvent.getAction() == 1) && (paramInt == 82))
{
dismiss();
return true;
}
return false;
}
public final void onRestoreInstanceState(Parcelable paramParcelable) {}
public final Parcelable onSaveInstanceState()
{
return null;
}
public final boolean onSubMenuSelected(SubMenuBuilder paramSubMenuBuilder)
{
if (paramSubMenuBuilder.hasVisibleItems())
{
MenuPopupHelper localMenuPopupHelper = new MenuPopupHelper(this.c, paramSubMenuBuilder, this.b, this.g, this.i, this.j);
localMenuPopupHelper.setPresenterCallback(this.n);
localMenuPopupHelper.setForceShowIcon(fw.b(paramSubMenuBuilder));
localMenuPopupHelper.setOnDismissListener(this.l);
this.l = null;
this.d.close(false);
if (localMenuPopupHelper.tryShow(this.a.getHorizontalOffset(), this.a.getVerticalOffset()))
{
if (this.n != null) {
this.n.onOpenSubMenu(paramSubMenuBuilder);
}
return true;
}
}
return false;
}
public final void setCallback(MenuPresenter.Callback paramCallback)
{
this.n = paramCallback;
}
public final void show()
{
int i2 = 1;
int i1;
if (isShowing()) {
i1 = i2;
}
while (i1 == 0)
{
throw new IllegalStateException("StandardMenuPopup cannot be used without an anchor");
if ((this.p) || (this.m == null))
{
i1 = 0;
}
else
{
this.b = this.m;
this.a.setOnDismissListener(this);
this.a.setOnItemClickListener(this);
this.a.setModal(true);
Object localObject = this.b;
if (this.o == null) {}
for (i1 = 1;; i1 = 0)
{
this.o = ((View)localObject).getViewTreeObserver();
if (i1 != 0) {
this.o.addOnGlobalLayoutListener(this.k);
}
this.a.setAnchorView((View)localObject);
this.a.setDropDownGravity(this.s);
if (!this.q)
{
this.r = a(this.f, null, this.c, this.h);
this.q = true;
}
this.a.setContentWidth(this.r);
this.a.setInputMethodMode(2);
this.a.setEpicenterBounds(this.e);
this.a.show();
localObject = this.a.getListView();
((ListView)localObject).setOnKeyListener(this);
if ((this.t) && (this.d.getHeaderTitle() != null))
{
FrameLayout localFrameLayout = (FrameLayout)LayoutInflater.from(this.c).inflate(R.layout.abc_popup_menu_header_item_layout, (ViewGroup)localObject, false);
TextView localTextView = (TextView)localFrameLayout.findViewById(16908310);
if (localTextView != null) {
localTextView.setText(this.d.getHeaderTitle());
}
localFrameLayout.setEnabled(false);
((ListView)localObject).addHeaderView(localFrameLayout, null, false);
}
this.a.setAdapter(this.f);
this.a.show();
i1 = i2;
break;
}
}
}
}
public final void updateMenuView(boolean paramBoolean)
{
this.q = false;
if (this.f != null) {
this.f.notifyDataSetChanged();
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/fy.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/