widbatpc: Fix drawing the bar when charging
parent
a20a2e4292
commit
a44d542053
|
|
@ -872,7 +872,7 @@
|
||||||
"id": "widbatpc",
|
"id": "widbatpc",
|
||||||
"name": "Battery Level Widget (with percentage)",
|
"name": "Battery Level Widget (with percentage)",
|
||||||
"shortName": "Battery Widget",
|
"shortName": "Battery Widget",
|
||||||
"version": "0.13",
|
"version": "0.14",
|
||||||
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
|
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,4 @@
|
||||||
0.11: Don't overwrite existing settings on app update
|
0.11: Don't overwrite existing settings on app update
|
||||||
0.12: Fixed for Bangle 2
|
0.12: Fixed for Bangle 2
|
||||||
0.13: Fillbar setting added, see README
|
0.13: Fillbar setting added, see README
|
||||||
|
0.14: Fix drawing the bar when charging
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ Show the current battery level and charging status in the top right of the clock
|
||||||
Works with Bangle 1 and Bangle 2
|
Works with Bangle 1 and Bangle 2
|
||||||
|
|
||||||
When the fillbar setting is on the level colour will fill the entire
|
When the fillbar setting is on the level colour will fill the entire
|
||||||
bar. This makes for an easier to read dsiplay when the charge is
|
bar. This makes for an easier to read display when the charge is
|
||||||
below 50%.
|
below 50%.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
When the fillbar setting is off the level colour will follow the battry percentage
|
When the fillbar setting is off the level colour will follow the battery percentage
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,7 @@
|
||||||
// else...
|
// else...
|
||||||
var s = 39;
|
var s = 39;
|
||||||
var x = this.x, y = this.y;
|
var x = this.x, y = this.y;
|
||||||
const l = E.getBattery();
|
const l = E.getBattery(),
|
||||||
let xl = x+4+l*(s-12)/100;
|
|
||||||
|
|
||||||
// show bar full in the level color, as you cant see the color if the bar is too small
|
|
||||||
if (setting('fillbar'))
|
|
||||||
xl = x+4+100*(s-12)/100;
|
|
||||||
|
|
||||||
c = levelColor(l);
|
c = levelColor(l);
|
||||||
|
|
||||||
if (Bangle.isCharging() && setting('charger')) {
|
if (Bangle.isCharging() && setting('charger')) {
|
||||||
|
|
@ -93,6 +87,12 @@
|
||||||
"DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
|
"DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
|
||||||
x+=16;
|
x+=16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let xl = x+4+l*(s-12)/100;
|
||||||
|
// show bar full in the level color, as you can't see the color if the bar is too small
|
||||||
|
if (setting('fillbar'))
|
||||||
|
xl = x+4+100*(s-12)/100;
|
||||||
|
|
||||||
g.setColor(g.theme.fg);
|
g.setColor(g.theme.fg);
|
||||||
g.fillRect(x,y+2,x+s-4,y+21);
|
g.fillRect(x,y+2,x+s-4,y+21);
|
||||||
g.clearRect(x+2,y+4,x+s-6,y+19);
|
g.clearRect(x+2,y+4,x+s-6,y+19);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue