Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
caa09cfc27
3 changed files with 24 additions and 1 deletions
|
@ -1631,6 +1631,18 @@ public class OsmandSettings {
|
|||
.commit();
|
||||
}
|
||||
|
||||
public boolean restorePointToStart() {
|
||||
if (settingsAPI.getFloat(globalPreferences, POINT_NAVIGATE_LAT_BACKUP, 0) == 0) {
|
||||
settingsAPI.edit(globalPreferences)
|
||||
.putFloat(START_POINT_LAT, settingsAPI.getFloat(globalPreferences, START_POINT_LAT_BACKUP, 0))
|
||||
.putFloat(START_POINT_LON, settingsAPI.getFloat(globalPreferences, START_POINT_LON_BACKUP, 0))
|
||||
.commit();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public LatLon getPointToNavigate() {
|
||||
float lat = settingsAPI.getFloat(globalPreferences, POINT_NAVIGATE_LAT, 0);
|
||||
float lon = settingsAPI.getFloat(globalPreferences, POINT_NAVIGATE_LON, 0);
|
||||
|
|
|
@ -305,6 +305,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
mapActivity.startActivity(intent);
|
||||
} else if (standardId == R.string.context_menu_item_directions_from) {
|
||||
mapActivity.getContextMenu().hide();
|
||||
if (settings.USE_MAP_MARKERS.get()
|
||||
&& getMyApplication().getTargetPointsHelper().getPointToNavigate() == null) {
|
||||
setFirstMapMarkerAsTarget();
|
||||
}
|
||||
enterRoutePlanningMode(new LatLon(latitude, longitude),
|
||||
mapActivity.getContextMenu().getPointDescription());
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
|
@ -501,8 +502,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
DirectionsDialogs.addWaypointDialogAndLaunchMap(mapActivity, latLon.getLatitude(),
|
||||
latLon.getLongitude(), getPointDescriptionForTarget());
|
||||
} else if (targets.getIntermediatePoints().isEmpty()) {
|
||||
boolean hasPointToStart = settings.restorePointToStart();
|
||||
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||
if (!hasPointToStart) {
|
||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true, true);
|
||||
} else {
|
||||
TargetPoint start = targets.getPointToStart();
|
||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, start.point, start.getOriginalPointDescription(), true, true);
|
||||
}
|
||||
close();
|
||||
} else {
|
||||
Builder bld = new AlertDialog.Builder(mapActivity);
|
||||
|
|
Loading…
Reference in a new issue