Merge pull request #1988 from blogmywiki/master

[new app] MacWatch
pull/1999/head^2
Gordon Williams 2022-06-27 12:17:44 +01:00 committed by GitHub
commit b4bce45449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 203 additions and 0 deletions

1
apps/macwatch/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: Created my first BangleJS app!

26
apps/macwatch/README.md Normal file
View File

@ -0,0 +1,26 @@
# MacWatch
A very simple clock using big numbers in the original Macintosh Chicago font.
Touch the screen to show the date in numerical format.
Touch the screen again to revert to the time.
Time updates every 15 seconds.
## In dark mode
![](screenshot-dark-time.png)
![](screenshot-dark-date.png)
## In light mode
![](screenshot-light-time.png)
![](screenshot-light-date.png)
## The watch in use
![](photo-watch-in-use.jpg)
## Creator
Written by Giles Booth | [twitter](https://twitter.com/blogmywiki) | [blog](http://www.suppertime.co.uk/blogmywiki/)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwkBIf4AOh//AggADC8YRCBIwXlI4oX/C5QWOC74WPC/4X/C6AA/AH4AmXwK5DAobBNC60P+DqHFxwXWCJAWRC44vUPwouRJKQXWBxAXlOAIgQbBDeLFxAXXAAa/RC64A/AH4AKA=="))

54
apps/macwatch/app.js Normal file
View File

@ -0,0 +1,54 @@
var font = atob("f3/gMB/7+AAAACA///AAAAAAQcHhsZ+LhAAAgUhsPh38eAAADAoJCI///BAA8XhkMhn8eAAAPz/0Mhn4eAAAgEAh8f+HgAAAb3/kMh/7eAAAeH5hML/z8AAAAAADYbAAAAAA");
function draw() {
g.reset();
g.setFontCustom(font, 48, 8, 1801);
g.setFontAlign(0, -1, 0);
if (showDate) {
if (g.theme.dark) {
g.setColor("#00ffff"); // cyan date numbers for dark mode
}
else {
g.setColor("#0000ff"); // blue date numbers for light mode
}
line1 = ("0"+(new Date()).getDate()).substr(-2);
line2 = ("0"+((new Date()).getMonth()+1)).substr(-2);
}
else {
if (g.theme.dark) {
g.setColor(1,1,1); // white time numbers for dark mode
}
else {
g.setColor(0); // black time numbers for light mode
}
var d = new Date();
var da = d.toString().split(" ");
line1 = da[4].substr(0,2);
line2 = da[4].substr(3,2);
}
g.drawString(line1, 95, 30, true);
g.drawString(line2, 95, 106, true);
}
// handle switch display on by pressing BTN1
Bangle.on('lcdPower', function(on) {
if (on) draw();
});
Bangle.on('touch', function(on) {
if (on) {
showDate = !showDate; // toggle date mode on and off
draw();
}
});
g.clear();
var showDate = 0;
setInterval(draw, 15000); // refresh display every 15s
draw();
// Show launcher when button pressed
Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();

BIN
apps/macwatch/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

View File

@ -0,0 +1,17 @@
{ "id": "macwatch",
"name": "MacWatch",
"shortName":"MacWatch",
"icon": "app.png",
"version":"0.01",
"description": "Simple clock with classic Mac font",
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"screenshots": [{"url":"screenshot-dark-date.png"}],
"readme": "README.md",
"allow_emulator": true,
"storage": [
{"name":"macwatch.app.js","url":"app.js"},
{"name":"macwatch.img","url":"app-icon.js","evaluate":true}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

3
apps/macwatch2/ChangeLog Normal file
View File

@ -0,0 +1,3 @@
0.01: Created first version of the app with numeric date, only works in light mode
0.02: New icon, shimmied date right a bit
0.03: Incorporated improvements from Peer David for accuracy, fix dark mode, widgets run in background

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

19
apps/macwatch2/README.md Normal file
View File

@ -0,0 +1,19 @@
# MacWatch2
A clock inspired by Susan Kare's original 1984 Macintosh desktop design.
Ideas for development:
- [x] fix dark mode either by forcing black on white or doing proper inverse display and text
- [] date in text format
- [] tap to load different info in window
- [] unlock to show seconds, perhaps flip time and date?
- [] incorporate widgets somehow either by leaving space or adding Chicago font widgets of my own in top bar
![](screenshot.png)
![](IMG_3782%20crop.JPG)
## Creator
Written by Giles Booth | [twitter](https://twitter.com/blogmywiki) | [blog](http://www.suppertime.co.uk/blogmywiki/)
Improvements for accuracy, dark mode and widgets running in background by [Peer David](https://gist.github.com/peerdavid)

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwgn/AH4A/AH4AfdIoX/C/4X4CIwYQC6wPIDBwX/C6IYNC7TVFC9IEFO6YX/VBQWPC7CmDVIoX/C/4X2AH4A/ADwA=="))

64
apps/macwatch2/app.js Normal file
View File

@ -0,0 +1,64 @@
// 68k Mac Finder desktop themed clock
// by Giles Booth @blogmywiki
// improvements by Peer David
var img = require("heatshrink").decompress(atob("2GwgP4C6cf8AVTg/ACqcDwADBDCMBCoICCCqACEj8zAwXwmcYgEGswYHhxwBjEDGocwCoVgQxHwCoMzjwVBwPzngrCnlmDAsfNoIVBIQMBwZBEAAIVIjwVD8YVNIIc/FY9+CpcwCo9gCo0PQYUzmIVGo1is1ACokGNoaDC+PzhkAg+Gnl/aiIA/AD//AClVACmqACgr/Fd2vVqP+FYNUbKMNFYOsCqMOFa+t/f/35LC/AODK43uFYUCgGACAUB/IFDFZP6gArEsArTgFhz9w+ArRsOZzOYFaQVCFan4FaiFHFZuIFaeYQZbbVf5LbK1gVRhwrX15MGABX+K/4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Ff4r/Fe+v/4AQ/wrBq4VR/orBAClVACgr/Ff4r/AAmr6or/q/6Fae/A="));
var font = atob("f3/gMB/7+AAAACA///AAAAAAQcHhsZ+LhAAAgUhsPh38eAAADAoJCI///BAA8XhkMhn8eAAAPz/0Mhn4eAAAgEAh8f+HgAAAb3/kMh/7eAAAeH5hML/z8AAAAAADYbAAAAAA");
var drawTimeout;
// schedule a draw for the next minute
function queueDraw() {
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
}
function draw() {
queueDraw();
// Fix theme to "light"
g.setTheme({bg:"#fff", fg:"#000", dark:false}).clear();
g.reset();
g.drawImage(img,0,0);
g.setFontCustom(font, 48, 8, 1033);
g.setFontAlign(0, -1, 0);
g.setColor(0,0,0);
var d = new Date();
var da = d.toString().split(" ");
hh = da[4].substr(0,2);
mi = da[4].substr(3,2);
dd = ("0"+(new Date()).getDate()).substr(-2);
mo = ("0"+((new Date()).getMonth()+1)).substr(-2);
yy = ("0"+((new Date()).getFullYear())).substr(-2);
g.drawString(hh, 52, 65, true);
g.drawString(mi, 132, 65, true);
g.drawString(':', 93,65);
g.setFontCustom(font, 48, 8, 521);
g.drawString(dd + ':' + mo + ':' + yy, 88, 120, true);
// Hide widgets
for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
}
// handle switch display on by pressing BTN1
Bangle.on('lcdPower',on=>{
if (on) {
draw(); // draw immediately, queue redraw
} else { // stop draw timer
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
}
});
// Load widgets but hide them
Bangle.loadWidgets();
draw();
Bangle.setUI("clock");

BIN
apps/macwatch2/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

View File

@ -0,0 +1,17 @@
{ "id": "macwatch2",
"name": "MacWatch2",
"shortName":"MacWatch2",
"icon": "app.png",
"version":"0.03",
"description": "Classic Mac Finder clock",
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"screenshots": [{"url":"screenshot.png"}],
"readme": "README.md",
"allow_emulator": true,
"storage": [
{"name":"macwatch2.app.js","url":"app.js"},
{"name":"macwatch2.img","url":"app-icon.js","evaluate":true}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB