From ee22bab46a95611786ca6cf4ed0e7d453bd14ce4 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 5 Sep 2019 11:44:49 +0300 Subject: [PATCH] Fix #7468 #7460 --- .../plus/mapcontextmenu/MapContextMenu.java | 9 +++++++++ .../mapcontextmenu/MapContextMenuFragment.java | 3 ++- .../controllers/TransportRouteController.java | 18 +++++------------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 1d96fe94f8..040d371eae 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -88,6 +88,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL private LatLon mapCenter; private int mapPosition = 0; private boolean centerMarker; + private boolean zoomOutOnly; private int mapZoom; private boolean inLocationUpdate = false; @@ -286,6 +287,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL this.centerMarker = centerMarker; } + public boolean isZoomOutOnly() { + return zoomOutOnly; + } + + public void setZoomOutOnly(boolean zoomOutOnly) { + this.zoomOutOnly = zoomOutOnly; + } + public int getMapZoom() { return mapZoom; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 0e60f07b4f..6d036c7764 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1734,10 +1734,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo private void showOnMap(LatLon latLon, boolean updateCoords, boolean alreadyAdjusted, int zoom) { 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) { zoom = Math.min(zoom, calculatedZoom); } + menu.setZoomOutOnly(false); LatLon calcLatLon = calculateCenterLatLon(latLon, zoom, updateCoords); if (updateCoords) { mapCenter = calcLatLon; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java index 78bfb88a66..99850be914 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java @@ -60,7 +60,7 @@ public class TransportRouteController extends MenuController { public void buttonPressed() { final int previousStop = getPreviousStop(); 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() { final int nextStop = getNextStop(); 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(); if (mapActivity != null && mapContextMenu != null) { transportRoute.stop = stop; @@ -198,6 +198,7 @@ public class TransportRouteController extends MenuController { mapContextMenu.setMapPosition(getMapActivity().getMapView().getMapPosition()); } mapContextMenu.setCenterMarker(true); + mapContextMenu.setZoomOutOnly(movingBetweenStops); mapContextMenu.setMapZoom(15); mapContextMenu.showOrUpdate(stopLocation, pd, transportRoute); } @@ -286,16 +287,7 @@ public class TransportRouteController extends MenuController { @Override public void onClick(View arg0) { - showTransportStop(stop); - /* - 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()); - */ + showTransportStop(stop, false); } }); }