Skip to content

Commit 14285f6

Browse files
committed
Bangle_setUI_F18: (WIP) complete rewrite
1 parent cdfb4d6 commit 14285f6

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

libs/js/banglejs/Bangle_setUI_F18.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,33 @@
6060
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
6161
];
6262
} else if (mode=="custom") {
63-
if (options.clock) Bangle.CLOCK=1;
64-
if (options.touch) {
65-
Bangle.touchHandler = options.touch;
66-
Bangle.on("touch", Bangle.touchHandler);
67-
}
68-
if (options.swipe) {
69-
Bangle.swipeHandler = options.swipe;
70-
Bangle.on("swipe", Bangle.swipeHandler);
71-
}
72-
if (options.btn || options.btnRelease) {
73-
Bangle.btnWatches = [
74-
setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"falling"}),
75-
setWatch(function() { options.btn(2); }, BTN2, {repeat:1,edge:"falling"}),
76-
setWatch(function() { options.btn(3); }, BTN3, {repeat:1,edge:"falling"})
77-
];
78-
} else if (options.clock) {
63+
if (options.clock) {
7964
Bangle.btnWatches = [
8065
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
8166
];
8267
}
8368
} else
8469
throw new Error("Unknown UI mode "+E.toJS(mode));
70+
if (options.clock) Bangle.CLOCK=1;
71+
if (options.touch) {
72+
Bangle.touchHandler = options.touch;
73+
Bangle.on("touch", Bangle.touchHandler);
74+
}
75+
if (options.swipe) {
76+
Bangle.swipeHandler = options.swipe;
77+
Bangle.on("swipe", Bangle.swipeHandler);
78+
}
79+
if ((options.btn || options.btnRelease) && !Bangle.btnWatches) Bangle.btnWatches = [];
80+
if (options.btn) Bangle.btnWatches.push(
81+
setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"rising"}),
82+
setWatch(function() { options.btn(2); }, BTN2, {repeat:1,edge:"rising"}),
83+
setWatch(function() { options.btn(3); }, BTN3, {repeat:1,edge:"rising"})
84+
);
85+
if (options.btnRelease) Bangle.btnWatches.push(
86+
setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"falling"}),
87+
setWatch(function() { options.btn(2); }, BTN2, {repeat:1,edge:"falling"}),
88+
setWatch(function() { options.btn(3); }, BTN3, {repeat:1,edge:"falling"})
89+
);
8590
if (options.remove) // handler for removing the UI (intervals/etc)
8691
Bangle.uiRemove = options.remove;
8792
if (options.redraw) // handler for redrawing the UI

0 commit comments

Comments
 (0)