Do not delete waypoints when chosing Directions in Search and Favorites

This commit is contained in:
sonora 2013-06-14 08:27:11 +02:00
parent bfb06a4d99
commit 42c07f1928
2 changed files with 18 additions and 2 deletions

View file

@ -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));

View file

@ -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);