diff --git a/OsmAnd-java/src/net/osmand/osm/AbstractPoiType.java b/OsmAnd-java/src/net/osmand/osm/AbstractPoiType.java index 4935288527..a7bad75ea9 100644 --- a/OsmAnd-java/src/net/osmand/osm/AbstractPoiType.java +++ b/OsmAnd-java/src/net/osmand/osm/AbstractPoiType.java @@ -11,6 +11,8 @@ public abstract class AbstractPoiType { protected final String keyName; protected final MapPoiTypes registry; private List poiAdditionals = null; + private boolean topVisible; + public AbstractPoiType(String keyName, MapPoiTypes registry) { this.keyName = keyName; @@ -25,6 +27,18 @@ public abstract class AbstractPoiType { return getKeyName().replace(':', '_'); } + public void setTopVisible(boolean topVisible) { + this.topVisible = topVisible; + } + + public boolean isTopVisible() { + return topVisible; + } + + public boolean isAdditional() { + return this instanceof PoiType && ((PoiType) this).isAdditional(); + } + public String getTranslation() { return registry.getTranslation(this); diff --git a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java index 3039427fac..69faedef1d 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java @@ -126,7 +126,7 @@ public class MapPoiTypes { return null; } - public Map getAllTranslatedNames(boolean onlyTranslation) { + public Map getAllTranslatedNames() { Map translation = new TreeMap(); for(PoiCategory pc : categories) { for(PoiType pt : pc.getPoiTypes()) { @@ -134,12 +134,6 @@ public class MapPoiTypes { continue; } translation.put(pt.getTranslation(), pt); - if(!onlyTranslation) { - String kn = pt.getKeyName().replace('_', ' '); - if(!pt.getTranslation().toLowerCase().contains(kn)) { - translation.put(Algorithms.capitalizeFirstLetterAndLowercase(kn), pt); - } - } } } return translation; @@ -147,19 +141,19 @@ public class MapPoiTypes { public Map getAllTypesTranslatedNames(StringMatcher matcher) { TreeMap tm = new TreeMap(Collator.getInstance()); - Map translation = new TreeMap(); - for(PoiCategory pc : categories) { + for (PoiCategory pc : categories) { addIf(tm, pc, matcher); - for(PoiFilter pt : pc.getPoiFilters()) { + for (PoiFilter pt : pc.getPoiFilters()) { addIf(tm, pt, matcher); } - for(PoiType pt : pc.getPoiTypes()) { - if(pt.isReference()) { + for (PoiType pt : pc.getPoiTypes()) { + if (pt.isReference()) { continue; } addIf(tm, pt, matcher); } } + return tm; } @@ -167,6 +161,12 @@ public class MapPoiTypes { if(matcher.matches(pc.getTranslation()) || matcher.matches(pc.getKeyName().replace('_', ' '))) { tm.put(pc.getTranslation(), pc); } + List additionals = pc.getPoiAdditionals(); + if (additionals != null) { + for (PoiType a : additionals) { + addIf(tm, a, matcher); + } + } } @@ -174,11 +174,10 @@ public class MapPoiTypes { Map translation = new TreeMap(); for (PoiType pt : pc.getPoiTypes()) { translation.put(pt.getTranslation(), pt); + if (!onlyTranslation) { - String kn = pt.getKeyName().replace('_', ' '); - if(!pt.getTranslation().toLowerCase().contains(kn)) { - translation.put(Algorithms.capitalizeFirstLetterAndLowercase(kn), pt); - } +// translation.put(pt.getKeyName(), pt); + translation.put(Algorithms.capitalizeFirstLetterAndLowercase(pt.getKeyName().replace('_', ' ')), pt); } } return translation; @@ -264,6 +263,10 @@ public class MapPoiTypes { lastCategory.addPoiType(tp); } else if (name.equals("poi_additional")) { PoiType tp = new PoiType(this, lastCategory, parser.getAttributeValue("", "name")); + tp.setAdditional(lastType != null ? lastType : + (lastFilter != null ? lastFilter : lastCategory)); + tp.setTopVisible(Boolean.parseBoolean(parser.getAttributeValue("", "top"))); + tp.setOsmTag(parser.getAttributeValue("", "tag")); tp.setOsmValue(parser.getAttributeValue("", "value")); tp.setOsmTag2(parser.getAttributeValue("", "tag2")); @@ -350,6 +353,42 @@ public class MapPoiTypes { } + private PoiType getPoiAdditionalByKey(AbstractPoiType p, String name) { + List pp = p.getPoiAdditionals(); + if (pp != null) { + for (PoiType pt : pp) { + if (pt.getKeyName().equals(name)) { + return pt; + } + } + } + return null; + + } + + public AbstractPoiType getAnyPoiAdditionalTypeByKey(String name) { + PoiType add = null; + for (PoiCategory pc : categories) { + add = getPoiAdditionalByKey(pc, name); + if (add != null) { + return add; + } + for (PoiFilter pf : pc.getPoiFilters()) { + add = getPoiAdditionalByKey(pf, name); + if (add != null) { + return add; + } + } + for (PoiType p : pc.getPoiTypes()) { + add = getPoiAdditionalByKey(p, name); + if (add != null) { + return add; + } + } + } + return null; + } + private static void print(String indent, PoiFilter f) { for(PoiType pt : f.getPoiTypes()) { System.out.println(indent + " Type " + pt.getKeyName() + diff --git a/OsmAnd-java/src/net/osmand/osm/PoiFilter.java b/OsmAnd-java/src/net/osmand/osm/PoiFilter.java index bcb44cc19f..a4d2a79396 100644 --- a/OsmAnd-java/src/net/osmand/osm/PoiFilter.java +++ b/OsmAnd-java/src/net/osmand/osm/PoiFilter.java @@ -9,7 +9,6 @@ import java.util.Map; public class PoiFilter extends AbstractPoiType { private PoiCategory pc; - private boolean topVisible; private List poiTypes = new ArrayList(); private Map map = new LinkedHashMap(); @@ -71,12 +70,4 @@ public class PoiFilter extends AbstractPoiType { return poiTypes; } - public void setTopVisible(boolean topVisible) { - this.topVisible = topVisible; - } - - public boolean isTopVisible() { - return topVisible; - } - } diff --git a/OsmAnd-java/src/net/osmand/osm/PoiType.java b/OsmAnd-java/src/net/osmand/osm/PoiType.java index 6b1d9e0b92..1cedd529fa 100644 --- a/OsmAnd-java/src/net/osmand/osm/PoiType.java +++ b/OsmAnd-java/src/net/osmand/osm/PoiType.java @@ -6,6 +6,7 @@ import java.util.Map; public class PoiType extends AbstractPoiType { private PoiCategory category; + private AbstractPoiType parentType; private PoiType referenceType; private String osmTag; private String osmTag2; @@ -79,6 +80,9 @@ public class PoiType extends AbstractPoiType { } public Map> putTypes(Map> acceptedTypes) { + if (isAdditional()) { + return parentType.putTypes(acceptedTypes); + } PoiType rt = getReferenceType(); PoiType poiType = rt != null ? rt : this; if (!acceptedTypes.containsKey(poiType.category)) { @@ -91,6 +95,16 @@ public class PoiType extends AbstractPoiType { return acceptedTypes; } - + public void setAdditional(AbstractPoiType parentType) { + this.parentType = parentType; + } + + public boolean isAdditional(){ + return parentType != null; + } + + public AbstractPoiType getParentType() { + return parentType; + } } diff --git a/OsmAnd/res/values-be/phrases.xml b/OsmAnd/res/values-be/phrases.xml index 0fe271389a..e41e37dd67 100644 --- a/OsmAnd/res/values-be/phrases.xml +++ b/OsmAnd/res/values-be/phrases.xml @@ -730,29 +730,29 @@ Даліна Лес Землекарыстаньне - Дызэль - GTL-дызэль - HGV-дызэль - Біядызэль - Звадкаваны газ - Актан 80 - Актан 91 - Актан 92 - Актан 95 - Актан 98 - Актан 100 - Сьціснуты прыродны газ - Паліва 1:25 - Паліва 1:50 - Этаноль - Мэтаноль - Алейнае паліва - E10 - E20 - E85 - E85 - Вадкі вадарод - Электрычнасьць + Дызэль + GTL-дызэль + HGV-дызэль + Біядызэль + Звадкаваны газ + Актан 80 + Актан 91 + Актан 92 + Актан 95 + Актан 98 + Актан 100 + Сьціснуты прыродны газ + Паліва 1:25 + Паліва 1:50 + Этаноль + Мэтаноль + Алейнае паліва + E10 + E20 + E85 + E85 + Вадкі вадарод + Электрычнасьць Падворак Луг diff --git a/OsmAnd/res/values-bg/phrases.xml b/OsmAnd/res/values-bg/phrases.xml index b7122a226d..f74731dc81 100644 --- a/OsmAnd/res/values-bg/phrases.xml +++ b/OsmAnd/res/values-bg/phrases.xml @@ -153,21 +153,21 @@ ГТП Автомивка Бензиностанция - Дизел - GTL дизел - Дизел за камиони - Био дизел - Природен газ - Октан 80 - А 91 - А 92 - А 95 - А 98 - А 100 - 1:25 гориво - 1:50 гориво - Етанол - Метанол - E10 - E20 + Дизел + GTL дизел + Дизел за камиони + Био дизел + Природен газ + Октан 80 + А 91 + А 92 + А 95 + А 98 + А 100 + 1:25 гориво + 1:50 гориво + Етанол + Метанол + E10 + E20 diff --git a/OsmAnd/res/values-ca/phrases.xml b/OsmAnd/res/values-ca/phrases.xml index 5aaffe9d9f..ed58227011 100644 --- a/OsmAnd/res/values-ca/phrases.xml +++ b/OsmAnd/res/values-ca/phrases.xml @@ -405,19 +405,19 @@ Mobles de cuina Subministraments mèdics Fotografia - Dièsel - Gasoil de vehicles pesants - Gasoil biològic - 80 octans - 91 octans - 92 octans - 95 octans - 98 octans - 100 octans - Etanol - Metanol - Hidrogen líquid - Electricitat + Dièsel + Gasoil de vehicles pesants + Gasoil biològic + 80 octans + 91 octans + 92 octans + 95 octans + 98 octans + 100 octans + Etanol + Metanol + Hidrogen líquid + Electricitat Rampa per vehicles Aire comprimit Localització de parada de transport públic @@ -434,16 +434,16 @@ Boca d\'incendis Subministrament d\'aigua Xafa focs - 10% etanol - 20% etanol - 85% etanol - 85% etanol - Gasoil extra - Gas liquat del petroli - Gas natural comprimit - Benzina amb 1:25 d\'oli - Benzina amb 1:50 d\'oli - Carburant d\'oli vegetal + 10% etanol + 20% etanol + 85% etanol + 85% etanol + Gasoil extra + Gas liquat del petroli + Gas natural comprimit + Benzina amb 1:25 d\'oli + Benzina amb 1:50 d\'oli + Carburant d\'oli vegetal Topall de via Àrea industrial Prat diff --git a/OsmAnd/res/values-cs/phrases.xml b/OsmAnd/res/values-cs/phrases.xml index 269793598a..68f77cc5ec 100644 --- a/OsmAnd/res/values-cs/phrases.xml +++ b/OsmAnd/res/values-cs/phrases.xml @@ -321,29 +321,29 @@ Hlukové pásy Plochý hrb Zůžení - Nafta - Vysoce kvalitní nafta - Nafta (tlakový přívod) - Bionafta - LPG - 80 oktanů - 91 oktanů - 92 oktanů - 95 oktanů - 98 oktanů - 100 oktanů - CNG - zemní plyn - 1:25 palivo (olej:benzín) - 1:50 palivo (olej:benzín) - Etanol - Metanol - Rostlinný olej - E10 (10% Bioetanol) - E20 (20% Etanol) - E85 - (85% Etanol) - E85 - (85% Etanol) - Kapalný vodík - Nabíjení + Nafta + Vysoce kvalitní nafta + Nafta (tlakový přívod) + Bionafta + LPG + 80 oktanů + 91 oktanů + 92 oktanů + 95 oktanů + 98 oktanů + 100 oktanů + CNG - zemní plyn + 1:25 palivo (olej:benzín) + 1:50 palivo (olej:benzín) + Etanol + Metanol + Rostlinný olej + E10 (10% Bioetanol) + E20 (20% Etanol) + E85 - (85% Etanol) + E85 - (85% Etanol) + Kapalný vodík + Nabíjení Servisní rampa Stlačený vzduch Motocyklové parkoviště diff --git a/OsmAnd/res/values-da/phrases.xml b/OsmAnd/res/values-da/phrases.xml index 6e73a3f2c6..d834120c11 100644 --- a/OsmAnd/res/values-da/phrases.xml +++ b/OsmAnd/res/values-da/phrases.xml @@ -736,29 +736,29 @@ Vand Træ Arealanvendelse - Diesel - GTL diesel - HGV diesel - Bio-diesel - LPG - Oktan 80 - Oktan 91 - Oktan 92 - Oktan 95 - Oktan 98 - Oktan 100 - CNG - 1:25 benzin - 1:50 benzin - Ethanol - Methanol - SVO - E10 - E20 - E85 - E85 - Flydende brint - Elektricitet + Diesel + GTL diesel + HGV diesel + Bio-diesel + LPG + Oktan 80 + Oktan 91 + Oktan 92 + Oktan 95 + Oktan 98 + Oktan 100 + CNG + 1:25 benzin + 1:50 benzin + Ethanol + Methanol + SVO + E10 + E20 + E85 + E85 + Flydende brint + Elektricitet Industriområde Gårdsplads Eng diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml index d56a33170b..4b754878b9 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -652,28 +652,28 @@ Medizinische Versorgung Fotogeschäft - Diesel - GtL-Diesel - Lkw-Diesel - Biodiesel - Autogas - 80 Oktan - 91 Oktan - 92 Oktan - 95 Oktan - 98 Oktan - 100 Oktan - Komprimiertes Erdgas - Kraftstoffgemisch 1:25 - Kraftstoffgemisch 1:50 - Ethanol - Methanol - E10 - E20 - E85 - E85 - Flüssigwasserstoff - Strom + Diesel + GtL-Diesel + Lkw-Diesel + Biodiesel + Autogas + 80 Oktan + 91 Oktan + 92 Oktan + 95 Oktan + 98 Oktan + 100 Oktan + Komprimiertes Erdgas + Kraftstoffgemisch 1:25 + Kraftstoffgemisch 1:50 + Ethanol + Methanol + E10 + E20 + E85 + E85 + Flüssigwasserstoff + Strom ÖPNV-Halteposition Eisenbahnprellbock Kreuzung @@ -720,7 +720,7 @@ Forstwald Reservoir Allgemeine Attraktion - Bio-Kraftstoff + Bio-Kraftstoff Übungsgelände Quartier Jagdhütte diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index 427afb318b..4b8b091a4b 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -171,29 +171,29 @@ Inspección de vehículos Lavadero de autos Estación de servicio - Diésel - Diésel GTL - Diésel de vehículos pesados - Biodiésel - GPL - 80 octanos - 91 octanos - 92 octanos - 95 octanos - 98 octanos - 100 octanos - GNC - Combustible 1:25 - Combustible 1:50 - Etanol - Metanol - SVO - E10 - E20 - E85 - Biogás - Hidrógeno líquido - Electricidad + Diésel + Diésel GTL + Diésel de vehículos pesados + Biodiésel + GPL + 80 octanos + 91 octanos + 92 octanos + 95 octanos + 98 octanos + 100 octanos + GNC + Combustible 1:25 + Combustible 1:50 + Etanol + Metanol + SVO + E10 + E20 + E85 + Biogás + Hidrógeno líquido + Electricidad Estación de carga Rampa de vehículos Aire comprimido diff --git a/OsmAnd/res/values-es/phrases.xml b/OsmAnd/res/values-es/phrases.xml index 6cd4015d0f..347cc5982e 100644 --- a/OsmAnd/res/values-es/phrases.xml +++ b/OsmAnd/res/values-es/phrases.xml @@ -121,13 +121,13 @@ Inspección de vehículos Lavadero de automóviles Gasolinera - Diésel - Diésel GTL - Biodiésel - GNC - Metanol - Hidrógeno líquido - Electricidad + Diésel + Diésel GTL + Biodiésel + GNC + Metanol + Hidrógeno líquido + Electricidad Estación de carga Rampa de vehículos Aire comprimido @@ -410,14 +410,14 @@ Banda sonora Gargantilla Neumáticos - 80 octanos - 91 octanos - 92 octanos - 95 octanos - 98 octanos - 100 octanos - Combustible 1:25 - Etanol + 80 octanos + 91 octanos + 92 octanos + 95 octanos + 98 octanos + 100 octanos + Combustible 1:25 + Etanol Entrada al aparcamiento Garajes @@ -450,14 +450,14 @@ Tope Chicana Plataforma elevada - Diésel de vehículos pesados - GPL - Combustible 1:50 - SVO - E10 - E20 - E85 - Biogás + Diésel de vehículos pesados + GPL + Combustible 1:50 + SVO + E10 + E20 + E85 + Biogás Topera Telesquí (T) Telesquí (J) diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml index 95440463a6..1e32fe8312 100644 --- a/OsmAnd/res/values-fr/phrases.xml +++ b/OsmAnd/res/values-fr/phrases.xml @@ -710,20 +710,20 @@ Eau Bois Lotissement - Octane 80 - Octane 91 - Octane 92 - Octane 95 - Octane 98 - Octane 100 - Éthanol - Méthanol - E85 - E85 - E20 - Hydrogène liquide - Électricité - E10 + Octane 80 + Octane 91 + Octane 92 + Octane 95 + Octane 98 + Octane 100 + Éthanol + Méthanol + E85 + E85 + E20 + Hydrogène liquide + Électricité + E10 Cour de ferme Prairie Terrain de jeu @@ -731,15 +731,15 @@ Zone résidentielle Occupation du sol - Gazole - Gazole liquéfié - Gazole poids lourds - Bio-gazole - GPL - Gaz naturel compressé - Carburant 1:25 - Carburant 1:50 - Huile Végétale Brute (HVB) + Gazole + Gazole liquéfié + Gazole poids lourds + Bio-gazole + GPL + Gaz naturel compressé + Carburant 1:25 + Carburant 1:50 + Huile Végétale Brute (HVB) Carrefour Sylviculture Zone de chemins de fer diff --git a/OsmAnd/res/values-ja/phrases.xml b/OsmAnd/res/values-ja/phrases.xml index 7ee1b38129..31581a87f4 100644 --- a/OsmAnd/res/values-ja/phrases.xml +++ b/OsmAnd/res/values-ja/phrases.xml @@ -260,29 +260,29 @@ 発電機(Power generator) 土地利用(Landuse) - ディーゼル(Diesel) - GTLディーゼル(GTL diesel) - HGVディーゼル(HGV diesel) - バイオディーゼル(Bio diesel) - 液化石油ガス - オクタン価80(Octane 80) - オクタン価91(Octane 91) - オクタン価92(Octane 92) - オクタン価95(Octane 95) - オクタン価98(Octane 98) - オクタン価100(Octane 100) - 圧縮天然ガス - 混合油 1:25(1:25 fuel) - 混合油 1:50(1:50 fuel) - エタノール(Ethanol) - メタノール(Methanol) - 植物油(SVO) - E10・バイオエタノール10%混合ガソリン(E10) - E20・バイオエタノール20%混合ガソリン(E20) - E85・バイオエタノール85%混合ガソリン(E85) - E85・バイオエタノール85%混合ガソリン(E85) - 液体水素(Liquid hydrogen) - 電気(Electricity) + ディーゼル(Diesel) + GTLディーゼル(GTL diesel) + HGVディーゼル(HGV diesel) + バイオディーゼル(Bio diesel) + 液化石油ガス + オクタン価80(Octane 80) + オクタン価91(Octane 91) + オクタン価92(Octane 92) + オクタン価95(Octane 95) + オクタン価98(Octane 98) + オクタン価100(Octane 100) + 圧縮天然ガス + 混合油 1:25(1:25 fuel) + 混合油 1:50(1:50 fuel) + エタノール(Ethanol) + メタノール(Methanol) + 植物油(SVO) + E10・バイオエタノール10%混合ガソリン(E10) + E20・バイオエタノール20%混合ガソリン(E20) + E85・バイオエタノール85%混合ガソリン(E85) + E85・バイオエタノール85%混合ガソリン(E85) + 液体水素(Liquid hydrogen) + 電気(Electricity) ジャンクション(Junction) PA・SA(Rest area) diff --git a/OsmAnd/res/values-ko/phrases.xml b/OsmAnd/res/values-ko/phrases.xml index 78ee5cb09d..35e7230dd3 100644 --- a/OsmAnd/res/values-ko/phrases.xml +++ b/OsmAnd/res/values-ko/phrases.xml @@ -731,29 +731,29 @@ 수로 나무 사유지 - 디젤 - GTL 디젤 - HGV 디젤 - 바이오 디젤 - LPG - 옥탄가 80 - 옥탄가 91 - 옥탄가 92 - 옥탄가 95 - 옥탄가 98 - 옥탄가 100 - 압축천연가스(CNG) - 혼합유 1:25 - 혼합유 1:50 - 에탄올 - 메탄올 - 식물성 기름 - E10 - E20 - E85 - E85 - 액체 수소 - 전기 + 디젤 + GTL 디젤 + HGV 디젤 + 바이오 디젤 + LPG + 옥탄가 80 + 옥탄가 91 + 옥탄가 92 + 옥탄가 95 + 옥탄가 98 + 옥탄가 100 + 압축천연가스(CNG) + 혼합유 1:25 + 혼합유 1:50 + 에탄올 + 메탄올 + 식물성 기름 + E10 + E20 + E85 + E85 + 액체 수소 + 전기 접합 산업 분야 농장 구내 diff --git a/OsmAnd/res/values-nl/phrases.xml b/OsmAnd/res/values-nl/phrases.xml index 8b849c41a2..bfcf9594ce 100644 --- a/OsmAnd/res/values-nl/phrases.xml +++ b/OsmAnd/res/values-nl/phrases.xml @@ -696,28 +696,28 @@ Goede doelen-winkel Medische artikelen Fotowinkel - Diesel - GTL-diesel - Vrachtauto-diesel - Biodiesel - LPG - Octaan 80 - Octaan 91 - Octaan 92 - Octaan 95 - Octaan 98 - Octaan 100 - CNG - Mengsmering 1:25 - Mengsmering 1:50 - Ethanol - Methanol - E10 - E20 - E85 - E85 - Vloeibare waterstof - Elektriciteit + Diesel + GTL-diesel + Vrachtauto-diesel + Biodiesel + LPG + Octaan 80 + Octaan 91 + Octaan 92 + Octaan 95 + Octaan 98 + Octaan 100 + CNG + Mengsmering 1:25 + Mengsmering 1:50 + Ethanol + Methanol + E10 + E20 + E85 + E85 + Vloeibare waterstof + Elektriciteit Kruising Snelweg-parkeerplaats diff --git a/OsmAnd/res/values-pl/phrases.xml b/OsmAnd/res/values-pl/phrases.xml index e0dedcf728..2952ca1d72 100644 --- a/OsmAnd/res/values-pl/phrases.xml +++ b/OsmAnd/res/values-pl/phrases.xml @@ -505,9 +505,9 @@ Noclegi Klub Kawiarnia i restauracja - Biodiesel - LPG - CNG + Biodiesel + LPG + CNG "Przystanek transportu publicznego" Przystanek kolejowy Miejsce odpoczynku @@ -520,26 +520,26 @@ Rzemieślnik Wodny Artykuły medyczne - Olej napędowy - Modyfikowany olej napędowy - Ulepszony olej napędowy - Benzyna 80 oktanów - Benzyna 91 oktanów - Benzyna 92 oktany - Benzyna 95 oktanów - Benzyna 98 oktanów - Benzyna 100 oktanów - Paliwo 1:25 - Paliwo 1:50 - Paliwo: etanol - Paliwo: metanol - Paliwo: SVO (olej roślinny) - Paliwo: E10 - Paliwo: E20 - Paliwo: E85 - Paliwo: biogaz - Paliwo: ciekły wodór - Paliwo: elektryczność + Olej napędowy + Modyfikowany olej napędowy + Ulepszony olej napędowy + Benzyna 80 oktanów + Benzyna 91 oktanów + Benzyna 92 oktany + Benzyna 95 oktanów + Benzyna 98 oktanów + Benzyna 100 oktanów + Paliwo 1:25 + Paliwo 1:50 + Paliwo: etanol + Paliwo: metanol + Paliwo: SVO (olej roślinny) + Paliwo: E10 + Paliwo: E20 + Paliwo: E85 + Paliwo: biogaz + Paliwo: ciekły wodór + Paliwo: elektryczność Ogranicznik kolejowy Skrzyżowanie Zamknięta brama diff --git a/OsmAnd/res/values-pt-rBR/phrases.xml b/OsmAnd/res/values-pt-rBR/phrases.xml index 2d07ee6156..c05ff4ca50 100644 --- a/OsmAnd/res/values-pt-rBR/phrases.xml +++ b/OsmAnd/res/values-pt-rBR/phrases.xml @@ -132,7 +132,7 @@ Colocador de carpete Loja de departamento Loja de eletrônicos - Octano 80 + Octano 80 Ponto de trólebus Loja de utensílios de mesa Bilheteria @@ -178,28 +178,28 @@ Inspeção veicular Lavagem de carro Posto de combustível - Diesel - Diesel GPL - Diesel de veículos pesados - Biodiesel - GPL - Octano 91 - Octano 92 - Octano 95 - Octano 98 - Octano 100 - GNV - Combustível 1:25 - Combustível 1:50 - Etanol - Metanol - OVD - E10 - E20 - E85 - Biogás - Hidrogênio líquido - Eletricidade + Diesel + Diesel GPL + Diesel de veículos pesados + Biodiesel + GPL + Octano 91 + Octano 92 + Octano 95 + Octano 98 + Octano 100 + GNV + Combustível 1:25 + Combustível 1:50 + Etanol + Metanol + OVD + E10 + E20 + E85 + Biogás + Hidrogênio líquido + Eletricidade Eletroposto Rampa de veículo Ar comprimido diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 83c52b403c..9b6957daac 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -710,9 +710,9 @@ Ледовый каток Снежный парк - Дизель - Этанол - Метанол + Дизель + Этанол + Метанол Фото магазин Энергетика Землепользование diff --git a/OsmAnd/res/values-sc/phrases.xml b/OsmAnd/res/values-sc/phrases.xml index c6454e89d5..b8fdecb6b2 100644 --- a/OsmAnd/res/values-sc/phrases.xml +++ b/OsmAnd/res/values-sc/phrases.xml @@ -645,15 +645,15 @@ Parcu giogos Butega de fotografia - Diesel - GTL diesel - HGV diesel - Bio diesel - LPG - Etanolo - Metanolo - Idrògenu lìcuidu - Eletritzidade + Diesel + GTL diesel + HGV diesel + Bio diesel + LPG + Etanolo + Metanolo + Idrògenu lìcuidu + Eletritzidade Logu de pasada Àrea industriale diff --git a/OsmAnd/res/values-sk/phrases.xml b/OsmAnd/res/values-sk/phrases.xml index 16eb5fbef0..42a44e9b94 100644 --- a/OsmAnd/res/values-sk/phrases.xml +++ b/OsmAnd/res/values-sk/phrases.xml @@ -558,29 +558,29 @@ Šikana Zvukový retardér Zúženie ulice - Nafta - GTL nafta - Nafta pre nákladné autá - Bionafta - LPG - 80-oktánový benzín - 91-oktánový benzín - 92-oktánový benzín - 95-oktánový benzín - 98-oktánový benzín - 100-oktánový benzín - CNG (Stlačený zemný plyn) - Benzín 1:25 - Benzín 1:50 - Etanol - Metanol - SVO - E10 - E20 - E85 - E85 - Tekutý vodík - Elektrina + Nafta + GTL nafta + Nafta pre nákladné autá + Bionafta + LPG + 80-oktánový benzín + 91-oktánový benzín + 92-oktánový benzín + 95-oktánový benzín + 98-oktánový benzín + 100-oktánový benzín + CNG (Stlačený zemný plyn) + Benzín 1:25 + Benzín 1:50 + Etanol + Metanol + SVO + E10 + E20 + E85 + E85 + Tekutý vodík + Elektrina Križovatka Vodná pumpa Priemyselná oblasť diff --git a/OsmAnd/res/values-zh-rTW/phrases.xml b/OsmAnd/res/values-zh-rTW/phrases.xml index e99a444a7e..faa23ff7a0 100644 --- a/OsmAnd/res/values-zh-rTW/phrases.xml +++ b/OsmAnd/res/values-zh-rTW/phrases.xml @@ -172,29 +172,29 @@ 車輛檢修 洗車場 加油站 - 柴油 - GTL 柴油 - HGV 柴油 - Bio 柴油 - 液化石油瓦斯 - 80 無鉛汽油 - 91 無鉛汽油 - 92 無鉛汽油 - 95 無鉛汽油 - 98 無鉛汽油 - 100 無鉛汽油 - 壓縮天然氣 - 1:25 混合油 - 1:50 混合油 - 乙醇 - 甲醇 - 植物油 - 混合配方油 E10 - 混合配方油 E20 - 混合配方油 E85 - 混合配方油 E85 - 液態氫 - 電力 + 柴油 + GTL 柴油 + HGV 柴油 + Bio 柴油 + 液化石油瓦斯 + 80 無鉛汽油 + 91 無鉛汽油 + 92 無鉛汽油 + 95 無鉛汽油 + 98 無鉛汽油 + 100 無鉛汽油 + 壓縮天然氣 + 1:25 混合油 + 1:50 混合油 + 乙醇 + 甲醇 + 植物油 + 混合配方油 E10 + 混合配方油 E20 + 混合配方油 E85 + 混合配方油 E85 + 液態氫 + 電力 充電站 車輛斜坡 壓縮空氣 diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 3873d6ad22..667e4e9ba9 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -173,29 +173,29 @@ Vehicle inspection Car wash Gas station - Diesel - GTL diesel - HGV diesel - Bio diesel - LPG - Octane 80 - Octane 91 - Octane 92 - Octane 95 - Octane 98 - Octane 100 - CNG - 1:25 fuel - 1:50 fuel - Ethanol - Methanol - SVO - E10 - E20 - E85 - E85 - Liquid hydrogen - Electricity + Diesel + GTL diesel + HGV diesel + Bio diesel + LPG + Octane 80 + Octane 91 + Octane 92 + Octane 95 + Octane 98 + Octane 100 + CNG + 1:25 fuel + 1:50 fuel + Ethanol + Methanol + SVO + E10 + E20 + E85 + E85 + Liquid hydrogen + Electricity Charging station Vehicle ramp Compressed air diff --git a/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java b/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java index 7c6f3dcd27..47d8b82b72 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditPOIFilterActivity.java @@ -18,7 +18,7 @@ import net.osmand.osm.PoiType; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.poi.PoiFiltersHelper; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.util.Algorithms; import android.app.AlertDialog; import android.app.AlertDialog.Builder; @@ -43,7 +43,7 @@ import android.widget.TextView; */ public class EditPOIFilterActivity extends OsmandListActivity { public static final String AMENITY_FILTER = "net.osmand.amenity_filter"; //$NON-NLS-1$ - private PoiLegacyFilter filter; + private PoiUIFilter filter; private PoiFiltersHelper helper; private static final int FILTER = 2; public static final int EDIT_ACTIVITY_RESULT_OK = 20; diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index e2faba025b..19636a7e0d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -40,7 +40,7 @@ import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.dashboard.DashboardOnMap; import net.osmand.plus.helpers.GpxImportHelper; import net.osmand.plus.helpers.WakeLockHelper; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.routing.RoutingHelper; diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java index 3532e0e7a3..06f60ca866 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java @@ -26,7 +26,7 @@ import net.osmand.plus.SQLiteTileSource; import net.osmand.plus.activities.search.SearchActivity; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.poi.PoiFiltersHelper; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.render.MapVectorLayer; import net.osmand.plus.render.RenderingIcons; @@ -245,14 +245,14 @@ public class MapActivityLayers { } - public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiLegacyFilter[] selected){ + public AlertDialog selectPOIFilterLayer(final OsmandMapTileView mapView, final PoiUIFilter[] selected){ OsmandApplication app = (OsmandApplication) getApplication(); final PoiFiltersHelper poiFilters = app.getPoiFilters(); final ContextMenuAdapter adapter = new ContextMenuAdapter(activity); adapter.item(R.string.shared_string_search).iconColor(R.drawable.ic_action_search_dark).reg(); - final List list = new ArrayList(); + final List list = new ArrayList(); list.add(poiFilters.getCustomPOIFilter()); - for (PoiLegacyFilter f : poiFilters.getTopDefinedPoiFilters()) { + for (PoiUIFilter f : poiFilters.getTopDefinedPoiFilters()) { addFilterToList(adapter, list, f); } @@ -261,9 +261,9 @@ public class MapActivityLayers { builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { - PoiLegacyFilter pf = list.get(which); + PoiUIFilter pf = list.get(which); String filterId = pf.getFilterId(); - if(filterId.equals(PoiLegacyFilter.CUSTOM_FILTER_ID)){ + if(filterId.equals(PoiUIFilter.CUSTOM_FILTER_ID)){ Intent search = new Intent(activity, SearchActivity.class); search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); activity.getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.POI_TAB_INDEX); @@ -286,7 +286,7 @@ public class MapActivityLayers { return builder.show(); } - private void addFilterToList(final ContextMenuAdapter adapter, final List list, PoiLegacyFilter f) { + private void addFilterToList(final ContextMenuAdapter adapter, final List list, PoiUIFilter f) { list.add(f); Item it = adapter.item(f.getName()); if (RenderingIcons.containsBigIcon(f.getSimplifiedId())) { diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index 71dce0a998..641bb62758 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -36,8 +36,8 @@ import net.osmand.plus.activities.OsmandListActivity; import net.osmand.plus.dashboard.DashLocationFragment; import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.poi.NominatimPoiFilter; -import net.osmand.plus.poi.PoiLegacyFilter; -import net.osmand.plus.poi.PoiLegacyFilter.AmenityNameFilter; +import net.osmand.plus.poi.PoiUIFilter; +import net.osmand.plus.poi.PoiUIFilter.AmenityNameFilter; import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.views.DirectionDrawable; import net.osmand.plus.views.POIMapLayer; @@ -101,7 +101,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa private static final int SAVE_FILTER = 6; - private PoiLegacyFilter filter; + private PoiUIFilter filter; private AmenityAdapter amenityAdapter; private EditText searchFilter; private View searchFilterLayout; @@ -338,13 +338,13 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa IconsCache iconsCache = getMyApplication().getIconsCache(); final PopupMenu optionsMenu = new PopupMenu(this, v); - final PoiLegacyFilter f = this.filter; + final PoiUIFilter f = this.filter; MenuItem item = optionsMenu.getMenu().add(R.string.shared_string_edit) .setIcon(iconsCache.getContentIcon(R.drawable.ic_action_edit_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - PoiLegacyFilter custom = getMyApplication().getPoiFilters().getCustomPOIFilter(); + PoiUIFilter custom = getMyApplication().getPoiFilters().getCustomPOIFilter(); custom.updateTypesToAccept(f); showEditActivity(custom); return true; @@ -356,7 +356,9 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa if(poiAdditionals != null) { TreeMap adds = new TreeMap(); for(PoiType vtype : poiAdditionals.values()) { - adds.put(vtype.getTranslation().replace(' ', ':').toLowerCase(), vtype); + if(vtype.isTopVisible()) { + adds.put(vtype.getTranslation().replace(' ', ':').toLowerCase(), vtype); + } } for(String vtype : adds.keySet()) { addFilter(optionsMenu, vtype); @@ -382,7 +384,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa }); } - private void showEditActivity(PoiLegacyFilter poi) { + private void showEditActivity(PoiUIFilter poi) { Intent newIntent = new Intent(this, EditPOIFilterActivity.class); // folder selected newIntent.putExtra(EditPOIFilterActivity.AMENITY_FILTER, poi.getFilterId()); @@ -399,7 +401,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RESULT_REQUEST_CODE && resultCode == EditPOIFilterActivity.EDIT_ACTIVITY_RESULT_OK) { - PoiLegacyFilter custom = app.getPoiFilters().getCustomPOIFilter(); + PoiUIFilter custom = app.getPoiFilters().getCustomPOIFilter(); if (this.filter.isStandardFilter()) { this.filter = custom; if (!Algorithms.isEmpty(searchFilter.getText().toString())) { @@ -462,7 +464,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa } public boolean isOfflineSearchByNameFilter() { - return filter != null && PoiLegacyFilter.BY_NAME_FILTER_ID.equals(filter.getFilterId()); + return filter != null && PoiUIFilter.BY_NAME_FILTER_ID.equals(filter.getFilterId()); } public boolean isNameSearch() { @@ -922,7 +924,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - PoiLegacyFilter nFilter = new PoiLegacyFilter(editText.getText().toString(), + PoiUIFilter nFilter = new PoiUIFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), (OsmandApplication) getApplication()); if(searchFilter.getText().toString().length() > 0) { diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java index 7ffe1e79fd..63176c6095 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java @@ -21,7 +21,7 @@ import net.osmand.plus.activities.OsmAndListFragment; import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild; import net.osmand.plus.poi.NominatimPoiFilter; import net.osmand.plus.poi.PoiFiltersHelper; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.resources.ResourceManager; @@ -125,7 +125,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc if (Algorithms.isEmpty(s)) { filters.addAll(poiFilters.getTopDefinedPoiFilters()); } else { - for(PoiLegacyFilter pf : poiFilters.getTopDefinedPoiFilters()) { + for(PoiUIFilter pf : poiFilters.getTopDefinedPoiFilters()) { if(!pf.isStandardFilter() && pf.getName().toLowerCase().startsWith(s.toLowerCase())) { filters.add(pf); } @@ -177,9 +177,9 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc AccessibleToast.makeText(getActivity(), R.string.data_to_search_poi_not_available, Toast.LENGTH_LONG); return; } - if (item instanceof PoiLegacyFilter) { - PoiLegacyFilter model = ((PoiLegacyFilter) item); - if (PoiLegacyFilter.BY_NAME_FILTER_ID.equals(model.getFilterId()) + if (item instanceof PoiUIFilter) { + PoiUIFilter model = ((PoiUIFilter) item); + if (PoiUIFilter.BY_NAME_FILTER_ID.equals(model.getFilterId()) || model instanceof NominatimPoiFilter) { model.setFilterByName(searchEditText.getText().toString()); } else { @@ -187,9 +187,13 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc } showFilterActivity(model.getFilterId()); } else { - PoiLegacyFilter custom = getApp().getPoiFilters().getFilterById(PoiLegacyFilter.STD_PREFIX + ((AbstractPoiType) item).getKeyName()); + PoiUIFilter custom = getApp().getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + ((AbstractPoiType) item).getKeyName()); if(custom != null) { - custom.setFilterByName(null); + if(item instanceof PoiType && ((PoiType) item).isAdditional()) { + // it is already set + } else { + custom.setFilterByName(null); + } custom.updateTypesToAccept(((AbstractPoiType) item)); showFilterActivity(custom.getFilterId()); } @@ -248,11 +252,11 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc ImageView icon = (ImageView) row.findViewById(R.id.folder_icon); Object item = getItem(position); String name; - if (item instanceof PoiLegacyFilter) { - final PoiLegacyFilter model = (PoiLegacyFilter) item; + if (item instanceof PoiUIFilter) { + final PoiUIFilter model = (PoiUIFilter) item; if (RenderingIcons.containsBigIcon(model.getSimplifiedId())) { icon.setImageDrawable(RenderingIcons.getBigIcon(getActivity(), model.getSimplifiedId())); - } else if(PoiLegacyFilter.BY_NAME_FILTER_ID.equals(model.getFilterId()) || + } else if(PoiUIFilter.BY_NAME_FILTER_ID.equals(model.getFilterId()) || model instanceof NominatimPoiFilter){ icon.setImageResource(R.drawable.mx_name_finder); } else { @@ -288,7 +292,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - PoiLegacyFilter filter = getApp().getPoiFilters().getCustomPOIFilter(); + PoiUIFilter filter = getApp().getPoiFilters().getCustomPOIFilter(); filter.clearFilter(); showFilterActivity(filter.getFilterId()); return true; diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index cb5fd38829..215401f5b5 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -21,7 +21,7 @@ import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.TransportRouteHelper; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.views.OsmandMapTileView; @@ -149,7 +149,7 @@ public class ConfigureMapMenu { } protected void selectPOILayer(final OsmandSettings settings) { - final PoiLegacyFilter[] selected = new PoiLegacyFilter[1]; + final PoiUIFilter[] selected = new PoiUIFilter[1]; AlertDialog dlg = ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), selected); dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index 1fd4e61e20..c60a08aa20 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -13,7 +13,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.util.MapUtils; import android.app.Activity; @@ -219,7 +219,7 @@ public class WaypointDialogHelper { running[0] = position; thisAdapter.notifyDataSetInvalidated(); MapActivity map = (MapActivity) ctx; - final PoiLegacyFilter[] selected = new PoiLegacyFilter[1]; + final PoiUIFilter[] selected = new PoiUIFilter[1]; AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected); dlg.setOnDismissListener(new OnDismissListener() { @Override @@ -238,9 +238,9 @@ public class WaypointDialogHelper { private void selectPoi(final int[] running, final ArrayAdapter listAdapter, final int type, final boolean enable, Activity ctx) { if (ctx instanceof MapActivity && - !PoiLegacyFilter.CUSTOM_FILTER_ID.equals(app.getSettings().SELECTED_POI_FILTER_FOR_MAP.get())) { + !PoiUIFilter.CUSTOM_FILTER_ID.equals(app.getSettings().SELECTED_POI_FILTER_FOR_MAP.get())) { MapActivity map = (MapActivity) ctx; - final PoiLegacyFilter[] selected = new PoiLegacyFilter[1]; + final PoiUIFilter[] selected = new PoiUIFilter[1]; AlertDialog dlg = map.getMapLayers().selectPOIFilterLayer(map.getMapView(), selected); dlg.setOnDismissListener(new OnDismissListener() { diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index 8ac2be0a98..a8a5d1b63a 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -27,7 +27,7 @@ import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.IntermediatePointsDialog; import net.osmand.plus.base.FavoriteImageDrawable; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.routing.AlarmInfo; import net.osmand.plus.routing.AlarmInfo.AlarmInfoType; @@ -524,7 +524,7 @@ public class WaypointHelper { protected void calculatePoi(RouteCalculationResult route, List locationPoints) { - PoiLegacyFilter pf = getPoiFilter(); + PoiUIFilter pf = getPoiFilter(); if (pf != null) { final List locs = route.getImmutableAllLocations(); List amenities = pf.searchAmenitiesOnThePath(locs, poiSearchDeviationRadius); @@ -591,7 +591,7 @@ public class WaypointHelper { /// - public PoiLegacyFilter getPoiFilter() { + public PoiUIFilter getPoiFilter() { return app.getPoiFilters().getFilterById(app.getSettings().SELECTED_POI_FILTER_FOR_MAP.get()); } public boolean showPOI() { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java index 68c445e037..e8eeb0c8f7 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIDialogProvider.java @@ -108,7 +108,7 @@ public class EditingPOIDialogProvider implements DialogProvider { private void prepareProvider() { poiTypes = ((OsmandApplication) activity.getApplication()).getPoiTypes(); - allTranslatedSubTypes = poiTypes.getAllTranslatedNames(false); + allTranslatedSubTypes = poiTypes.getAllTranslatedNames(); settings = ((OsmandApplication) activity.getApplication()).getSettings(); isLocalEdit = true; if (settings.OFFLINE_EDITION.get() || !settings.isInternetConnectionAvailable(true)) { diff --git a/OsmAnd/src/net/osmand/plus/poi/NominatimPoiFilter.java b/OsmAnd/src/net/osmand/plus/poi/NominatimPoiFilter.java index effdde0f9a..5018a8ae6e 100644 --- a/OsmAnd/src/net/osmand/plus/poi/NominatimPoiFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/NominatimPoiFilter.java @@ -23,7 +23,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class NominatimPoiFilter extends PoiLegacyFilter { +public class NominatimPoiFilter extends PoiUIFilter { private static final String FILTER_ID = "name_finder"; //$NON-NLS-1$ private static final Log log = PlatformUtil.getLog(NominatimPoiFilter.class); diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java b/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java index 957951152a..db2a9d820e 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiFiltersHelper.java @@ -30,10 +30,10 @@ public class PoiFiltersHelper { private NominatimPoiFilter nominatimPOIFilter; private NominatimPoiFilter nominatimAddresFilter; - private PoiLegacyFilter searchByNamePOIFilter; - private PoiLegacyFilter customPOIFilter; - private PoiLegacyFilter showAllPOIFilter; - private List cacheTopStandardFilters; + private PoiUIFilter searchByNamePOIFilter; + private PoiUIFilter customPOIFilter; + private PoiUIFilter showAllPOIFilter; + private List cacheTopStandardFilters; private static final String UDF_CAR_AID = "car_aid"; private static final String UDF_FOR_TOURISTS = "for_tourists"; @@ -69,28 +69,28 @@ public class PoiFiltersHelper { return nominatimAddresFilter; } - public PoiLegacyFilter getSearchByNamePOIFilter() { + public PoiUIFilter getSearchByNamePOIFilter() { if(searchByNamePOIFilter == null){ - PoiLegacyFilter filter = new SearchByNameFilter(application); + PoiUIFilter filter = new SearchByNameFilter(application); filter.setStandardFilter(true); searchByNamePOIFilter = filter; } return searchByNamePOIFilter; } - public PoiLegacyFilter getCustomPOIFilter() { + public PoiUIFilter getCustomPOIFilter() { if(customPOIFilter == null){ - PoiLegacyFilter filter = new PoiLegacyFilter(application.getString(R.string.poi_filter_custom_filter), - PoiLegacyFilter.CUSTOM_FILTER_ID, new LinkedHashMap>(), application); //$NON-NLS-1$ + PoiUIFilter filter = new PoiUIFilter(application.getString(R.string.poi_filter_custom_filter), + PoiUIFilter.CUSTOM_FILTER_ID, new LinkedHashMap>(), application); //$NON-NLS-1$ filter.setStandardFilter(true); customPOIFilter = filter; } return customPOIFilter; } - public PoiLegacyFilter getShowAllPOIFilter() { + public PoiUIFilter getShowAllPOIFilter() { if(showAllPOIFilter == null){ - PoiLegacyFilter filter = new PoiLegacyFilter(null, application); //$NON-NLS-1$ + PoiUIFilter filter = new PoiUIFilter(null, application); //$NON-NLS-1$ filter.setStandardFilter(true); showAllPOIFilter = filter; } @@ -98,8 +98,8 @@ public class PoiFiltersHelper { } - private PoiLegacyFilter getFilterById(String filterId, PoiLegacyFilter... filters){ - for(PoiLegacyFilter pf : filters) { + private PoiUIFilter getFilterById(String filterId, PoiUIFilter... filters){ + for(PoiUIFilter pf : filters) { if(pf.getFilterId().equals(filterId)){ return pf; } @@ -107,26 +107,35 @@ public class PoiFiltersHelper { return null; } - public PoiLegacyFilter getFilterById(String filterId){ + public PoiUIFilter getFilterById(String filterId){ if(filterId == null){ return null; } - for(PoiLegacyFilter f : getTopDefinedPoiFilters()) { + for(PoiUIFilter f : getTopDefinedPoiFilters()) { if(f.getFilterId().equals(filterId)){ return f; } } - PoiLegacyFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(), + PoiUIFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(), getShowAllPOIFilter(), getNominatimPOIFilter(), getNominatimAddressFilter()); if (ff != null) { return ff; } - if(filterId.startsWith(PoiLegacyFilter.STD_PREFIX)) { - String typeId = filterId.substring(PoiLegacyFilter.STD_PREFIX.length()); + if(filterId.startsWith(PoiUIFilter.STD_PREFIX)) { + String typeId = filterId.substring(PoiUIFilter.STD_PREFIX.length()); AbstractPoiType tp = application.getPoiTypes().getAnyPoiTypeByKey(typeId); if(tp != null) { - PoiLegacyFilter lf = new PoiLegacyFilter(tp, application); - ArrayList copy = new ArrayList(cacheTopStandardFilters); + PoiUIFilter lf = new PoiUIFilter(tp, application); + ArrayList copy = new ArrayList(cacheTopStandardFilters); + copy.add(lf); + sortListOfFilters(copy); + cacheTopStandardFilters = copy; + return lf; + } + AbstractPoiType lt = application.getPoiTypes().getAnyPoiAdditionalTypeByKey(typeId); + if(lt != null) { + PoiUIFilter lf = new PoiUIFilter(lt, application); + ArrayList copy = new ArrayList(cacheTopStandardFilters); copy.add(lf); sortListOfFilters(copy); cacheTopStandardFilters = copy; @@ -145,43 +154,43 @@ public class PoiFiltersHelper { } - private List getUserDefinedPoiFilters() { - ArrayList userDefinedFilters = new ArrayList(); + private List getUserDefinedPoiFilters() { + ArrayList userDefinedFilters = new ArrayList(); PoiFilterDbHelper helper = openDbHelper(); if (helper != null) { - List userDefined = helper.getFilters(helper.getReadableDatabase()); + List userDefined = helper.getFilters(helper.getReadableDatabase()); userDefinedFilters.addAll(userDefined); helper.close(); } return userDefinedFilters; } - public void sortListOfFilters(List list) { + public void sortListOfFilters(List list) { final Collator instance = Collator.getInstance(); - Collections.sort(list, new Comparator() { + Collections.sort(list, new Comparator() { @Override - public int compare(PoiLegacyFilter lhs, PoiLegacyFilter rhs) { + public int compare(PoiUIFilter lhs, PoiUIFilter rhs) { return instance.compare(lhs.getName(), rhs.getName()); } }); } - public List getTopDefinedPoiFilters() { + public List getTopDefinedPoiFilters() { if (cacheTopStandardFilters == null) { - List top = new ArrayList(); + List top = new ArrayList(); // user defined top.addAll(getUserDefinedPoiFilters()); // default MapPoiTypes poiTypes = application.getPoiTypes(); for (PoiFilter t : poiTypes.getTopVisibleFilters()) { - top.add(new PoiLegacyFilter(t, application)); + top.add(new PoiUIFilter(t, application)); } sortListOfFilters(top); cacheTopStandardFilters = top; } - List result = new ArrayList(); + List result = new ArrayList(); if(OsmandPlugin.getEnabledPlugin(AccessibilityPlugin.class) != null) { result.add(getShowAllPOIFilter()); } @@ -196,10 +205,10 @@ public class PoiFiltersHelper { return new PoiFilterDbHelper(application.getPoiTypes(), application); } - public boolean removePoiFilter(PoiLegacyFilter filter){ - if(filter.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID) || - filter.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID) || - filter.getFilterId().startsWith(PoiLegacyFilter.STD_PREFIX)){ + public boolean removePoiFilter(PoiUIFilter filter){ + if(filter.getFilterId().equals(PoiUIFilter.CUSTOM_FILTER_ID) || + filter.getFilterId().equals(PoiUIFilter.BY_NAME_FILTER_ID) || + filter.getFilterId().startsWith(PoiUIFilter.STD_PREFIX)){ return false; } PoiFilterDbHelper helper = openDbHelper(); @@ -208,7 +217,7 @@ public class PoiFiltersHelper { } boolean res = helper.deleteFilter(helper.getWritableDatabase(), filter); if(res){ - ArrayList copy = new ArrayList<>(cacheTopStandardFilters); + ArrayList copy = new ArrayList<>(cacheTopStandardFilters); copy.remove(filter); cacheTopStandardFilters = copy; } @@ -216,13 +225,13 @@ public class PoiFiltersHelper { return res; } - public boolean createPoiFilter(PoiLegacyFilter filter){ + public boolean createPoiFilter(PoiUIFilter filter){ PoiFilterDbHelper helper = openDbHelper(); if(helper == null){ return false; } boolean res = helper.deleteFilter(helper.getWritableDatabase(), filter); - Iterator it = cacheTopStandardFilters.iterator(); + Iterator it = cacheTopStandardFilters.iterator(); while(it.hasNext()) { if(it.next().getFilterId().equals(filter.getFilterId())) { it.remove(); @@ -230,7 +239,7 @@ public class PoiFiltersHelper { } res = helper.addFilter(filter, helper.getWritableDatabase(), false); if(res){ - ArrayList copy = new ArrayList<>(cacheTopStandardFilters); + ArrayList copy = new ArrayList<>(cacheTopStandardFilters); copy.add(filter); sortListOfFilters(copy); cacheTopStandardFilters = copy; @@ -241,9 +250,9 @@ public class PoiFiltersHelper { - public boolean editPoiFilter(PoiLegacyFilter filter) { - if (filter.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID) || - filter.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID) || filter.getFilterId().startsWith(PoiLegacyFilter.STD_PREFIX)) { + public boolean editPoiFilter(PoiUIFilter filter) { + if (filter.getFilterId().equals(PoiUIFilter.CUSTOM_FILTER_ID) || + filter.getFilterId().equals(PoiUIFilter.BY_NAME_FILTER_ID) || filter.getFilterId().startsWith(PoiUIFilter.STD_PREFIX)) { return false; } PoiFilterDbHelper helper = openDbHelper(); @@ -335,7 +344,7 @@ public class PoiFiltersHelper { } } - protected boolean addFilter(PoiLegacyFilter p, SQLiteConnection db, boolean addOnlyCategories){ + protected boolean addFilter(PoiUIFilter p, SQLiteConnection db, boolean addOnlyCategories){ if(db != null){ if(!addOnlyCategories){ db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()}); //$NON-NLS-1$ //$NON-NLS-2$ @@ -363,8 +372,8 @@ public class PoiFiltersHelper { return false; } - protected List getFilters(SQLiteConnection conn){ - ArrayList list = new ArrayList(); + protected List getFilters(SQLiteConnection conn){ + ArrayList list = new ArrayList(); if(conn != null){ SQLiteCursor query = conn.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ CATEGORIES_NAME, null); @@ -396,7 +405,7 @@ public class PoiFiltersHelper { do { String filterId = query.getString(0); if(map.containsKey(filterId)){ - PoiLegacyFilter filter = new PoiLegacyFilter(query.getString(1), filterId, + PoiUIFilter filter = new PoiUIFilter(query.getString(1), filterId, map.get(filterId), application); filter.setSavedFilterByName(query.getString(2)); list.add(filter); @@ -408,7 +417,7 @@ public class PoiFiltersHelper { return list; } - protected boolean editFilter(SQLiteConnection conn, PoiLegacyFilter filter) { + protected boolean editFilter(SQLiteConnection conn, PoiUIFilter filter) { if (conn != null) { conn.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ new Object[] { filter.getFilterId() }); @@ -419,12 +428,12 @@ public class PoiFiltersHelper { return false; } - private void updateName(SQLiteConnection db, PoiLegacyFilter filter) { + private void updateName(SQLiteConnection db, PoiUIFilter filter) { db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() }); //$NON-NLS-1$ } - protected boolean deleteFilter(SQLiteConnection db, PoiLegacyFilter p){ + protected boolean deleteFilter(SQLiteConnection db, PoiUIFilter p){ String key = p.getFilterId(); return deleteFilter(db, key); } diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java similarity index 96% rename from OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java rename to OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java index f34ae9a374..44dab8a144 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiUIFilter.java @@ -34,7 +34,7 @@ import net.osmand.util.OpeningHoursParser; import net.osmand.util.OpeningHoursParser.OpeningHours; import android.content.Context; -public class PoiLegacyFilter implements SearchPoiTypeFilter { +public class PoiUIFilter implements SearchPoiTypeFilter { public final static String STD_PREFIX = "std_"; //$NON-NLS-1$ public final static String USER_PREFIX = "user_"; //$NON-NLS-1$ @@ -62,7 +62,7 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { protected List currentSearchResult = null; // constructor for standard filters - public PoiLegacyFilter(AbstractPoiType type, OsmandApplication application) { + public PoiUIFilter(AbstractPoiType type, OsmandApplication application) { this.app = application; isStandardFilter = true; filterId = STD_PREFIX + (type == null ? null : type.getKeyName()); @@ -72,12 +72,15 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { initSearchAll(); updatePoiAdditionals(); } else { + if(type.isAdditional()) { + setSavedFilterByName(type.getKeyName().replace('_', ':')); + } updateTypesToAccept(type); } } // search by name standard - protected PoiLegacyFilter(OsmandApplication application) { + protected PoiUIFilter(OsmandApplication application) { this.app = application; isStandardFilter = true; filterId = STD_PREFIX; // overridden @@ -85,7 +88,7 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { } // constructor for user defined filters - public PoiLegacyFilter(String name, String filterId, + public PoiUIFilter(String name, String filterId, Map> acceptedTypes, OsmandApplication app){ this.app = app; isStandardFilter = false; @@ -449,7 +452,11 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { acceptedTypes.clear(); pt.putTypes(acceptedTypes); poiAdditionals.clear(); - fillPoiAdditionals(pt); + if (pt instanceof PoiType && ((PoiType) pt).isAdditional() && ((PoiType) pt).getParentType() != null) { + fillPoiAdditionals(((PoiType) pt).getParentType()); + } else { + fillPoiAdditionals(pt); + } } private void fillPoiAdditionals(AbstractPoiType pt) { @@ -481,7 +488,7 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { } } - public void updateTypesToAccept(PoiLegacyFilter f) { + public void updateTypesToAccept(PoiUIFilter f) { acceptedTypes.clear(); acceptedTypes.putAll(f.acceptedTypes); poiAdditionals.clear(); @@ -567,4 +574,4 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { -} +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java b/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java index ffd6a5062d..3559f6093c 100644 --- a/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/SearchByNameFilter.java @@ -12,9 +12,9 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.util.MapUtils; -public class SearchByNameFilter extends PoiLegacyFilter { +public class SearchByNameFilter extends PoiUIFilter { - public static final String FILTER_ID = PoiLegacyFilter.BY_NAME_FILTER_ID; //$NON-NLS-1$ + public static final String FILTER_ID = PoiUIFilter.BY_NAME_FILTER_ID; //$NON-NLS-1$ public SearchByNameFilter(OsmandApplication application) { super(application); diff --git a/OsmAnd/src/net/osmand/plus/resources/AmenityIndexRepositoryBinary.java b/OsmAnd/src/net/osmand/plus/resources/AmenityIndexRepositoryBinary.java index 746b8e0360..c7d55a0eae 100644 --- a/OsmAnd/src/net/osmand/plus/resources/AmenityIndexRepositoryBinary.java +++ b/OsmAnd/src/net/osmand/plus/resources/AmenityIndexRepositoryBinary.java @@ -15,7 +15,7 @@ import net.osmand.binary.BinaryMapIndexReader.SearchPoiTypeFilter; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; import net.osmand.data.Amenity; import net.osmand.osm.PoiCategory; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.util.MapUtils; import org.apache.commons.logging.Log; diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 75515ec942..f0ee0b7d33 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -25,7 +25,7 @@ import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.osmo.OsMoService; import net.osmand.plus.poi.PoiFiltersHelper; -import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.routing.RoutingHelper; @@ -85,7 +85,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon private ResourceManager resourceManager; private RoutingHelper routingHelper; - private PoiLegacyFilter filter; + private PoiUIFilter filter; private MapTextLayer mapTextLayer; /// cache for displayed POI