diff --git a/powerbell/build.properties b/powerbell/build.properties
index cd4ebd2..68437c4 100644
--- a/powerbell/build.properties
+++ b/powerbell/build.properties
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
-#Sun Dec 28 13:54:20 HKT 2025
+#Sun Dec 28 12:37:50 GMT 2025
stageCount=40
libraryProject=
baseVersion=15.14
publishVersion=15.14.39
-buildCount=0
+buildCount=2
baseBetaVersion=15.14.40
diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/models/BatteryStyle.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/models/BatteryStyle.java
index b6762ed..e0a7617 100644
--- a/powerbell/src/main/java/cc/winboll/studio/powerbell/models/BatteryStyle.java
+++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/models/BatteryStyle.java
@@ -6,6 +6,7 @@ package cc.winboll.studio.powerbell.models;
*/
public enum BatteryStyle {
ENERGY_STYLE, // 能量样式
- ZEBRA_STYLE // 条纹样式
+ ZEBRA_STYLE, // 条纹样式
+ POINT_STYLE // 点阵样式
}
diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryDrawable.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryDrawable.java
index 108ab10..2a5e4f3 100644
--- a/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryDrawable.java
+++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryDrawable.java
@@ -106,6 +106,8 @@ public class BatteryDrawable extends Drawable {
drawEnergyStyle(canvas, validBattery, left, right, drawHeight);
} else if (mBatteryStyle == BatteryStyle.ZEBRA_STYLE) {
drawZebraStyle(canvas, validBattery, left, right, drawHeight);
+ } else if (mBatteryStyle == BatteryStyle.POINT_STYLE) {
+ drawPointStyle(canvas, validBattery, left, right, drawHeight);
}
LogUtils.d(TAG, "【draw】绘制完成");
}
@@ -139,7 +141,7 @@ public class BatteryDrawable extends Drawable {
nBottom = nHeight;
nTop = nHeight - (nHeight * mBatteryValue / 100);
canvas.drawRect(new Rect(nLeft, nTop, nRight, nBottom), mBatteryPaint);
-
+
}
/**
@@ -179,6 +181,49 @@ public class BatteryDrawable extends Drawable {
LogUtils.d(TAG, "【drawStripeStyle】条纹风格绘制完成 | 条纹数量=" + battery);
}
+
+ /**
+ * 点阵风格绘制
+ * @param canvas 绘制画布
+ * @param battery 有效电量(0-100)
+ * @param left 左边界
+ * @param right 右边界
+ * @param height 绘制高度
+ */
+ private void drawPointStyle(Canvas canvas, int battery, int left, int right, int height) {
+ LogUtils.d(TAG, "【drawStripeStyle】条纹风格绘制开始 | 电量=" + battery);
+
+ int nWidth = getBounds().width();
+ int nHeight = getBounds().height();
+ int mnDx = nHeight / 203;
+
+
+ // 意兴阑珊绘图风格
+ int nTop;
+ int nLeft = 0;
+ int nBottom;
+ int nRight = nWidth;
+
+ int nLineWidth = nRight - nLeft;
+ int radius_horizontal = (nLineWidth / 10) / 2;
+ int radius_vertical = mnDx/2;
+ int radius = Math.min(radius_horizontal, radius_vertical);
+
+ for (int i = 0; i < mBatteryValue; i ++) {
+ nBottom = (nHeight * (100 - i) / 100) - mnDx;
+ nTop = nBottom + mnDx;
+ //canvas.drawRect(new Rect(nLeft, nTop, nRight, nBottom), mBatteryPaint);
+
+ for (int j = 0; j < 10; j++) {
+ // cx, cy 圆心坐标;radius 半径;paint 画笔
+ int cx = radius_horizontal + radius_horizontal * j * 2;
+ int cy = nTop + radius_vertical;
+ canvas.drawCircle(cx, cy, radius, mBatteryPaint);
+ }
+ }
+ LogUtils.d(TAG, "【drawStripeStyle】条纹风格绘制完成 | 条纹数量=" + battery);
+ }
+
// ====================================== 对外暴露方法(业务控制入口,按功能排序) ======================================
/**
* 设置当前电量(外部核心调用入口)
diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryStyleView.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryStyleView.java
index fbe69fa..9cd6a7c 100644
--- a/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryStyleView.java
+++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/views/BatteryStyleView.java
@@ -37,10 +37,13 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
private RadioGroup rgBatteryStyle;
private RadioButton rbZebraStyle;
private RadioButton rbEnergyStyle;
+ private RadioButton rbPointStyle; // ✅ 新增:圆点样式单选按钮
private RelativeLayout rlZebraPreview;
private RelativeLayout rlEnergyPreview;
+ private RelativeLayout rlPointPreview; // ✅ 新增:圆点样式预览布局
private BatteryDrawable mZebraDrawable;
private BatteryDrawable mEnergyDrawable;
+ private BatteryDrawable mPointDrawable; // ✅ 新增:圆点样式Drawable实例
// ====================== 业务变量 ======================
private BatteryStyle mCurrentStyle = BatteryStyle.ENERGY_STYLE; // ✅ 修改默认样式为 能量样式
@@ -83,7 +86,7 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
mBatteryColor = typedArray.getColor(R.styleable.BatteryStyleView_batteryPreviewColor, DEFAULT_BATTERY_COLOR);
mBatteryValue = typedArray.getInt(R.styleable.BatteryStyleView_previewBatteryValue, 100);
int styleIndex = typedArray.getInt(R.styleable.BatteryStyleView_defaultSelectedStyle, DEFAULT_CHECKED_STYLE_INDEX);
- mCurrentStyle = getStyleFromSP() == null ? (styleIndex == 0 ? BatteryStyle.ENERGY_STYLE : BatteryStyle.ZEBRA_STYLE) : getStyleFromSP();
+ mCurrentStyle = getStyleFromSP() == null ? (styleIndex == 0 ? BatteryStyle.ENERGY_STYLE : styleIndex ==1 ? BatteryStyle.ZEBRA_STYLE : BatteryStyle.POINT_STYLE) : getStyleFromSP();
typedArray.recycle();
LogUtils.d(TAG, "【initAttrs】解析属性完成 电量颜色=" + Integer.toHexString(mBatteryColor) + " 预览电量=" + mBatteryValue + " 默认样式=" + mCurrentStyle.name());
}
@@ -93,8 +96,10 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
rgBatteryStyle = findViewById(R.id.rg_battery_style);
rbZebraStyle = findViewById(R.id.rb_zebra_style);
rbEnergyStyle = findViewById(R.id.rb_energy_style);
+ rbPointStyle = findViewById(R.id.rb_point_style); // ✅ 新增:绑定圆点样式单选按钮
rlZebraPreview = findViewById(R.id.rl_zebra_preview);
rlEnergyPreview = findViewById(R.id.rl_energy_preview);
+ rlPointPreview = findViewById(R.id.rl_point_preview); // ✅ 新增:绑定圆点样式预览布局
initPreviewDrawable();
rgBatteryStyle.setOnCheckedChangeListener(this);
@@ -111,12 +116,21 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
mEnergyDrawable = new BatteryDrawable(mBatteryColor, BatteryStyle.ENERGY_STYLE);
mEnergyDrawable.setBatteryValue(mBatteryValue);
rlEnergyPreview.setBackground(mEnergyDrawable);
+
+ // ✅ 新增:初始化圆点样式Drawable + 绑定预览布局 + 设置电量值
+ mPointDrawable = new BatteryDrawable(mBatteryColor, BatteryStyle.POINT_STYLE);
+ mPointDrawable.setBatteryValue(mBatteryValue);
+ rlPointPreview.setBackground(mPointDrawable);
+
LogUtils.d(TAG, "【initPreviewDrawable】Drawable预览初始化完成");
}
private void setDefaultChecked() {
+ // ✅ 新增:圆点样式的默认选中判断
if (mCurrentStyle == BatteryStyle.ZEBRA_STYLE) {
rbZebraStyle.setChecked(true);
+ } else if (mCurrentStyle == BatteryStyle.POINT_STYLE) {
+ rbPointStyle.setChecked(true);
} else {
rbEnergyStyle.setChecked(true);
}
@@ -129,6 +143,7 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
public void onClick(View v) {
rbZebraStyle.setChecked(true);
rbEnergyStyle.setChecked(false);
+ rbPointStyle.setChecked(false); // ✅ 新增:取消圆点样式选中
handleStyleSelect(BatteryStyle.ZEBRA_STYLE);
}
});
@@ -138,9 +153,21 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
public void onClick(View v) {
rbEnergyStyle.setChecked(true);
rbZebraStyle.setChecked(false);
+ rbPointStyle.setChecked(false); // ✅ 新增:取消圆点样式选中
handleStyleSelect(BatteryStyle.ENERGY_STYLE);
}
});
+
+ // ✅ 新增:圆点样式单选按钮点击事件
+ rbPointStyle.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ rbPointStyle.setChecked(true);
+ rbZebraStyle.setChecked(false);
+ rbEnergyStyle.setChecked(false);
+ handleStyleSelect(BatteryStyle.POINT_STYLE);
+ }
+ });
}
// ====================== RadioGroup 选中回调 (点击必触发) ======================
@@ -151,6 +178,8 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
handleStyleSelect(BatteryStyle.ZEBRA_STYLE);
} else if (checkedId == R.id.rb_energy_style) {
handleStyleSelect(BatteryStyle.ENERGY_STYLE);
+ } else if (checkedId == R.id.rb_point_style) { // ✅ 新增:圆点样式选中回调
+ handleStyleSelect(BatteryStyle.POINT_STYLE);
}
}
@@ -218,8 +247,10 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
// ====================== 对外暴露方法 ======================
public void setSelectedStyle(BatteryStyle style) {
mCurrentStyle = style;
+ // ✅ 新增:圆点样式的手动选中赋值
rbZebraStyle.setChecked(style == BatteryStyle.ZEBRA_STYLE);
rbEnergyStyle.setChecked(style == BatteryStyle.ENERGY_STYLE);
+ rbPointStyle.setChecked(style == BatteryStyle.POINT_STYLE);
saveStyle2SP(style);
LogUtils.d(TAG, "【setSelectedStyle】手动设置选中样式 → " + style.name() + ",已存入SP");
}
@@ -232,12 +263,14 @@ public class BatteryStyleView extends LinearLayout implements RadioGroup.OnCheck
this.mBatteryValue = batteryValue;
mZebraDrawable.setBatteryValue(batteryValue);
mEnergyDrawable.setBatteryValue(batteryValue);
+ mPointDrawable.setBatteryValue(batteryValue); // ✅ 新增:圆点样式同步电量值
}
public void setPreviewBatteryColor(int color) {
this.mBatteryColor = color;
mZebraDrawable.updateBatteryColor(color);
mEnergyDrawable.updateBatteryColor(color);
+ mPointDrawable.updateBatteryColor(color); // ✅ 新增:圆点样式同步颜色值
}
public void setOnBatteryStyleSelectedListener(OnBatteryStyleSelectedListener listener) {
diff --git a/powerbell/src/main/res/layout/view_battery_style.xml b/powerbell/src/main/res/layout/view_battery_style.xml
index 122a688..8b36cdb 100644
--- a/powerbell/src/main/res/layout/view_battery_style.xml
+++ b/powerbell/src/main/res/layout/view_battery_style.xml
@@ -9,6 +9,33 @@
android:padding="8dp"
android:spacing="16dp">
+
+
+
+
+
+
+
+
-
+
diff --git a/powerbell/src/main/res/values/attrs.xml b/powerbell/src/main/res/values/attrs.xml
index 634aeca..a4c52b6 100644
--- a/powerbell/src/main/res/values/attrs.xml
+++ b/powerbell/src/main/res/values/attrs.xml
@@ -9,8 +9,4 @@
-
-
- Zebra Style
- Energy Style
diff --git a/powerbell/src/main/res/values/strings.xml b/powerbell/src/main/res/values/strings.xml
index 5490a15..81c33f6 100644
--- a/powerbell/src/main/res/values/strings.xml
+++ b/powerbell/src/main/res/values/strings.xml
@@ -32,6 +32,9 @@
About The APP
>>>Seek 100% Right Is Clean Record.>>>
No Battery Record
+ Zebra Style
+ Energy Style
+ Point Style
权限申请