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