Skip to content

Commit

Permalink
Add clock info clock widget
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Nov 24, 2023
1 parent c7efd4f commit 6268679
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/clkinfoclk/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01: New App!
Binary file added apps/clkinfoclk/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions apps/clkinfoclk/clkinfo.js
Original file line number Diff line number Diff line change
@@ -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;
}
}
]
};
})
13 changes: 13 additions & 0 deletions apps/clkinfoclk/metadata.json
Original file line number Diff line number Diff line change
@@ -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 added apps/clkinfoclk/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion apps/widclkinfo/ChangeLog
Original file line number Diff line number Diff line change
@@ -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.03: Fix widget clearing too far down
0.04: If a small font is needed, use 6x8 but twice as high
2 changes: 1 addition & 1 deletion apps/widclkinfo/metadata.json
Original file line number Diff line number Diff line change
@@ -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" }],
Expand Down
2 changes: 1 addition & 1 deletion apps/widclkinfo/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 6268679

Please sign in to comment.