red color for displacement-derived speed values

This commit is contained in:
sonora 2017-05-23 23:42:27 +02:00
parent 0ccdc225c6
commit a717787a2e
3 changed files with 25 additions and 4 deletions

View file

@ -237,12 +237,15 @@
<color name="gpx_chart_blue">#2f7af5</color> <color name="gpx_chart_blue">#2f7af5</color>
<color name="gpx_chart_orange">#ff8800</color> <color name="gpx_chart_orange">#ff8800</color>
<color name="gpx_chart_red">#ff0000</color>
<color name="gpx_chart_green">#23b03b</color> <color name="gpx_chart_green">#23b03b</color>
<color name="gpx_chart_blue_grid">#c32561c2</color> <color name="gpx_chart_blue_grid">#c32561c2</color>
<color name="gpx_chart_orange_grid">#c3b35f00</color> <color name="gpx_chart_orange_grid">#c3b35f00</color>
<color name="gpx_chart_red_grid">#c3b30000</color>
<color name="gpx_chart_green_grid">#c3197d2a</color> <color name="gpx_chart_green_grid">#c3197d2a</color>
<color name="gpx_chart_blue_label">#2561c2</color> <color name="gpx_chart_blue_label">#2561c2</color>
<color name="gpx_chart_orange_label">#b27700</color> <color name="gpx_chart_orange_label">#b27700</color>
<color name="gpx_chart_red_label">#b20000</color>
<color name="gpx_chart_green_label">#197d2a</color> <color name="gpx_chart_green_label">#197d2a</color>
</resources> </resources>

View file

@ -303,6 +303,10 @@ public class GPXUtilities {
return maxElevation != -100; return maxElevation != -100;
} }
public boolean hasSpeedInTrack() {
return hasSpeedInTrack;
}
public boolean isBoundsCalculated() { public boolean isBoundsCalculated() {
return left !=0 && right != 0 && top != 0 && bottom != 0; return left !=0 && right != 0 && top != 0 && bottom != 0;
} }

View file

@ -1257,8 +1257,14 @@ public class GpxUiHelper {
} else { } else {
yAxis = mChart.getAxisLeft(); yAxis = mChart.getAxisLeft();
} }
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_label)); if (analysis.hasSpeedInTrack()) {
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_grid)); yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_label));
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange_grid));
} else {
yAxis.setTextColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_red_label));
yAxis.setGridColor(ActivityCompat.getColor(mChart.getContext(), R.color.gpx_chart_red_grid));
}
yAxis.setAxisMinimum(0f); yAxis.setAxisMinimum(0f);
ArrayList<Entry> values = new ArrayList<>(); ArrayList<Entry> values = new ArrayList<>();
@ -1320,11 +1326,19 @@ public class GpxUiHelper {
} }
dataSet.units = mainUnitY; dataSet.units = mainUnitY;
dataSet.setColor(ContextCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange)); if (analysis.hasSpeedInTrack()) {
dataSet.setColor(ContextCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange));
} else {
dataSet.setColor(ContextCompat.getColor(mChart.getContext(), R.color.gpx_chart_red));
}
dataSet.setLineWidth(1f); dataSet.setLineWidth(1f);
if (drawFilled) { if (drawFilled) {
dataSet.setFillAlpha(128); dataSet.setFillAlpha(128);
dataSet.setFillColor(ContextCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange)); if (analysis.hasSpeedInTrack()) {
dataSet.setFillColor(ContextCompat.getColor(mChart.getContext(), R.color.gpx_chart_orange));
} else {
dataSet.setFillColor(ContextCompat.getColor(mChart.getContext(), R.color.gpx_chart_red));
}
dataSet.setDrawFilled(true); dataSet.setDrawFilled(true);
} else { } else {
dataSet.setDrawFilled(false); dataSet.setDrawFilled(false);