Add transport route
This commit is contained in:
parent
836a1f02cf
commit
0bc0eb7cc9
2 changed files with 76 additions and 1 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -149,7 +149,7 @@ public class TransportStopController extends MenuController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TransportStopRoute {
|
public static class TransportStopRoute {
|
||||||
public TransportStopType type;
|
public TransportStopType type;
|
||||||
public String desc;
|
public String desc;
|
||||||
public TransportRoute route;
|
public TransportRoute route;
|
||||||
|
|
Loading…
Reference in a new issue