MenuPopupHelper.java
6.23 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
package android.support.v7.view.menu;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build.VERSION;
import android.support.annotation.AttrRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R.attr;
import android.support.v7.appcompat.R.dimen;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow.OnDismissListener;
import fw;
import fy;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class MenuPopupHelper
{
private final Context a;
private final MenuBuilder b;
private final boolean c;
private final int d;
private final int e;
private View f;
private int g = 8388611;
private boolean h;
private MenuPresenter.Callback i;
private fw j;
private PopupWindow.OnDismissListener k;
private final PopupWindow.OnDismissListener l = new PopupWindow.OnDismissListener()
{
public final void onDismiss()
{
MenuPopupHelper.this.onDismiss();
}
};
public MenuPopupHelper(@NonNull Context paramContext, @NonNull MenuBuilder paramMenuBuilder)
{
this(paramContext, paramMenuBuilder, null, false, R.attr.popupMenuStyle, 0);
}
public MenuPopupHelper(@NonNull Context paramContext, @NonNull MenuBuilder paramMenuBuilder, @NonNull View paramView)
{
this(paramContext, paramMenuBuilder, paramView, false, R.attr.popupMenuStyle, 0);
}
public MenuPopupHelper(@NonNull Context paramContext, @NonNull MenuBuilder paramMenuBuilder, @NonNull View paramView, boolean paramBoolean, @AttrRes int paramInt)
{
this(paramContext, paramMenuBuilder, paramView, paramBoolean, paramInt, 0);
}
public MenuPopupHelper(@NonNull Context paramContext, @NonNull MenuBuilder paramMenuBuilder, @NonNull View paramView, boolean paramBoolean, @AttrRes int paramInt1, @StyleRes int paramInt2)
{
this.a = paramContext;
this.b = paramMenuBuilder;
this.f = paramView;
this.c = paramBoolean;
this.d = paramInt1;
this.e = paramInt2;
}
private void a(int paramInt1, int paramInt2, boolean paramBoolean1, boolean paramBoolean2)
{
fw localfw = getPopup();
localfw.b(paramBoolean2);
if (paramBoolean1)
{
int m = paramInt1;
if ((GravityCompat.getAbsoluteGravity(this.g, ViewCompat.getLayoutDirection(this.f)) & 0x7) == 5) {
m = paramInt1 - this.f.getWidth();
}
localfw.b(m);
localfw.c(paramInt2);
paramInt1 = (int)(this.a.getResources().getDisplayMetrics().density * 48.0F / 2.0F);
localfw.e = new Rect(m - paramInt1, paramInt2 - paramInt1, m + paramInt1, paramInt1 + paramInt2);
}
localfw.show();
}
public void dismiss()
{
if (isShowing()) {
this.j.dismiss();
}
}
public int getGravity()
{
return this.g;
}
@NonNull
public fw getPopup()
{
Point localPoint;
int m;
if (this.j == null)
{
localObject = ((WindowManager)this.a.getSystemService("window")).getDefaultDisplay();
localPoint = new Point();
if (Build.VERSION.SDK_INT < 17) {
break label165;
}
((Display)localObject).getRealSize(localPoint);
if (Math.min(localPoint.x, localPoint.y) < this.a.getResources().getDimensionPixelSize(R.dimen.abc_cascading_menus_min_smallest_width)) {
break label196;
}
m = 1;
label75:
if (m == 0) {
break label201;
}
}
label165:
label196:
label201:
for (Object localObject = new CascadingMenuPopup(this.a, this.f, this.d, this.e, this.c);; localObject = new fy(this.a, this.b, this.f, this.d, this.e, this.c))
{
((fw)localObject).a(this.b);
((fw)localObject).a(this.l);
((fw)localObject).a(this.f);
((fw)localObject).setCallback(this.i);
((fw)localObject).a(this.h);
((fw)localObject).a(this.g);
this.j = ((fw)localObject);
return this.j;
if (Build.VERSION.SDK_INT >= 13)
{
((Display)localObject).getSize(localPoint);
break;
}
localPoint.set(((Display)localObject).getWidth(), ((Display)localObject).getHeight());
break;
m = 0;
break label75;
}
}
public boolean isShowing()
{
return (this.j != null) && (this.j.isShowing());
}
protected void onDismiss()
{
this.j = null;
if (this.k != null) {
this.k.onDismiss();
}
}
public void setAnchorView(@NonNull View paramView)
{
this.f = paramView;
}
public void setForceShowIcon(boolean paramBoolean)
{
this.h = paramBoolean;
if (this.j != null) {
this.j.a(paramBoolean);
}
}
public void setGravity(int paramInt)
{
this.g = paramInt;
}
public void setOnDismissListener(@Nullable PopupWindow.OnDismissListener paramOnDismissListener)
{
this.k = paramOnDismissListener;
}
public void setPresenterCallback(@Nullable MenuPresenter.Callback paramCallback)
{
this.i = paramCallback;
if (this.j != null) {
this.j.setCallback(paramCallback);
}
}
public void show()
{
if (!tryShow()) {
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
}
}
public void show(int paramInt1, int paramInt2)
{
if (!tryShow(paramInt1, paramInt2)) {
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
}
}
public boolean tryShow()
{
if (isShowing()) {
return true;
}
if (this.f == null) {
return false;
}
a(0, 0, false, false);
return true;
}
public boolean tryShow(int paramInt1, int paramInt2)
{
if (isShowing()) {
return true;
}
if (this.f == null) {
return false;
}
a(paramInt1, paramInt2, true, true);
return true;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/view/menu/MenuPopupHelper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/