Fixes on pR

This commit is contained in:
madwasp79 2019-01-28 16:49:08 +02:00
parent a15c642a74
commit ec33737955
2 changed files with 13 additions and 14 deletions

View file

@ -10,6 +10,11 @@
- For wording and consistency, please note https://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience - For wording and consistency, please note https://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience
Thx - Hardy Thx - Hardy
--> -->
<string name="cubic_m"></string>
<string name="metric_ton">t</string>
<string name="shared_string_capacity">Сapacity</string>
<string name="shared_string_width">Width</string>
<string name="shared_string_height">Height</string>
<string name="osm_live_subscriptions">Subscriptions</string> <string name="osm_live_subscriptions">Subscriptions</string>
<string name="powered_by_osmand">Powered by OsmAnd</string> <string name="powered_by_osmand">Powered by OsmAnd</string>
<string name="osm_live_plan_pricing">Plan &amp; Pricing</string> <string name="osm_live_plan_pricing">Plan &amp; Pricing</string>
@ -2423,12 +2428,6 @@
<string name="km">km</string> <string name="km">km</string>
<string name="km_h">km/h</string> <string name="km_h">km/h</string>
<string name="m">m</string> <string name="m">m</string>
<string name="cubic_m"></string>
<string name="metric_ton">t</string>
<string name ="capacity">Сapacity</string>
<string name="width_label">Width</string>
<string name="height_label">Height</string>
<string name="distance_label">Distance</string>
<string name="old_map_index_is_not_supported">Deprecated map data format \'\'{0}\'\', not supported</string> <string name="old_map_index_is_not_supported">Deprecated map data format \'\'{0}\'\', not supported</string>
<string name="poi_filter_closest_poi">Nearest POIs</string> <string name="poi_filter_closest_poi">Nearest POIs</string>
<string name="poi_filter_custom_filter">Custom filter</string> <string name="poi_filter_custom_filter">Custom filter</string>

View file

@ -61,7 +61,8 @@ import java.util.Map;
public class AmenityMenuBuilder extends MenuBuilder { public class AmenityMenuBuilder extends MenuBuilder {
private static final String WIKI_LINK = ".wikipedia.org/w"; private static final String WIKI_LINK = ".wikipedia.org/w";
public final static Log log = PlatformUtil.getLog(AmenityMenuBuilder.class); public final static Log LOG = PlatformUtil.getLog(AmenityMenuBuilder.class);
private final static DecimalFormat DF = new DecimalFormat("#.##");
private OsmandSettings.MetricsConstants metricSystem; private OsmandSettings.MetricsConstants metricSystem;
private final Amenity amenity; private final Amenity amenity;
@ -684,26 +685,25 @@ public class AmenityMenuBuilder extends MenuBuilder {
} }
private String[] getFormattedPrefixAndText(String key, String prefix, String value) { private String[] getFormattedPrefixAndText(String key, String prefix, String value) {
DecimalFormat df = new DecimalFormat("#.##"); DF.setRoundingMode(RoundingMode.CEILING);
df.setRoundingMode(RoundingMode.CEILING);
String formattedValue = ""; String formattedValue = "";
String formattedPrefix = ""; String formattedPrefix = "";
switch (key) { switch (key) {
case "width": case "width":
case "height": case "height":
if (key.equals("width")) { if (key.equals("width")) {
formattedPrefix = mapActivity.getResources().getString(R.string.width_label); formattedPrefix = mapActivity.getResources().getString(R.string.shared_string_width);
} else { } else {
formattedPrefix = mapActivity.getResources().getString(R.string.height_label); formattedPrefix = mapActivity.getResources().getString(R.string.shared_string_height);
} }
case "depth": case "depth":
case "seamark_height": case "seamark_height":
double valueAsDouble = Double.valueOf(value); double valueAsDouble = Double.valueOf(value);
if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) { if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) {
formattedValue = String.valueOf(df.format(valueAsDouble * OsmAndFormatter.FEET_IN_ONE_METER)) formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.FEET_IN_ONE_METER))
+ " " + mapActivity.getResources().getString(R.string.foot); + " " + mapActivity.getResources().getString(R.string.foot);
} else if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_YARDS) { } else if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_YARDS) {
formattedValue = String.valueOf(df.format(valueAsDouble * OsmAndFormatter.YARDS_IN_ONE_METER)) formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.YARDS_IN_ONE_METER))
+ " " + mapActivity.getResources().getString(R.string.yard); + " " + mapActivity.getResources().getString(R.string.yard);
} else { } else {
formattedValue = value + " " + mapActivity.getResources().getString(R.string.m); formattedValue = value + " " + mapActivity.getResources().getString(R.string.m);
@ -727,7 +727,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
case "students": case "students":
case "spots": case "spots":
case "seats": case "seats":
formattedPrefix = formatPrefix(prefix, mapActivity.getResources().getString(R.string.capacity)); formattedPrefix = formatPrefix(prefix, mapActivity.getResources().getString(R.string.shared_string_capacity));
break; break;
default: default:
formattedValue = value; formattedValue = value;