[8.2.6][乘客屏] 珠海LOGO修改,此修改对LOGO换肤时不生效

This commit is contained in:
xinfengkun
2025-10-28 17:39:44 +08:00
parent bc13f49533
commit b0eca73789
9 changed files with 167 additions and 30 deletions

View File

@@ -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("珠海")
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -7,23 +7,62 @@
tools:ignore="MissingDefaultResource"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<ImageView
android:id="@+id/iv_logon"
android:layout_width="@dimen/dp_58"
android:layout_height="@dimen/dp_58"
android:src="@drawable/shuttle_p_m2_status_bar_logo"
app:isUseSkin="true"
<FrameLayout
android:id="@+id/layout_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_49"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_logon"
android:layout_width="@dimen/dp_58"
android:layout_height="@dimen/dp_58"
android:src="@drawable/shuttle_p_m2_status_bar_logo"
app:isUseSkin="true" />
<LinearLayout
android:id="@+id/layout_zhuhai_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/iv_zhuhai_logo"
android:layout_width="@dimen/dp_201"
android:layout_height="@dimen/dp_58"
android:src="@drawable/shuttle_p_m2_status_bar_logo_zhuhai_mogox"
app:isUseSkin="true" />
<View
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_36"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_9"
android:background="#CC000000" />
<ImageView
android:id="@+id/iv_zhuhai_logo_other"
android:layout_width="@dimen/dp_274"
android:layout_height="@dimen/dp_58"
android:paddingTop="@dimen/dp_1"
android:paddingBottom="@dimen/dp_1"
android:src="@drawable/shuttle_p_m2_status_bar_logo_zhuhai_noma_autonoma"
app:isUseSkin="true" />
</LinearLayout>
</FrameLayout>
<TextView
android:id="@+id/tv_status_line_name"
app:layout_constraintTop_toTopOf="@+id/iv_logon"
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
app:layout_constraintStart_toEndOf="@+id/iv_logon"
app:layout_constraintTop_toTopOf="@+id/layout_logo"
app:layout_constraintBottom_toBottomOf="@+id/layout_logo"
app:layout_constraintStart_toEndOf="@+id/layout_logo"
android:layout_marginStart="@dimen/dp_20"
android:text="@string/m2_line_name_detaile"
android:textSize="@dimen/dp_38"
@@ -42,9 +81,9 @@
android:layout_gravity="center"
android:layout_marginEnd="@dimen/dp_18"
android:src="@drawable/driver_connect_statis"
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
app:layout_constraintBottom_toBottomOf="@+id/layout_logo"
app:layout_constraintEnd_toStartOf="@+id/textClockDate"
app:layout_constraintTop_toTopOf="@+id/iv_logon" />
app:layout_constraintTop_toTopOf="@+id/layout_logo" />
<TextClock
android:id="@+id/textClockDate"
@@ -52,8 +91,8 @@
android:layout_height="wrap_content"
android:format12Hour="HH:mm:ss"
android:format24Hour="HH:mm:ss"
app:layout_constraintTop_toTopOf="@+id/iv_logon"
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
app:layout_constraintTop_toTopOf="@+id/layout_logo"
app:layout_constraintBottom_toBottomOf="@+id/layout_logo"
app:layout_constraintEnd_toStartOf="@+id/wifiStateView"
android:gravity="center"
android:layout_marginEnd="@dimen/dp_18"
@@ -69,8 +108,8 @@
android:layout_width="@dimen/dp_47"
android:layout_height="@dimen/dp_47"
android:layout_gravity="center"
app:layout_constraintTop_toTopOf="@+id/iv_logon"
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
app:layout_constraintTop_toTopOf="@+id/layout_logo"
app:layout_constraintBottom_toBottomOf="@+id/layout_logo"
app:layout_constraintEnd_toStartOf="@+id/aciv_battery_bg"
android:layout_marginEnd="@dimen/dp_18"
app:wifi_show_title="false"
@@ -79,8 +118,8 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_battery_bg"
app:layout_constraintTop_toTopOf="@+id/iv_logon"
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
app:layout_constraintTop_toTopOf="@+id/layout_logo"
app:layout_constraintBottom_toBottomOf="@+id/layout_logo"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/m2_p_battery"
android:layout_marginEnd="@dimen/dp_22"

View File

@@ -4,6 +4,8 @@ import bag_manager.BagManagerOuterClass
import chassis.Chassis
import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HdMapBuildConfig
@@ -510,6 +512,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
AppConfigInfo.plateNumber = carConfigResp.plateNumber//车牌号
AppConfigInfo.iPCMacAddress = carConfigResp.macAddress//工控机MAC地址
AppConfigInfo.protocolVersionNumber = carConfigResp.protocolVersionValue//工控机协议版本
carConfigResp.cityCode?.let {
SharedPrefsMgr.getInstance().putString(SharedPrefsConstants.CMDB_CITY_CODE, it)
}
invokeAutopilotCarConfigData(carConfigResp)
}
}

View File

@@ -21,4 +21,5 @@ public class SharedPrefsConstants {
public static final String inputIpDomainController = "InputIpDomainController";
public static final String inputDriverIpDomainController = "InputDriverIpDomainController";
public static final String CMDB_CITY_CODE = "cmdb_city_code";//域控返回的城市
}

View File

@@ -559,7 +559,8 @@ message CarConfigResp
string carType = 9; //车辆类型
string subCarType = 10; //车辆子类型
string vinCode = 11;//车辆vin码 taxi: 420 bus: 440
reserved 12 to 100;
string cityCode = 12;//城市
reserved 13 to 100;
int32 mapVersion = 101;//dockVersion解析出版本号仅用于版本对比解析失败为-1。例如"MAP-taxi_RoboTaxi_df_2.8.0.3_20220928_test" 解析结果为20800
bool isBus = 102;//是否是Bus
bool isTaxi = 103;//是否是Taxi