launcher 0.09: Bangle.js 2 - pressing the button goes back to clock (fix #971)

After 10s of being locked, the launcher goes back to the clock screen
master
Gordon Williams 2021-12-02 10:28:38 +00:00
parent 5b967184b6
commit 9d26a6448e
4 changed files with 25 additions and 1 deletions

View File

@ -104,7 +104,7 @@
"id": "launch",
"name": "Launcher",
"shortName": "Launcher",
"version": "0.08",
"version": "0.09",
"description": "This is needed to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
"icon": "app.png",
"type": "launch",

View File

@ -6,3 +6,5 @@
0.06: Use Bangle.setUI for buttons
0.07: Theme colours fix
0.08: Merge Bangle.js 1 and 2 launchers
0.09: Bangle.js 2 - pressing the button goes back to clock (fix #971)
After 10s of being locked, the launcher goes back to the clock screen

View File

@ -64,3 +64,12 @@ Bangle.setUI("updown",dir=>{
});
Bangle.loadWidgets();
Bangle.drawWidgets();
// 10s of inactivity goes back to clock
if (Bangle.setLocked) Bangle.setLocked(false); // unlock initially
var lockTimeout;
Bangle.on('lock', locked => {
if (lockTimeout) clearTimeout(lockTimeout);
lockTimeout = undefined;
if (locked)
lockTimeout = setTimeout(_=>load(), 10000);
});

View File

@ -46,3 +46,16 @@ E.showScroller({
}
}
});
// pressing button goes back
setWatch(_=>load(), BTN1, {edge:"falling"});
// 10s of inactivity goes back to clock
Bangle.setLocked(false); // unlock initially
var lockTimeout;
Bangle.on('lock', locked => {
if (lockTimeout) clearTimeout(lockTimeout);
lockTimeout = undefined;
if (locked)
lockTimeout = setTimeout(_=>load(), 10000);
});