mirror of https://github.com/espruino/BangleApps
iconlaunch - Cleanup and reset timeout as needed
parent
5c110a89fb
commit
81632cda7e
|
@ -133,6 +133,7 @@
|
|||
g.flip();
|
||||
const itemsN = Math.ceil(launchCache.apps.length / appsN);
|
||||
let onDrag = function(e) {
|
||||
updateTimeout();
|
||||
g.setColor(g.theme.fg);
|
||||
g.setBgColor(g.theme.bg);
|
||||
let dy = e.dy;
|
||||
|
@ -182,6 +183,7 @@
|
|||
drag: onDrag,
|
||||
touch: (_, e) => {
|
||||
if (e.y < R.y - 4) return;
|
||||
updateTimeout();
|
||||
let i = YtoIdx(e.y);
|
||||
selectItem(i, e);
|
||||
},
|
||||
|
@ -202,16 +204,23 @@
|
|||
delete idxToY;
|
||||
delete YtoIdx;
|
||||
delete settings;
|
||||
if (timeout) clearTimeout(timeout);
|
||||
setTimeout(eval, 0, s.read(".bootcde"));
|
||||
};
|
||||
|
||||
|
||||
if (settings.oneClickExit) mode.btn = returnToClock;
|
||||
|
||||
let timeout;
|
||||
const updateTimeout = function(){
|
||||
if (settings.timeOut!="Off"){
|
||||
let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt
|
||||
setTimeout(returnToClock,time*1000);
|
||||
if (timeout) clearTimeout(timeout);
|
||||
timeout = setTimeout(returnToClock,time*1000);
|
||||
}
|
||||
}
|
||||
|
||||
updateTimeout();
|
||||
|
||||
Bangle.setUI(mode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue