package com.github.mikephil.charting.charts; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Typeface; import android.util.AttributeSet; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.lang.ref.WeakReference; import java.util.List; import o.AbstractC0810PWv; import o.C6354cQa; import o.Dfa; import o.InterfaceC1234Ypa; import o.LsD; import o.QFQ; import o.UAQ; import o.xzO; /* loaded from: classes.dex */ public class PieChart extends PieRadarChartBase { public boolean A; public float B; public boolean C; public boolean D; private float G; public boolean I; private float L; public QFQ p; public float[] s; public CharSequence t; public RectF u; public boolean v; public float[] w; public float x; public boolean y; public float z; @Override // com.github.mikephil.charting.charts.PieRadarChartBase protected final float q() { return BitmapDescriptorFactory.HUE_RED; } public PieChart(Context context) { super(context); this.u = new RectF(); this.v = true; this.w = new float[1]; this.s = new float[1]; this.D = true; this.A = false; this.I = false; this.C = false; this.t = ""; this.p = QFQ.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); this.B = 50.0f; this.z = 55.0f; this.y = true; this.x = 100.0f; this.G = 360.0f; this.L = BitmapDescriptorFactory.HUE_RED; } public PieChart(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.u = new RectF(); this.v = true; this.w = new float[1]; this.s = new float[1]; this.D = true; this.A = false; this.I = false; this.C = false; this.t = ""; this.p = QFQ.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); this.B = 50.0f; this.z = 55.0f; this.y = true; this.x = 100.0f; this.G = 360.0f; this.L = BitmapDescriptorFactory.HUE_RED; } public PieChart(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.u = new RectF(); this.v = true; this.w = new float[1]; this.s = new float[1]; this.D = true; this.A = false; this.I = false; this.C = false; this.t = ""; this.p = QFQ.e(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); this.B = 50.0f; this.z = 55.0f; this.y = true; this.x = 100.0f; this.G = 360.0f; this.L = BitmapDescriptorFactory.HUE_RED; } /* JADX INFO: Access modifiers changed from: protected */ @Override // com.github.mikephil.charting.charts.PieRadarChartBase, com.github.mikephil.charting.charts.Chart public final void m() { super.m(); this.f6461o = new xzO(this, this.d, this.r); this.q = null; this.j = new LsD(this); } /* JADX INFO: Access modifiers changed from: protected */ @Override // com.github.mikephil.charting.charts.Chart, android.view.View public void onDraw(Canvas canvas) { super.onDraw(canvas); if (this.c == 0) { return; } this.f6461o.GR_(canvas); if (s()) { this.f6461o.GT_(canvas, this.g); } this.f6461o.GS_(canvas); this.f6461o.GU_(canvas); this.m.GJ_(canvas); Gt_(canvas); d(); } @Override // com.github.mikephil.charting.charts.PieRadarChartBase, com.github.mikephil.charting.charts.Chart public final void b() { super.b(); if (this.c == 0) { return; } float t = t() / 2.0f; QFQ c = c(); float v = ((Dfa) this.c).f().v(); this.u.set((c.a - t) + v, (c.e - t) + v, (c.a + t) - v, (c.e + t) - v); QFQ.b(c); } @Override // com.github.mikephil.charting.charts.Chart protected final float[] e(UAQ uaq) { QFQ e = QFQ.e(this.u.centerX(), this.u.centerY()); RectF rectF = this.u; float min = rectF == null ? BitmapDescriptorFactory.HUE_RED : Math.min(rectF.width() / 2.0f, this.u.height() / 2.0f); float f = (min / 10.0f) * 3.6f; if (this.D) { f = (min - ((min / 100.0f) * this.B)) / 2.0f; } float f2 = this.H; float f3 = this.w[(int) uaq.j] / 2.0f; double d = min - f; float cos = (float) ((Math.cos(Math.toRadians(((this.s[r11] + f2) - f3) * this.d.a)) * d) + e.a); float sin = (float) ((d * Math.sin(Math.toRadians(((f2 + this.s[r11]) - f3) * this.d.a))) + e.e); QFQ.b(e); return new float[]{cos, sin}; } public final boolean a(int i) { if (!s()) { return false; } for (int i2 = 0; i2 < this.g.length; i2++) { if (((int) this.g[i2].j) == i) { return true; } } return false; } @Override // com.github.mikephil.charting.charts.Chart @Deprecated public final C6354cQa n() { throw new RuntimeException("PieChart has no XAxis"); } public void setHoleColor(int i) { ((xzO) this.f6461o).h.setColor(i); } @Override // com.github.mikephil.charting.charts.PieRadarChartBase protected final float r() { return this.m.d.getTextSize() * 2.0f; } @Override // com.github.mikephil.charting.charts.PieRadarChartBase public final float p() { RectF rectF = this.u; return rectF == null ? BitmapDescriptorFactory.HUE_RED : Math.min(rectF.width() / 2.0f, this.u.height() / 2.0f); } public void setCenterTextTypeface(Typeface typeface) { ((xzO) this.f6461o).j.setTypeface(typeface); } public void setCenterTextSize(float f) { ((xzO) this.f6461o).j.setTextSize(AbstractC0810PWv.d(f)); } public void setCenterTextSizePixels(float f) { ((xzO) this.f6461o).j.setTextSize(f); } public void setCenterTextOffset(float f, float f2) { this.p.a = AbstractC0810PWv.d(f); this.p.e = AbstractC0810PWv.d(f2); } public void setCenterTextColor(int i) { ((xzO) this.f6461o).j.setColor(i); } public void setTransparentCircleColor(int i) { Paint paint = ((xzO) this.f6461o).g; int alpha = paint.getAlpha(); paint.setColor(i); paint.setAlpha(alpha); } public void setTransparentCircleAlpha(int i) { ((xzO) this.f6461o).g.setAlpha(i); } public void setEntryLabelColor(int i) { ((xzO) this.f6461o).i.setColor(i); } public void setEntryLabelTypeface(Typeface typeface) { ((xzO) this.f6461o).i.setTypeface(typeface); } public void setEntryLabelTextSize(float f) { ((xzO) this.f6461o).i.setTextSize(AbstractC0810PWv.d(f)); } /* JADX INFO: Access modifiers changed from: protected */ @Override // com.github.mikephil.charting.charts.Chart, android.view.ViewGroup, android.view.View public void onDetachedFromWindow() { if (this.f6461o != null && (this.f6461o instanceof xzO)) { xzO xzo = (xzO) this.f6461o; Canvas canvas = xzo.c; if (canvas != null) { canvas.setBitmap(null); xzo.c = null; } WeakReference weakReference = xzo.f; if (weakReference != null) { Bitmap bitmap = weakReference.get(); if (bitmap != null) { bitmap.recycle(); } xzo.f.clear(); xzo.f = null; } } super.onDetachedFromWindow(); } /* JADX INFO: Access modifiers changed from: protected */ @Override // com.github.mikephil.charting.charts.PieRadarChartBase, com.github.mikephil.charting.charts.Chart public final void e() { int c = ((Dfa) this.c).c(); if (this.w.length != c) { this.w = new float[c]; } else { for (int i = 0; i < c; i++) { this.w[i] = 0.0f; } } if (this.s.length != c) { this.s = new float[c]; } else { for (int i2 = 0; i2 < c; i2++) { this.s[i2] = 0.0f; } } float h = ((Dfa) this.c).h(); List d = ((Dfa) this.c).d(); float f = this.L; boolean z = f != BitmapDescriptorFactory.HUE_RED && ((float) c) * f <= this.G; float[] fArr = new float[c]; float f2 = 0.0f; float f3 = 0.0f; int i3 = 0; for (int i4 = 0; i4 < ((Dfa) this.c).e(); i4++) { InterfaceC1234Ypa interfaceC1234Ypa = d.get(i4); for (int i5 = 0; i5 < interfaceC1234Ypa.r(); i5++) { float abs = (Math.abs(interfaceC1234Ypa.d(i5).e) / h) * this.G; if (z) { float f4 = this.L; float f5 = abs - f4; if (f5 <= BitmapDescriptorFactory.HUE_RED) { fArr[i3] = f4; f3 -= f5; } else { fArr[i3] = abs; f2 += f5; } } this.w[i3] = abs; if (i3 == 0) { this.s[i3] = abs; } else { float[] fArr2 = this.s; fArr2[i3] = fArr2[i3 - 1] + abs; } i3++; } } if (z) { for (int i6 = 0; i6 < c; i6++) { float f6 = fArr[i6]; float f7 = f6 - (((f6 - this.L) / f2) * f3); fArr[i6] = f7; if (i6 == 0) { this.s[0] = fArr[0]; } else { float[] fArr3 = this.s; fArr3[i6] = fArr3[i6 - 1] + f7; } } this.w = fArr; } } @Override // com.github.mikephil.charting.charts.PieRadarChartBase public final int c(float f) { float c = AbstractC0810PWv.c(f - this.H); int i = 0; while (true) { float[] fArr = this.s; if (i >= fArr.length) { return -1; } if (fArr[i] > c) { return i; } i++; } } public void setUsePercentValues(boolean z) { this.I = z; } public void setTransparentCircleRadius(float f) { this.z = f; } /* JADX WARN: Code restructure failed: missing block: B:8:0x000e, code lost: if (r3 < com.google.android.gms.maps.model.BitmapDescriptorFactory.HUE_RED) goto L4; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void setMinAngleForSlices(float r3) { /* r2 = this; float r0 = r2.G r1 = 1073741824(0x40000000, float:2.0) float r0 = r0 / r1 int r1 = (r3 > r0 ? 1 : (r3 == r0 ? 0 : -1)) if (r1 <= 0) goto Lb L9: r3 = r0 goto L11 Lb: r0 = 0 int r1 = (r3 > r0 ? 1 : (r3 == r0 ? 0 : -1)) if (r1 >= 0) goto L11 goto L9 L11: r2.L = r3 return */ throw new UnsupportedOperationException("Method not decompiled: com.github.mikephil.charting.charts.PieChart.setMinAngleForSlices(float):void"); } public void setMaxAngle(float f) { if (f > 360.0f) { f = 360.0f; } if (f < 90.0f) { f = 90.0f; } this.G = f; } public void setHoleRadius(float f) { this.B = f; } public void setDrawSlicesUnderHole(boolean z) { this.A = z; } @Deprecated public void setDrawSliceText(boolean z) { this.v = z; } public void setDrawRoundedSlices(boolean z) { this.C = z; } public void setDrawHoleEnabled(boolean z) { this.D = z; } public void setDrawEntryLabels(boolean z) { this.v = z; } public void setDrawCenterText(boolean z) { this.y = z; } public void setCenterTextRadiusPercent(float f) { this.x = f; } public void setCenterText(CharSequence charSequence) { if (charSequence == null) { this.t = ""; } else { this.t = charSequence; } } }