diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneContainerView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneContainerView.kt index 60cd41880b..24773287c9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneContainerView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneContainerView.kt @@ -40,8 +40,12 @@ class BoneContainerView @JvmOverloads constructor( } private fun initView() { - clBoneTab.loginOut { - logOut?.invoke() + clBoneTab.loginOut { //todo 判断没有logout caller出去 + if(logOut != null){ + logOut?.invoke() + }else{ + + } } } @@ -52,4 +56,14 @@ class BoneContainerView @JvmOverloads constructor( fun loginOut(logOut:(() -> Unit)){ this.logOut = logOut } + + override fun invokeCarMode(carModel: String?) { + super.invokeCarMode(carModel) + clBoneTab.setCarMode(carModel) + } + + override fun invokePlateNumber(plateNumber: String?) { + super.invokePlateNumber(plateNumber) + clBoneTab.setCarNo(plateNumber) + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt index 85667786fe..d72ae4626e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTabLayout.kt @@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI +import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.view_bone_tab.view.carInfoTabView import kotlinx.android.synthetic.main.view_bone_tab.view.msgBoxTabView import kotlinx.android.synthetic.main.view_bone_tab.view.tabSwitchCarInfo @@ -83,7 +84,7 @@ class BoneTabLayout @JvmOverloads constructor( } - fun setCarNo(carNo: String) { + fun setCarNo(carNo: String?) { carInfoTabView.setCarNo(carNo) } @@ -91,8 +92,14 @@ class BoneTabLayout @JvmOverloads constructor( carInfoTabView.setLoginInfo(loginNo) } + fun setCarMode(carModel: String?) { + carInfoTabView.setCarMode(carModel) + } + fun loginOut(logOut: (() -> Unit)) { - this.logOut = logOut + UiThreadHandler.post { + this.logOut = logOut + } } private fun updateTabType(changeType: TabType) { @@ -141,6 +148,8 @@ class BoneTabLayout @JvmOverloads constructor( override fun onUpdateTipEvent(isShow: Boolean) { super.onUpdateTipEvent(isShow) - tabSwitchMsgBox.updateNotice(isShow) + UiThreadHandler.post { + tabSwitchMsgBox.updateNotice(isShow) + } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/CarInfoTabView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/CarInfoTabView.kt index 63065996be..6733027530 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/CarInfoTabView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/tab/CarInfoTabView.kt @@ -27,6 +27,7 @@ import com.mogo.eagle.core.utilcode.util.AppUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.map.MogoData +import kotlinx.android.synthetic.main.view_car_info_tab.view.ivCarType import kotlinx.android.synthetic.main.view_car_info_tab.view.tvADMapVersion import kotlinx.android.synthetic.main.view_car_info_tab.view.tvADVersion import kotlinx.android.synthetic.main.view_car_info_tab.view.tvCarExit @@ -43,10 +44,6 @@ import system_master.SystemStatusInfo private fun String.parsePlateNo(): String { return substring(0, 2) + " " + substring(2) } -private fun String.parsePlateNoTel(): String { - return takeLast(6) -} - private fun String.parsePhoneNo(): String { return take(3) + "****" + takeLast(4) } @@ -56,7 +53,7 @@ class CarInfoTabView @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoCheckAutoPilotBtnListener, - IMoGoAutopilotStatusListener, IMoGoDevaToolsListener, IMoGoAutopilotCarConfigListener { + IMoGoAutopilotStatusListener, IMoGoDevaToolsListener { companion object { private const val TAG = "CarInfoTabView" @@ -77,7 +74,6 @@ class CarInfoTabView @JvmOverloads constructor( super.onAttachedToWindow() CallerHmiListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this) - CallerAutopilotCarConfigListenerManager.addListener(TAG, this) CallerDevaToolsListenerManager.addListener(TAG, this) } @@ -94,12 +90,6 @@ class CarInfoTabView @JvmOverloads constructor( updateAdHdMapVersion() tvSnInfo.text = SharedPrefsMgr.getInstance().sn - - if (AppConfigInfo.plateNumber.isNotEmpty()) { - val plateNo = AppConfigInfo.plateNumber - tvCarNo.text = plateNo.parsePlateNo() - } - tvCarExit.setOnClickListener { loginOut?.invoke() } @@ -152,36 +142,46 @@ class CarInfoTabView @JvmOverloads constructor( } fun setLoginInfo(loginNo: String) { - if (loginNo.isNotEmpty()) { - tvCarLoginInfo.text = loginNo.parsePhoneNo() - } else { - tvCarLoginInfo.text = "" + UiThreadHandler.post { + if (loginNo.isNotEmpty()) { + tvCarLoginInfo.text = loginNo.parsePhoneNo() + } else { + tvCarLoginInfo.text = "" + } } } - fun setCarNo(carNo: String) { - // 监听工控的车牌信息,防止调试跳过无车牌内容(链接先后顺序不一致也会导致数据显示异常) - if (carNo.isNotEmpty()) { - if (tvCarNo.text.isNotEmpty() && tvCarNo.text == carNo) { - CallerLogger.i("$M_HMI$TAG", "已存在车牌号") - return + fun setCarNo(carNo: String?) { + UiThreadHandler.post { + // 监听工控的车牌信息,防止调试跳过无车牌内容(链接先后顺序不一致也会导致数据显示异常) + if (!carNo.isNullOrEmpty()) { + if (tvCarNo.text.isNotEmpty() && tvCarNo.text == carNo) { + CallerLogger.i("$M_HMI$TAG", "已存在车牌号") + return@post + } + tvCarNo.visibility = VISIBLE + tvCarNo.text = carNo.parsePlateNo() + } else { + tvCarNo.visibility = GONE + tvCarNo.text = "" } - tvCarNo.visibility = VISIBLE - tvCarNo.text = carNo.parsePlateNo() - } else { - tvCarNo.visibility = GONE - tvCarNo.text = "" } } - override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) { - super.onAutopilotCarConfig(carConfigResp) - carConfigResp.plateNumber?.let { - if (tvCarNo.text.isNotEmpty() && tvCarNo.text == it) { - return + fun setCarMode(carModel:String?){ + UiThreadHandler.post { + if(carModel.isNullOrEmpty()){ + ivCarType.visibility = GONE + }else{ + ivCarType.visibility = VISIBLE + when(carModel){ + "b1" -> ivCarType.setImageResource(R.drawable.icon_car_b1) + "b2" -> ivCarType.setImageResource(R.drawable.icon_car_b2) + "t1" -> ivCarType.setImageResource(R.drawable.icon_car_t1) + "t2" -> ivCarType.setImageResource(R.drawable.icon_car_t2) + "m1" -> ivCarType.setImageResource(R.drawable.icon_car_m1) + } } - tvCarNo.visibility = VISIBLE - tvCarNo.text = it.parsePlateNoTel() } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_car_info_tab.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_car_info_tab.xml index 3572ed5548..a3c62d38da 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_car_info_tab.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_car_info_tab.xml @@ -43,6 +43,7 @@ android:id="@+id/ivCarType" android:layout_width="match_parent" android:layout_height="@dimen/dp_280" + android:scaleType="fitXY" app:layout_constraintTop_toTopOf="parent" tools:ignore="ContentDescription" /> @@ -97,7 +98,7 @@