Fixes
This commit is contained in:
parent
e817a70ff4
commit
cfbd2fc54c
3 changed files with 52 additions and 13 deletions
|
@ -27,7 +27,16 @@ public class PoiCategory extends PoiFilter {
|
||||||
public List<PoiFilter> getPoiFilters() {
|
public List<PoiFilter> getPoiFilters() {
|
||||||
return poiFilters;
|
return poiFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PoiFilter getPoiFilterByName(String keyName) {
|
||||||
|
for (PoiFilter f : poiFilters) {
|
||||||
|
if (f.getKeyName().equals(keyName)) {
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDefaultTag() {
|
public String getDefaultTag() {
|
||||||
if(defaultTag == null) {
|
if(defaultTag == null) {
|
||||||
return keyName;
|
return keyName;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.TransportRoute;
|
import net.osmand.data.TransportRoute;
|
||||||
import net.osmand.data.TransportStop;
|
import net.osmand.data.TransportStop;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
|
import net.osmand.osm.PoiFilter;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -39,7 +40,19 @@ public class AmenityMenuController extends MenuController {
|
||||||
super(new AmenityMenuBuilder(app, amenity), pointDescription, mapActivity);
|
super(new AmenityMenuBuilder(app, amenity), pointDescription, mapActivity);
|
||||||
this.amenity = amenity;
|
this.amenity = amenity;
|
||||||
if (amenity.getType().getKeyName().equals("transportation")) {
|
if (amenity.getType().getKeyName().equals("transportation")) {
|
||||||
processTransportStop();
|
boolean showTransportStops = false;
|
||||||
|
PoiFilter f = amenity.getType().getPoiFilterByName("public_transport");
|
||||||
|
if (f != null) {
|
||||||
|
for (PoiType t : f.getPoiTypes()) {
|
||||||
|
if (t.getKeyName().equals(amenity.getSubType())) {
|
||||||
|
showTransportStops = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (showTransportStops) {
|
||||||
|
processTransportStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +152,7 @@ public class AmenityMenuController extends MenuController {
|
||||||
};
|
};
|
||||||
if (r.type == null) {
|
if (r.type == null) {
|
||||||
builder.addPlainMenuItem(R.drawable.ic_action_polygom_dark, r.getDescription(getMapActivity().getMyApplication(), true),
|
builder.addPlainMenuItem(R.drawable.ic_action_polygom_dark, r.getDescription(getMapActivity().getMyApplication(), true),
|
||||||
false, false, listener );
|
false, false, listener);
|
||||||
} else {
|
} else {
|
||||||
builder.addPlainMenuItem(r.type.getResourceId(), r.getDescription(getMapActivity().getMyApplication(), true),
|
builder.addPlainMenuItem(r.type.getResourceId(), r.getDescription(getMapActivity().getMyApplication(), true),
|
||||||
false, false, listener);
|
false, false, listener);
|
||||||
|
@ -202,7 +215,7 @@ public class AmenityMenuController extends MenuController {
|
||||||
TransportStopController.TransportStopType type = TransportStopController.TransportStopType.findType(rs.getType());
|
TransportStopController.TransportStopType type = TransportStopController.TransportStopType.findType(rs.getType());
|
||||||
TransportStopRoute r = new TransportStopRoute();
|
TransportStopRoute r = new TransportStopRoute();
|
||||||
r.type = type;
|
r.type = type;
|
||||||
r.desc = rs.getRef() + " " + (useEnglishNames ? rs.getEnName(true) : rs.getName());
|
r.desc = rs.getRef() + " " + (useEnglishNames ? rs.getEnName(true) : rs.getName());
|
||||||
r.route = rs;
|
r.route = rs;
|
||||||
r.stop = s;
|
r.stop = s;
|
||||||
r.distance = dist;
|
r.distance = dist;
|
||||||
|
|
|
@ -29,8 +29,10 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
|
import net.osmand.osm.PoiFilter;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -464,19 +466,34 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
|
||||||
MapPoiTypes poiTypes = getMyApplication().getPoiTypes();
|
MapPoiTypes poiTypes = getMyApplication().getPoiTypes();
|
||||||
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();
|
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();
|
||||||
for (Entry<PoiCategory, LinkedHashSet<String>> entry : filter.getAcceptedTypes().entrySet()) {
|
for (Entry<PoiCategory, LinkedHashSet<String>> entry : filter.getAcceptedTypes().entrySet()) {
|
||||||
if (entry.getKey().getExcludedPoiAdditionalCategories() != null) {
|
for (PoiFilter f : entry.getKey().getPoiFilters()) {
|
||||||
excludedPoiAdditionalCategories.addAll(entry.getKey().getExcludedPoiAdditionalCategories());
|
for (PoiType t : f.getPoiTypes()) {
|
||||||
|
collectExcludedCategories(poiTypes, t, null, excludedPoiAdditionalCategories);
|
||||||
|
}
|
||||||
|
collectExcludedCategories(poiTypes, f, null, excludedPoiAdditionalCategories);
|
||||||
}
|
}
|
||||||
if (entry.getValue() != null) {
|
for (PoiType t : entry.getKey().getPoiTypes()) {
|
||||||
for (String keyName : entry.getValue()) {
|
collectExcludedCategories(poiTypes, t, null, excludedPoiAdditionalCategories);
|
||||||
List<String> categories = poiTypes.getPoiTypeByKey(keyName).getExcludedPoiAdditionalCategories();
|
}
|
||||||
if (categories != null) {
|
collectExcludedCategories(poiTypes, entry.getKey(), entry.getValue(), excludedPoiAdditionalCategories);
|
||||||
excludedPoiAdditionalCategories.addAll(categories);
|
}
|
||||||
}
|
return excludedPoiAdditionalCategories;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void collectExcludedCategories(MapPoiTypes poiTypes,
|
||||||
|
AbstractPoiType type, LinkedHashSet<String> names,
|
||||||
|
Set<String> excludedPoiAdditionalCategories) {
|
||||||
|
if (type.getExcludedPoiAdditionalCategories() != null) {
|
||||||
|
excludedPoiAdditionalCategories.addAll(type.getExcludedPoiAdditionalCategories());
|
||||||
|
}
|
||||||
|
if (names != null) {
|
||||||
|
for (String keyName : names) {
|
||||||
|
List<String> categories = poiTypes.getPoiTypeByKey(keyName).getExcludedPoiAdditionalCategories();
|
||||||
|
if (categories != null) {
|
||||||
|
excludedPoiAdditionalCategories.addAll(categories);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return excludedPoiAdditionalCategories;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PoiFilterListItem> getListItems() {
|
private List<PoiFilterListItem> getListItems() {
|
||||||
|
|
Loading…
Reference in a new issue