From bbb1fd0ac6c5309dc2c4533391f5bc2aa3570b16 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Fri, 12 Mar 2021 22:46:37 +0200 Subject: [PATCH] Remove "Swap" button from RP if "Follow track" https://github.com/osmandapp/OsmAnd-Issues/issues/186 --- .../plus/routepreparationmenu/MapRouteInfoMenu.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 2475d70f34..e57dec6080 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -98,9 +98,9 @@ import net.osmand.plus.routepreparationmenu.cards.PublicTransportNotFoundSetting import net.osmand.plus.routepreparationmenu.cards.PublicTransportNotFoundWarningCard; import net.osmand.plus.routepreparationmenu.cards.SimpleRouteCard; import net.osmand.plus.routepreparationmenu.cards.TracksCard; +import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.routing.IRouteInformationListener; import net.osmand.plus.routing.RouteCalculationResult; -import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelperUtils; import net.osmand.plus.routing.TransportRoutingHelper; @@ -1831,6 +1831,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener }); FrameLayout fromButton = (FrameLayout) mainView.findViewById(R.id.from_button); + boolean isFollowTrack = app.getRoutingHelper().getCurrentGPXRoute() != null; + + if (isFollowTrack) { + fromButton.setVisibility(View.GONE); + } else { + fromButton.setVisibility(View.VISIBLE); + } LinearLayout fromButtonContainer = (LinearLayout) mainView.findViewById(R.id.from_button_container); setupButtonBackground(fromButton, fromButtonContainer);