PopupMenu.java
4.14 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
package android.support.v7.widget;
import android.content.Context;
import android.support.annotation.AttrRes;
import android.support.annotation.MenuRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v7.appcompat.R.attr;
import android.support.v7.view.SupportMenuInflater;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuBuilder.Callback;
import android.support.v7.view.menu.MenuPopupHelper;
import android.support.v7.view.menu.ShowableListMenu;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.PopupWindow.OnDismissListener;
public class PopupMenu
{
final MenuPopupHelper a;
OnMenuItemClickListener b;
OnDismissListener c;
private final Context d;
private final MenuBuilder e;
private final View f;
private View.OnTouchListener g;
public PopupMenu(@NonNull Context paramContext, @NonNull View paramView)
{
this(paramContext, paramView, 0);
}
public PopupMenu(@NonNull Context paramContext, @NonNull View paramView, int paramInt)
{
this(paramContext, paramView, paramInt, R.attr.popupMenuStyle, 0);
}
public PopupMenu(@NonNull Context paramContext, @NonNull View paramView, int paramInt1, @AttrRes int paramInt2, @StyleRes int paramInt3)
{
this.d = paramContext;
this.f = paramView;
this.e = new MenuBuilder(paramContext);
this.e.setCallback(new MenuBuilder.Callback()
{
public final boolean onMenuItemSelected(MenuBuilder paramAnonymousMenuBuilder, MenuItem paramAnonymousMenuItem)
{
if (PopupMenu.this.b != null) {
return PopupMenu.this.b.onMenuItemClick(paramAnonymousMenuItem);
}
return false;
}
public final void onMenuModeChange(MenuBuilder paramAnonymousMenuBuilder) {}
});
this.a = new MenuPopupHelper(paramContext, this.e, paramView, false, paramInt2, paramInt3);
this.a.setGravity(paramInt1);
this.a.setOnDismissListener(new PopupWindow.OnDismissListener()
{
public final void onDismiss()
{
if (PopupMenu.this.c != null) {
PopupMenu.this.c.onDismiss(PopupMenu.this);
}
}
});
}
public void dismiss()
{
this.a.dismiss();
}
@NonNull
public View.OnTouchListener getDragToOpenListener()
{
if (this.g == null) {
this.g = new ForwardingListener(this.f)
{
public final ShowableListMenu getPopup()
{
return PopupMenu.this.a.getPopup();
}
protected final boolean onForwardingStarted()
{
PopupMenu.this.show();
return true;
}
protected final boolean onForwardingStopped()
{
PopupMenu.this.dismiss();
return true;
}
};
}
return this.g;
}
public int getGravity()
{
return this.a.getGravity();
}
@NonNull
public Menu getMenu()
{
return this.e;
}
@NonNull
public MenuInflater getMenuInflater()
{
return new SupportMenuInflater(this.d);
}
public void inflate(@MenuRes int paramInt)
{
getMenuInflater().inflate(paramInt, this.e);
}
public void setGravity(int paramInt)
{
this.a.setGravity(paramInt);
}
public void setOnDismissListener(@Nullable OnDismissListener paramOnDismissListener)
{
this.c = paramOnDismissListener;
}
public void setOnMenuItemClickListener(@Nullable OnMenuItemClickListener paramOnMenuItemClickListener)
{
this.b = paramOnMenuItemClickListener;
}
public void show()
{
this.a.show();
}
public static abstract interface OnDismissListener
{
public abstract void onDismiss(PopupMenu paramPopupMenu);
}
public static abstract interface OnMenuItemClickListener
{
public abstract boolean onMenuItemClick(MenuItem paramMenuItem);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/widget/PopupMenu.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/