[3.3.0] fix SpeedLimit call back in main thread

This commit is contained in:
zhongchao
2023-06-27 16:03:51 +08:00
parent 47d900dd78
commit c5c330821f

View File

@@ -4,13 +4,10 @@ import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import java.util.Objects;
import java.util.Timer;
@@ -58,11 +55,9 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationWGS84Listener
private void getSpeedLimit() {
int speedLimit = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMapUIController()).getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
UiThreadHandler.post(() -> {
if (speedLimit > 0) {
CallerLimitingVelocityListenerManager.INSTANCE.invokeUnion(speedLimit, DataSourceType.MAP);
}
});
if (speedLimit > 0) {
CallerLimitingVelocityListenerManager.INSTANCE.invokeUnion(speedLimit, DataSourceType.MAP);
}
}
}