mirror of https://github.com/espruino/BangleApps
Add clock info clock widget
parent
c7efd4fc10
commit
62686795a5
|
@ -0,0 +1 @@
|
||||||
|
0.01: New App!
|
Binary file not shown.
After Width: | Height: | Size: 929 B |
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
})
|
|
@ -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 |
|
@ -1,3 +1,4 @@
|
||||||
0.01: New Widget!
|
0.01: New Widget!
|
||||||
0.02: Now use an app ID (to avoid conflicts with clocks that also use ClockInfo)
|
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.03: Fix widget clearing too far down
|
||||||
|
0.04: If a small font is needed, use 6x8 but twice as high
|
|
@ -1,6 +1,6 @@
|
||||||
{ "id": "widclkinfo",
|
{ "id": "widclkinfo",
|
||||||
"name": "Clock Info Widget",
|
"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.",
|
"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",
|
"icon": "widget.png",
|
||||||
"screenshots" : [ { "url":"screenshot.png" }],
|
"screenshots" : [ { "url":"screenshot.png" }],
|
||||||
|
|
|
@ -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);
|
var availableWidth = o.x+clockInfoMenu.w - (x+2);
|
||||||
g.setFont("6x8:2").setFontAlign(-1,0);
|
g.setFont("6x8:2").setFontAlign(-1,0);
|
||||||
if (g.stringWidth(clockInfoInfo.text) > availableWidth)
|
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
|
g.drawString(clockInfoInfo.text, x+2,o.y+12); // draw the text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue