Fix wiki poi selector

This commit is contained in:
Victor Shcherb 2015-06-16 00:03:17 +02:00
parent 3cd05c6e71
commit 72ed1b4040
2 changed files with 10 additions and 10 deletions

View file

@ -157,27 +157,27 @@ public class Amenity extends MapObject {
setAdditionalInfo(PHONE, phone); setAdditionalInfo(PHONE, phone);
} }
public String getNameSelected(String lang, String defLang) { public String getContentSelected(String tag, String lang, String defLang) {
if (lang != null) { if (lang != null) {
String translateName; String translateName = getAdditionalInfo(tag + ":" + lang);
if (lang.equals("en")) {
translateName = getEnName();
} else {
translateName = getAdditionalInfo("name:" + lang);
}
if (!Algorithms.isEmpty(translateName)) { if (!Algorithms.isEmpty(translateName)) {
return lang; return lang;
} }
} }
if(!Algorithms.isEmpty(getName())) { String plainName = getAdditionalInfo(tag);
if (!Algorithms.isEmpty(plainName)) {
return defLang; return defLang;
} }
String enName = getAdditionalInfo(tag + ":en");
if (!Algorithms.isEmpty(enName)) {
return enName;
}
for (String nm : getAdditionalInfo().keySet()) { for (String nm : getAdditionalInfo().keySet()) {
if (nm.startsWith("name:")) { if (nm.startsWith("name:")) {
return nm.substring("name:".length()); return nm.substring("name:".length());
} }
} }
return ""; return defLang;
} }
public String getName(String lang) { public String getName(String lang) {

View file

@ -382,7 +382,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
topBar.setBackgroundColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTabBackground))); topBar.setBackgroundColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTabBackground)));
topBar.setTitleTextColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTextColor))); topBar.setTitleTextColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTextColor)));
String lng = a.getNameSelected(lang, "en"); String lng = a.getContentSelected("content", lang, "en");
if(Algorithms.isEmpty(lng)) { if(Algorithms.isEmpty(lng)) {
lng = "en"; lng = "en";
} }