diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/SampleFormatter.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/SampleFormatter.java index 6a340aa528..0c5780bd6a 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/SampleFormatter.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/SampleFormatter.java @@ -12,7 +12,6 @@ import net.osmand.util.Algorithms; import java.text.DecimalFormat; import java.text.MessageFormat; -import java.util.Map.Entry; public class SampleFormatter { public final static float METERS_IN_KILOMETER = 1000f; @@ -275,10 +274,9 @@ public class SampleFormatter { return ""; } MapPoiTypes poiTypes = ctx.getPoiTypes(); - for(Entry e : amenity.getAdditionalInfo().entrySet()) { - String key = e.getKey(); - String vl = e.getValue(); - if(key.startsWith("name:")) { + for (String key : amenity.getAdditionalInfoKeys()) { + String vl = amenity.getAdditionalInfo(key); + if (key.startsWith("name:")) { continue; } else if(vl.length() >= 150) { if(shortDescription) { @@ -291,16 +289,15 @@ public class SampleFormatter { } else if(Amenity.WEBSITE.equals(key)) { d.append(ctx.getString("website") + ": "); } else { - AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(e.getKey()); + AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(key); if (pt != null) { if(pt instanceof PoiType && !((PoiType) pt).isText()) { vl = pt.getTranslation(); } else { - vl = pt.getTranslation() + ": " + amenity.unzipContent(e.getValue()); + vl = pt.getTranslation() + ": " + vl; } } else { - vl = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) + - ": " + amenity.unzipContent(e.getValue()); + vl = Algorithms.capitalizeFirstLetterAndLowercase(key) + ": " + vl; } } d.append(vl).append('\n'); diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/builders/AmenityMenuBuilder.java index 2215c4ad90..5719c097e8 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -39,7 +39,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; -import java.util.Map; public class AmenityMenuBuilder extends MenuBuilder { @@ -275,12 +274,11 @@ public class AmenityMenuBuilder extends MenuBuilder { List infoRows = new LinkedList<>(); List descriptions = new LinkedList<>(); - for (Map.Entry e : amenity.getAdditionalInfo().entrySet()) { + for (String key : amenity.getAdditionalInfoKeys()) { + String vl = amenity.getAdditionalInfo(key); int iconId; Drawable icon = null; int textColor = 0; - String key = e.getKey(); - String vl = e.getValue(); String textPrefix = ""; View collapsableView = null; @@ -357,7 +355,7 @@ public class AmenityMenuBuilder extends MenuBuilder { } else if (Amenity.CUISINE.equals(key)) { iconId = OsmandResources.getDrawableId("ic_action_cuisine"); StringBuilder sb = new StringBuilder(); - for (String c : e.getValue().split(";")) { + for (String c : vl.split(";")) { if (sb.length() > 0) { sb.append(", "); } else { @@ -388,7 +386,6 @@ public class AmenityMenuBuilder extends MenuBuilder { isText = true; isDescription = iconId == OsmandResources.getDrawableId("ic_action_note_dark"); textPrefix = pType.getTranslation(); - vl = amenity.unzipContent(e.getValue()); } if (!isDescription && icon == null) { icon = getRowIcon(view.getContext(), pType.getIconKeyName()); @@ -400,8 +397,7 @@ public class AmenityMenuBuilder extends MenuBuilder { iconId = OsmandResources.getDrawableId("ic_action_note_dark"); } } else { - textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()); - vl = amenity.unzipContent(e.getValue()); + textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(vl); } }