ViewDragHelper.java
28.1 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
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
package android.support.v4.widget;
import android.content.Context;
import android.content.res.Resources;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import java.util.Arrays;
public class ViewDragHelper
{
public static final int DIRECTION_ALL = 3;
public static final int DIRECTION_HORIZONTAL = 1;
public static final int DIRECTION_VERTICAL = 2;
public static final int EDGE_ALL = 15;
public static final int EDGE_BOTTOM = 8;
public static final int EDGE_LEFT = 1;
public static final int EDGE_RIGHT = 2;
public static final int EDGE_TOP = 4;
public static final int INVALID_POINTER = -1;
public static final int STATE_DRAGGING = 1;
public static final int STATE_IDLE = 0;
public static final int STATE_SETTLING = 2;
private static final Interpolator v = new Interpolator()
{
public final float getInterpolation(float paramAnonymousFloat)
{
paramAnonymousFloat -= 1.0F;
return paramAnonymousFloat * (paramAnonymousFloat * paramAnonymousFloat * paramAnonymousFloat * paramAnonymousFloat) + 1.0F;
}
};
private int a;
private int b;
private int c = -1;
private float[] d;
private float[] e;
private float[] f;
private float[] g;
private int[] h;
private int[] i;
private int[] j;
private int k;
private VelocityTracker l;
private float m;
private float n;
private int o;
private int p;
private ScrollerCompat q;
private final Callback r;
private View s;
private boolean t;
private final ViewGroup u;
private final Runnable w = new Runnable()
{
public final void run()
{
ViewDragHelper.this.a(0);
}
};
private ViewDragHelper(Context paramContext, ViewGroup paramViewGroup, Callback paramCallback)
{
if (paramViewGroup == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (paramCallback == null) {
throw new IllegalArgumentException("Callback may not be null");
}
this.u = paramViewGroup;
this.r = paramCallback;
paramViewGroup = ViewConfiguration.get(paramContext);
this.o = ((int)(paramContext.getResources().getDisplayMetrics().density * 20.0F + 0.5F));
this.b = paramViewGroup.getScaledTouchSlop();
this.m = paramViewGroup.getScaledMaximumFlingVelocity();
this.n = paramViewGroup.getScaledMinimumFlingVelocity();
this.q = ScrollerCompat.create(paramContext, v);
}
private static float a(float paramFloat1, float paramFloat2, float paramFloat3)
{
float f1 = Math.abs(paramFloat1);
if (f1 < paramFloat2) {
paramFloat2 = 0.0F;
}
do
{
return paramFloat2;
if (f1 <= paramFloat3) {
break;
}
paramFloat2 = paramFloat3;
} while (paramFloat1 > 0.0F);
return -paramFloat3;
return paramFloat1;
}
private int a(int paramInt1, int paramInt2, int paramInt3)
{
if (paramInt1 == 0) {
return 0;
}
int i1 = this.u.getWidth();
int i2 = i1 / 2;
float f3 = Math.min(1.0F, Math.abs(paramInt1) / i1);
float f1 = i2;
float f2 = i2;
f3 = (float)Math.sin((float)((f3 - 0.5F) * 0.4712389167638204D));
paramInt2 = Math.abs(paramInt2);
if (paramInt2 > 0) {}
for (paramInt1 = Math.round(Math.abs((f3 * f2 + f1) / paramInt2) * 1000.0F) * 4;; paramInt1 = (int)((Math.abs(paramInt1) / paramInt3 + 1.0F) * 256.0F)) {
return Math.min(paramInt1, 600);
}
}
private void a()
{
this.l.computeCurrentVelocity(1000, this.m);
a(a(VelocityTrackerCompat.getXVelocity(this.l, this.c), this.n, this.m), a(VelocityTrackerCompat.getYVelocity(this.l, this.c), this.n, this.m));
}
private void a(float paramFloat1, float paramFloat2)
{
this.t = true;
this.r.onViewReleased(this.s, paramFloat1, paramFloat2);
this.t = false;
if (this.a == 1) {
a(0);
}
}
private void a(float paramFloat1, float paramFloat2, int paramInt)
{
int i2 = 0;
if ((this.d == null) || (this.d.length <= paramInt))
{
localObject = new float[paramInt + 1];
float[] arrayOfFloat1 = new float[paramInt + 1];
float[] arrayOfFloat2 = new float[paramInt + 1];
float[] arrayOfFloat3 = new float[paramInt + 1];
int[] arrayOfInt1 = new int[paramInt + 1];
int[] arrayOfInt2 = new int[paramInt + 1];
int[] arrayOfInt3 = new int[paramInt + 1];
if (this.d != null)
{
System.arraycopy(this.d, 0, localObject, 0, this.d.length);
System.arraycopy(this.e, 0, arrayOfFloat1, 0, this.e.length);
System.arraycopy(this.f, 0, arrayOfFloat2, 0, this.f.length);
System.arraycopy(this.g, 0, arrayOfFloat3, 0, this.g.length);
System.arraycopy(this.h, 0, arrayOfInt1, 0, this.h.length);
System.arraycopy(this.i, 0, arrayOfInt2, 0, this.i.length);
System.arraycopy(this.j, 0, arrayOfInt3, 0, this.j.length);
}
this.d = ((float[])localObject);
this.e = arrayOfFloat1;
this.f = arrayOfFloat2;
this.g = arrayOfFloat3;
this.h = arrayOfInt1;
this.i = arrayOfInt2;
this.j = arrayOfInt3;
}
Object localObject = this.d;
this.f[paramInt] = paramFloat1;
localObject[paramInt] = paramFloat1;
localObject = this.e;
this.g[paramInt] = paramFloat2;
localObject[paramInt] = paramFloat2;
localObject = this.h;
int i4 = (int)paramFloat1;
int i3 = (int)paramFloat2;
if (i4 < this.u.getLeft() + this.o) {
i2 = 1;
}
int i1 = i2;
if (i3 < this.u.getTop() + this.o) {
i1 = i2 | 0x4;
}
i2 = i1;
if (i4 > this.u.getRight() - this.o) {
i2 = i1 | 0x2;
}
i1 = i2;
if (i3 > this.u.getBottom() - this.o) {
i1 = i2 | 0x8;
}
localObject[paramInt] = i1;
this.k |= 1 << paramInt;
}
private void a(MotionEvent paramMotionEvent)
{
int i2 = paramMotionEvent.getPointerCount();
int i1 = 0;
while (i1 < i2)
{
int i3 = paramMotionEvent.getPointerId(i1);
if (c(i3))
{
float f1 = paramMotionEvent.getX(i1);
float f2 = paramMotionEvent.getY(i1);
this.f[i3] = f1;
this.g[i3] = f2;
}
i1 += 1;
}
}
private boolean a(float paramFloat1, float paramFloat2, int paramInt1, int paramInt2)
{
paramFloat1 = Math.abs(paramFloat1);
paramFloat2 = Math.abs(paramFloat2);
if (((this.h[paramInt1] & paramInt2) != paramInt2) || ((this.p & paramInt2) == 0) || ((this.j[paramInt1] & paramInt2) == paramInt2) || ((this.i[paramInt1] & paramInt2) == paramInt2) || ((paramFloat1 <= this.b) && (paramFloat2 <= this.b))) {}
do
{
return false;
if ((paramFloat1 < paramFloat2 * 0.5F) && (this.r.onEdgeLock(paramInt2)))
{
int[] arrayOfInt = this.j;
arrayOfInt[paramInt1] |= paramInt2;
return false;
}
} while (((this.i[paramInt1] & paramInt2) != 0) || (paramFloat1 <= this.b));
return true;
}
private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
int i1 = this.s.getLeft();
int i2 = this.s.getTop();
paramInt1 -= i1;
paramInt2 -= i2;
if ((paramInt1 == 0) && (paramInt2 == 0))
{
this.q.abortAnimation();
a(0);
return false;
}
View localView = this.s;
paramInt3 = b(paramInt3, (int)this.n, (int)this.m);
paramInt4 = b(paramInt4, (int)this.n, (int)this.m);
int i3 = Math.abs(paramInt1);
int i4 = Math.abs(paramInt2);
int i5 = Math.abs(paramInt3);
int i6 = Math.abs(paramInt4);
int i7 = i5 + i6;
int i8 = i3 + i4;
float f1;
if (paramInt3 != 0)
{
f1 = i5 / i7;
if (paramInt4 == 0) {
break label239;
}
}
label239:
for (float f2 = i6 / i7;; f2 = i4 / i8)
{
paramInt3 = a(paramInt1, paramInt3, this.r.getViewHorizontalDragRange(localView));
paramInt4 = a(paramInt2, paramInt4, this.r.getViewVerticalDragRange(localView));
float f3 = paramInt3;
paramInt3 = (int)(f2 * paramInt4 + f1 * f3);
this.q.startScroll(i1, i2, paramInt1, paramInt2, paramInt3);
a(2);
return true;
f1 = i3 / i8;
break;
}
}
private boolean a(View paramView, float paramFloat1, float paramFloat2)
{
if (paramView == null) {}
label20:
int i2;
label73:
label79:
do
{
do
{
return false;
int i1;
if (this.r.getViewHorizontalDragRange(paramView) > 0)
{
i1 = 1;
if (this.r.getViewVerticalDragRange(paramView) <= 0) {
break label73;
}
}
for (i2 = 1;; i2 = 0)
{
if ((i1 == 0) || (i2 == 0)) {
break label79;
}
if (paramFloat1 * paramFloat1 + paramFloat2 * paramFloat2 <= this.b * this.b) {
break;
}
return true;
i1 = 0;
break label20;
}
if (i1 == 0) {
break;
}
} while (Math.abs(paramFloat1) <= this.b);
return true;
} while ((i2 == 0) || (Math.abs(paramFloat2) <= this.b));
return true;
}
private boolean a(View paramView, int paramInt)
{
if ((paramView == this.s) && (this.c == paramInt)) {
return true;
}
if ((paramView != null) && (this.r.tryCaptureView(paramView, paramInt)))
{
this.c = paramInt;
captureChildView(paramView, paramInt);
return true;
}
return false;
}
private static int b(int paramInt1, int paramInt2, int paramInt3)
{
int i1 = Math.abs(paramInt1);
if (i1 < paramInt2) {
paramInt2 = 0;
}
do
{
return paramInt2;
if (i1 <= paramInt3) {
break;
}
paramInt2 = paramInt3;
} while (paramInt1 > 0);
return -paramInt3;
return paramInt1;
}
private void b(float paramFloat1, float paramFloat2, int paramInt)
{
int i2 = 1;
if (a(paramFloat1, paramFloat2, paramInt, 1)) {}
for (;;)
{
int i1 = i2;
if (a(paramFloat2, paramFloat1, paramInt, 4)) {
i1 = i2 | 0x4;
}
i2 = i1;
if (a(paramFloat1, paramFloat2, paramInt, 2)) {
i2 = i1 | 0x2;
}
i1 = i2;
if (a(paramFloat2, paramFloat1, paramInt, 8)) {
i1 = i2 | 0x8;
}
if (i1 != 0)
{
int[] arrayOfInt = this.i;
arrayOfInt[paramInt] |= i1;
this.r.onEdgeDragStarted(i1, paramInt);
}
return;
i2 = 0;
}
}
private void b(int paramInt)
{
if ((this.d == null) || (!isPointerDown(paramInt))) {
return;
}
this.d[paramInt] = 0.0F;
this.e[paramInt] = 0.0F;
this.f[paramInt] = 0.0F;
this.g[paramInt] = 0.0F;
this.h[paramInt] = 0;
this.i[paramInt] = 0;
this.j[paramInt] = 0;
this.k &= (1 << paramInt ^ 0xFFFFFFFF);
}
private boolean c(int paramInt)
{
if (!isPointerDown(paramInt))
{
Log.e("ViewDragHelper", "Ignoring pointerId=" + paramInt + " because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because ViewDragHelper did not receive all the events in the event stream.");
return false;
}
return true;
}
public static ViewDragHelper create(ViewGroup paramViewGroup, float paramFloat, Callback paramCallback)
{
paramViewGroup = create(paramViewGroup, paramCallback);
paramViewGroup.b = ((int)(paramViewGroup.b * (1.0F / paramFloat)));
return paramViewGroup;
}
public static ViewDragHelper create(ViewGroup paramViewGroup, Callback paramCallback)
{
return new ViewDragHelper(paramViewGroup.getContext(), paramViewGroup, paramCallback);
}
final void a(int paramInt)
{
this.u.removeCallbacks(this.w);
if (this.a != paramInt)
{
this.a = paramInt;
this.r.onViewDragStateChanged(paramInt);
if (this.a == 0) {
this.s = null;
}
}
}
public void abort()
{
cancel();
if (this.a == 2)
{
int i1 = this.q.getCurrX();
int i2 = this.q.getCurrY();
this.q.abortAnimation();
int i3 = this.q.getCurrX();
int i4 = this.q.getCurrY();
this.r.onViewPositionChanged(this.s, i3, i4, i3 - i1, i4 - i2);
}
a(0);
}
protected boolean canScroll(View paramView, boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
if ((paramView instanceof ViewGroup))
{
ViewGroup localViewGroup = (ViewGroup)paramView;
int i2 = paramView.getScrollX();
int i3 = paramView.getScrollY();
int i1 = localViewGroup.getChildCount() - 1;
while (i1 >= 0)
{
View localView = localViewGroup.getChildAt(i1);
if ((paramInt3 + i2 >= localView.getLeft()) && (paramInt3 + i2 < localView.getRight()) && (paramInt4 + i3 >= localView.getTop()) && (paramInt4 + i3 < localView.getBottom()) && (canScroll(localView, true, paramInt1, paramInt2, paramInt3 + i2 - localView.getLeft(), paramInt4 + i3 - localView.getTop()))) {
return true;
}
i1 -= 1;
}
}
return (paramBoolean) && ((ViewCompat.canScrollHorizontally(paramView, -paramInt1)) || (ViewCompat.canScrollVertically(paramView, -paramInt2)));
}
public void cancel()
{
this.c = -1;
if (this.d != null)
{
Arrays.fill(this.d, 0.0F);
Arrays.fill(this.e, 0.0F);
Arrays.fill(this.f, 0.0F);
Arrays.fill(this.g, 0.0F);
Arrays.fill(this.h, 0);
Arrays.fill(this.i, 0);
Arrays.fill(this.j, 0);
this.k = 0;
}
if (this.l != null)
{
this.l.recycle();
this.l = null;
}
}
public void captureChildView(View paramView, int paramInt)
{
if (paramView.getParent() != this.u) {
throw new IllegalArgumentException("captureChildView: parameter must be a descendant of the ViewDragHelper's tracked parent view (" + this.u + ")");
}
this.s = paramView;
this.c = paramInt;
this.r.onViewCaptured(paramView, paramInt);
a(1);
}
public boolean checkTouchSlop(int paramInt)
{
boolean bool2 = false;
int i2 = this.d.length;
int i1 = 0;
for (;;)
{
boolean bool1 = bool2;
if (i1 < i2)
{
if (checkTouchSlop(paramInt, i1)) {
bool1 = true;
}
}
else {
return bool1;
}
i1 += 1;
}
}
public boolean checkTouchSlop(int paramInt1, int paramInt2)
{
if (!isPointerDown(paramInt2)) {}
label20:
float f2;
label98:
label103:
do
{
float f1;
do
{
return false;
int i1;
if ((paramInt1 & 0x1) == 1)
{
i1 = 1;
if ((paramInt1 & 0x2) != 2) {
break label98;
}
}
for (paramInt1 = 1;; paramInt1 = 0)
{
f1 = this.f[paramInt2] - this.d[paramInt2];
f2 = this.g[paramInt2] - this.e[paramInt2];
if ((i1 == 0) || (paramInt1 == 0)) {
break label103;
}
if (f1 * f1 + f2 * f2 <= this.b * this.b) {
break;
}
return true;
i1 = 0;
break label20;
}
if (i1 == 0) {
break;
}
} while (Math.abs(f1) <= this.b);
return true;
} while ((paramInt1 == 0) || (Math.abs(f2) <= this.b));
return true;
}
public boolean continueSettling(boolean paramBoolean)
{
boolean bool;
if (this.a == 2)
{
bool = this.q.computeScrollOffset();
int i1 = this.q.getCurrX();
int i2 = this.q.getCurrY();
int i3 = i1 - this.s.getLeft();
int i4 = i2 - this.s.getTop();
if (i3 != 0) {
ViewCompat.offsetLeftAndRight(this.s, i3);
}
if (i4 != 0) {
ViewCompat.offsetTopAndBottom(this.s, i4);
}
if ((i3 != 0) || (i4 != 0)) {
this.r.onViewPositionChanged(this.s, i1, i2, i3, i4);
}
if ((!bool) || (i1 != this.q.getFinalX()) || (i2 != this.q.getFinalY())) {
break label188;
}
this.q.abortAnimation();
bool = false;
}
label178:
label188:
for (;;)
{
if (!bool)
{
if (!paramBoolean) {
break label178;
}
this.u.post(this.w);
}
while (this.a == 2)
{
return true;
a(0);
}
return false;
}
}
public View findTopChildUnder(int paramInt1, int paramInt2)
{
int i1 = this.u.getChildCount() - 1;
while (i1 >= 0)
{
View localView = this.u.getChildAt(this.r.getOrderedChildIndex(i1));
if ((paramInt1 >= localView.getLeft()) && (paramInt1 < localView.getRight()) && (paramInt2 >= localView.getTop()) && (paramInt2 < localView.getBottom())) {
return localView;
}
i1 -= 1;
}
return null;
}
public void flingCapturedView(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
{
if (!this.t) {
throw new IllegalStateException("Cannot flingCapturedView outside of a call to Callback#onViewReleased");
}
this.q.fling(this.s.getLeft(), this.s.getTop(), (int)VelocityTrackerCompat.getXVelocity(this.l, this.c), (int)VelocityTrackerCompat.getYVelocity(this.l, this.c), paramInt1, paramInt3, paramInt2, paramInt4);
a(2);
}
public int getActivePointerId()
{
return this.c;
}
public View getCapturedView()
{
return this.s;
}
public int getEdgeSize()
{
return this.o;
}
public float getMinVelocity()
{
return this.n;
}
public int getTouchSlop()
{
return this.b;
}
public int getViewDragState()
{
return this.a;
}
public boolean isCapturedViewUnder(int paramInt1, int paramInt2)
{
return isViewUnder(this.s, paramInt1, paramInt2);
}
public boolean isEdgeTouched(int paramInt)
{
boolean bool2 = false;
int i2 = this.h.length;
int i1 = 0;
for (;;)
{
boolean bool1 = bool2;
if (i1 < i2)
{
if (isEdgeTouched(paramInt, i1)) {
bool1 = true;
}
}
else {
return bool1;
}
i1 += 1;
}
}
public boolean isEdgeTouched(int paramInt1, int paramInt2)
{
return (isPointerDown(paramInt2)) && ((this.h[paramInt2] & paramInt1) != 0);
}
public boolean isPointerDown(int paramInt)
{
return (this.k & 1 << paramInt) != 0;
}
public boolean isViewUnder(View paramView, int paramInt1, int paramInt2)
{
if (paramView == null) {}
while ((paramInt1 < paramView.getLeft()) || (paramInt1 >= paramView.getRight()) || (paramInt2 < paramView.getTop()) || (paramInt2 >= paramView.getBottom())) {
return false;
}
return true;
}
public void processTouchEvent(MotionEvent paramMotionEvent)
{
int i1 = 0;
int i2 = 0;
int i4 = MotionEventCompat.getActionMasked(paramMotionEvent);
int i3 = MotionEventCompat.getActionIndex(paramMotionEvent);
if (i4 == 0) {
cancel();
}
if (this.l == null) {
this.l = VelocityTracker.obtain();
}
this.l.addMovement(paramMotionEvent);
float f1;
float f2;
switch (i4)
{
case 4:
default:
case 0:
case 5:
case 2:
do
{
do
{
do
{
do
{
return;
f1 = paramMotionEvent.getX();
f2 = paramMotionEvent.getY();
i1 = paramMotionEvent.getPointerId(0);
paramMotionEvent = findTopChildUnder((int)f1, (int)f2);
a(f1, f2, i1);
a(paramMotionEvent, i1);
i2 = this.h[i1];
} while ((this.p & i2) == 0);
this.r.onEdgeTouched(i2 & this.p, i1);
return;
i1 = paramMotionEvent.getPointerId(i3);
f1 = paramMotionEvent.getX(i3);
f2 = paramMotionEvent.getY(i3);
a(f1, f2, i1);
if (this.a != 0) {
break;
}
a(findTopChildUnder((int)f1, (int)f2), i1);
i2 = this.h[i1];
} while ((this.p & i2) == 0);
this.r.onEdgeTouched(i2 & this.p, i1);
return;
} while (!isCapturedViewUnder((int)f1, (int)f2));
a(this.s, i1);
return;
if (this.a != 1) {
break;
}
} while (!c(this.c));
i1 = paramMotionEvent.findPointerIndex(this.c);
f1 = paramMotionEvent.getX(i1);
f2 = paramMotionEvent.getY(i1);
i4 = (int)(f1 - this.f[this.c]);
int i5 = (int)(f2 - this.g[this.c]);
i2 = this.s.getLeft() + i4;
i3 = this.s.getTop() + i5;
int i6 = this.s.getLeft();
int i7 = this.s.getTop();
i1 = i2;
if (i4 != 0)
{
i1 = this.r.clampViewPositionHorizontal(this.s, i2, i4);
ViewCompat.offsetLeftAndRight(this.s, i1 - i6);
}
i2 = i3;
if (i5 != 0)
{
i2 = this.r.clampViewPositionVertical(this.s, i3, i5);
ViewCompat.offsetTopAndBottom(this.s, i2 - i7);
}
if ((i4 != 0) || (i5 != 0)) {
this.r.onViewPositionChanged(this.s, i1, i2, i1 - i6, i2 - i7);
}
a(paramMotionEvent);
return;
i3 = paramMotionEvent.getPointerCount();
i1 = i2;
while (i1 < i3)
{
i2 = paramMotionEvent.getPointerId(i1);
if (c(i2))
{
f1 = paramMotionEvent.getX(i1);
f2 = paramMotionEvent.getY(i1);
float f3 = f1 - this.d[i2];
float f4 = f2 - this.e[i2];
b(f3, f4, i2);
if (this.a == 1) {
break;
}
View localView = findTopChildUnder((int)f1, (int)f2);
if ((a(localView, f3, f4)) && (a(localView, i2))) {
break;
}
}
i1 += 1;
}
a(paramMotionEvent);
return;
case 6:
i2 = paramMotionEvent.getPointerId(i3);
if ((this.a == 1) && (i2 == this.c))
{
i3 = paramMotionEvent.getPointerCount();
if (i1 >= i3) {
break label814;
}
i4 = paramMotionEvent.getPointerId(i1);
if (i4 == this.c) {
break label769;
}
f1 = paramMotionEvent.getX(i1);
f2 = paramMotionEvent.getY(i1);
if ((findTopChildUnder((int)f1, (int)f2) != this.s) || (!a(this.s, i4))) {
break label769;
}
}
break;
}
label769:
label814:
for (i1 = this.c;; i1 = -1)
{
if (i1 == -1) {
a();
}
b(i2);
return;
i1 += 1;
break;
if (this.a == 1) {
a();
}
cancel();
return;
if (this.a == 1) {
a(0.0F, 0.0F);
}
cancel();
return;
}
}
public void setEdgeTrackingEnabled(int paramInt)
{
this.p = paramInt;
}
public void setMinVelocity(float paramFloat)
{
this.n = paramFloat;
}
public boolean settleCapturedViewAt(int paramInt1, int paramInt2)
{
if (!this.t) {
throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to Callback#onViewReleased");
}
return a(paramInt1, paramInt2, (int)VelocityTrackerCompat.getXVelocity(this.l, this.c), (int)VelocityTrackerCompat.getYVelocity(this.l, this.c));
}
public boolean shouldInterceptTouchEvent(MotionEvent paramMotionEvent)
{
int i2 = MotionEventCompat.getActionMasked(paramMotionEvent);
int i1 = MotionEventCompat.getActionIndex(paramMotionEvent);
if (i2 == 0) {
cancel();
}
if (this.l == null) {
this.l = VelocityTracker.obtain();
}
this.l.addMovement(paramMotionEvent);
switch (i2)
{
}
while (this.a == 1)
{
return true;
float f1 = paramMotionEvent.getX();
float f2 = paramMotionEvent.getY();
i1 = paramMotionEvent.getPointerId(0);
a(f1, f2, i1);
paramMotionEvent = findTopChildUnder((int)f1, (int)f2);
if ((paramMotionEvent == this.s) && (this.a == 2)) {
a(paramMotionEvent, i1);
}
i2 = this.h[i1];
if ((this.p & i2) != 0)
{
this.r.onEdgeTouched(i2 & this.p, i1);
continue;
i2 = paramMotionEvent.getPointerId(i1);
f1 = paramMotionEvent.getX(i1);
f2 = paramMotionEvent.getY(i1);
a(f1, f2, i2);
if (this.a == 0)
{
i1 = this.h[i2];
if ((this.p & i1) != 0) {
this.r.onEdgeTouched(i1 & this.p, i2);
}
}
else if (this.a == 2)
{
paramMotionEvent = findTopChildUnder((int)f1, (int)f2);
if (paramMotionEvent == this.s)
{
a(paramMotionEvent, i2);
continue;
if ((this.d != null) && (this.e != null))
{
int i3 = paramMotionEvent.getPointerCount();
i1 = 0;
if (i1 < i3)
{
int i4 = paramMotionEvent.getPointerId(i1);
float f3;
float f4;
View localView;
if (c(i4))
{
f1 = paramMotionEvent.getX(i1);
f2 = paramMotionEvent.getY(i1);
f3 = f1 - this.d[i4];
f4 = f2 - this.e[i4];
localView = findTopChildUnder((int)f1, (int)f2);
if ((localView == null) || (!a(localView, f3, f4))) {
break label585;
}
}
label585:
for (i2 = 1;; i2 = 0)
{
if (i2 != 0)
{
int i5 = localView.getLeft();
int i6 = (int)f3;
i6 = this.r.clampViewPositionHorizontal(localView, i6 + i5, (int)f3);
int i7 = localView.getTop();
int i8 = (int)f4;
i8 = this.r.clampViewPositionVertical(localView, i8 + i7, (int)f4);
int i9 = this.r.getViewHorizontalDragRange(localView);
int i10 = this.r.getViewVerticalDragRange(localView);
if (((i9 == 0) || ((i9 > 0) && (i6 == i5))) && ((i10 == 0) || ((i10 > 0) && (i8 == i7)))) {
break label591;
}
}
b(f3, f4, i4);
if ((this.a == 1) || ((i2 != 0) && (a(localView, i4)))) {
break label591;
}
i1 += 1;
break;
}
}
label591:
a(paramMotionEvent);
continue;
b(paramMotionEvent.getPointerId(i1));
continue;
cancel();
}
}
}
}
}
return false;
}
public boolean smoothSlideViewTo(View paramView, int paramInt1, int paramInt2)
{
this.s = paramView;
this.c = -1;
boolean bool = a(paramInt1, paramInt2, 0, 0);
if ((!bool) && (this.a == 0) && (this.s != null)) {
this.s = null;
}
return bool;
}
public static abstract class Callback
{
public int clampViewPositionHorizontal(View paramView, int paramInt1, int paramInt2)
{
return 0;
}
public int clampViewPositionVertical(View paramView, int paramInt1, int paramInt2)
{
return 0;
}
public int getOrderedChildIndex(int paramInt)
{
return paramInt;
}
public int getViewHorizontalDragRange(View paramView)
{
return 0;
}
public int getViewVerticalDragRange(View paramView)
{
return 0;
}
public void onEdgeDragStarted(int paramInt1, int paramInt2) {}
public boolean onEdgeLock(int paramInt)
{
return false;
}
public void onEdgeTouched(int paramInt1, int paramInt2) {}
public void onViewCaptured(View paramView, int paramInt) {}
public void onViewDragStateChanged(int paramInt) {}
public void onViewPositionChanged(View paramView, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {}
public void onViewReleased(View paramView, float paramFloat1, float paramFloat2) {}
public abstract boolean tryCaptureView(View paramView, int paramInt);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/widget/ViewDragHelper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/