diff --git a/apps/runplus/ChangeLog b/apps/runplus/ChangeLog index c3dfd9ffe..8c192de4f 100644 --- a/apps/runplus/ChangeLog +++ b/apps/runplus/ChangeLog @@ -29,5 +29,7 @@ Write to correct settings file, fixing settings not working. 0.26: Add ability to zoom in on a single stat by tapping it 0.27: Allow setting to alway resume an activity 0.28: Add vibration feedback on start/stop -0.29: Change the "time" stat to show active time (duration) rather than +0.29: Optimise UI: only redraw if we showed a recorder menu and correctly + track screen state +0.30: Change the "time" stat to show active time (duration) rather than elapsed time (fix #3802) diff --git a/apps/runplus/app.js b/apps/runplus/app.js index 219bdd14b..aa2e5f0d3 100644 --- a/apps/runplus/app.js +++ b/apps/runplus/app.js @@ -90,14 +90,18 @@ function onStartStop() { // an overwrite before we start tracking exstats if (settings.record && WIDGETS["recorder"]) { if (running) { - screen = "menu"; promise = promise. - then(() => WIDGETS["recorder"].setRecording(true, { force : shouldResume?"append":undefined })). then(() => { + screen = "menu"; + return WIDGETS["recorder"].setRecording(true, { force : shouldResume?"append":undefined }); + }).then(() => { screen = "main"; - layout.setUI(); // grab our input handling again - layout.forgetLazyState(); - layout.render(); + if(!shouldResume){ + // setRecording might have rendered - need to grab UI + layout.setUI(); // grab our input handling again + layout.forgetLazyState(); + layout.render(); + } }); } else { promise = promise.then( @@ -146,7 +150,7 @@ function zoom(statID) { .clearRect(R) .setFontAlign(0, 0); - layout.render(layout.bottom); + tick(); const value = exs.state.active ? stat.getString() : "____"; @@ -220,6 +224,20 @@ Bangle.on("GPS", function(fix) { } }); +const tick = () => { + layout.clock.label = locale.time(new Date(),1); + switch (screen) { + case "main": + layout.render(); + break; + case "zoom": + layout.render(layout.bottom); + break; + case "menu": + break; + } +}; + function setScreen(to) { if (screen === "karvonen") { require("runplus_karvonen").stop(); @@ -238,12 +256,8 @@ function setScreen(to) { layout.render(); layout.lazy = true; // We always call ourselves once a second to update - if (!runInterval){ - runInterval = setInterval(function() { - layout.clock.label = locale.time(new Date(),1); - if (screen !== "menu") layout.render(); - }, 1000); - } + if (!runInterval) + runInterval = setInterval(tick, 1000); break; case "karvonen": diff --git a/apps/runplus/metadata.json b/apps/runplus/metadata.json index 4c405b922..f26204123 100644 --- a/apps/runplus/metadata.json +++ b/apps/runplus/metadata.json @@ -1,7 +1,7 @@ { "id": "runplus", "name": "Run+", - "version": "0.29", + "version": "0.30", "description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screens for heart rate interval training and individual stat focus.", "icon": "app.png", "tags": "run,running,fitness,outdoors,gps,karvonen,karvonnen",