能量风格绘图方法切换回老式算法,修复能量条间隔缝隙问题。

This commit is contained in:
2025-12-28 13:52:51 +08:00
parent e379684002
commit 56a65cd10a
2 changed files with 21 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Sun Dec 28 13:16:31 HKT 2025 #Sun Dec 28 05:50:24 GMT 2025
stageCount=39 stageCount=39
libraryProject= libraryProject=
baseVersion=15.14 baseVersion=15.14
publishVersion=15.14.38 publishVersion=15.14.38
buildCount=0 buildCount=1
baseBetaVersion=15.14.39 baseBetaVersion=15.14.39

View File

@@ -121,9 +121,25 @@ public class BatteryDrawable extends Drawable {
*/ */
private void drawEnergyStyle(Canvas canvas, int battery, int left, int right, int height) { private void drawEnergyStyle(Canvas canvas, int battery, int left, int right, int height) {
LogUtils.d(TAG, "【drawEnergyStyle】能量风格绘制开始 | 电量=" + battery); LogUtils.d(TAG, "【drawEnergyStyle】能量风格绘制开始 | 电量=" + battery);
int top = height - (height * battery / BATTERY_MAX); // 计算电量对应顶部坐标 // int top = height - (height * battery / BATTERY_MAX); // 计算电量对应顶部坐标
canvas.drawRect(new Rect(left, top, right, height), mBatteryPaint); // canvas.drawRect(new Rect(left, top, right, height), mBatteryPaint);
LogUtils.d(TAG, "【drawEnergyStyle】能量风格绘制完成 | 顶部坐标=" + top); // LogUtils.d(TAG, "【drawEnergyStyle】能量风格绘制完成 | 顶部坐标=" + top);
int nWidth = getBounds().width();
int nHeight = getBounds().height();
int mnDx = nHeight / 203;
// 绘制耗电电量提醒值电量
// 能量绘图风格
int nTop;
int nLeft = 0;
int nBottom;
int nRight = nWidth;
//for (int i = 0; i < mnValue; i ++) {
nBottom = nHeight;
nTop = nHeight - (nHeight * mBatteryValue / 100);
canvas.drawRect(new Rect(nLeft, nTop, nRight, nBottom), mBatteryPaint);
} }
/** /**