From 0bc0eb7cc93a85bd162a440b193b025c04211350 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 29 Jul 2016 17:24:41 +0200 Subject: [PATCH] Add transport route --- .../controllers/TransportRouteController.java | 75 +++++++++++++++++++ .../controllers/TransportStopController.java | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java new file mode 100644 index 0000000000..336c4f71bd --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportRouteController.java @@ -0,0 +1,75 @@ +package net.osmand.plus.mapcontextmenu.controllers; + +import net.osmand.data.LatLon; +import net.osmand.data.PointDescription; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.mapcontextmenu.MenuController; +import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute; + +public class TransportRouteController extends MenuController { + + private TransportStopRoute transportStop; + + public TransportRouteController(OsmandApplication app, MapActivity mapActivity, PointDescription pointDescription, + TransportStopRoute transportStop) { + super(new MenuBuilder(app), pointDescription, mapActivity); + this.transportStop = transportStop; + } + + @Override + protected void setObject(Object object) { + if (object instanceof TransportStopRoute) { + this.transportStop = (TransportStopRoute) object; + } + } + + @Override + protected int getSupportedMenuStatesPortrait() { + return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN; + } + + @Override + public int getLeftIconId() { + return this.transportStop.type.getTopResourceId(); + } + + @Override + public boolean needStreetName() { + return false; + } + + @Override + public boolean displayDistanceDirection() { + return false; + } + + @Override + public boolean fabVisible() { + return false; + } + + @Override + public boolean displayStreetNameInTitle() { + return super.displayStreetNameInTitle(); + } + + @Override + public String getTypeStr() { + return getPointDescription().getTypeName(); + } + + @Override + public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { +// for (TransportStopRoute r : routes) { +// if (r.type == null) { +// addPlainMenuItem(R.drawable.ic_action_polygom_dark, r.desc, false, false); +// } else { +// addPlainMenuItem(r.type.getResourceId(), r.desc, false, false); +// } +// } + super.addPlainMenuItems(typeStr, pointDescription, latLon); + } + +} diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java index 094ab171f7..a5c1766bc9 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java @@ -149,7 +149,7 @@ public class TransportStopController extends MenuController { } } - private class TransportStopRoute { + public static class TransportStopRoute { public TransportStopType type; public String desc; public TransportRoute route;