add continue with previous route
git-svn-id: https://osmand.googlecode.com/svn/trunk@374 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
66bd6c43f8
commit
95e7d9be61
6 changed files with 44 additions and 6 deletions
|
@ -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) (?)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="continue_follow_previous_route">Предыдущий маршрут был не закончен. Продолжить следовать по нему?</string>
|
||||
<string name="context_menu_item_search_poi">Искать POI</string>
|
||||
<string name="context_menu_item_show_route">Маршрут от точки</string>
|
||||
<string name="use_trackball_descr">Использовать трекбол, чтобы перемещать карту</string>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="continue_follow_previous_route">Previous route was unfinished. Do you want to continue follow with it? </string>
|
||||
<string name="context_menu_item_search_poi">Search POI</string>
|
||||
<string name="context_menu_item_show_route">Show route from</string>
|
||||
<string name="use_trackball_descr">Use trackball to move map</string>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue