This commit is contained in:
max-klaus 2019-09-05 11:44:49 +03:00
parent 53acf00f1a
commit 3a7232c8b4
3 changed files with 16 additions and 14 deletions

View file

@ -88,6 +88,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private LatLon mapCenter; private LatLon mapCenter;
private int mapPosition = 0; private int mapPosition = 0;
private boolean centerMarker; private boolean centerMarker;
private boolean zoomOutOnly;
private int mapZoom; private int mapZoom;
private boolean inLocationUpdate = false; private boolean inLocationUpdate = false;
@ -286,6 +287,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
this.centerMarker = centerMarker; this.centerMarker = centerMarker;
} }
public boolean isZoomOutOnly() {
return zoomOutOnly;
}
public void setZoomOutOnly(boolean zoomOutOnly) {
this.zoomOutOnly = zoomOutOnly;
}
public int getMapZoom() { public int getMapZoom() {
return mapZoom; return mapZoom;
} }

View file

@ -1734,10 +1734,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void showOnMap(LatLon latLon, boolean updateCoords, boolean alreadyAdjusted, int zoom) { private void showOnMap(LatLon latLon, boolean updateCoords, boolean alreadyAdjusted, int zoom) {
AnimateDraggingMapThread thread = map.getAnimatedDraggingThread(); AnimateDraggingMapThread thread = map.getAnimatedDraggingThread();
int calculatedZoom = thread.calculateMoveZoom(null, latLon.getLatitude(), latLon.getLongitude(), null); int calculatedZoom = menu.isZoomOutOnly() ? thread.calculateMoveZoom(null, latLon.getLatitude(), latLon.getLongitude(), null) : 0;
if (calculatedZoom > 0) { if (calculatedZoom > 0) {
zoom = Math.min(zoom, calculatedZoom); zoom = Math.min(zoom, calculatedZoom);
} }
menu.setZoomOutOnly(false);
LatLon calcLatLon = calculateCenterLatLon(latLon, zoom, updateCoords); LatLon calcLatLon = calculateCenterLatLon(latLon, zoom, updateCoords);
if (updateCoords) { if (updateCoords) {
mapCenter = calcLatLon; mapCenter = calcLatLon;

View file

@ -60,7 +60,7 @@ public class TransportRouteController extends MenuController {
public void buttonPressed() { public void buttonPressed() {
final int previousStop = getPreviousStop(); final int previousStop = getPreviousStop();
if (previousStop != -1) { if (previousStop != -1) {
showTransportStop(getTransportRoute().route.getForwardStops().get(previousStop)); showTransportStop(getTransportRoute().route.getForwardStops().get(previousStop), true);
} }
} }
}; };
@ -72,7 +72,7 @@ public class TransportRouteController extends MenuController {
public void buttonPressed() { public void buttonPressed() {
final int nextStop = getNextStop(); final int nextStop = getNextStop();
if (nextStop != -1) { if (nextStop != -1) {
showTransportStop(getTransportRoute().route.getForwardStops().get(nextStop)); showTransportStop(getTransportRoute().route.getForwardStops().get(nextStop), true);
} }
} }
}; };
@ -180,7 +180,7 @@ public class TransportRouteController extends MenuController {
} }
} }
private void showTransportStop(TransportStop stop) { private void showTransportStop(TransportStop stop, boolean movingBetweenStops) {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null && mapContextMenu != null) { if (mapActivity != null && mapContextMenu != null) {
transportRoute.stop = stop; transportRoute.stop = stop;
@ -198,6 +198,7 @@ public class TransportRouteController extends MenuController {
mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition()); mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition());
} }
mapContextMenu.setCenterMarker(true); mapContextMenu.setCenterMarker(true);
mapContextMenu.setZoomOutOnly(movingBetweenStops);
mapContextMenu.setMapZoom(15); mapContextMenu.setMapZoom(15);
mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute); mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute);
} }
@ -286,16 +287,7 @@ public class TransportRouteController extends MenuController {
@Override @Override
public void onClick(View arg0) { public void onClick(View arg0) {
showTransportStop(stop); showTransportStop(stop, false);
/*
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
getMapActivity().getString(R.string.transport_Stop), name);
LatLon stopLocation = stop.getLocation();
getMapActivity().getMyApplication().getSettings()
.setMapLocationToShow(stopLocation.getLatitude(), stopLocation.getLongitude(),
15, pd, false, transportRoute);
MapActivity.launchMapActivityMoveToTop(getMapActivity());
*/
} }
}); });
} }