819 lines
31 KiB
Java
819 lines
31 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.Matrix;
|
||
import android.graphics.Paint;
|
||
import android.graphics.Rect;
|
||
import android.graphics.RectF;
|
||
import android.graphics.Shader;
|
||
import android.util.AttributeSet;
|
||
import android.util.Log;
|
||
import android.view.MotionEvent;
|
||
import android.view.View;
|
||
import com.ubt.jimu.R;
|
||
import com.ubt.jimu.utils.BitmapUtils;
|
||
import com.ubt.jimu.utils.LogUtils;
|
||
|
||
/* loaded from: classes.dex */
|
||
public class TensionAngleSetView extends View {
|
||
private RectF A;
|
||
private RectF B;
|
||
private RectF C;
|
||
private Context D;
|
||
private Bitmap E;
|
||
private Bitmap F;
|
||
private Bitmap G;
|
||
private Bitmap H;
|
||
private float I;
|
||
private float J;
|
||
private float K;
|
||
private boolean L;
|
||
private Paint M;
|
||
private double N;
|
||
private double O;
|
||
private float P;
|
||
private float Q;
|
||
private String R;
|
||
private String S;
|
||
private float T;
|
||
private float U;
|
||
private String V;
|
||
private String W;
|
||
private float a;
|
||
private float a0;
|
||
private float b;
|
||
private Matrix b0;
|
||
private float c;
|
||
private float c0;
|
||
private float d;
|
||
private boolean d0;
|
||
private float e;
|
||
private AngleUpdateListener e0;
|
||
private float f;
|
||
private float g;
|
||
private float h;
|
||
private float i;
|
||
private float j;
|
||
private float k;
|
||
private Paint l;
|
||
private Paint m;
|
||
private Paint n;
|
||
private Paint o;
|
||
private Paint p;
|
||
private Paint q;
|
||
private Paint r;
|
||
private Paint s;
|
||
private Paint t;
|
||
private RectF u;
|
||
private RectF v;
|
||
private RectF x;
|
||
private RectF y;
|
||
private RectF z;
|
||
|
||
public interface AngleUpdateListener {
|
||
void b(double d);
|
||
|
||
void d(double d);
|
||
}
|
||
|
||
enum DataType {
|
||
START,
|
||
LAUNCH
|
||
}
|
||
|
||
public TensionAngleSetView(Context context) {
|
||
super(context);
|
||
this.j = 0.0f;
|
||
this.k = 0.0f;
|
||
this.T = -118.0f;
|
||
this.U = 118.0f;
|
||
this.D = context;
|
||
a();
|
||
}
|
||
|
||
private float[] b(float f) {
|
||
this.O = 388.0f - (((Math.abs(118.0f) + Math.abs(-118.0f)) / 236.0f) * (118.0f - f));
|
||
double d = this.O;
|
||
if (d >= 360.0d) {
|
||
double radians = Math.toRadians((float) (d - 360.0d));
|
||
return new float[]{(float) (this.Q + (Math.cos(radians) * (this.g / 2.0f))), (float) (this.P + (Math.sin(radians) * (this.g / 2.0f)))};
|
||
}
|
||
if (d >= 270.0d && d < 360.0d) {
|
||
float f2 = (float) (360.0d - d);
|
||
LogUtils.c("cosAnglecosAngle:" + f2);
|
||
double radians2 = Math.toRadians((double) f2);
|
||
return new float[]{(float) (this.Q + (Math.cos(radians2) * (this.g / 2.0f))), (float) (this.P - (Math.sin(radians2) * ((double) (this.g / 2.0f))))};
|
||
}
|
||
double d2 = this.O;
|
||
if (d2 < 270.0d && d2 >= 180.0d) {
|
||
double radians3 = Math.toRadians((float) (d2 - 180.0d));
|
||
return new float[]{(float) (this.Q - (Math.cos(radians3) * (this.g / 2.0f))), (float) (this.P - (Math.sin(radians3) * (this.g / 2.0f)))};
|
||
}
|
||
double d3 = this.O;
|
||
if (d3 >= 180.0d || d3 <= 90.0d) {
|
||
return null;
|
||
}
|
||
double radians4 = Math.toRadians((float) (180.0d - d3));
|
||
return new float[]{(float) (this.Q - (Math.cos(radians4) * (this.g / 2.0f))), (float) (this.P + (Math.sin(radians4) * (this.g / 2.0f)))};
|
||
}
|
||
|
||
private float[] c(float f, float f2) {
|
||
float b = b(f, f2);
|
||
if (b < -28.0f) {
|
||
b = -28.0f;
|
||
} else if (b >= 208.0f) {
|
||
b = 208.0f;
|
||
}
|
||
double radians = Math.toRadians(b);
|
||
double sin = Math.sin(radians);
|
||
double cos = Math.cos(radians);
|
||
float f3 = this.g;
|
||
return new float[]{(float) (this.u.centerX() + ((f3 / 2.0f) * cos)), (float) (this.u.centerY() - ((f3 / 2.0f) * sin))};
|
||
}
|
||
|
||
private double d(float f, float f2) {
|
||
float centerX = this.y.centerX();
|
||
double atan2 = ((Math.atan2(f2 - this.y.centerY(), f - centerX) * 180.0d) / 3.141592653589793d) + 180.0d;
|
||
if (atan2 < 28.0d || atan2 >= 152.0d || centerX <= f) {
|
||
return atan2;
|
||
}
|
||
return 28.0d;
|
||
}
|
||
|
||
private void setAngle(float f) {
|
||
this.b0.reset();
|
||
float centerX = this.x.centerX();
|
||
float centerY = this.x.centerY();
|
||
this.b0.setTranslate(centerX - (this.F.getWidth() / 2.0f), centerY - (this.F.getHeight() / 2.0f));
|
||
this.b0.postRotate(-f, centerX, centerY);
|
||
}
|
||
|
||
public void a(float f, float f2) {
|
||
if (this.T == f) {
|
||
this.r.setAlpha(60);
|
||
} else {
|
||
this.r.setAlpha(255);
|
||
}
|
||
if (this.U == f2) {
|
||
this.s.setAlpha(60);
|
||
} else {
|
||
this.s.setAlpha(255);
|
||
}
|
||
this.T = f;
|
||
this.U = f2;
|
||
this.V = ((int) f) + "°";
|
||
this.W = ((int) f2) + "°";
|
||
float[] a = a(f, DataType.START);
|
||
float[] b = b(f2);
|
||
RectF rectF = this.x;
|
||
if (rectF != null && b != null) {
|
||
float f3 = b[0];
|
||
float f4 = this.i;
|
||
rectF.set(f3 - (f4 / 2.0f), b[1] - (f4 / 2.0f), b[0] + (f4 / 2.0f), b[1] + (f4 / 2.0f));
|
||
}
|
||
RectF rectF2 = this.y;
|
||
if (rectF2 != null) {
|
||
float f5 = a[0];
|
||
float f6 = this.h;
|
||
rectF2.set(f5 - (f6 / 2.0f), a[1] - (f6 / 2.0f), a[0] + (f6 / 2.0f), a[1] + (f6 / 2.0f));
|
||
}
|
||
invalidate();
|
||
}
|
||
|
||
public float getCurrentMax() {
|
||
return this.J;
|
||
}
|
||
|
||
public float getCurrentMin() {
|
||
return this.I;
|
||
}
|
||
|
||
@Override // android.view.View
|
||
protected void onDraw(Canvas canvas) {
|
||
canvas.drawArc(this.u, 152.0f, 236.0f, false, this.l);
|
||
double d = this.O;
|
||
double d2 = this.N;
|
||
double d3 = 0.0d;
|
||
if (d == d2) {
|
||
d3 = 0.11d;
|
||
setAngle(a(false));
|
||
} else if (d2 >= 90.0d || d < 360.0d || d - 360.0d < d2) {
|
||
double d4 = this.N;
|
||
if (d4 < 90.0d) {
|
||
double d5 = this.O;
|
||
if (d5 <= 360.0d) {
|
||
d3 = (360.0d - d5) + d4;
|
||
setAngle(a(true));
|
||
d2 = d5;
|
||
}
|
||
}
|
||
double d6 = this.O;
|
||
if (d6 >= 360.0d) {
|
||
double d7 = this.N;
|
||
if (d7 < 90.0d && d6 - 360.0d <= d7) {
|
||
setAngle(a(true));
|
||
d2 = d6 - 360.0d;
|
||
d3 = d7 - (d6 - 360.0d);
|
||
}
|
||
}
|
||
double d8 = this.N;
|
||
if (d8 > 90.0d && d8 <= 360.0d) {
|
||
double d9 = this.O;
|
||
if (d9 > 90.0d && d8 < d9) {
|
||
d3 = d9 - d8;
|
||
setAngle(a(false));
|
||
d2 = d8;
|
||
}
|
||
}
|
||
double d10 = this.N;
|
||
double d11 = this.O;
|
||
if (d10 <= d11 || d10 <= 90.0d || d11 <= 90.0d) {
|
||
d2 = 0.0d;
|
||
} else {
|
||
d3 = d10 - d11;
|
||
setAngle(a(true));
|
||
d2 = d11;
|
||
}
|
||
} else {
|
||
d3 = (d - 360.0d) - d2;
|
||
setAngle(a(false));
|
||
}
|
||
canvas.drawArc(this.v, (float) d2, (float) d3, false, this.m);
|
||
LogUtils.c("isOnClickStartIcon:" + this.L);
|
||
if (this.L) {
|
||
canvas.drawBitmap(this.F, this.b0, this.n);
|
||
canvas.drawBitmap(this.E, (Rect) null, this.y, this.n);
|
||
} else {
|
||
canvas.drawBitmap(this.E, (Rect) null, this.y, this.n);
|
||
canvas.drawBitmap(this.F, this.b0, this.n);
|
||
}
|
||
canvas.drawBitmap(this.G, (Rect) null, this.z, this.s);
|
||
canvas.drawBitmap(this.G, (Rect) null, this.A, this.q);
|
||
canvas.drawBitmap(this.H, (Rect) null, this.B, this.t);
|
||
canvas.drawBitmap(this.H, (Rect) null, this.C, this.r);
|
||
canvas.drawText(this.V, this.A.centerX(), this.P - this.f, this.o);
|
||
canvas.drawText(this.W, this.z.centerX(), this.P - this.f, this.o);
|
||
canvas.drawText(this.R, this.z.centerX(), this.P + this.f, this.p);
|
||
canvas.drawText(this.S, this.A.centerX(), this.P + this.f, this.p);
|
||
super.onDraw(canvas);
|
||
}
|
||
|
||
@Override // android.view.View
|
||
protected void onMeasure(int i, int i2) {
|
||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec((int) this.c0, 1073741824);
|
||
super.onMeasure(makeMeasureSpec, makeMeasureSpec);
|
||
}
|
||
|
||
@Override // android.view.View
|
||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||
int action = motionEvent.getAction();
|
||
if (action != 0) {
|
||
if (action == 2) {
|
||
float x = motionEvent.getX();
|
||
float y = motionEvent.getY();
|
||
float centerX = this.u.centerX();
|
||
float centerY = this.u.centerY();
|
||
if (!this.L) {
|
||
this.x.centerX();
|
||
this.x.centerY();
|
||
if (this.d0) {
|
||
LogUtils.c("按下微调箭头,不响应滑动计算事件");
|
||
return super.onTouchEvent(motionEvent);
|
||
}
|
||
float[] c = c(x, y);
|
||
RectF rectF = this.x;
|
||
float f = c[0];
|
||
float f2 = this.i;
|
||
rectF.offsetTo(f - (f2 / 2.0f), c[1] - (f2 / 2.0f));
|
||
this.O = 360.0f - b(x, y);
|
||
if (Math.round(this.O) == 152.0f) {
|
||
this.t.setAlpha(60);
|
||
} else {
|
||
this.t.setAlpha(255);
|
||
}
|
||
if (Math.round(this.O) == 388.0f) {
|
||
this.s.setAlpha(60);
|
||
} else {
|
||
this.s.setAlpha(255);
|
||
}
|
||
double a = a(this.O);
|
||
this.W = ((int) a) + "°";
|
||
AngleUpdateListener angleUpdateListener = this.e0;
|
||
if (angleUpdateListener != null) {
|
||
angleUpdateListener.d(a);
|
||
}
|
||
} else {
|
||
if (this.d0) {
|
||
LogUtils.c("按下微调箭头,不响应滑动计算事件");
|
||
return super.onTouchEvent(motionEvent);
|
||
}
|
||
float[] c2 = c(x, y);
|
||
RectF rectF2 = this.y;
|
||
float f3 = c2[0];
|
||
float f4 = this.h;
|
||
rectF2.offsetTo(f3 - (f4 / 2.0f), c2[1] - (f4 / 2.0f));
|
||
this.N = d(centerX, centerY);
|
||
double a2 = a(this.N);
|
||
if (Math.round(this.N) == 28.0f) {
|
||
this.q.setAlpha(60);
|
||
} else {
|
||
this.q.setAlpha(255);
|
||
}
|
||
if (Math.round(this.N) == 152.0f) {
|
||
this.r.setAlpha(60);
|
||
} else {
|
||
this.r.setAlpha(255);
|
||
}
|
||
this.V = ((int) a2) + "°";
|
||
AngleUpdateListener angleUpdateListener2 = this.e0;
|
||
if (angleUpdateListener2 != null) {
|
||
angleUpdateListener2.b(a2);
|
||
}
|
||
}
|
||
invalidate();
|
||
}
|
||
return super.onTouchEvent(motionEvent);
|
||
}
|
||
float x2 = motionEvent.getX();
|
||
float y2 = motionEvent.getY();
|
||
float centerX2 = this.x.centerX();
|
||
float centerY2 = this.x.centerY();
|
||
float centerX3 = this.y.centerX();
|
||
float centerY3 = this.y.centerY();
|
||
this.d0 = false;
|
||
if (this.L) {
|
||
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.L = true;
|
||
return true;
|
||
}
|
||
float f6 = this.i;
|
||
if (x2 >= centerX2 - (f6 / 2.0f) && x2 <= centerX2 + (f6 / 2.0f) && y2 >= centerY2 - (f6 / 2.0f) && y2 <= centerY2 + (f6 / 2.0f)) {
|
||
this.L = false;
|
||
return true;
|
||
}
|
||
} else {
|
||
float f7 = this.i;
|
||
if (x2 >= centerX2 - (f7 / 2.0f) && x2 <= centerX2 + (f7 / 2.0f) && y2 >= centerY2 - (f7 / 2.0f) && y2 <= centerY2 + (f7 / 2.0f)) {
|
||
this.L = false;
|
||
return true;
|
||
}
|
||
float f8 = this.h;
|
||
if (x2 >= centerX3 - (f8 / 2.0f) && x2 <= centerX3 + (f8 / 2.0f) && y2 >= centerY3 - (f8 / 2.0f) && y2 <= centerY3 + (f8 / 2.0f)) {
|
||
this.L = true;
|
||
return true;
|
||
}
|
||
}
|
||
float centerX4 = this.A.centerX();
|
||
float centerY4 = this.A.centerY();
|
||
float f9 = this.a;
|
||
float f10 = this.a0;
|
||
if (x2 >= (centerX4 - (f9 / 2.0f)) - f10 && x2 <= centerX4 + (f9 / 2.0f) + f10) {
|
||
float f11 = this.b;
|
||
if (y2 >= (centerY4 - (f11 / 2.0f)) - f10 && y2 <= centerY4 + (f11 / 2.0f) + f10) {
|
||
this.L = false;
|
||
this.d0 = true;
|
||
this.N += 1.0d;
|
||
double d = this.N;
|
||
if (d < 28.0d || d >= 152.0d) {
|
||
double d2 = this.N;
|
||
double d3 = this.O;
|
||
if (d2 == d3) {
|
||
this.N = d3;
|
||
} else if (d2 < 0.0d) {
|
||
this.N = 360.0d;
|
||
} else if (d2 > 360.0d) {
|
||
this.N = d2 - 360.0d;
|
||
}
|
||
} else {
|
||
this.N = 28.0d;
|
||
}
|
||
double a3 = a(this.N);
|
||
this.V = ((int) a3) + "°";
|
||
float[] a4 = a((float) this.N);
|
||
RectF rectF3 = this.y;
|
||
float f12 = a4[0];
|
||
float f13 = this.h;
|
||
rectF3.set(f12 - (f13 / 2.0f), a4[1] - (f13 / 2.0f), a4[0] + (f13 / 2.0f), a4[1] + (f13 / 2.0f));
|
||
if (a3 >= 118.0d) {
|
||
this.q.setAlpha(60);
|
||
} else {
|
||
this.q.setAlpha(255);
|
||
}
|
||
this.r.setAlpha(225);
|
||
invalidate();
|
||
AngleUpdateListener angleUpdateListener3 = this.e0;
|
||
if (angleUpdateListener3 != null) {
|
||
angleUpdateListener3.b(a3);
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
float centerX5 = this.C.centerX();
|
||
float centerY5 = this.C.centerY();
|
||
float f14 = this.a;
|
||
float f15 = this.a0;
|
||
if (x2 >= (centerX5 - (f14 / 2.0f)) - f15 && x2 <= centerX5 + (f14 / 2.0f) + f15) {
|
||
float f16 = this.b;
|
||
if (y2 >= (centerY5 - (f16 / 2.0f)) - f15 && y2 <= centerY5 + (f16 / 2.0f) + f15) {
|
||
this.L = false;
|
||
this.d0 = true;
|
||
this.N -= 1.0d;
|
||
double d4 = this.N;
|
||
if (d4 <= 28.0d || d4 >= 152.0d) {
|
||
double d5 = this.N;
|
||
double d6 = this.O;
|
||
if (d5 == d6) {
|
||
this.N = d6;
|
||
} else if (d5 < 0.0d) {
|
||
this.N = 360.0d;
|
||
}
|
||
} else {
|
||
this.N = 152.0d;
|
||
}
|
||
double a5 = a(this.N);
|
||
this.V = ((int) a5) + "°";
|
||
float[] a6 = a((float) this.N);
|
||
RectF rectF4 = this.y;
|
||
float f17 = a6[0];
|
||
float f18 = this.h;
|
||
rectF4.set(f17 - (f18 / 2.0f), a6[1] - (f18 / 2.0f), a6[0] + (f18 / 2.0f), a6[1] + (f18 / 2.0f));
|
||
if (a5 <= this.T) {
|
||
this.r.setAlpha(60);
|
||
} else {
|
||
this.r.setAlpha(225);
|
||
}
|
||
this.q.setAlpha(255);
|
||
invalidate();
|
||
AngleUpdateListener angleUpdateListener4 = this.e0;
|
||
if (angleUpdateListener4 != null) {
|
||
angleUpdateListener4.b(a5);
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
float centerX6 = this.B.centerX();
|
||
float centerY6 = this.B.centerY();
|
||
float f19 = this.a;
|
||
float f20 = this.a0;
|
||
if (x2 >= (centerX6 - (f19 / 2.0f)) - f20 && x2 <= centerX6 + (f19 / 2.0f) + f20) {
|
||
float f21 = this.b;
|
||
if (y2 >= (centerY6 - (f21 / 2.0f)) - f20 && y2 <= centerY6 + (f21 / 2.0f) + f20) {
|
||
this.L = true;
|
||
this.d0 = true;
|
||
this.O -= 1.0d;
|
||
double d7 = this.O;
|
||
double d8 = this.N;
|
||
if (d7 == d8) {
|
||
this.O = d8;
|
||
} else if (d7 > 28.0d && d7 <= 152.0d) {
|
||
this.O = 152.0d;
|
||
} else if (this.O < 0.0d) {
|
||
this.O = 360.0d;
|
||
}
|
||
Log.e("Test", "最小值角度+1 progressEndAngle-Down" + this.O + " 28.0 152.0");
|
||
double a7 = a(this.O);
|
||
if (a7 <= this.T) {
|
||
this.t.setAlpha(60);
|
||
} else {
|
||
this.t.setAlpha(255);
|
||
}
|
||
this.s.setAlpha(225);
|
||
float[] b = b((float) a7);
|
||
this.W = ((int) a7) + "°";
|
||
if (b != null) {
|
||
RectF rectF5 = this.x;
|
||
float f22 = b[0];
|
||
float f23 = this.i;
|
||
rectF5.set(f22 - (f23 / 2.0f), b[1] - (f23 / 2.0f), b[0] + (f23 / 2.0f), b[1] + (f23 / 2.0f));
|
||
}
|
||
invalidate();
|
||
AngleUpdateListener angleUpdateListener5 = this.e0;
|
||
if (angleUpdateListener5 != null) {
|
||
angleUpdateListener5.d(a7);
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
float centerX7 = this.z.centerX();
|
||
float centerY7 = this.z.centerY();
|
||
float f24 = this.a;
|
||
float f25 = this.a0;
|
||
if (x2 >= (centerX7 - (f24 / 2.0f)) - f25 && x2 <= centerX7 + (f24 / 2.0f) + f25) {
|
||
float f26 = this.b;
|
||
if (y2 >= (centerY7 - (f26 / 2.0f)) - f25 && y2 <= centerY7 + (f26 / 2.0f) + f25) {
|
||
this.L = true;
|
||
this.d0 = true;
|
||
this.O += 1.0d;
|
||
double d9 = this.O;
|
||
if (d9 > 360.0d) {
|
||
this.O = d9 - 360.0d;
|
||
}
|
||
double d10 = this.O;
|
||
if (d10 < 28.0d || d10 >= 152.0d) {
|
||
double d11 = this.O;
|
||
double d12 = this.N;
|
||
if (d11 == d12) {
|
||
this.O = d12;
|
||
}
|
||
} else {
|
||
this.O = 28.0d;
|
||
}
|
||
double a8 = a(this.O);
|
||
if (a8 >= 118.0d) {
|
||
this.s.setAlpha(60);
|
||
} else {
|
||
this.s.setAlpha(255);
|
||
}
|
||
this.t.setAlpha(225);
|
||
float[] b2 = b((float) a8);
|
||
this.W = ((int) a8) + "°";
|
||
if (b2 != null) {
|
||
RectF rectF6 = this.x;
|
||
float f27 = b2[0];
|
||
float f28 = this.i;
|
||
rectF6.set(f27 - (f28 / 2.0f), b2[1] - (f28 / 2.0f), b2[0] + (f28 / 2.0f), b2[1] + (f28 / 2.0f));
|
||
}
|
||
invalidate();
|
||
AngleUpdateListener angleUpdateListener6 = this.e0;
|
||
if (angleUpdateListener6 != null) {
|
||
angleUpdateListener6.d(a8);
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
return super.onTouchEvent(motionEvent);
|
||
}
|
||
|
||
public void setAngleUpdateListener(AngleUpdateListener angleUpdateListener) {
|
||
this.e0 = angleUpdateListener;
|
||
}
|
||
|
||
public void setCurrentMax(float f) {
|
||
this.J = f;
|
||
}
|
||
|
||
public void setCurrentMin(float f) {
|
||
this.I = f;
|
||
}
|
||
|
||
public TensionAngleSetView(Context context, AttributeSet attributeSet) {
|
||
super(context, attributeSet);
|
||
this.j = 0.0f;
|
||
this.k = 0.0f;
|
||
this.T = -118.0f;
|
||
this.U = 118.0f;
|
||
this.D = context;
|
||
a();
|
||
}
|
||
|
||
public void a() {
|
||
float f;
|
||
this.V = ((int) this.T) + "°";
|
||
this.W = ((int) this.U) + "°";
|
||
this.a0 = this.D.getResources().getDimension(R.dimen.arrow_down_offset);
|
||
this.a = this.D.getResources().getDimension(R.dimen.arrow_width);
|
||
this.b = this.D.getResources().getDimension(R.dimen.arrow_height);
|
||
this.c = this.D.getResources().getDimension(R.dimen.arrow_sides_x);
|
||
this.d = this.D.getResources().getDimension(R.dimen.arrow_sides_y);
|
||
this.e = this.D.getResources().getDimension(R.dimen.arrow_sides_down_y);
|
||
this.f = this.D.getResources().getDimension(R.dimen.angle_text_margin_top);
|
||
this.K = this.D.getResources().getDimension(R.dimen.angle_set_progress_width);
|
||
this.g = this.D.getResources().getDimension(R.dimen.angle_set_view_width);
|
||
this.c0 = this.D.getResources().getDimension(R.dimen.angle_set_view_width) + getResources().getDimension(R.dimen.angle_set_match);
|
||
this.j = getResources().getDimension(R.dimen.top_match);
|
||
this.k = getResources().getDimension(R.dimen.top_match);
|
||
this.h = this.K;
|
||
this.i = this.D.getResources().getDimension(R.dimen.start_arrows_wh);
|
||
this.R = this.D.getResources().getString(R.string.ejector_value);
|
||
this.S = this.D.getResources().getString(R.string.default_value);
|
||
this.o = new Paint();
|
||
this.o.setAntiAlias(true);
|
||
this.o.setColor(this.D.getResources().getColor(R.color.txt_596F80));
|
||
this.o.setTextSize(this.D.getResources().getDimension(R.dimen.angle_text_size));
|
||
this.o.setTextAlign(Paint.Align.CENTER);
|
||
this.p = new Paint();
|
||
this.p.setAntiAlias(true);
|
||
this.p.setColor(this.D.getResources().getColor(R.color.txt_596F80));
|
||
this.p.setTextSize(this.D.getResources().getDimension(R.dimen.angle_text_hint_size));
|
||
this.p.setTextAlign(Paint.Align.CENTER);
|
||
this.n = new Paint();
|
||
this.n.setFlags(3);
|
||
this.q = new Paint();
|
||
this.q.setFlags(3);
|
||
this.r = new Paint();
|
||
this.r.setFlags(3);
|
||
this.r.setAlpha(60);
|
||
this.s = new Paint();
|
||
this.s.setFlags(3);
|
||
this.s.setAlpha(60);
|
||
this.t = new Paint();
|
||
this.t.setFlags(3);
|
||
this.M = new Paint();
|
||
this.M.setColor(-16776961);
|
||
this.l = new Paint();
|
||
this.l.setColor(this.D.getResources().getColor(R.color.bg_3396A6B4));
|
||
this.l.setFlags(3);
|
||
this.l.setStrokeWidth(this.K);
|
||
this.l.setStyle(Paint.Style.STROKE);
|
||
this.l.setStrokeCap(Paint.Cap.ROUND);
|
||
this.m = new Paint();
|
||
this.m.setShader(new LinearGradient(0.0f, 0.0f, this.g + 500.0f, 0.0f, new int[]{this.D.getResources().getColor(R.color.color_FF4979), this.D.getResources().getColor(R.color.bg_F0553E)}, (float[]) null, Shader.TileMode.CLAMP));
|
||
this.m.setFlags(3);
|
||
this.m.setStrokeWidth(this.K);
|
||
this.m.setStyle(Paint.Style.STROKE);
|
||
this.m.setStrokeCap(Paint.Cap.BUTT);
|
||
float f2 = this.j;
|
||
float f3 = this.k;
|
||
float f4 = this.K;
|
||
float f5 = this.g;
|
||
this.u = new RectF(f2, f3 + f4, f2 + f5, f3 + f5 + f4);
|
||
float f6 = this.j;
|
||
float f7 = this.k;
|
||
float f8 = this.K;
|
||
float f9 = this.g;
|
||
this.v = new RectF(f6, f7 + f8, f6 + f9, f7 + f9 + f8);
|
||
this.b0 = new Matrix();
|
||
this.Q = this.u.centerX();
|
||
this.P = this.u.centerY();
|
||
float[] a = a(this.T, DataType.START);
|
||
float f10 = a[0];
|
||
float f11 = a[1];
|
||
float[] b = b(this.U);
|
||
float f12 = 0.0f;
|
||
if (b != null) {
|
||
f12 = b[0];
|
||
f = b[1];
|
||
} else {
|
||
f = 0.0f;
|
||
}
|
||
float f13 = this.h;
|
||
this.y = new RectF(f10 - (f13 / 2.0f), f11 - (f13 / 2.0f), f10 + (f13 / 2.0f), f11 + (f13 / 2.0f));
|
||
float f14 = this.Q;
|
||
float f15 = this.c;
|
||
float f16 = this.a;
|
||
float f17 = this.P;
|
||
float f18 = this.d;
|
||
float f19 = this.b;
|
||
this.z = new RectF((f14 + f15) - (f16 / 2.0f), (f17 - f18) - (f19 / 2.0f), f14 + f15 + (f16 / 2.0f), (f17 - f18) + (f19 / 2.0f));
|
||
float f20 = this.Q;
|
||
float f21 = this.c;
|
||
float f22 = this.a;
|
||
float f23 = this.P;
|
||
float f24 = this.d;
|
||
float f25 = this.b;
|
||
this.A = new RectF((f20 - f21) - (f22 / 2.0f), (f23 - f24) - (f25 / 2.0f), (f20 - f21) + (f22 / 2.0f), (f23 - f24) + (f25 / 2.0f));
|
||
float f26 = this.Q;
|
||
float f27 = this.c;
|
||
float f28 = this.a;
|
||
float f29 = this.P;
|
||
float f30 = this.e;
|
||
float f31 = this.b;
|
||
this.B = new RectF((f26 + f27) - (f28 / 2.0f), (f29 + f30) - (f31 / 2.0f), f26 + f27 + (f28 / 2.0f), f29 + f30 + (f31 / 2.0f));
|
||
float f32 = this.Q;
|
||
float f33 = this.c;
|
||
float f34 = this.a;
|
||
float f35 = this.P;
|
||
float f36 = this.e;
|
||
float f37 = this.b;
|
||
this.C = new RectF((f32 - f33) - (f34 / 2.0f), (f35 + f36) - (f37 / 2.0f), (f32 - f33) + (f34 / 2.0f), f35 + f36 + (f37 / 2.0f));
|
||
this.E = BitmapFactory.decodeResource(this.D.getResources(), R.drawable.tension_start);
|
||
Context context = this.D;
|
||
float f38 = this.i;
|
||
this.F = BitmapUtils.a(context, R.drawable.tension_end, (int) f38, (int) f38);
|
||
float f39 = this.i;
|
||
this.x = new RectF(f12 - (f39 / 2.0f), f - (f39 / 2.0f), f12 + (f39 / 2.0f), f + (f39 / 2.0f));
|
||
this.G = BitmapFactory.decodeResource(this.D.getResources(), R.mipmap.arrow_up);
|
||
this.H = BitmapFactory.decodeResource(this.D.getResources(), R.mipmap.arrow_down);
|
||
}
|
||
|
||
private float b(float f, float f2) {
|
||
float centerX = this.u.centerX();
|
||
double degrees = Math.toDegrees(Math.atan((this.u.centerY() - f2) / (f - centerX)));
|
||
if (f <= centerX) {
|
||
degrees += 180.0d;
|
||
}
|
||
double d = -28.0f;
|
||
if (degrees >= d) {
|
||
d = degrees >= 208.0d ? 208.0d : degrees;
|
||
}
|
||
return (float) d;
|
||
}
|
||
|
||
private float[] a(float f, DataType dataType) {
|
||
float f2;
|
||
float f3;
|
||
float abs = (Math.abs(118.0f) + Math.abs(-118.0f)) / 236.0f;
|
||
if (dataType == DataType.START) {
|
||
f2 = (abs * (f - (-118.0f))) + 152.0f;
|
||
this.N = f2;
|
||
double d = this.N;
|
||
if (d > 360.0d) {
|
||
this.N = d - 360.0d;
|
||
}
|
||
f3 = f2;
|
||
} else {
|
||
f2 = (abs * (118.0f - f)) + 236.0f;
|
||
this.O = f2 + this.N;
|
||
double d2 = this.O;
|
||
f3 = d2 > 360.0d ? (float) (d2 - 360.0d) : 0.0f;
|
||
LogUtils.c("launchLimitAngle:angleDeviation:" + f2 + " progressEndAngle:" + this.O);
|
||
}
|
||
if (f3 >= 90.0f && f3 <= 180.0f) {
|
||
float f4 = 180.0f - f3;
|
||
double radians = Math.toRadians(f4);
|
||
double sin = Math.sin(radians) * (this.g / 2.0f);
|
||
float f5 = (float) (this.P + sin);
|
||
float cos = (float) (this.Q - (Math.cos(radians) * (this.g / 2.0f)));
|
||
Log.e("Test", "minBallX:" + cos + " minBallY:" + f5 + " radiansA:" + f4);
|
||
return new float[]{cos, f5};
|
||
}
|
||
if (f3 > 180.0f && f3 <= 270.0f) {
|
||
float f6 = f2 - 180.0f;
|
||
double radians2 = Math.toRadians(f6);
|
||
double sin2 = Math.sin(radians2) * (this.g / 2.0f);
|
||
float f7 = (float) (this.P - sin2);
|
||
float cos2 = (float) (this.Q - (Math.cos(radians2) * (this.g / 2.0f)));
|
||
Log.e("Test", "minBallX:" + cos2 + " minBallY:" + f7 + " radiansA:" + f6);
|
||
return new float[]{cos2, f7};
|
||
}
|
||
if (f3 > 270.0f && f3 <= 360.0f) {
|
||
float f8 = f2 - 270.0f;
|
||
double radians3 = Math.toRadians(f8);
|
||
double sin3 = Math.sin(radians3) * (this.g / 2.0f);
|
||
float cos3 = (float) (this.P - (Math.cos(radians3) * (this.g / 2.0f)));
|
||
float f9 = (float) (this.Q + sin3);
|
||
Log.e("Test", "minBallX:" + f9 + " minBallY:" + cos3 + " radiansA:" + f8);
|
||
return new float[]{f9, cos3};
|
||
}
|
||
if (f3 >= 360.0f) {
|
||
float f10 = f2 - 360.0f;
|
||
double radians4 = Math.toRadians(f10);
|
||
double sin4 = Math.sin(radians4) * (this.g / 2.0f);
|
||
float f11 = (float) (this.P + sin4);
|
||
float cos4 = (float) (this.Q + (Math.cos(radians4) * (this.g / 2.0f)));
|
||
Log.e("Test", "minBallX:" + cos4 + " minBallY:" + f11 + " radiansA:" + f10);
|
||
return new float[]{cos4, f11};
|
||
}
|
||
double radians5 = Math.toRadians(28.0f);
|
||
double sin5 = Math.sin(radians5) * (this.g / 2.0f);
|
||
float cos5 = (float) (this.Q - (Math.cos(radians5) * (this.g / 2.0f)));
|
||
float f12 = (float) (sin5 + this.P);
|
||
this.N = 152.0d;
|
||
this.O = 28.0d;
|
||
return new float[]{cos5, f12};
|
||
}
|
||
|
||
private float[] a(float f) {
|
||
if (f >= 90.0f && f <= 180.0f) {
|
||
float f2 = 180.0f - f;
|
||
double radians = Math.toRadians(f2);
|
||
double sin = Math.sin(radians) * (this.g / 2.0f);
|
||
float f3 = (float) (this.P + sin);
|
||
float cos = (float) (this.Q - (Math.cos(radians) * (this.g / 2.0f)));
|
||
Log.e("Test", "minBallX:" + cos + " minBallY:" + f3 + " radiansA:" + f2);
|
||
return new float[]{cos, f3};
|
||
}
|
||
if (f > 180.0f && f <= 270.0f) {
|
||
float f4 = f - 180.0f;
|
||
double radians2 = Math.toRadians(f4);
|
||
double sin2 = Math.sin(radians2) * (this.g / 2.0f);
|
||
float f5 = (float) (this.P - sin2);
|
||
float cos2 = (float) (this.Q - (Math.cos(radians2) * (this.g / 2.0f)));
|
||
Log.e("Test", "minBallX:" + cos2 + " minBallY:" + f5 + " radiansA:" + f4);
|
||
return new float[]{cos2, f5};
|
||
}
|
||
if (f > 270.0f && f <= 360.0f) {
|
||
double radians3 = Math.toRadians(f - 270.0f);
|
||
return new float[]{(float) (this.Q + (Math.sin(radians3) * (this.g / 2.0f))), (float) (this.P - (Math.cos(radians3) * (this.g / 2.0f)))};
|
||
}
|
||
if (f >= 0.0f && f < 90.0f) {
|
||
double radians4 = Math.toRadians(f);
|
||
return new float[]{(float) (this.Q + (Math.cos(radians4) * (this.g / 2.0f))), (float) (this.P + (Math.sin(radians4) * (this.g / 2.0f)))};
|
||
}
|
||
double radians5 = Math.toRadians(28.0f);
|
||
double sin3 = Math.sin(radians5) * (this.g / 2.0f);
|
||
float cos3 = (float) (this.Q - (Math.cos(radians5) * (this.g / 2.0f)));
|
||
float f6 = (float) (sin3 + this.P);
|
||
this.N = 152.0d;
|
||
this.O = 28.0d;
|
||
return new float[]{cos3, f6};
|
||
}
|
||
|
||
private double a(double d) {
|
||
if (Math.round(d) < 152.0f) {
|
||
d += 360.0d;
|
||
}
|
||
return Math.round((d - 152.0d) * 1.0d) - 118.0d;
|
||
}
|
||
|
||
public float a(boolean z) {
|
||
float degrees = (float) Math.toDegrees(Math.atan2(this.u.centerX() - this.x.centerX(), this.u.centerY() - this.x.centerY()));
|
||
return !z ? degrees + 180.0f : degrees;
|
||
}
|
||
}
|