diff --git a/OsmAnd-java/src/net/osmand/map/OsmandRegions.java b/OsmAnd-java/src/net/osmand/map/OsmandRegions.java index 4c699d4d9d..7809b997be 100644 --- a/OsmAnd-java/src/net/osmand/map/OsmandRegions.java +++ b/OsmAnd-java/src/net/osmand/map/OsmandRegions.java @@ -48,6 +48,7 @@ public class OsmandRegions { 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_WIKI_LINK = "region_wiki_link"; + public static final String FIELD_POPULATION = "region_population"; private BinaryMapIndexReader reader; private String locale = "en"; @@ -76,6 +77,7 @@ public class OsmandRegions { Integer leftHandDrivingType = null; Integer roadSignsType = null; Integer wikiLinkType = null; + Integer populationType = null; public String get(Integer tp, BinaryMapDataObject object) { if(tp == null) { @@ -396,6 +398,7 @@ public class OsmandRegions { rd.params.regionMetric = mapIndexFields.get(mapIndexFields.metricType, object); rd.params.regionRoadSigns = mapIndexFields.get(mapIndexFields.roadSignsType, object); rd.params.wikiLink = mapIndexFields.get(mapIndexFields.wikiLinkType, object); + rd.params.population = mapIndexFields.get(mapIndexFields.populationType, object); rd.regionSearchText = getSearchIndex(object); rd.regionMapDownload = isDownloadOfType(object, MAP_TYPE); return rd; @@ -513,6 +516,7 @@ public class OsmandRegions { mapIndexFields.leftHandDrivingType = object.getMapIndex().getRule(FIELD_LEFT_HAND_DRIVING, null); mapIndexFields.roadSignsType = object.getMapIndex().getRule(FIELD_ROAD_SIGNS, 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); } } diff --git a/OsmAnd-java/src/net/osmand/map/WorldRegion.java b/OsmAnd-java/src/net/osmand/map/WorldRegion.java index 7c29a152f3..bdc5d5fd08 100644 --- a/OsmAnd-java/src/net/osmand/map/WorldRegion.java +++ b/OsmAnd-java/src/net/osmand/map/WorldRegion.java @@ -46,6 +46,7 @@ public class WorldRegion implements Serializable { protected String regionMetric; protected String regionRoadSigns; protected String wikiLink; + protected String population; public String getRegionLeftHandDriving() { return regionLeftHandDriving; @@ -66,6 +67,10 @@ public class WorldRegion implements Serializable { public String getWikiLink() { return wikiLink; } + + public String getPopulation() { + return population; + } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java index 86441cb1d0..6e4b8ce5af 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java @@ -197,6 +197,21 @@ public class MapDataMenuController extends MenuController { } 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) { DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(getMapActivity()); addPlainMenuItem(R.drawable.ic_action_data, indexItem.getRemoteDate(dateFormat), false, false);