Fix core-sample compilation

This commit is contained in:
Vitaliy 2020-11-24 16:38:46 +02:00
parent e9b3a881b5
commit 360338d9de
2 changed files with 10 additions and 17 deletions

View file

@ -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<String, String> 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');

View file

@ -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<AmenityInfoRow> infoRows = 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;
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);
}
}