Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
parent
899233394d
commit
f6b38b3443
|
|
@ -10,4 +10,5 @@
|
|||
week is buffered until date or timezone changes
|
||||
0.07: align default settings with app.js (otherwise the initial displayed settings will be confusing to users)
|
||||
0.08: fixed calendar weeknumber not shortened to two digits
|
||||
0.09: Use default Bangle formatter for booleans
|
||||
0.09: Use default Bangle formatter for booleans
|
||||
0.10: Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "antonclk",
|
||||
"name": "Anton Clock",
|
||||
"version": "0.09",
|
||||
"version": "0.10",
|
||||
"description": "A clock using the bold Anton font, optionally showing seconds and date in ISO-8601 format.",
|
||||
"readme":"README.md",
|
||||
"icon": "app.png",
|
||||
|
|
|
|||
|
|
@ -14,3 +14,4 @@
|
|||
Add /*LANG*/ tags for internationalisation
|
||||
0.13: Add fullscreen mode
|
||||
0.14: Use default Bangle formatter for booleans
|
||||
0.15: Support for unload and quick return to the clock on 2v16
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
var s = require("Storage");
|
||||
var scaleval = 1;
|
||||
var vectorval = 20;
|
||||
var font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
|
||||
{ // must be inside our own scope here so that when we are unloaded everything disappears
|
||||
let s = require("Storage");
|
||||
let scaleval = 1;
|
||||
let vectorval = 20;
|
||||
let font = g.getFonts().includes("12x20") ? "12x20" : "6x8:2";
|
||||
let settings = Object.assign({
|
||||
showClocks: true,
|
||||
fullscreen: false
|
||||
|
|
@ -20,7 +21,7 @@ if ("font" in settings){
|
|||
scaleval = (font.split("x")[1])/20;
|
||||
}
|
||||
}
|
||||
var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type));
|
||||
let apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || !app.type));
|
||||
apps.sort((a,b)=>{
|
||||
var n=(0|a.sortorder)-(0|b.sortorder);
|
||||
if (n) return n; // do sortorder first
|
||||
|
|
@ -69,18 +70,30 @@ E.showScroller({
|
|||
}
|
||||
});
|
||||
|
||||
function returnToClock() {
|
||||
// unload everything manually
|
||||
// ... or we could just call `load();` but it will be slower
|
||||
Bangle.setUI(); // remove scroller's handling
|
||||
if (lockTimeout) clearTimeout(lockTimeout);
|
||||
Bangle.removeListener("lock", lockHandler);
|
||||
// now load the default clock - just call .bootcde as this has the code already
|
||||
setTimeout(eval,0,s.read(".bootcde"));
|
||||
}
|
||||
|
||||
// on bangle.js 2, the screen is used for navigating, so the single button goes back
|
||||
// on bangle.js 1, the buttons are used for navigating
|
||||
if (process.env.HWVERSION==2) {
|
||||
setWatch(_=>load(), BTN1, {edge:"falling"});
|
||||
setWatch(returnToClock, BTN1, {edge:"falling"});
|
||||
}
|
||||
|
||||
// 10s of inactivity goes back to clock
|
||||
Bangle.setLocked(false); // unlock initially
|
||||
var lockTimeout;
|
||||
Bangle.on("lock", locked => {
|
||||
let lockTimeout;
|
||||
function lockHandler(locked) {
|
||||
if (lockTimeout) clearTimeout(lockTimeout);
|
||||
lockTimeout = undefined;
|
||||
if (locked)
|
||||
lockTimeout = setTimeout(_=>load(), 10000);
|
||||
});
|
||||
lockTimeout = setTimeout(returnToClock, 10000);
|
||||
}
|
||||
Bangle.on("lock", lockHandler);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "launch",
|
||||
"name": "Launcher",
|
||||
"shortName": "Launcher",
|
||||
"version": "0.14",
|
||||
"version": "0.15",
|
||||
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
|
||||
"readme": "README.md",
|
||||
"icon": "app.png",
|
||||
|
|
|
|||
Loading…
Reference in New Issue