diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index 67d96baff6..6538288ead 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -53,6 +53,7 @@ public class TrackDetailsMenu { private TrackDetailsBarController toolbarController; private TrkSegment segment; private TrackChartPoints trackChartPoints; + private List xAxisPoints; private static boolean VISIBLE; @@ -310,9 +311,8 @@ public class TrackDetailsMenu { trackChartPoints.setGpx(getGpxItem().group.getGpx()); } location = new LatLon(wpt.lat, wpt.lon); - List xAxisPoints = getXAxisPoints(chart); trackChartPoints.setHighlightedPoint(location); - trackChartPoints.setXAxisPoints(xAxisPoints); + trackChartPoints.setXAxisPoints(getXAxisPoints(chart)); if (gpxItem.route) { mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(trackChartPoints); } else { @@ -326,11 +326,19 @@ public class TrackDetailsMenu { } private List getXAxisPoints(LineChart chart) { - List xAxisPoints = new ArrayList<>(); float[] entries = chart.getXAxis().mEntries; - for (int i = 0; i < entries.length; i++) { - WptPt pointToAdd = getPoint(chart, entries[i]); - xAxisPoints.add(pointToAdd); + float maxXValue = chart.getLineData().getXMax(); + if (entries.length >= 2) { + float interval = entries[1] - entries[0]; + if (interval > 0) { + xAxisPoints = new ArrayList<>(); + float currentPointEntry = interval; + while (currentPointEntry < maxXValue) { + WptPt pointToAdd = getPoint(chart, currentPointEntry); + xAxisPoints.add(pointToAdd); + currentPointEntry += interval; + } + } } return xAxisPoints; } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index 99395a0515..ebd5fe7b47 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -287,7 +287,15 @@ public class TrackSegmentFragment extends OsmAndListFragment { vis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false); + if (!isChecked) { + selectedSplitInterval = 0; + } + SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false); + final List groups = getDisplayGroups(); + if (groups.size() > 0) { + updateSplit(groups, vis.isChecked() ? sf : null); + } + updateSplitIntervalView(splitIntervalView); updateColorView(colorView); } }); diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 7f87363af1..326a8f9be1 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -280,11 +280,15 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex List groups = g.getDisplayGroups(); if (groups != null) { for (GpxDisplayGroup group : groups) { - int color = g.getModifiableGpxFile().getColor(0); - if (color == 0 || color == Color.RED) { - GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path)); - color = gpxDataItem.getColor(); + GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path)); + int color = gpxDataItem.getColor(); + if (color == 0) { + color = g.getModifiableGpxFile().getColor(0); } + if (color == 0) { + color = cachedColor; + } + paintInnerRect.setColor(color); paintInnerRect.setAlpha(179); List items = group.getModifiableList();