Skip to content

Commit

Permalink
Bangle_setUI_F18: (WIP) complete rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Nov 1, 2024
1 parent cdfb4d6 commit 14285f6
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions libs/js/banglejs/Bangle_setUI_F18.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,33 @@
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
];
} else if (mode=="custom") {
if (options.clock) Bangle.CLOCK=1;
if (options.touch) {
Bangle.touchHandler = options.touch;
Bangle.on("touch", Bangle.touchHandler);
}
if (options.swipe) {
Bangle.swipeHandler = options.swipe;
Bangle.on("swipe", Bangle.swipeHandler);
}
if (options.btn || options.btnRelease) {
Bangle.btnWatches = [
setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"falling"}),
setWatch(function() { options.btn(2); }, BTN2, {repeat:1,edge:"falling"}),
setWatch(function() { options.btn(3); }, BTN3, {repeat:1,edge:"falling"})
];
} else if (options.clock) {
if (options.clock) {
Bangle.btnWatches = [
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
];
}
} else
throw new Error("Unknown UI mode "+E.toJS(mode));
if (options.clock) Bangle.CLOCK=1;
if (options.touch) {
Bangle.touchHandler = options.touch;
Bangle.on("touch", Bangle.touchHandler);
}
if (options.swipe) {
Bangle.swipeHandler = options.swipe;
Bangle.on("swipe", Bangle.swipeHandler);
}
if ((options.btn || options.btnRelease) && !Bangle.btnWatches) Bangle.btnWatches = [];
if (options.btn) Bangle.btnWatches.push(
setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"rising"}),
setWatch(function() { options.btn(2); }, BTN2, {repeat:1,edge:"rising"}),
setWatch(function() { options.btn(3); }, BTN3, {repeat:1,edge:"rising"})
);
if (options.btnRelease) Bangle.btnWatches.push(
setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"falling"}),
setWatch(function() { options.btn(2); }, BTN2, {repeat:1,edge:"falling"}),
setWatch(function() { options.btn(3); }, BTN3, {repeat:1,edge:"falling"})
);
if (options.remove) // handler for removing the UI (intervals/etc)
Bangle.uiRemove = options.remove;
if (options.redraw) // handler for redrawing the UI
Expand Down

0 comments on commit 14285f6

Please sign in to comment.