Alexey Kulish 2016-01-17 15:11:08 +03:00
parent bddcfd58b8
commit e74e913ff8
3 changed files with 24 additions and 0 deletions

View file

@ -48,6 +48,7 @@ public class OsmandRegions {
public static final String FIELD_ROAD_SIGNS = "region_road_signs"; public static final String FIELD_ROAD_SIGNS = "region_road_signs";
public static final String FIELD_LEFT_HAND_DRIVING = "region_left_hand_navigation"; public static final String FIELD_LEFT_HAND_DRIVING = "region_left_hand_navigation";
public static final String FIELD_WIKI_LINK = "region_wiki_link"; public static final String FIELD_WIKI_LINK = "region_wiki_link";
public static final String FIELD_POPULATION = "region_population";
private BinaryMapIndexReader reader; private BinaryMapIndexReader reader;
private String locale = "en"; private String locale = "en";
@ -76,6 +77,7 @@ public class OsmandRegions {
Integer leftHandDrivingType = null; Integer leftHandDrivingType = null;
Integer roadSignsType = null; Integer roadSignsType = null;
Integer wikiLinkType = null; Integer wikiLinkType = null;
Integer populationType = null;
public String get(Integer tp, BinaryMapDataObject object) { public String get(Integer tp, BinaryMapDataObject object) {
if(tp == null) { if(tp == null) {
@ -396,6 +398,7 @@ public class OsmandRegions {
rd.params.regionMetric = mapIndexFields.get(mapIndexFields.metricType, object); rd.params.regionMetric = mapIndexFields.get(mapIndexFields.metricType, object);
rd.params.regionRoadSigns = mapIndexFields.get(mapIndexFields.roadSignsType, object); rd.params.regionRoadSigns = mapIndexFields.get(mapIndexFields.roadSignsType, object);
rd.params.wikiLink = mapIndexFields.get(mapIndexFields.wikiLinkType, object); rd.params.wikiLink = mapIndexFields.get(mapIndexFields.wikiLinkType, object);
rd.params.population = mapIndexFields.get(mapIndexFields.populationType, object);
rd.regionSearchText = getSearchIndex(object); rd.regionSearchText = getSearchIndex(object);
rd.regionMapDownload = isDownloadOfType(object, MAP_TYPE); rd.regionMapDownload = isDownloadOfType(object, MAP_TYPE);
return rd; return rd;
@ -513,6 +516,7 @@ public class OsmandRegions {
mapIndexFields.leftHandDrivingType = object.getMapIndex().getRule(FIELD_LEFT_HAND_DRIVING, null); mapIndexFields.leftHandDrivingType = object.getMapIndex().getRule(FIELD_LEFT_HAND_DRIVING, null);
mapIndexFields.roadSignsType = object.getMapIndex().getRule(FIELD_ROAD_SIGNS, null); mapIndexFields.roadSignsType = object.getMapIndex().getRule(FIELD_ROAD_SIGNS, null);
mapIndexFields.wikiLinkType = object.getMapIndex().getRule(FIELD_WIKI_LINK, null); mapIndexFields.wikiLinkType = object.getMapIndex().getRule(FIELD_WIKI_LINK, null);
mapIndexFields.populationType = object.getMapIndex().getRule(FIELD_POPULATION, null);
mapIndexFields.nameType = object.getMapIndex().getRule(FIELD_NAME, null); mapIndexFields.nameType = object.getMapIndex().getRule(FIELD_NAME, null);
} }
} }

View file

@ -46,6 +46,7 @@ public class WorldRegion implements Serializable {
protected String regionMetric; protected String regionMetric;
protected String regionRoadSigns; protected String regionRoadSigns;
protected String wikiLink; protected String wikiLink;
protected String population;
public String getRegionLeftHandDriving() { public String getRegionLeftHandDriving() {
return regionLeftHandDriving; return regionLeftHandDriving;
@ -66,6 +67,10 @@ public class WorldRegion implements Serializable {
public String getWikiLink() { public String getWikiLink() {
return wikiLink; return wikiLink;
} }
public String getPopulation() {
return population;
}
} }

View file

@ -197,6 +197,21 @@ public class MapDataMenuController extends MenuController {
} }
addPlainMenuItem(R.drawable.ic_world_globe_dark, url, false, true); addPlainMenuItem(R.drawable.ic_world_globe_dark, url, false, true);
} }
if (!Algorithms.isEmpty(mapObject.getWorldRegion().getParams().getPopulation())) {
String population = mapObject.getWorldRegion().getParams().getPopulation();
StringBuilder b = new StringBuilder();
int k = 0;
for (int i = population.length() - 1; i >= 0; i--) {
if (k == 3) {
b.insert(0, " ");
k = 0;
}
b.insert(0, population.charAt(i));
k++;
}
addPlainMenuItem(R.drawable.ic_action_info_dark, getMapActivity().getResources().getString(R.string.poi_population)
+ ": " + b, false, false);
}
if (indexItem != null) { if (indexItem != null) {
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(getMapActivity()); DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(getMapActivity());
addPlainMenuItem(R.drawable.ic_action_data, indexItem.getRemoteDate(dateFormat), false, false); addPlainMenuItem(R.drawable.ic_action_data, indexItem.getRemoteDate(dateFormat), false, false);