Commit fbd75360 authored by Bart Mathijssen's avatar Bart Mathijssen Committed by Susan Rati Lane

Remove Redundant Pedometer Resume and Pause methods (#1907)

parent b319e0b9
......@@ -1625,6 +1625,10 @@ public final class YoungAndroidFormUpgrader {
// The GPS related functionality was removed.
srcCompVersion = 2;
}
if (srcCompVersion < 3) {
// The Resume and Pause methods were removed.
srcCompVersion = 3;
}
return srcCompVersion;
}
......
......@@ -2122,7 +2122,10 @@ Blockly.Versioning.AllUpgradeMaps =
// AI2: The step sensing algorithm was updated to be more accurate.
// The GPS related functionality was removed.
2: "noUpgrade"
2: "noUpgrade",
// AI2: The Resume and Pause methods were removed.
3: "noUpgrade"
}, // End PhoneCall upgraders
......
......@@ -484,8 +484,10 @@ public class YaVersion {
// - POLYGON_COMPONENT_VERSION was incremented to 2
// - RECTANGLE_COMPONENT_VERSION was incremented to 2
// - TEXTBOX_COMPONENT_VERSION was incremented to 6
// For YOUNG_ANDROID_VERSION 195:
// - PEDOMETER_COMPONENT_VERSION was incremented to 2
public static final int YOUNG_ANDROID_VERSION = 194;
public static final int YOUNG_ANDROID_VERSION = 195;
// ............................... Blocks Language Version Number ...............................
......@@ -1032,7 +1034,9 @@ public class YaVersion {
// For PEDOMETER_COMPONENT_VERSION 2:
// - The step sensing algorithm was updated to be more accurate.
// - The GPS related functionality was removed.
public static final int PEDOMETER_COMPONENT_VERSION = 2;
// For PEDOMETER_COMPONENT_VERSION 3:
// - The Resume and Pause methods were removed.
public static final int PEDOMETER_COMPONENT_VERSION = 3;
// For PHONECALL_COMPONENT_VERSION 2:
// - The PhoneCallStarted event was added.
......
......@@ -117,7 +117,12 @@ public class Pedometer extends AndroidNonvisibleComponent
*/
@SimpleFunction(description = "Stop counting steps")
public void Stop() {
Pause();
if (!pedometerPaused) {
pedometerPaused = true;
sensorManager.unregisterListener(this);
Log.d(TAG, "Unregistered listener on pause");
prevStopClockTime += (System.currentTimeMillis() - startTime);
}
}
/**
......@@ -135,6 +140,7 @@ public class Pedometer extends AndroidNonvisibleComponent
/**
* Resumes the counting of steps.
*/
@Deprecated
@SimpleFunction(description = "Resumes counting, synonym of Start.")
public void Resume() {
Start();
......@@ -143,14 +149,10 @@ public class Pedometer extends AndroidNonvisibleComponent
/**
* Pauses the counting of steps.
*/
@Deprecated
@SimpleFunction(description = "Pause counting of steps and distance.")
public void Pause() {
if (!pedometerPaused) {
pedometerPaused = true;
sensorManager.unregisterListener(this);
Log.d(TAG, "Unregistered listener on pause");
prevStopClockTime += (System.currentTimeMillis() - startTime);
}
Stop();
}
/**
......
......@@ -960,12 +960,8 @@ none
<h3>Methods</h3>
<dl>
<dt><code>Pause()</code></dt>
<dd>Pause counting of steps and distance.</dd>
<dt><code>Reset()</code></dt>
<dd>Resets the step counter, distance measure and time running.</dd>
<dt><code>Resume()</code></dt>
<dd>Resumes counting, synonym of Start.</dd>
<dt><code>Save()</code></dt>
<dd>Saves the pedometer state to the phone. Permits permits accumulation of steps and distance between invocations of an App that uses the pedometer. Different Apps will have their own saved state.</dd>
<dt><code>Start()</code></dt>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment