Fix issue 1362 - only show route double call buggy
This commit is contained in:
parent
3353cfa4e4
commit
ebf725457b
3 changed files with 15 additions and 20 deletions
|
@ -926,14 +926,14 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
return zoomDelta;
|
||||
}
|
||||
|
||||
public void navigateToPoint(LatLon point){
|
||||
public void navigateToPoint(LatLon point, boolean updateRoute){
|
||||
if(point != null){
|
||||
settings.setPointToNavigate(point.getLatitude(), point.getLongitude(), null);
|
||||
} else {
|
||||
settings.clearPointToNavigate();
|
||||
}
|
||||
if(routingHelper.isRouteBeingCalculated() || routingHelper.isRouteCalculated() ||
|
||||
routingHelper.isFollowingMode()) {
|
||||
if(updateRoute && ( routingHelper.isRouteBeingCalculated() || routingHelper.isRouteCalculated() ||
|
||||
routingHelper.isFollowingMode())) {
|
||||
routingHelper.setFinalAndCurrentLocation(point, getLastKnownLocation(), routingHelper.getCurrentGPXRoute());
|
||||
}
|
||||
mapLayers.getNavigationLayer().setPointToNavigate(point);
|
||||
|
|
|
@ -747,10 +747,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mapActivity.startActivity(intent);
|
||||
} else if (standardId == R.string.context_menu_item_navigate_point) {
|
||||
mapActivity.navigateToPoint(new LatLon(latitude, longitude));
|
||||
mapActivity.navigateToPoint(new LatLon(latitude, longitude), true);
|
||||
} else if (standardId == R.string.context_menu_item_directions) {
|
||||
Location loc = mapActivity.getLastKnownLocation();
|
||||
mapActivity.navigateToPoint(new LatLon(latitude, longitude));
|
||||
mapActivity.navigateToPoint(new LatLon(latitude, longitude), false);
|
||||
// always enable and follow and let calculate it (GPS is not accessible in garage)
|
||||
getDirections(loc, true);
|
||||
} else if (standardId == R.string.context_menu_item_show_route) {
|
||||
|
@ -917,18 +917,15 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
@Override
|
||||
public boolean onClick(MenuItem item) {
|
||||
if (mapActivity.getMapLayers().getNavigationLayer().getPointToNavigate() != null) {
|
||||
if (routingHelper.isRouteCalculated() || routingHelper.isFollowingMode() || routingHelper.isRouteBeingCalculated()) {
|
||||
routingHelper.setFinalAndCurrentLocation(null, mapActivity.getLastKnownLocation(), routingHelper.getCurrentGPXRoute());
|
||||
routingHelper.setFinalAndCurrentLocation(null, mapActivity.getLastKnownLocation(),
|
||||
routingHelper.getCurrentGPXRoute());
|
||||
// restore default mode
|
||||
boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get());
|
||||
mapActivity.updateApplicationModeSettings();
|
||||
mapView.refreshMap(changed);
|
||||
} else {
|
||||
mapActivity.navigateToPoint(null);
|
||||
}
|
||||
} else {
|
||||
mapActivity.navigateToPoint(new LatLon(mapView.getLatitude(), mapView.getLongitude()));
|
||||
mapActivity.navigateToPoint(null, true);
|
||||
}
|
||||
mapView.refreshMap();
|
||||
return true;
|
||||
|
|
|
@ -224,12 +224,10 @@ public class RoutingHelper {
|
|||
locationProjection.setLatitude(project.getLatitude());
|
||||
locationProjection.setLongitude(project.getLongitude());
|
||||
// we need to update bearing too
|
||||
if (locationProjection.hasBearing()) {
|
||||
float bearingTo = locationProjection.bearingTo(nextLocation);
|
||||
locationProjection.setBearing(bearingTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
lastFixedLocation = currentLocation;
|
||||
lastProjection = locationProjection;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue