diff --git a/OsmAnd-java/src/net/osmand/map/WorldRegion.java b/OsmAnd-java/src/net/osmand/map/WorldRegion.java index b4460aeffc..7c29a152f3 100644 --- a/OsmAnd-java/src/net/osmand/map/WorldRegion.java +++ b/OsmAnd-java/src/net/osmand/map/WorldRegion.java @@ -20,7 +20,10 @@ public class WorldRegion implements Serializable { public static final String JAPAN_REGION_ID = "japan_asia"; public static final String SOUTH_AMERICA_REGION_ID = "southamerica"; protected static final String WORLD = "world"; - + + // Just a string constant + public static final String UNITED_KINGDOM_REGION_ID = "gb_europe"; + // Hierarchy protected WorldRegion superregion; protected List subregions; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java index 3ccc72acb6..e96f13464e 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java @@ -92,6 +92,7 @@ public class ReportsFragment extends BaseOsmAndFragment { String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition); int regionItemPosition = regionReportsSpinner.getSelectedItemPosition(); String regionUrlString = regionsForReportsAdapter.getQueryString(regionItemPosition); + regionUrlString = regionUrlString == null ? "" : regionUrlString; GetJsonAsyncTask.OnResponseListener onResponseListener = new GetJsonAsyncTask.OnResponseListener() { @Override @@ -150,21 +151,52 @@ public class ReportsFragment extends BaseOsmAndFragment { public RegionsForReportsAdapter(final OsmandActionBarActivity context) { super(context, R.layout.reports_for_spinner_item, android.R.id.text1); - WorldRegion root = context.getMyApplication().getRegions().getWorldRegion(); + final WorldRegion root = context.getMyApplication().getRegions().getWorldRegion(); ArrayList groups = new ArrayList<>(); + groups.add(root); processGroup(root, groups, context); Collections.sort(groups, new Comparator() { @Override public int compare(WorldRegion lhs, WorldRegion rhs) { - return lhs.getLocaleName().compareTo(rhs.getLocaleName()); + if (lhs == root) { + return -1; + } + if (rhs == root) { + return 1; + } + return getHumanReadableName(lhs).compareTo(getHumanReadableName(rhs)); } }); for (WorldRegion group : groups) { - add(group.getLocaleName()); + String name = getHumanReadableName(group); + add(name); queryRegionNames.add(group.getRegionDownloadName()); } } + private static String getHumanReadableName(WorldRegion group) { + String name; + if(group.getLevel() > 2 || (group.getLevel() == 2 + && group.getSuperregion().getRegionId().equals(WorldRegion.RUSSIA_REGION_ID))) { + WorldRegion parent = group.getSuperregion(); + WorldRegion parentsParent = group.getSuperregion().getSuperregion(); + if(group.getLevel() == 3) { + if(parentsParent.getRegionId().equals(WorldRegion.RUSSIA_REGION_ID)) { + name = parentsParent.getLocaleName() + " " + group.getLocaleName(); + } else if (!parent.getRegionId().equals(WorldRegion.UNITED_KINGDOM_REGION_ID)) { + name = parent.getLocaleName() + " " + group.getLocaleName(); + } else { + name = group.getLocaleName(); + } + } else { + name = parent.getLocaleName() + " " + group.getLocaleName(); + } + } else { + name = group.getLocaleName(); + } + return name; + } + public String getQueryString(int position) { return queryRegionNames.get(position); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java index cff293bda0..c692b6cd43 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/ImpassibleRoadsMenuController.java @@ -32,7 +32,7 @@ public class ImpassibleRoadsMenuController extends MenuController { } }; rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete); - rightTitleButtonController.leftIconId = R.drawable.map_pin_avoid_road; + rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark; } @Override @@ -47,6 +47,6 @@ public class ImpassibleRoadsMenuController extends MenuController { @Override public Drawable getLeftIcon() { - return getMapActivity().getResources().getDrawable(R.drawable.ic_action_road_works_dark); + return getMapActivity().getResources().getDrawable(R.drawable.map_pin_avoid_road); } } diff --git a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java index e2728c3791..64facd89de 100644 --- a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java @@ -51,7 +51,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL float x = tileBox.getPixXFromLatLon(location.getLatitude(), location.getLongitude()); float y = tileBox.getPixYFromLatLon(location.getLatitude(), location.getLongitude()); float left = x - roadWorkIcon.getWidth() / 2; - float top = y - roadWorkIcon.getHeight() / 2; + float top = y - roadWorkIcon.getHeight(); canvas.drawBitmap(roadWorkIcon, left, top, paint); } }