diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CircularProgressView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CircularProgressView.kt index 4d201ca303..59f51b97d1 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CircularProgressView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CircularProgressView.kt @@ -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) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java index 8dd8526f1c..2a4734013b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java @@ -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); } }); diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel.xml index 0dc4ac8ab0..a9548ff937 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_steering_wheel.xml @@ -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" />