Add clock info clock widget

pull/3119/head
Gordon Williams 2023-11-24 16:46:22 +00:00
parent c7efd4fc10
commit 62686795a5
8 changed files with 45 additions and 3 deletions

View File

@ -0,0 +1 @@
0.01: New App!

BIN
apps/clkinfoclk/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

View File

@ -0,0 +1,27 @@
(function() {
return {
name: "Bangle",
items: [
{ name : "Clock",
get : () => {
return {
text : require("locale").time(new Date(),1),
img : atob("FhaBAAAAAAPwAD/wA8DwHADgYMGDAwMMDAxgMBmAwGYDAZgOBmAcGYA4YwBjDAAMGABgcAOA8DwA/8AA/AAAAAA=")
};
},
show : function() {
this.interval = setTimeout(()=>{
this.emit("redraw");
this.interval = setInterval(()=>{
this.emit("redraw");
}, 60000);
}, 60000 - (Date.now() % 60000));
},
hide : function() {
clearInterval(this.interval);
this.interval = undefined;
}
}
]
};
})

View File

@ -0,0 +1,13 @@
{ "id": "clkinfoclk",
"name": "Clockinfo Clock",
"version":"0.01",
"description": "This displays a clock *inside* a ClockInfo. This can be really handy for the [Clock Info Widget](https://banglejs.com/apps/?id=widclkinfo) where you might want the option to show a clock in the top bar of a non-clock app.",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clkinfo",
"tags": "clkinfo",
"supports" : ["BANGLEJS2"],
"storage": [
{"name":"clkinfoclk.clkinfo.js","url":"clkinfo.js"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,3 +1,4 @@
0.01: New Widget!
0.02: Now use an app ID (to avoid conflicts with clocks that also use ClockInfo)
0.03: Fix widget clearing too far down
0.04: If a small font is needed, use 6x8 but twice as high

View File

@ -1,6 +1,6 @@
{ "id": "widclkinfo",
"name": "Clock Info Widget",
"version":"0.03",
"version":"0.04",
"description": "Use 'Clock Info' in the Widget bar. Tap on the widget to select, then drag up/down/left/right to choose what information is displayed.",
"icon": "widget.png",
"screenshots" : [ { "url":"screenshot.png" }],

View File

@ -42,7 +42,7 @@ if (!require("clock_info").loadCount) { // don't load if a clock_info was alread
var availableWidth = o.x+clockInfoMenu.w - (x+2);
g.setFont("6x8:2").setFontAlign(-1,0);
if (g.stringWidth(clockInfoInfo.text) > availableWidth)
g.setFont("6x8");
g.setFont("6x8:1x2");
g.drawString(clockInfoInfo.text, x+2,o.y+12); // draw the text
}
}