ActionMenuItemView.java
9.3 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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
package android.support.v7.view.menu;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
import android.support.v4.content.res.ConfigurationHelper;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R.styleable;
import android.support.v7.widget.ActionMenuView.ActionMenuChildView;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.ForwardingListener;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Toast;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
public class ActionMenuItemView
extends AppCompatTextView
implements MenuView.ItemView, ActionMenuView.ActionMenuChildView, View.OnClickListener, View.OnLongClickListener
{
MenuItemImpl a;
MenuBuilder.ItemInvoker b;
PopupCallback c;
private CharSequence d;
private Drawable e;
private ForwardingListener f;
private boolean g;
private boolean h;
private int i;
private int j;
private int k;
public ActionMenuItemView(Context paramContext)
{
this(paramContext, null);
}
public ActionMenuItemView(Context paramContext, AttributeSet paramAttributeSet)
{
this(paramContext, paramAttributeSet, 0);
}
public ActionMenuItemView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
super(paramContext, paramAttributeSet, paramInt);
Resources localResources = paramContext.getResources();
this.g = a();
paramContext = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.ActionMenuItemView, paramInt, 0);
this.i = paramContext.getDimensionPixelSize(R.styleable.ActionMenuItemView_android_minWidth, 0);
paramContext.recycle();
this.k = ((int)(localResources.getDisplayMetrics().density * 32.0F + 0.5F));
setOnClickListener(this);
setOnLongClickListener(this);
this.j = -1;
setSaveEnabled(false);
}
private boolean a()
{
Configuration localConfiguration = getContext().getResources().getConfiguration();
int m = ConfigurationHelper.getScreenWidthDp(getResources());
int n = ConfigurationHelper.getScreenHeightDp(getResources());
return (m >= 480) || ((m >= 640) && (n >= 480)) || (localConfiguration.orientation == 2);
}
private void b()
{
int i1 = 0;
int m;
if (!TextUtils.isEmpty(this.d))
{
m = 1;
if (this.e != null)
{
n = i1;
if (!this.a.showsTextAsAction()) {
break label51;
}
if (!this.g)
{
n = i1;
if (!this.h) {
break label51;
}
}
}
int n = 1;
label51:
if ((m & n) == 0) {
break label75;
}
}
label75:
for (CharSequence localCharSequence = this.d;; localCharSequence = null)
{
setText(localCharSequence);
return;
m = 0;
break;
}
}
public MenuItemImpl getItemData()
{
return this.a;
}
public boolean hasText()
{
return !TextUtils.isEmpty(getText());
}
public void initialize(MenuItemImpl paramMenuItemImpl, int paramInt)
{
this.a = paramMenuItemImpl;
setIcon(paramMenuItemImpl.getIcon());
setTitle(paramMenuItemImpl.a(this));
setId(paramMenuItemImpl.getItemId());
if (paramMenuItemImpl.isVisible()) {}
for (paramInt = 0;; paramInt = 8)
{
setVisibility(paramInt);
setEnabled(paramMenuItemImpl.isEnabled());
if ((paramMenuItemImpl.hasSubMenu()) && (this.f == null)) {
this.f = new a();
}
return;
}
}
public boolean needsDividerAfter()
{
return hasText();
}
public boolean needsDividerBefore()
{
return (hasText()) && (this.a.getIcon() == null);
}
public void onClick(View paramView)
{
if (this.b != null) {
this.b.invokeItem(this.a);
}
}
public void onConfigurationChanged(Configuration paramConfiguration)
{
super.onConfigurationChanged(paramConfiguration);
this.g = a();
b();
}
public boolean onLongClick(View paramView)
{
if (hasText()) {
return false;
}
int[] arrayOfInt = new int[2];
Rect localRect = new Rect();
getLocationOnScreen(arrayOfInt);
getWindowVisibleDisplayFrame(localRect);
Context localContext = getContext();
int m = getWidth();
int i1 = getHeight();
int i2 = arrayOfInt[1];
int i3 = i1 / 2;
int n = arrayOfInt[0];
n = m / 2 + n;
m = n;
if (ViewCompat.getLayoutDirection(paramView) == 0) {
m = localContext.getResources().getDisplayMetrics().widthPixels - n;
}
paramView = Toast.makeText(localContext, this.a.getTitle(), 0);
if (i2 + i3 < localRect.height()) {
paramView.setGravity(8388661, m, arrayOfInt[1] + i1 - localRect.top);
}
for (;;)
{
paramView.show();
return true;
paramView.setGravity(81, 0, i1);
}
}
protected void onMeasure(int paramInt1, int paramInt2)
{
boolean bool = hasText();
if ((bool) && (this.j >= 0)) {
super.setPadding(this.j, getPaddingTop(), getPaddingRight(), getPaddingBottom());
}
super.onMeasure(paramInt1, paramInt2);
int m = View.MeasureSpec.getMode(paramInt1);
paramInt1 = View.MeasureSpec.getSize(paramInt1);
int n = getMeasuredWidth();
if (m == Integer.MIN_VALUE) {}
for (paramInt1 = Math.min(paramInt1, this.i);; paramInt1 = this.i)
{
if ((m != 1073741824) && (this.i > 0) && (n < paramInt1)) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(paramInt1, 1073741824), paramInt2);
}
if ((!bool) && (this.e != null)) {
super.setPadding((getMeasuredWidth() - this.e.getBounds().width()) / 2, getPaddingTop(), getPaddingRight(), getPaddingBottom());
}
return;
}
}
public void onRestoreInstanceState(Parcelable paramParcelable)
{
super.onRestoreInstanceState(null);
}
public boolean onTouchEvent(MotionEvent paramMotionEvent)
{
if ((this.a.hasSubMenu()) && (this.f != null) && (this.f.onTouch(this, paramMotionEvent))) {
return true;
}
return super.onTouchEvent(paramMotionEvent);
}
public boolean prefersCondensedTitle()
{
return true;
}
public void setCheckable(boolean paramBoolean) {}
public void setChecked(boolean paramBoolean) {}
public void setExpandedFormat(boolean paramBoolean)
{
if (this.h != paramBoolean)
{
this.h = paramBoolean;
if (this.a != null) {
this.a.actionFormatChanged();
}
}
}
public void setIcon(Drawable paramDrawable)
{
this.e = paramDrawable;
if (paramDrawable != null)
{
int i2 = paramDrawable.getIntrinsicWidth();
int i1 = paramDrawable.getIntrinsicHeight();
int n = i1;
int m = i2;
float f1;
if (i2 > this.k)
{
f1 = this.k / i2;
m = this.k;
n = (int)(i1 * f1);
}
i2 = n;
i1 = m;
if (n > this.k)
{
f1 = this.k / n;
i2 = this.k;
i1 = (int)(m * f1);
}
paramDrawable.setBounds(0, 0, i1, i2);
}
setCompoundDrawables(paramDrawable, null, null, null);
b();
}
public void setItemInvoker(MenuBuilder.ItemInvoker paramItemInvoker)
{
this.b = paramItemInvoker;
}
public void setPadding(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
this.j = paramInt1;
super.setPadding(paramInt1, paramInt2, paramInt3, paramInt4);
}
public void setPopupCallback(PopupCallback paramPopupCallback)
{
this.c = paramPopupCallback;
}
public void setShortcut(boolean paramBoolean, char paramChar) {}
public void setTitle(CharSequence paramCharSequence)
{
this.d = paramCharSequence;
setContentDescription(this.d);
b();
}
public boolean showsIcon()
{
return true;
}
public static abstract class PopupCallback
{
public abstract ShowableListMenu getPopup();
}
final class a
extends ForwardingListener
{
public a()
{
super();
}
public final ShowableListMenu getPopup()
{
if (ActionMenuItemView.this.c != null) {
return ActionMenuItemView.this.c.getPopup();
}
return null;
}
protected final boolean onForwardingStarted()
{
boolean bool2 = false;
boolean bool1 = bool2;
if (ActionMenuItemView.this.b != null)
{
bool1 = bool2;
if (ActionMenuItemView.this.b.invokeItem(ActionMenuItemView.this.a))
{
ShowableListMenu localShowableListMenu = getPopup();
bool1 = bool2;
if (localShowableListMenu != null)
{
bool1 = bool2;
if (localShowableListMenu.isShowing()) {
bool1 = true;
}
}
}
}
return bool1;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/view/menu/ActionMenuItemView.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/