Skip to content

Commit a3f2d85

Browse files
refactor(*): 优化AirDashBoardView
1 parent 53cc08f commit a3f2d85

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lite/src/main/java/com/pengxh/kt/lite/widget/AirDashBoardView.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class AirDashBoardView constructor(context: Context, attrs: AttributeSet) : View
3232
//控件边长
3333
private val viewSideLength: Int
3434
private val viewRect: Rect
35-
private val ringRadius: Int
3635
private lateinit var guidePaint: Paint
3736

3837
//表盘圆弧色
@@ -51,9 +50,6 @@ class AirDashBoardView constructor(context: Context, attrs: AttributeSet) : View
5150
//当前污染物测量值
5251
private var currentValue = 0
5352

54-
//污染物最小值
55-
private var minValue = 0
56-
5753
//污染物最大值
5854
private var maxValue = 500
5955

@@ -72,7 +68,7 @@ class AirDashBoardView constructor(context: Context, attrs: AttributeSet) : View
7268
* getDimensionPixelSize()返回的是实际数值的四舍五入
7369
* getDimensionPixelOffset返回的是实际数值去掉后面的小数点
7470
*/
75-
ringRadius = type.getDimensionPixelSize(
71+
val ringRadius = type.getDimensionPixelSize(
7672
R.styleable.AirDashBoardView_air_ring_radius, 100.dp2px(context)
7773
)
7874
viewSideLength = ringRadius + 15.dp2px(context)
@@ -272,7 +268,7 @@ class AirDashBoardView constructor(context: Context, attrs: AttributeSet) : View
272268

273269
private fun drawMinValue(canvas: Canvas) {
274270
canvas.drawText(
275-
minValue.toString(),
271+
"0",
276272
-viewSideLength / 2f,
277273
viewSideLength / 2f + viewSideLength / 3f,
278274
thresholdPaint

0 commit comments

Comments
 (0)