From a306705cb71f5f94d0296fb7938e47211667bfbe Mon Sep 17 00:00:00 2001 From: aibingbing Date: Thu, 11 Jul 2024 11:55:41 +0800 Subject: [PATCH] =?UTF-8?q?[6.5.0]refactor:=20=E9=80=9A=E8=BF=87=E5=85=AC?= =?UTF-8?q?=E4=BA=A4=E7=AB=99=E4=BC=98=E5=8C=96=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busstation/PassBusStationEventManager.kt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) 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") }