From 4ca20c8197cf3a4e031ed2ad43a368910f82a1b3 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 7 Jul 2019 23:20:54 +0200 Subject: [PATCH] Fix compilation --- .../net/osmand/plus/helpers/GpxUiHelper.java | 2 +- .../cards/RouteInfoCard.java | 30 ++----------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index 2f75ea0b31..d3cd3e96d2 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -1287,7 +1287,7 @@ public class GpxUiHelper { } float divX = setupAxisDistance(app, yAxis, analysis.totalDistance); - List segments = routeStatistics.getElements(); + List segments = routeStatistics.elements; List entries = new ArrayList<>(); float[] stacks = new float[segments.size()]; int[] colors = new int[segments.size()]; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteInfoCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteInfoCard.java index b29db0fa7e..1d1f4d20e6 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteInfoCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteInfoCard.java @@ -27,7 +27,6 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.SettingsNavigationActivity; import net.osmand.plus.helpers.GpxUiHelper; -import net.osmand.router.RouteStatisticsHelper.Boundaries; import net.osmand.router.RouteStatisticsHelper.RouteSegmentAttribute; import net.osmand.router.RouteStatisticsHelper.RouteStatistics; import net.osmand.util.Algorithms; @@ -82,7 +81,7 @@ public class RouteInfoCard extends BaseCard { chart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry e, Highlight h) { - List elems = routeStatistics.getElements(); + List elems = routeStatistics.elements; int i = h.getStackIndex(); if (i >= 0 && elems.size() > i) { selectedPropertyName = elems.get(i).getPropertyName(); @@ -153,9 +152,8 @@ public class RouteInfoCard extends BaseCard { } private void attachLegend(ViewGroup container, RouteStatistics routeStatistics) { - Map partition = routeStatistics.getPartition(); + Map partition = routeStatistics.partition; List> list = new ArrayList<>(partition.entrySet()); - sortRouteSegmentAttributes(list); ContextThemeWrapper ctx = new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme); LayoutInflater inflater = LayoutInflater.from(ctx); for (Map.Entry entry : list) { @@ -179,30 +177,6 @@ public class RouteInfoCard extends BaseCard { } } - private void sortRouteSegmentAttributes(List> list) { - Collections.sort(list, new Comparator>() { - @Override - public int compare(Map.Entry o1, Map.Entry o2) { - Object key1 = o1.getKey(); - Object key2 = o2.getKey(); - if (key1 instanceof String && key2 instanceof String) { - float distance1 = o1.getValue().getDistance(); - float distance2 = o2.getValue().getDistance(); - - if (((String) key1).equalsIgnoreCase(UNDEFINED_ATTR) || distance1 < distance2) { - return 1; - } - if (((String) key2).equalsIgnoreCase(UNDEFINED_ATTR) || distance1 > distance2) { - return -1; - } - } else if (key1 instanceof Boundaries && key2 instanceof Boundaries) { - return ((Boundaries) key1).compareTo((Boundaries) key2); - } - return 0; - } - }); - } - private Spannable getSpanLegend(String title, RouteSegmentAttribute segment, boolean selected) { String formattedDistance = OsmAndFormatter.getFormattedDistance(segment.getDistance(), getMyApplication()); title = Algorithms.capitalizeFirstLetter(title);