Create method in context menu
This commit is contained in:
parent
bd4be5ee6e
commit
d2263b6152
5 changed files with 20 additions and 20 deletions
|
@ -368,6 +368,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
fragmentRef.get().centerMarkerLocation();
|
||||
}
|
||||
}
|
||||
updateWidgetsVisibility();
|
||||
}
|
||||
|
||||
public void show(@NonNull LatLon latLon,
|
||||
|
@ -376,6 +377,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
if (init(latLon, pointDescription, object)) {
|
||||
showInternal();
|
||||
}
|
||||
updateWidgetsVisibility();
|
||||
}
|
||||
|
||||
private void showInternal() {
|
||||
|
@ -446,17 +448,21 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
if (fragmentRef != null) {
|
||||
fragmentRef.get().dismissMenu();
|
||||
}
|
||||
updateWidgetsVisibility(true);
|
||||
updateWidgetsVisibility();
|
||||
}
|
||||
|
||||
public void updateWidgetsVisibility(boolean visible) {
|
||||
int visibility = visible ? View.VISIBLE : View.GONE;
|
||||
public void updateWidgetsVisibility() {
|
||||
int visibility = shouldShowControls() ? 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();
|
||||
}
|
||||
|
||||
public boolean shouldShowControls() {
|
||||
return !isVisible() || isLandscapeLayout() || getCurrentMenuState() == MenuController.MenuState.HEADER_ONLY;
|
||||
}
|
||||
|
||||
// timeout in msec
|
||||
public void hideWithTimeout(long timeout) {
|
||||
autoHide = true;
|
||||
|
|
|
@ -525,7 +525,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
|||
boolean needMapAdjust = oldMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN;
|
||||
|
||||
if (newMenuState != oldMenuState) {
|
||||
menu.updateWidgetsVisibility(menu.isLandscapeLayout() || newMenuState == MenuState.HEADER_ONLY);
|
||||
menu.updateWidgetsVisibility();
|
||||
doBeforeMenuStateChange(oldMenuState, newMenuState);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ 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,14 +708,12 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
||||
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
||||
boolean contextMenuOpened = mapActivity.getContextMenu().isVisible();
|
||||
boolean contextMenuInLandscape = mapActivity.getContextMenu().isLandscapeLayout();
|
||||
int contextMenuState = mapActivity.getContextMenu().getCurrentMenuState();
|
||||
boolean showControlsDueToContextMenu = mapActivity.getContextMenu().shouldShowControls();
|
||||
boolean showRouteCalculationControls = routePlanningMode ||
|
||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || (contextMenuOpened && !contextMenuInLandscape && contextMenuState != MenuController.MenuState.HEADER_ONLY));
|
||||
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || !showControlsDueToContextMenu);
|
||||
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
|
||||
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && (!contextMenuOpened || contextMenuInLandscape || contextMenuState == MenuController.MenuState.HEADER_ONLY);
|
||||
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && showControlsDueToContextMenu;
|
||||
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
|
||||
if (rh.isFollowingMode()) {
|
||||
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
|
||||
|
@ -731,19 +728,18 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
routePlanningBtn.updateVisibility(showButtons);
|
||||
menuControl.updateVisibility(showButtons);
|
||||
|
||||
mapZoomIn.updateVisibility(!routeDialogOpened && (!contextMenuOpened || contextMenuInLandscape || contextMenuState == MenuController.MenuState.HEADER_ONLY));
|
||||
mapZoomOut.updateVisibility(!routeDialogOpened && (!contextMenuOpened || contextMenuInLandscape || contextMenuState == MenuController.MenuState.HEADER_ONLY));
|
||||
mapZoomIn.updateVisibility(!routeDialogOpened && showControlsDueToContextMenu);
|
||||
mapZoomOut.updateVisibility(!routeDialogOpened && showControlsDueToContextMenu);
|
||||
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
|
||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode()
|
||||
&& (!contextMenuOpened || contextMenuInLandscape || contextMenuState == MenuController.MenuState.HEADER_ONLY));
|
||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && showControlsDueToContextMenu);
|
||||
|
||||
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
|
||||
layersHud.update(app, isNight);
|
||||
}
|
||||
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
|
||||
&& (!contextMenuOpened || contextMenuInLandscape || contextMenuState == MenuController.MenuState.HEADER_ONLY));
|
||||
&& showControlsDueToContextMenu);
|
||||
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
|
||||
&& (!contextMenuOpened || contextMenuInLandscape || contextMenuState == MenuController.MenuState.HEADER_ONLY));
|
||||
&& showControlsDueToContextMenu);
|
||||
|
||||
if (!routePlanningMode && !routeFollowingMode) {
|
||||
if (mapView.isZooming()) {
|
||||
|
|
|
@ -803,8 +803,7 @@ public class MapInfoWidgetsFactory {
|
|||
}
|
||||
}
|
||||
}
|
||||
MapContextMenu contextMenu = map.getContextMenu();
|
||||
if (map.isTopToolbarActive() || (contextMenu.isVisible() && !contextMenu.isLandscapeLayout() && contextMenu.getCurrentMenuState() != MenuController.MenuState.HEADER_ONLY)) {
|
||||
if (map.isTopToolbarActive() || !map.getContextMenu().shouldShowControls()) {
|
||||
updateVisibility(false);
|
||||
} else if (!showNextTurn && updateWaypoint()) {
|
||||
updateVisibility(true);
|
||||
|
|
|
@ -192,7 +192,6 @@ public class MapMarkersWidgetsFactory {
|
|||
}
|
||||
}
|
||||
|
||||
MapContextMenu contextMenu = map.getContextMenu();
|
||||
List<MapMarker> markers = helper.getMapMarkers();
|
||||
if (zoom < 3 || markers.size() == 0
|
||||
|| !map.getMyApplication().getSettings().MAP_MARKERS_MODE.get().isToolbar()
|
||||
|
@ -201,7 +200,7 @@ public class MapMarkersWidgetsFactory {
|
|||
|| MapRouteInfoMenu.isVisible()
|
||||
|| addressTopBar.getVisibility() == View.VISIBLE
|
||||
|| map.isTopToolbarActive()
|
||||
|| (contextMenu.isVisible() && !contextMenu.isLandscapeLayout() && contextMenu.getCurrentMenuState() != MenuController.MenuState.HEADER_ONLY)) {
|
||||
|| !map.getContextMenu().shouldShowControls()) {
|
||||
updateVisibility(false);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue