diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index cf71cf8fba..6d4db65870 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -17,12 +17,10 @@ public class ToDoConstants { // Improvement : progress while loading tiles // Improvement : download with wget - // Yandex traffic : http://jgo.maps.yandex.net/tiles?l=trf // Imrpovement : show vehicle for calculating route // Improvement : show detailed route on the map with turns and show route information directly (like in gmaps) // Improvement : show route info after route is calculated (-) - // Improvement : after return if there was previous route (continue follow) // Not clear if it is really needed // 69. Add phone information to POI @@ -31,7 +29,7 @@ public class ToDoConstants { // Unscheduled (complex) // 66. Transport routing (show next stop, total distance, show stop get out) (?). - // 64. Traffic information (?) - rmaps? + // 64. Traffic information (?) - rmaps (http://jgo.maps.yandex.net/tiles?l=trf)? // 65. Intermediate points - for better control routing, to avoid traffic jams ...(?) // 40. Support simple vector road rendering (require new index file) (?) // 63. Support simple offline routing(require new index file) (?) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index d50dd5e2b2..5171cf0232 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -1,5 +1,6 @@ + Предыдущий маршрут был не закончен. Продолжить следовать по нему? Искать POI Маршрут от точки Использовать трекбол, чтобы перемещать карту diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 8863f377e0..15966f8f17 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,6 @@ + Previous route was unfinished. Do you want to continue follow with it? Search POI Show route from Use trackball to move map diff --git a/OsmAnd/src/com/osmand/OsmandSettings.java b/OsmAnd/src/com/osmand/OsmandSettings.java index 8248c5c3b8..a1c6980119 100644 --- a/OsmAnd/src/com/osmand/OsmandSettings.java +++ b/OsmAnd/src/com/osmand/OsmandSettings.java @@ -602,6 +602,18 @@ public class OsmandSettings { } + public static final String FOLLOW_TO_THE_ROUTE = "follow_to_route"; //$NON-NLS-1$ + + public static boolean isFollowingByRoute(Context ctx){ + SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); + return prefs.getBoolean(FOLLOW_TO_THE_ROUTE, false); + } + + public static boolean setFollowingByRoute(Context ctx, boolean val){ + SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); + return prefs.edit().putBoolean(FOLLOW_TO_THE_ROUTE, val).commit(); + } + } diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index e99c400fa2..d215f5cd75 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -212,6 +212,29 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso routingHelper.setFinalAndCurrentLocation(pointToNavigate, null); } + if(OsmandSettings.isFollowingByRoute(this)){ + if(pointToNavigate == null){ + OsmandSettings.setFollowingByRoute(this, false); + } else if(!routingHelper.isRouteCalculated()){ + Builder builder = new AlertDialog.Builder(this); + builder.setMessage(R.string.continue_follow_previous_route); + builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog, int which) { + routingHelper.setFollowingMode(true); + } + }); + builder.setNegativeButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener(){ + @Override + public void onClick(DialogInterface dialog, int which) { + OsmandSettings.setFollowingByRoute(MapActivity.this, false); + routingHelper.setFinalLocation(null); + mapView.refreshMap(); + } + }); + builder.show(); + } + } navigationLayer.setPointToNavigate(pointToNavigate); @@ -752,7 +775,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso private void updateNavigateToPointMenu(){ if (navigateToPointMenu != null) { - navigateToPointMenu.setTitle(routingHelper.getFinalLocation() != null ? R.string.stop_routing : R.string.stop_navigation); + navigateToPointMenu.setTitle(routingHelper.isRouteCalculated() ? R.string.stop_routing : R.string.stop_navigation); if (OsmandSettings.getPointToNavigate(this) != null) { navigateToPointMenu.setVisible(true); } else { @@ -815,10 +838,9 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso return true; } else if (item.getItemId() == R.id.map_navigate_to_point) { if(navigationLayer.getPointToNavigate() != null){ - if(routingHelper.getFinalLocation() != null){ + if(routingHelper.isRouteCalculated()){ routingHelper.setFinalAndCurrentLocation(null, null); routingHelper.setFollowingMode(false); - mapView.refreshMap(); updateNavigateToPointMenu(); } else { navigateToPoint(null); @@ -826,6 +848,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso } else { navigateToPoint(new LatLon(mapView.getLatitude(), mapView.getLongitude())); } + mapView.refreshMap(); } return super.onOptionsItemSelected(item); } @@ -849,6 +872,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso } routingHelper.setFollowingMode(true); routingHelper.setFinalAndCurrentLocation(navigationLayer.getPointToNavigate(), location); + OsmandSettings.setFollowingByRoute(MapActivity.this, true); updateNavigateToPointMenu(); } }); diff --git a/OsmAnd/src/com/osmand/activities/RoutingHelper.java b/OsmAnd/src/com/osmand/activities/RoutingHelper.java index 787d18aebc..0bafb8f72d 100644 --- a/OsmAnd/src/com/osmand/activities/RoutingHelper.java +++ b/OsmAnd/src/com/osmand/activities/RoutingHelper.java @@ -133,10 +133,12 @@ public class RoutingHelper { if(currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < 60){ if(lastFixedLocation != null && lastFixedLocation.distanceTo(lastPoint) < 60){ showMessage(context.getString(R.string.arrived_at_destination)); + OsmandSettings.setFollowingByRoute(context, false); voiceRouter.arrivedDestinationPoint(); updateCurrentRoute(routeNodes.size() - 1); // clear final location to prevent all time showing message finalLocation = null; + } lastFixedLocation = currentLocation; return true;