diff --git a/OsmAnd/res/drawable-hdpi/info_max_speed.png b/OsmAnd/res/drawable-hdpi/info_max_speed.png new file mode 100644 index 0000000000..e072b61a05 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/info_max_speed.png differ diff --git a/OsmAnd/res/drawable-hdpi/widget_max_speed.png b/OsmAnd/res/drawable-hdpi/widget_max_speed.png new file mode 100644 index 0000000000..766136f262 Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/widget_max_speed.png differ diff --git a/OsmAnd/res/drawable-large/widget_max_speed.png b/OsmAnd/res/drawable-large/widget_max_speed.png new file mode 100644 index 0000000000..766136f262 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_max_speed.png differ diff --git a/OsmAnd/res/drawable-mdpi/info_max_speed.png b/OsmAnd/res/drawable-mdpi/info_max_speed.png new file mode 100644 index 0000000000..30e1cb4b46 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/info_max_speed.png differ diff --git a/OsmAnd/res/drawable-mdpi/widget_max_speed.png b/OsmAnd/res/drawable-mdpi/widget_max_speed.png new file mode 100644 index 0000000000..39356b96d3 Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/widget_max_speed.png differ diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 7c534439d5..85476ef167 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 1. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Allowed speed Lat %1$.3f, lon %2$.3f Current position From : %1$s\nTo : %2$s diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index b332effbbf..6192cd18a0 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -513,6 +513,10 @@ public class RoutingHelper { return i; } + public synchronized float getCurrentMaxSpeed() { + return route.getCurrentMaxSpeed(); + } + public synchronized AlarmInfo getMostImportantAlarm(MetricsConstants mc, boolean showCameras){ float mxspeed = route.getCurrentMaxSpeed(); AlarmInfo speedAlarm = null; @@ -574,7 +578,6 @@ public class RoutingHelper { private class RouteRecalculationThread extends Thread { - private boolean interrupted = false; private final RouteCalculationParams params; public RouteRecalculationThread(String name, RouteCalculationParams params) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index b26ec34267..4bf6f72e2a 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -247,6 +247,8 @@ public class MapInfoLayer extends OsmandMapLayer { mapInfoControls.registerSideWidget(time, R.drawable.widget_time, R.string.map_widget_time, "time",false, all, none, 10); TextInfoControl speed = ric.createSpeedControl(map, paintText, paintSubText); mapInfoControls.registerSideWidget(speed, R.drawable.widget_speed, R.string.map_widget_speed, "speed", false, all, none, 15); + TextInfoControl maxspeed = ric.createMaxSpeedControl(map, paintText, paintSubText); + mapInfoControls.registerSideWidget(maxspeed, R.drawable.widget_max_speed, R.string.map_widget_max_speed, "max_speed", false, none, none, 18); TextInfoControl alt = ric.createAltitudeControl(map, paintText, paintSubText); mapInfoControls.registerSideWidget(alt, R.drawable.widget_altitude, R.string.map_widget_altitude, "altitude", false, EnumSet.of(ApplicationMode.PEDESTRIAN), none, 20); diff --git a/OsmAnd/src/net/osmand/plus/views/RouteInfoControls.java b/OsmAnd/src/net/osmand/plus/views/RouteInfoControls.java index ea740f007f..e2b544200d 100644 --- a/OsmAnd/src/net/osmand/plus/views/RouteInfoControls.java +++ b/OsmAnd/src/net/osmand/plus/views/RouteInfoControls.java @@ -307,6 +307,37 @@ public class RouteInfoControls { return altitudeControl; } + protected TextInfoControl createMaxSpeedControl(final MapActivity map, Paint paintText, Paint paintSubText) { + final RoutingHelper rh = map.getRoutingHelper(); + final TextInfoControl speedControl = new TextInfoControl(map, 3, paintText, paintSubText) { + private float cachedSpeed = 0; + + @Override + public boolean updateInfo() { + float mx = rh == null ? 0 : rh.getCurrentMaxSpeed(); + if (cachedSpeed != mx) { + cachedSpeed = mx; + if (cachedSpeed == 0) { + setText(null, null); + } else { + String ds = OsmAndFormatter.getFormattedSpeed(cachedSpeed, map); + int ls = ds.lastIndexOf(' '); + if (ls == -1) { + setText(ds, null); + } else { + setText(ds.substring(0, ls), ds.substring(ls + 1)); + } + } + return true; + } + return false; + } + }; + speedControl.setImageDrawable(map.getResources().getDrawable(R.drawable.info_max_speed)); + speedControl.setText(null, null); + return speedControl; + } + protected TextInfoControl createSpeedControl(final MapActivity map, Paint paintText, Paint paintSubText) { final TextInfoControl speedControl = new TextInfoControl(map, 3, paintText, paintSubText) { private float cachedSpeed = 0;