786 lines
29 KiB
Java
786 lines
29 KiB
Java
package com.ubt.jimu.controller.component;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.BitmapFactory;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.LinearGradient;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.graphics.RectF;
|
|
import android.graphics.Shader;
|
|
import android.util.AttributeSet;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.utils.LogUtils;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class AngleSetView extends View {
|
|
private Bitmap A;
|
|
private Bitmap B;
|
|
private Bitmap C;
|
|
private float D;
|
|
private float E;
|
|
private float F;
|
|
private boolean G;
|
|
private Paint H;
|
|
private Paint I;
|
|
private Paint J;
|
|
private Paint K;
|
|
private Paint L;
|
|
private double M;
|
|
private double N;
|
|
private float O;
|
|
private float P;
|
|
private String Q;
|
|
private String R;
|
|
private float S;
|
|
private float T;
|
|
private float U;
|
|
private float V;
|
|
private String W;
|
|
private float a;
|
|
private String a0;
|
|
private float b;
|
|
private float b0;
|
|
private float c;
|
|
private AngleUpdateListener c0;
|
|
private float d;
|
|
private boolean d0;
|
|
private float e;
|
|
private float f;
|
|
private float g;
|
|
private float h;
|
|
private float i;
|
|
private float j;
|
|
private Paint k;
|
|
private Paint l;
|
|
private Paint m;
|
|
private Paint n;
|
|
private Paint o;
|
|
private RectF p;
|
|
private RectF q;
|
|
private RectF r;
|
|
private RectF s;
|
|
private RectF t;
|
|
private RectF u;
|
|
private RectF v;
|
|
private RectF x;
|
|
private Context y;
|
|
private Bitmap z;
|
|
|
|
public interface AngleUpdateListener {
|
|
void a(double d);
|
|
|
|
void c(double d);
|
|
}
|
|
|
|
enum DataType {
|
|
MIN,
|
|
MAX
|
|
}
|
|
|
|
public AngleSetView(Context context) {
|
|
super(context);
|
|
this.h = 150.0f;
|
|
this.i = 0.0f;
|
|
this.j = 0.0f;
|
|
this.S = -118.0f;
|
|
this.T = 118.0f;
|
|
this.U = -118.0f;
|
|
this.V = 118.0f;
|
|
this.d0 = false;
|
|
this.y = context;
|
|
a();
|
|
}
|
|
|
|
private void b(float f, float f2) {
|
|
if (f == this.U) {
|
|
this.J.setAlpha(60);
|
|
} else {
|
|
this.J.setAlpha(255);
|
|
}
|
|
if (f2 == this.V) {
|
|
this.K.setAlpha(60);
|
|
} else {
|
|
this.K.setAlpha(255);
|
|
}
|
|
}
|
|
|
|
private void c() {
|
|
double d = this.N;
|
|
double d2 = this.M;
|
|
if (d < 90.0d) {
|
|
d += 360.0d;
|
|
}
|
|
if (d2 < 90.0d) {
|
|
d2 = this.M + 360.0d;
|
|
}
|
|
if (d - d2 > 0.0d) {
|
|
this.I.setAlpha(255);
|
|
return;
|
|
}
|
|
this.M = this.N;
|
|
float centerX = this.s.centerX();
|
|
float centerY = this.s.centerY();
|
|
RectF rectF = this.r;
|
|
float f = this.h;
|
|
rectF.offsetTo(centerX - (f / 2.0f), centerY - (f / 2.0f));
|
|
this.I.setAlpha(66);
|
|
}
|
|
|
|
private void d(float f, float f2) {
|
|
this.J.setAlpha(255);
|
|
double d = this.M;
|
|
if (d > 152.0d || d < Math.abs(-28.0f)) {
|
|
return;
|
|
}
|
|
if (this.M >= Math.abs(-28.0f) && this.M < 90.0d) {
|
|
float sin = (float) ((this.g / 2.0f) * Math.sin((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
float cos = (float) ((this.g / 2.0f) * Math.cos((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
RectF rectF = this.r;
|
|
float f3 = this.F;
|
|
rectF.offsetTo((f + cos) - (f3 / 2.0f), (f2 + sin) - (f3 / 2.0f));
|
|
this.M = 28.0d;
|
|
return;
|
|
}
|
|
float sin2 = (float) ((this.g / 2.0f) * Math.sin((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
float cos2 = (float) ((this.g / 2.0f) * Math.cos((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
RectF rectF2 = this.r;
|
|
float f4 = this.F;
|
|
rectF2.offsetTo((f - cos2) - (f4 / 2.0f), (f2 + sin2) - (f4 / 2.0f));
|
|
this.M = 152.0d;
|
|
this.J.setAlpha(60);
|
|
}
|
|
|
|
public void a(float f, float f2) {
|
|
this.S = f;
|
|
this.T = f2;
|
|
this.W = ((int) f) + "°";
|
|
this.a0 = ((int) f2) + "°";
|
|
b(f, f2);
|
|
float[] a = a(f, DataType.MIN);
|
|
float[] a2 = a(f2, DataType.MAX);
|
|
RectF rectF = this.r;
|
|
if (rectF != null) {
|
|
float f3 = a[0];
|
|
float f4 = this.h;
|
|
rectF.set(f3 - (f4 / 2.0f), a[1] - (f4 / 2.0f), a[0] + (f4 / 2.0f), a[1] + (f4 / 2.0f));
|
|
}
|
|
RectF rectF2 = this.s;
|
|
if (rectF2 != null) {
|
|
float f5 = a2[0];
|
|
float f6 = this.h;
|
|
rectF2.set(f5 - (f6 / 2.0f), a2[1] - (f6 / 2.0f), a2[0] + (f6 / 2.0f), a2[1] + (f6 / 2.0f));
|
|
}
|
|
invalidate();
|
|
}
|
|
|
|
public float getCurrentMax() {
|
|
return this.E;
|
|
}
|
|
|
|
public float getCurrentMin() {
|
|
return this.D;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onDraw(Canvas canvas) {
|
|
double d;
|
|
canvas.drawArc(this.p, 152.0f, 236.0f, false, this.k);
|
|
LogUtils.c("progressStartAngle:" + this.M + " progressEndAngle:" + this.N);
|
|
double d2 = this.N;
|
|
if (d2 == this.M) {
|
|
d = 0.11d;
|
|
LogUtils.c("progressEndAngle == progressStartAngle1111");
|
|
} else {
|
|
if (d2 <= 152.0d || d2 > 360.0d) {
|
|
double d3 = this.M;
|
|
if (d3 < 0.0d || d3 >= 152.0d || d3 >= this.N) {
|
|
double d4 = this.N;
|
|
if (d4 >= 0.0d && d4 < 152.0d) {
|
|
double d5 = this.M;
|
|
if (d4 != d5) {
|
|
d = d4 + (360.0d - d5);
|
|
LogUtils.c("3333");
|
|
}
|
|
}
|
|
d = 0.0d;
|
|
}
|
|
}
|
|
d = this.N - this.M;
|
|
LogUtils.c("2222222");
|
|
}
|
|
double d6 = this.M;
|
|
if (d < 0.0d) {
|
|
d = d + 360.0d + 152.0d;
|
|
LogUtils.c("44444");
|
|
}
|
|
LogUtils.c("startAngle:" + d6 + " sweepAngle:" + d);
|
|
canvas.drawArc(this.q, (float) d6, (float) d, false, this.l);
|
|
if (this.G) {
|
|
canvas.drawBitmap(this.A, (Rect) null, this.r, this.m);
|
|
canvas.drawBitmap(this.z, (Rect) null, this.s, this.m);
|
|
} else {
|
|
canvas.drawBitmap(this.z, (Rect) null, this.s, this.m);
|
|
canvas.drawBitmap(this.A, (Rect) null, this.r, this.m);
|
|
}
|
|
canvas.drawBitmap(this.B, (Rect) null, this.t, this.K);
|
|
canvas.drawBitmap(this.B, (Rect) null, this.u, this.I);
|
|
canvas.drawBitmap(this.C, (Rect) null, this.v, this.L);
|
|
canvas.drawBitmap(this.C, (Rect) null, this.x, this.J);
|
|
canvas.drawText(this.W, this.u.centerX(), this.O - this.f, this.n);
|
|
canvas.drawText(this.a0, this.t.centerX(), this.O - this.f, this.n);
|
|
canvas.drawText(this.Q, this.t.centerX(), this.O + this.f, this.o);
|
|
canvas.drawText(this.R, this.u.centerX(), this.O + this.f, this.o);
|
|
super.onDraw(canvas);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
int i;
|
|
int action = motionEvent.getAction();
|
|
if (action != 0) {
|
|
if (action == 2) {
|
|
float x = motionEvent.getX();
|
|
float y = motionEvent.getY();
|
|
float centerX = this.p.centerX();
|
|
float centerY = this.p.centerY();
|
|
double sqrt = Math.sqrt((r0 * r0) + (r2 * r2));
|
|
float f = this.g;
|
|
double d = (((f / 2.0f) / sqrt) * (x - centerX)) + (f / 2.0f);
|
|
double d2 = (((f / 2.0f) / sqrt) * (y - centerY)) + (f / 2.0f);
|
|
if (this.G) {
|
|
if (this.d0) {
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
this.N = a(centerX, centerY, d, d2);
|
|
b();
|
|
if (Math.round(this.N) == 28.0f) {
|
|
this.K.setAlpha(66);
|
|
} else {
|
|
this.K.setAlpha(255);
|
|
}
|
|
c(centerX, centerY);
|
|
double a = a(this.N);
|
|
this.a0 = ((int) a) + "°";
|
|
AngleUpdateListener angleUpdateListener = this.c0;
|
|
if (angleUpdateListener != null) {
|
|
angleUpdateListener.a(a);
|
|
}
|
|
} else {
|
|
if (this.d0) {
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
this.M = b(centerX, centerY, d, d2);
|
|
c();
|
|
d(centerX, centerY);
|
|
double a2 = a(this.M);
|
|
this.W = ((int) a2) + "°";
|
|
AngleUpdateListener angleUpdateListener2 = this.c0;
|
|
if (angleUpdateListener2 != null) {
|
|
angleUpdateListener2.c(a2);
|
|
}
|
|
}
|
|
invalidate();
|
|
}
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
float x2 = motionEvent.getX();
|
|
float y2 = motionEvent.getY();
|
|
float centerX2 = this.r.centerX();
|
|
float centerY2 = this.r.centerY();
|
|
float centerX3 = this.s.centerX();
|
|
float centerY3 = this.s.centerY();
|
|
this.d0 = false;
|
|
if (this.G) {
|
|
float f2 = this.h;
|
|
if (x2 >= centerX3 - (f2 / 2.0f) && x2 <= centerX3 + (f2 / 2.0f) && y2 >= centerY3 - (f2 / 2.0f) && y2 <= centerY3 + (f2 / 2.0f)) {
|
|
this.G = true;
|
|
return true;
|
|
}
|
|
float f3 = this.h;
|
|
if (x2 >= centerX2 - (f3 / 2.0f) && x2 <= centerX2 + (f3 / 2.0f) && y2 >= centerY2 - (f3 / 2.0f) && y2 <= centerY2 + (f3 / 2.0f)) {
|
|
this.G = false;
|
|
return true;
|
|
}
|
|
} else {
|
|
float f4 = this.h;
|
|
if (x2 >= centerX2 - (f4 / 2.0f) && x2 <= centerX2 + (f4 / 2.0f) && y2 >= centerY2 - (f4 / 2.0f) && y2 <= centerY2 + (f4 / 2.0f)) {
|
|
this.G = false;
|
|
return true;
|
|
}
|
|
float f5 = this.h;
|
|
if (x2 >= centerX3 - (f5 / 2.0f) && x2 <= centerX3 + (f5 / 2.0f) && y2 >= centerY3 - (f5 / 2.0f) && y2 <= centerY3 + (f5 / 2.0f)) {
|
|
this.G = true;
|
|
return true;
|
|
}
|
|
}
|
|
float centerX4 = this.u.centerX();
|
|
float centerY4 = this.u.centerY();
|
|
float f6 = this.a;
|
|
float f7 = this.b0;
|
|
if (x2 >= (centerX4 - (f6 / 2.0f)) - f7 && x2 <= centerX4 + (f6 / 2.0f) + f7) {
|
|
float f8 = this.b;
|
|
if (y2 >= (centerY4 - (f8 / 2.0f)) - f7 && y2 <= centerY4 + (f8 / 2.0f) + f7) {
|
|
this.d0 = true;
|
|
this.G = false;
|
|
this.M += 1.0d;
|
|
double d3 = this.M;
|
|
if (d3 < 28.0d || d3 >= 152.0d) {
|
|
double d4 = this.M;
|
|
double d5 = this.N;
|
|
if (d4 == d5) {
|
|
this.M = d5;
|
|
} else if (d4 < 0.0d) {
|
|
this.M = 360.0d;
|
|
} else if (d4 > 360.0d) {
|
|
this.M = d4 - 360.0d;
|
|
}
|
|
} else {
|
|
this.M = 28.0d;
|
|
}
|
|
c();
|
|
this.J.setAlpha(255);
|
|
double a3 = a(this.M);
|
|
this.W = ((int) a3) + "°";
|
|
float[] a4 = a((float) this.M);
|
|
RectF rectF = this.r;
|
|
float f9 = a4[0];
|
|
float f10 = this.h;
|
|
rectF.set(f9 - (f10 / 2.0f), a4[1] - (f10 / 2.0f), a4[0] + (f10 / 2.0f), a4[1] + (f10 / 2.0f));
|
|
invalidate();
|
|
AngleUpdateListener angleUpdateListener3 = this.c0;
|
|
if (angleUpdateListener3 != null) {
|
|
angleUpdateListener3.c(a3);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
float centerX5 = this.x.centerX();
|
|
float centerY5 = this.x.centerY();
|
|
float f11 = this.a;
|
|
float f12 = this.b0;
|
|
if (x2 >= (centerX5 - (f11 / 2.0f)) - f12 && x2 <= centerX5 + (f11 / 2.0f) + f12) {
|
|
float f13 = this.b;
|
|
if (y2 >= (centerY5 - (f13 / 2.0f)) - f12 && y2 <= centerY5 + (f13 / 2.0f) + f12) {
|
|
this.d0 = true;
|
|
this.G = false;
|
|
this.M -= 1.0d;
|
|
double d6 = this.M;
|
|
if (d6 <= 28.0d || d6 >= 152.0d) {
|
|
double d7 = this.M;
|
|
double d8 = this.N;
|
|
if (d7 == d8) {
|
|
this.M = d8;
|
|
} else if (d7 < 0.0d) {
|
|
this.M = 360.0d;
|
|
}
|
|
} else {
|
|
this.M = 152.0d;
|
|
}
|
|
this.I.setAlpha(255);
|
|
if (Math.round(this.M) == 152.0f) {
|
|
this.J.setAlpha(60);
|
|
} else {
|
|
this.J.setAlpha(255);
|
|
}
|
|
double a5 = a(this.M);
|
|
this.W = ((int) a5) + "°";
|
|
float[] a6 = a((float) this.M);
|
|
RectF rectF2 = this.r;
|
|
float f14 = a6[0];
|
|
float f15 = this.h;
|
|
rectF2.set(f14 - (f15 / 2.0f), a6[1] - (f15 / 2.0f), a6[0] + (f15 / 2.0f), a6[1] + (f15 / 2.0f));
|
|
invalidate();
|
|
AngleUpdateListener angleUpdateListener4 = this.c0;
|
|
if (angleUpdateListener4 != null) {
|
|
angleUpdateListener4.c(a5);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
float centerX6 = this.v.centerX();
|
|
float centerY6 = this.v.centerY();
|
|
float f16 = this.a;
|
|
float f17 = this.b0;
|
|
if (x2 >= (centerX6 - (f16 / 2.0f)) - f17 && x2 <= centerX6 + (f16 / 2.0f) + f17) {
|
|
float f18 = this.b;
|
|
if (y2 >= (centerY6 - (f18 / 2.0f)) - f17 && y2 <= centerY6 + (f18 / 2.0f) + f17) {
|
|
this.d0 = true;
|
|
this.G = true;
|
|
this.N -= 1.0d;
|
|
double d9 = this.N;
|
|
double d10 = this.M;
|
|
if (d9 == d10) {
|
|
this.N = d10;
|
|
} else if (d9 > 28.0d && d9 <= 152.0d) {
|
|
this.N = 152.0d;
|
|
} else if (this.N < 0.0d) {
|
|
this.N = 360.0d;
|
|
}
|
|
b();
|
|
if (this.N == 28.0d) {
|
|
this.K.setAlpha(60);
|
|
} else {
|
|
this.K.setAlpha(255);
|
|
}
|
|
double a7 = a(this.N);
|
|
this.a0 = ((int) a7) + "°";
|
|
float[] a8 = a((float) this.N);
|
|
RectF rectF3 = this.s;
|
|
float f19 = a8[0];
|
|
float f20 = this.h;
|
|
rectF3.set(f19 - (f20 / 2.0f), a8[1] - (f20 / 2.0f), a8[0] + (f20 / 2.0f), a8[1] + (f20 / 2.0f));
|
|
invalidate();
|
|
AngleUpdateListener angleUpdateListener5 = this.c0;
|
|
if (angleUpdateListener5 != null) {
|
|
angleUpdateListener5.a(a7);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
float centerX7 = this.t.centerX();
|
|
float centerY7 = this.t.centerY();
|
|
float f21 = this.a;
|
|
float f22 = this.b0;
|
|
if (x2 >= (centerX7 - (f21 / 2.0f)) - f22 && x2 <= centerX7 + (f21 / 2.0f) + f22) {
|
|
float f23 = this.b;
|
|
if (y2 >= (centerY7 - (f23 / 2.0f)) - f22 && y2 <= centerY7 + (f23 / 2.0f) + f22) {
|
|
this.d0 = true;
|
|
this.G = true;
|
|
this.N += 1.0d;
|
|
double d11 = this.N;
|
|
if (d11 > 360.0d) {
|
|
this.N = d11 - 360.0d;
|
|
}
|
|
double d12 = this.N;
|
|
if (d12 < 28.0d || d12 >= 152.0d) {
|
|
double d13 = this.N;
|
|
double d14 = this.M;
|
|
if (d13 == d14) {
|
|
this.N = d14;
|
|
}
|
|
} else {
|
|
this.N = 28.0d;
|
|
}
|
|
if (this.N == 28.0d) {
|
|
this.K.setAlpha(60);
|
|
i = 255;
|
|
} else {
|
|
i = 255;
|
|
this.K.setAlpha(255);
|
|
}
|
|
this.L.setAlpha(i);
|
|
double a9 = a(this.N);
|
|
this.a0 = ((int) a9) + "°";
|
|
float[] a10 = a((float) this.N);
|
|
RectF rectF4 = this.s;
|
|
float f24 = a10[0];
|
|
float f25 = this.h;
|
|
rectF4.set(f24 - (f25 / 2.0f), a10[1] - (f25 / 2.0f), a10[0] + (f25 / 2.0f), a10[1] + (f25 / 2.0f));
|
|
invalidate();
|
|
AngleUpdateListener angleUpdateListener6 = this.c0;
|
|
if (angleUpdateListener6 != null) {
|
|
angleUpdateListener6.a(a9);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
|
|
public void setAngleUpdateListener(AngleUpdateListener angleUpdateListener) {
|
|
this.c0 = angleUpdateListener;
|
|
}
|
|
|
|
public void setCurrentMax(float f) {
|
|
this.E = f;
|
|
}
|
|
|
|
public void setCurrentMin(float f) {
|
|
this.D = f;
|
|
}
|
|
|
|
private void b() {
|
|
double d = this.N;
|
|
double d2 = this.M;
|
|
if (d < 90.0d) {
|
|
d += 360.0d;
|
|
}
|
|
if (d2 < 90.0d) {
|
|
d2 = this.M + 360.0d;
|
|
}
|
|
if (d - d2 <= 0.0d) {
|
|
this.N = this.M;
|
|
float centerX = this.r.centerX();
|
|
float centerY = this.r.centerY();
|
|
RectF rectF = this.s;
|
|
float f = this.h;
|
|
rectF.offsetTo(centerX - (f / 2.0f), centerY - (f / 2.0f));
|
|
this.L.setAlpha(60);
|
|
return;
|
|
}
|
|
this.L.setAlpha(255);
|
|
}
|
|
|
|
private void c(float f, float f2) {
|
|
if (this.N >= Math.abs(-28.0f)) {
|
|
double d = this.N;
|
|
if (d < 152.0d) {
|
|
if (d < 152.0d && d > 90.0d) {
|
|
float sin = (float) ((this.g / 2.0f) * Math.sin((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
float cos = (float) ((this.g / 2.0f) * Math.cos((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
RectF rectF = this.s;
|
|
float f3 = f - cos;
|
|
float f4 = this.F;
|
|
rectF.offsetTo(f3 - (f4 / 2.0f), (f2 + sin) - (f4 / 2.0f));
|
|
this.N = 152.0d;
|
|
return;
|
|
}
|
|
float sin2 = (float) ((this.g / 2.0f) * Math.sin((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
float cos2 = (float) ((this.g / 2.0f) * Math.cos((Math.abs(-28.0f) * 3.141592653589793d) / 180.0d));
|
|
RectF rectF2 = this.s;
|
|
float f5 = f + cos2;
|
|
float f6 = this.F;
|
|
rectF2.offsetTo(f5 - (f6 / 2.0f), (f2 + sin2) - (f6 / 2.0f));
|
|
this.N = 28.0d;
|
|
}
|
|
}
|
|
}
|
|
|
|
public AngleSetView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.h = 150.0f;
|
|
this.i = 0.0f;
|
|
this.j = 0.0f;
|
|
this.S = -118.0f;
|
|
this.T = 118.0f;
|
|
this.U = -118.0f;
|
|
this.V = 118.0f;
|
|
this.d0 = false;
|
|
this.y = context;
|
|
a();
|
|
}
|
|
|
|
public void a() {
|
|
this.W = ((int) this.S) + "°";
|
|
this.a0 = ((int) this.T) + "°";
|
|
this.b0 = this.y.getResources().getDimension(R.dimen.arrow_down_offset);
|
|
this.a = this.y.getResources().getDimension(R.dimen.arrow_width);
|
|
this.b = this.y.getResources().getDimension(R.dimen.arrow_height);
|
|
this.c = this.y.getResources().getDimension(R.dimen.arrow_sides_x);
|
|
this.d = this.y.getResources().getDimension(R.dimen.arrow_sides_y);
|
|
this.e = this.y.getResources().getDimension(R.dimen.arrow_sides_down_y);
|
|
this.f = this.y.getResources().getDimension(R.dimen.angle_text_margin_top);
|
|
this.F = this.y.getResources().getDimension(R.dimen.angle_set_progress_width);
|
|
float dimension = this.y.getResources().getDimension(R.dimen.angle_set_width);
|
|
float f = this.F;
|
|
this.g = dimension - f;
|
|
this.h = f;
|
|
Math.toDegrees(Math.asin(this.h / this.g));
|
|
this.Q = this.y.getResources().getString(R.string.angle_max_txt);
|
|
this.R = this.y.getResources().getString(R.string.angle_min_txt);
|
|
LogUtils.c("angleMaxHintText:" + this.Q.length());
|
|
LogUtils.c("angleMinHintText:" + this.R.length());
|
|
this.n = new Paint();
|
|
this.n.setAntiAlias(true);
|
|
this.n.setColor(this.y.getResources().getColor(R.color.txt_596F80));
|
|
this.n.setTextSize(this.y.getResources().getDimension(R.dimen.angle_text_size));
|
|
this.n.setTextAlign(Paint.Align.CENTER);
|
|
this.o = new Paint();
|
|
this.o.setAntiAlias(true);
|
|
this.o.setColor(this.y.getResources().getColor(R.color.txt_596F80));
|
|
int length = this.Q.length();
|
|
int length2 = this.R.length();
|
|
if (length <= 11 && length2 <= 11) {
|
|
this.o.setTextSize(this.y.getResources().getDimension(R.dimen.angle_text_hint_size));
|
|
} else {
|
|
this.o.setTextSize(this.y.getResources().getDimension(R.dimen.angle_text_hint_size_2));
|
|
}
|
|
this.o.setTextAlign(Paint.Align.CENTER);
|
|
this.I = new Paint();
|
|
this.I.setFlags(3);
|
|
this.J = new Paint();
|
|
this.J.setFlags(3);
|
|
this.K = new Paint();
|
|
this.K.setFlags(3);
|
|
this.L = new Paint();
|
|
this.L.setFlags(3);
|
|
this.m = new Paint();
|
|
this.m.setFlags(3);
|
|
this.H = new Paint();
|
|
this.H.setColor(-16776961);
|
|
this.k = new Paint();
|
|
this.k.setColor(this.y.getResources().getColor(R.color.bg_3396A6B4));
|
|
this.k.setFlags(3);
|
|
this.k.setStrokeWidth(this.F);
|
|
this.k.setStyle(Paint.Style.STROKE);
|
|
this.k.setStrokeCap(Paint.Cap.ROUND);
|
|
this.l = new Paint();
|
|
this.l.setShader(new LinearGradient(0.0f, 0.0f, 500.0f + this.g, 0.0f, new int[]{this.y.getResources().getColor(R.color.bg_0AEEFE), this.y.getResources().getColor(R.color.bg_4AACF5)}, (float[]) null, Shader.TileMode.CLAMP));
|
|
this.l.setAntiAlias(true);
|
|
this.l.setStrokeWidth(this.F);
|
|
this.l.setStyle(Paint.Style.STROKE);
|
|
this.l.setStrokeCap(Paint.Cap.ROUND);
|
|
float f2 = this.i;
|
|
float f3 = this.F;
|
|
float f4 = this.j;
|
|
float f5 = this.g;
|
|
this.p = new RectF((f3 / 2.0f) + f2, (f3 / 2.0f) + f4, f2 + f5 + (f3 / 2.0f), f4 + f5 + (f3 / 2.0f));
|
|
float f6 = this.i;
|
|
float f7 = this.F;
|
|
float f8 = this.j;
|
|
float f9 = this.g;
|
|
this.q = new RectF((f7 / 2.0f) + f6, (f7 / 2.0f) + f8, f6 + f9 + (f7 / 2.0f), f8 + f9 + (f7 / 2.0f));
|
|
this.P = this.p.centerX();
|
|
this.O = this.p.centerY();
|
|
float[] a = a(this.S, DataType.MIN);
|
|
float f10 = a[0];
|
|
float f11 = a[1];
|
|
float[] a2 = a(this.T, DataType.MAX);
|
|
float f12 = a2[0];
|
|
float f13 = a2[1];
|
|
float f14 = this.h;
|
|
this.r = new RectF(f10 - (f14 / 2.0f), f11 - (f14 / 2.0f), f10 + (f14 / 2.0f), f11 + (f14 / 2.0f));
|
|
float f15 = this.h;
|
|
this.s = new RectF(f12 - (f15 / 2.0f), f13 - (f15 / 2.0f), f12 + (f15 / 2.0f), f13 + (f15 / 2.0f));
|
|
float f16 = this.P;
|
|
float f17 = this.c;
|
|
float f18 = this.a;
|
|
float f19 = this.O;
|
|
float f20 = this.d;
|
|
float f21 = this.b;
|
|
this.t = new RectF((f16 + f17) - (f18 / 2.0f), (f19 - f20) - (f21 / 2.0f), f16 + f17 + (f18 / 2.0f), (f19 - f20) + (f21 / 2.0f));
|
|
float f22 = this.P;
|
|
float f23 = this.c;
|
|
float f24 = this.a;
|
|
float f25 = this.O;
|
|
float f26 = this.d;
|
|
float f27 = this.b;
|
|
this.u = new RectF((f22 - f23) - (f24 / 2.0f), (f25 - f26) - (f27 / 2.0f), (f22 - f23) + (f24 / 2.0f), (f25 - f26) + (f27 / 2.0f));
|
|
float f28 = this.P;
|
|
float f29 = this.c;
|
|
float f30 = this.a;
|
|
float f31 = this.O;
|
|
float f32 = this.e;
|
|
float f33 = this.b;
|
|
this.v = new RectF((f28 + f29) - (f30 / 2.0f), (f31 + f32) - (f33 / 2.0f), f28 + f29 + (f30 / 2.0f), f31 + f32 + (f33 / 2.0f));
|
|
float f34 = this.P;
|
|
float f35 = this.c;
|
|
float f36 = this.a;
|
|
float f37 = this.O;
|
|
float f38 = this.e;
|
|
float f39 = this.b;
|
|
this.x = new RectF((f34 - f35) - (f36 / 2.0f), (f37 + f38) - (f39 / 2.0f), (f34 - f35) + (f36 / 2.0f), f37 + f38 + (f39 / 2.0f));
|
|
this.z = BitmapFactory.decodeResource(this.y.getResources(), R.mipmap.angle_max);
|
|
this.A = BitmapFactory.decodeResource(this.y.getResources(), R.mipmap.angle_min);
|
|
this.B = BitmapFactory.decodeResource(this.y.getResources(), R.mipmap.arrow_up);
|
|
this.C = BitmapFactory.decodeResource(this.y.getResources(), R.mipmap.arrow_down);
|
|
b(this.S, this.T);
|
|
}
|
|
|
|
private double b(float f, float f2, double d, double d2) {
|
|
RectF rectF = this.r;
|
|
float f3 = this.h;
|
|
float f4 = this.F;
|
|
rectF.offsetTo((float) ((d - (f3 / 2.0f)) + (f4 / 2.0f)), (float) ((d2 - (f3 / 2.0f)) + (f4 / 2.0f)));
|
|
float centerX = this.r.centerX();
|
|
double atan2 = ((Math.atan2(f2 - this.r.centerY(), f - centerX) * 180.0d) / 3.141592653589793d) + 180.0d;
|
|
if (centerX < f && atan2 < 152.0d) {
|
|
return 152.0d;
|
|
}
|
|
if (centerX <= f || atan2 < 28.0d || atan2 >= 152.0d) {
|
|
return atan2;
|
|
}
|
|
return 28.0d;
|
|
}
|
|
|
|
private float[] a(float f, DataType dataType) {
|
|
float abs = (((Math.abs(this.U) + Math.abs(this.V)) / 236.0f) * (f - this.U)) + 152.0f;
|
|
if (dataType == DataType.MIN) {
|
|
this.M = abs;
|
|
double d = this.M;
|
|
if (d > 360.0d) {
|
|
this.M = d - 360.0d;
|
|
}
|
|
} else {
|
|
this.N = abs;
|
|
double d2 = this.N;
|
|
if (d2 > 360.0d) {
|
|
this.N = d2 - 360.0d;
|
|
}
|
|
}
|
|
if (abs >= 90.0f && abs <= 180.0f) {
|
|
double radians = Math.toRadians(180.0f - abs);
|
|
return new float[]{(float) (this.P - (Math.cos(radians) * (this.g / 2.0f))), (float) (this.O + (Math.sin(radians) * (this.g / 2.0f)))};
|
|
}
|
|
if (abs > 180.0f && abs <= 270.0f) {
|
|
double radians2 = Math.toRadians(abs - 180.0f);
|
|
return new float[]{(float) (this.P - (Math.cos(radians2) * (this.g / 2.0f))), (float) (this.O - (Math.sin(radians2) * (this.g / 2.0f)))};
|
|
}
|
|
if (abs > 270.0f && abs <= 360.0f) {
|
|
double radians3 = Math.toRadians(abs - 270.0f);
|
|
return new float[]{(float) (this.P + (Math.sin(radians3) * (this.g / 2.0f))), (float) (this.O - (Math.cos(radians3) * (this.g / 2.0f)))};
|
|
}
|
|
if (abs >= 360.0f) {
|
|
double radians4 = Math.toRadians(abs - 360.0f);
|
|
return new float[]{(float) (this.P + (Math.cos(radians4) * (this.g / 2.0f))), (float) (this.O + (Math.sin(radians4) * (this.g / 2.0f)))};
|
|
}
|
|
double radians5 = Math.toRadians(28.0f);
|
|
double sin = Math.sin(radians5) * (this.g / 2.0f);
|
|
float cos = (float) (this.P - (Math.cos(radians5) * (this.g / 2.0f)));
|
|
float f2 = (float) (sin + this.O);
|
|
this.M = 152.0d;
|
|
this.N = 28.0d;
|
|
return new float[]{cos, f2};
|
|
}
|
|
|
|
private float[] a(float f) {
|
|
if (f >= 90.0f && f <= 180.0f) {
|
|
double radians = Math.toRadians(180.0f - f);
|
|
return new float[]{(float) (this.P - (Math.cos(radians) * (this.g / 2.0f))), (float) (this.O + (Math.sin(radians) * (this.g / 2.0f)))};
|
|
}
|
|
if (f > 180.0f && f <= 270.0f) {
|
|
double radians2 = Math.toRadians(f - 180.0f);
|
|
return new float[]{(float) (this.P - (Math.cos(radians2) * (this.g / 2.0f))), (float) (this.O - (Math.sin(radians2) * (this.g / 2.0f)))};
|
|
}
|
|
if (f > 270.0f && f <= 360.0f) {
|
|
double radians3 = Math.toRadians(f - 270.0f);
|
|
return new float[]{(float) (this.P + (Math.sin(radians3) * (this.g / 2.0f))), (float) (this.O - (Math.cos(radians3) * (this.g / 2.0f)))};
|
|
}
|
|
if (f >= 0.0f && f < 90.0f) {
|
|
double radians4 = Math.toRadians(f);
|
|
return new float[]{(float) (this.P + (Math.cos(radians4) * (this.g / 2.0f))), (float) (this.O + (Math.sin(radians4) * (this.g / 2.0f)))};
|
|
}
|
|
double radians5 = Math.toRadians(28.0f);
|
|
double sin = Math.sin(radians5) * (this.g / 2.0f);
|
|
float cos = (float) (this.P - (Math.cos(radians5) * (this.g / 2.0f)));
|
|
float f2 = (float) (sin + this.O);
|
|
this.M = 152.0d;
|
|
this.N = 28.0d;
|
|
return new float[]{cos, f2};
|
|
}
|
|
|
|
private double a(double d) {
|
|
if (Math.round(d) < 152.0f) {
|
|
d += 360.0d;
|
|
}
|
|
return Math.round(((d - 152.0d) * 1.0d) + this.U);
|
|
}
|
|
|
|
private double a(float f, float f2, double d, double d2) {
|
|
RectF rectF = this.s;
|
|
float f3 = this.h;
|
|
float f4 = this.F;
|
|
rectF.offsetTo((float) ((d - (f3 / 2.0f)) + (f4 / 2.0f)), (float) ((d2 - (f3 / 2.0f)) + (f4 / 2.0f)));
|
|
float centerX = this.s.centerX();
|
|
double atan2 = ((Math.atan2(f2 - this.s.centerY(), f - centerX) * 180.0d) / 3.141592653589793d) + 180.0d;
|
|
if (atan2 < 28.0d || atan2 >= 152.0d || centerX <= f) {
|
|
return atan2;
|
|
}
|
|
return 28.0d;
|
|
}
|
|
}
|