fix bug where setting destination killed waypoints in some cases

This commit is contained in:
sonora 2013-06-19 00:39:26 +02:00
parent 120f8dca3a
commit 67b252a129
4 changed files with 7 additions and 7 deletions

View file

@ -190,8 +190,10 @@ public class TargetPointsHelper {
}
public void setSingleDestination(double lat, double lon, String historyName) {
clearPointToNavigate(false);
public void setDestination(double lat, double lon, String historyName) {
//clearPointToNavigate(false);
// Do not delete waypoints here
settings.clearPointToNavigate();
settings.setPointToNavigate(lat, lon, true, historyName);
updatePointsFromSettings();

View file

@ -1256,7 +1256,7 @@ public class MapActivityActions implements DialogProvider {
if(onShow != null) {
onShow.onClick(v);
}
targetPointsHelper.setSingleDestination(location.getLatitude(), location.getLongitude(), name);
targetPointsHelper.setDestination(location.getLatitude(), location.getLongitude(), name);
MapActivity.launchMapActivityMoveToTop(activity);
qa.dismiss();
}

View file

@ -256,8 +256,7 @@ public class NavigatePointFragment extends SherlockFragment implements SearchAct
double lon = convert(((TextView) view.findViewById(R.id.LongitudeEdit)).getText().toString());
TargetPointsHelper targetPointsHelper = ((OsmandApplication) getActivity().getApplication()).getTargetPointsHelper();
if (mode == NAVIGATE_TO) {
//TODO: Do not delete waypoints here!
targetPointsHelper.setSingleDestination(lat, lon, getString(R.string.point_on_map, lat, lon));
targetPointsHelper.setDestination(lat, lon, getString(R.string.point_on_map, lat, lon));
MapActivity.launchMapActivityMoveToTop(getActivity());
} else if (mode == ADD_WAYPOINT) {
MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), lat, lon, getString(R.string.point_on_map, lat, lon));

View file

@ -294,8 +294,7 @@ public class SearchAddressFragment extends SherlockFragment {
OsmandApplication ctx = (OsmandApplication) getActivity().getApplication();
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
if (mode == NAVIGATE_TO) {
//TODO: Do not delete waypoints here!
targetPointsHelper.setSingleDestination(searchPoint.getLatitude(), searchPoint.getLongitude(), historyName);
targetPointsHelper.setDestination(searchPoint.getLatitude(), searchPoint.getLongitude(), historyName);
MapActivity.launchMapActivityMoveToTop(getActivity());
} else if (mode == ADD_WAYPOINT) {
MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), historyName);