From d77403162eede068575df81f45f7587f950eb6bb Mon Sep 17 00:00:00 2001 From: hughbarney Date: Thu, 13 Jan 2022 18:58:22 +0000 Subject: [PATCH 1/2] Simple Pedometer and Lato Pedometer widgets, fix size after step count reset --- apps.json | 4 ++-- apps/widpa/ChangeLog | 1 + apps/widpa/widpa.wid.js | 2 +- apps/widpb/ChangeLog | 1 + apps/widpb/widpb.wid.js | 6 +++--- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps.json b/apps.json index f28766ab5..b837b8f2b 100644 --- a/apps.json +++ b/apps.json @@ -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", diff --git a/apps/widpa/ChangeLog b/apps/widpa/ChangeLog index 7b83706bf..5197bb4bd 100644 --- a/apps/widpa/ChangeLog +++ b/apps/widpa/ChangeLog @@ -1 +1,2 @@ 0.01: First release +0.02: Size widget after step count is reset diff --git a/apps/widpa/widpa.wid.js b/apps/widpa/widpa.wid.js index b8c439d2b..1c0f27394 100644 --- a/apps/widpa/widpa.wid.js +++ b/apps/widpa/widpa.wid.js @@ -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); diff --git a/apps/widpb/ChangeLog b/apps/widpb/ChangeLog index 7b83706bf..1409a81ff 100644 --- a/apps/widpb/ChangeLog +++ b/apps/widpb/ChangeLog @@ -1 +1,2 @@ 0.01: First release +0.02: Fixed widget id to wibpb, Size widget after step count is reset diff --git a/apps/widpb/widpb.wid.js b/apps/widpb/widpb.wid.js index d65d7fe43..6129fac51 100644 --- a/apps/widpb/widpb.wid.js +++ b/apps/widpb/widpb.wid.js @@ -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 From b80909be9b6b9dc5ef039fd46512acfd5e3c44e7 Mon Sep 17 00:00:00 2001 From: hughbarney Date: Thu, 13 Jan 2022 19:24:57 +0000 Subject: [PATCH 2/2] Widlock: set sortorder -1 --- apps.json | 3 ++- apps/widlock/ChangeLog | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index b837b8f2b..65fe64ed3 100644 --- a/apps.json +++ b/apps.json @@ -942,12 +942,13 @@ { "id": "widlock", "name": "Lock Widget", - "version": "0.03", + "version": "0.04", "description": "On devices with always-on display (Bangle.js 2) this displays lock icon whenever the display is locked", "icon": "widget.png", "type": "widget", "tags": "widget,lock", "supports": ["BANGLEJS","BANGLEJS2"], + "sortorder": -1, "storage": [ {"name":"widlock.wid.js","url":"widget.js"} ] diff --git a/apps/widlock/ChangeLog b/apps/widlock/ChangeLog index 3b1436feb..8aeb75429 100644 --- a/apps/widlock/ChangeLog +++ b/apps/widlock/ChangeLog @@ -1,3 +1,4 @@ 0.01: First commit 0.02: Handle new firmwares with 'lock' event 0.03: Don't try to be fancy - just bail out on firmwares without a lock event +0.04: Set sortorder to -1 so that widget always takes up the furthest left position