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 { ...@@ -1625,6 +1625,10 @@ public final class YoungAndroidFormUpgrader {
// The GPS related functionality was removed. // The GPS related functionality was removed.
srcCompVersion = 2; srcCompVersion = 2;
} }
if (srcCompVersion < 3) {
// The Resume and Pause methods were removed.
srcCompVersion = 3;
}
return srcCompVersion; return srcCompVersion;
} }
......
...@@ -2122,7 +2122,10 @@ Blockly.Versioning.AllUpgradeMaps = ...@@ -2122,7 +2122,10 @@ Blockly.Versioning.AllUpgradeMaps =
// AI2: The step sensing algorithm was updated to be more accurate. // AI2: The step sensing algorithm was updated to be more accurate.
// The GPS related functionality was removed. // The GPS related functionality was removed.
2: "noUpgrade" 2: "noUpgrade",
// AI2: The Resume and Pause methods were removed.
3: "noUpgrade"
}, // End PhoneCall upgraders }, // End PhoneCall upgraders
......
...@@ -484,8 +484,10 @@ public class YaVersion { ...@@ -484,8 +484,10 @@ public class YaVersion {
// - POLYGON_COMPONENT_VERSION was incremented to 2 // - POLYGON_COMPONENT_VERSION was incremented to 2
// - RECTANGLE_COMPONENT_VERSION was incremented to 2 // - RECTANGLE_COMPONENT_VERSION was incremented to 2
// - TEXTBOX_COMPONENT_VERSION was incremented to 6 // - 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 ............................... // ............................... Blocks Language Version Number ...............................
...@@ -1032,7 +1034,9 @@ public class YaVersion { ...@@ -1032,7 +1034,9 @@ public class YaVersion {
// For PEDOMETER_COMPONENT_VERSION 2: // For PEDOMETER_COMPONENT_VERSION 2:
// - The step sensing algorithm was updated to be more accurate. // - The step sensing algorithm was updated to be more accurate.
// - The GPS related functionality was removed. // - 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: // For PHONECALL_COMPONENT_VERSION 2:
// - The PhoneCallStarted event was added. // - The PhoneCallStarted event was added.
......
...@@ -117,7 +117,12 @@ public class Pedometer extends AndroidNonvisibleComponent ...@@ -117,7 +117,12 @@ public class Pedometer extends AndroidNonvisibleComponent
*/ */
@SimpleFunction(description = "Stop counting steps") @SimpleFunction(description = "Stop counting steps")
public void Stop() { 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 ...@@ -135,6 +140,7 @@ public class Pedometer extends AndroidNonvisibleComponent
/** /**
* Resumes the counting of steps. * Resumes the counting of steps.
*/ */
@Deprecated
@SimpleFunction(description = "Resumes counting, synonym of Start.") @SimpleFunction(description = "Resumes counting, synonym of Start.")
public void Resume() { public void Resume() {
Start(); Start();
...@@ -143,14 +149,10 @@ public class Pedometer extends AndroidNonvisibleComponent ...@@ -143,14 +149,10 @@ public class Pedometer extends AndroidNonvisibleComponent
/** /**
* Pauses the counting of steps. * Pauses the counting of steps.
*/ */
@Deprecated
@SimpleFunction(description = "Pause counting of steps and distance.") @SimpleFunction(description = "Pause counting of steps and distance.")
public void Pause() { public void Pause() {
if (!pedometerPaused) { Stop();
pedometerPaused = true;
sensorManager.unregisterListener(this);
Log.d(TAG, "Unregistered listener on pause");
prevStopClockTime += (System.currentTimeMillis() - startTime);
}
} }
/** /**
......
...@@ -960,12 +960,8 @@ none ...@@ -960,12 +960,8 @@ none
<h3>Methods</h3> <h3>Methods</h3>
<dl> <dl>
<dt><code>Pause()</code></dt>
<dd>Pause counting of steps and distance.</dd>
<dt><code>Reset()</code></dt> <dt><code>Reset()</code></dt>
<dd>Resets the step counter, distance measure and time running.</dd> <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> <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> <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> <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