forked from FOSS/BangleApps
gbmusic: `Simple button` setting to disable double/triple pressing
For music players which handle multiple button presses themselves. see http://forum.espruino.com/comments/15984222/master
parent
14c4bfdb8b
commit
d642ad5c80
|
@ -2,4 +2,4 @@
|
|||
0.02: Increase text brightness, improve controls, (try to) reduce memory usage
|
||||
0.03: Only auto-start if active app is a clock, auto close after 1 hour of inactivity
|
||||
0.04: Setting to disable touch controls, minor bugfix
|
||||
0.05: Remove touch controls setting, reduce fadeout flicker
|
||||
0.05: Setting to disable double/triple press control, remove touch controls setting, reduce fadeout flicker
|
|
@ -22,6 +22,9 @@ You can change these under `Settings`->`App/Widget Settings`->`Music Controls`.
|
|||
Automatically load the app when you play music and close when the music stops.
|
||||
(If the app opened automatically, it closes after music has been paused for 5 minutes.)
|
||||
|
||||
**Simple button**:
|
||||
Disable double/triple pressing Button 2: always simply toggle play/pause.
|
||||
(For music players which handle multiple button presses themselves.)
|
||||
|
||||
## Controls
|
||||
|
||||
|
|
|
@ -485,11 +485,19 @@ function startButtonWatches() {
|
|||
tPress = setTimeout(() => {Bangle.showLauncher();}, 3000);
|
||||
}
|
||||
}, BTN2, {repeat: true, edge: "rising"});
|
||||
setWatch(() => {
|
||||
nPress++;
|
||||
clearTimeout(tPress);
|
||||
tPress = setTimeout(handleButton2Press, 500);
|
||||
}, BTN2, {repeat: true, edge: "falling"});
|
||||
const s = require("Storage").readJSON("gbmusic.json", 1) || {};
|
||||
if (s.simpleButton) {
|
||||
setWatch(() => {
|
||||
clearTimeout(tPress);
|
||||
togglePlay();
|
||||
}, BTN2, {repeat: true, edge: "falling"});
|
||||
} else {
|
||||
setWatch(() => {
|
||||
nPress++;
|
||||
clearTimeout(tPress);
|
||||
tPress = setTimeout(handleButton2Press, 500);
|
||||
}, BTN2, {repeat: true, edge: "falling"});
|
||||
}
|
||||
}
|
||||
function handleButton2Press() {
|
||||
tPress = null;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// initialize with default settings...
|
||||
let s = {
|
||||
autoStart: true,
|
||||
simpleButton: false,
|
||||
};
|
||||
// ...and overwrite them with any saved values
|
||||
// This way saved values are preserved if a new version adds more settings
|
||||
|
@ -34,6 +35,11 @@
|
|||
format: yesNo,
|
||||
onchange: save("autoStart"),
|
||||
};
|
||||
menu[translate("Simple button")] = {
|
||||
value: !!s.simpleButton,
|
||||
format: yesNo,
|
||||
onchange: save("simpleButton"),
|
||||
};
|
||||
|
||||
E.showMenu(menu);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue