Fix markers import

This commit is contained in:
Alexander Sytnyk 2017-09-26 12:12:45 +03:00
parent 09345faefc
commit b6a90eb774
2 changed files with 10 additions and 14 deletions

View file

@ -187,14 +187,8 @@ public class EditFavoriteGroupDialogFragment extends BottomSheetDialogFragment {
addToMarkersView.setOnClickListener(new View.OnClickListener() { addToMarkersView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
List<LatLon> points = new ArrayList<>(group.points.size());
List<PointDescription> names = new ArrayList<>(group.points.size());
for (FavouritePoint fp : group.points) {
points.add(new LatLon(fp.getLatitude(), fp.getLongitude()));
names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName()));
}
markersHelper.addMarkersSyncGroup(syncGroup); markersHelper.addMarkersSyncGroup(syncGroup);
markersHelper.addMapMarkers(points, names, syncGroup); markersHelper.syncGroup(syncGroup);
dismiss(); dismiss();
MapActivity.launchMapActivityMoveToTop(getActivity()); MapActivity.launchMapActivityMoveToTop(getActivity());
} }

View file

@ -411,14 +411,16 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
new MarkersSyncGroup(favGr.name, favGr.name, MarkersSyncGroup.FAVORITES_TYPE, favGr.color); new MarkersSyncGroup(favGr.name, favGr.name, MarkersSyncGroup.FAVORITES_TYPE, favGr.color);
if (entry.getValue().size() == favGr.points.size()) { if (entry.getValue().size() == favGr.points.size()) {
markersHelper.addMarkersSyncGroup(syncGr); markersHelper.addMarkersSyncGroup(syncGr);
markersHelper.syncGroup(syncGr);
} else {
for (FavouritePoint fp : entry.getValue()) {
points.add(new LatLon(fp.getLatitude(), fp.getLongitude()));
names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName()));
}
markersHelper.addMapMarkers(points, names, syncGr);
points.clear();
names.clear();
} }
for (FavouritePoint fp : entry.getValue()) {
points.add(new LatLon(fp.getLatitude(), fp.getLongitude()));
names.add(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, fp.getName()));
}
markersHelper.addMapMarkers(points, names, syncGr);
points.clear();
names.clear();
} }
MapActivity.launchMapActivityMoveToTop(getActivity()); MapActivity.launchMapActivityMoveToTop(getActivity());
} else { } else {