#facepalm I confused minus with plus - incorrect and negative(!) step counts were possible

This commit is contained in:
y20k 2018-01-22 18:50:06 +01:00
parent 1584eac152
commit 6fbbd325c0
2 changed files with 4 additions and 4 deletions

View file

@ -184,9 +184,9 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
@Override @Override
public void onSensorChanged(SensorEvent sensorEvent) { public void onSensorChanged(SensorEvent sensorEvent) {
// save the step count offset (steps previously recorded by the system) and add any steps recorded during this session in case the app was killed // save the step count offset (steps previously recorded by the system) and subtract any steps recorded during this session in case the app was killed
if (mStepCountOffset == 0) { if (mStepCountOffset == 0) {
mStepCountOffset = sensorEvent.values[0] - 1 + mTrack.getStepCount(); mStepCountOffset = (sensorEvent.values[0] - 1) - mTrack.getStepCount();
} }
// calculate step count // calculate step count

View file

@ -21,8 +21,8 @@ allprojects {
} }
project.ext { project.ext {
applicationId = 'org.y20k.trackbook' applicationId = 'org.y20k.trackbook'
versionCode = 17 versionCode = 18
versionName = '1.1.1' versionName = '1.1.2'
minSdkVersion = 22 minSdkVersion = 22
compileSdkVersion = 27 compileSdkVersion = 27
targetSdkVersion = 27 targetSdkVersion = 27