Hide only on medium state

This commit is contained in:
PavelRatushny 2017-10-06 18:54:22 +03:00
parent 12b12896b4
commit a75978db5d
5 changed files with 15 additions and 12 deletions

View file

@ -368,7 +368,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
fragmentRef.get().centerMarkerLocation();
}
}
updateWidgetsVisibility(false);
}
public void show(@NonNull LatLon latLon,
@ -389,7 +388,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
centerMarker = false;
autoHide = false;
updateWidgetsVisibility(false);
}
public void update(LatLon latLon, PointDescription pointDescription, Object object) {
@ -451,7 +449,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
updateWidgetsVisibility(true);
}
private void updateWidgetsVisibility(boolean visible) {
public void updateWidgetsVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
mapActivity.findViewById(R.id.map_center_info).setVisibility(visibility);
mapActivity.findViewById(R.id.map_left_widgets_panel).setVisibility(visibility);

View file

@ -525,6 +525,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
boolean needMapAdjust = oldMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN;
if (newMenuState != oldMenuState) {
menu.updateWidgetsVisibility(newMenuState != MenuState.HALF_SCREEN);
doBeforeMenuStateChange(oldMenuState, newMenuState);
}

View file

@ -46,6 +46,7 @@ import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
import net.osmand.plus.routing.RoutingHelper;
@ -709,11 +710,12 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
boolean contextMenuOpened = mapActivity.getContextMenu().isVisible();
int contextMenuState = mapActivity.getContextMenu().getCurrentMenuState();
boolean showRouteCalculationControls = routePlanningMode ||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || contextMenuOpened);
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || (contextMenuOpened && contextMenuState == MenuController.MenuState.HALF_SCREEN));
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened;
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && (!contextMenuOpened || contextMenuState != MenuController.MenuState.HALF_SCREEN);
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
if (rh.isFollowingMode()) {
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
@ -728,16 +730,16 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningBtn.updateVisibility(showButtons);
menuControl.updateVisibility(showButtons);
mapZoomIn.updateVisibility(!routeDialogOpened && !contextMenuOpened);
mapZoomOut.updateVisibility(!routeDialogOpened && !contextMenuOpened);
mapZoomIn.updateVisibility(!routeDialogOpened && (!contextMenuOpened || contextMenuState != MenuController.MenuState.HALF_SCREEN));
mapZoomOut.updateVisibility(!routeDialogOpened && (!contextMenuOpened || contextMenuState != MenuController.MenuState.HALF_SCREEN));
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && (!contextMenuOpened || contextMenuState != MenuController.MenuState.HALF_SCREEN));
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
layersHud.update(app, isNight);
}
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && (!contextMenuOpened || contextMenuState != MenuController.MenuState.HALF_SCREEN));
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && (!contextMenuOpened || contextMenuState != MenuController.MenuState.HALF_SCREEN));
if (!routePlanningMode && !routeFollowingMode) {
if (mapView.isZooming()) {

View file

@ -28,6 +28,7 @@ import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
@ -801,7 +802,7 @@ public class MapInfoWidgetsFactory {
}
}
}
if (map.isTopToolbarActive() || map.getContextMenu().isVisible()) {
if (map.isTopToolbarActive() || (map.getContextMenu().isVisible() && map.getContextMenu().getCurrentMenuState() == MenuController.MenuState.HALF_SCREEN)) {
updateVisibility(false);
} else if (!showNextTurn && updateWaypoint()) {
updateVisibility(true);

View file

@ -17,6 +17,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.DirectionDrawable;
@ -198,7 +199,7 @@ public class MapMarkersWidgetsFactory {
|| MapRouteInfoMenu.isVisible()
|| addressTopBar.getVisibility() == View.VISIBLE
|| map.isTopToolbarActive()
|| map.getContextMenu().isVisible()) {
|| (map.getContextMenu().isVisible() && map.getContextMenu().getCurrentMenuState() == MenuController.MenuState.HALF_SCREEN)) {
updateVisibility(false);
return;
}