Add city types in activity
This commit is contained in:
parent
f46b154818
commit
74671267b5
3 changed files with 28 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<resources>
|
||||
<string name="city_type_suburb">Suburb</string>
|
||||
<string name="city_type_hamlet">Hamlet</string>
|
||||
<string name="city_type_village">Village</string>
|
||||
<string name="city_type_town">Town</string>
|
||||
<string name="city_type_city">City</string>
|
||||
<string name="layer_poi_label">POI labels</string>
|
||||
<string name="auto_follow_route_navigation_descr">Enable auto follow position only in navigation mode.</string>
|
||||
<string name="auto_follow_route_navigation">Auto follow navigation</string>
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.text.MessageFormat;
|
|||
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.AmenityType;
|
||||
import net.osmand.data.City.CityType;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||
|
@ -92,6 +93,22 @@ public class OsmAndFormatter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static String toPublicString(CityType t, Context ctx) {
|
||||
switch (t) {
|
||||
case CITY:
|
||||
return ctx.getString(R.string.city_type_city);
|
||||
case HAMLET:
|
||||
return ctx.getString(R.string.city_type_hamlet);
|
||||
case TOWN:
|
||||
return ctx.getString(R.string.city_type_town);
|
||||
case VILLAGE:
|
||||
return ctx.getString(R.string.city_type_village);
|
||||
case SUBURB:
|
||||
return ctx.getString(R.string.city_type_suburb);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static String toPublicString(AmenityType t, Context ctx) {
|
||||
switch (t) {
|
||||
case SUSTENANCE:
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.activities.search;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.Algoritms;
|
||||
import net.osmand.OsmAndFormatter;
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.data.City;
|
||||
|
@ -89,7 +90,11 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity<MapOb
|
|||
public String getText(MapObject obj) {
|
||||
LatLon l = obj.getLocation();
|
||||
if (getFilter().length() > 2 && locationToSearch != null && l != null) {
|
||||
return obj.getName(region.useEnglishNames()) + " - " + //$NON-NLS-1$
|
||||
String name =obj.getName(region.useEnglishNames());
|
||||
if(obj instanceof City){
|
||||
name += " [" + OsmAndFormatter.toPublicString(((City) obj).getType(), this) + "]";
|
||||
}
|
||||
return name+ " - " + //$NON-NLS-1$
|
||||
OsmAndFormatter.getFormattedDistance((int) MapUtils.getDistance(l, locationToSearch), this);
|
||||
} else {
|
||||
return obj.getName(region.useEnglishNames());
|
||||
|
|
Loading…
Reference in a new issue