Fix RP progress

This commit is contained in:
crimean 2019-07-17 14:47:56 +03:00
parent 981b31bc87
commit 28e6c3d59b
2 changed files with 27 additions and 2 deletions

View file

@ -396,7 +396,7 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
} }
ProgressBar progressBarButton = (ProgressBar) view.findViewById(R.id.progress_bar_button); ProgressBar progressBarButton = (ProgressBar) view.findViewById(R.id.progress_bar_button);
if (progressBarButton != null) { if (progressBarButton != null) {
progressBarButton.setProgress(100); progressBarButton.setProgress(isPublicTransportMode() ? 0 : 100);
} }
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr); TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
textViewExProgress.percent = isPublicTransportMode() ? 0 : 1; textViewExProgress.percent = isPublicTransportMode() ? 0 : 1;

View file

@ -1021,7 +1021,7 @@ public class RoutingHelper {
if(System.currentTimeMillis() - lastTimeEvaluatedRoute < RECALCULATE_THRESHOLD_CAUSING_FULL_RECALCULATE_INTERVAL) { if(System.currentTimeMillis() - lastTimeEvaluatedRoute < RECALCULATE_THRESHOLD_CAUSING_FULL_RECALCULATE_INTERVAL) {
recalculateCountInInterval ++; recalculateCountInInterval ++;
} }
RouteCalculationParams params = new RouteCalculationParams(); final RouteCalculationParams params = new RouteCalculationParams();
params.start = start; params.start = start;
params.end = end; params.end = end;
params.intermediates = intermediates; params.intermediates = intermediates;
@ -1041,6 +1041,19 @@ public class RoutingHelper {
if (params.mode.getRouteService() == RouteService.OSMAND) { if (params.mode.getRouteService() == RouteService.OSMAND) {
params.calculationProgress = new RouteCalculationProgress(); params.calculationProgress = new RouteCalculationProgress();
updateProgress = true; 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); 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) { public static void applyApplicationSettings(RouteCalculationParams params, OsmandSettings settings, ApplicationMode mode) {
params.leftSide = settings.DRIVING_REGION.get().leftHandDriving; params.leftSide = settings.DRIVING_REGION.get().leftHandDriving;
params.fast = settings.FAST_ROUTE_MODE.getModeValue(mode); params.fast = settings.FAST_ROUTE_MODE.getModeValue(mode);