Use Bangle.load and Bangle.showClock

pull/2271/head
thyttan 2022-11-14 18:42:06 +01:00
parent f0a270b1b2
commit c6e70dbab4
3 changed files with 12 additions and 28 deletions

View File

@ -14,3 +14,4 @@
added timeOut to return to the clock added timeOut to return to the clock
0.11: Cleanup timeout when changing to clock 0.11: Cleanup timeout when changing to clock
Reset timeout on swipe and drag Reset timeout on swipe and drag
0.12: Use Bangle.load and Bangle.showClock

View File

@ -94,7 +94,7 @@
const appId = id * appsN + iconN; const appId = id * appsN + iconN;
if( settings.direct && launchCache.apps[appId]) if( settings.direct && launchCache.apps[appId])
{ {
load(launchCache.apps[appId].src); Bangle.load(launchCache.apps[appId].src);
return; return;
} }
if (appId == selectedItem && launchCache.apps[appId]) { if (appId == selectedItem && launchCache.apps[appId]) {
@ -102,7 +102,7 @@
if (!app.src || s.read(app.src) === undefined) { if (!app.src || s.read(app.src) === undefined) {
E.showMessage( /*LANG*/ "App Source\nNot found"); E.showMessage( /*LANG*/ "App Source\nNot found");
} else { } else {
load(app.src); Bangle.load(app.src);
} }
} }
selectedItem = appId; selectedItem = appId;
@ -186,39 +186,22 @@
let i = YtoIdx(e.y); let i = YtoIdx(e.y);
selectItem(i, e); selectItem(i, e);
}, },
swipe: (h,_) => { if(settings.swipeExit && h==1) { returnToClock(); } }, swipe: (h,_) => { if(settings.swipeExit && h==1) { Bangle.showClock(); } },
btn: _=> { if (settings.oneClickExit) Bangle.showClock(); },
remove: function() {
if (timeout) clearTimeout(timeout);
}
}; };
const returnToClock = function() {
Bangle.setUI();
delete launchCache;
delete launchHash;
delete drawItemAuto;
delete drawText;
delete selectItem;
delete onDrag;
delete drawItems;
delete drawItem;
delete returnToClock;
delete idxToY;
delete YtoIdx;
delete settings;
if (timeout) clearTimeout(timeout);
setTimeout(eval, 0, s.read(".bootcde"));
};
if (settings.oneClickExit) mode.btn = returnToClock;
let timeout; let timeout;
const updateTimeout = function(){ 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
if (timeout) clearTimeout(timeout); if (timeout) clearTimeout(timeout);
timeout = setTimeout(returnToClock,time*1000); timeout = setTimeout(returnToClock,time*1000);
} }
} };
updateTimeout(); updateTimeout();
Bangle.setUI(mode); Bangle.setUI(mode);

View File

@ -2,7 +2,7 @@
"id": "iconlaunch", "id": "iconlaunch",
"name": "Icon Launcher", "name": "Icon Launcher",
"shortName" : "Icon launcher", "shortName" : "Icon launcher",
"version": "0.11", "version": "0.12",
"icon": "app.png", "icon": "app.png",
"description": "A launcher inspired by smartphones, with an icon-only scrollable menu.", "description": "A launcher inspired by smartphones, with an icon-only scrollable menu.",
"tags": "tool,system,launcher", "tags": "tool,system,launcher",