counter2: always-unlocked option
parent
e95668da52
commit
40416fccc9
|
|
@ -4,3 +4,4 @@
|
||||||
0.04: Fix lint warnings
|
0.04: Fix lint warnings
|
||||||
0.05: Fix on not reading counter defaults in Settings
|
0.05: Fix on not reading counter defaults in Settings
|
||||||
0.06: Added ability to display only one counter and fast-scrolling
|
0.06: Added ability to display only one counter and fast-scrolling
|
||||||
|
0.07: Add option to keep unlocked
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,19 @@ var s = Object.assign({
|
||||||
fullscreen:true,
|
fullscreen:true,
|
||||||
buzz: true,
|
buzz: true,
|
||||||
colortext: true,
|
colortext: true,
|
||||||
|
keepunlocked: false,
|
||||||
}, require('Storage').readJSON("counter2.json", true) || {});
|
}, require('Storage').readJSON("counter2.json", true) || {});
|
||||||
|
|
||||||
var sGlob = Object.assign({
|
var sGlob = Object.assign({
|
||||||
timeout: 10,
|
timeout: 10,
|
||||||
}, require('Storage').readJSON("setting.json", true) || {});
|
}, require('Storage').readJSON("setting.json", true) || {});
|
||||||
|
|
||||||
|
const lockTimeout = s.keepunlocked ? 0 : 1000;
|
||||||
|
if (s.keepunlocked) {
|
||||||
|
Bangle.setOptions({lockTimeout});
|
||||||
|
Bangle.setLocked(false);
|
||||||
|
}
|
||||||
|
|
||||||
const f1 = (s.colortext) ? "#f00" : "#fff";
|
const f1 = (s.colortext) ? "#f00" : "#fff";
|
||||||
const f2 = (s.colortext) ? "#00f" : "#fff";
|
const f2 = (s.colortext) ? "#00f" : "#fff";
|
||||||
const b1 = (s.colortext) ? g.theme.bg : "#f00";
|
const b1 = (s.colortext) ? g.theme.bg : "#f00";
|
||||||
|
|
@ -80,7 +87,7 @@ function updateScreen() {
|
||||||
Bangle.on('lock', e => {
|
Bangle.on('lock', e => {
|
||||||
drag = undefined;
|
drag = undefined;
|
||||||
var timeOutTimer = sGlob.timeout * 1000;
|
var timeOutTimer = sGlob.timeout * 1000;
|
||||||
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout: timeOutTimer});
|
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout});
|
||||||
if (dragtimeout) clearTimeout(dragtimeout);
|
if (dragtimeout) clearTimeout(dragtimeout);
|
||||||
fastupdateoccurring = false;
|
fastupdateoccurring = false;
|
||||||
});
|
});
|
||||||
|
|
@ -102,7 +109,7 @@ Bangle.on("drag", e => {
|
||||||
drag = undefined;
|
drag = undefined;
|
||||||
if (dragtimeout) {
|
if (dragtimeout) {
|
||||||
let timeOutTimer = 1000;
|
let timeOutTimer = 1000;
|
||||||
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout: timeOutTimer});
|
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout});
|
||||||
clearTimeout(dragtimeout);
|
clearTimeout(dragtimeout);
|
||||||
}
|
}
|
||||||
fastupdateoccurring = false;
|
fastupdateoccurring = false;
|
||||||
|
|
@ -134,7 +141,7 @@ function resetcounter(which) {
|
||||||
fastupdateoccurring = false;
|
fastupdateoccurring = false;
|
||||||
if (dragtimeout) {
|
if (dragtimeout) {
|
||||||
let timeOutTimer = 1000;
|
let timeOutTimer = 1000;
|
||||||
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout: timeOutTimer});
|
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout});
|
||||||
clearTimeout(dragtimeout);
|
clearTimeout(dragtimeout);
|
||||||
}
|
}
|
||||||
if (which == null) {
|
if (which == null) {
|
||||||
|
|
@ -152,7 +159,6 @@ function resetcounter(which) {
|
||||||
ignoreonce = true;
|
ignoreonce = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateScreen();
|
updateScreen();
|
||||||
|
|
||||||
setWatch(function() {
|
setWatch(function() {
|
||||||
|
|
@ -163,6 +169,6 @@ setWatch(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var timeOutTimer = sGlob.timeout * 1000;
|
var timeOutTimer = sGlob.timeout * 1000;
|
||||||
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout: timeOutTimer});
|
Bangle.setOptions({backlightTimeout: timeOutTimer, lockTimeout});
|
||||||
load();
|
load();
|
||||||
}, BTN1, {repeat:true, edge:"falling"});
|
}, BTN1, {repeat:true, edge:"falling"});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "counter2",
|
"id": "counter2",
|
||||||
"name": "Counter2",
|
"name": "Counter2",
|
||||||
"version": "0.06",
|
"version": "0.07",
|
||||||
"description": "Dual Counter",
|
"description": "Dual Counter",
|
||||||
"readme":"README.md",
|
"readme":"README.md",
|
||||||
"icon": "counter2-icon.png",
|
"icon": "counter2-icon.png",
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,17 @@
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.buzz = v;
|
settings.buzz = v;
|
||||||
writeSettings();
|
writeSettings();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
appMenu['Keep unlocked'] = {
|
||||||
|
value: settings.keepunlocked,
|
||||||
|
onchange: v => {
|
||||||
|
settings.keepunlocked = v;
|
||||||
|
writeSettings();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
E.showMenu(appMenu);
|
E.showMenu(appMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
showMainMenu();
|
showMainMenu();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue