559 lines
15 KiB
Java
559 lines
15 KiB
Java
|
package com.github.mikephil.charting.charts;
|
||
|
|
||
|
import android.animation.ObjectAnimator;
|
||
|
import android.animation.ValueAnimator;
|
||
|
import android.content.Context;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.Color;
|
||
|
import android.graphics.Paint;
|
||
|
import android.graphics.Typeface;
|
||
|
import android.text.TextUtils;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Iterator;
|
||
|
import o.AbstractC0810PWv;
|
||
|
import o.AbstractViewOnTouchListenerC15838ixU;
|
||
|
import o.C2640aiS;
|
||
|
import o.C3144arv;
|
||
|
import o.C6354cQa;
|
||
|
import o.DRH;
|
||
|
import o.FPV;
|
||
|
import o.InterfaceC17394wQe;
|
||
|
import o.JfG;
|
||
|
import o.Lhm;
|
||
|
import o.QFQ;
|
||
|
import o.QtO;
|
||
|
import o.RNy;
|
||
|
import o.UAQ;
|
||
|
import o.UFB;
|
||
|
import o.XPM;
|
||
|
import o.YZF;
|
||
|
import o.hDm;
|
||
|
import o.pHy;
|
||
|
import o.stp;
|
||
|
import o.tsQ;
|
||
|
import org.bouncycastle.crypto.tls.CipherSuite;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public abstract class Chart<T extends JfG<? extends InterfaceC17394wQe<? extends Lhm>>> extends ViewGroup {
|
||
|
private String A;
|
||
|
private ArrayList<Runnable> B;
|
||
|
private QtO C;
|
||
|
private float D;
|
||
|
private FPV E;
|
||
|
private boolean G;
|
||
|
public XPM a;
|
||
|
public boolean b;
|
||
|
protected T c;
|
||
|
protected C3144arv d;
|
||
|
protected AbstractViewOnTouchListenerC15838ixU e;
|
||
|
public boolean f;
|
||
|
protected UAQ[] g;
|
||
|
public hDm h;
|
||
|
public float i;
|
||
|
protected RNy j;
|
||
|
protected UFB k;
|
||
|
protected boolean l;
|
||
|
protected pHy m;
|
||
|
protected boolean n;
|
||
|
|
||
|
/* renamed from: o, reason: collision with root package name */
|
||
|
protected stp f6461o;
|
||
|
private Paint p;
|
||
|
protected C6354cQa q;
|
||
|
protected DRH r;
|
||
|
private tsQ s;
|
||
|
private boolean t;
|
||
|
private float u;
|
||
|
private float v;
|
||
|
private Paint w;
|
||
|
private float x;
|
||
|
private float y;
|
||
|
private boolean z;
|
||
|
|
||
|
protected abstract void b();
|
||
|
|
||
|
protected abstract void e();
|
||
|
|
||
|
public abstract void o();
|
||
|
|
||
|
public Chart(Context context) {
|
||
|
super(context);
|
||
|
this.n = false;
|
||
|
this.c = null;
|
||
|
this.f = true;
|
||
|
this.b = true;
|
||
|
this.i = 0.9f;
|
||
|
this.s = new tsQ(0);
|
||
|
this.l = true;
|
||
|
this.A = "No chart data available.";
|
||
|
this.r = new DRH();
|
||
|
this.u = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.v = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.x = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.y = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.z = false;
|
||
|
this.D = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.t = true;
|
||
|
this.B = new ArrayList<>();
|
||
|
this.G = false;
|
||
|
m();
|
||
|
}
|
||
|
|
||
|
public Chart(Context context, AttributeSet attributeSet) {
|
||
|
super(context, attributeSet);
|
||
|
this.n = false;
|
||
|
this.c = null;
|
||
|
this.f = true;
|
||
|
this.b = true;
|
||
|
this.i = 0.9f;
|
||
|
this.s = new tsQ(0);
|
||
|
this.l = true;
|
||
|
this.A = "No chart data available.";
|
||
|
this.r = new DRH();
|
||
|
this.u = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.v = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.x = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.y = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.z = false;
|
||
|
this.D = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.t = true;
|
||
|
this.B = new ArrayList<>();
|
||
|
this.G = false;
|
||
|
m();
|
||
|
}
|
||
|
|
||
|
public Chart(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(context, attributeSet, i);
|
||
|
this.n = false;
|
||
|
this.c = null;
|
||
|
this.f = true;
|
||
|
this.b = true;
|
||
|
this.i = 0.9f;
|
||
|
this.s = new tsQ(0);
|
||
|
this.l = true;
|
||
|
this.A = "No chart data available.";
|
||
|
this.r = new DRH();
|
||
|
this.u = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.v = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.x = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.y = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.z = false;
|
||
|
this.D = BitmapDescriptorFactory.HUE_RED;
|
||
|
this.t = true;
|
||
|
this.B = new ArrayList<>();
|
||
|
this.G = false;
|
||
|
m();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public void m() {
|
||
|
setWillNotDraw(false);
|
||
|
this.d = new C3144arv(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.github.mikephil.charting.charts.Chart.1
|
||
|
private Chart e;
|
||
|
|
||
|
{
|
||
|
this.e = this;
|
||
|
}
|
||
|
|
||
|
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
|
||
|
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||
|
this.e.postInvalidate();
|
||
|
}
|
||
|
});
|
||
|
AbstractC0810PWv.a(getContext());
|
||
|
this.D = AbstractC0810PWv.d(500.0f);
|
||
|
this.a = new XPM();
|
||
|
UFB ufb = new UFB();
|
||
|
this.k = ufb;
|
||
|
this.m = new pHy(this.r, ufb);
|
||
|
this.q = new C6354cQa();
|
||
|
this.p = new Paint(1);
|
||
|
Paint paint = new Paint(1);
|
||
|
this.w = paint;
|
||
|
paint.setColor(Color.rgb(247, CipherSuite.TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256, 51));
|
||
|
this.w.setTextAlign(Paint.Align.CENTER);
|
||
|
this.w.setTextSize(AbstractC0810PWv.d(12.0f));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
@Override // android.view.View
|
||
|
public void onDraw(Canvas canvas) {
|
||
|
if (this.c == null) {
|
||
|
if (!TextUtils.isEmpty(this.A)) {
|
||
|
QFQ e = QFQ.e(getWidth() / 2.0f, getHeight() / 2.0f);
|
||
|
canvas.drawText(this.A, e.a, e.e, this.w);
|
||
|
return;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
if (this.z) {
|
||
|
return;
|
||
|
}
|
||
|
b();
|
||
|
this.z = true;
|
||
|
}
|
||
|
|
||
|
public void setMaxHighlightDistance(float f) {
|
||
|
this.D = AbstractC0810PWv.d(f);
|
||
|
}
|
||
|
|
||
|
public final boolean s() {
|
||
|
UAQ[] uaqArr = this.g;
|
||
|
return (uaqArr == null || uaqArr.length <= 0 || uaqArr[0] == null) ? false : true;
|
||
|
}
|
||
|
|
||
|
private void d(UAQ[] uaqArr) {
|
||
|
UAQ uaq;
|
||
|
if (uaqArr != null && uaqArr.length > 0 && (uaq = uaqArr[0]) != null) {
|
||
|
this.e.c = uaq;
|
||
|
} else {
|
||
|
this.e.c = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void k() {
|
||
|
this.g = null;
|
||
|
d((UAQ[]) null);
|
||
|
invalidate();
|
||
|
}
|
||
|
|
||
|
public final void c(UAQ uaq) {
|
||
|
if (uaq == null) {
|
||
|
this.g = null;
|
||
|
} else if (this.c.a(uaq) == null) {
|
||
|
this.g = null;
|
||
|
} else {
|
||
|
this.g = new UAQ[]{uaq};
|
||
|
}
|
||
|
d(this.g);
|
||
|
if (this.E != null) {
|
||
|
s();
|
||
|
}
|
||
|
invalidate();
|
||
|
}
|
||
|
|
||
|
public final QFQ c() {
|
||
|
DRH drh = this.r;
|
||
|
return QFQ.e(drh.b.centerX(), drh.b.centerY());
|
||
|
}
|
||
|
|
||
|
public void setExtraOffsets(float f, float f2, float f3, float f4) {
|
||
|
setExtraLeftOffset(f);
|
||
|
setExtraTopOffset(f2);
|
||
|
setExtraRightOffset(f3);
|
||
|
setExtraBottomOffset(f4);
|
||
|
}
|
||
|
|
||
|
public void setExtraTopOffset(float f) {
|
||
|
this.u = AbstractC0810PWv.d(f);
|
||
|
}
|
||
|
|
||
|
public void setExtraRightOffset(float f) {
|
||
|
this.v = AbstractC0810PWv.d(f);
|
||
|
}
|
||
|
|
||
|
public void setExtraBottomOffset(float f) {
|
||
|
this.x = AbstractC0810PWv.d(f);
|
||
|
}
|
||
|
|
||
|
public void setExtraLeftOffset(float f) {
|
||
|
this.y = AbstractC0810PWv.d(f);
|
||
|
}
|
||
|
|
||
|
public void setNoDataTextColor(int i) {
|
||
|
this.w.setColor(i);
|
||
|
}
|
||
|
|
||
|
public void setNoDataTextTypeface(Typeface typeface) {
|
||
|
this.w.setTypeface(typeface);
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public void setMarkerView(QtO qtO) {
|
||
|
setMarker(qtO);
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public void setDrawMarkerViews(boolean z) {
|
||
|
setDrawMarkers(z);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.ViewGroup, android.view.View
|
||
|
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||
|
for (int i5 = 0; i5 < getChildCount(); i5++) {
|
||
|
getChildAt(i5).layout(i, i2, i3, i4);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onMeasure(int i, int i2) {
|
||
|
super.onMeasure(i, i2);
|
||
|
int d = (int) AbstractC0810PWv.d(50.0f);
|
||
|
setMeasuredDimension(Math.max(getSuggestedMinimumWidth(), resolveSize(d, i)), Math.max(getSuggestedMinimumHeight(), resolveSize(d, i2)));
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onSizeChanged(int i, int i2, int i3, int i4) {
|
||
|
if (i > 0 && i2 > 0 && i < 10000 && i2 < 10000) {
|
||
|
DRH drh = this.r;
|
||
|
float f = drh.b.left;
|
||
|
float f2 = drh.b.top;
|
||
|
float f3 = drh.e - drh.b.right;
|
||
|
float f4 = drh.a - drh.b.bottom;
|
||
|
drh.a = i2;
|
||
|
drh.e = i;
|
||
|
drh.e(f, f2, f3, f4);
|
||
|
}
|
||
|
o();
|
||
|
Iterator<Runnable> it = this.B.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
post(it.next());
|
||
|
}
|
||
|
this.B.clear();
|
||
|
super.onSizeChanged(i, i2, i3, i4);
|
||
|
}
|
||
|
|
||
|
public void setHardwareAccelerationEnabled(boolean z) {
|
||
|
if (z) {
|
||
|
setLayerType(2, null);
|
||
|
} else {
|
||
|
setLayerType(1, null);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
@Override // android.view.ViewGroup, android.view.View
|
||
|
public void onDetachedFromWindow() {
|
||
|
super.onDetachedFromWindow();
|
||
|
if (this.G) {
|
||
|
d(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void d(View view) {
|
||
|
if (view.getBackground() != null) {
|
||
|
view.getBackground().setCallback(null);
|
||
|
}
|
||
|
if (!(view instanceof ViewGroup)) {
|
||
|
return;
|
||
|
}
|
||
|
int i = 0;
|
||
|
while (true) {
|
||
|
ViewGroup viewGroup = (ViewGroup) view;
|
||
|
if (i < viewGroup.getChildCount()) {
|
||
|
d(viewGroup.getChildAt(i));
|
||
|
i++;
|
||
|
} else {
|
||
|
viewGroup.removeAllViews();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void d(C2640aiS.LWm lWm) {
|
||
|
C3144arv c3144arv = this.d;
|
||
|
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(c3144arv, "phaseY", BitmapDescriptorFactory.HUE_RED, 1.0f);
|
||
|
ofFloat.setInterpolator(lWm);
|
||
|
ofFloat.setDuration(1400L);
|
||
|
ofFloat.addUpdateListener(c3144arv.c);
|
||
|
ofFloat.start();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public final void Gt_(Canvas canvas) {
|
||
|
XPM xpm = this.a;
|
||
|
if (xpm == null || !xpm.q) {
|
||
|
return;
|
||
|
}
|
||
|
QFQ qfq = this.a.c;
|
||
|
this.p.setTypeface(this.a.v);
|
||
|
this.p.setTextSize(this.a.b());
|
||
|
this.p.setColor(this.a.r);
|
||
|
this.p.setTextAlign(this.a.a);
|
||
|
float width = getWidth();
|
||
|
DRH drh = this.r;
|
||
|
float e = (width - (drh.e - drh.b.right)) - this.a.e();
|
||
|
float height = getHeight();
|
||
|
DRH drh2 = this.r;
|
||
|
canvas.drawText(this.a.b, e, (height - (drh2.a - drh2.b.bottom)) - this.a.d(), this.p);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public final void d() {
|
||
|
if (this.C == null || !this.t || !s()) {
|
||
|
return;
|
||
|
}
|
||
|
int i = 0;
|
||
|
while (true) {
|
||
|
UAQ[] uaqArr = this.g;
|
||
|
if (i >= uaqArr.length) {
|
||
|
return;
|
||
|
}
|
||
|
UAQ uaq = uaqArr[i];
|
||
|
InterfaceC17394wQe c = this.c.c(uaq.b);
|
||
|
Lhm a = this.c.a(this.g[i]);
|
||
|
int a2 = c.a((InterfaceC17394wQe) a);
|
||
|
if (a != null && a2 <= c.r() * this.d.d) {
|
||
|
float[] e = e(uaq);
|
||
|
DRH drh = this.r;
|
||
|
float f = e[0];
|
||
|
float f2 = e[1];
|
||
|
if (drh.b.left <= f + 1.0f && drh.b.right >= (((int) (f * 100.0f)) / 100.0f) - 1.0f && drh.b.top <= f2) {
|
||
|
if (drh.b.bottom >= ((int) (f2 * 100.0f)) / 100.0f) {
|
||
|
float f3 = e[0];
|
||
|
float f4 = e[1];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final UAQ b(float f, float f2) {
|
||
|
if (this.c == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return this.j.c(f, f2);
|
||
|
}
|
||
|
|
||
|
protected float[] e(UAQ uaq) {
|
||
|
return new float[]{uaq.c, uaq.e};
|
||
|
}
|
||
|
|
||
|
public void setData(T t) {
|
||
|
float max;
|
||
|
this.c = t;
|
||
|
this.z = false;
|
||
|
if (t == null) {
|
||
|
return;
|
||
|
}
|
||
|
float f = t.i;
|
||
|
float f2 = t.h;
|
||
|
T t2 = this.c;
|
||
|
if (t2 == null || t2.c() < 2) {
|
||
|
max = Math.max(Math.abs(f), Math.abs(f2));
|
||
|
} else {
|
||
|
max = Math.abs(f2 - f);
|
||
|
}
|
||
|
this.s.a(AbstractC0810PWv.e(max));
|
||
|
for (InterfaceC17394wQe interfaceC17394wQe : this.c.d()) {
|
||
|
if (interfaceC17394wQe.t() || interfaceC17394wQe.f() == this.s) {
|
||
|
interfaceC17394wQe.d(this.s);
|
||
|
}
|
||
|
}
|
||
|
o();
|
||
|
}
|
||
|
|
||
|
public void setUnbindEnabled(boolean z) {
|
||
|
this.G = z;
|
||
|
}
|
||
|
|
||
|
public void setTouchEnabled(boolean z) {
|
||
|
this.l = z;
|
||
|
}
|
||
|
|
||
|
public void setRenderer(stp stpVar) {
|
||
|
if (stpVar != null) {
|
||
|
this.f6461o = stpVar;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setPaint(Paint paint, int i) {
|
||
|
if (i == 7) {
|
||
|
this.w = paint;
|
||
|
} else if (i == 11) {
|
||
|
this.p = paint;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setOnTouchListener(AbstractViewOnTouchListenerC15838ixU abstractViewOnTouchListenerC15838ixU) {
|
||
|
this.e = abstractViewOnTouchListenerC15838ixU;
|
||
|
}
|
||
|
|
||
|
public void setOnChartValueSelectedListener(FPV fpv) {
|
||
|
this.E = fpv;
|
||
|
}
|
||
|
|
||
|
public void setOnChartGestureListener(hDm hdm) {
|
||
|
this.h = hdm;
|
||
|
}
|
||
|
|
||
|
public void setNoDataText(String str) {
|
||
|
this.A = str;
|
||
|
}
|
||
|
|
||
|
public void setMarker(QtO qtO) {
|
||
|
this.C = qtO;
|
||
|
}
|
||
|
|
||
|
public void setLogEnabled(boolean z) {
|
||
|
this.n = z;
|
||
|
}
|
||
|
|
||
|
public void setHighlighter(YZF yzf) {
|
||
|
this.j = yzf;
|
||
|
}
|
||
|
|
||
|
public void setHighlightPerTapEnabled(boolean z) {
|
||
|
this.f = z;
|
||
|
}
|
||
|
|
||
|
public void setDrawMarkers(boolean z) {
|
||
|
this.t = z;
|
||
|
}
|
||
|
|
||
|
public void setDragDecelerationFrictionCoef(float f) {
|
||
|
if (f < BitmapDescriptorFactory.HUE_RED) {
|
||
|
f = 0.0f;
|
||
|
}
|
||
|
if (f >= 1.0f) {
|
||
|
f = 0.999f;
|
||
|
}
|
||
|
this.i = f;
|
||
|
}
|
||
|
|
||
|
public void setDragDecelerationEnabled(boolean z) {
|
||
|
this.b = z;
|
||
|
}
|
||
|
|
||
|
public void setDescription(XPM xpm) {
|
||
|
this.a = xpm;
|
||
|
}
|
||
|
|
||
|
public C6354cQa n() {
|
||
|
return this.q;
|
||
|
}
|
||
|
|
||
|
public final UFB l() {
|
||
|
return this.k;
|
||
|
}
|
||
|
|
||
|
public final float f() {
|
||
|
return this.u;
|
||
|
}
|
||
|
|
||
|
public final float i() {
|
||
|
return this.v;
|
||
|
}
|
||
|
|
||
|
public final float h() {
|
||
|
return this.y;
|
||
|
}
|
||
|
|
||
|
public final float j() {
|
||
|
return this.x;
|
||
|
}
|
||
|
|
||
|
public final T g() {
|
||
|
return this.c;
|
||
|
}
|
||
|
|
||
|
public final C3144arv a() {
|
||
|
return this.d;
|
||
|
}
|
||
|
}
|