1
0
Fork 0

Change Bangle1 BTN2 to show launcher.

master
Andrew Gregory 2021-11-13 21:50:44 +08:00 committed by GitHub
parent d9733ebd57
commit d8ac7cfd57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -267,20 +267,19 @@ function onSwipe(e) {
function bangle1Btn(e) { function bangle1Btn(e) {
if (tokens.length > 0) { if (tokens.length > 0) {
if (state.curtoken == -1) { if (state.curtoken == -1) {
state.nextTime = 0;
state.curtoken = state.prevcur; state.curtoken = state.prevcur;
} else { } else {
switch (e) { switch (e) {
case -1: state.curtoken--; break; case -1: state.curtoken--; break;
case 1: state.curtoken++; break; case 1: state.curtoken++; break;
} }
state.nextTime = 0;
} }
state.curtoken = Math.max(state.curtoken, 0); state.curtoken = Math.max(state.curtoken, 0);
state.curtoken = Math.min(state.curtoken, tokens.length - 1); state.curtoken = Math.min(state.curtoken, tokens.length - 1);
var fakee = {}; var fakee = {};
fakee.y = state.curtoken * tokenentryheight - state.listy + Bangle.appRect.y; fakee.y = state.curtoken * tokenentryheight - state.listy + Bangle.appRect.y;
state.curtoken = -1; state.curtoken = -1;
state.nextTime = 0;
onTouch(0, fakee); onTouch(0, fakee);
} }
} }
@ -290,7 +289,7 @@ Bangle.on('drag' , onDrag );
Bangle.on('swipe', onSwipe); Bangle.on('swipe', onSwipe);
if (typeof BTN2 == 'number') { if (typeof BTN2 == 'number') {
setWatch(function(){bangle1Btn(-1); }, BTN1, {edge:"rising", debounce:50, repeat:true}); setWatch(function(){bangle1Btn(-1); }, BTN1, {edge:"rising", debounce:50, repeat:true});
setWatch(function(){ onSwipe(-1);}, BTN2, {edge:"rising", debounce:50, repeat:true}); setWatch(function(){Bangle.showLauncher();}, BTN2, {edge:"rising", debounce:50, repeat:true});
setWatch(function(){bangle1Btn( 1); }, BTN3, {edge:"rising", debounce:50, repeat:true}); setWatch(function(){bangle1Btn( 1); }, BTN3, {edge:"rising", debounce:50, repeat:true});
} }
Bangle.loadWidgets(); Bangle.loadWidgets();