渐变模糊化,色值待与UI确认

This commit is contained in:
liujing
2022-05-12 19:59:39 +08:00
parent 37a72ae29a
commit e0fa0027a0
4 changed files with 29 additions and 21 deletions

View File

@@ -56,6 +56,7 @@ class CircularProgressView @JvmOverloads constructor(
mProgPaint.isDither = true // 设置抖动
mProgPaint.strokeWidth = typedArray.getDimension(R.styleable.CircularProgressView_progWidth, 10.0f)
mProgPaint.color = typedArray.getColor(R.styleable.CircularProgressView_progColor, Color.BLUE)
// mProgPaint.setPathEffect()
// 初始化进度圆环渐变色
val startColor = typedArray.getColor(R.styleable.CircularProgressView_progStartColor, -1)
val firstColor = typedArray.getColor(R.styleable.CircularProgressView_progFirstColor, -1)
@@ -65,7 +66,7 @@ class CircularProgressView @JvmOverloads constructor(
mColorArray = null
}
// mProgPaint.setShadowLayer()
typedArray.recycle();
}
@@ -102,6 +103,12 @@ class CircularProgressView @JvmOverloads constructor(
}
fun setBlurMaskFilter(blur: Boolean,radius: Float) {
var blur: BlurMaskFilter = BlurMaskFilter(radius, BlurMaskFilter.Blur.NORMAL)
mProgPaint.setMaskFilter(blur)
invalidate()
}
/**
* 获取当前进度
* @return 当前进度0-100

View File

@@ -75,13 +75,15 @@ public class SteeringWheelView extends ConstraintLayout {
tapPositionView = findViewById(R.id.tap_position);
steeringCircularV = findViewById(R.id.steering_circular);
steeringCircularV.setBackWidth(8);
steeringCircularV.setBackColor(R.color.hmi_light_blue_00);
steeringCircularV.setBackColor(R.color.hmi_light_back_bg);
steeringCircularV.setProgColor(R.color.hmi_light_blue, R.color.hmi_dark_blue);
steeringCircularV.setProgress((int) (180 * 100) / 360, 1000);
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
steeringCircularVAlpha = findViewById(R.id.steering_circular_alpha);
steeringCircularVAlpha.setAlpha(0.4f);
steeringCircularVAlpha.setBackColor(R.color.hmi_light_blue_00);
steeringCircularVAlpha.setBackWidth(20);
steeringCircularVAlpha.setProgWidth(20);
steeringCircularVAlpha.setBlurMaskFilter(true, 10.0f);
steeringCircularVAlpha.setBackColor(R.color.hmi_clear_00);
steeringCircularVAlpha.setProgColor(R.color.hmi_light_blue_alpha);
steeringCircularVAlpha.setProgress((int) (180 * 100) / 360, 1000);
}

View File

@@ -18,18 +18,18 @@
app:layout_constraintTop_toTopOf="parent" />
<!--底层默认进度条,无进度值改变动作-->
<ProgressBar
android:id="@+id/blue_circle"
android:layout_width="@dimen/dp_260"
android:layout_height="@dimen/dp_260"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/dp_85"
android:layout_marginTop="@dimen/dp_130"
android:layout_marginRight="@dimen/dp_85"
android:indeterminateDrawable="@drawable/bg_steering_outer_taxi"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <ProgressBar-->
<!-- android:id="@+id/blue_circle"-->
<!-- android:layout_width="@dimen/dp_260"-->
<!-- android:layout_height="@dimen/dp_260"-->
<!-- android:layout_centerHorizontal="true"-->
<!-- android:layout_marginLeft="@dimen/dp_85"-->
<!-- android:layout_marginTop="@dimen/dp_130"-->
<!-- android:layout_marginRight="@dimen/dp_85"-->
<!-- android:indeterminateDrawable="@drawable/bg_steering_outer_taxi"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent" />-->
<TextView
android:id="@+id/steering_tv_left"
@@ -66,7 +66,6 @@
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_130"
android:outlineAmbientShadowColor="#1EBBCFF6"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -84,7 +83,6 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:progWidth="22px"
app:progress="0" />
<ImageView
@@ -104,6 +102,6 @@
android:layout_marginTop="@dimen/dp_30"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/blue_circle" />
app:layout_constraintTop_toBottomOf="@+id/steering_circular" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -56,6 +56,7 @@
<color name="hmi_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="hmi_light_blue">#45D3FF</color>
<color name="hmi_dark_blue">#1B5BFF</color>
<color name="hmi_light_blue_00">#0045D3FF</color>
<color name="hmi_light_back_bg">#1EBBCFF6</color>
<color name="hmi_light_blue_alpha">#666C79C4</color>
<color name="hmi_clear_00">#0045D3FF</color>
</resources>