iconlaunch - Only use fastload for switch to clock
parent
ad3c9f8f0c
commit
157d8aef80
|
|
@ -11,10 +11,10 @@
|
|||
launchCache = {
|
||||
hash : launchHash,
|
||||
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};})
|
||||
.map(app=>{let 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))
|
||||
.sort((a,b)=>{
|
||||
var n=(0|a.sortorder)-(0|b.sortorder);
|
||||
let n=(0|a.sortorder)-(0|b.sortorder);
|
||||
if (n) return n; // do sortorder first
|
||||
if (a.name<b.name) return -1;
|
||||
if (a.name>b.name) return 1;
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
drawText(itemI);
|
||||
};
|
||||
let drawItemAuto = function(i) {
|
||||
var y = idxToY(i);
|
||||
let y = idxToY(i);
|
||||
g.reset().setClipRect(R.x, y, R.x2, y + itemSize);
|
||||
drawItem(i, {
|
||||
x: R.x,
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
const appId = id * appsN + iconN;
|
||||
if( settings.direct && launchCache.apps[appId])
|
||||
{
|
||||
loadApp(launchCache.apps[appId].src);
|
||||
load(launchCache.apps[appId].src);
|
||||
return;
|
||||
}
|
||||
if (appId == selectedItem && launchCache.apps[appId]) {
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
if (!app.src || s.read(app.src) === undefined) {
|
||||
E.showMessage( /*LANG*/ "App Source\nNot found");
|
||||
} else {
|
||||
loadApp(app.src);
|
||||
load(app.src);
|
||||
}
|
||||
}
|
||||
selectedItem = appId;
|
||||
|
|
@ -109,9 +109,9 @@
|
|||
let drawItems = function() {
|
||||
g.reset().clearRect(R.x, R.y, R.x2, R.y2);
|
||||
g.setClipRect(R.x, R.y, R.x2, R.y2);
|
||||
var a = YtoIdx(R.y);
|
||||
var b = Math.min(YtoIdx(R.y2), 99);
|
||||
for (var i = a; i <= b; i++)
|
||||
let a = YtoIdx(R.y);
|
||||
let b = Math.min(YtoIdx(R.y2), 99);
|
||||
for (let i = a; i <= b; i++)
|
||||
drawItem(i, {
|
||||
x: R.x,
|
||||
y: idxToY(i),
|
||||
|
|
@ -168,25 +168,20 @@
|
|||
}
|
||||
g.setClipRect(0, 0, g.getWidth() - 1, g.getHeight() - 1);
|
||||
};
|
||||
Bangle.setUI({
|
||||
let mode = {
|
||||
mode: "custom",
|
||||
drag: onDrag,
|
||||
touch: (_, e) => {
|
||||
if (e.y < R.y - 4) return;
|
||||
var i = YtoIdx(e.y);
|
||||
let i = YtoIdx(e.y);
|
||||
selectItem(i, e);
|
||||
},
|
||||
swipe: (h,_) => { if(settings.swipeExit && h==1) { returnToClock(); } },
|
||||
});
|
||||
const returnToClock = function() {
|
||||
loadApp(".bootcde");
|
||||
};
|
||||
let watch;
|
||||
let loadApp;
|
||||
if (settings.fastload){
|
||||
loadApp = function(name) {
|
||||
|
||||
const returnToClock = function() {
|
||||
if (settings.fastload == true){
|
||||
Bangle.setUI();
|
||||
if (watch) clearWatch(watch);
|
||||
delete launchCache;
|
||||
delete launchHash;
|
||||
delete drawItemAuto;
|
||||
|
|
@ -199,16 +194,14 @@
|
|||
delete idxToY;
|
||||
delete YtoIdx;
|
||||
delete settings;
|
||||
setTimeout(eval, 0, s.read(name));
|
||||
return;
|
||||
};
|
||||
} else {
|
||||
loadApp = function(name) {
|
||||
load(name);
|
||||
setTimeout(eval, 0, s.read(".bootcde"));
|
||||
} else {
|
||||
load();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (settings.oneClickExit) {
|
||||
watch = setWatch(returnToClock, BTN1);
|
||||
}
|
||||
if (settings.oneClickExit) mode.btn = returnToClock;
|
||||
|
||||
Bangle.setUI(mode);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue