diff --git a/apps/drained/ChangeLog b/apps/drained/ChangeLog index 65c93e70f..3767ad71e 100644 --- a/apps/drained/ChangeLog +++ b/apps/drained/ChangeLog @@ -4,3 +4,4 @@ Also avoid polluting global scope. 0.04: Enhance menu: enable bluetooth, visit settings & visit recovery 0.05: Enhance menu: permit toggling bluetooth +0.06: Display clock in green when charging, with "charging" text diff --git a/apps/drained/app.js b/apps/drained/app.js index c74affea3..deafe7d68 100644 --- a/apps/drained/app.js +++ b/apps/drained/app.js @@ -37,14 +37,19 @@ var draw = function () { require("locale").dow(date, 0).toUpperCase(); var x2 = x + 6; var y2 = y + 66; + var charging = Bangle.isCharging(); g.reset() .clearRect(Bangle.appRect) .setFont("Vector", 55) .setFontAlign(0, 0) + .setColor(charging ? "#0f0" : g.theme.fg) .drawString(timeStr, x, y) .setFont("Vector", 24) - .drawString(dateStr, x2, y2) - .drawString("".concat(E.getBattery(), "%"), x2, y2 + 48); + .drawString(dateStr, x2, y2); + if (charging) + g.drawString("charging: ".concat(E.getBattery(), "%"), x2, y2 + 48); + else + g.drawString("".concat(E.getBattery(), "%"), x2, y2 + 48); if (nextDraw) clearTimeout(nextDraw); nextDraw = setTimeout(function () { @@ -96,8 +101,10 @@ function drainedRestore() { load(); } var checkCharge = function () { - if (E.getBattery() < restore) + if (E.getBattery() < restore) { + draw(); return; + } drainedRestore(); }; if (Bangle.isCharging()) diff --git a/apps/drained/app.ts b/apps/drained/app.ts index de6114f99..a779a8660 100644 --- a/apps/drained/app.ts +++ b/apps/drained/app.ts @@ -54,15 +54,21 @@ const draw = () => { require("locale").dow(date, 0).toUpperCase(); const x2 = x + 6; const y2 = y + 66; + const charging = Bangle.isCharging(); g.reset() .clearRect(Bangle.appRect) .setFont("Vector", 55) .setFontAlign(0, 0) + .setColor(charging ? "#0f0" : g.theme.fg) .drawString(timeStr, x, y) .setFont("Vector", 24) - .drawString(dateStr, x2, y2) - .drawString(`${E.getBattery()}%`, x2, y2 + 48); + .drawString(dateStr, x2, y2); + + if(charging) + g.drawString(`charging: ${E.getBattery()}%`, x2, y2 + 48); + else + g.drawString(`${E.getBattery()}%`, x2, y2 + 48); if(nextDraw) clearTimeout(nextDraw); nextDraw = setTimeout(() => { @@ -125,7 +131,10 @@ function drainedRestore() { // "public", to allow users to call } const checkCharge = () => { - if(E.getBattery() < restore) return; + if(E.getBattery() < restore) { + draw(); + return; + } drainedRestore(); }; diff --git a/apps/drained/metadata.json b/apps/drained/metadata.json index 115289d09..a5389a91b 100644 --- a/apps/drained/metadata.json +++ b/apps/drained/metadata.json @@ -1,7 +1,7 @@ { "id": "drained", "name": "Drained", - "version": "0.05", + "version": "0.06", "description": "Switches to displaying a simple clock when the battery percentage is low, and disables some peripherals", "readme": "README.md", "icon": "icon.png",