diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java index 65a6ae6b30..9f519e1299 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java @@ -396,7 +396,7 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment { } ProgressBar progressBarButton = (ProgressBar) view.findViewById(R.id.progress_bar_button); if (progressBarButton != null) { - progressBarButton.setProgress(100); + progressBarButton.setProgress(isPublicTransportMode() ? 0 : 100); } TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr); textViewExProgress.percent = isPublicTransportMode() ? 0 : 1; diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index ca1ee7c1b1..3979b8b45a 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -1021,7 +1021,7 @@ public class RoutingHelper { if(System.currentTimeMillis() - lastTimeEvaluatedRoute < RECALCULATE_THRESHOLD_CAUSING_FULL_RECALCULATE_INTERVAL) { recalculateCountInInterval ++; } - RouteCalculationParams params = new RouteCalculationParams(); + final RouteCalculationParams params = new RouteCalculationParams(); params.start = start; params.end = end; params.intermediates = intermediates; @@ -1041,6 +1041,19 @@ public class RoutingHelper { if (params.mode.getRouteService() == RouteService.OSMAND) { params.calculationProgress = new RouteCalculationProgress(); updateProgress = true; + } else { + params.resultListener = new RouteCalculationParams.RouteCalculationResultListener() { + @Override + public void onRouteCalculated(RouteCalculationResult route) { + app.runInUIThread(new Runnable() { + + @Override + public void run() { + finishProgress(params); + } + }); + } + }; } startRouteCalculationThread(params, paramsChanged, updateProgress); } @@ -1109,6 +1122,18 @@ public class RoutingHelper { } } + private void finishProgress(RouteCalculationParams params) { + final RouteCalculationProgressCallback progressRoute; + if (params.calculationProgressCallback != null) { + progressRoute = params.calculationProgressCallback; + } else { + progressRoute = this.progressRoute; + } + if (progressRoute != null ) { + progressRoute.finish(); + } + } + public static void applyApplicationSettings(RouteCalculationParams params, OsmandSettings settings, ApplicationMode mode) { params.leftSide = settings.DRIVING_REGION.get().leftHandDriving; params.fast = settings.FAST_ROUTE_MODE.getModeValue(mode);