Merge remote-tracking branch 'origin/dev_robotaxi-d-app-module_265_220329_2.6.5' into dev_robotaxi-d-app-module_265_220329_2.6.5

This commit is contained in:
donghongyu
2022-04-11 18:09:28 +08:00
3 changed files with 16 additions and 11 deletions

View File

@@ -78,14 +78,17 @@ class CircularProgressView @JvmOverloads constructor(
val mRectT = getPaddingTop() + (viewHigh - mRectLength) / 2
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
(mRectT + mRectLength).toFloat())
Log.d(TAG, "渐变色:" + mColorArray?.size.toString())
// 设置进度圆环渐变色
mColorArray?.let {
mProgPaint.shader = LinearGradient(
0.0f, 0.0f, 0.0f,
measuredWidth.toFloat(), it, null, Shader.TileMode.MIRROR)
0f, 0f, 0f,
measuredWidth.toFloat(), mColorArray!![0], mColorArray!![1], Shader.TileMode.MIRROR)
}
Log.d(TAG, mRectL.toString() + "," + mRectT.toString())
Log.d(TAG, mRectF.toString() + "," + "width:" + measuredWidth.toString() + "," + "PaddingLeft:" + getPaddingLeft().toString())
}
override fun onDraw(canvas: Canvas?) {
@@ -188,10 +191,14 @@ class CircularProgressView @JvmOverloads constructor(
fun setProgColor(startColor: Int, endColor: Int) {
mColorArray = intArrayOf(ContextCompat.getColor(context, startColor), ContextCompat.getColor(context, endColor))
mColorArray?.let {
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
if (mRectF != null) {
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), mColorArray!![0], mColorArray!![1], Shader.TileMode.MIRROR)
}
}
Log.d(TAG, "setProgColor:" + getMeasuredWidth().toString())
}
fun setProgColor(colorArray: IntArray) {

View File

@@ -73,6 +73,7 @@ public class SteeringWheelView extends ConstraintLayout {
steeringCircularV.setBackWidth(8);
steeringCircularV.setBackColor(R.color.hmi_light_blue_00);
steeringCircularV.setProgColor(R.color.hmi_light_blue, R.color.hmi_dark_blue);
steeringCircularV.setProgress((int) (180 * 100) / 360, 1000);
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
@@ -163,17 +164,15 @@ public class SteeringWheelView extends ConstraintLayout {
steeringTVR.setVisibility(View.INVISIBLE);
steeringTVL.setVisibility(View.VISIBLE);
steeringTVL.setText(String.valueOf((int) steering) + "°");
steeringCircularV.setProgress((int) steering, 1000);
animationWithSteeringData(steering);
} else if (steeringTVR != null && steering > 0) {
} else if (steeringTVR != null && steering >= 0) {
steeringTVL.setVisibility(View.INVISIBLE);
steeringTVR.setVisibility(View.VISIBLE);
steeringTVR.setText(String.valueOf((int) steering) + "°");
steeringCircularV.setProgress((int) steering, 1000);
animationWithSteeringData(steering);
} else {
Log.d(TAG, "onAutopilotSteeringData error");
}
animationWithSteeringData(steering);
steeringCircularV.setProgress((int) (steering * 100) / 360, 1000);
}
});

View File

@@ -42,7 +42,6 @@
android:text="18°"
android:textColor="#415479"
android:textSize="@dimen/dp_26"
android:visibility="invisible"
app:layout_constraintLeft_toRightOf="@+id/autopilot_iv"
app:layout_constraintTop_toTopOf="parent" />