AlertController.java
19.8 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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
package android.support.v7.app;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface.OnKeyListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.NestedScrollView;
import android.support.v4.widget.NestedScrollView.OnScrollChangeListener;
import android.support.v7.appcompat.R.attr;
import android.support.v7.appcompat.R.styleable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewStub;
import android.view.Window;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.CursorAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import java.lang.ref.WeakReference;
final class AlertController
{
TextView A;
TextView B;
View C;
ListAdapter D;
int E = -1;
int F;
int G;
int H;
int I;
int J;
int K;
boolean L;
int M = 0;
Handler N;
final View.OnClickListener O = new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
if ((paramAnonymousView == AlertController.this.n) && (AlertController.this.p != null)) {
paramAnonymousView = Message.obtain(AlertController.this.p);
}
for (;;)
{
if (paramAnonymousView != null) {
paramAnonymousView.sendToTarget();
}
AlertController.this.N.obtainMessage(1, AlertController.this.b).sendToTarget();
return;
if ((paramAnonymousView == AlertController.this.q) && (AlertController.this.s != null)) {
paramAnonymousView = Message.obtain(AlertController.this.s);
} else if ((paramAnonymousView == AlertController.this.t) && (AlertController.this.v != null)) {
paramAnonymousView = Message.obtain(AlertController.this.v);
} else {
paramAnonymousView = null;
}
}
}
};
final Context a;
final AppCompatDialog b;
final Window c;
CharSequence d;
CharSequence e;
ListView f;
View g;
int h;
int i;
int j;
int k;
int l;
boolean m = false;
Button n;
CharSequence o;
Message p;
Button q;
CharSequence r;
Message s;
Button t;
CharSequence u;
Message v;
NestedScrollView w;
int x = 0;
Drawable y;
ImageView z;
public AlertController(Context paramContext, AppCompatDialog paramAppCompatDialog, Window paramWindow)
{
this.a = paramContext;
this.b = paramAppCompatDialog;
this.c = paramWindow;
this.N = new a(paramAppCompatDialog);
paramContext = paramContext.obtainStyledAttributes(null, R.styleable.AlertDialog, R.attr.alertDialogStyle, 0);
this.F = paramContext.getResourceId(R.styleable.AlertDialog_android_layout, 0);
this.G = paramContext.getResourceId(R.styleable.AlertDialog_buttonPanelSideLayout, 0);
this.H = paramContext.getResourceId(R.styleable.AlertDialog_listLayout, 0);
this.I = paramContext.getResourceId(R.styleable.AlertDialog_multiChoiceItemLayout, 0);
this.J = paramContext.getResourceId(R.styleable.AlertDialog_singleChoiceItemLayout, 0);
this.K = paramContext.getResourceId(R.styleable.AlertDialog_listItemLayout, 0);
this.L = paramContext.getBoolean(R.styleable.AlertDialog_showTitle, true);
paramContext.recycle();
paramAppCompatDialog.supportRequestWindowFeature(1);
}
@Nullable
static ViewGroup a(@Nullable View paramView1, @Nullable View paramView2)
{
if (paramView1 == null) {
if (!(paramView2 instanceof ViewStub)) {
break label71;
}
}
label71:
for (paramView1 = ((ViewStub)paramView2).inflate();; paramView1 = paramView2)
{
return (ViewGroup)paramView1;
if (paramView2 != null)
{
ViewParent localViewParent = paramView2.getParent();
if ((localViewParent instanceof ViewGroup)) {
((ViewGroup)localViewParent).removeView(paramView2);
}
}
if ((paramView1 instanceof ViewStub)) {
paramView1 = ((ViewStub)paramView1).inflate();
}
for (;;)
{
return (ViewGroup)paramView1;
}
}
}
static void a(View paramView1, View paramView2, View paramView3)
{
int i2 = 0;
if (paramView2 != null)
{
if (ViewCompat.canScrollVertically(paramView1, -1))
{
i1 = 0;
paramView2.setVisibility(i1);
}
}
else if (paramView3 != null) {
if (!ViewCompat.canScrollVertically(paramView1, 1)) {
break label48;
}
}
label48:
for (int i1 = i2;; i1 = 4)
{
paramView3.setVisibility(i1);
return;
i1 = 4;
break;
}
}
static void a(Button paramButton)
{
LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams)paramButton.getLayoutParams();
localLayoutParams.gravity = 1;
localLayoutParams.weight = 0.5F;
paramButton.setLayoutParams(localLayoutParams);
}
static boolean a(View paramView)
{
if (paramView.onCheckIsTextEditor()) {
return true;
}
if (!(paramView instanceof ViewGroup)) {
return false;
}
paramView = (ViewGroup)paramView;
int i1 = paramView.getChildCount();
while (i1 > 0)
{
int i2 = i1 - 1;
i1 = i2;
if (a(paramView.getChildAt(i2))) {
return true;
}
}
return false;
}
public final void a(int paramInt)
{
this.y = null;
this.x = paramInt;
if (this.z != null)
{
if (paramInt != 0)
{
this.z.setVisibility(0);
this.z.setImageResource(this.x);
}
}
else {
return;
}
this.z.setVisibility(8);
}
public final void a(int paramInt, CharSequence paramCharSequence, DialogInterface.OnClickListener paramOnClickListener, Message paramMessage)
{
Message localMessage = paramMessage;
if (paramMessage == null)
{
localMessage = paramMessage;
if (paramOnClickListener != null) {
localMessage = this.N.obtainMessage(paramInt, paramOnClickListener);
}
}
switch (paramInt)
{
default:
throw new IllegalArgumentException("Button does not exist");
case -1:
this.o = paramCharSequence;
this.p = localMessage;
return;
case -2:
this.r = paramCharSequence;
this.s = localMessage;
return;
}
this.u = paramCharSequence;
this.v = localMessage;
}
public final void a(Drawable paramDrawable)
{
this.y = paramDrawable;
this.x = 0;
if (this.z != null)
{
if (paramDrawable != null)
{
this.z.setVisibility(0);
this.z.setImageDrawable(paramDrawable);
}
}
else {
return;
}
this.z.setVisibility(8);
}
public final void a(View paramView, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
this.g = paramView;
this.h = 0;
this.m = true;
this.i = paramInt1;
this.j = paramInt2;
this.k = paramInt3;
this.l = paramInt4;
}
public final void a(CharSequence paramCharSequence)
{
this.d = paramCharSequence;
if (this.A != null) {
this.A.setText(paramCharSequence);
}
}
public final void b(View paramView)
{
this.g = paramView;
this.h = 0;
this.m = false;
}
public final void b(CharSequence paramCharSequence)
{
this.e = paramCharSequence;
if (this.B != null) {
this.B.setText(paramCharSequence);
}
}
public static class AlertParams
{
public ListAdapter mAdapter;
public boolean mCancelable;
public int mCheckedItem = -1;
public boolean[] mCheckedItems;
public final Context mContext;
public Cursor mCursor;
public View mCustomTitleView;
public boolean mForceInverseBackground;
public Drawable mIcon;
public int mIconAttrId = 0;
public int mIconId = 0;
public final LayoutInflater mInflater;
public String mIsCheckedColumn;
public boolean mIsMultiChoice;
public boolean mIsSingleChoice;
public CharSequence[] mItems;
public String mLabelColumn;
public CharSequence mMessage;
public DialogInterface.OnClickListener mNegativeButtonListener;
public CharSequence mNegativeButtonText;
public DialogInterface.OnClickListener mNeutralButtonListener;
public CharSequence mNeutralButtonText;
public DialogInterface.OnCancelListener mOnCancelListener;
public DialogInterface.OnMultiChoiceClickListener mOnCheckboxClickListener;
public DialogInterface.OnClickListener mOnClickListener;
public DialogInterface.OnDismissListener mOnDismissListener;
public AdapterView.OnItemSelectedListener mOnItemSelectedListener;
public DialogInterface.OnKeyListener mOnKeyListener;
public OnPrepareListViewListener mOnPrepareListViewListener;
public DialogInterface.OnClickListener mPositiveButtonListener;
public CharSequence mPositiveButtonText;
public boolean mRecycleOnMeasure = true;
public CharSequence mTitle;
public View mView;
public int mViewLayoutResId;
public int mViewSpacingBottom;
public int mViewSpacingLeft;
public int mViewSpacingRight;
public boolean mViewSpacingSpecified = false;
public int mViewSpacingTop;
public AlertParams(Context paramContext)
{
this.mContext = paramContext;
this.mCancelable = true;
this.mInflater = ((LayoutInflater)paramContext.getSystemService("layout_inflater"));
}
public void apply(final AlertController paramAlertController)
{
final AlertController.RecycleListView localRecycleListView;
Object localObject;
if (this.mCustomTitleView != null)
{
paramAlertController.C = this.mCustomTitleView;
if (this.mMessage != null) {
paramAlertController.b(this.mMessage);
}
if (this.mPositiveButtonText != null) {
paramAlertController.a(-1, this.mPositiveButtonText, this.mPositiveButtonListener, null);
}
if (this.mNegativeButtonText != null) {
paramAlertController.a(-2, this.mNegativeButtonText, this.mNegativeButtonListener, null);
}
if (this.mNeutralButtonText != null) {
paramAlertController.a(-3, this.mNeutralButtonText, this.mNeutralButtonListener, null);
}
if ((this.mItems != null) || (this.mCursor != null) || (this.mAdapter != null))
{
localRecycleListView = (AlertController.RecycleListView)this.mInflater.inflate(paramAlertController.H, null);
if (!this.mIsMultiChoice) {
break label409;
}
if (this.mCursor != null) {
break label386;
}
localObject = new ArrayAdapter(this.mContext, paramAlertController.I, this.mItems, localRecycleListView)
{
public final View getView(int paramAnonymousInt, View paramAnonymousView, ViewGroup paramAnonymousViewGroup)
{
paramAnonymousView = super.getView(paramAnonymousInt, paramAnonymousView, paramAnonymousViewGroup);
if ((AlertController.AlertParams.this.mCheckedItems != null) && (AlertController.AlertParams.this.mCheckedItems[paramAnonymousInt] != 0)) {
localRecycleListView.setItemChecked(paramAnonymousInt, true);
}
return paramAnonymousView;
}
};
label170:
if (this.mOnPrepareListViewListener != null) {
this.mOnPrepareListViewListener.onPrepareListView(localRecycleListView);
}
paramAlertController.D = ((ListAdapter)localObject);
paramAlertController.E = this.mCheckedItem;
if (this.mOnClickListener == null) {
break label510;
}
localRecycleListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
public final void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
{
AlertController.AlertParams.this.mOnClickListener.onClick(paramAlertController.b, paramAnonymousInt);
if (!AlertController.AlertParams.this.mIsSingleChoice) {
paramAlertController.b.dismiss();
}
}
});
label222:
if (this.mOnItemSelectedListener != null) {
localRecycleListView.setOnItemSelectedListener(this.mOnItemSelectedListener);
}
if (!this.mIsSingleChoice) {
break label536;
}
localRecycleListView.setChoiceMode(1);
label251:
paramAlertController.f = localRecycleListView;
}
if (this.mView == null) {
break label561;
}
if (!this.mViewSpacingSpecified) {
break label552;
}
paramAlertController.a(this.mView, this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom);
}
label386:
label409:
label475:
label510:
label536:
label552:
label561:
while (this.mViewLayoutResId == 0)
{
return;
if (this.mTitle != null) {
paramAlertController.a(this.mTitle);
}
if (this.mIcon != null) {
paramAlertController.a(this.mIcon);
}
if (this.mIconId != 0) {
paramAlertController.a(this.mIconId);
}
if (this.mIconAttrId == 0) {
break;
}
i = this.mIconAttrId;
localObject = new TypedValue();
paramAlertController.a.getTheme().resolveAttribute(i, (TypedValue)localObject, true);
paramAlertController.a(((TypedValue)localObject).resourceId);
break;
localObject = new CursorAdapter(this.mContext, this.mCursor, localRecycleListView)
{
private final int d;
private final int e;
public final void bindView(View paramAnonymousView, Context paramAnonymousContext, Cursor paramAnonymousCursor)
{
((CheckedTextView)paramAnonymousView.findViewById(16908308)).setText(paramAnonymousCursor.getString(this.d));
paramAnonymousView = localRecycleListView;
int i = paramAnonymousCursor.getPosition();
if (paramAnonymousCursor.getInt(this.e) == 1) {}
for (boolean bool = true;; bool = false)
{
paramAnonymousView.setItemChecked(i, bool);
return;
}
}
public final View newView(Context paramAnonymousContext, Cursor paramAnonymousCursor, ViewGroup paramAnonymousViewGroup)
{
return AlertController.AlertParams.this.mInflater.inflate(paramAlertController.I, paramAnonymousViewGroup, false);
}
};
break label170;
if (this.mIsSingleChoice) {}
for (i = paramAlertController.J;; i = paramAlertController.K)
{
if (this.mCursor == null) {
break label475;
}
localObject = new SimpleCursorAdapter(this.mContext, i, this.mCursor, new String[] { this.mLabelColumn }, new int[] { 16908308 });
break;
}
if (this.mAdapter != null)
{
localObject = this.mAdapter;
break label170;
}
localObject = new AlertController.b(this.mContext, i, this.mItems);
break label170;
if (this.mOnCheckboxClickListener == null) {
break label222;
}
localRecycleListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
public final void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
{
if (AlertController.AlertParams.this.mCheckedItems != null) {
AlertController.AlertParams.this.mCheckedItems[paramAnonymousInt] = localRecycleListView.isItemChecked(paramAnonymousInt);
}
AlertController.AlertParams.this.mOnCheckboxClickListener.onClick(paramAlertController.b, paramAnonymousInt, localRecycleListView.isItemChecked(paramAnonymousInt));
}
});
break label222;
if (!this.mIsMultiChoice) {
break label251;
}
localRecycleListView.setChoiceMode(2);
break label251;
paramAlertController.b(this.mView);
return;
}
int i = this.mViewLayoutResId;
paramAlertController.g = null;
paramAlertController.h = i;
paramAlertController.m = false;
}
public static abstract interface OnPrepareListViewListener
{
public abstract void onPrepareListView(ListView paramListView);
}
}
public static class RecycleListView
extends ListView
{
private final int a;
private final int b;
public RecycleListView(Context paramContext)
{
this(paramContext, null);
}
public RecycleListView(Context paramContext, AttributeSet paramAttributeSet)
{
super(paramAttributeSet);
paramContext = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.RecycleListView);
this.b = paramContext.getDimensionPixelOffset(R.styleable.RecycleListView_paddingBottomNoButtons, -1);
this.a = paramContext.getDimensionPixelOffset(R.styleable.RecycleListView_paddingTopNoTitle, -1);
}
public void setHasDecor(boolean paramBoolean1, boolean paramBoolean2)
{
int k;
int i;
int m;
if ((!paramBoolean2) || (!paramBoolean1))
{
k = getPaddingLeft();
if (!paramBoolean1) {
break label51;
}
i = getPaddingTop();
m = getPaddingRight();
if (!paramBoolean2) {
break label59;
}
}
label51:
label59:
for (int j = getPaddingBottom();; j = this.b)
{
setPadding(k, i, m, j);
return;
i = this.a;
break;
}
}
}
static final class a
extends Handler
{
private WeakReference<DialogInterface> a;
public a(DialogInterface paramDialogInterface)
{
this.a = new WeakReference(paramDialogInterface);
}
public final void handleMessage(Message paramMessage)
{
switch (paramMessage.what)
{
case 0:
default:
return;
case -3:
case -2:
case -1:
((DialogInterface.OnClickListener)paramMessage.obj).onClick((DialogInterface)this.a.get(), paramMessage.what);
return;
}
((DialogInterface)paramMessage.obj).dismiss();
}
}
static final class b
extends ArrayAdapter<CharSequence>
{
public b(Context paramContext, int paramInt, CharSequence[] paramArrayOfCharSequence)
{
super(paramInt, 16908308, paramArrayOfCharSequence);
}
public final long getItemId(int paramInt)
{
return paramInt;
}
public final boolean hasStableIds()
{
return true;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/app/AlertController.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/