commit
3eec6c2b66
4 changed files with 30 additions and 11 deletions
|
@ -373,22 +373,30 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
||||||
|
|
||||||
public void addLocationListener(@NonNull OsmAndLocationListener listener) {
|
public void addLocationListener(@NonNull OsmAndLocationListener listener) {
|
||||||
if (!locationListeners.contains(listener)) {
|
if (!locationListeners.contains(listener)) {
|
||||||
locationListeners.add(listener);
|
List<OsmAndLocationListener> listeners = new ArrayList<>(locationListeners);
|
||||||
|
listeners.add(listener);
|
||||||
|
locationListeners = listeners;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLocationListener(@NonNull OsmAndLocationListener listener) {
|
public void removeLocationListener(@NonNull OsmAndLocationListener listener) {
|
||||||
locationListeners.remove(listener);
|
List<OsmAndLocationListener> listeners = new ArrayList<>(locationListeners);
|
||||||
|
listeners.remove(listener);
|
||||||
|
locationListeners = listeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCompassListener(@NonNull OsmAndCompassListener listener) {
|
public void addCompassListener(@NonNull OsmAndCompassListener listener) {
|
||||||
if (!compassListeners.contains(listener)) {
|
if (!compassListeners.contains(listener)) {
|
||||||
compassListeners.add(listener);
|
List<OsmAndCompassListener> listeners = new ArrayList<>(compassListeners);
|
||||||
|
listeners.add(listener);
|
||||||
|
compassListeners = listeners;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCompassListener(@NonNull OsmAndCompassListener listener) {
|
public void removeCompassListener(@NonNull OsmAndCompassListener listener) {
|
||||||
compassListeners.remove(listener);
|
List<OsmAndCompassListener> listeners = new ArrayList<>(compassListeners);
|
||||||
|
listeners.remove(listener);
|
||||||
|
compassListeners = listeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -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,11 +232,17 @@ class RouteRecalculationHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
void startProgress(final RouteCalculationParams params) {
|
void startProgress(final RouteCalculationParams params) {
|
||||||
if (params.calculationProgressCallback != null) {
|
app.runInUIThread(new Runnable() {
|
||||||
params.calculationProgressCallback.start();
|
|
||||||
} else if (progressRoute != null) {
|
@Override
|
||||||
progressRoute.start();
|
public void run() {
|
||||||
}
|
if (params.calculationProgressCallback != null) {
|
||||||
|
params.calculationProgressCallback.start();
|
||||||
|
} else if (progressRoute != null) {
|
||||||
|
progressRoute.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateProgress(final RouteCalculationParams params) {
|
void updateProgress(final RouteCalculationParams params) {
|
||||||
|
|
|
@ -237,7 +237,12 @@ 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) {
|
||||||
progressRoute.start();
|
app.runInUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
progressRoute.start();
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
setCurrentRoute(-1);
|
setCurrentRoute(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue