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)) {
RoutePointsPlugin routePointsPlugin = new RoutePointsPlugin(app);
installedPlugins.add(routePointsPlugin);
enablePlugin(app, routePointsPlugin, true);
}
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 destinationReached() { }
public boolean destinationReached() { return true; }
public void settingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {}
@ -240,11 +241,15 @@ public abstract class OsmandPlugin {
}
}
public static void onDestinationReached() {
public static boolean onDestinationReached() {
boolean b = true;
for (OsmandPlugin plugin : activePlugins) {
plugin.destinationReached();
if(!plugin.destinationReached()){
b = false;
}
}
return b;
}
public static void createLayers(OsmandMapTileView mapView, MapActivity activity) {

View file

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

View file

@ -434,6 +434,7 @@ public class RoutingHelper {
if(isFollowingMode) {
voiceRouter.arrivedDestinationPoint(description);
}
if (OsmandPlugin.onDestinationReached()) {
clearCurrentRoute(null, null);
setRoutePlanningMode(false);
OsmandPlugin.onDestinationReached();
@ -443,7 +444,7 @@ public class RoutingHelper {
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
}
});
}
// targets.clearPointToNavigate(false);
return true;
}