Widbatpc: added option to fillbar with level color, see README for screenshots

master
hughbarney 2021-10-11 14:31:10 +01:00
parent e6d4573f70
commit b2d389d56e
8 changed files with 23 additions and 3 deletions

View File

@ -653,7 +653,7 @@
"name": "Battery Level Widget (with percentage)", "name": "Battery Level Widget (with percentage)",
"shortName": "Battery Widget", "shortName": "Battery Widget",
"icon": "widget.png", "icon": "widget.png",
"version":"0.12", "version":"0.13",
"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",
"tags": "widget,battery,b2", "tags": "widget,battery,b2",
"type":"widget", "type":"widget",

View File

@ -9,3 +9,4 @@
0.10: Add 'hide if charge greater than' 0.10: Add 'hide if charge greater than'
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

View File

@ -4,5 +4,13 @@ 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
![](screenshot.jpg) 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
below 50%.
![](widbatpc.full.jpg)
When the fillbar setting is off the level colour will follow the battry percentage
![](widbatpc.part.jpg)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -10,6 +10,7 @@
let s = { let s = {
'color': COLORS[0], 'color': COLORS[0],
'percentage': true, 'percentage': true,
'fillbar': false,
'charger': true, 'charger': true,
'hideifmorethan': 100, 'hideifmorethan': 100,
} }
@ -54,6 +55,11 @@
save('color')(s.color) save('color')(s.color)
} }
}, },
'Fill Bar': {
value: s.fillbar,
format: onOffFormat,
onchange: save('fillbar'),
},
'Hide if >': { 'Hide if >': {
value: s.hideifmorethan||100, value: s.hideifmorethan||100,
min: 10, min: 10,

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -80,7 +80,12 @@
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();
const xl = x+4+l*(s-12)/100 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')) {