[android] Don't set subway routing mode when layer active

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond 2025-02-26 13:19:10 +00:00 committed by Konstantin Pastbin
parent 32bf3a3e9a
commit b14939e770
3 changed files with 5 additions and 34 deletions

View file

@ -77,7 +77,6 @@ import app.organicmaps.maplayer.MapButtonsViewModel;
import app.organicmaps.maplayer.ToggleMapLayerFragment;
import app.organicmaps.maplayer.isolines.IsolinesManager;
import app.organicmaps.maplayer.isolines.IsolinesState;
import app.organicmaps.maplayer.subway.SubwayManager;
import app.organicmaps.routing.NavigationController;
import app.organicmaps.routing.NavigationService;
import app.organicmaps.routing.RoutePointInfo;
@ -1675,12 +1674,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
mRoutingPlanInplaceController.showDrivingOptionView();
}
@Override
public boolean isSubwayEnabled()
{
return SubwayManager.from(this).isEnabled();
}
@Override
public void onCommonBuildError(int lastResultCode, @NonNull String[] lastMissingMaps)
{

View file

@ -99,7 +99,7 @@ public class Factory
RoutingController.get().prepare(MapObject.createMapObject(FeatureId.EMPTY, MapObject.API_POINT,
from.mName, "", from.mLat, from.mLon),
MapObject.createMapObject(FeatureId.EMPTY, MapObject.API_POINT,
to.mName, "", to.mLat, to.mLon), true);
to.mName, "", to.mLat, to.mLon));
return true;
case RequestType.SEARCH:
{

View file

@ -60,7 +60,7 @@ public class RoutingController
default void onResetToPlanningState() {}
default void onBuiltRoute() {}
default void onDrivingOptionsWarning() {}
default boolean isSubwayEnabled() { return false; }
default void onCommonBuildError(int lastResultCode, @NonNull String[] lastMissingMaps) {}
default void onDrivingOptionsBuildError() {}
@ -333,45 +333,23 @@ public class RoutingController
{
setState(State.NONE);
setBuildState(BuildState.NONE);
prepare(getStartPoint(), getEndPoint(), false);
prepare(getStartPoint(), getEndPoint());
}
public void prepare(@Nullable MapObject startPoint, @Nullable MapObject endPoint)
{
prepare(startPoint, endPoint, false);
}
public void prepare(@Nullable MapObject startPoint, @Nullable MapObject endPoint, boolean fromApi)
{
Logger.d(TAG, "prepare (" + (endPoint == null ? "route)" : "p2p)"));
initLastRouteType(startPoint, endPoint, fromApi);
initLastRouteType(startPoint, endPoint);
prepare(startPoint, endPoint, mLastRouterType);
}
private void initLastRouteType(@Nullable MapObject startPoint, @Nullable MapObject endPoint,
boolean fromApi)
private void initLastRouteType(@Nullable MapObject startPoint, @Nullable MapObject endPoint)
{
if (shouldForceTransitRoute(fromApi))
{
mLastRouterType = Framework.ROUTER_TYPE_TRANSIT;
return;
}
if (startPoint != null && endPoint != null)
mLastRouterType = Framework.nativeGetBestRouter(startPoint.getLat(), startPoint.getLon(),
endPoint.getLat(), endPoint.getLon());
}
private boolean isSubwayEnabled()
{
return mContainer != null && mContainer.isSubwayEnabled();
}
private boolean shouldForceTransitRoute(boolean fromApi)
{
return mState == State.NONE && isSubwayEnabled() && !fromApi;
}
public void prepare(final @Nullable MapObject startPoint, final @Nullable MapObject endPoint,
@Framework.RouterType int routerType)
{