Merge branch 'sasha_pasha_branch' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch

This commit is contained in:
PavelRatushny 2017-09-08 16:00:42 +03:00
commit adfadc91d9
2 changed files with 20 additions and 9 deletions

View file

@ -327,14 +327,18 @@ public class MapMarkersHelper {
} }
public void addMapMarker(LatLon point, PointDescription historyName) { public void addMapMarker(LatLon point, PointDescription historyName) {
List<LatLon> points = new ArrayList<>(1); addMarkers(Collections.singletonList(point), Collections.singletonList(historyName), null);
List<PointDescription> historyNames = new ArrayList<>(1); }
points.add(point);
historyNames.add(historyName); public void addMapMarkers(List<LatLon> points, List<PointDescription> historyNames, List<String> groups) {
addMapMarkers(points, historyNames); addMarkers(points, historyNames, groups);
} }
public void addMapMarkers(List<LatLon> points, List<PointDescription> historyNames) { public void addMapMarkers(List<LatLon> points, List<PointDescription> historyNames) {
addMarkers(points, historyNames, null);
}
private void addMarkers(List<LatLon> points, List<PointDescription> historyNames, @Nullable List<String> groups) {
if (points.size() > 0) { if (points.size() > 0) {
int colorIndex = -1; int colorIndex = -1;
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
@ -360,6 +364,9 @@ public class MapMarkersHelper {
} }
MapMarker marker = new MapMarker(point, pointDescription, colorIndex, false, 0); MapMarker marker = new MapMarker(point, pointDescription, colorIndex, false, 0);
if (groups != null) {
marker.groupKey = markersDbHelper.createGroupIfNeeded(groups.get(i));
}
markersDbHelper.addMarker(marker); markersDbHelper.addMarker(marker);
} }
loadMarkers(); loadMarkers();

View file

@ -404,11 +404,15 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
int size = getSelectedFavoritesCount(); int size = getSelectedFavoritesCount();
List<LatLon> points = new ArrayList<>(size); List<LatLon> points = new ArrayList<>(size);
List<PointDescription> names = new ArrayList<>(size); List<PointDescription> names = new ArrayList<>(size);
for (FavouritePoint fp : getSelectedFavorites()) { List<String> groups = new ArrayList<>(size);
points.add(new LatLon(fp.getLatitude(), fp.getLongitude())); for (Map.Entry<String, Set<FavouritePoint>> entry : favoritesSelected.entrySet()) {
names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName())); 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()); MapActivity.launchMapActivityMoveToTop(getActivity());
} else { } else {
final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper(); final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();