package o; import android.view.MotionEvent; import android.view.View; import android.view.ViewParent; import android.view.animation.AnimationUtils; import com.github.mikephil.charting.charts.PieRadarChartBase; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.ArrayList; import o.AbstractViewOnTouchListenerC15838ixU; /* loaded from: classes.dex */ public final class yoL extends AbstractViewOnTouchListenerC15838ixU> { private ArrayList f; private long g; private float h; private float i; private QFQ j; @Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnDoubleTapListener public final boolean onSingleTapConfirmed(MotionEvent motionEvent) { return true; } public yoL(PieRadarChartBase pieRadarChartBase) { super(pieRadarChartBase); this.j = QFQ.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); this.i = BitmapDescriptorFactory.HUE_RED; this.f = new ArrayList<>(); this.g = 0L; this.h = BitmapDescriptorFactory.HUE_RED; } @Override // android.view.View.OnTouchListener public final boolean onTouch(View view, MotionEvent motionEvent) { float abs; if (!this.e.onTouchEvent(motionEvent) && ((PieRadarChartBase) this.a).F) { float x = motionEvent.getX(); float y = motionEvent.getY(); int action = motionEvent.getAction(); if (action == 0) { this.h = BitmapDescriptorFactory.HUE_RED; this.f.clear(); if (((PieRadarChartBase) this.a).b) { b(x, y); } this.i = ((PieRadarChartBase) this.a).e(x, y) - ((PieRadarChartBase) this.a).E; this.j.a = x; this.j.e = y; } else if (action == 1) { if (((PieRadarChartBase) this.a).b) { this.h = BitmapDescriptorFactory.HUE_RED; b(x, y); if (this.f.isEmpty()) { abs = 0.0f; } else { LWm lWm = this.f.get(0); ArrayList arrayList = this.f; LWm lWm2 = arrayList.get(arrayList.size() - 1); LWm lWm3 = lWm; for (int size = this.f.size() - 1; size >= 0; size--) { lWm3 = this.f.get(size); if (lWm3.d != lWm2.d) { break; } } float f = ((float) (lWm2.a - lWm.a)) / 1000.0f; if (f == BitmapDescriptorFactory.HUE_RED) { f = 0.1f; } boolean z = lWm2.d >= lWm3.d; if (Math.abs(lWm2.d - lWm3.d) > 270.0d) { z = !z; } if (lWm2.d - lWm.d > 180.0d) { lWm.d = (float) (lWm.d + 360.0d); } else if (lWm.d - lWm2.d > 180.0d) { lWm2.d = (float) (lWm2.d + 360.0d); } abs = Math.abs((lWm2.d - lWm.d) / f); if (!z) { abs = -abs; } } this.h = abs; if (abs != BitmapDescriptorFactory.HUE_RED) { this.g = AnimationUtils.currentAnimationTimeMillis(); AbstractC0810PWv.c(this.a); } } ViewParent parent = ((PieRadarChartBase) this.a).getParent(); if (parent != null) { parent.requestDisallowInterceptTouchEvent(false); } this.b = 0; } else if (action == 2) { if (((PieRadarChartBase) this.a).b) { b(x, y); } if (this.b == 0) { float f2 = x - this.j.a; float f3 = y - this.j.e; if (((float) Math.sqrt((f2 * f2) + (f3 * f3))) > AbstractC0810PWv.d(8.0f)) { this.d = AbstractViewOnTouchListenerC15838ixU.HBt.ROTATE; this.b = 6; ViewParent parent2 = ((PieRadarChartBase) this.a).getParent(); if (parent2 != null) { parent2.requestDisallowInterceptTouchEvent(true); } } } if (this.b == 6) { ((PieRadarChartBase) this.a).setRotationAngle(((PieRadarChartBase) this.a).e(x, y) - this.i); ((PieRadarChartBase) this.a).invalidate(); } } } return true; } @Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener public final void onLongPress(MotionEvent motionEvent) { this.d = AbstractViewOnTouchListenerC15838ixU.HBt.LONG_PRESS; hDm hdm = ((PieRadarChartBase) this.a).h; } @Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener public final boolean onSingleTapUp(MotionEvent motionEvent) { this.d = AbstractViewOnTouchListenerC15838ixU.HBt.SINGLE_TAP; hDm hdm = ((PieRadarChartBase) this.a).h; if (!((PieRadarChartBase) this.a).f) { return false; } a(((PieRadarChartBase) this.a).b(motionEvent.getX(), motionEvent.getY())); return true; } private void b(float f, float f2) { long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis(); this.f.add(new LWm(this, currentAnimationTimeMillis, ((PieRadarChartBase) this.a).e(f, f2))); for (int size = this.f.size(); size - 2 > 0 && currentAnimationTimeMillis - this.f.get(0).a > 1000; size--) { this.f.remove(0); } } public final void e() { if (this.h == BitmapDescriptorFactory.HUE_RED) { return; } long currentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis(); this.h *= ((PieRadarChartBase) this.a).i; ((PieRadarChartBase) this.a).setRotationAngle(((PieRadarChartBase) this.a).H + (this.h * (((float) (currentAnimationTimeMillis - this.g)) / 1000.0f))); this.g = currentAnimationTimeMillis; if (Math.abs(this.h) >= 0.001d) { AbstractC0810PWv.c(this.a); } else { this.h = BitmapDescriptorFactory.HUE_RED; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public class LWm { public long a; public float d; private yoL e; public LWm(yoL yol, long j, float f) { this.e = yol; this.a = j; this.d = f; } } }