fix ui bug and add log

This commit is contained in:
zhongchao
2021-11-10 20:05:30 +08:00
parent 7e306c6715
commit 624abbe706
7 changed files with 40 additions and 17 deletions

View File

@@ -55,7 +55,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
override fun vipIdentification(visible: Boolean) {
flVipIdentificationView.visibility = if (visible) View.VISIBLE else View.GONE
ThreadUtils.runOnUiThread {
Logger.d(TAG, "vipIdentification")
if (visible) {
flVipIdentificationView.visibility = View.VISIBLE
} else {
flVipIdentificationView.visibility = View.GONE
}
}
}
override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? {

View File

@@ -29,8 +29,9 @@
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:layout_marginLeft="@dimen/module_vip_margin_left"
app:layout_constraintLeft_toRightOf="@+id/flSpeedChartView"
app:layout_constraintTop_toTopOf="@+id/flSpeedChartView" />
android:visibility="gone"
app:layout_constraintLeft_toRightOf="@+id/viewSpeedChart"
app:layout_constraintTop_toTopOf="@+id/viewSpeedChart" />
<com.mogo.eagle.core.function.hmi.ui.widget.AutoPilotStatusView
android:id="@+id/viewAutopilotStatus"
@@ -97,11 +98,10 @@
android:id="@+id/ivCameraIcon"
android:layout_width="130px"
android:layout_height="130px"
app:layout_constraintEnd_toStartOf="@id/viewTrafficLightVr"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="38px"
android:layout_marginEnd="30px"
android:background="@drawable/icon_camera_nor"
tools:visibility="visible"
/>
app:layout_constraintEnd_toStartOf="@id/viewTrafficLightVr"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -11,7 +11,6 @@
android:layout_height="@dimen/dp_104"
android:scaleType="fitXY"
android:src="@drawable/v2x_vip_identification_vr"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.core.utilcode.util.SPUtils
import com.mogo.map.navi.IMogoCarLocationChangedListener2
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.enums.EventTypeEnum
@@ -37,9 +38,23 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
fun initServer(context: Context) {
mContext = context
MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
MogoApisHandler.getInstance().apis.getSocketManagerApi(context)
MogoApisHandler.getInstance()
.apis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
MogoApisHandler.getInstance()
.apis.getSocketManagerApi(context)
.registerOnMessageListener(401025, this)
val vipSetTime = SPUtils.getInstance().getLong("vip")
if (vipSetTime == -1L) {
return
}
//todo 后续改成接口调用查询,防止清除缓存造成状态不统一
if (vipSetTime > 0 && System.currentTimeMillis() - vipSetTime < 0) { //未超时需要设置VIP
CallerHmiManager.vipIdentification(true)
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
} else {
SPUtils.getInstance().remove("vip") //超时
}
}
override fun target(): Class<VipMessage> {
@@ -47,13 +62,16 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
}
override fun onMsgReceived(vipMessage: VipMessage?) {
Logger.d(TAG, "onMsgReceived vipMessage : ${vipMessage.toString()}")
vipMessage?.let {
when (it.vipType) {
0 -> {
0 -> { //取消VIP
SPUtils.getInstance().remove("vip")
CallerHmiManager.vipIdentification(false)
CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
}
1 -> {
1 -> { //设置VIP
SPUtils.getInstance().put("vip", vipMessage.timeOut)
CallerHmiManager.vipIdentification(true)
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
}
@@ -67,7 +85,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
//如果上次结果和本次灯态结果变化比较大则已变灯控制HMI展示弹窗
if ((result!!.laneList.mid.remain - trafficLightResult.laneList.mid.remain) > 3) {
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(),
"",
EventTypeEnum.TYPE_VIP_IDENTIFICATION.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType,
object : IMoGoWarningStatusListener {

View File

@@ -6,5 +6,5 @@ package com.mogo.eagle.core.data.v2x
* vipType: Vip --1 变成VIP--0 撤销VIP
* content: VIP消息
*/
class VipMessage(val timeOut: Long, val vipType: Int, val content: String) {
data class VipMessage(val timeOut: Long, val vipType: Int, val content: String) {
}