Hide map widgets and disable context menu when RouteLineAppearanceFragment is visible

This commit is contained in:
nazar-kutz 2021-03-19 18:02:42 +02:00
parent 8ce078f189
commit a9bd3c7a9d
6 changed files with 44 additions and 11 deletions

View file

@ -126,6 +126,7 @@ import net.osmand.plus.settings.datastorage.DataStorageFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
import net.osmand.plus.settings.fragments.RouteLineAppearanceFragment;
import net.osmand.plus.track.TrackAppearanceFragment;
import net.osmand.plus.track.TrackMenuFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
@ -2266,6 +2267,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return getFragment(TrackMenuFragment.TAG);
}
public RouteLineAppearanceFragment getRouteLineAppearanceFragment() {
return getFragment(RouteLineAppearanceFragment.TAG);
}
public void backToConfigureProfileFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount();

View file

@ -872,14 +872,16 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean showBottomMenuButtons = (showRouteCalculationControls || !routeFollowingMode)
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode()
&& !isInPlanRouteMode() && !shouldHideTopControls && !isInChoosingRoutesMode()
&& !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode();
&& !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode()
&& !isInRouteLineCustomizationMode();
routePlanningBtn.updateVisibility(showBottomMenuButtons);
menuControl.updateVisibility(showBottomMenuButtons);
boolean additionalDialogsHide = !isInGpxApproximationMode()
&& !isInTrackAppearanceMode()
&& !isInChoosingRoutesMode()
&& !isInWaypointsChoosingMode();
&& !isInWaypointsChoosingMode()
&& !isInRouteLineCustomizationMode();
boolean showZoomButtons = !routeDialogOpened && !shouldHideTopControls
&& !isInFollowTrackMode()
&& (additionalDialogsHide || !portrait);
@ -888,7 +890,8 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode()
|| isInPlanRouteMode() || shouldHideTopControls || isInChoosingRoutesMode()
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode();
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode()
|| isInRouteLineCustomizationMode();
compassHud.forceHideCompass = forceHideCompass;
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
@ -899,7 +902,8 @@ public class MapControlsLayer extends OsmandMapLayer {
}
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !shouldHideTopControls
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode()
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode();
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode()
&& !isInRouteLineCustomizationMode();
layersHud.updateVisibility(showTopButtons);
quickSearchHud.updateVisibility(showTopButtons);
@ -1029,7 +1033,8 @@ public class MapControlsLayer extends OsmandMapLayer {
&& !isInGpxApproximationMode()
&& !isInChoosingRoutesMode()
&& !isInWaypointsChoosingMode()
&& !isInFollowTrackMode();
&& !isInFollowTrackMode()
&& !isInRouteLineCustomizationMode();
backToLocationControl.updateVisibility(visible && !dialogOpened && !isInPlanRouteMode()
&& (additionalDialogsHide || !isPotrait()));
}
@ -1397,6 +1402,10 @@ public class MapControlsLayer extends OsmandMapLayer {
return MapRouteInfoMenu.waypointsVisible;
}
private boolean isInRouteLineCustomizationMode() {
return mapActivity.getMapLayers().getRouteLayer().isInRouteLineAppearanceMode();
}
private boolean isInFollowTrackMode() {
return MapRouteInfoMenu.followTrackVisible;
}

View file

@ -61,6 +61,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
private final MapMarkersLayer mapMarkersLayer;
private final MapControlsLayer mapControlsLayer;
private final GPXLayer gpxLayer;
private final RouteLayer routeLayer;
private ImageView contextMarker;
private final MapActivity mapActivity;
private final OsmandApplication app;
@ -90,6 +91,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
mapMarkersLayer = mapActivity.getMapLayers().getMapMarkersLayer();
gpxLayer = mapActivity.getMapLayers().getGpxLayer();
mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
routeLayer = mapActivity.getMapLayers().getRouteLayer();
}
@Override
@ -426,6 +428,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
mapMarkersLayer.isInPlanRouteMode() ||
gpxLayer.isInTrackAppearanceMode() ||
mapControlsLayer.isInTrackMenuMode() ||
routeLayer.isInRouteLineAppearanceMode() ||
mapRouteInfoMenu.isVisible() ||
MapRouteInfoMenu.chooseRoutesVisible ||
MapRouteInfoMenu.waypointsVisible ||

View file

@ -206,8 +206,8 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
}
private boolean isPlanRouteGraphsAvailable() {
if (view.getContext() instanceof MapActivity) {
MapActivity mapActivity = (MapActivity) view.getContext();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
MeasurementToolFragment fragment = mapActivity.getMeasurementToolFragment();
if (fragment != null) {
return fragment.hasVisibleGraph();
@ -216,6 +216,20 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
return false;
}
public boolean isInRouteLineAppearanceMode() {
MapActivity mapActivity = getMapActivity();
return mapActivity != null
&& mapActivity.getRouteLineAppearanceFragment() != null
&& mapActivity.getRouteLineAppearanceFragment().isVisible();
}
private MapActivity getMapActivity() {
if (view.getContext() instanceof MapActivity) {
return (MapActivity) view.getContext();
}
return null;
}
private void updateAttrs(DrawSettings settings, RotatedTileBox tileBox) {
boolean updatePaints = attrs.updatePaints(view.getApplication(), settings, tileBox);
attrs.isPaint3 = false;
@ -636,12 +650,12 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
@Override
public boolean disableSingleTap() {
return false;
return isInRouteLineAppearanceMode();
}
@Override
public boolean disableLongPressOnMap() {
return false;
return isInRouteLineAppearanceMode();
}
@Override

View file

@ -1207,6 +1207,7 @@ public class MapInfoWidgetsFactory {
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && !map.shouldHideTopControls()
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
&& !map.getMapLayers().getRouteLayer().isInRouteLineAppearanceMode()
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible
&& !MapRouteInfoMenu.followTrackVisible;

View file

@ -191,7 +191,8 @@ public class MapMarkersWidgetsFactory {
|| map.isTopToolbarActive()
|| map.shouldHideTopControls()
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()
|| map.getMapLayers().getRouteLayer().isInRouteLineAppearanceMode()) {
updateVisibility(false);
return;
}