move ineractive code into setUI, replace 'click to exit' with back function in setUI (always on).
parent
02f91e1bd0
commit
af81e45aed
|
|
@ -16,3 +16,6 @@
|
||||||
0.16: Use default Bangle formatter for booleans
|
0.16: Use default Bangle formatter for booleans
|
||||||
0.17: Bangle 2: Fast loading on exit to clock face. Added option for exit to
|
0.17: Bangle 2: Fast loading on exit to clock face. Added option for exit to
|
||||||
clock face by timeout.
|
clock face by timeout.
|
||||||
|
0.18: Move interactions inside setUI. Replace "one click exit" with
|
||||||
|
back-functionality through setUI, adding the red back button as well. Hardware
|
||||||
|
button to exit is no longer an option.
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,10 @@ let settings = Object.assign({
|
||||||
showClocks: true,
|
showClocks: true,
|
||||||
showLaunchers: true,
|
showLaunchers: true,
|
||||||
direct: false,
|
direct: false,
|
||||||
oneClickExit: false,
|
|
||||||
swipeExit: false,
|
swipeExit: false,
|
||||||
timeOut: "Off"
|
timeOut: "Off"
|
||||||
}, require('Storage').readJSON("dtlaunch.json", true) || {});
|
}, require('Storage').readJSON("dtlaunch.json", true) || {});
|
||||||
|
|
||||||
if (settings.oneClickExit) {
|
|
||||||
var buttonWatch = setWatch(_=> returnToClock(), BTN1, {edge: 'falling'});
|
|
||||||
}
|
|
||||||
|
|
||||||
let s = require("Storage");
|
let s = require("Storage");
|
||||||
var apps = s.list(/\.info$/).map(app=>{
|
var apps = s.list(/\.info$/).map(app=>{
|
||||||
let a=s.readJSON(app,1);
|
let a=s.readJSON(app,1);
|
||||||
|
|
@ -91,7 +86,7 @@ let drawPage = function(p){
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
//g.clear();
|
//g.clear();
|
||||||
Bangle.drawWidgets();
|
//Bangle.drawWidgets();
|
||||||
drawPage(0);
|
drawPage(0);
|
||||||
|
|
||||||
let swipeListenerDt = function(dirLeftRight, dirUpDown){
|
let swipeListenerDt = function(dirLeftRight, dirUpDown){
|
||||||
|
|
@ -106,7 +101,6 @@ let swipeListenerDt = function(dirLeftRight, dirUpDown){
|
||||||
drawPage(page);
|
drawPage(page);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Bangle.on("swipe",swipeListenerDt);
|
|
||||||
|
|
||||||
let isTouched = function(p,n){
|
let isTouched = function(p,n){
|
||||||
if (n<0 || n>3) return false;
|
if (n<0 || n>3) return false;
|
||||||
|
|
@ -138,25 +132,18 @@ let touchListenerDt = function(_,p){
|
||||||
selected=-1;
|
selected=-1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Bangle.on("touch",touchListenerDt);
|
|
||||||
|
|
||||||
const returnToClock = function() {
|
const returnToClock = function() {
|
||||||
Bangle.setUI();
|
Bangle.setUI();
|
||||||
if (buttonWatch) {
|
|
||||||
clearWatch(buttonWatch);
|
|
||||||
delete buttonWatch;
|
|
||||||
}
|
|
||||||
if (timeoutToClock) {
|
|
||||||
clearTimeout(timeoutToClock);
|
|
||||||
delete timeoutToClock;
|
|
||||||
}
|
|
||||||
Bangle.removeListener("swipe", swipeListenerDt);
|
|
||||||
Bangle.removeListener("touch", touchListenerDt);
|
|
||||||
var apps = [];
|
|
||||||
delete apps;
|
|
||||||
delete returnToClock;
|
|
||||||
setTimeout(eval, 0, s.read(".bootcde"));
|
setTimeout(eval, 0, s.read(".bootcde"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Bangle.setUI({
|
||||||
|
mode : 'custom',
|
||||||
|
back : returnToClock,
|
||||||
|
swipe : swipeListenerDt,
|
||||||
|
touch : touchListenerDt
|
||||||
|
});
|
||||||
|
|
||||||
// taken from Icon Launcher with minor alterations
|
// taken from Icon Launcher with minor alterations
|
||||||
var timeoutToClock;
|
var timeoutToClock;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "dtlaunch",
|
"id": "dtlaunch",
|
||||||
"name": "Desktop Launcher",
|
"name": "Desktop Launcher",
|
||||||
"version": "0.17",
|
"version": "0.18",
|
||||||
"description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.",
|
"description": "Desktop style App Launcher with six (four for Bangle 2) apps per page - fast access if you have lots of apps installed.",
|
||||||
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
|
"screenshots": [{"url":"shot1.png"},{"url":"shot2.png"},{"url":"shot3.png"}],
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
showClocks: true,
|
showClocks: true,
|
||||||
showLaunchers: true,
|
showLaunchers: true,
|
||||||
direct: false,
|
direct: false,
|
||||||
oneClickExit:false,
|
|
||||||
swipeExit: false,
|
swipeExit: false,
|
||||||
timeOut: "Off"
|
timeOut: "Off"
|
||||||
}, require('Storage').readJSON(FILE, true) || {});
|
}, require('Storage').readJSON(FILE, true) || {});
|
||||||
|
|
@ -47,13 +46,6 @@
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*LANG*/'One click exit': {
|
|
||||||
value: settings.oneClickExit,
|
|
||||||
onchange: v => {
|
|
||||||
settings.oneClickExit = v;
|
|
||||||
writeSettings();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/*LANG*/'Time Out': { // Adapted from Icon Launcher
|
/*LANG*/'Time Out': { // Adapted from Icon Launcher
|
||||||
value: timeOutChoices.indexOf(settings.timeOut),
|
value: timeOutChoices.indexOf(settings.timeOut),
|
||||||
min: 0,
|
min: 0,
|
||||||
|
|
@ -63,6 +55,6 @@
|
||||||
settings.timeOut = timeOutChoices[v];
|
settings.timeOut = timeOutChoices[v];
|
||||||
writeSettings();
|
writeSettings();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue