mirror of https://github.com/espruino/BangleApps
Update mosaic clock for fast load and widget_utils
parent
739ffca92d
commit
1bcbd4f06c
|
@ -1,2 +1,3 @@
|
|||
0.01: First release
|
||||
0.02: Use locale time
|
||||
0.03: Change for fast loading, use widget_utils to hide widgets
|
|
@ -4,7 +4,7 @@ A fabulously colourful clock!
|
|||
|
||||
* Clearly shows the time on a colourful background that changes every minute.
|
||||
* Dark and Light theme compatible, with a setting to override the digit colour scheme.
|
||||
* Show or hide widgets with a setting (default shows widgets).
|
||||
* Show or hide widgets with a setting (default hides widgets, swipe down to show them thanks to `widget_utils`).
|
||||
|
||||

|
||||

|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id":"mosaic",
|
||||
"name":"Mosaic Clock",
|
||||
"shortName": "Mosaic Clock",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "A fabulously colourful clock",
|
||||
"readme": "README.md",
|
||||
"icon":"mosaic.png",
|
||||
|
|
|
@ -2,6 +2,7 @@ Array.prototype.sample = function(){
|
|||
return this[Math.floor(Math.random()*this.length)];
|
||||
};
|
||||
|
||||
{
|
||||
const SETTINGS_FILE = "mosaic.settings.json";
|
||||
let settings;
|
||||
let theme;
|
||||
|
@ -87,8 +88,6 @@ let o_h = Math.floor((g.getHeight() - num_squares_h * s+offset_widgets)/2);
|
|||
let mid_x = Math.floor(num_squares_w/2);
|
||||
let mid_y = Math.floor((num_squares_h-1)/2);
|
||||
|
||||
draw();
|
||||
|
||||
Bangle.on('lcdPower',on=>{
|
||||
if (on) {
|
||||
draw(); // draw immediately, queue redraw
|
||||
|
@ -98,8 +97,23 @@ Bangle.on('lcdPower',on=>{
|
|||
}
|
||||
});
|
||||
|
||||
Bangle.setUI('clock');
|
||||
Bangle.setUI({
|
||||
mode : 'clock',
|
||||
remove : function() {
|
||||
// Called to unload all of the clock app
|
||||
if (drawTimeout) clearTimeout(drawTimeout);
|
||||
drawTimeout = undefined;
|
||||
delete Array.prototype.sample;
|
||||
require('widget_utils').show(); // re-show widgets
|
||||
}
|
||||
});
|
||||
|
||||
Bangle.loadWidgets();
|
||||
if (settings.showWidgets) {
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
} else {
|
||||
require("widget_utils").swipeOn(); // hide widgets, make them visible with a swipe
|
||||
}
|
||||
|
||||
draw();
|
||||
}
|
Loading…
Reference in New Issue