Merge pull request #2546 from halemmerich/quickcentertimeout
qcenter - Allow going back to clock on timeoutmaster
commit
418b57ed78
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: New App!
|
0.01: New App!
|
||||||
0.02: Fix fast loading on swipe to clock
|
0.02: Fix fast loading on swipe to clock
|
||||||
|
0.03: Adds a setting for going back to clock on a timeout
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ let layout = new Layout({
|
||||||
}, {
|
}, {
|
||||||
remove: ()=>{
|
remove: ()=>{
|
||||||
Bangle.removeListener("swipe", onSwipe);
|
Bangle.removeListener("swipe", onSwipe);
|
||||||
|
Bangle.removeListener("touch", updateTimeout);
|
||||||
delete Graphics.prototype.setFont8x12;
|
delete Graphics.prototype.setFont8x12;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -117,6 +118,16 @@ g.clear();
|
||||||
layout.render();
|
layout.render();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
||||||
|
let timeout;
|
||||||
|
const updateTimeout = function(){
|
||||||
|
if (settings.timeout){
|
||||||
|
if (timeout) clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(Bangle.showClock,settings.timeout*1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateTimeout();
|
||||||
|
|
||||||
// swipe event listener for exit gesture
|
// swipe event listener for exit gesture
|
||||||
let onSwipe = function (lr, ud) {
|
let onSwipe = function (lr, ud) {
|
||||||
if(exitGesture == "swipeup" && ud == -1) Bangle.showClock();
|
if(exitGesture == "swipeup" && ud == -1) Bangle.showClock();
|
||||||
|
|
@ -126,4 +137,5 @@ let onSwipe = function (lr, ud) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.on("swipe", onSwipe);
|
Bangle.on("swipe", onSwipe);
|
||||||
|
Bangle.on("touch", updateTimeout);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "qcenter",
|
"id": "qcenter",
|
||||||
"name": "Quick Center",
|
"name": "Quick Center",
|
||||||
"shortName": "QCenter",
|
"shortName": "QCenter",
|
||||||
"version": "0.02",
|
"version": "0.03",
|
||||||
"description": "An app for quickly launching your favourite apps, inspired by the control centres of other watches.",
|
"description": "An app for quickly launching your favourite apps, inspired by the control centres of other watches.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "",
|
"tags": "",
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,11 @@
|
||||||
E.showMenu(exitGestureMenu);
|
E.showMenu(exitGestureMenu);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set Timeout
|
||||||
|
mainmenu["Timeout: " + (settings.timeout ? (settings.timeout+"s") : "Off")] = function () {
|
||||||
|
E.showMenu(timeoutMenu);
|
||||||
|
};
|
||||||
|
|
||||||
//List all pinned apps, redirecting to menu with options to unpin and reorder
|
//List all pinned apps, redirecting to menu with options to unpin and reorder
|
||||||
pinnedApps.forEach((app, i) => {
|
pinnedApps.forEach((app, i) => {
|
||||||
mainmenu[app.name] = function () {
|
mainmenu[app.name] = function () {
|
||||||
|
|
@ -129,5 +134,22 @@
|
||||||
showMainMenu();
|
showMainMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// menu for setting timeout
|
||||||
|
var timeoutMenu = {
|
||||||
|
"": { title: "Timeout", back: showMainMenu }
|
||||||
|
};
|
||||||
|
timeoutMenu["Off"] = function () {
|
||||||
|
save("timeout", 0);
|
||||||
|
showMainMenu();
|
||||||
|
};
|
||||||
|
let timeoutvalues = [10,20,30,60];
|
||||||
|
for (c in timeoutvalues){
|
||||||
|
let v = timeoutvalues[c];
|
||||||
|
timeoutMenu[v+"s"] = function () {
|
||||||
|
save("timeout", v);
|
||||||
|
showMainMenu();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
showMainMenu();
|
showMainMenu();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue