Skip to content

Commit 0f31281

Browse files
author
thyttan
committed
bigclkinfo: new app - one fullscreen clock info
1 parent 0cee7cd commit 0f31281

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed

apps/bigclkinfo/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: New Clock!

apps/bigclkinfo/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Big Clock Info app
2+
3+
For die hard clock info fans...
4+
5+
## Features
6+
7+
All the clock infos you have installed displayed full screen.
8+
9+
## Controls
10+
11+
Interact with it like one big clock info, which it is!
12+
13+
## Settings
14+
15+
TBA: Should the app be treated as a clock face app?
16+
17+
## Requests
18+
19+
Open an issue on the espruino/BangleApps issue tracker mentioning @thyttan.
20+
21+
## Creator
22+
23+
thyttan

apps/bigclkinfo/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/bigclkinfo/app.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// TODO:
2+
// Add setting to decide if the app shoud set Bangle.CLOCK=1 ?
3+
// Make an updating analog clock info entry to use as start card. (update clkinfoclk or make a new one?)
4+
5+
Bangle.CLOCK = 1; // TODO: make optional.
6+
7+
// Load the clock infos
8+
let clockInfoItems = require("clock_info").load();
9+
// Add the
10+
let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, {
11+
// Add the dimensions we're rendering to here - these are used to detect taps on the clock info area
12+
x : 0, y: 0, w: Bangle.appRect.w, h: Bangle.appRect.h,
13+
// You can add other information here you want to be passed into 'options' in 'draw'
14+
// This function draws the info
15+
draw : (itm, info, options) => {
16+
// itm: the item containing name/hasRange/etc
17+
// info: data returned from itm.get() containing text/img/etc
18+
// options: options passed into addInteractive
19+
// Clear the background
20+
g.reset().clearRect(options.x, options.y, options.x+options.w-2, options.y+options.h-1);
21+
// indicate focus - we're using a border, but you could change color?
22+
if (options.focus) g.drawRect(options.x, options.y, options.x+options.w-2, options.y+options.h-1); // show if focused
23+
// we're drawing center-aligned here
24+
var midx = options.x+options.w/2;
25+
let scale = 5;
26+
if (info.img) g.drawImage(info.img, midx-12*scale,options.y+4, {scale:scale}); // draw the image
27+
g.setFont("6x8:2").setFontAlign(0,1).drawString(info.text, midx,options.y+160); // draw the text
28+
}
29+
});
30+
clockInfoMenu.menuA = 0;
31+
clockInfoMenu.menuB = 6; // Assume clkinfoclk is at indices (0,6)
32+
clockInfoMenu.redraw();

apps/bigclkinfo/icon.png

1.06 KB
Loading

apps/bigclkinfo/metadata.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{ "id": "bigclkinfo",
2+
"name": "Big clock info app",
3+
"shortName":"Big clkinfo",
4+
"version":"0.01",
5+
"author": "thyttan",
6+
"description": "One single big clock info. Full screen.",
7+
"icon": "icon.png",
8+
"screenshots": [{"url":"screenshot.png"}],
9+
"type": "clock",
10+
"tags": "clock, clkinfo, clk_info",
11+
"supports" : ["BANGLEJS2"],
12+
"readme": "README.md",
13+
"dependencies" : { "clock_info":"module",
14+
"clkinfoclk":"app" },
15+
"storage": [
16+
{"name":"bigclkinfo.app.js","url":"app.js"},
17+
{"name":"bigclkinfo.img","url":"app-icon.js","evaluate":true}
18+
]
19+
}

0 commit comments

Comments
 (0)