Hide the first stats waypoint.

This commit is contained in:
Sandor Dornbush
2011-02-22 16:52:22 -08:00
parent 10cd26af5e
commit e829f1fc1b
2 changed files with 12 additions and 2 deletions
@@ -201,7 +201,10 @@ public class MyTracksMap extends MapActivity
MyTracksConstants.MAX_DISPLAYED_WAYPOINTS_POINTS); MyTracksConstants.MAX_DISPLAYED_WAYPOINTS_POINTS);
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
do { do {
mapOverlay.addWaypoint(providerUtils.createWaypoint(cursor)); Waypoint waypoint = providerUtils.createWaypoint(cursor);
if (MyTracksUtils.isValidLocation(waypoint.getLocation())) {
mapOverlay.addWaypoint(waypoint);
}
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
@@ -897,7 +897,14 @@ public class TrackRecordingService extends Service implements LocationListener {
} }
wpt.setTrackId(recordingTrackId); wpt.setTrackId(recordingTrackId);
wpt.setLength(length); wpt.setLength(length);
if (lastValidLocation != null) { if (lastValidLocation == null) {
// A null location is ok, and expected on track start.
// Make it an impossible location.
Location l = new Location("");
l.setLatitude(100);
l.setLongitude(200);
wpt.setLocation(l);
} else {
// A null location is ok, and expected on track start. // A null location is ok, and expected on track start.
wpt.setLocation(lastLocation); wpt.setLocation(lastLocation);
wpt.setDuration(lastLocation.getTime() wpt.setDuration(lastLocation.getTime()