package d0; import android.content.Context; 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 android.widget.OverScroller; import androidx.core.view.n0; import java.util.Arrays; /* loaded from: classes.dex */ public class c { /* renamed from: w, reason: collision with root package name */ private static final Interpolator f8962w = new a(); /* renamed from: a, reason: collision with root package name */ private int f8963a; /* renamed from: b, reason: collision with root package name */ private int f8964b; /* renamed from: d, reason: collision with root package name */ private float[] f8966d; /* renamed from: e, reason: collision with root package name */ private float[] f8967e; /* renamed from: f, reason: collision with root package name */ private float[] f8968f; /* renamed from: g, reason: collision with root package name */ private float[] f8969g; /* renamed from: h, reason: collision with root package name */ private int[] f8970h; /* renamed from: i, reason: collision with root package name */ private int[] f8971i; /* renamed from: j, reason: collision with root package name */ private int[] f8972j; /* renamed from: k, reason: collision with root package name */ private int f8973k; /* renamed from: l, reason: collision with root package name */ private VelocityTracker f8974l; /* renamed from: m, reason: collision with root package name */ private float f8975m; /* renamed from: n, reason: collision with root package name */ private float f8976n; /* renamed from: o, reason: collision with root package name */ private int f8977o; /* renamed from: p, reason: collision with root package name */ private int f8978p; /* renamed from: q, reason: collision with root package name */ private OverScroller f8979q; /* renamed from: r, reason: collision with root package name */ private final AbstractC0132c f8980r; /* renamed from: s, reason: collision with root package name */ private View f8981s; /* renamed from: t, reason: collision with root package name */ private boolean f8982t; /* renamed from: u, reason: collision with root package name */ private final ViewGroup f8983u; /* renamed from: c, reason: collision with root package name */ private int f8965c = -1; /* renamed from: v, reason: collision with root package name */ private final Runnable f8984v = new b(); static class a implements Interpolator { a() { } @Override // android.animation.TimeInterpolator public float getInterpolation(float f10) { float f11 = f10 - 1.0f; return (f11 * f11 * f11 * f11 * f11) + 1.0f; } } class b implements Runnable { b() { } @Override // java.lang.Runnable public void run() { c.this.E(0); } } /* renamed from: d0.c$c, reason: collision with other inner class name */ public static abstract class AbstractC0132c { public abstract int a(View view, int i10, int i11); public abstract int b(View view, int i10, int i11); public int c(int i10) { return i10; } public int d(View view) { return 0; } public int e(View view) { return 0; } public void f(int i10, int i11) { } public boolean g(int i10) { return false; } public void h(int i10, int i11) { } public void i(View view, int i10) { } public abstract void j(int i10); public abstract void k(View view, int i10, int i11, int i12, int i13); public abstract void l(View view, float f10, float f11); public abstract boolean m(View view, int i10); } private c(Context context, ViewGroup viewGroup, AbstractC0132c abstractC0132c) { if (viewGroup == null) { throw new IllegalArgumentException("Parent view may not be null"); } if (abstractC0132c == null) { throw new IllegalArgumentException("Callback may not be null"); } this.f8983u = viewGroup; this.f8980r = abstractC0132c; ViewConfiguration viewConfiguration = ViewConfiguration.get(context); this.f8977o = (int) ((context.getResources().getDisplayMetrics().density * 20.0f) + 0.5f); this.f8964b = viewConfiguration.getScaledTouchSlop(); this.f8975m = viewConfiguration.getScaledMaximumFlingVelocity(); this.f8976n = viewConfiguration.getScaledMinimumFlingVelocity(); this.f8979q = new OverScroller(context, f8962w); } private void A() { this.f8974l.computeCurrentVelocity(1000, this.f8975m); n(e(this.f8974l.getXVelocity(this.f8965c), this.f8976n, this.f8975m), e(this.f8974l.getYVelocity(this.f8965c), this.f8976n, this.f8975m)); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r0v15 */ /* JADX WARN: Type inference failed for: r0v16 */ /* JADX WARN: Type inference failed for: r0v4, types: [int] */ /* JADX WARN: Type inference failed for: r0v6 */ /* JADX WARN: Type inference failed for: r0v7 */ /* JADX WARN: Type inference failed for: r3v3, types: [d0.c$c] */ private void B(float f10, float f11, int i10) { boolean c10 = c(f10, f11, i10, 1); boolean z10 = c10; if (c(f11, f10, i10, 4)) { z10 = (c10 ? 1 : 0) | 4; } boolean z11 = z10; if (c(f10, f11, i10, 2)) { z11 = (z10 ? 1 : 0) | 2; } ?? r02 = z11; if (c(f11, f10, i10, 8)) { r02 = (z11 ? 1 : 0) | 8; } if (r02 != 0) { int[] iArr = this.f8971i; iArr[i10] = iArr[i10] | r02; this.f8980r.f(r02, i10); } } private void C(float f10, float f11, int i10) { q(i10); float[] fArr = this.f8966d; this.f8968f[i10] = f10; fArr[i10] = f10; float[] fArr2 = this.f8967e; this.f8969g[i10] = f11; fArr2[i10] = f11; this.f8970h[i10] = t((int) f10, (int) f11); this.f8973k |= 1 << i10; } private void D(MotionEvent motionEvent) { int pointerCount = motionEvent.getPointerCount(); for (int i10 = 0; i10 < pointerCount; i10++) { int pointerId = motionEvent.getPointerId(i10); if (x(pointerId)) { float x10 = motionEvent.getX(i10); float y10 = motionEvent.getY(i10); this.f8968f[pointerId] = x10; this.f8969g[pointerId] = y10; } } } private boolean c(float f10, float f11, int i10, int i11) { float abs = Math.abs(f10); float abs2 = Math.abs(f11); if ((this.f8970h[i10] & i11) != i11 || (this.f8978p & i11) == 0 || (this.f8972j[i10] & i11) == i11 || (this.f8971i[i10] & i11) == i11) { return false; } int i12 = this.f8964b; if (abs <= i12 && abs2 <= i12) { return false; } if (abs >= abs2 * 0.5f || !this.f8980r.g(i11)) { return (this.f8971i[i10] & i11) == 0 && abs > ((float) this.f8964b); } int[] iArr = this.f8972j; iArr[i10] = iArr[i10] | i11; return false; } private boolean d(View view, float f10, float f11) { if (view == null) { return false; } boolean z10 = this.f8980r.d(view) > 0; boolean z11 = this.f8980r.e(view) > 0; if (!z10 || !z11) { return z10 ? Math.abs(f10) > ((float) this.f8964b) : z11 && Math.abs(f11) > ((float) this.f8964b); } float f12 = (f10 * f10) + (f11 * f11); int i10 = this.f8964b; return f12 > ((float) (i10 * i10)); } private float e(float f10, float f11, float f12) { float abs = Math.abs(f10); if (abs < f11) { return 0.0f; } return abs > f12 ? f10 > 0.0f ? f12 : -f12 : f10; } private int f(int i10, int i11, int i12) { int abs = Math.abs(i10); if (abs < i11) { return 0; } return abs > i12 ? i10 > 0 ? i12 : -i12 : i10; } private void g() { float[] fArr = this.f8966d; if (fArr == null) { return; } Arrays.fill(fArr, 0.0f); Arrays.fill(this.f8967e, 0.0f); Arrays.fill(this.f8968f, 0.0f); Arrays.fill(this.f8969g, 0.0f); Arrays.fill(this.f8970h, 0); Arrays.fill(this.f8971i, 0); Arrays.fill(this.f8972j, 0); this.f8973k = 0; } private void h(int i10) { if (this.f8966d == null || !w(i10)) { return; } this.f8966d[i10] = 0.0f; this.f8967e[i10] = 0.0f; this.f8968f[i10] = 0.0f; this.f8969g[i10] = 0.0f; this.f8970h[i10] = 0; this.f8971i[i10] = 0; this.f8972j[i10] = 0; this.f8973k = (~(1 << i10)) & this.f8973k; } private int i(int i10, int i11, int i12) { if (i10 == 0) { return 0; } int width = this.f8983u.getWidth(); float f10 = width / 2; float o10 = f10 + (o(Math.min(1.0f, Math.abs(i10) / width)) * f10); int abs = Math.abs(i11); return Math.min(abs > 0 ? Math.round(Math.abs(o10 / abs) * 1000.0f) * 4 : (int) (((Math.abs(i10) / i12) + 1.0f) * 256.0f), 600); } private int j(View view, int i10, int i11, int i12, int i13) { float f10; float f11; float f12; float f13; int f14 = f(i12, (int) this.f8976n, (int) this.f8975m); int f15 = f(i13, (int) this.f8976n, (int) this.f8975m); int abs = Math.abs(i10); int abs2 = Math.abs(i11); int abs3 = Math.abs(f14); int abs4 = Math.abs(f15); int i14 = abs3 + abs4; int i15 = abs + abs2; if (f14 != 0) { f10 = abs3; f11 = i14; } else { f10 = abs; f11 = i15; } float f16 = f10 / f11; if (f15 != 0) { f12 = abs4; f13 = i14; } else { f12 = abs2; f13 = i15; } return (int) ((i(i10, f14, this.f8980r.d(view)) * f16) + (i(i11, f15, this.f8980r.e(view)) * (f12 / f13))); } public static c l(ViewGroup viewGroup, float f10, AbstractC0132c abstractC0132c) { c m10 = m(viewGroup, abstractC0132c); m10.f8964b = (int) (m10.f8964b * (1.0f / f10)); return m10; } public static c m(ViewGroup viewGroup, AbstractC0132c abstractC0132c) { return new c(viewGroup.getContext(), viewGroup, abstractC0132c); } private void n(float f10, float f11) { this.f8982t = true; this.f8980r.l(this.f8981s, f10, f11); this.f8982t = false; if (this.f8963a == 1) { E(0); } } private float o(float f10) { return (float) Math.sin((f10 - 0.5f) * 0.47123894f); } private void p(int i10, int i11, int i12, int i13) { int left = this.f8981s.getLeft(); int top = this.f8981s.getTop(); if (i12 != 0) { i10 = this.f8980r.a(this.f8981s, i10, i12); n0.X(this.f8981s, i10 - left); } int i14 = i10; if (i13 != 0) { i11 = this.f8980r.b(this.f8981s, i11, i13); n0.Y(this.f8981s, i11 - top); } int i15 = i11; if (i12 == 0 && i13 == 0) { return; } this.f8980r.k(this.f8981s, i14, i15, i14 - left, i15 - top); } private void q(int i10) { float[] fArr = this.f8966d; if (fArr == null || fArr.length <= i10) { int i11 = i10 + 1; float[] fArr2 = new float[i11]; float[] fArr3 = new float[i11]; float[] fArr4 = new float[i11]; float[] fArr5 = new float[i11]; int[] iArr = new int[i11]; int[] iArr2 = new int[i11]; int[] iArr3 = new int[i11]; if (fArr != null) { System.arraycopy(fArr, 0, fArr2, 0, fArr.length); float[] fArr6 = this.f8967e; System.arraycopy(fArr6, 0, fArr3, 0, fArr6.length); float[] fArr7 = this.f8968f; System.arraycopy(fArr7, 0, fArr4, 0, fArr7.length); float[] fArr8 = this.f8969g; System.arraycopy(fArr8, 0, fArr5, 0, fArr8.length); int[] iArr4 = this.f8970h; System.arraycopy(iArr4, 0, iArr, 0, iArr4.length); int[] iArr5 = this.f8971i; System.arraycopy(iArr5, 0, iArr2, 0, iArr5.length); int[] iArr6 = this.f8972j; System.arraycopy(iArr6, 0, iArr3, 0, iArr6.length); } this.f8966d = fArr2; this.f8967e = fArr3; this.f8968f = fArr4; this.f8969g = fArr5; this.f8970h = iArr; this.f8971i = iArr2; this.f8972j = iArr3; } } private boolean s(int i10, int i11, int i12, int i13) { int left = this.f8981s.getLeft(); int top = this.f8981s.getTop(); int i14 = i10 - left; int i15 = i11 - top; if (i14 == 0 && i15 == 0) { this.f8979q.abortAnimation(); E(0); return false; } this.f8979q.startScroll(left, top, i14, i15, j(this.f8981s, i14, i15, i12, i13)); E(2); return true; } private int t(int i10, int i11) { int i12 = i10 < this.f8983u.getLeft() + this.f8977o ? 1 : 0; if (i11 < this.f8983u.getTop() + this.f8977o) { i12 |= 4; } if (i10 > this.f8983u.getRight() - this.f8977o) { i12 |= 2; } return i11 > this.f8983u.getBottom() - this.f8977o ? i12 | 8 : i12; } private boolean x(int i10) { if (w(i10)) { return true; } Log.e("ViewDragHelper", "Ignoring pointerId=" + i10 + " 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; } void E(int i10) { this.f8983u.removeCallbacks(this.f8984v); if (this.f8963a != i10) { this.f8963a = i10; this.f8980r.j(i10); if (this.f8963a == 0) { this.f8981s = null; } } } public boolean F(int i10, int i11) { if (this.f8982t) { return s(i10, i11, (int) this.f8974l.getXVelocity(this.f8965c), (int) this.f8974l.getYVelocity(this.f8965c)); } throw new IllegalStateException("Cannot settleCapturedViewAt outside of a call to Callback#onViewReleased"); } /* JADX WARN: Code restructure failed: missing block: B:50:0x00dd, code lost: if (r12 != r11) goto L54; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public boolean G(android.view.MotionEvent r17) { /* Method dump skipped, instructions count: 315 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: d0.c.G(android.view.MotionEvent):boolean"); } public boolean H(View view, int i10, int i11) { this.f8981s = view; this.f8965c = -1; boolean s10 = s(i10, i11, 0, 0); if (!s10 && this.f8963a == 0 && this.f8981s != null) { this.f8981s = null; } return s10; } boolean I(View view, int i10) { if (view == this.f8981s && this.f8965c == i10) { return true; } if (view == null || !this.f8980r.m(view, i10)) { return false; } this.f8965c = i10; b(view, i10); return true; } public void a() { this.f8965c = -1; g(); VelocityTracker velocityTracker = this.f8974l; if (velocityTracker != null) { velocityTracker.recycle(); this.f8974l = null; } } public void b(View view, int i10) { if (view.getParent() == this.f8983u) { this.f8981s = view; this.f8965c = i10; this.f8980r.i(view, i10); E(1); return; } throw new IllegalArgumentException("captureChildView: parameter must be a descendant of the ViewDragHelper's tracked parent view (" + this.f8983u + ")"); } public boolean k(boolean z10) { if (this.f8963a == 2) { boolean computeScrollOffset = this.f8979q.computeScrollOffset(); int currX = this.f8979q.getCurrX(); int currY = this.f8979q.getCurrY(); int left = currX - this.f8981s.getLeft(); int top = currY - this.f8981s.getTop(); if (left != 0) { n0.X(this.f8981s, left); } if (top != 0) { n0.Y(this.f8981s, top); } if (left != 0 || top != 0) { this.f8980r.k(this.f8981s, currX, currY, left, top); } if (computeScrollOffset && currX == this.f8979q.getFinalX() && currY == this.f8979q.getFinalY()) { this.f8979q.abortAnimation(); computeScrollOffset = false; } if (!computeScrollOffset) { if (z10) { this.f8983u.post(this.f8984v); } else { E(0); } } } return this.f8963a == 2; } public View r(int i10, int i11) { for (int childCount = this.f8983u.getChildCount() - 1; childCount >= 0; childCount--) { View childAt = this.f8983u.getChildAt(this.f8980r.c(childCount)); if (i10 >= childAt.getLeft() && i10 < childAt.getRight() && i11 >= childAt.getTop() && i11 < childAt.getBottom()) { return childAt; } } return null; } public int u() { return this.f8964b; } public boolean v(int i10, int i11) { return y(this.f8981s, i10, i11); } public boolean w(int i10) { return ((1 << i10) & this.f8973k) != 0; } public boolean y(View view, int i10, int i11) { return view != null && i10 >= view.getLeft() && i10 < view.getRight() && i11 >= view.getTop() && i11 < view.getBottom(); } public void z(MotionEvent motionEvent) { int i10; int actionMasked = motionEvent.getActionMasked(); int actionIndex = motionEvent.getActionIndex(); if (actionMasked == 0) { a(); } if (this.f8974l == null) { this.f8974l = VelocityTracker.obtain(); } this.f8974l.addMovement(motionEvent); int i11 = 0; if (actionMasked == 0) { float x10 = motionEvent.getX(); float y10 = motionEvent.getY(); int pointerId = motionEvent.getPointerId(0); View r10 = r((int) x10, (int) y10); C(x10, y10, pointerId); I(r10, pointerId); int i12 = this.f8970h[pointerId]; int i13 = this.f8978p; if ((i12 & i13) != 0) { this.f8980r.h(i12 & i13, pointerId); return; } return; } if (actionMasked == 1) { if (this.f8963a == 1) { A(); } a(); return; } if (actionMasked == 2) { if (this.f8963a == 1) { if (x(this.f8965c)) { int findPointerIndex = motionEvent.findPointerIndex(this.f8965c); float x11 = motionEvent.getX(findPointerIndex); float y11 = motionEvent.getY(findPointerIndex); float[] fArr = this.f8968f; int i14 = this.f8965c; int i15 = (int) (x11 - fArr[i14]); int i16 = (int) (y11 - this.f8969g[i14]); p(this.f8981s.getLeft() + i15, this.f8981s.getTop() + i16, i15, i16); D(motionEvent); return; } return; } int pointerCount = motionEvent.getPointerCount(); while (i11 < pointerCount) { int pointerId2 = motionEvent.getPointerId(i11); if (x(pointerId2)) { float x12 = motionEvent.getX(i11); float y12 = motionEvent.getY(i11); float f10 = x12 - this.f8966d[pointerId2]; float f11 = y12 - this.f8967e[pointerId2]; B(f10, f11, pointerId2); if (this.f8963a != 1) { View r11 = r((int) x12, (int) y12); if (d(r11, f10, f11) && I(r11, pointerId2)) { break; } } else { break; } } i11++; } D(motionEvent); return; } if (actionMasked == 3) { if (this.f8963a == 1) { n(0.0f, 0.0f); } a(); return; } if (actionMasked == 5) { int pointerId3 = motionEvent.getPointerId(actionIndex); float x13 = motionEvent.getX(actionIndex); float y13 = motionEvent.getY(actionIndex); C(x13, y13, pointerId3); if (this.f8963a != 0) { if (v((int) x13, (int) y13)) { I(this.f8981s, pointerId3); return; } return; } else { I(r((int) x13, (int) y13), pointerId3); int i17 = this.f8970h[pointerId3]; int i18 = this.f8978p; if ((i17 & i18) != 0) { this.f8980r.h(i17 & i18, pointerId3); return; } return; } } if (actionMasked != 6) { return; } int pointerId4 = motionEvent.getPointerId(actionIndex); if (this.f8963a == 1 && pointerId4 == this.f8965c) { int pointerCount2 = motionEvent.getPointerCount(); while (true) { if (i11 >= pointerCount2) { i10 = -1; break; } int pointerId5 = motionEvent.getPointerId(i11); if (pointerId5 != this.f8965c) { View r12 = r((int) motionEvent.getX(i11), (int) motionEvent.getY(i11)); View view = this.f8981s; if (r12 == view && I(view, pointerId5)) { i10 = this.f8965c; break; } } i11++; } if (i10 == -1) { A(); } } h(pointerId4); } }