LinearSnapHelper.java
7.63 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
package android.support.v7.widget;
import android.graphics.PointF;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
public class LinearSnapHelper
extends SnapHelper
{
@Nullable
private OrientationHelper b;
@Nullable
private OrientationHelper c;
private int a(RecyclerView.LayoutManager paramLayoutManager, OrientationHelper paramOrientationHelper, int paramInt1, int paramInt2)
{
int[] arrayOfInt = calculateScrollDistance(paramInt1, paramInt2);
Object localObject1 = null;
Object localObject2 = null;
paramInt1 = Integer.MAX_VALUE;
int i = Integer.MIN_VALUE;
int n = paramLayoutManager.getChildCount();
float f;
int k;
label48:
int j;
Object localObject3;
if (n == 0)
{
f = 1.0F;
if (f <= 0.0F) {
return 0;
}
}
else
{
k = 0;
if (k < n)
{
View localView = paramLayoutManager.getChildAt(k);
int m = paramLayoutManager.getPosition(localView);
j = paramInt1;
localObject3 = localObject1;
if (m == -1) {
break label292;
}
paramInt2 = paramInt1;
if (m < paramInt1)
{
paramInt2 = m;
localObject1 = localView;
}
j = paramInt2;
localObject3 = localObject1;
if (m <= i) {
break label292;
}
localObject2 = localObject1;
localObject1 = localView;
paramInt1 = m;
}
}
for (;;)
{
k += 1;
localObject3 = localObject2;
i = paramInt1;
paramInt1 = paramInt2;
localObject2 = localObject1;
localObject1 = localObject3;
break label48;
if ((localObject1 == null) || (localObject2 == null))
{
f = 1.0F;
break;
}
paramInt2 = Math.min(paramOrientationHelper.getDecoratedStart((View)localObject1), paramOrientationHelper.getDecoratedStart((View)localObject2));
paramInt2 = Math.max(paramOrientationHelper.getDecoratedEnd((View)localObject1), paramOrientationHelper.getDecoratedEnd((View)localObject2)) - paramInt2;
if (paramInt2 == 0)
{
f = 1.0F;
break;
}
f = paramInt2 * 1.0F / (i - paramInt1 + 1);
break;
if (Math.abs(arrayOfInt[0]) > Math.abs(arrayOfInt[1])) {}
for (paramInt1 = arrayOfInt[0]; paramInt1 > 0; paramInt1 = arrayOfInt[1]) {
return (int)Math.floor(paramInt1 / f);
}
return (int)Math.ceil(paramInt1 / f);
label292:
paramInt1 = i;
paramInt2 = j;
localObject1 = localObject2;
localObject2 = localObject3;
}
}
private static int a(@NonNull RecyclerView.LayoutManager paramLayoutManager, @NonNull View paramView, OrientationHelper paramOrientationHelper)
{
int j = paramOrientationHelper.getDecoratedStart(paramView);
int k = paramOrientationHelper.getDecoratedMeasurement(paramView) / 2;
if (paramLayoutManager.getClipToPadding()) {}
for (int i = paramOrientationHelper.getStartAfterPadding() + paramOrientationHelper.getTotalSpace() / 2;; i = paramOrientationHelper.getEnd() / 2) {
return k + j - i;
}
}
@NonNull
private OrientationHelper a(@NonNull RecyclerView.LayoutManager paramLayoutManager)
{
if ((this.b == null) || (this.b.mLayoutManager != paramLayoutManager)) {
this.b = OrientationHelper.createVerticalHelper(paramLayoutManager);
}
return this.b;
}
@Nullable
private static View a(RecyclerView.LayoutManager paramLayoutManager, OrientationHelper paramOrientationHelper)
{
Object localObject1 = null;
Object localObject2 = null;
int n = paramLayoutManager.getChildCount();
if (n == 0) {}
int j;
int i;
int k;
label45:
do
{
return (View)localObject2;
if (!paramLayoutManager.getClipToPadding()) {
break;
}
j = paramOrientationHelper.getStartAfterPadding() + paramOrientationHelper.getTotalSpace() / 2;
i = Integer.MAX_VALUE;
k = 0;
localObject2 = localObject1;
} while (k >= n);
localObject2 = paramLayoutManager.getChildAt(k);
int m = Math.abs(paramOrientationHelper.getDecoratedStart((View)localObject2) + paramOrientationHelper.getDecoratedMeasurement((View)localObject2) / 2 - j);
if (m < i)
{
localObject1 = localObject2;
i = m;
}
for (;;)
{
k += 1;
break label45;
j = paramOrientationHelper.getEnd() / 2;
break;
}
}
@NonNull
private OrientationHelper b(@NonNull RecyclerView.LayoutManager paramLayoutManager)
{
if ((this.c == null) || (this.c.mLayoutManager != paramLayoutManager)) {
this.c = OrientationHelper.createHorizontalHelper(paramLayoutManager);
}
return this.c;
}
public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager paramLayoutManager, @NonNull View paramView)
{
int[] arrayOfInt = new int[2];
if (paramLayoutManager.canScrollHorizontally()) {
arrayOfInt[0] = a(paramLayoutManager, paramView, b(paramLayoutManager));
}
while (paramLayoutManager.canScrollVertically())
{
arrayOfInt[1] = a(paramLayoutManager, paramView, a(paramLayoutManager));
return arrayOfInt;
arrayOfInt[0] = 0;
}
arrayOfInt[1] = 0;
return arrayOfInt;
}
public View findSnapView(RecyclerView.LayoutManager paramLayoutManager)
{
if (paramLayoutManager.canScrollVertically()) {
return a(paramLayoutManager, a(paramLayoutManager));
}
if (paramLayoutManager.canScrollHorizontally()) {
return a(paramLayoutManager, b(paramLayoutManager));
}
return null;
}
public int findTargetSnapPosition(RecyclerView.LayoutManager paramLayoutManager, int paramInt1, int paramInt2)
{
if (!(paramLayoutManager instanceof RecyclerView.SmoothScroller.ScrollVectorProvider)) {
paramInt2 = -1;
}
int j;
label152:
label170:
label175:
label180:
do
{
return paramInt2;
j = paramLayoutManager.getItemCount();
if (j == 0) {
return -1;
}
Object localObject = findSnapView(paramLayoutManager);
if (localObject == null) {
return -1;
}
int k = paramLayoutManager.getPosition((View)localObject);
if (k == -1) {
return -1;
}
localObject = ((RecyclerView.SmoothScroller.ScrollVectorProvider)paramLayoutManager).computeScrollVectorForPosition(j - 1);
if (localObject == null) {
return -1;
}
if (paramLayoutManager.canScrollHorizontally())
{
int i = a(paramLayoutManager, b(paramLayoutManager), paramInt1, 0);
paramInt1 = i;
if (((PointF)localObject).x < 0.0F) {
paramInt1 = -i;
}
if (!paramLayoutManager.canScrollVertically()) {
break label170;
}
i = a(paramLayoutManager, a(paramLayoutManager), 0, paramInt2);
paramInt2 = i;
if (((PointF)localObject).y < 0.0F) {
paramInt2 = -i;
}
if (!paramLayoutManager.canScrollVertically()) {
break label175;
}
}
for (;;)
{
if (paramInt2 != 0) {
break label180;
}
return -1;
paramInt1 = 0;
break;
paramInt2 = 0;
break label152;
paramInt2 = paramInt1;
}
paramInt2 = k + paramInt2;
paramInt1 = paramInt2;
if (paramInt2 < 0) {
paramInt1 = 0;
}
paramInt2 = paramInt1;
} while (paramInt1 < j);
return j - 1;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/widget/LinearSnapHelper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/