Fix split color, add points for whole track, fix switch in header

This commit is contained in:
PavelRatushny 2017-06-22 15:18:25 +03:00
parent bc26a0ee1a
commit 955a69b9d1
3 changed files with 31 additions and 11 deletions

View file

@ -53,6 +53,7 @@ public class TrackDetailsMenu {
private TrackDetailsBarController toolbarController;
private TrkSegment segment;
private TrackChartPoints trackChartPoints;
private List<WptPt> 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<WptPt> 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<WptPt> getXAxisPoints(LineChart chart) {
List<WptPt> 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;
}

View file

@ -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<GpxDisplayGroup> groups = getDisplayGroups();
if (groups.size() > 0) {
updateSplit(groups, vis.isChecked() ? sf : null);
}
updateSplitIntervalView(splitIntervalView);
updateColorView(colorView);
}
});

View file

@ -280,11 +280,15 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
List<GpxDisplayGroup> 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<GpxDisplayItem> items = group.getModifiableList();