[Add function]重构了当前位置获取的监听方式;

// 订阅监听
 CallerMapLocationListenerManager.addListener(TAG, IMoGoMapLocationListener)

 // 主动查询
 CallerMapLocationListenerManager.INSTANCE.getCurrentLocation()

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-09 20:41:21 +08:00
parent cde1338251
commit d915d60a7d
15 changed files with 146 additions and 37 deletions

View File

@@ -14,17 +14,21 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -46,7 +50,7 @@ class DebugSettingView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener {
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
private val TAG = "DebugSettingView"
@@ -60,6 +64,7 @@ class DebugSettingView @JvmOverloads constructor(
CallerObuListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerMapLocationListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
@@ -67,6 +72,7 @@ class DebugSettingView @JvmOverloads constructor(
CallerObuListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerMapLocationListenerManager.removeListener(TAG)
}
private fun initView() {
@@ -239,4 +245,8 @@ class DebugSettingView @JvmOverloads constructor(
}
override fun onLocationChanged(location: MogoLocation?) {
Logger.d(TAG, "location:$location")
}
}