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

3
.idea/misc.xml generated
View File

@@ -16,13 +16,12 @@
<entry key="OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml" value="0.1010068539349746" /> <entry key="OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml" value="0.1010068539349746" />
<entry key="OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml" value="0.19479166666666667" /> <entry key="OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml" value="0.19479166666666667" />
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.1953125" /> <entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.1953125" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="1.0729233277594363" /> <entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="0.1" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.18996305418719212" /> <entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="0.18996305418719212" /> <entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_status.xml" value="0.18996305418719212" /> <entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_status.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.18996305418719212" /> <entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_vip_identification.xml" value="0.45" /> <entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_vip_identification.xml" value="0.45" />
<entry key="core/function-impl/mogo-core-function-map/src/main/res/layout/function_map_fragment_hd_map.xml" value="0.29322916666666665" />
<entry key="foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast.xml" value="0.3117283950617284" /> <entry key="foudations/mogo-commons/src/main/res/layout/module_commons_layout_toast.xml" value="0.3117283950617284" />
<entry key="modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml" value="0.273046875" /> <entry key="modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml" value="0.273046875" />
<entry key="modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml" value="0.231875" /> <entry key="modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml" value="0.231875" />

View File

@@ -55,7 +55,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
} }
override fun vipIdentification(visible: Boolean) { 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? { override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? {

View File

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

View File

@@ -11,7 +11,6 @@
android:layout_height="@dimen/dp_104" android:layout_height="@dimen/dp_104"
android:scaleType="fitXY" android:scaleType="fitXY"
android:src="@drawable/v2x_vip_identification_vr" android:src="@drawable/v2x_vip_identification_vr"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="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.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager 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.map.navi.IMogoCarLocationChangedListener2
import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.enums.EventTypeEnum import com.mogo.module.common.enums.EventTypeEnum
@@ -37,9 +38,23 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
fun initServer(context: Context) { fun initServer(context: Context) {
mContext = context mContext = context
MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener(TAG, this) MogoApisHandler.getInstance()
MogoApisHandler.getInstance().apis.getSocketManagerApi(context) .apis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
MogoApisHandler.getInstance()
.apis.getSocketManagerApi(context)
.registerOnMessageListener(401025, this) .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> { override fun target(): Class<VipMessage> {
@@ -47,13 +62,16 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
} }
override fun onMsgReceived(vipMessage: VipMessage?) { override fun onMsgReceived(vipMessage: VipMessage?) {
Logger.d(TAG, "onMsgReceived vipMessage : ${vipMessage.toString()}")
vipMessage?.let { vipMessage?.let {
when (it.vipType) { when (it.vipType) {
0 -> { 0 -> { //取消VIP
SPUtils.getInstance().remove("vip")
CallerHmiManager.vipIdentification(false) CallerHmiManager.vipIdentification(false)
CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
} }
1 -> { 1 -> { //设置VIP
SPUtils.getInstance().put("vip", vipMessage.timeOut)
CallerHmiManager.vipIdentification(true) CallerHmiManager.vipIdentification(true)
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this) CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
} }
@@ -67,7 +85,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
//如果上次结果和本次灯态结果变化比较大则已变灯控制HMI展示弹窗 //如果上次结果和本次灯态结果变化比较大则已变灯控制HMI展示弹窗
if ((result!!.laneList.mid.remain - trafficLightResult.laneList.mid.remain) > 3) { if ((result!!.laneList.mid.remain - trafficLightResult.laneList.mid.remain) > 3) {
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(), CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(),
"", EventTypeEnum.TYPE_VIP_IDENTIFICATION.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType,
object : IMoGoWarningStatusListener { object : IMoGoWarningStatusListener {

View File

@@ -6,5 +6,5 @@ package com.mogo.eagle.core.data.v2x
* vipType: Vip --1 变成VIP--0 撤销VIP * vipType: Vip --1 变成VIP--0 撤销VIP
* content: 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) {
} }

View File

@@ -176,7 +176,7 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem
if (listeners != null && !listeners.isEmpty()) { if (listeners != null && !listeners.isEmpty()) {
for (IMogoOnMessageListener listener : listeners) { for (IMogoOnMessageListener listener : listeners) {
if (listener != null) { if (listener != null) {
Logger.d(TAG, "received msgId = %s, content = %s", mAckListeners.get(msgType), obj); Logger.d(TAG, "received msgId = %s, content = %s", mAckListeners.get(msgType), obj.toString());
listener.onMsgReceived(obj); listener.onMsgReceived(obj);
} }
} }