diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/b2/com/mogo/och/shuttle/weaknet/passenger/ui/statusbar/M2StatusBarView.kt b/OCH/shuttle/passenger_weaknet/src/main/java/b2/com/mogo/och/shuttle/weaknet/passenger/ui/statusbar/M2StatusBarView.kt
index 2cb5390f56..730b8dfdad 100644
--- a/OCH/shuttle/passenger_weaknet/src/main/java/b2/com/mogo/och/shuttle/weaknet/passenger/ui/statusbar/M2StatusBarView.kt
+++ b/OCH/shuttle/passenger_weaknet/src/main/java/b2/com/mogo/och/shuttle/weaknet/passenger/ui/statusbar/M2StatusBarView.kt
@@ -1,20 +1,24 @@
package com.mogo.och.shuttle.weaknet.passenger.ui.statusbar
-import android.annotation.*
+import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.ChassisStatesOuterClass
+import com.mogo.commons.constants.SharedPrefsConstants
+import com.mogo.commons.storage.SharedPrefsMgr
+import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
+import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
-import com.mogo.eagle.core.utilcode.kotlin.*
+import com.mogo.eagle.core.utilcode.kotlin.onClick
+import com.mogo.eagle.core.utilcode.kotlin.scope
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
-import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.manager.bluetooth.BleManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.ResourcesUtils
@@ -22,10 +26,14 @@ import com.mogo.och.shuttle.weaknet.passenger.R
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.iv_logon
+import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.iv_zhuhai_logo
+import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.iv_zhuhai_logo_other
+import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.layout_zhuhai_logo
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.tv_power_cos
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.tv_status_line_name
-import kotlinx.coroutines.*
+import kotlinx.coroutines.launch
import me.jessyan.autosize.utils.AutoSizeUtils
+import mogo.telematics.pad.MessagePad
/**
* @author: wangmingjun
@@ -34,7 +42,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils
class M2StatusBarView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs),
- IMoGoChassisStatesListener, ICommonCallback {
+ IMoGoChassisStatesListener, ICommonCallback, IMoGoAutopilotCarConfigListener {
companion object {
const val TAG = "M2StatusBarView"
@@ -43,9 +51,15 @@ class M2StatusBarView @JvmOverloads constructor(
@Volatile
private var oldBmsSoc: Float = -1.0f
+ @Volatile
+ private var isHaveTask = false
+
init {
LayoutInflater.from(context).inflate(R.layout.shuttle_p_m2_view_status_bar, this, true)
setBackgroundColor(ResourcesUtils.getColor(R.color.white))
+ if (isZhuhai()) {
+ showZhuhaiLogo()
+ }
isClickable = true
isFocusable = true
iv_logon.setOnLongClickListener {
@@ -54,8 +68,65 @@ class M2StatusBarView @JvmOverloads constructor(
}
true
}
+ iv_zhuhai_logo.setOnLongClickListener {
+ context?.let {
+ ToggleDebugView.toggleDebugView.toggle(it)
+ }
+ true
+ }
}
+ private fun showLogo() {
+ layout_zhuhai_logo.visibility = GONE
+ iv_logon.visibility = VISIBLE
+ updateLogoState()
+ }
+ private fun updateLogoState(){
+ if (!isHaveTask) {
+ tv_status_line_name.setText(R.string.m2_line_name_detaile)
+ }
+ }
+
+ private fun showZhuhaiLogo() {
+ iv_logon.visibility = GONE
+ layout_zhuhai_logo.visibility = VISIBLE
+ updateZhuhaiLogoState()
+ }
+
+ private fun updateZhuhaiLogoState(){
+ val zhuhaiLogoParams = iv_zhuhai_logo.layoutParams
+ val zhuhaiLogoOtherParams = iv_zhuhai_logo_other.layoutParams
+ var logonId = R.dimen.dp_201
+ var logonOtherId = R.dimen.dp_274
+ var logonImgId = R.drawable.shuttle_p_m2_status_bar_logo_zhuhai_mogox
+ var logonOtherImgId = R.drawable.shuttle_p_m2_status_bar_logo_zhuhai_noma_autonoma
+ if (isHaveTask) {
+ logonId = R.dimen.dp_62
+ logonOtherId = R.dimen.dp_98
+ logonImgId = R.drawable.shuttle_p_m2_status_bar_logo_zhuhai
+ logonOtherImgId = R.drawable.shuttle_p_m2_status_bar_logo_zhuhai_noma
+ } else {
+ tv_status_line_name.text = ""
+ }
+ zhuhaiLogoParams.width = resources.getDimensionPixelSize(logonId)
+ iv_zhuhai_logo.layoutParams = zhuhaiLogoParams
+ zhuhaiLogoOtherParams.width = resources.getDimensionPixelSize(logonOtherId)
+ iv_zhuhai_logo_other.layoutParams = zhuhaiLogoOtherParams
+ iv_zhuhai_logo.setImageResource(logonImgId)
+ iv_zhuhai_logo_other.setImageResource(logonOtherImgId)
+ }
+
+ override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
+ super.onAutopilotCarConfig(carConfigResp)
+ BizLoopManager.runInMainThread {
+ CallerLogger.d(TAG, "城市-------${carConfigResp.cityCode}")
+ if (isZhuhai(carConfigResp.cityCode)) {
+ showZhuhaiLogo()
+ } else {
+ showLogo()
+ }
+ }
+ }
@SuppressLint("ClickableViewAccessibility")
override fun onAttachedToWindow() {
@@ -71,6 +142,7 @@ class M2StatusBarView @JvmOverloads constructor(
//电量
CallerChassisStatesListenerManager.addListener(TAG,this)
+ CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CommonModel.setRouteLineInfoCallback(TAG,this)
tv_power_cos?.also {
@@ -88,10 +160,18 @@ class M2StatusBarView @JvmOverloads constructor(
override fun updateLineInfo(lineName: String?) {
post {
CallerLogger.d(TAG,"updateLineInfo2-------${lineName}----${this}")
- if(lineName==null){
- tv_status_line_name.setText(R.string.m2_line_name_detaile)
- }else{
+ isHaveTask = lineName != null
+ if (isHaveTask) {
+ if (isZhuhai()) {
+ updateZhuhaiLogoState()
+ }
tv_status_line_name.text = lineName
+ } else {
+ if (isZhuhai()) {
+ updateZhuhaiLogoState()
+ } else {
+ tv_status_line_name.setText(R.string.m2_line_name_detaile)
+ }
}
}
}
@@ -100,7 +180,12 @@ class M2StatusBarView @JvmOverloads constructor(
BizLoopManager.runInMainThread {
CallerLogger.d(TAG,"updateLineInfo1-------${isTrue}----${this}")
if(isTrue) {
- tv_status_line_name.setText(R.string.m2_line_name_detaile)
+ isHaveTask = false
+ if (isZhuhai()) {
+ updateZhuhaiLogoState()
+ } else {
+ tv_status_line_name.setText(R.string.m2_line_name_detaile)
+ }
}
}
}
@@ -108,6 +193,7 @@ class M2StatusBarView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisStatesListenerManager.removeListener(TAG)
+ CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CommonModel.setRouteLineInfoCallback(TAG,null)
}
@@ -134,4 +220,9 @@ class M2StatusBarView @JvmOverloads constructor(
}
},ThreadUtils.MODE.QUEUE)
}
+
+ private fun isZhuhai(cityCode: String? = SharedPrefsMgr.getInstance().getString(SharedPrefsConstants.CMDB_CITY_CODE, "")): Boolean {
+ if (cityCode.isNullOrEmpty()) return false
+ return cityCode.contains("珠海")
+ }
}
\ No newline at end of file
diff --git a/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai.webp b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai.webp
new file mode 100644
index 0000000000..eb60919ced
Binary files /dev/null and b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai.webp differ
diff --git a/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_mogox.webp b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_mogox.webp
new file mode 100644
index 0000000000..cac3eec7de
Binary files /dev/null and b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_mogox.webp differ
diff --git a/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_noma.webp b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_noma.webp
new file mode 100644
index 0000000000..5b975e4a7f
Binary files /dev/null and b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_noma.webp differ
diff --git a/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_noma_autonoma.webp b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_noma_autonoma.webp
new file mode 100644
index 0000000000..701b47fb4d
Binary files /dev/null and b/OCH/shuttle/passenger_weaknet/src/main/res/b2/drawable-nodpi/shuttle_p_m2_status_bar_logo_zhuhai_noma_autonoma.webp differ
diff --git a/OCH/shuttle/passenger_weaknet/src/main/res/b2/layout/shuttle_p_m2_view_status_bar.xml b/OCH/shuttle/passenger_weaknet/src/main/res/b2/layout/shuttle_p_m2_view_status_bar.xml
index 8b4635775a..53635c8749 100644
--- a/OCH/shuttle/passenger_weaknet/src/main/res/b2/layout/shuttle_p_m2_view_status_bar.xml
+++ b/OCH/shuttle/passenger_weaknet/src/main/res/b2/layout/shuttle_p_m2_view_status_bar.xml
@@ -7,23 +7,62 @@
tools:ignore="MissingDefaultResource"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toTopOf="@+id/layout_logo" />