Merge branch 'master' of https://github.com/lightnin/BangleApps into lightnin-master

pull/318/head^2
Gordon Williams 2020-04-20 09:19:47 +01:00
commit 5182cb5aab
3 changed files with 20 additions and 6 deletions

View File

@ -11,6 +11,7 @@
'color': COLORS[0],
'percentage': true,
'charger': true,
'hideifmorethan20pct': false,
}
// ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings
@ -51,8 +52,13 @@
const newIndex = (oldIndex + 1) % COLORS.length
s.color = COLORS[newIndex]
save('color')(s.color)
},
},
}
}
},
'Hide when \> 20\%': {
value: s.hideifmorethan20pct,
format: onOffFormat,
onchange: save('hideifmorethan20pct'),
},
}
E.showMenu(menu)
})

View File

@ -0,0 +1 @@
{"color":"By Level","percentage":true,"charger":true,"hideifmorethan20pct":false}

View File

@ -3,6 +3,7 @@ const DEFAULTS = {
'color': 'By Level',
'percentage': true,
'charger': true,
'hideifmorethan20pct': false,
}
const COLORS = {
'white': -1,
@ -53,8 +54,16 @@ function setWidth() {
}
}
function draw() {
var s = 39;
var x = this.x, y = this.y;
const l = E.getBattery(),
c = levelColor(l);
const xl = x+4+l*(s-12)/100
if(!Bangle.isCharging() && setting('hideifmorethan20pct') && l > 20){
return;}
if (Bangle.isCharging() && setting('charger')) {
g.setColor(chargerColor()).drawImage(atob(
"DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"),x,y);
@ -64,9 +73,7 @@ function draw() {
g.fillRect(x,y+2,x+s-4,y+21);
g.clearRect(x+2,y+4,x+s-6,y+19);
g.fillRect(x+s-3,y+10,x+s,y+14);
const l = E.getBattery(),
c = levelColor(l);
const xl = x+4+l*(s-12)/100
g.setColor(c).fillRect(x+4,y+6,xl,y+17);
g.setColor(-1);
if (!setting('percentage')) {