diff --git a/resources/properties.xml b/resources/properties.xml index ac176b8..383e339 100644 --- a/resources/properties.xml +++ b/resources/properties.xml @@ -46,7 +46,7 @@ - 6.1.0 + 6.1.1 Timer field Timer Moving time diff --git a/source/FlexiRunnerApp-rectangle-148x205.mc b/source/FlexiRunnerApp-rectangle-148x205.mc index 0297a87..c337f18 100644 --- a/source/FlexiRunnerApp-rectangle-148x205.mc +++ b/source/FlexiRunnerApp-rectangle-148x205.mc @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { //! Timer transitions from stopped to running state function onTimerStart() { - var info = Activity.getActivityInfo(); - //! If the start/stop button was last pushed less than 1.5 seconds ago, - //! toggle the force backlight feature (see in compute(), above). - //! That is, press the start/stop button twice in quick succession - //! to make the backlight stay on, or revert to the normal timeout - //! setting as configured on the watch. - if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) { - uBacklight = !uBacklight; - } - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = true; } //! Timer transitions from running to stopped state function onTimerStop() { - var info = Activity.getActivityInfo(); - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = false; } @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { } + //! Start/stop button was pushed - emulated via timer start/stop + //! If the button was double pressed quickly, toggle + //! the force backlight feature (see in compute(), above). + function startStopPushed() { + var info = Activity.getActivityInfo(); + var doublePressTimeMs = null; + if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) { + doublePressTimeMs = info.elapsedTime - mStartStopPushed; + } + if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) { + uBacklight = !uBacklight; + } + mStartStopPushed = info.elapsedTime; + } + + //! Current activity is ended function onTimerReset() { mStoppedTime = 0; diff --git a/source/FlexiRunnerApp-rectangle-205x148.mc b/source/FlexiRunnerApp-rectangle-205x148.mc index c52012b..e1a9f46 100644 --- a/source/FlexiRunnerApp-rectangle-205x148.mc +++ b/source/FlexiRunnerApp-rectangle-205x148.mc @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { //! Timer transitions from stopped to running state function onTimerStart() { - var info = Activity.getActivityInfo(); - //! If the start/stop button was last pushed less than 1.5 seconds ago, - //! toggle the force backlight feature (see in compute(), above). - //! That is, press the start/stop button twice in quick succession - //! to make the backlight stay on, or revert to the normal timeout - //! setting as configured on the watch. - if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) { - uBacklight = !uBacklight; - } - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = true; } //! Timer transitions from running to stopped state function onTimerStop() { - var info = Activity.getActivityInfo(); - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = false; } @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { } + //! Start/stop button was pushed - emulated via timer start/stop + //! If the button was double pressed quickly, toggle + //! the force backlight feature (see in compute(), above). + function startStopPushed() { + var info = Activity.getActivityInfo(); + var doublePressTimeMs = null; + if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) { + doublePressTimeMs = info.elapsedTime - mStartStopPushed; + } + if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) { + uBacklight = !uBacklight; + } + mStartStopPushed = info.elapsedTime; + } + + //! Current activity is ended function onTimerReset() { mStoppedTime = 0; diff --git a/source/FlexiRunnerApp-round.mc b/source/FlexiRunnerApp-round.mc index 53c3781..f790fdc 100644 --- a/source/FlexiRunnerApp-round.mc +++ b/source/FlexiRunnerApp-round.mc @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { //! Timer transitions from stopped to running state function onTimerStart() { - var info = Activity.getActivityInfo(); - //! If the start/stop button was last pushed less than 1.5 seconds ago, - //! toggle the force backlight feature (see in compute(), above). - //! That is, press the start/stop button twice in quick succession - //! to make the backlight stay on, or revert to the normal timeout - //! setting as configured on the watch. - if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) { - uBacklight = !uBacklight; - } - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = true; } //! Timer transitions from running to stopped state function onTimerStop() { - var info = Activity.getActivityInfo(); - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = false; } @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { } + //! Start/stop button was pushed - emulated via timer start/stop + //! If the button was double pressed quickly, toggle + //! the force backlight feature (see in compute(), above). + function startStopPushed() { + var info = Activity.getActivityInfo(); + var doublePressTimeMs = null; + if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) { + doublePressTimeMs = info.elapsedTime - mStartStopPushed; + } + if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) { + uBacklight = !uBacklight; + } + mStartStopPushed = info.elapsedTime; + } + + //! Current activity is ended function onTimerReset() { mStoppedTime = 0; diff --git a/source/FlexiRunnerApp-semiround.mc b/source/FlexiRunnerApp-semiround.mc index 8cc23e6..73c9806 100644 --- a/source/FlexiRunnerApp-semiround.mc +++ b/source/FlexiRunnerApp-semiround.mc @@ -202,24 +202,14 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { //! Timer transitions from stopped to running state function onTimerStart() { - var info = Activity.getActivityInfo(); - //! If the start/stop button was last pushed less than 1.5 seconds ago, - //! toggle the force backlight feature (see in compute(), above). - //! That is, press the start/stop button twice in quick succession - //! to make the backlight stay on, or revert to the normal timeout - //! setting as configured on the watch. - if ( ( info.elapsedTime > 0 ) && ( (info.elapsedTime - mStartStopPushed) < 1500 ) ) { - uBacklight = !uBacklight; - } - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = true; } //! Timer transitions from running to stopped state function onTimerStop() { - var info = Activity.getActivityInfo(); - mStartStopPushed = info.elapsedTime; + startStopPushed(); mTimerRunning = false; } @@ -236,6 +226,22 @@ class FlexiRunnerView extends Toybox.WatchUi.DataField { } + //! Start/stop button was pushed - emulated via timer start/stop + //! If the button was double pressed quickly, toggle + //! the force backlight feature (see in compute(), above). + function startStopPushed() { + var info = Activity.getActivityInfo(); + var doublePressTimeMs = null; + if ( mStartStopPushed > 0 && info.elapsedTime > 0 ) { + doublePressTimeMs = info.elapsedTime - mStartStopPushed; + } + if ( doublePressTimeMs != null && doublePressTimeMs < 1000 ) { + uBacklight = !uBacklight; + } + mStartStopPushed = info.elapsedTime; + } + + //! Current activity is ended function onTimerReset() { mStoppedTime = 0;