From 63131b6abb4a186bec7dba80640cd20044f3f365 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 8 Sep 2017 15:09:03 +0300 Subject: [PATCH 1/2] Change some methods --- .../src/net/osmand/plus/MapMarkersHelper.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 87a11c53e7..4e08dc1ea3 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -327,14 +327,18 @@ public class MapMarkersHelper { } public void addMapMarker(LatLon point, PointDescription historyName) { - List points = new ArrayList<>(1); - List historyNames = new ArrayList<>(1); - points.add(point); - historyNames.add(historyName); - addMapMarkers(points, historyNames); + addMarkers(Collections.singletonList(point), Collections.singletonList(historyName), null); + } + + public void addMapMarkers(List points, List historyNames, List groups) { + addMarkers(points, historyNames, groups); } public void addMapMarkers(List points, List historyNames) { + addMarkers(points, historyNames, null); + } + + private void addMarkers(List points, List historyNames, @Nullable List groups) { if (points.size() > 0) { int colorIndex = -1; for (int i = 0; i < points.size(); i++) { @@ -360,6 +364,9 @@ public class MapMarkersHelper { } MapMarker marker = new MapMarker(point, pointDescription, colorIndex, false, 0); + if (groups != null) { + marker.groupKey = markersDbHelper.createGroupIfNeeded(groups.get(i)); + } markersDbHelper.addMarker(marker); } loadMarkers(); From c5a053605759968995dfa46b9f4cec46e60a5f3e Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 8 Sep 2017 15:29:45 +0300 Subject: [PATCH 2/2] Change method --- .../plus/activities/FavoritesTreeFragment.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 3103115549..7c0f7817b6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -404,11 +404,15 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { int size = getSelectedFavoritesCount(); List points = new ArrayList<>(size); List names = new ArrayList<>(size); - for (FavouritePoint fp : getSelectedFavorites()) { - points.add(new LatLon(fp.getLatitude(), fp.getLongitude())); - names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName())); + List groups = new ArrayList<>(size); + for (Map.Entry> entry : favoritesSelected.entrySet()) { + for (FavouritePoint fp : entry.getValue()) { + points.add(new LatLon(fp.getLatitude(), fp.getLongitude())); + names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName())); + groups.add(entry.getKey()); + } } - markersHelper.addMapMarkers(points, names); + markersHelper.addMapMarkers(points, names, groups); MapActivity.launchMapActivityMoveToTop(getActivity()); } else { final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();