This commit is contained in:
Alexey Kulish 2017-10-15 14:39:24 +03:00
parent 309e6f4bfd
commit 33b579972b
3 changed files with 21 additions and 9 deletions

View file

@ -758,7 +758,7 @@ public class OsmandApplication extends MultiDexApplication {
return lang;
}
public RoutingConfiguration.Builder getDefaultRoutingConfig() {
public synchronized RoutingConfiguration.Builder getDefaultRoutingConfig() {
if(defaultRoutingConfig == null) {
defaultRoutingConfig = appInitializer.getLazyDefaultRoutingConfig();
}

View file

@ -403,14 +403,24 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
@Override
public void updateProgress(int progress) {
if (findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE) {
if (pbExtView.getVisibility() == View.VISIBLE) {
pbExtView.setVisibility(View.GONE);
}
if (pb.getVisibility() == View.GONE) {
pb.setVisibility(View.VISIBLE);
}
pb.setProgress(progress);
pb.invalidate();
pb.requestLayout();
} else {
if (pb.getVisibility() == View.VISIBLE) {
pb.setVisibility(View.GONE);
}
if (pbExtView.getVisibility() == View.GONE) {
pbExtView.setVisibility(View.VISIBLE);
}
pbExt.setProgress(progress);
pbExt.invalidate();
pbExt.requestLayout();
}
}

View file

@ -952,14 +952,14 @@ public class RoutingHelper {
}
public void startRouteCalculationThread(RouteCalculationParams params, boolean paramsChanged, boolean updateProgress) {
if (updateProgress) {
updateProgress(params);
}
synchronized (this) {
final Thread prevRunningJob = currentRunningJob;
RouteRecalculationThread newThread = new RouteRecalculationThread(
"Calculating route", params, paramsChanged); //$NON-NLS-1$
currentRunningJob = newThread;
if (updateProgress) {
updateProgress(params);
}
if (prevRunningJob != null) {
newThread.setWaitPrevJob(prevRunningJob);
}
@ -986,6 +986,8 @@ public class RoutingHelper {
if (all > 0) {
int t = (int) Math.min(p * p / (all * all) * 100f, 99);
progressRoute.updateProgress(t);
} else {
progressRoute.updateProgress(0);
}
Thread t = currentRunningJob;
if(t instanceof RouteRecalculationThread && ((RouteRecalculationThread) t).params != params) {