Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-06-19 20:30:21 +02:00
commit d0df0bad67
3 changed files with 28 additions and 17 deletions

View file

@ -86,6 +86,7 @@ public abstract class OsmandPlugin {
if(Version.isRouteNavPluginInlined(app)) { if(Version.isRouteNavPluginInlined(app)) {
RoutePointsPlugin routePointsPlugin = new RoutePointsPlugin(app); RoutePointsPlugin routePointsPlugin = new RoutePointsPlugin(app);
installedPlugins.add(routePointsPlugin); installedPlugins.add(routePointsPlugin);
enablePlugin(app, routePointsPlugin, true);
} }
installPlugin(OSMODROID_PLUGIN_COMPONENT, OsMoDroidPlugin.ID, app, new OsMoDroidPlugin(app)); installPlugin(OSMODROID_PLUGIN_COMPONENT, OsMoDroidPlugin.ID, app, new OsMoDroidPlugin(app));
@ -137,7 +138,7 @@ public abstract class OsmandPlugin {
public void mapActivityDestroy(MapActivity activity) { } public void mapActivityDestroy(MapActivity activity) { }
public void destinationReached() { } public boolean destinationReached() { return true; }
public void settingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {} public void settingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {}
@ -240,10 +241,14 @@ public abstract class OsmandPlugin {
} }
} }
public static void onDestinationReached() { public static boolean onDestinationReached() {
boolean b = true;
for (OsmandPlugin plugin : activePlugins) { for (OsmandPlugin plugin : activePlugins) {
plugin.destinationReached(); if(!plugin.destinationReached()){
b = false;
}
} }
return b;
} }

View file

@ -62,10 +62,14 @@ public class RoutePointsPlugin extends OsmandPlugin {
@Override @Override
public void destinationReached() { public boolean destinationReached() {
if(currentRoute != null) { if(currentRoute != null) {
currentRoute.naviateToNextPoint(); boolean naviateToNextPoint = currentRoute.naviateToNextPoint();
if(naviateToNextPoint) {
return false;
}
} }
return true;
} }
@Override @Override
@ -248,7 +252,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
sortPoints(); sortPoints();
} }
public void naviateToNextPoint() { public boolean naviateToNextPoint() {
if(!currentPoints.isEmpty()) { if(!currentPoints.isEmpty()) {
RoutePoint rp = currentPoints.get(0); RoutePoint rp = currentPoints.get(0);
if(rp.isNextNavigate) { if(rp.isNextNavigate) {
@ -259,11 +263,12 @@ public class RoutePointsPlugin extends OsmandPlugin {
if(!first.isVisited()) { if(!first.isVisited()) {
app.getTargetPointsHelper().navigateToPoint(first.getPoint(), true, -1, first.getName()); app.getTargetPointsHelper().navigateToPoint(first.getPoint(), true, -1, first.getName());
first.isNextNavigate = true; first.isNextNavigate = true;
return true;
} else { } else {
app.getTargetPointsHelper().clearPointToNavigate(true); app.getTargetPointsHelper().clearPointToNavigate(true);
} }
} }
return false;
} }
private void sortPoints() { private void sortPoints() {

View file

@ -434,16 +434,17 @@ public class RoutingHelper {
if(isFollowingMode) { if(isFollowingMode) {
voiceRouter.arrivedDestinationPoint(description); voiceRouter.arrivedDestinationPoint(description);
} }
clearCurrentRoute(null, null); if (OsmandPlugin.onDestinationReached()) {
setRoutePlanningMode(false); clearCurrentRoute(null, null);
OsmandPlugin.onDestinationReached(); setRoutePlanningMode(false);
app.runInUIThread(new Runnable() { OsmandPlugin.onDestinationReached();
@Override app.runInUIThread(new Runnable() {
public void run() { @Override
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get()); public void run() {
} settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
}); }
});
}
// targets.clearPointToNavigate(false); // targets.clearPointToNavigate(false);
return true; return true;
} }