Fix possible CalledFromWrongThreadException
This commit is contained in:
parent
e4098c0135
commit
f95c97ff15
3 changed files with 18 additions and 7 deletions
|
@ -1002,7 +1002,6 @@ public class MeasurementEditingContext implements IRouteSettingsListener {
|
||||||
pts.add(pt);
|
pts.add(pt);
|
||||||
}
|
}
|
||||||
calculatedPairs++;
|
calculatedPairs++;
|
||||||
params.calculationProgressCallback.updateProgress(0);
|
|
||||||
List<RouteSegmentResult> originalRoute = route.getOriginalRoute();
|
List<RouteSegmentResult> originalRoute = route.getOriginalRoute();
|
||||||
if (Algorithms.isEmpty(originalRoute)) {
|
if (Algorithms.isEmpty(originalRoute)) {
|
||||||
originalRoute = Collections.singletonList(RoutePlannerFrontEnd.generateStraightLineSegment(
|
originalRoute = Collections.singletonList(RoutePlannerFrontEnd.generateStraightLineSegment(
|
||||||
|
@ -1012,6 +1011,7 @@ public class MeasurementEditingContext implements IRouteSettingsListener {
|
||||||
application.runInUIThread(new Runnable() {
|
application.runInUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
params.calculationProgressCallback.updateProgress(0);
|
||||||
updateSegmentsForSnap(true, false);
|
updateSegmentsForSnap(true, false);
|
||||||
progressListener.refresh();
|
progressListener.refresh();
|
||||||
RouteCalculationParams params = getParams(false);
|
RouteCalculationParams params = getParams(false);
|
||||||
|
|
|
@ -232,12 +232,18 @@ class RouteRecalculationHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
void startProgress(final RouteCalculationParams params) {
|
void startProgress(final RouteCalculationParams params) {
|
||||||
|
app.runInUIThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
if (params.calculationProgressCallback != null) {
|
if (params.calculationProgressCallback != null) {
|
||||||
params.calculationProgressCallback.start();
|
params.calculationProgressCallback.start();
|
||||||
} else if (progressRoute != null) {
|
} else if (progressRoute != null) {
|
||||||
progressRoute.start();
|
progressRoute.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void updateProgress(final RouteCalculationParams params) {
|
void updateProgress(final RouteCalculationParams params) {
|
||||||
final RouteCalculationProgressCallback progressRoute;
|
final RouteCalculationProgressCallback progressRoute;
|
||||||
|
|
|
@ -237,8 +237,13 @@ public class TransportRoutingHelper {
|
||||||
private void startProgress(final TransportRouteCalculationParams params) {
|
private void startProgress(final TransportRouteCalculationParams params) {
|
||||||
final TransportRouteCalculationProgressCallback progressRoute = this.progressRoute;
|
final TransportRouteCalculationProgressCallback progressRoute = this.progressRoute;
|
||||||
if (progressRoute != null) {
|
if (progressRoute != null) {
|
||||||
|
app.runInUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
progressRoute.start();
|
progressRoute.start();
|
||||||
}
|
}
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
setCurrentRoute(-1);
|
setCurrentRoute(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue