Add transport route

This commit is contained in:
Victor Shcherb 2016-07-29 17:24:41 +02:00
parent 836a1f02cf
commit 0bc0eb7cc9
2 changed files with 76 additions and 1 deletions

View file

@ -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);
}
}

View file

@ -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;