Merge branch 'master' of github.com:osmandapp/Osmand
This commit is contained in:
commit
3a6c4c9767
2 changed files with 10 additions and 17 deletions
|
@ -12,7 +12,6 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class SampleFormatter {
|
public class SampleFormatter {
|
||||||
public final static float METERS_IN_KILOMETER = 1000f;
|
public final static float METERS_IN_KILOMETER = 1000f;
|
||||||
|
@ -275,10 +274,9 @@ public class SampleFormatter {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
MapPoiTypes poiTypes = ctx.getPoiTypes();
|
MapPoiTypes poiTypes = ctx.getPoiTypes();
|
||||||
for(Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
for (String key : amenity.getAdditionalInfoKeys()) {
|
||||||
String key = e.getKey();
|
String vl = amenity.getAdditionalInfo(key);
|
||||||
String vl = e.getValue();
|
if (key.startsWith("name:")) {
|
||||||
if(key.startsWith("name:")) {
|
|
||||||
continue;
|
continue;
|
||||||
} else if(vl.length() >= 150) {
|
} else if(vl.length() >= 150) {
|
||||||
if(shortDescription) {
|
if(shortDescription) {
|
||||||
|
@ -291,16 +289,15 @@ public class SampleFormatter {
|
||||||
} else if(Amenity.WEBSITE.equals(key)) {
|
} else if(Amenity.WEBSITE.equals(key)) {
|
||||||
d.append(ctx.getString("website") + ": ");
|
d.append(ctx.getString("website") + ": ");
|
||||||
} else {
|
} else {
|
||||||
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(e.getKey());
|
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(key);
|
||||||
if (pt != null) {
|
if (pt != null) {
|
||||||
if(pt instanceof PoiType && !((PoiType) pt).isText()) {
|
if(pt instanceof PoiType && !((PoiType) pt).isText()) {
|
||||||
vl = pt.getTranslation();
|
vl = pt.getTranslation();
|
||||||
} else {
|
} else {
|
||||||
vl = pt.getTranslation() + ": " + amenity.unzipContent(e.getValue());
|
vl = pt.getTranslation() + ": " + vl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vl = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) +
|
vl = Algorithms.capitalizeFirstLetterAndLowercase(key) + ": " + vl;
|
||||||
": " + amenity.unzipContent(e.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.append(vl).append('\n');
|
d.append(vl).append('\n');
|
||||||
|
|
|
@ -39,7 +39,6 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class AmenityMenuBuilder extends MenuBuilder {
|
public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
|
@ -275,12 +274,11 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
List<AmenityInfoRow> infoRows = new LinkedList<>();
|
List<AmenityInfoRow> infoRows = new LinkedList<>();
|
||||||
List<AmenityInfoRow> descriptions = new LinkedList<>();
|
List<AmenityInfoRow> descriptions = new LinkedList<>();
|
||||||
|
|
||||||
for (Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
for (String key : amenity.getAdditionalInfoKeys()) {
|
||||||
|
String vl = amenity.getAdditionalInfo(key);
|
||||||
int iconId;
|
int iconId;
|
||||||
Drawable icon = null;
|
Drawable icon = null;
|
||||||
int textColor = 0;
|
int textColor = 0;
|
||||||
String key = e.getKey();
|
|
||||||
String vl = e.getValue();
|
|
||||||
|
|
||||||
String textPrefix = "";
|
String textPrefix = "";
|
||||||
View collapsableView = null;
|
View collapsableView = null;
|
||||||
|
@ -357,7 +355,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
} else if (Amenity.CUISINE.equals(key)) {
|
} else if (Amenity.CUISINE.equals(key)) {
|
||||||
iconId = OsmandResources.getDrawableId("ic_action_cuisine");
|
iconId = OsmandResources.getDrawableId("ic_action_cuisine");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (String c : e.getValue().split(";")) {
|
for (String c : vl.split(";")) {
|
||||||
if (sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
sb.append(", ");
|
sb.append(", ");
|
||||||
} else {
|
} else {
|
||||||
|
@ -388,7 +386,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
isText = true;
|
isText = true;
|
||||||
isDescription = iconId == OsmandResources.getDrawableId("ic_action_note_dark");
|
isDescription = iconId == OsmandResources.getDrawableId("ic_action_note_dark");
|
||||||
textPrefix = pType.getTranslation();
|
textPrefix = pType.getTranslation();
|
||||||
vl = amenity.unzipContent(e.getValue());
|
|
||||||
}
|
}
|
||||||
if (!isDescription && icon == null) {
|
if (!isDescription && icon == null) {
|
||||||
icon = getRowIcon(view.getContext(), pType.getIconKeyName());
|
icon = getRowIcon(view.getContext(), pType.getIconKeyName());
|
||||||
|
@ -400,8 +397,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
iconId = OsmandResources.getDrawableId("ic_action_note_dark");
|
iconId = OsmandResources.getDrawableId("ic_action_note_dark");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey());
|
textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(vl);
|
||||||
vl = amenity.unzipContent(e.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue