diff --git a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java index 1151f71651..17747d3173 100644 --- a/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/NavigatePointFragment.java @@ -12,6 +12,7 @@ import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.activities.search.SearchActivity; import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild; +import net.osmand.plus.routing.routingHelper; import net.osmand.util.MapUtils; import android.content.Intent; import android.location.Location; @@ -256,7 +257,14 @@ 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) { - targetPointsHelper.setSingleDestination(lat, lon, getString(R.string.point_on_map, lat, lon)); + //targetPointsHelper.setSingleDestination(lat, lon, getString(R.string.point_on_map, lat, lon)); + //Do not delete waypoints here + app.getSettings().setPointToNavigate(lat, lon, false, getString(R.string.point_on_map, lat, lon)); + targetPointsHelper.updatePointsFromSettings(); + // always enable and follow and let calculate it (GPS is not accessible in garage) + if(!routingHelper.isRouteBeingCalculated() && !routingHelper.isRouteCalculated() ) { + MapActivityActions.getDirections(null, new LatLon(lat, lon), true); + } MapActivity.launchMapActivityMoveToTop(getActivity()); } else if (mode == ADD_WAYPOINT) { MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), lat, lon, getString(R.string.point_on_map, lat, lon)); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java index 3f2dc4b322..501a2d2aff 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java @@ -13,6 +13,7 @@ import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivityActions; import net.osmand.plus.resources.RegionAddressRepository; +import net.osmand.plus.routing.routingHelper; import net.osmand.util.Algorithms; import android.content.Intent; import android.os.Bundle; @@ -294,7 +295,14 @@ public class SearchAddressFragment extends SherlockFragment { OsmandApplication ctx = (OsmandApplication) getActivity().getApplication(); final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper(); if (mode == NAVIGATE_TO) { - targetPointsHelper.setSingleDestination(searchPoint.getLatitude(), searchPoint.getLongitude(), historyName); + //targetPointsHelper.setSingleDestination(searchPoint.getLatitude(), searchPoint.getLongitude(), historyName); + //Do not delete waypoints here + osmandSettings.setPointToNavigate(searchPoint.getLatitude(), searchPoint.getLongitude(), false, historyName); + targetPointsHelper.updatePointsFromSettings(); + // always enable and follow and let calculate it (GPS is not accessible in garage) + if(!routingHelper.isRouteBeingCalculated() && !routingHelper.isRouteCalculated() ) { + MapActivityActions.getDirections(null, new LatLon(lat, lon), true); + } MapActivity.launchMapActivityMoveToTop(getActivity()); } else if (mode == ADD_WAYPOINT) { MapActivityActions.navigatePointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), historyName);