Merge pull request #3382 from jt-nti/thunder-themes

thunder: show lightning image in dark themes
pull/3387/head
Rob Pilling 2024-04-26 23:00:21 +01:00 committed by GitHub
commit e9d99a21ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 11 deletions

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Use locale module to display distance
0.03: Fix lightning image and flash button

View File

@ -22,7 +22,7 @@ var layout = new Layout( {
{type:"txt", pad:8, font:"20%", label:"", id:"distance", fillx:1},
{type:"h", c: [
{type:"btn", font:"6x8:2", label:"Flash", cb: l=>flash() },
{type:"img", pad:4, src:require("heatshrink").decompress(atob("h0awkBiMQBAQFBAxwdDAoIGKCYQGGFBQTCAyIAPgIGGIAoFCAxITDAxIFDAxATEJwIMEAw4TEAwo")) },
{type:"img", pad:4, src:atob("DhoBH+B/gf4P8D/A/gP4H+B/AfwH8B//////7/+A/APwD4A+APADwA4AcAHABgAYAA==") },
{type:"btn", font:"6x8:2", label:"Boom", cb: l=>boom() }
]},
]
@ -79,21 +79,27 @@ const renderIntervalCallback = function() {
updateTimeAndDistance();
};
const flash = function() {
Bangle.buzz(50, 0.5);
startTime = startTime = Date.now();
updateTimeAndDistance();
renderIntervalId = setInterval(renderIntervalCallback, 100);
};
const boom = function() {
const flashAndBoom = function() {
Bangle.buzz(50, 0.5);
if (renderIntervalId !== undefined) {
clearInterval(renderIntervalId);
renderIntervalId = undefined;
}
};
const flash = function() {
flashAndBoom();
startTime = undefined;
updateTimeAndDistance();
startTime = Date.now();
renderIntervalId = setInterval(renderIntervalCallback, 100);
};
const boom = function() {
flashAndBoom();
updateTimeAndDistance();
startTime = undefined;

View File

@ -1,7 +1,7 @@
{ "id": "thunder",
"name": "Come on Thunder",
"shortName":"Thunder",
"version":"0.02",
"version":"0.03",
"description": "Simple timer to calculate how far away lightning is",
"icon": "app.png",
"tags": "tool,weather",