Fix #8335 Expansion state of the route setup dialog #8335

This commit is contained in:
Victor Shcherb 2020-02-12 20:13:41 +01:00
parent b98d76fd25
commit b7063062f8
4 changed files with 26 additions and 1 deletions

View file

@ -3374,6 +3374,9 @@ public class OsmandSettings {
public final CommonPreference<Integer> OSMAND_THEME = public final CommonPreference<Integer> OSMAND_THEME =
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME).makeProfile().cache(); new IntPreference("osmand_theme", OSMAND_LIGHT_THEME).makeProfile().cache();
public final OsmandPreference<Boolean> OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED =
new BooleanPreference("open_only_header_route_calculated", false).makeProfile();
public boolean isLightActionBar() { public boolean isLightActionBar() {
return isLightContent(); return isLightContent();
} }

View file

@ -742,6 +742,8 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
int newMenuState = getCurrentMenuState(); int newMenuState = getCurrentMenuState();
boolean needMapAdjust = currentMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN; boolean needMapAdjust = currentMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN;
updateMenuState(currentMenuState, newMenuState);
applyPosY(currentY, needCloseMenu, needMapAdjust, currentMenuState, newMenuState, 0, animated); applyPosY(currentY, needCloseMenu, needMapAdjust, currentMenuState, newMenuState, 0, animated);
ContextMenuFragmentListener listener = this.listener; ContextMenuFragmentListener listener = this.listener;
@ -750,6 +752,9 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
} }
} }
protected void updateMenuState(int currentMenuState, int newMenuState) {
}
private int getPosY(final int currentY, boolean needCloseMenu, int previousState) { private int getPosY(final int currentY, boolean needCloseMenu, int previousState) {
if (needCloseMenu) { if (needCloseMenu) {

View file

@ -445,7 +445,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
fragment.updateInfo(); fragment.updateInfo();
if (!routeCalculationInProgress) { if (!routeCalculationInProgress) {
fragment.hideRouteCalculationProgressBar(); fragment.hideRouteCalculationProgressBar();
fragment.openMenuHalfScreen(); if(!app.getSettings().OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED.
getModeValue(app.getRoutingHelper().getAppMode())) {
fragment.openMenuHalfScreen();
} else {
fragment.openMenuHeaderOnly();
}
} }
} }
} }

View file

@ -186,6 +186,18 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
} }
} }
@Override
protected void updateMenuState(int currentMenuState, int newMenuState) {
if(getMyApplication().getRoutingHelper().isRouteCalculated() ) {
ApplicationMode mV = getMyApplication().getRoutingHelper().getAppMode();
if (newMenuState == MenuState.HEADER_ONLY && currentMenuState == MenuState.HALF_SCREEN) {
getSettings().OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED.setModeValue(mV,true);
} else if (currentMenuState == MenuState.HEADER_ONLY && newMenuState == MenuState.HALF_SCREEN) {
getSettings().OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED.resetModeToDefault(mV);
}
}
}
@Override @Override
protected void setViewY(int y, boolean animated, boolean adjustMapPos) { protected void setViewY(int y, boolean animated, boolean adjustMapPos) {
super.setViewY(y, animated, adjustMapPos); super.setViewY(y, animated, adjustMapPos);