Try fix #4043
This commit is contained in:
parent
309e6f4bfd
commit
33b579972b
3 changed files with 21 additions and 9 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue