Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d0df0bad67
3 changed files with 28 additions and 17 deletions
|
@ -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,10 +241,14 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,10 +62,14 @@ 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
|
||||
|
@ -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() {
|
||||
|
|
|
@ -434,16 +434,17 @@ public class RoutingHelper {
|
|||
if(isFollowingMode) {
|
||||
voiceRouter.arrivedDestinationPoint(description);
|
||||
}
|
||||
clearCurrentRoute(null, null);
|
||||
setRoutePlanningMode(false);
|
||||
OsmandPlugin.onDestinationReached();
|
||||
app.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
|
||||
}
|
||||
});
|
||||
|
||||
if (OsmandPlugin.onDestinationReached()) {
|
||||
clearCurrentRoute(null, null);
|
||||
setRoutePlanningMode(false);
|
||||
OsmandPlugin.onDestinationReached();
|
||||
app.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get());
|
||||
}
|
||||
});
|
||||
}
|
||||
// targets.clearPointToNavigate(false);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue