Fix order of entities
This commit is contained in:
parent
2c08623541
commit
963014b8f4
4 changed files with 19 additions and 3 deletions
|
@ -251,7 +251,11 @@ public class Amenity extends MapObject {
|
||||||
public int compareTo(MapObject o) {
|
public int compareTo(MapObject o) {
|
||||||
int cmp = super.compareTo(o);
|
int cmp = super.compareTo(o);
|
||||||
if(cmp == 0 && o instanceof Amenity) {
|
if(cmp == 0 && o instanceof Amenity) {
|
||||||
return ((Amenity) o).getType().getKeyName().compareTo(getType().getKeyName());
|
int kn = ((Amenity) o).getType().getKeyName().compareTo(getType().getKeyName());
|
||||||
|
if(kn == 0) {
|
||||||
|
kn = ((Amenity) o).getSubType().compareTo(getSubType());
|
||||||
|
}
|
||||||
|
return kn;
|
||||||
}
|
}
|
||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +264,8 @@ public class Amenity extends MapObject {
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
boolean res = super.equals(o);
|
boolean res = super.equals(o);
|
||||||
if (res && o instanceof Amenity) {
|
if (res && o instanceof Amenity) {
|
||||||
return ((Amenity) o).getType().getKeyName().equals(getType().getKeyName());
|
return Algorithms.stringsEqual(((Amenity) o).getType().getKeyName(), getType().getKeyName())
|
||||||
|
&& Algorithms.stringsEqual(((Amenity) o).getSubType(), getSubType());
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ public class PoiType extends AbstractPoiType {
|
||||||
if(isReference()) {
|
if(isReference()) {
|
||||||
return referenceType.getOsmTag();
|
return referenceType.getOsmTag();
|
||||||
}
|
}
|
||||||
|
if(osmTag != null && osmTag.startsWith("osmand_amenity")) {
|
||||||
|
return "amenity";
|
||||||
|
}
|
||||||
return osmTag;
|
return osmTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -503,10 +503,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
for (PoiType s : ct.getPoiTypes()) {
|
for (PoiType s : ct.getPoiTypes()) {
|
||||||
if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
||||||
addMapEntryAdapter(subCategories, s.getTranslation(), s);
|
addMapEntryAdapter(subCategories, s.getTranslation(), s);
|
||||||
|
if(!s.getKeyName().contains("osmand")) {
|
||||||
addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s);
|
addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (Map.Entry<String, PoiType> s : editPoiData.getAllTranslatedSubTypes().entrySet()) {
|
for (Map.Entry<String, PoiType> s : editPoiData.getAllTranslatedSubTypes().entrySet()) {
|
||||||
addMapEntryAdapter(subCategories, s.getKey(), s.getValue());
|
addMapEntryAdapter(subCategories, s.getKey(), s.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,6 +242,12 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|
||||||
}, lat, lon, lat, lon, -1, null);
|
}, lat, lon, lat, lon, -1, null);
|
||||||
|
|
||||||
MapPoiTypes types = app.getPoiTypes();
|
MapPoiTypes types = app.getPoiTypes();
|
||||||
|
for (Amenity amenity : amenities) {
|
||||||
|
String poiSimpleFormat = OsmAndFormatter.getPoiStringWithoutType(amenity, lang);
|
||||||
|
if (poiSimpleFormat.equals(name)) {
|
||||||
|
return amenity;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (Amenity amenity : amenities) {
|
for (Amenity amenity : amenities) {
|
||||||
String amenityName = amenity.getName(lang, true);
|
String amenityName = amenity.getName(lang, true);
|
||||||
if (Algorithms.isEmpty(amenityName)) {
|
if (Algorithms.isEmpty(amenityName)) {
|
||||||
|
|
Loading…
Reference in a new issue