修复 模块加载 类型转换异常

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-15 18:57:07 +08:00
parent 0e119f8f55
commit da955835a2
35 changed files with 321 additions and 219 deletions

View File

@@ -0,0 +1,77 @@
package com.mogo.eagle.core.function.call.map
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapStyleChangeListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.LogUtils
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 地图 监听管理
*/
object CallerMapListenerManager : CallerBase() {
private val TAG = "CallerMapListenerManager"
// 记录地图样式
private var mMapStyleMode = 0
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mMapStyleChangeListeners: HashMap<String, IMoGoMapStyleChangeListener> = HashMap()
/**
* 添加 地图样式改变 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addMapStyleChangeListener(
@Nullable tag: String,
@Nullable listener: IMoGoMapStyleChangeListener
) {
mMapStyleChangeListeners[tag] = listener
listener.onMapStyleModeChange(mMapStyleMode)
}
/**
* 删除 地图样式改变 监听
* @param tag 标记,用来注销监听使用
*/
fun removeMapStyleChangeListener(@Nullable tag: String) {
mMapStyleChangeListeners.remove(tag)
}
/**
* 删除 地图样式改变 监听
* @param listener 要删除的监听对象
*/
fun removeMapStyleChangeListener(@Nullable listener: IMoGoMapStyleChangeListener) {
mMapStyleChangeListeners.forEach {
if (it.value == listener) {
mMapStyleChangeListeners.remove(it.key)
}
}
}
/**
* 触发 地图样式改变 监听
*/
fun invokeMapStyleChangeListener() {
invokeMapStyleChangeListener(mMapStyleMode)
}
/**
* 触发 地图样式改变 监听
* @param mapStyleMode 选中状态
*/
fun invokeMapStyleChangeListener(mapStyleMode: Int) {
LogUtils.dTag(TAG, "mapStyleMode:$mapStyleMode")
mMapStyleMode = mapStyleMode
mMapStyleChangeListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onMapStyleModeChange(mMapStyleMode)
}
}
}

View File

@@ -22,21 +22,21 @@ object CallerObuListenerManager : CallerBase() {
private val mObuStatusListeners: HashMap<String, IMoGoObuStatusListener> = HashMap()
/**
* 查询OBU状态
* 查询 OBU状态
*/
fun getObuStatusInfo(): ObuStatusInfo {
return mObuStatusInfo
}
/**
* 查询OBU状态
* 查询 OBU状态
*/
fun getObuStatusInfoJsonString(): String {
return GsonUtils.toJson(mObuStatusInfo)
}
/**
* 添加自动驾驶按钮选中监听
* 添加 OBU状态 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
@@ -49,7 +49,7 @@ object CallerObuListenerManager : CallerBase() {
}
/**
* 删除 监听
* 删除 OBU状态 监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
@@ -57,7 +57,7 @@ object CallerObuListenerManager : CallerBase() {
}
/**
* 删除自动驾驶按钮选中监听
* 删除 OBU状态 监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoObuStatusListener) {
@@ -69,19 +69,18 @@ object CallerObuListenerManager : CallerBase() {
}
/**
* 触发自动驾驶按钮选中监听
* 触发 OBU状态 监听
*/
fun invokeListener() {
LogUtils.dTag(TAG, "isChecked:$mObuStatusInfo")
invokeListener(mObuStatusInfo)
}
/**
* 触发自动驾驶按钮选中监听
* 触发 OBU状态 监听
* @param obuStatusInfo 选中状态
*/
fun invokeListener(obuStatusInfo: ObuStatusInfo) {
LogUtils.dTag(TAG, "isChecked:$obuStatusInfo")
LogUtils.dTag(TAG, "obuStatusInfo:$obuStatusInfo")
mObuStatusInfo = obuStatusInfo
mObuStatusListeners.forEach {
val tag = it.key