This commit is contained in:
Alexey Kulish 2016-09-22 17:27:50 +03:00
parent cec52a53e8
commit 5f5e574ac5

View file

@ -113,25 +113,30 @@ public class ContextMenuLayer extends OsmandMapLayer {
paint = new Paint(); paint = new Paint();
pressedBitmap = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_shield_tap); pressedBitmap = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_shield_tap);
pressedBitmapSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_shield_tap_small); pressedBitmapSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_shield_tap_small);
publicTransportTypes = new ArrayList<>();
List<PoiFilter> filters = activity.getMyApplication().getPoiTypes().getPoiCategoryByName("transportation").getPoiFilters();
for (PoiFilter poiFilter : filters) {
if (poiFilter.getKeyName().equals("public_transport")) {
for (PoiType poiType : poiFilter.getPoiTypes()) {
publicTransportTypes.add(poiType.getKeyName());
for (PoiType poiAdditionalType : poiType.getPoiAdditionals()) {
publicTransportTypes.add(poiAdditionalType.getKeyName());
}
}
}
}
} }
public boolean isVisible() { public boolean isVisible() {
return menu.isActive(); return menu.isActive();
} }
private List<String> getPublicTransportTypes() {
if (publicTransportTypes == null) {
publicTransportTypes = new ArrayList<>();
List<PoiFilter> filters = activity.getMyApplication().getPoiTypes().getPoiCategoryByName("transportation").getPoiFilters();
for (PoiFilter poiFilter : filters) {
if (poiFilter.getKeyName().equals("public_transport")) {
for (PoiType poiType : poiFilter.getPoiTypes()) {
publicTransportTypes.add(poiType.getKeyName());
for (PoiType poiAdditionalType : poiType.getPoiAdditionals()) {
publicTransportTypes.add(poiAdditionalType.getKeyName());
}
}
}
}
}
return publicTransportTypes;
}
@Override @Override
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings nightMode) { public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings nightMode) {
for (LatLon latLon : pressedLatLonSmall) { for (LatLon latLon : pressedLatLonSmall) {
@ -681,7 +686,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
} }
} }
if (res != null && publicTransportTypes.contains(res.getSubType())) { if (res != null && getPublicTransportTypes().contains(res.getSubType())) {
return findNearestTransportStop(lat, lon) == null ? res : null; return findNearestTransportStop(lat, lon) == null ? res : null;
} }