This commit is contained in:
Chumva 2019-10-25 15:18:11 +03:00
parent 764631fe9a
commit 3ee1ef6e4a
2 changed files with 13 additions and 7 deletions

View file

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

View file

@ -318,12 +318,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapLayers.createLayers(mapView); mapLayers.createLayers(mapView);
createProgressBarForRouting(); createProgressBarForRouting();
updateStatusBarColor(); updateStatusBarColor();
// This situtation could be when navigation suddenly crashed and after restarting
// it tries to continue the last route if (!app.getRoutingHelper().isRoutePlanningMode()
if (settings.FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()
&& !app.getRoutingHelper().isRouteBeingCalculated()) {
FailSafeFuntions.restoreRoutingMode(this);
} else if (!app.getRoutingHelper().isRoutePlanningMode()
&& !settings.FOLLOW_THE_ROUTE.get() && !settings.FOLLOW_THE_ROUTE.get()
&& app.getTargetPointsHelper().getAllPoints().size() > 0) { && app.getTargetPointsHelper().getAllPoints().size() > 0) {
app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>()); app.getRoutingHelper().clearCurrentRoute(null, new ArrayList<LatLon>());
@ -423,6 +419,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (event == InitEvents.FAVORITES_INITIALIZED) { if (event == InitEvents.FAVORITES_INITIALIZED) {
refreshMap(); refreshMap();
} }
if (event == InitEvents.ROUTING_CONFIG_INITIALIZED) {
// 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);
}
}
} }
@Override @Override