[2.15.0]fix bug of roma which click has no react and multi obj problem
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.TypedArray
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMoGoRomaListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager.romaTrigger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
@@ -15,7 +16,7 @@ class RomaPassengerView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IReceivedMsgListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IReceivedMsgListener, IMoGoRomaListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RomaPassengerView"
|
||||
@@ -29,9 +30,10 @@ class RomaPassengerView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_roma_passenger_bg, this, true)
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.RomaPassengerView, defStyleAttr, 0)
|
||||
openRes = a.getResourceId(R.styleable.RomaPassengerView_roma_open,0)
|
||||
normalRes = a.getResourceId(R.styleable.RomaPassengerView_roma_close,0)
|
||||
val a =
|
||||
context.obtainStyledAttributes(attrs, R.styleable.RomaPassengerView, defStyleAttr, 0)
|
||||
openRes = a.getResourceId(R.styleable.RomaPassengerView_roma_open, 0)
|
||||
normalRes = a.getResourceId(R.styleable.RomaPassengerView_roma_close, 0)
|
||||
a.recycle()
|
||||
setOnClickListener {
|
||||
romaMode = !romaMode
|
||||
@@ -42,6 +44,7 @@ class RomaPassengerView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTelematicListenerManager.addListener(TAG, this)
|
||||
CallerMapRomaListener.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
@@ -49,25 +52,34 @@ class RomaPassengerView @JvmOverloads constructor(
|
||||
TelematicConstant.OPEN_ROMA_STATUS -> {
|
||||
when (String(byteArray)) {
|
||||
"0" -> {
|
||||
romaMode = true
|
||||
if(openRes != 0){
|
||||
setBackgroundResource(openRes)
|
||||
}
|
||||
romaStatus(true)
|
||||
}
|
||||
"1" -> {
|
||||
romaMode = false
|
||||
if(normalRes != 0){
|
||||
setBackgroundResource(normalRes)
|
||||
}
|
||||
romaStatus(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun romaStatus(status: Boolean) {
|
||||
if (status) {
|
||||
romaMode = true
|
||||
if (openRes != 0) {
|
||||
setBackgroundResource(openRes)
|
||||
}
|
||||
} else {
|
||||
romaMode = false
|
||||
if (normalRes != 0) {
|
||||
setBackgroundResource(normalRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
CallerMapRomaListener.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMogoRoma
|
||||
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
|
||||
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.aiCloudIdentifyDataManager
|
||||
@@ -12,7 +13,7 @@ import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_MAP_BIZ)
|
||||
class MapBizProvider :IMoGoFunctionServerProvider{
|
||||
class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
|
||||
|
||||
override val functionName: String
|
||||
get() = "MapBizProvider"
|
||||
@@ -25,6 +26,10 @@ class MapBizProvider :IMoGoFunctionServerProvider{
|
||||
aiCloudIdentifyDataManager.initServer(AbsMogoApplication.getApp())
|
||||
}
|
||||
|
||||
override fun trigger(romaStatus: Boolean) {
|
||||
aiCloudIdentifyDataManager.trigger(romaStatus)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
package com.mogo.eagle.core.function.business.ai
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import android.util.Log
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMogoRoma
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.business.ai.net.AiCloudIdentifyNetWorkModel.Companion.aiCloudIdentifyNetWorkModel
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.updateLongSightLevel
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
@@ -31,9 +30,9 @@ import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_ROMA)
|
||||
class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogoRoma,
|
||||
class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener,
|
||||
IMoGoPlanningRottingListener, IMoGoAutopilotStatusListener {
|
||||
|
||||
companion object {
|
||||
@@ -48,13 +47,9 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogo
|
||||
}
|
||||
}
|
||||
|
||||
private var showAiCloud = false
|
||||
private var showAiCloud = AtomicBoolean(false)
|
||||
private var serverSn = ""
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
}
|
||||
|
||||
fun initServer(mContext: Context) {
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
|
||||
@@ -79,7 +74,7 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogo
|
||||
override fun onMsgReceived(obj: SocketDownData.SocketDownDataProto?) {
|
||||
obj?.let {
|
||||
obj.data?.let {
|
||||
if (showAiCloud) {
|
||||
if (showAiCloud.get()) {
|
||||
if (it.allListList == null || it.allListList.size == 0) {
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
return
|
||||
@@ -93,7 +88,7 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogo
|
||||
}
|
||||
}
|
||||
|
||||
override fun trigger(romaStatus: Boolean) {
|
||||
fun trigger(romaStatus: Boolean) {
|
||||
MapBizTrace.log(TAG, "trigger")
|
||||
// 乘客屏单独控制漫游
|
||||
if (romaStatus) {
|
||||
@@ -143,6 +138,10 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogo
|
||||
return
|
||||
}
|
||||
}
|
||||
if (!showAiCloud.get()) {
|
||||
Log.d("emArrow", "closeRoma,showAiCloud is false, return ")
|
||||
return
|
||||
}
|
||||
requestRangeOfIdentify(false)
|
||||
updateLongSightLevel(false)
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma()
|
||||
@@ -154,6 +153,15 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogo
|
||||
}
|
||||
|
||||
fun requestRangeOfIdentify(dataReceive: Boolean) {
|
||||
// if (dataReceive) { //todo test
|
||||
// // 请求地图开始漫游
|
||||
// MogoMapUIController.getInstance().setRomaMode(FunctionBuildConfig.romaModeStyle)
|
||||
// CallerMapRomaListener.invokeMapRoma(true)
|
||||
// sendMsgToServer(TelematicConstant.OPEN_ROMA_STATUS, "3".toByteArray())
|
||||
// } else {
|
||||
// CallerMapRomaListener.invokeMapRoma(false)
|
||||
// sendMsgToServer(TelematicConstant.OPEN_ROMA_STATUS, "4".toByteArray())
|
||||
// }
|
||||
aiCloudIdentifyNetWorkModel.requestIdentifyRange(dataReceive, serverSn, {
|
||||
MapBizTrace.log(
|
||||
TAG,
|
||||
@@ -171,23 +179,25 @@ class AiCloudIdentifyDataManager : IMogoMapListener, IReceivedMsgListener, IMogo
|
||||
TAG,
|
||||
"requestIdentifyRange error : $it , startRange:$START_METRE, endRange:$END_METRE, dataReceive:$dataReceive"
|
||||
)
|
||||
updateLongSightLevel(false)
|
||||
})
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode) {
|
||||
super.onMapVisualAngleChanged(visualAngleMode)
|
||||
Log.d("emArrow", "onMapVisualAngleChanged , thread : ${Thread.currentThread().name}")
|
||||
when {
|
||||
// 解除漫游限制
|
||||
visualAngleMode.isRoma -> {
|
||||
showAiCloud = true
|
||||
showAiCloud.set(true)
|
||||
Log.d("emArrow", "map call back roma , showAiCloud : ${showAiCloud.get()}")
|
||||
FunctionBuildConfig.isDrawIdentifyData = false
|
||||
}
|
||||
else -> {
|
||||
if (showAiCloud) {
|
||||
showAiCloud = false
|
||||
FunctionBuildConfig.isDrawIdentifyData = true
|
||||
if (showAiCloud.get()) {
|
||||
closeRoma(false)
|
||||
Log.d("emArrow", "解除漫游限制")
|
||||
showAiCloud.set(false)
|
||||
FunctionBuildConfig.isDrawIdentifyData = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,4 @@ public class MogoServicePaths {
|
||||
@Keep
|
||||
public static final String PATH_UPGRADE_TYPE_API = "/upgrade/type/api";
|
||||
|
||||
@Keep
|
||||
public static final String PATH_ROMA = "/map/roma";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.eagle.core.function.api.map.roma
|
||||
|
||||
interface IMoGoRomaListener {
|
||||
|
||||
/**
|
||||
* 漫游状态回调
|
||||
*/
|
||||
fun romaStatus(status:Boolean)
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_ROMA
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMogoRoma
|
||||
|
||||
object CallerMapIdentifyManager {
|
||||
|
||||
private val romaApi:IMogoRoma
|
||||
get() = ARouter.getInstance().build(PATH_ROMA)
|
||||
get() = ARouter.getInstance().build( MogoServicePaths.PATH_MAP_BIZ)
|
||||
.navigation() as IMogoRoma
|
||||
|
||||
fun romaTrigger(romaStatus:Boolean){
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMoGoRomaListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallerMapRomaListener : CallerBase<IMoGoRomaListener>() {
|
||||
|
||||
private var roma = false
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoRomaListener) {
|
||||
listener.romaStatus(roma)
|
||||
}
|
||||
|
||||
fun invokeMapRoma(romaStatus: Boolean) {
|
||||
roma = romaStatus
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.romaStatus(romaStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user