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){
|
switch (key){
|
||||||
case "width":
|
case "width":
|
||||||
case "height":
|
case "height":
|
||||||
|
case "seamark_height":
|
||||||
case "depth":
|
case "depth":
|
||||||
if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) {
|
if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) {
|
||||||
units = mapActivity.getResources().getString(R.string.foot);
|
units = mapActivity.getResources().getString(R.string.foot);
|
||||||
|
@ -699,6 +700,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
} else {
|
} else {
|
||||||
units = mapActivity.getResources().getString(R.string.m);
|
units = mapActivity.getResources().getString(R.string.m);
|
||||||
}
|
}
|
||||||
|
prefix = prefixConstructor(prefix, units);
|
||||||
break;
|
break;
|
||||||
case "distance":
|
case "distance":
|
||||||
value = String.valueOf(OsmAndFormatter
|
value = String.valueOf(OsmAndFormatter
|
||||||
|
@ -712,28 +714,33 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
} else {
|
} else {
|
||||||
units = mapActivity.getResources().getString(R.string.km);
|
units = mapActivity.getResources().getString(R.string.km);
|
||||||
}
|
}
|
||||||
|
prefix = prefixConstructor(prefix, units);
|
||||||
break;
|
break;
|
||||||
case "capacity":
|
case "capacity":
|
||||||
units = mapActivity.getResources().getString(R.string.cubic_m);
|
units = mapActivity.getResources().getString(R.string.cubic_m);
|
||||||
|
prefix = prefixConstructor(prefix, units);
|
||||||
break;
|
break;
|
||||||
case "maxweight":
|
case "maxweight":
|
||||||
units = mapActivity.getResources().getString(R.string.cubic_m);
|
units = mapActivity.getResources().getString(R.string.cubic_m);
|
||||||
|
prefix = prefixConstructor(prefix, units);
|
||||||
break;
|
break;
|
||||||
case "students":
|
case "students":
|
||||||
case "spots":
|
case "spots":
|
||||||
case "seats":
|
case "seats":
|
||||||
units = "capacity";
|
units = "capacity";
|
||||||
|
prefix = prefixConstructor(prefix, units);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prefix.isEmpty()) {
|
|
||||||
prefix = prefix + ", " + units;
|
|
||||||
} else {
|
|
||||||
prefix = units;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new String[]{prefix, value};
|
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) {
|
public void buildAmenityRow(View view, AmenityInfoRow info) {
|
||||||
if (info.icon != null) {
|
if (info.icon != null) {
|
||||||
buildRow(view, info.icon, info.text, info.textPrefix, info.collapsable, info.collapsableView,
|
buildRow(view, info.icon, info.text, info.textPrefix, info.collapsable, info.collapsableView,
|
||||||
|
|
Loading…
Reference in a new issue