MenuPopupWindow.java
6.21 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
package android.support.v7.widget;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build.VERSION;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.ListMenuItemView;
import android.support.v7.view.menu.MenuAdapter;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuItemImpl;
import android.transition.Transition;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.widget.HeaderViewListAdapter;
import android.widget.PopupWindow;
import gp;
import java.lang.reflect.Method;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class MenuPopupWindow
extends ListPopupWindow
implements MenuItemHoverListener
{
private static Method a;
private MenuItemHoverListener b;
static
{
try
{
a = PopupWindow.class.getDeclaredMethod("setTouchModal", new Class[] { Boolean.TYPE });
return;
}
catch (NoSuchMethodException localNoSuchMethodException)
{
Log.i("MenuPopupWindow", "Could not find method setTouchModal() on PopupWindow. Oh well.");
}
}
public MenuPopupWindow(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2)
{
super(paramContext, paramAttributeSet, paramInt1, paramInt2);
}
final gp a(Context paramContext, boolean paramBoolean)
{
paramContext = new MenuDropDownListView(paramContext, paramBoolean);
paramContext.setHoverListener(this);
return paramContext;
}
public void onItemHoverEnter(@NonNull MenuBuilder paramMenuBuilder, @NonNull MenuItem paramMenuItem)
{
if (this.b != null) {
this.b.onItemHoverEnter(paramMenuBuilder, paramMenuItem);
}
}
public void onItemHoverExit(@NonNull MenuBuilder paramMenuBuilder, @NonNull MenuItem paramMenuItem)
{
if (this.b != null) {
this.b.onItemHoverExit(paramMenuBuilder, paramMenuItem);
}
}
public void setEnterTransition(Object paramObject)
{
if (Build.VERSION.SDK_INT >= 23) {
this.i.setEnterTransition((Transition)paramObject);
}
}
public void setExitTransition(Object paramObject)
{
if (Build.VERSION.SDK_INT >= 23) {
this.i.setExitTransition((Transition)paramObject);
}
}
public void setHoverListener(MenuItemHoverListener paramMenuItemHoverListener)
{
this.b = paramMenuItemHoverListener;
}
public void setTouchModal(boolean paramBoolean)
{
if (a != null) {}
try
{
a.invoke(this.i, new Object[] { Boolean.valueOf(paramBoolean) });
return;
}
catch (Exception localException)
{
Log.i("MenuPopupWindow", "Could not invoke setTouchModal() on PopupWindow. Oh well.");
}
}
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public static class MenuDropDownListView
extends gp
{
final int f;
final int g;
private MenuItemHoverListener h;
private MenuItem i;
public MenuDropDownListView(Context paramContext, boolean paramBoolean)
{
super(paramBoolean);
paramContext = paramContext.getResources().getConfiguration();
if ((Build.VERSION.SDK_INT >= 17) && (1 == paramContext.getLayoutDirection()))
{
this.f = 21;
this.g = 22;
return;
}
this.f = 22;
this.g = 21;
}
public void clearSelection()
{
setSelection(-1);
}
public boolean onHoverEvent(MotionEvent paramMotionEvent)
{
Object localObject;
int j;
if (this.h != null)
{
localObject = getAdapter();
if (!(localObject instanceof HeaderViewListAdapter)) {
break label166;
}
localObject = (HeaderViewListAdapter)localObject;
j = ((HeaderViewListAdapter)localObject).getHeadersCount();
localObject = (MenuAdapter)((HeaderViewListAdapter)localObject).getWrappedAdapter();
if (paramMotionEvent.getAction() == 10) {
break label178;
}
int k = pointToPosition((int)paramMotionEvent.getX(), (int)paramMotionEvent.getY());
if (k == -1) {
break label178;
}
j = k - j;
if ((j < 0) || (j >= ((MenuAdapter)localObject).getCount())) {
break label178;
}
}
label166:
label178:
for (MenuItemImpl localMenuItemImpl = ((MenuAdapter)localObject).getItem(j);; localMenuItemImpl = null)
{
MenuItem localMenuItem = this.i;
if (localMenuItem != localMenuItemImpl)
{
localObject = ((MenuAdapter)localObject).getAdapterMenu();
if (localMenuItem != null) {
this.h.onItemHoverExit((MenuBuilder)localObject, localMenuItem);
}
this.i = localMenuItemImpl;
if (localMenuItemImpl != null) {
this.h.onItemHoverEnter((MenuBuilder)localObject, localMenuItemImpl);
}
}
return super.onHoverEvent(paramMotionEvent);
j = 0;
localObject = (MenuAdapter)localObject;
break;
}
}
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
{
ListMenuItemView localListMenuItemView = (ListMenuItemView)getSelectedView();
if ((localListMenuItemView != null) && (paramInt == this.f))
{
if ((localListMenuItemView.isEnabled()) && (localListMenuItemView.getItemData().hasSubMenu())) {
performItemClick(localListMenuItemView, getSelectedItemPosition(), getSelectedItemId());
}
return true;
}
if ((localListMenuItemView != null) && (paramInt == this.g))
{
setSelection(-1);
((MenuAdapter)getAdapter()).getAdapterMenu().close(false);
return true;
}
return super.onKeyDown(paramInt, paramKeyEvent);
}
public void setHoverListener(MenuItemHoverListener paramMenuItemHoverListener)
{
this.h = paramMenuItemHoverListener;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/widget/MenuPopupWindow.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/