timeout to clock copied from Icon Launcher
parent
84837228f9
commit
a46c76a2ff
|
|
@ -10,12 +10,18 @@ let settings = Object.assign({
|
|||
direct: false,
|
||||
oneClickExit: false,
|
||||
swipeExit: false,
|
||||
timeOut: "Off"
|
||||
}, require('Storage').readJSON("dtlaunch.json", true) || {});
|
||||
|
||||
if (settings.oneClickExit) {
|
||||
var buttonWatch = setWatch(_=> returnToClock, BTN1);
|
||||
}
|
||||
|
||||
// taken from Icon Launcher with minor alterations
|
||||
if (settings.timeOut!="Off"){
|
||||
let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt
|
||||
var timeoutToClock = setTimeout(returnToClock,time*1000);
|
||||
}
|
||||
let s = require("Storage");
|
||||
var apps = s.list(/\.info$/).map(app=>{
|
||||
let a=s.readJSON(app,1);
|
||||
|
|
@ -142,6 +148,9 @@ Bangle.on("touch",touchListenerDt);
|
|||
const returnToClock = function() {
|
||||
Bangle.setUI();
|
||||
clearWatch(buttonWatch);
|
||||
delete buttonWatch;
|
||||
clearTimeout(timeoutToClock);
|
||||
delete timeoutToClock;
|
||||
delete s;
|
||||
delete a;
|
||||
delete n;
|
||||
|
|
|
|||
|
|
@ -6,50 +6,63 @@
|
|||
showLaunchers: true,
|
||||
direct: false,
|
||||
oneClickExit:false,
|
||||
swipeExit: false
|
||||
swipeExit: false,
|
||||
timeOut: "Off"
|
||||
}, require('Storage').readJSON(FILE, true) || {});
|
||||
|
||||
function writeSettings() {
|
||||
require('Storage').writeJSON(FILE, settings);
|
||||
}
|
||||
|
||||
const timeOutChoices = [/*LANG*/"Off", "10s", "15s", "20s", "30s"];
|
||||
|
||||
E.showMenu({
|
||||
"" : { "title" : "Desktop launcher" },
|
||||
"< Back" : () => back(),
|
||||
'Show clocks': {
|
||||
/*LANG*/"< Back" : () => back(),
|
||||
/*LANG*/'Show clocks': {
|
||||
value: settings.showClocks,
|
||||
onchange: v => {
|
||||
settings.showClocks = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
'Show launchers': {
|
||||
/*LANG*/'Show launchers': {
|
||||
value: settings.showLaunchers,
|
||||
onchange: v => {
|
||||
settings.showLaunchers = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
'Direct launch': {
|
||||
/*LANG*/'Direct launch': {
|
||||
value: settings.direct,
|
||||
onchange: v => {
|
||||
settings.direct = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
'Swipe Exit': {
|
||||
/*LANG*/'Swipe Exit': {
|
||||
value: settings.swipeExit,
|
||||
onchange: v => {
|
||||
settings.swipeExit = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
'One click exit': {
|
||||
/*LANG*/'One click exit': {
|
||||
value: settings.oneClickExit,
|
||||
onchange: v => {
|
||||
settings.oneClickExit = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
/*LANG*/'Time Out': {
|
||||
value: timeOutChoices.indexOf(settings.timeOut),
|
||||
min: 0,
|
||||
max: timeOutChoices.length-1,
|
||||
format: v => timeOutChoices[v],
|
||||
onchange: m => {
|
||||
settings.timeOut = m;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue