Fix RP progress

This commit is contained in:
crimean 2019-07-17 14:47:56 +03:00
parent 106611fc81
commit 681f5c336c
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);
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;

View file

@ -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);