From ddbaf97b7dd0510a9aa5fdcac1cbeea6b5968064 Mon Sep 17 00:00:00 2001 From: Joseph Moroney Date: Sat, 29 Jan 2022 08:37:46 +1000 Subject: [PATCH] patch - call `Bangle.setUI` when exiting settings --- apps/sonicclk/Changelog | 7 ++++--- apps/sonicclk/README.md | 2 +- apps/sonicclk/app.js | 21 ++++++++++++--------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/sonicclk/Changelog b/apps/sonicclk/Changelog index 4f597b627..050e18b5a 100644 --- a/apps/sonicclk/Changelog +++ b/apps/sonicclk/Changelog @@ -1,3 +1,4 @@ -1.00 Added sonic clock app -1.01 Fixed text alignment issue; Increased acceleration required to activate twist; -1.10 Added settings menu to control twist threshold and LCD Activity \ No newline at end of file +1.00 [MAJOR] Added sonic clock app +1.01 [PATCH] Fixed text alignment issue; Increased acceleration required to activate twist; +1.10 [MINOR] Added settings menu to control twist threshold and LCD Activity +1.11 [PATCH] Call `Bangle.setUI` when exiting settings menu, settings tap moved to top \ No newline at end of file diff --git a/apps/sonicclk/README.md b/apps/sonicclk/README.md index adfbf47b4..54de16115 100644 --- a/apps/sonicclk/README.md +++ b/apps/sonicclk/README.md @@ -12,7 +12,7 @@ A classic sonic clock featuring run, stop and wait animations. ## Configuration -To access the settings menu, you can **double tap** on the **right** side of the watch. The following options are configurable: +To access the settings menu, you can **double tap** on the **top** side of the watch. The following options are configurable: - `Active Mode` - catering for 'active' behaviour where the `twist` method can be fired undesirably. When `on` this will prevent the LCD from turning on when a `twist` event is fired. - `Twist Thresh` - customise the acceleration needed to activate the twist method (see the [`Bangle.setOptions`](https://www.espruino.com/Reference#:~:text=twisted%3F%20default%20%3D%20true-,twistThreshold,-How%20much%20acceleration) method for more info). diff --git a/apps/sonicclk/app.js b/apps/sonicclk/app.js index b12af48fd..1fae353ca 100644 --- a/apps/sonicclk/app.js +++ b/apps/sonicclk/app.js @@ -264,18 +264,20 @@ const settings = require("Storage").readJSON("sonicclk-settings") || { let isSettings = false; const settingsMenu = { - "": { "title": "Settings" }, + "": { title: "Settings" }, "Active Mode": { value: settings.activeMode, - format: v => v ? "On" : "Off", - onchange: v => settings.activeMode = v, + format: (v) => (v ? "On" : "Off"), + onchange: (v) => (settings.activeMode = v), }, - "Twist Thresh" : { + "Twist Thresh": { value: settings.twistThreshold, - min: 800, max: 4000, step: 200, - onchange: v => settings.twistThreshold = v, + min: 800, + max: 4000, + step: 200, + onchange: (v) => (settings.twistThreshold = v), }, - "Exit" : () => { + Exit: () => { isSettings = false; require("Storage").writeJSON("sonicclk-settings", settings); @@ -286,9 +288,10 @@ const settingsMenu = { }); E.showMenu(); + Bangle.setUI("clock"); draw("reset"); start(); - } + }, }; g.setTheme({ bg: "#0099ff", fg: "#fff", dark: true }).clear(); @@ -313,7 +316,7 @@ Bangle.on("twist", () => { }); Bangle.on("tap", (d) => { - if (d.double && d.dir === "right") { + if (d.double && d.dir === "top") { fullReset(); isSettings = true; Bangle.setLocked(false);