Skip to content
Permalink
Browse files

Remove Redundant Pedometer Resume and Pause methods (#1907)

  • Loading branch information
bartmathijssen authored and SusanRatiLane committed Nov 28, 2019
1 parent b319e0b commit fbd75360e1df2daca9076342aabdc463d4e7f359
@@ -1625,6 +1625,10 @@ private static int upgradePedometerProperties(Map<String, JSONValue> componentPr
// 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 @@ private 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 @@ private 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 void Start() {
*/
@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 void Reset() {
/**
* Resumes the counting of steps.
*/
@Deprecated
@SimpleFunction(description = "Resumes counting, synonym of Start.")
public void Resume() {
Start();
@@ -143,14 +149,10 @@ public void Resume() {
/**
* 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 @@ <h3>Events</h3>

<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>

0 comments on commit fbd7536

Please sign in to comment.
You can’t perform that action at this time.