widpedom - added option to show steps in larger 6x8x2 font
parent
760840db2e
commit
1503da2df2
|
|
@ -1183,7 +1183,7 @@
|
||||||
{ "id": "widpedom",
|
{ "id": "widpedom",
|
||||||
"name": "Pedometer widget",
|
"name": "Pedometer widget",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"version":"0.15",
|
"version":"0.16",
|
||||||
"description": "Daily pedometer widget",
|
"description": "Daily pedometer widget",
|
||||||
"tags": "widget,b2",
|
"tags": "widget,b2",
|
||||||
"type":"widget",
|
"type":"widget",
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,4 @@
|
||||||
0.13: Now use system color theme
|
0.13: Now use system color theme
|
||||||
0.14: Improve memory usage
|
0.14: Improve memory usage
|
||||||
0.15: Settings option to hide the widget icon
|
0.15: Settings option to hide the widget icon
|
||||||
|
0.16: Settings option to show large digits in widget area
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
let s = {
|
let s = {
|
||||||
'goal': 10000,
|
'goal': 10000,
|
||||||
'progress': false,
|
'progress': false,
|
||||||
|
'large': false,
|
||||||
'hide': false
|
'hide': false
|
||||||
}
|
}
|
||||||
// ...and overwrite them with any saved values
|
// ...and overwrite them with any saved values
|
||||||
|
|
@ -42,6 +43,14 @@
|
||||||
save()
|
save()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'Large Digits': {
|
||||||
|
value: s.large,
|
||||||
|
format: () => (s.large ? 'Yes' : 'No'),
|
||||||
|
onchange: () => {
|
||||||
|
s.large = !s.large
|
||||||
|
save()
|
||||||
|
},
|
||||||
|
},
|
||||||
'Hide Widget': {
|
'Hide Widget': {
|
||||||
value: s.hide,
|
value: s.hide,
|
||||||
format: () => (s.hide ? 'Yes' : 'No'),
|
format: () => (s.hide ? 'Yes' : 'No'),
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
const DEFAULTS = {
|
const DEFAULTS = {
|
||||||
'goal': 10000,
|
'goal': 10000,
|
||||||
'progress': false,
|
'progress': false,
|
||||||
|
'large': false,
|
||||||
'hide': false
|
'hide': false
|
||||||
}
|
}
|
||||||
return (key in settings) ? settings[key] : DEFAULTS[key];
|
return (key in settings) ? settings[key] : DEFAULTS[key];
|
||||||
|
|
@ -48,6 +49,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// show the step count in the widget area in a readable sized font
|
||||||
|
function draw_large(st) {
|
||||||
|
var width = 12 * st.length;
|
||||||
|
g.reset();
|
||||||
|
g.clearRect(this.x, this.y, this.x + width, this.y + 16); // erase background
|
||||||
|
g.setColor(g.theme.fg);
|
||||||
|
g.setFont("6x8",2);
|
||||||
|
g.setFontAlign(-1, -1);
|
||||||
|
g.drawString(st, this.x + 4, this.y + 2);
|
||||||
|
}
|
||||||
|
|
||||||
// draw your widget
|
// draw your widget
|
||||||
function draw() {
|
function draw() {
|
||||||
if (setting('hide')) return;
|
if (setting('hide')) return;
|
||||||
|
|
@ -56,6 +68,10 @@
|
||||||
stp_today = stp_today % 100000; // cap to five digits + comma = 6 characters
|
stp_today = stp_today % 100000; // cap to five digits + comma = 6 characters
|
||||||
}
|
}
|
||||||
let stps = stp_today.toString();
|
let stps = stp_today.toString();
|
||||||
|
if (setting('large')) {
|
||||||
|
draw_large.call(this, stps);
|
||||||
|
return;
|
||||||
|
}
|
||||||
g.reset().clearRect(this.x, this.y, this.x + width, this.y + 23); // erase background
|
g.reset().clearRect(this.x, this.y, this.x + width, this.y + 23); // erase background
|
||||||
if (setting('progress')){ drawProgress.call(this, stps); }
|
if (setting('progress')){ drawProgress.call(this, stps); }
|
||||||
g.setColor(g.theme.fg);
|
g.setColor(g.theme.fg);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue