diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt index 5aa3369d3d..9af681efb7 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/PassBusStationEventManager.kt @@ -112,12 +112,12 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { val currentLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() busStationListNeedNotified.values.forEach { -// val distance = CoordinateUtils.calculateLineDistance( -// currentLocation.longitude, -// currentLocation.latitude, -// it.getBusStationPoint().longitude, -// it.getBusStationPoint().latitude, -// ).toInt() + val distance = CoordinateUtils.calculateLineDistance( + currentLocation.longitude, + currentLocation.latitude, + it.getBusStationPoint().longitude, + it.getBusStationPoint().latitude, + ).toInt() val angle = DrivingDirectionUtils.getDegreeOfCar2Poi( currentLocation.longitude, currentLocation.latitude, @@ -125,7 +125,7 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { it.getBusStationPoint().latitude, currentLocation.heading.toInt() ) - if (angle >= 90) { + if (angle >= 90 || distance >= 150) { CallerRoadV2NEventWindowListenerManager.dismiss(it.getBusStationId()) busStationListNeedNotified.remove(it.getBusStationId()) trackEvent("dismiss --> busStationId=${it.getBusStationId()}") @@ -213,18 +213,20 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener { fun init() { CallerChassisLocationWGS84ListenerManager.addListener(TAG, 1, this) - handler?.post(checkDistanceRunnable) + handler.removeCallbacks(checkDistanceRunnable) + handler.removeCallbacks(notificationCheckRunnable) + handler.post(checkDistanceRunnable) trackEvent("init") } fun unInit() { CallerChassisLocationWGS84ListenerManager.removeListener(TAG) mCoroutineScope?.cancel() - busStationNearByQueue?.clear() - busStationListNeedNotified?.clear() - handler?.removeCallbacks(checkDistanceRunnable) - handler?.removeCallbacks(notificationCheckRunnable) - handler?.looper?.quit() + busStationNearByQueue.clear() + busStationListNeedNotified.clear() + handler.removeCallbacks(checkDistanceRunnable) + handler.removeCallbacks(notificationCheckRunnable) + handler.looper?.quit() trackEvent("unInit") }