From 733d152956f83c2ab8ce35f9b6ea51b326fc1907 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 8 Apr 2021 14:22:55 +0300 Subject: [PATCH] Fix map adjusting for track menu --- .../src/net/osmand/plus/track/TrackMenuFragment.java | 12 +++++++----- .../src/net/osmand/plus/views/layers/GPXLayer.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index 2d5c26313e..dcb907f483 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -165,7 +165,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card private int menuTitleHeight; private int menuHeaderHeight; private int toolbarHeightPx; - private boolean mapPositionAdjusted; + private boolean adjustMapPosition = true; public enum TrackMenuType { @@ -596,7 +596,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card boolean backButtonVisible = !Algorithms.isEmpty(returnScreenName) && currentMenuState == MenuState.HALF_SCREEN; AndroidUiHelper.updateVisibility(backButtonContainer, backButtonVisible); } - if (currentMenuState != MenuState.FULL_SCREEN && (changed || !mapPositionAdjusted)) { + if (currentMenuState != MenuState.FULL_SCREEN && (changed || adjustMapPosition)) { adjustMapPosition(getMenuStatePosY(currentMenuState)); } } @@ -971,7 +971,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card if (r.left != 0 && r.right != 0) { mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0); } - mapPositionAdjusted = true; + adjustMapPosition = false; } } @@ -1318,7 +1318,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public boolean processResult(SelectedGpxFile selectedGpxFile) { MapActivity mapActivity = mapActivityRef.get(); if (mapActivity != null && selectedGpxFile != null) { - showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName, callingFragmentTag); + showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName, callingFragmentTag, true); } return true; } @@ -1329,7 +1329,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card @NonNull SelectedGpxFile selectedGpxFile, @Nullable LatLon latLon, @Nullable String returnScreenName, - @Nullable String callingFragmentTag) { + @Nullable String callingFragmentTag, + boolean adjustMapPosition) { try { Bundle args = new Bundle(); args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY); @@ -1340,6 +1341,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card fragment.setSelectedGpxFile(selectedGpxFile); fragment.setReturnScreenName(returnScreenName); fragment.setCallingFragmentTag(callingFragmentTag); + fragment.adjustMapPosition = adjustMapPosition; if (latLon != null) { fragment.setLatLon(latLon); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index 203e446c15..2171c4fc82 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -1115,7 +1115,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM SelectedGpxPoint point = (SelectedGpxPoint) object; WptPt wptPt = point.getSelectedPoint(); TrackMenuFragment.showInstance(mapActivity, point.getSelectedGpxFile(), - new LatLon(wptPt.lat, wptPt.lon), null, null); + new LatLon(wptPt.lat, wptPt.lon), null, null, false); return true; }