Skip to content

Commit 336874c

Browse files
authored
Add haptics option and improve menu item handling
1 parent c5538d2 commit 336874c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

apps/clock_info/lib.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ exports.loadSettings = function() {
2323
hrmOn : 0, // 0(Always), 1(Tap)
2424
defocusOnLock : true,
2525
maxAltitude : 3000,
26+
haptics:false,
2627
apps : {}
2728
},
2829
require("Storage").readJSON("clock_info.json",1)||{}
@@ -293,13 +294,15 @@ exports.addInteractive = function(menu, options) {
293294
var oldMenuItem;
294295
if (ud) {
295296
if (menu[options.menuA].items.length==1) return; // 1 item - can't move
297+
Bangle.buzz(30);
296298
oldMenuItem = menu[options.menuA].items[options.menuB];
297299
options.menuB += ud;
298300
if (options.menuB<0) options.menuB = menu[options.menuA].items.length-1;
299301
if (options.menuB>=menu[options.menuA].items.length) options.menuB = 0;
300302
} else if (lr) {
301303
if (menu.length==1) return; // 1 item - can't move
302304
oldMenuItem = menu[options.menuA].items[options.menuB];
305+
Bangle.buzz(44);
303306
do {
304307
options.menuA += lr;
305308
if (options.menuA<0) options.menuA = menu.length-1;
@@ -317,9 +320,12 @@ exports.addInteractive = function(menu, options) {
317320
if (oldMenuItem) {
318321
menuHideItem(oldMenuItem);
319322
oldMenuItem.removeAllListeners("draw");
320-
menuShowItem(menu[options.menuA].items[options.menuB]);
321-
}
323+
let name=menu[options.menuA].name;
324+
let formattedName=name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
325+
let menuItem=menu[options.menuA].items[options.menuB]
326+
menuShowItem(menuItem);
322327
// On 2v18+ firmware we can stop other event handlers from being executed since we handled this
328+
}
323329
E.stopEventPropagation&&E.stopEventPropagation();
324330
}
325331
if (Bangle.prependListener) {Bangle.prependListener("swipe",swipeHandler);} else {Bangle.on("swipe",swipeHandler);}

0 commit comments

Comments
 (0)