consolidate directions

This commit is contained in:
Victor Shcherb 2013-07-15 01:59:57 +02:00
parent c3b0e8a07c
commit 0bc606a36c
2 changed files with 6 additions and 1 deletions

View file

@ -1154,6 +1154,9 @@ public class OsmandSettings {
public boolean setPointToNavigate(double latitude, double longitude, String historyDescription) {
return setPointToNavigate(latitude, longitude, false, historyDescription);
}
public boolean navigateDialog() {
return settingsAPI.edit(globalPreferences).putString(POINT_NAVIGATE_ROUTE, "true").commit();
}
public boolean setPointToNavigate(double latitude, double longitude, boolean navigate, String historyDescription) {
boolean add = settingsAPI.edit(globalPreferences).putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();

View file

@ -1425,7 +1425,7 @@ public class MapActivityActions implements DialogProvider {
public static void addWaypointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name) {
OsmandApplication ctx = (OsmandApplication) act.getApplication();
final OsmandApplication ctx = (OsmandApplication) act.getApplication();
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
if (targetPointsHelper.getPointToNavigate() != null) {
Builder builder = new AlertDialog.Builder(act);
@ -1443,11 +1443,13 @@ public class MapActivityActions implements DialogProvider {
} else {
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, 0);
}
ctx.getSettings().navigateDialog();
MapActivity.launchMapActivityMoveToTop(act);
}
});
builder.show();
} else {
ctx.getSettings().navigateDialog();
targetPointsHelper.navigateToPoint(new LatLon(lat, lon), true, -1);
MapActivity.launchMapActivityMoveToTop(act);
}