FocusStrategy.java
9.94 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
package android.support.v4.widget;
import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
final class FocusStrategy
{
private static int a(int paramInt1, int paramInt2)
{
return paramInt1 * 13 * paramInt1 + paramInt2 * paramInt2;
}
public static <L, T> T a(@NonNull L paramL, @NonNull CollectionAdapter<L, T> paramCollectionAdapter, @NonNull BoundsAdapter<T> paramBoundsAdapter, @Nullable T paramT, int paramInt, boolean paramBoolean)
{
Object localObject = null;
int j = paramCollectionAdapter.size(paramL);
ArrayList localArrayList = new ArrayList(j);
int i = 0;
while (i < j)
{
localArrayList.add(paramCollectionAdapter.get(paramL, i));
i += 1;
}
Collections.sort(localArrayList, new a(paramBoolean, paramBoundsAdapter));
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_FORWARD, FOCUS_BACKWARD}.");
case 2:
i = localArrayList.size();
if (paramT == null) {}
for (paramInt = -1;; paramInt = localArrayList.lastIndexOf(paramT))
{
paramInt += 1;
paramL = (L)localObject;
if (paramInt < i) {
paramL = localArrayList.get(paramInt);
}
return paramL;
}
}
paramInt = localArrayList.size();
if (paramT == null) {}
for (;;)
{
paramInt -= 1;
paramL = (L)localObject;
if (paramInt < 0) {
break;
}
return (T)localArrayList.get(paramInt);
paramInt = localArrayList.indexOf(paramT);
}
}
public static <L, T> T a(@NonNull L paramL, @NonNull CollectionAdapter<L, T> paramCollectionAdapter, @NonNull BoundsAdapter<T> paramBoundsAdapter, @Nullable T paramT, @NonNull Rect paramRect, int paramInt)
{
Rect localRect1 = new Rect(paramRect);
Object localObject1;
Rect localRect2;
int j;
label103:
int i;
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
localRect1.offset(paramRect.width() + 1, 0);
localObject1 = null;
int k = paramCollectionAdapter.size(paramL);
localRect2 = new Rect();
j = 0;
if (j < k)
{
Object localObject2 = paramCollectionAdapter.get(paramL, j);
if (localObject2 == paramT) {
break label333;
}
paramBoundsAdapter.obtainBounds(localObject2, localRect2);
if (a(paramRect, localRect2, paramInt)) {
if (!a(paramRect, localRect1, paramInt))
{
i = 1;
label164:
if (i == 0) {
break label333;
}
localRect1.set(localRect2);
localObject1 = localObject2;
}
}
}
break;
}
label333:
for (;;)
{
j += 1;
break label103;
localRect1.offset(-(paramRect.width() + 1), 0);
break;
localRect1.offset(0, paramRect.height() + 1);
break;
localRect1.offset(0, -(paramRect.height() + 1));
break;
if (a(paramInt, paramRect, localRect2, localRect1))
{
i = 1;
break label164;
}
if ((!a(paramInt, paramRect, localRect1, localRect2)) && (a(b(paramInt, paramRect, localRect2), c(paramInt, paramRect, localRect2)) < a(b(paramInt, paramRect, localRect1), c(paramInt, paramRect, localRect1))))
{
i = 1;
break label164;
}
i = 0;
break label164;
return (T)localObject1;
}
}
private static boolean a(int paramInt, @NonNull Rect paramRect1, @NonNull Rect paramRect2)
{
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
case 66:
if ((paramRect2.bottom < paramRect1.top) || (paramRect2.top > paramRect1.bottom)) {
break;
}
}
do
{
return true;
return false;
} while ((paramRect2.right >= paramRect1.left) && (paramRect2.left <= paramRect1.right));
return false;
}
private static boolean a(int paramInt, @NonNull Rect paramRect1, @NonNull Rect paramRect2, @NonNull Rect paramRect3)
{
boolean bool = a(paramInt, paramRect1, paramRect2);
if ((a(paramInt, paramRect1, paramRect3)) || (!bool)) {
return false;
}
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
if (paramRect1.left >= paramRect3.right) {
i = 1;
}
break;
}
while (i == 0)
{
return true;
i = 0;
continue;
if (paramRect1.right <= paramRect3.left)
{
i = 1;
}
else
{
i = 0;
continue;
if (paramRect1.top >= paramRect3.bottom)
{
i = 1;
}
else
{
i = 0;
continue;
if (paramRect1.bottom <= paramRect3.top) {
i = 1;
} else {
i = 0;
}
}
}
}
if ((paramInt == 17) || (paramInt == 66)) {
return true;
}
int i = b(paramInt, paramRect1, paramRect2);
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
paramInt = paramRect1.left - paramRect3.left;
}
while (i < Math.max(1, paramInt))
{
return true;
paramInt = paramRect3.right - paramRect1.right;
continue;
paramInt = paramRect1.top - paramRect3.top;
continue;
paramInt = paramRect3.bottom - paramRect1.bottom;
}
return false;
}
private static boolean a(@NonNull Rect paramRect1, @NonNull Rect paramRect2, int paramInt)
{
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
if (((paramRect1.right <= paramRect2.right) && (paramRect1.left < paramRect2.right)) || (paramRect1.left <= paramRect2.left)) {
break;
}
}
do
{
do
{
do
{
return true;
return false;
} while (((paramRect1.left < paramRect2.left) || (paramRect1.right <= paramRect2.left)) && (paramRect1.right < paramRect2.right));
return false;
} while (((paramRect1.bottom > paramRect2.bottom) || (paramRect1.top >= paramRect2.bottom)) && (paramRect1.top > paramRect2.top));
return false;
} while (((paramRect1.top < paramRect2.top) || (paramRect1.bottom <= paramRect2.top)) && (paramRect1.bottom < paramRect2.bottom));
return false;
}
private static int b(int paramInt, @NonNull Rect paramRect1, @NonNull Rect paramRect2)
{
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
paramInt = paramRect1.left - paramRect2.right;
}
for (;;)
{
return Math.max(0, paramInt);
paramInt = paramRect2.left - paramRect1.right;
continue;
paramInt = paramRect1.top - paramRect2.bottom;
continue;
paramInt = paramRect2.top - paramRect1.bottom;
}
}
private static int c(int paramInt, @NonNull Rect paramRect1, @NonNull Rect paramRect2)
{
switch (paramInt)
{
default:
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
case 17:
case 66:
return Math.abs(paramRect1.top + paramRect1.height() / 2 - (paramRect2.top + paramRect2.height() / 2));
}
return Math.abs(paramRect1.left + paramRect1.width() / 2 - (paramRect2.left + paramRect2.width() / 2));
}
public static abstract interface BoundsAdapter<T>
{
public abstract void obtainBounds(T paramT, Rect paramRect);
}
public static abstract interface CollectionAdapter<T, V>
{
public abstract V get(T paramT, int paramInt);
public abstract int size(T paramT);
}
static final class a<T>
implements Comparator<T>
{
private final Rect a = new Rect();
private final Rect b = new Rect();
private final boolean c;
private final FocusStrategy.BoundsAdapter<T> d;
a(boolean paramBoolean, FocusStrategy.BoundsAdapter<T> paramBoundsAdapter)
{
this.c = paramBoolean;
this.d = paramBoundsAdapter;
}
public final int compare(T paramT1, T paramT2)
{
Rect localRect1 = this.a;
Rect localRect2 = this.b;
this.d.obtainBounds(paramT1, localRect1);
this.d.obtainBounds(paramT2, localRect2);
if (localRect1.top < localRect2.top) {}
do
{
do
{
do
{
do
{
do
{
return -1;
if (localRect1.top > localRect2.top) {
return 1;
}
if (localRect1.left >= localRect2.left) {
break;
}
} while (!this.c);
return 1;
if (localRect1.left <= localRect2.left) {
break;
}
} while (this.c);
return 1;
} while (localRect1.bottom < localRect2.bottom);
if (localRect1.bottom > localRect2.bottom) {
return 1;
}
if (localRect1.right >= localRect2.right) {
break;
}
} while (!this.c);
return 1;
if (localRect1.right <= localRect2.right) {
break;
}
} while (this.c);
return 1;
return 0;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/widget/FocusStrategy.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/