mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
Removed unused Waypoint.TripStatistics.
This commit is contained in:
@@ -71,12 +71,9 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
for (int i = 0; i < cursor.getCount(); i++) {
|
||||
Waypoint currentMarker = contentProviderUtils.createWaypoint(cursor);
|
||||
|
||||
if (!currentMarker.isTripStatistics()) {
|
||||
markerIds.add(currentMarker.getId());
|
||||
if (currentMarker.getId() == markerId) {
|
||||
markerIndex = markerIds.size() - 1;
|
||||
}
|
||||
markerIds.add(currentMarker.getId());
|
||||
if (currentMarker.getId() == markerId) {
|
||||
markerIndex = markerIds.size() - 1;
|
||||
}
|
||||
|
||||
cursor.moveToNext();
|
||||
|
||||
@@ -518,9 +518,6 @@ public class ContentProviderUtils {
|
||||
tripStatistics.setMaxGrade(cursor.getFloat(maxGradeIndex));
|
||||
hasTripStatistics = true;
|
||||
}
|
||||
if (hasTripStatistics) {
|
||||
waypoint.setTripStatistics(tripStatistics);
|
||||
}
|
||||
|
||||
if (!cursor.isNull(photoUrlIndex)) {
|
||||
waypoint.setPhotoUrl(cursor.getString(photoUrlIndex));
|
||||
@@ -742,22 +739,6 @@ public class ContentProviderUtils {
|
||||
}
|
||||
}
|
||||
|
||||
TripStatistics tripStatistics = waypoint.getTripStatistics();
|
||||
if (tripStatistics != null) {
|
||||
values.put(WaypointsColumns.STARTTIME, tripStatistics.getStartTime());
|
||||
values.put(WaypointsColumns.TOTALDISTANCE, tripStatistics.getTotalDistance());
|
||||
values.put(WaypointsColumns.TOTALTIME, tripStatistics.getTotalTime());
|
||||
values.put(WaypointsColumns.MOVINGTIME, tripStatistics.getMovingTime());
|
||||
values.put(WaypointsColumns.AVGSPEED, tripStatistics.getAverageSpeed());
|
||||
values.put(WaypointsColumns.AVGMOVINGSPEED, tripStatistics.getAverageMovingSpeed());
|
||||
values.put(WaypointsColumns.MAXSPEED, tripStatistics.getMaxSpeed());
|
||||
values.put(WaypointsColumns.MINELEVATION, tripStatistics.getMinElevation());
|
||||
values.put(WaypointsColumns.MAXELEVATION, tripStatistics.getMaxElevation());
|
||||
values.put(WaypointsColumns.ELEVATIONGAIN, tripStatistics.getTotalElevationGain());
|
||||
values.put(WaypointsColumns.MINGRADE, tripStatistics.getMinGrade());
|
||||
values.put(WaypointsColumns.MAXGRADE, tripStatistics.getMaxGrade());
|
||||
}
|
||||
|
||||
values.put(WaypointsColumns.PHOTOURL, waypoint.getPhotoUrl());
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ package de.dennisguse.opentracks.content.data;
|
||||
import android.location.Location;
|
||||
import android.net.Uri;
|
||||
|
||||
import de.dennisguse.opentracks.stats.TripStatistics;
|
||||
|
||||
/**
|
||||
* A waypoint.
|
||||
*
|
||||
@@ -38,13 +36,12 @@ public final class Waypoint {
|
||||
private double length = 0.0;
|
||||
private long duration = 0;
|
||||
private Location location = null;
|
||||
private TripStatistics tripStatistics = null;
|
||||
private String photoUrl = "";
|
||||
|
||||
public Waypoint() {
|
||||
}
|
||||
|
||||
public Waypoint(String name, String description, String category, String icon, long trackId, double length, long duration, Location location, TripStatistics tripStatistics, String photoUrl) {
|
||||
public Waypoint(String name, String description, String category, String icon, long trackId, double length, long duration, Location location, String photoUrl) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.category = category;
|
||||
@@ -53,7 +50,6 @@ public final class Waypoint {
|
||||
this.length = length;
|
||||
this.duration = duration;
|
||||
this.location = location;
|
||||
this.tripStatistics = tripStatistics;
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
|
||||
@@ -129,18 +125,6 @@ public final class Waypoint {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public boolean isTripStatistics() {
|
||||
return tripStatistics != null;
|
||||
}
|
||||
|
||||
public TripStatistics getTripStatistics() {
|
||||
return tripStatistics;
|
||||
}
|
||||
|
||||
public void setTripStatistics(TripStatistics tripStatistics) {
|
||||
this.tripStatistics = tripStatistics;
|
||||
}
|
||||
|
||||
public String getPhotoUrl() {
|
||||
return photoUrl;
|
||||
}
|
||||
|
||||
@@ -108,9 +108,7 @@ public class FileTrackExporter implements TrackExporter {
|
||||
hasWaypoints = true;
|
||||
}
|
||||
Waypoint waypoint = contentProviderUtils.createWaypoint(cursor);
|
||||
if (!waypoint.isTripStatistics()) {
|
||||
trackWriter.writeWaypoint(waypoint);
|
||||
}
|
||||
trackWriter.writeWaypoint(waypoint);
|
||||
|
||||
cursor.moveToNext();
|
||||
}
|
||||
|
||||
+1
-4
@@ -44,7 +44,6 @@ import de.dennisguse.opentracks.content.LocationIterator;
|
||||
import de.dennisguse.opentracks.content.data.Track;
|
||||
import de.dennisguse.opentracks.content.data.Waypoint;
|
||||
import de.dennisguse.opentracks.services.TrackRecordingService;
|
||||
import de.dennisguse.opentracks.stats.TripStatistics;
|
||||
import de.dennisguse.opentracks.stats.TripStatisticsUpdater;
|
||||
import de.dennisguse.opentracks.util.FileUtils;
|
||||
import de.dennisguse.opentracks.util.LocationUtils;
|
||||
@@ -200,15 +199,13 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
|
||||
|
||||
// Valid location
|
||||
if (location.getLatitude() == waypoint.getLocation().getLatitude() && location.getLongitude() == waypoint.getLocation().getLongitude()) {
|
||||
|
||||
TripStatistics tripStatistics = null;
|
||||
String waypointDescription = waypoint.getDescription();
|
||||
String icon = context.getString(R.string.marker_waypoint_icon_url);
|
||||
double length = trackTripStatisticstrackUpdater.getTripStatistics().getTotalDistance();
|
||||
long duration = trackTripStatisticstrackUpdater.getTripStatistics().getTotalTime();
|
||||
|
||||
// Insert waypoint
|
||||
Waypoint newWaypoint = new Waypoint(waypoint.getName(), waypointDescription, waypoint.getCategory(), icon, track.getId(), length, duration, location, tripStatistics, waypoint.getPhotoUrl());
|
||||
Waypoint newWaypoint = new Waypoint(waypoint.getName(), waypointDescription, waypoint.getCategory(), icon, track.getId(), length, duration, location, waypoint.getPhotoUrl());
|
||||
contentProviderUtils.insertWaypoint(newWaypoint);
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ public class TrackRecordingService extends Service {
|
||||
long duration = stats.getTotalTime();
|
||||
|
||||
// Insert waypoint
|
||||
Waypoint waypoint = new Waypoint(name, description, category, icon, recordingTrackId, length, duration, location, null, photoUrl);
|
||||
Waypoint waypoint = new Waypoint(name, description, category, icon, recordingTrackId, length, duration, location, photoUrl);
|
||||
Uri uri = contentProviderUtils.insertWaypoint(waypoint);
|
||||
return Long.parseLong(uri.getLastPathSegment());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user