mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 21:47:10 +08:00
refactor(views): DunTemperatureView 颜色值提取为静态常量
- 新增 COLOR_GRADIENT_LOW/MID/HIGH 渐变颜色常量 - 新增 COLOR_BORDER 边框颜色常量 - 新增 COLOR_TEXT 文本颜色常量 - 替换 mGradientColors、mBorderColor、mTextColor 为常量引用
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Mon Jul 20 14:47:50 CST 2026
|
||||
#Tue Jul 21 11:13:12 CST 2026
|
||||
stageCount=12
|
||||
libraryProject=
|
||||
baseVersion=15.20
|
||||
baseVersion=15.21
|
||||
publishVersion=15.20.11
|
||||
buildCount=17
|
||||
buildCount=22
|
||||
baseBetaVersion=15.20.12
|
||||
|
||||
@@ -36,6 +36,14 @@ public class DunTemperatureView extends View {
|
||||
private static final int FILL_PADDING_VERTICAL = 2;
|
||||
// 竖排文本字间距
|
||||
private static final float TEXT_CHAR_SPACING = 8f;
|
||||
// 渐变颜色常量(低→中→高 对应绿→黄→红)
|
||||
private static final int COLOR_GRADIENT_LOW = Color.GREEN;
|
||||
private static final int COLOR_GRADIENT_MID = Color.YELLOW;
|
||||
private static final int COLOR_GRADIENT_HIGH = Color.RED;
|
||||
// 边框颜色
|
||||
private static final int COLOR_BORDER = Color.parseColor("#FF444444");
|
||||
// 文本颜色
|
||||
private static final int COLOR_TEXT = Color.parseColor("#FF000000");
|
||||
// Handler消息标识
|
||||
public static final int MSG_UPDATE_DUN_VALUE = 0x01;
|
||||
// 消息参数Key
|
||||
@@ -60,13 +68,13 @@ public class DunTemperatureView extends View {
|
||||
private int mCurrentValue = 0; // 当前盾值
|
||||
private RectF mThermometerRect; // 温度条矩形区域
|
||||
// 渐变颜色配置(低→中→高 对应绿→黄→红)
|
||||
private int[] mGradientColors = {Color.GREEN, Color.YELLOW, Color.RED};
|
||||
private int[] mGradientColors = {COLOR_GRADIENT_LOW, COLOR_GRADIENT_MID, COLOR_GRADIENT_HIGH};
|
||||
private float[] mGradientPositions = {0.0f, 0.5f, 1.0f};
|
||||
// 布局配置:true=文本在温度条右侧(默认),false=文本在温度条左侧
|
||||
private boolean isTextOnRight = true;
|
||||
// 其他颜色配置
|
||||
private int mBorderColor = Color.parseColor("#FF444444");
|
||||
private int mTextColor = Color.parseColor("#FF000000");
|
||||
private int mBorderColor = COLOR_BORDER;
|
||||
private int mTextColor = COLOR_TEXT;
|
||||
|
||||
// ====================== 静态代码块 ======================
|
||||
static {
|
||||
|
||||
Reference in New Issue
Block a user