forked from FOSS/BangleApps
Simple Pedometer and Lato Pedometer widgets, fix size after step count reset
parent
b96f9bf7e8
commit
d77403162e
|
@ -5618,7 +5618,7 @@
|
|||
"shortName":"Simple Pedometer",
|
||||
"icon": "screenshot_widpa.png",
|
||||
"screenshots": [{"url":"screenshot_widpa.png"}],
|
||||
"version":"0.01",
|
||||
"version":"0.02",
|
||||
"type": "widget",
|
||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
|
@ -5634,7 +5634,7 @@
|
|||
"shortName":"Lato Pedometer",
|
||||
"icon": "screenshot_widpb.png",
|
||||
"screenshots": [{"url":"screenshot_widpb.png"}],
|
||||
"version":"0.01",
|
||||
"version":"0.02",
|
||||
"type": "widget",
|
||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.01: First release
|
||||
0.02: Size widget after step count is reset
|
||||
|
|
|
@ -6,7 +6,7 @@ WIDGETS["widpa"]={area:"tl",width:13,draw:function() {
|
|||
if (!Bangle.isLCDOn()) return; // dont redraw if LCD is off
|
||||
var steps = Bangle.getHealthStatus("day").steps;
|
||||
var w = 1 + (steps.toString().length)*12;
|
||||
if (w > this.width) {this.width = w; setTimeout(() => Bangle.drawWidgets(),10); return;}
|
||||
if (w != this.width) {this.width = w; setTimeout(() => Bangle.drawWidgets(),10); return;}
|
||||
g.reset();
|
||||
g.setColor(g.theme.bg);
|
||||
g.fillRect(this.x, this.y, this.x + this.width, this.y + 23);
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
0.01: First release
|
||||
0.02: Fixed widget id to wibpb, Size widget after step count is reset
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// on.step version
|
||||
Bangle.on('step', function(s) { WIDGETS["bata"].draw(); });
|
||||
Bangle.on('lcdPower', function(on) {
|
||||
if (on) WIDGETS["bata"].draw();
|
||||
if (on) WIDGETS["widpb"].draw();
|
||||
});
|
||||
WIDGETS["bata"]={area:"tl",width:13,draw:function() {
|
||||
WIDGETS["widpb"]={area:"tl",width:13,draw:function() {
|
||||
if (!Bangle.isLCDOn()) return; // dont redraw if LCD is off
|
||||
var steps = Bangle.getHealthStatus("day").steps;
|
||||
var w = 1 + (steps.toString().length)*12;
|
||||
if (w > this.width) {this.width = w; setTimeout(() => Bangle.drawWidgets(),10); return;}
|
||||
if (w != this.width) {this.width = w; setTimeout(() => Bangle.drawWidgets(),10); return;}
|
||||
g.reset();
|
||||
g.setColor(g.theme.bg);
|
||||
g.fillRect(this.x, this.y, this.x + this.width, this.y + 23); // erase background
|
||||
|
|
Loading…
Reference in New Issue