This commit is contained in:
crimean 2019-02-06 12:55:57 +03:00
parent 8811108adc
commit 56e6c31bc1

View file

@ -369,7 +369,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (menu.isLandscapeLayout() && newY > topScreenPosY) {
newY = topScreenPosY;
}
setViewY((int) newY, false, false);
setViewY((int) newY, false, false, 0);
menuFullHeight = view.getHeight() - (int) newY + 10;
ViewGroup.LayoutParams lp = mainView.getLayoutParams();
@ -886,7 +886,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
}
int newMenuState = menu.getCurrentMenuState();
boolean needMapAdjust = currentMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN;
boolean needMapAdjust = currentMenuState != newMenuState && (currentMenuState == MenuState.HEADER_ONLY || newMenuState == MenuState.HEADER_ONLY);
if (newMenuState != currentMenuState) {
menu.updateControlsVisibility(true);
@ -1004,7 +1004,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
.start();
if (needMapAdjust) {
adjustMapPosition(posY, true, centered, dZoom);
int mapPosY = posY;
if (newMenuState == MenuState.FULL_SCREEN) {
mapPosY = getMenuStatePosY(MenuState.HALF_SCREEN);
}
adjustMapPosition(mapPosY, true, centered, dZoom);
}
}
}
@ -1787,12 +1791,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
return (int) mainView.getY();
}
private void setViewY(int y, boolean animated, boolean adjustMapPos) {
private void setViewY(int y, boolean animated, boolean adjustMapPos, int mapY) {
mainView.setY(y);
zoomButtonsView.setY(getZoomButtonsY(y));
if (!customMapCenter) {
if (adjustMapPos) {
adjustMapPosition(y, animated, centered, 0);
adjustMapPosition(mapY, animated, centered, 0);
}
} else {
customMapCenter = false;
@ -1887,8 +1891,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
private void doLayoutMenu() {
final int posY = getPosY(getViewY(), false, menu.getCurrentMenuState());
setViewY(posY, true, !initLayout || !centered);
int state = menu.getCurrentMenuState();
int posY = getPosY(getViewY(), false, state);
int mapPosY = state == MenuState.FULL_SCREEN ? getMenuStatePosY(MenuState.HALF_SCREEN) : posY;
setViewY(posY, true, !initLayout || !centered, mapPosY);
updateMainViewLayout(posY);
}
@ -1919,7 +1925,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (mapCenter != null) {
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
}
adjustMapPosition(getPosY(), true, false, 0);
int posY = getPosY();
int mapPosY = menu.getCurrentMenuState() == MenuState.FULL_SCREEN ? getMenuStatePosY(MenuState.HALF_SCREEN) : posY;
adjustMapPosition(mapPosY, true, false, 0);
} else {
view.setVisibility(View.GONE);
}