182 lines
5.8 KiB
Java
182 lines
5.8 KiB
Java
|
package o;
|
||
|
|
||
|
import android.graphics.Rect;
|
||
|
import java.util.Comparator;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
final class YCi {
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface IeS<T> {
|
||
|
void xl_(T t, Rect rect);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public interface LWm<T, V> {
|
||
|
V c(T t, int i);
|
||
|
|
||
|
int d(T t);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
static class Sts<T> implements Comparator<T> {
|
||
|
private final IeS<T> b;
|
||
|
private final boolean d;
|
||
|
private final Rect a = new Rect();
|
||
|
private final Rect c = new Rect();
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public Sts(boolean z, IeS<T> ieS) {
|
||
|
this.d = z;
|
||
|
this.b = ieS;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Comparator
|
||
|
public final int compare(T t, T t2) {
|
||
|
Rect rect = this.a;
|
||
|
Rect rect2 = this.c;
|
||
|
this.b.xl_(t, rect);
|
||
|
this.b.xl_(t2, rect2);
|
||
|
if (rect.top < rect2.top) {
|
||
|
return -1;
|
||
|
}
|
||
|
if (rect.top > rect2.top) {
|
||
|
return 1;
|
||
|
}
|
||
|
if (rect.left < rect2.left) {
|
||
|
return this.d ? 1 : -1;
|
||
|
}
|
||
|
if (rect.left > rect2.left) {
|
||
|
return !this.d ? 1 : -1;
|
||
|
}
|
||
|
if (rect.bottom < rect2.bottom) {
|
||
|
return -1;
|
||
|
}
|
||
|
if (rect.bottom > rect2.bottom) {
|
||
|
return 1;
|
||
|
}
|
||
|
if (rect.right < rect2.right) {
|
||
|
return this.d ? 1 : -1;
|
||
|
}
|
||
|
if (rect.right > rect2.right) {
|
||
|
return !this.d ? 1 : -1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static boolean xe_(int i, Rect rect, Rect rect2, Rect rect3) {
|
||
|
boolean xf_ = xf_(i, rect, rect2);
|
||
|
if (xf_(i, rect, rect3) || !xf_) {
|
||
|
return false;
|
||
|
}
|
||
|
return !xh_(i, rect, rect3) || i == 17 || i == 66 || Math.max(0, xi_(i, rect, rect2)) < Math.max(1, xj_(i, rect, rect3));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static boolean xg_(Rect rect, Rect rect2, int i) {
|
||
|
if (i == 17) {
|
||
|
return (rect.right > rect2.right || rect.left >= rect2.right) && rect.left > rect2.left;
|
||
|
}
|
||
|
if (i == 33) {
|
||
|
return (rect.bottom > rect2.bottom || rect.top >= rect2.bottom) && rect.top > rect2.top;
|
||
|
}
|
||
|
if (i == 66) {
|
||
|
return (rect.left < rect2.left || rect.right <= rect2.left) && rect.right < rect2.right;
|
||
|
}
|
||
|
if (i == 130) {
|
||
|
return (rect.top < rect2.top || rect.bottom <= rect2.top) && rect.bottom < rect2.bottom;
|
||
|
}
|
||
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
||
|
}
|
||
|
|
||
|
private static boolean xf_(int i, Rect rect, Rect rect2) {
|
||
|
if (i != 17) {
|
||
|
if (i != 33) {
|
||
|
if (i != 66) {
|
||
|
if (i != 130) {
|
||
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return rect2.right >= rect.left && rect2.left <= rect.right;
|
||
|
}
|
||
|
return rect2.bottom >= rect.top && rect2.top <= rect.bottom;
|
||
|
}
|
||
|
|
||
|
private static boolean xh_(int i, Rect rect, Rect rect2) {
|
||
|
if (i == 17) {
|
||
|
return rect.left >= rect2.right;
|
||
|
}
|
||
|
if (i == 33) {
|
||
|
return rect.top >= rect2.bottom;
|
||
|
}
|
||
|
if (i == 66) {
|
||
|
return rect.right <= rect2.left;
|
||
|
}
|
||
|
if (i == 130) {
|
||
|
return rect.bottom <= rect2.top;
|
||
|
}
|
||
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static int xi_(int i, Rect rect, Rect rect2) {
|
||
|
int i2;
|
||
|
int i3;
|
||
|
if (i == 17) {
|
||
|
i2 = rect.left;
|
||
|
i3 = rect2.right;
|
||
|
} else if (i == 33) {
|
||
|
i2 = rect.top;
|
||
|
i3 = rect2.bottom;
|
||
|
} else if (i == 66) {
|
||
|
i2 = rect2.left;
|
||
|
i3 = rect.right;
|
||
|
} else if (i == 130) {
|
||
|
i2 = rect2.top;
|
||
|
i3 = rect.bottom;
|
||
|
} else {
|
||
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
||
|
}
|
||
|
return i2 - i3;
|
||
|
}
|
||
|
|
||
|
private static int xj_(int i, Rect rect, Rect rect2) {
|
||
|
int i2;
|
||
|
int i3;
|
||
|
if (i == 17) {
|
||
|
i2 = rect.left;
|
||
|
i3 = rect2.left;
|
||
|
} else if (i == 33) {
|
||
|
i2 = rect.top;
|
||
|
i3 = rect2.top;
|
||
|
} else if (i == 66) {
|
||
|
i2 = rect2.right;
|
||
|
i3 = rect.right;
|
||
|
} else if (i == 130) {
|
||
|
i2 = rect2.bottom;
|
||
|
i3 = rect.bottom;
|
||
|
} else {
|
||
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
||
|
}
|
||
|
return i2 - i3;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static int xk_(int i, Rect rect, Rect rect2) {
|
||
|
if (i != 17) {
|
||
|
if (i != 33) {
|
||
|
if (i != 66) {
|
||
|
if (i != 130) {
|
||
|
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return Math.abs((rect.left + (rect.width() / 2)) - (rect2.left + (rect2.width() / 2)));
|
||
|
}
|
||
|
return Math.abs((rect.top + (rect.height() / 2)) - (rect2.top + (rect2.height() / 2)));
|
||
|
}
|
||
|
}
|