Merge pull request #4502 from osmandapp/context_menu_hide
Hide topbar and widgets when context menu is open
This commit is contained in:
commit
6d428ef621
6 changed files with 565 additions and 553 deletions
|
@ -368,6 +368,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
fragmentRef.get().centerMarkerLocation();
|
fragmentRef.get().centerMarkerLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateWidgetsVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(@NonNull LatLon latLon,
|
public void show(@NonNull LatLon latLon,
|
||||||
|
@ -388,6 +389,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
}
|
}
|
||||||
centerMarker = false;
|
centerMarker = false;
|
||||||
autoHide = false;
|
autoHide = false;
|
||||||
|
updateWidgetsVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(LatLon latLon, PointDescription pointDescription, Object object) {
|
public void update(LatLon latLon, PointDescription pointDescription, Object object) {
|
||||||
|
@ -446,6 +448,15 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
fragmentRef.get().dismissMenu();
|
fragmentRef.get().dismissMenu();
|
||||||
}
|
}
|
||||||
|
updateWidgetsVisibility(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private 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);
|
||||||
|
mapActivity.findViewById(R.id.map_right_widgets_panel).setVisibility(visibility);
|
||||||
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// timeout in msec
|
// timeout in msec
|
||||||
|
@ -713,7 +724,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void buttonFavoritePressed() {
|
public void buttonFavoritePressed() {
|
||||||
if (object != null && object instanceof FavouritePoint) {
|
if (object != null && object instanceof FavouritePoint) {
|
||||||
getFavoritePointEditor().edit((FavouritePoint) object);
|
getFavoritePointEditor().edit((FavouritePoint) object);
|
||||||
|
@ -815,7 +825,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWptPt(LatLon latLon, String title, String categoryName, int categoryColor, boolean skipDialog){
|
public void addWptPt(LatLon latLon, String title, String categoryName, int categoryColor, boolean skipDialog) {
|
||||||
|
|
||||||
final List<SelectedGpxFile> list
|
final List<SelectedGpxFile> list
|
||||||
= mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles();
|
= mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles();
|
||||||
|
|
|
@ -708,11 +708,12 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
||||||
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
||||||
|
boolean contextMenuOpened = mapActivity.getContextMenu().isVisible();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||||
updateMyLocation(rh, routeDialogOpened || trackDialogOpened);
|
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || contextMenuOpened);
|
||||||
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
|
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
|
||||||
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode();
|
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened;
|
||||||
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
|
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
|
||||||
if (rh.isFollowingMode()) {
|
if (rh.isFollowingMode()) {
|
||||||
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
|
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
|
||||||
|
@ -727,16 +728,16 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanningBtn.updateVisibility(showButtons);
|
routePlanningBtn.updateVisibility(showButtons);
|
||||||
menuControl.updateVisibility(showButtons);
|
menuControl.updateVisibility(showButtons);
|
||||||
|
|
||||||
mapZoomIn.updateVisibility(!routeDialogOpened);
|
mapZoomIn.updateVisibility(!routeDialogOpened && !contextMenuOpened);
|
||||||
mapZoomOut.updateVisibility(!routeDialogOpened);
|
mapZoomOut.updateVisibility(!routeDialogOpened && !contextMenuOpened);
|
||||||
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
|
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
|
||||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode());
|
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
|
||||||
|
|
||||||
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
|
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
|
||||||
layersHud.update(app, isNight);
|
layersHud.update(app, isNight);
|
||||||
}
|
}
|
||||||
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode());
|
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
|
||||||
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode());
|
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
|
||||||
|
|
||||||
if (!routePlanningMode && !routeFollowingMode) {
|
if (!routePlanningMode && !routeFollowingMode) {
|
||||||
if (mapView.isZooming()) {
|
if (mapView.isZooming()) {
|
||||||
|
|
|
@ -577,7 +577,7 @@ public class MapInfoWidgetsFactory {
|
||||||
initToolbar(defaultController);
|
initToolbar(defaultController);
|
||||||
defaultController.updateToolbar(this);
|
defaultController.updateToolbar(this);
|
||||||
}
|
}
|
||||||
updateVisibility(controller != null);
|
updateVisibility(controller != null && (!map.getContextMenu().isVisible() || controller.getType() == TopToolbarControllerType.CONTEXT_MENU));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateColors(TopToolbarController controller) {
|
public void updateColors(TopToolbarController controller) {
|
||||||
|
@ -801,7 +801,7 @@ public class MapInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.isTopToolbarActive()) {
|
if (map.isTopToolbarActive() || map.getContextMenu().isVisible()) {
|
||||||
updateVisibility(false);
|
updateVisibility(false);
|
||||||
} else if (!showNextTurn && updateWaypoint()) {
|
} else if (!showNextTurn && updateWaypoint()) {
|
||||||
updateVisibility(true);
|
updateVisibility(true);
|
||||||
|
|
|
@ -197,7 +197,8 @@ public class MapMarkersWidgetsFactory {
|
||||||
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|
||||||
|| MapRouteInfoMenu.isVisible()
|
|| MapRouteInfoMenu.isVisible()
|
||||||
|| addressTopBar.getVisibility() == View.VISIBLE
|
|| addressTopBar.getVisibility() == View.VISIBLE
|
||||||
|| map.isTopToolbarActive()) {
|
|| map.isTopToolbarActive()
|
||||||
|
|| map.getContextMenu().isVisible()) {
|
||||||
updateVisibility(false);
|
updateVisibility(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue