TrackPoint has Location as delegate instead of inheritance.

This commit is contained in:
Dennis Guse
2020-03-29 12:30:16 +02:00
parent 901cffee97
commit 194379295d
25 changed files with 288 additions and 184 deletions
@@ -755,7 +755,7 @@ public class ContentProviderUtils {
* @param cursor the cursor pointing to the location
*/
public TrackPoint createTrackPoint(Cursor cursor) {
TrackPoint location = new TrackPoint("");
TrackPoint location = new TrackPoint();
fillTrackPoint(cursor, new CachedTrackPointsIndexes(cursor), location);
return location;
}
@@ -1,5 +1,6 @@
package de.dennisguse.opentracks.content.provider;
import android.location.Location;
import android.location.LocationManager;
import de.dennisguse.opentracks.content.data.TrackPoint;
@@ -16,6 +17,6 @@ public class TrackPointFactory {
public static final TrackPointFactory DEFAULT_LOCATION_FACTORY = new TrackPointFactory();
public TrackPoint create() {
return new TrackPoint(LocationManager.GPS_PROVIDER);
return new TrackPoint(new Location(LocationManager.GPS_PROVIDER));
}
}
@@ -18,7 +18,7 @@ public class TrackPointIterator implements Iterator<TrackPoint>, AutoCloseable {
private final ContentProviderUtils contentProviderUtils;
private final long trackId;
private final boolean descending;
private final TrackPointFactory trackPointFactory;
private final TrackPointFactory trackPointFactory; //TODO Remove; seems to be an old performance optimization.
private final CachedTrackPointsIndexes indexes;
private long lastTrackPointId = -1L;
private Cursor cursor;