ActivityPoint: standardise on step length - remove stride handling

This commit is contained in:
Thomas Kuehne
2026-05-08 09:35:10 +00:00
parent e13a219efc
commit 7960835407
3 changed files with 2 additions and 64 deletions
@@ -76,7 +76,6 @@ public class DefaultWorkoutCharts {
final List<Entry> temperatureDataPoints = new ArrayList<>(initalCapacity);
final List<Entry> depthDataPoints = new ArrayList<>(initalCapacity);
final List<Entry> distancePoints = new ArrayList<>(initalCapacity);
final List<Entry> stridePoints = new ArrayList<>(initalCapacity);
final List<Entry> staminaPoints = new ArrayList<>(initalCapacity);
final List<Entry> bodyEnergyPoints = new ArrayList<>(initalCapacity);
final List<Entry> stepLengthPoints = new ArrayList<>(initalCapacity);
@@ -92,7 +91,6 @@ public class DefaultWorkoutCharts {
boolean hasTemperatureValues = false;
boolean hasDepthValues = false;
boolean hasDistanceValues = false;
boolean hasStrideValues = false;
boolean hasBodyEnergyValues = false;
boolean hasStaminaValues = false;
boolean hasStepLengthValues = false;
@@ -168,13 +166,6 @@ public class DefaultWorkoutCharts {
hasDistanceValues = hasDistanceValues || (distance > 0);
}
// Stride
final float stride = point.getStride();
if (stride >= 0.0f) {
stridePoints.add(new Entry(tsShorten, stride));
hasStrideValues = hasStrideValues || (stride > 0.0f);
}
// Body Energy
final float bodyEnergy = point.getBodyEnergy();
if (bodyEnergy >= 0.0f) {
@@ -247,10 +238,6 @@ public class DefaultWorkoutCharts {
charts.add(createDistanceChart(context, distancePoints));
}
if (hasStrideValues && !stridePoints.isEmpty()) {
charts.add(createStrideChart(context, stridePoints));
}
if (hasBodyEnergyValues && !bodyEnergyPoints.isEmpty()) {
charts.add(createBodyEnergyChart(context, bodyEnergyPoints));
}
@@ -486,26 +473,6 @@ public class DefaultWorkoutCharts {
);
}
private static WorkoutChart createStrideChart(final Context context,
final List<Entry> stridePoints) {
final String label = String.format("%s(%s)", context.getString(R.string.stride), getUnitString(context, UNIT_MM));
final LineDataSet dataset = createLineDataSet(context, stridePoints, label, ContextCompat.getColor(context, R.color.chart_line_stride));
final ValueFormatter valueFormatter = new ValueFormatter() {
@Override
public String getFormattedValue(float value) {
return String.valueOf((int) value);
}
};
return new WorkoutChart(
"chart_stride",
context.getString(R.string.stride),
ActivitySummaryEntries.GROUP_STEPS,
new LineData(dataset),
valueFormatter,
getUnitString(context, UNIT_MM)
);
}
private static WorkoutChart createBodyEnergyChart(final Context context,
final List<Entry> bodyEnergyPoints) {
final String label = String.format("%s(%s)", context.getString(R.string.body_energy), getUnitString(context, UNIT_PERCENTAGE));
@@ -27,7 +27,6 @@ public class ActivityPoint {
private GPSCoordinate location;
private int heartRate;
private float speed = -1;
private int stride = -1;
private int stepLength = -1;
private int cadence = -1;
private float power = -1;
@@ -145,12 +144,6 @@ public class ActivityPoint {
this.speed = speed;
}
/// distance from one foot landing to the same foot landing again
/// @see ActivitySummaryEntries#UNIT_MM
public int getStride() {
return stride;
}
/// distance from one foot landing to the opposite foot landing
/// @see ActivitySummaryEntries#UNIT_MM
public int getStepLength() {
@@ -210,7 +203,6 @@ public class ActivityPoint {
if (!(o instanceof ActivityPoint that)) return false;
return heartRate == that.heartRate &&
Float.compare(speed, that.speed) == 0 &&
stride == that.stride &&
cadence == that.cadence &&
Float.compare(power, that.power) == 0 &&
Float.compare(respiratoryRate, that.respiratoryRate) == 0 &&
@@ -227,7 +219,7 @@ public class ActivityPoint {
@Override
public int hashCode() {
return Objects.hash(time, location, heartRate, speed, stride, cadence, power, respiratoryRate, depth, temperature, description, distance, altitude, bodyEnergy, stamina);
return Objects.hash(time, location, heartRate, speed, cadence, power, respiratoryRate, depth, temperature, description, distance, altitude, bodyEnergy, stamina);
}
public static class Builder {
@@ -245,7 +237,6 @@ public class ActivityPoint {
private int heartRate = Integer.MIN_VALUE;
private float speed = Float.NaN;
private int stride = Integer.MIN_VALUE;
private int stepLength = Integer.MIN_VALUE;
private int cadence = Integer.MIN_VALUE;
private float power = Float.NaN;
@@ -349,23 +340,6 @@ public class ActivityPoint {
this.speed = speed;
}
/// @see ActivitySummaryEntries#UNIT_MM
public int getStride() {
return stride;
}
/// distance from one foot landing to the same foot landing again
/// @see ActivitySummaryEntries#UNIT_MM
public void setStride(@Nullable Number stride) {
this.stride = (stride == null) ? Integer.MIN_VALUE : stride.intValue();
}
/// distance from one foot landing to the same foot landing again
/// @see ActivitySummaryEntries#UNIT_MM
public void setStride(int stride) {
this.stride = stride;
}
public int getCadence() {
return cadence;
}
@@ -564,9 +538,6 @@ public class ActivityPoint {
if (cadence > Integer.MIN_VALUE) {
activityPoint.setCadence(cadence);
}
if (stride > Integer.MIN_VALUE) {
activityPoint.stride = stride;
}
if (!Float.isNaN(power)) {
activityPoint.setPower(power);
}
@@ -316,7 +316,7 @@ public class ZeppOsActivityDetailsParser extends AbstractHuamiActivityDetailsPar
final short pace = buf.getShort(); // sec/km
activityPointBuilder.setCadence(cadence);
activityPointBuilder.setStride(stride * 10.0f);
activityPointBuilder.setStepLength(stride / 2.0f * 10.0f); // stride cm -> step mm
if (pace != 0) {
activityPointBuilder.setSpeed(1000f / pace); // s/km -> m/s
}