@@ -0,0 +1,56 @@
|
||||
package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/23 10:22 上午
|
||||
* HMI 视图上的监听管理
|
||||
*/
|
||||
object CallerHmiListenerManager : CallerBase() {
|
||||
|
||||
private val TAG = "CallerHmiListenerManager"
|
||||
|
||||
private val checkAutoPilotBtnListeners: HashMap<String, IMoGoCheckAutoPilotBtnListener> =
|
||||
HashMap()
|
||||
|
||||
|
||||
/**
|
||||
* 添加自动驾驶按钮选中监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addCheckAutoPilotBtnListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoCheckAutoPilotBtnListener
|
||||
) {
|
||||
checkAutoPilotBtnListeners[tag] = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动驾驶按钮选中监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
|
||||
checkAutoPilotBtnListeners.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发自动驾驶按钮选中监听
|
||||
* @param isChecked 选中状态
|
||||
*/
|
||||
fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) {
|
||||
LogUtils.dTag(TAG, "isChecked:$isChecked")
|
||||
checkAutoPilotBtnListeners.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onCheck(isChecked)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
Reference in New Issue
Block a user