[sonar] fix sonar plm
This commit is contained in:
@@ -12,19 +12,18 @@ import androidx.annotation.Nullable;
|
||||
|
||||
public class SharpView extends View {
|
||||
|
||||
private int mWidth =0; //三角形的宽度
|
||||
private int mHeight =0; //三角形的高度
|
||||
private Context mContext;
|
||||
private int mWidth = 0; //三角形的宽度
|
||||
private int mHeight = 0; //三角形的高度
|
||||
private final Paint paint = new Paint();
|
||||
private final Path path = new Path();
|
||||
|
||||
public SharpView(Context context) {
|
||||
super(context);
|
||||
this.mContext=context;
|
||||
initView();
|
||||
}
|
||||
|
||||
public SharpView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mContext=context;
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -32,28 +31,27 @@ public class SharpView extends View {
|
||||
mWidth = 25;
|
||||
mHeight = 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(mWidth,mHeight);
|
||||
setMeasuredDimension(mWidth, mHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
//创建画笔
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(Color.parseColor("#FFFFFFFF"));
|
||||
paint.setAntiAlias(true); //抗锯齿
|
||||
paint.setStyle(Paint.Style.FILL);//实线
|
||||
//创建路径
|
||||
Path path = new Path();
|
||||
path.moveTo(0,mHeight);
|
||||
path.lineTo(mWidth,mHeight);
|
||||
path.lineTo(mWidth/2,0);
|
||||
path.moveTo(0, mHeight);
|
||||
path.lineTo(mWidth, mHeight);
|
||||
path.lineTo(mWidth / 2.0f, 0);
|
||||
path.close();//闭合路径
|
||||
//画在画布上
|
||||
canvas.drawPath(path,paint);
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import static com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocRece
|
||||
import static com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START;
|
||||
import static com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -12,6 +13,7 @@ import com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBea
|
||||
|
||||
public class DispatchDialogManager {
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static volatile DispatchDialogManager manager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private final Context mContext;
|
||||
|
||||
@@ -22,13 +22,13 @@ import com.mogo.eagle.core.function.hmi.R;
|
||||
public class SpeedChartView extends View {
|
||||
|
||||
//中心的文字描述
|
||||
private String mDes = "KM/H";
|
||||
private final String mDes = "KM/H";
|
||||
//根据数据显示的圆弧Paint
|
||||
private Paint mArcPaint;
|
||||
//圆弧颜色
|
||||
private int mArcColor;
|
||||
//圆弧的画笔的宽度
|
||||
private float mStrokeWith = getResources().getDimension(R.dimen.module_ext_arcView_stroke_with);
|
||||
private final float mStrokeWith = getResources().getDimension(R.dimen.module_ext_arcView_stroke_with);
|
||||
//文字描述的paint
|
||||
private Paint mTextPaint;
|
||||
|
||||
@@ -37,9 +37,9 @@ public class SpeedChartView extends View {
|
||||
//当前数据
|
||||
private int currentValue;
|
||||
//最大数据
|
||||
private int maxValue = 240;
|
||||
private final int maxValue = 240;
|
||||
//圆弧背景的开始和结束间的夹角大小
|
||||
private float mAngle = 270;
|
||||
private final float mAngle = 270;
|
||||
//上次绘制圆弧夹角
|
||||
private float lastAngle = 0;
|
||||
|
||||
@@ -73,13 +73,13 @@ public class SpeedChartView extends View {
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
//绘制中心的数值
|
||||
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
|
||||
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2 - 10, mTextPaint);
|
||||
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
|
||||
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
|
||||
//绘制中心文字描述
|
||||
mTextPaint.setTextSize(getResources().getDimension(R.dimen.module_ext_arcView_des_text_size));
|
||||
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
|
||||
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
|
||||
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
|
||||
}
|
||||
|
||||
private void drawArc(Canvas canvas) {
|
||||
|
||||
Reference in New Issue
Block a user