Skip to content

Commit 9028b6d

Browse files
authored
Merge pull request #4040 from chuckwagoncomputing/clockinfo-list
New App: Clockinfo list
2 parents 4528581 + fe3425b commit 9028b6d

File tree

8 files changed

+72
-0
lines changed

8 files changed

+72
-0
lines changed

apps/clockinfolist/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Clockinfo List
2+
==============
3+
4+
Lists available clockinfo modules by name

apps/clockinfolist/app-icon.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/clockinfolist/app.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Bangle.loadWidgets();
2+
Bangle.drawWidgets();
3+
4+
var menu = {
5+
"": {
6+
title: "Clockinfo List",
7+
back: function() { load(); },
8+
}
9+
}
10+
11+
function showItem(item, menu) {
12+
console.log(JSON.stringify(item));
13+
E.showPrompt(item.get().text, {
14+
title: item.name,
15+
buttons: { "Back": false, "Run": true },
16+
img: item.get().img
17+
}).then((v) => {
18+
if (v) {
19+
item.run();
20+
showItem(item, menu);
21+
} else {
22+
E.showMenu(menu);
23+
}
24+
});
25+
}
26+
27+
var ci = require("clock_info").load()
28+
for (let i = 0; i < ci.length; i++) {
29+
let n = ci[i].name;
30+
menu[n] = function(n, i) {
31+
let ci_s = ci[i].items;
32+
let menu_s = {}
33+
for (let ii = 0; ii < ci_s.length; ii++) {
34+
let i_s = ci_s[ii];
35+
menu_s[i_s.name] = showItem.bind(null, i_s, menu_s)
36+
}
37+
menu_s[""] = {
38+
back: function() { E.showMenu(menu); },
39+
title: n
40+
};
41+
E.showMenu(menu_s)
42+
}.bind(null, n, i);
43+
}
44+
E.showMenu(menu)

apps/clockinfolist/app.png

878 Bytes
Loading

apps/clockinfolist/metadata.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": "clockinfolist",
3+
"name": "Clockinfo List",
4+
"shortName": "ClockinfoList",
5+
"version": "0.01",
6+
"type": "app",
7+
"description": "List Available Clockinfo Modules",
8+
"icon": "app.png",
9+
"screenshots": [
10+
{"url":"scr1.png"},
11+
{"url":"scr2.png"},
12+
{"url":"scr3.png"}
13+
],
14+
"allow_emulator": true,
15+
"tags": "tool,clkinfo",
16+
"supports": ["BANGLEJS", "BANGLEJS2"],
17+
"readme": "README.md",
18+
"storage": [
19+
{ "name": "clockinfolist.app.js", "url": "app.js" },
20+
{ "name": "clockinfolist.img", "url": "app-icon.js", "evaluate": true }
21+
],
22+
"dependencies" : { "clock_info":"module" }
23+
}

apps/clockinfolist/scr1.png

6.19 KB
Loading

apps/clockinfolist/scr2.png

5.74 KB
Loading

apps/clockinfolist/scr3.png

4.18 KB
Loading

0 commit comments

Comments
 (0)