Added default units of measurement if not specified in the object #6383 - added new category and some refactoring
This commit is contained in:
parent
abc7deb8e2
commit
0278c7388f
1 changed files with 12 additions and 5 deletions
|
@ -689,6 +689,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
switch (key){
|
||||
case "width":
|
||||
case "height":
|
||||
case "seamark_height":
|
||||
case "depth":
|
||||
if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) {
|
||||
units = mapActivity.getResources().getString(R.string.foot);
|
||||
|
@ -699,6 +700,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
} else {
|
||||
units = mapActivity.getResources().getString(R.string.m);
|
||||
}
|
||||
prefix = prefixConstructor(prefix, units);
|
||||
break;
|
||||
case "distance":
|
||||
value = String.valueOf(OsmAndFormatter
|
||||
|
@ -712,28 +714,33 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
} else {
|
||||
units = mapActivity.getResources().getString(R.string.km);
|
||||
}
|
||||
prefix = prefixConstructor(prefix, units);
|
||||
break;
|
||||
case "capacity":
|
||||
units = mapActivity.getResources().getString(R.string.cubic_m);
|
||||
prefix = prefixConstructor(prefix, units);
|
||||
break;
|
||||
case "maxweight":
|
||||
units = mapActivity.getResources().getString(R.string.cubic_m);
|
||||
prefix = prefixConstructor(prefix, units);
|
||||
break;
|
||||
case "students":
|
||||
case "spots":
|
||||
case "seats":
|
||||
units = "capacity";
|
||||
prefix = prefixConstructor(prefix, units);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!prefix.isEmpty()) {
|
||||
prefix = prefix + ", " + units;
|
||||
} else {
|
||||
prefix = units;
|
||||
}
|
||||
|
||||
return new String[]{prefix, value};
|
||||
}
|
||||
|
||||
private String prefixConstructor(String prefix, String units){
|
||||
return (!prefix.isEmpty()) ? (prefix + ", " + units) : units;
|
||||
|
||||
}
|
||||
|
||||
public void buildAmenityRow(View view, AmenityInfoRow info) {
|
||||
if (info.icon != null) {
|
||||
buildRow(view, info.icon, info.text, info.textPrefix, info.collapsable, info.collapsableView,
|
||||
|
|
Loading…
Reference in a new issue