Display all segments of the current recording track in the same colour

Previously, when selecting a custom colour for the current recording track,
any new track segments after the first one were displayed in the default
GPX colour, not the custom colour.
This commit is contained in:
njohnston 2017-02-04 19:01:44 +00:00
parent e631c9c552
commit 164dc6ff1a

View file

@ -417,13 +417,14 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
private void addTrackPoint(WptPt pt, boolean newSegment, long time) { private void addTrackPoint(WptPt pt, boolean newSegment, long time) {
List<TrkSegment> points = currentTrack.getModifiablePointsToDisplay(); List<TrkSegment> points = currentTrack.getModifiablePointsToDisplay();
Track track = currentTrack.getGpxFile().tracks.get(0); Track track = currentTrack.getModifiableGpxFile().tracks.get(0);
assert track.segments.size() == points.size(); assert track.segments.size() == points.size();
if (points.size() == 0 || newSegment) { if (points.size() == 0 || newSegment) {
points.add(new TrkSegment()); points.add(new TrkSegment());
} }
if(track.segments.size() == 0 || newSegment) { if(track.segments.size() == 0 || newSegment) {
track.segments.add(new TrkSegment()); track.segments.add(new TrkSegment());
currentTrack.processPoints();
} }
if (pt != null) { if (pt != null) {
int ind = points.size() - 1; int ind = points.size() - 1;