You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

462 lines
14 KiB

package p032k0;
import android.content.res.Resources;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import p023h0.C0829h1;
/* renamed from: k0.a */
/* loaded from: classes.dex */
public abstract class AbstractView$OnTouchListenerC1276a implements View.OnTouchListener {
/* renamed from: u */
public static final int f2966u = ViewConfiguration.getTapTimeout();
/* renamed from: f */
public final View f2969f;
/* renamed from: g */
public Runnable f2970g;
/* renamed from: j */
public int f2973j;
/* renamed from: k */
public int f2974k;
/* renamed from: o */
public boolean f2978o;
/* renamed from: p */
public boolean f2979p;
/* renamed from: q */
public boolean f2980q;
/* renamed from: r */
public boolean f2981r;
/* renamed from: s */
public boolean f2982s;
/* renamed from: t */
public boolean f2983t;
/* renamed from: d */
public final C1277a f2967d = new C1277a();
/* renamed from: e */
public final Interpolator f2968e = new AccelerateInterpolator();
/* renamed from: h */
public float[] f2971h = {0.0f, 0.0f};
/* renamed from: i */
public float[] f2972i = {Float.MAX_VALUE, Float.MAX_VALUE};
/* renamed from: l */
public float[] f2975l = {0.0f, 0.0f};
/* renamed from: m */
public float[] f2976m = {0.0f, 0.0f};
/* renamed from: n */
public float[] f2977n = {Float.MAX_VALUE, Float.MAX_VALUE};
/* renamed from: k0.a$a */
/* loaded from: classes.dex */
public static class C1277a {
/* renamed from: a */
public int f2984a;
/* renamed from: b */
public int f2985b;
/* renamed from: c */
public float f2986c;
/* renamed from: d */
public float f2987d;
/* renamed from: j */
public float f2993j;
/* renamed from: k */
public int f2994k;
/* renamed from: e */
public long f2988e = Long.MIN_VALUE;
/* renamed from: i */
public long f2992i = -1;
/* renamed from: f */
public long f2989f = 0;
/* renamed from: g */
public int f2990g = 0;
/* renamed from: h */
public int f2991h = 0;
/* renamed from: a */
public void m1723a() {
if (this.f2989f == 0) {
throw new RuntimeException("Cannot compute scroll delta before calling start()");
}
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
float m1717g = m1717g(m1719e(currentAnimationTimeMillis));
this.f2989f = currentAnimationTimeMillis;
float f = ((float) (currentAnimationTimeMillis - this.f2989f)) * m1717g;
this.f2990g = (int) (this.f2986c * f);
this.f2991h = (int) (f * this.f2987d);
}
/* renamed from: b */
public int m1722b() {
return this.f2990g;
}
/* renamed from: c */
public int m1721c() {
return this.f2991h;
}
/* renamed from: d */
public int m1720d() {
float f = this.f2986c;
return (int) (f / Math.abs(f));
}
/* renamed from: e */
public final float m1719e(long j) {
long j2 = this.f2988e;
if (j < j2) {
return 0.0f;
}
long j3 = this.f2992i;
if (j3 < 0 || j < j3) {
return AbstractView$OnTouchListenerC1276a.m1740e(((float) (j - j2)) / this.f2984a, 0.0f, 1.0f) * 0.5f;
}
float f = this.f2993j;
return (1.0f - f) + (f * AbstractView$OnTouchListenerC1276a.m1740e(((float) (j - j3)) / this.f2994k, 0.0f, 1.0f));
}
/* renamed from: f */
public int m1718f() {
float f = this.f2987d;
return (int) (f / Math.abs(f));
}
/* renamed from: g */
public final float m1717g(float f) {
return ((-4.0f) * f * f) + (f * 4.0f);
}
/* renamed from: h */
public boolean m1716h() {
return this.f2992i > 0 && AnimationUtils.currentAnimationTimeMillis() > this.f2992i + ((long) this.f2994k);
}
/* renamed from: i */
public void m1715i() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.f2994k = AbstractView$OnTouchListenerC1276a.m1739f((int) (currentAnimationTimeMillis - this.f2988e), 0, this.f2985b);
this.f2993j = m1719e(currentAnimationTimeMillis);
this.f2992i = currentAnimationTimeMillis;
}
/* renamed from: j */
public void m1714j(int i) {
this.f2985b = i;
}
/* renamed from: k */
public void m1713k(int i) {
this.f2984a = i;
}
/* renamed from: l */
public void m1712l(float f, float f2) {
this.f2986c = f;
this.f2987d = f2;
}
/* renamed from: m */
public void m1711m() {
long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
this.f2988e = currentAnimationTimeMillis;
this.f2992i = -1L;
this.f2989f = currentAnimationTimeMillis;
this.f2993j = 0.5f;
this.f2990g = 0;
this.f2991h = 0;
}
}
/* renamed from: k0.a$b */
/* loaded from: classes.dex */
public class RunnableC1278b implements Runnable {
public RunnableC1278b() {
}
@Override // java.lang.Runnable
public void run() {
AbstractView$OnTouchListenerC1276a abstractView$OnTouchListenerC1276a = AbstractView$OnTouchListenerC1276a.this;
if (abstractView$OnTouchListenerC1276a.f2981r) {
if (abstractView$OnTouchListenerC1276a.f2979p) {
abstractView$OnTouchListenerC1276a.f2979p = false;
abstractView$OnTouchListenerC1276a.f2967d.m1711m();
}
C1277a c1277a = AbstractView$OnTouchListenerC1276a.this.f2967d;
if (c1277a.m1716h() || !AbstractView$OnTouchListenerC1276a.this.m1725u()) {
AbstractView$OnTouchListenerC1276a.this.f2981r = false;
return;
}
AbstractView$OnTouchListenerC1276a abstractView$OnTouchListenerC1276a2 = AbstractView$OnTouchListenerC1276a.this;
if (abstractView$OnTouchListenerC1276a2.f2980q) {
abstractView$OnTouchListenerC1276a2.f2980q = false;
abstractView$OnTouchListenerC1276a2.m1742c();
}
c1277a.m1723a();
AbstractView$OnTouchListenerC1276a.this.mo1602j(c1277a.m1722b(), c1277a.m1721c());
C0829h1.m2853J(AbstractView$OnTouchListenerC1276a.this.f2969f, this);
}
}
}
public AbstractView$OnTouchListenerC1276a(View view) {
this.f2969f = view;
float f = Resources.getSystem().getDisplayMetrics().density;
float f2 = (int) ((1575.0f * f) + 0.5f);
m1731o(f2, f2);
float f3 = (int) ((f * 315.0f) + 0.5f);
m1730p(f3, f3);
m1734l(1);
m1732n(Float.MAX_VALUE, Float.MAX_VALUE);
m1727s(0.2f, 0.2f);
m1726t(1.0f, 1.0f);
m1735k(f2966u);
m1728r(500);
m1729q(500);
}
/* renamed from: e */
public static float m1740e(float f, float f2, float f3) {
return f > f3 ? f3 : f < f2 ? f2 : f;
}
/* renamed from: f */
public static int m1739f(int i, int i2, int i3) {
return i > i3 ? i3 : i < i2 ? i2 : i;
}
/* renamed from: a */
public abstract boolean mo1604a(int i);
/* renamed from: b */
public abstract boolean mo1603b(int i);
/* renamed from: c */
public void m1742c() {
long uptimeMillis = SystemClock.uptimeMillis();
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
this.f2969f.onTouchEvent(obtain);
obtain.recycle();
}
/* renamed from: d */
public final float m1741d(int i, float f, float f2, float f3) {
float m1737h = m1737h(this.f2971h[i], f2, this.f2972i[i], f);
if (m1737h == 0.0f) {
return 0.0f;
}
float f4 = this.f2975l[i];
float f5 = this.f2976m[i];
float f6 = this.f2977n[i];
float f7 = f4 * f3;
return m1737h > 0.0f ? m1740e(m1737h * f7, f5, f6) : -m1740e((-m1737h) * f7, f5, f6);
}
/* renamed from: g */
public final float m1738g(float f, float f2) {
if (f2 == 0.0f) {
return 0.0f;
}
int i = this.f2973j;
if (i == 0 || i == 1) {
if (f < f2) {
if (f >= 0.0f) {
return 1.0f - (f / f2);
}
if (this.f2981r && i == 1) {
return 1.0f;
}
}
} else if (i == 2 && f < 0.0f) {
return f / (-f2);
}
return 0.0f;
}
/* renamed from: h */
public final float m1737h(float f, float f2, float f3, float f4) {
float interpolation;
float m1740e = m1740e(f * f2, 0.0f, f3);
float m1738g = m1738g(f2 - f4, m1740e) - m1738g(f4, m1740e);
if (m1738g < 0.0f) {
interpolation = -this.f2968e.getInterpolation(-m1738g);
} else if (m1738g <= 0.0f) {
return 0.0f;
} else {
interpolation = this.f2968e.getInterpolation(m1738g);
}
return m1740e(interpolation, -1.0f, 1.0f);
}
/* renamed from: i */
public final void m1736i() {
if (this.f2979p) {
this.f2981r = false;
} else {
this.f2967d.m1715i();
}
}
/* renamed from: j */
public abstract void mo1602j(int i, int i2);
/* renamed from: k */
public AbstractView$OnTouchListenerC1276a m1735k(int i) {
this.f2974k = i;
return this;
}
/* renamed from: l */
public AbstractView$OnTouchListenerC1276a m1734l(int i) {
this.f2973j = i;
return this;
}
/* renamed from: m */
public AbstractView$OnTouchListenerC1276a m1733m(boolean z) {
if (this.f2982s && !z) {
m1736i();
}
this.f2982s = z;
return this;
}
/* renamed from: n */
public AbstractView$OnTouchListenerC1276a m1732n(float f, float f2) {
float[] fArr = this.f2972i;
fArr[0] = f;
fArr[1] = f2;
return this;
}
/* renamed from: o */
public AbstractView$OnTouchListenerC1276a m1731o(float f, float f2) {
float[] fArr = this.f2977n;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0013, code lost:
if (r0 != 3) goto L12;
*/
@Override // android.view.View.OnTouchListener
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public boolean onTouch(View view, MotionEvent motionEvent) {
if (!this.f2982s) {
return false;
}
int actionMasked = motionEvent.getActionMasked();
if (actionMasked != 0) {
if (actionMasked != 1) {
if (actionMasked != 2) {
}
}
m1736i();
return this.f2983t && this.f2981r;
}
this.f2980q = true;
this.f2978o = false;
this.f2967d.m1712l(m1741d(0, motionEvent.getX(), view.getWidth(), this.f2969f.getWidth()), m1741d(1, motionEvent.getY(), view.getHeight(), this.f2969f.getHeight()));
if (!this.f2981r && m1725u()) {
m1724v();
}
if (this.f2983t) {
return false;
}
}
/* renamed from: p */
public AbstractView$OnTouchListenerC1276a m1730p(float f, float f2) {
float[] fArr = this.f2976m;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
/* renamed from: q */
public AbstractView$OnTouchListenerC1276a m1729q(int i) {
this.f2967d.m1714j(i);
return this;
}
/* renamed from: r */
public AbstractView$OnTouchListenerC1276a m1728r(int i) {
this.f2967d.m1713k(i);
return this;
}
/* renamed from: s */
public AbstractView$OnTouchListenerC1276a m1727s(float f, float f2) {
float[] fArr = this.f2971h;
fArr[0] = f;
fArr[1] = f2;
return this;
}
/* renamed from: t */
public AbstractView$OnTouchListenerC1276a m1726t(float f, float f2) {
float[] fArr = this.f2975l;
fArr[0] = f / 1000.0f;
fArr[1] = f2 / 1000.0f;
return this;
}
/* renamed from: u */
public boolean m1725u() {
C1277a c1277a = this.f2967d;
int m1718f = c1277a.m1718f();
int m1720d = c1277a.m1720d();
return (m1718f != 0 && mo1603b(m1718f)) || (m1720d != 0 && mo1604a(m1720d));
}
/* renamed from: v */
public final void m1724v() {
int i;
if (this.f2970g == null) {
this.f2970g = new RunnableC1278b();
}
this.f2981r = true;
this.f2979p = true;
if (this.f2978o || (i = this.f2974k) <= 0) {
this.f2970g.run();
} else {
C0829h1.m2852K(this.f2969f, this.f2970g, i);
}
this.f2978o = true;
}
}