Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContourClock 0.31 #3008

Merged
merged 6 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/contourclock/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
0.28: More config options for cleaner look, enabled fast loading
0.29: Fixed a bug that would leave old font files in storage.
0.30: Added options to show widgets and date on twist and tap. New fonts.
0.31: Bugfix, no more freeze.
23 changes: 15 additions & 8 deletions apps/contourclock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@
}
let showExtras = function() { //show extras for a limited time
drawExtras();
if (extrasTimeout) clearTimeout(extrasTimeout);
//if (extrasTimeout) clearTimeout(extrasTimeout);
gfwilliams marked this conversation as resolved.
Show resolved Hide resolved
extrasTimeout = setTimeout(() => {
extrasTimeout = undefined;
hideExtras();
}, 5000);
extrasShown = false;
};
let drawExtras = function() { //draw date, day of the week and widgets
let date = new Date();
g.reset();
g.clearRect(0, 138, g.getWidth() - 1, 176);
g.setFont("Teletext10x18Ascii").setFontAlign(0, 1);
if (settings.weekday) g.drawString(require("locale").dow(date).toUpperCase(), g.getWidth() / 2, g.getHeight() - 18);
if (settings.date) g.drawString(require('locale').date(date, 1), g.getWidth() / 2, g.getHeight());
Expand All @@ -45,21 +48,23 @@
};
let hideExtras = function() {
if (extrasTimeout) clearTimeout(extrasTimeout);
extrasTimeout = undefined; //NEW
g.reset();
g.clearRect(0, 138, g.getWidth() - 1, 176);
require("widget_utils").hide();
extrasShown = false;
extrasShown = false; ///NEW
};
let draw = function() {
if (drawTimeout) clearTimeout(drawTimeout); //NEW
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
let date = new Date();
g.reset();
if (extrasShown) drawExtras();
else hideExtras();
require('contourclock').drawClock(settings.fontIndex);
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
};
if (settings.hideWhenLocked) {
onLock = locked => {
Expand All @@ -83,6 +88,8 @@
Bangle.removeListener('twist', showExtras);
if (drawTimeout) clearTimeout(drawTimeout);
if (extrasTimeout) clearTimeout(extrasTimeout);
drawTimeout = undefined;
extrasTimeout = undefined;
if (settings.hideWhenLocked) require("widget_utils").show();
g.reset();
g.clear();
Expand All @@ -91,7 +98,7 @@
g.clear();
if (settings.widgets) {
Bangle.loadWidgets();
Bangle.drawWidgets();
setTimeout(Bangle.drawWidgets,0); //NEW
}
draw();
}
2 changes: 1 addition & 1 deletion apps/contourclock/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "id": "contourclock",
"name": "Contour Clock",
"shortName" : "Contour Clock",
"version":"0.30",
"version":"0.31",
"icon": "app.png",
"readme": "README.md",
"description": "A Minimalist clockface with large Digits.",
Expand Down