forked from upstream-mirrors/OpenTracks
Remove the parameter of updateCalorie method of TrackRecordingService. Re-calculate the calorie of track and last marker in TrackRecordingService.
This commit is contained in:
+15
-4
@@ -24,6 +24,7 @@ import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
import com.google.android.apps.mytracks.stats.TripStatisticsUpdater;
|
||||
import com.google.android.apps.mytracks.util.CalorieUtils;
|
||||
import com.google.android.apps.mytracks.util.FileUtils;
|
||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
@@ -241,9 +242,16 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
|
||||
// No more track points. Ignore the rest of the waypoints.
|
||||
return;
|
||||
}
|
||||
trackTripStatisticstrackUpdater.addLocation(trackPoint, recordingDistanceInterval,
|
||||
context);
|
||||
markerTripStatisticsUpdater.addLocation(trackPoint, recordingDistanceInterval, context);
|
||||
trackTripStatisticstrackUpdater.addLocation(trackPoint, recordingDistanceInterval, false,
|
||||
CalorieUtils.getActivityType(context,
|
||||
PreferencesUtils.getLong(context, R.string.recording_track_id_key)),
|
||||
PreferencesUtils.getInt(context, R.string.stats_weight_key,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT));
|
||||
markerTripStatisticsUpdater.addLocation(trackPoint, recordingDistanceInterval, false,
|
||||
CalorieUtils.getActivityType(context,
|
||||
PreferencesUtils.getLong(context, R.string.recording_track_id_key)),
|
||||
PreferencesUtils.getInt(context, R.string.stats_weight_key,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT));
|
||||
}
|
||||
if (waypoint.getLocation().getTime() > trackPoint.getTime()) {
|
||||
trackPoint = null;
|
||||
@@ -546,7 +554,10 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
|
||||
trackData.tripStatisticsUpdater = new TripStatisticsUpdater(
|
||||
location.getTime() != -1L ? location.getTime() : trackData.importTime);
|
||||
}
|
||||
trackData.tripStatisticsUpdater.addLocation(location, recordingDistanceInterval, context);
|
||||
trackData.tripStatisticsUpdater.addLocation(location, recordingDistanceInterval, false,
|
||||
CalorieUtils.getActivityType(context,
|
||||
PreferencesUtils.getLong(context, R.string.recording_track_id_key)), PreferencesUtils
|
||||
.getInt(context, R.string.stats_weight_key, PreferencesUtils.STATS_WEIGHT_DEFAULT));
|
||||
|
||||
trackData.bufferedLocations[trackData.numBufferedLocations] = location;
|
||||
trackData.numBufferedLocations++;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.google.android.apps.mytracks.io.gdata.maps.XmlMapsGDataParserFactory;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendToGoogleUtils;
|
||||
import com.google.android.apps.mytracks.stats.TripStatisticsUpdater;
|
||||
import com.google.android.apps.mytracks.util.CalorieUtils;
|
||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.common.gdata.AndroidXmlParserFactory;
|
||||
@@ -277,7 +278,11 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask {
|
||||
sentStartMarker = true;
|
||||
}
|
||||
|
||||
tripStatisticsUpdater.addLocation(location, recordingDistanceInterval, context);
|
||||
tripStatisticsUpdater.addLocation(location, recordingDistanceInterval, false, CalorieUtils
|
||||
.getActivityType(context,
|
||||
PreferencesUtils.getLong(context, R.string.recording_track_id_key)),
|
||||
PreferencesUtils.getInt(context, R.string.stats_weight_key,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT));
|
||||
if (i % elevationSamplingFrequency == 0) {
|
||||
distances.add(tripStatisticsUpdater.getTripStatistics().getTotalDistance());
|
||||
elevations.add(tripStatisticsUpdater.getSmoothedElevation());
|
||||
|
||||
Reference in New Issue
Block a user