Merge pull request #7754 from osmandapp/Fix_7693

Fix 7693
This commit is contained in:
max-klaus 2019-10-25 16:25:40 +03:00 committed by GitHub
commit d5050a97fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View file

@ -130,7 +130,7 @@ public class AppInitializer implements IProgress {
FAVORITES_INITIALIZED, NATIVE_INITIALIZED,
NATIVE_OPEN_GLINITIALIZED,
TASK_CHANGED, MAPS_INITIALIZED, POI_TYPES_INITIALIZED, ASSETS_COPIED, INIT_RENDERERS,
RESTORE_BACKUPS, INDEX_REGION_BOUNDARIES, SAVE_GPX_TRACKS, LOAD_GPX_TRACKS
RESTORE_BACKUPS, INDEX_REGION_BOUNDARIES, SAVE_GPX_TRACKS, LOAD_GPX_TRACKS, ROUTING_CONFIG_INITIALIZED
}
public interface AppInitializeListener {
@ -588,6 +588,7 @@ public class AppInitializer implements IProgress {
protected void onPostExecute(Builder builder) {
super.onPostExecute(builder);
app.updateRoutingConfig(builder);
notifyEvent(InitEvents.ROUTING_CONFIG_INITIALIZED);
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

View file

@ -318,12 +318,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapLayers.createLayers(mapView);
createProgressBarForRouting();
updateStatusBarColor();
// This situtation could be when navigation suddenly crashed and after restarting
// it tries to continue the last route
if (settings.FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()
&& !app.getRoutingHelper().isRouteBeingCalculated()) {
FailSafeFuntions.restoreRoutingMode(this);
} else if (!app.getRoutingHelper().isRoutePlanningMode()
if ((app.getRoutingHelper().isRouteCalculated() || app.getRoutingHelper().isRouteBeingCalculated())
&& !app.getRoutingHelper().isRoutePlanningMode()
&& !settings.FOLLOW_THE_ROUTE.get()
&& app.getTargetPointsHelper().getAllPoints().size() > 0) {
app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>());
@ -423,6 +420,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (event == InitEvents.FAVORITES_INITIALIZED) {
refreshMap();
}
if (event == InitEvents.ROUTING_CONFIG_INITIALIZED) {
checkRestoreRoutingMode();
}
}
@Override
@ -441,6 +441,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
getMyApplication().checkApplicationIsBeingInitialized(this, initListener);
} else {
setupOpenGLView(true);
checkRestoreRoutingMode();
}
}
private void checkRestoreRoutingMode() {
// This situation could be when navigation suddenly crashed and after restarting
// it tries to continue the last route
if (settings.FOLLOW_THE_ROUTE.get()
&& !app.getRoutingHelper().isRouteCalculated()
&& !app.getRoutingHelper().isRouteBeingCalculated()) {
FailSafeFuntions.restoreRoutingMode(MapActivity.this);
}
}