diff --git a/apps/alarm/ChangeLog b/apps/alarm/ChangeLog index d7b8edc55..15afa790b 100644 --- a/apps/alarm/ChangeLog +++ b/apps/alarm/ChangeLog @@ -53,3 +53,5 @@ 0.48: Use datetimeinput for Events, if available. Scroll back when getting out of group. Menu date format setting for shorter dates on current year. 0.49: fix uncaught error if no scroller (Bangle 1). Would happen when trying to select an alarm in the main menu. +0.50: Bangle.js 2: Long touch of alarm in main menu toggle it on/off. Touching the icon on + the right will do the same. diff --git a/apps/alarm/README.md b/apps/alarm/README.md index 77aa61d2c..d7b64b3c2 100644 --- a/apps/alarm/README.md +++ b/apps/alarm/README.md @@ -20,6 +20,8 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master - `Disable All` → Disable _all_ enabled alarms & timers - `Delete All` → Delete _all_ alarms & timers +On Bangle.js 2 it's possible to toggle alarms, timers and events from the main menu. This is done by clicking the indicator icons of corresponding entries. Or long pressing anywhere on them. + ## Creator - [Gordon Williams](https://github.com/gfwilliams) @@ -29,6 +31,7 @@ It uses the [`sched` library](https://github.com/espruino/BangleApps/blob/master - [Alessandro Cocco](https://github.com/alessandrococco) - New UI, full rewrite, new features - [Sabin Iacob](https://github.com/m0n5t3r) - Auto snooze support - [storm64](https://github.com/storm64) - Fix redrawing in submenus +- [thyttan](https://github.com/thyttan) - Toggle alarms directly from main menu. ## Attributions diff --git a/apps/alarm/app.js b/apps/alarm/app.js index bec147f96..0318be6d3 100644 --- a/apps/alarm/app.js +++ b/apps/alarm/app.js @@ -88,13 +88,23 @@ function showMainMenu(scroll, group, scrollback) { const getGroups = settings.showGroup && !group; const groups = getGroups ? {} : undefined; var showAlarm; + const getIcon = (e)=>{return e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff);}; alarms.forEach((e, index) => { showAlarm = !settings.showGroup || (group ? e.group === group : !e.group); if(showAlarm) { - menu[trimLabel(getLabel(e),40)] = { - value: e.on ? (e.timer ? iconTimerOn : iconAlarmOn) : (e.timer ? iconTimerOff : iconAlarmOff), - onchange: () => setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller?scroller.scroll:undefined, group) + const label = trimLabel(getLabel(e),40); + menu[label] = { + value: e.on, + onchange: (v, touch) => { + if (touch && (2==touch.type || 145getIcon(e) }; } else if (getGroups) { groups[e.group] = undefined; diff --git a/apps/alarm/metadata.json b/apps/alarm/metadata.json index a8e22658c..17dd147e3 100644 --- a/apps/alarm/metadata.json +++ b/apps/alarm/metadata.json @@ -2,7 +2,7 @@ "id": "alarm", "name": "Alarms & Timers", "shortName": "Alarms", - "version": "0.49", + "version": "0.50", "description": "Set alarms and timers on your Bangle", "icon": "app.png", "tags": "tool,alarm",