mirror of https://github.com/espruino/BangleApps
widbat: Use flash, not fork to indicate charging
Green fork is not easily visible, which can be confusing.pull/2984/head
parent
918be9e7bb
commit
bc92e0c8c6
|
@ -8,3 +8,4 @@
|
|||
0.09: Misc speed/memory tweaks
|
||||
0.10: Color changes due to the battery level
|
||||
0.11: Change level for medium charge (50% -> 40%), and darken color on light themes as yellow was almost invisible
|
||||
0.12: Use black flash instead of green fork to indicate charging
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "widbat",
|
||||
"name": "Battery Level Widget",
|
||||
"version": "0.11",
|
||||
"version": "0.12",
|
||||
"description": "Show the current battery level and charging status in the top right of the clock",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -26,16 +26,19 @@
|
|||
var s = 39;
|
||||
var x = this.x, y = this.y;
|
||||
g.reset();
|
||||
if (Bangle.isCharging()) {
|
||||
g.setColor("#0f0").drawImage(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
|
||||
x+=16;
|
||||
}
|
||||
g.setColor(g.theme.fg).fillRect(x,y+2,x+s-4,y+21).clearRect(x+2,y+4,x+s-6,y+19).fillRect(x+s-3,y+10,x+s,y+14);
|
||||
var battery = E.getBattery();
|
||||
if(battery < 20) {g.setColor("#f00");}
|
||||
else if (battery < 40) {g.setColor(g.theme.dark ? "#ff0" : "#f80");}
|
||||
else {g.setColor("#0f0");}
|
||||
g.fillRect(x+4,y+6,x+4+battery*(s-12)/100,y+17);
|
||||
if (Bangle.isCharging()) {
|
||||
let hy = y+11;
|
||||
let hx = x+s/2;
|
||||
let flash = [x+5,hy, hx-4,hy-1, hx,y+6, x+s-7,y+hy,
|
||||
hx+4,y+hy+1, hx,y+17];
|
||||
g.setColor(g.theme.fg).fillPoly(flash);
|
||||
}
|
||||
}};
|
||||
setWidth();
|
||||
})()
|
||||
|
|
Loading…
Reference in New Issue