Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!518
This commit is contained in:
@@ -2,7 +2,9 @@ package com.mogo.eagle.core.function.hmi.ui.vehicle
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue.COMPLEX_UNIT_PX
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
@@ -23,6 +25,8 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.android.synthetic.main.view_pnc_actions.view.*
|
||||
import me.jessyan.autosize.AutoSize
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
class PncActionsView @JvmOverloads constructor(
|
||||
@@ -41,12 +45,24 @@ class PncActionsView @JvmOverloads constructor(
|
||||
|
||||
private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null
|
||||
|
||||
private val bgResources: Int
|
||||
private val topMargin: Int
|
||||
private val txtSize: Int
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_pnc_actions, this, true)
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.PncActionsView, defStyleAttr, 0)
|
||||
bgResources = a.getResourceId(R.styleable.PncActionsView_background_resource, R.drawable.pnc_actions_bg)
|
||||
topMargin = a.getResourceId(R.styleable.PncActionsView_pnc_top_margin,resources.getDimension(R.dimen.dp_30).toInt())
|
||||
txtSize = a.getResourceId(R.styleable.PncActionsView_pnc_size,resources.getDimension(R.dimen.dp_34).toInt())
|
||||
a.recycle()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
(tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin
|
||||
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX,txtSize.toFloat())
|
||||
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerPlanningActionsListenerManager.addListener(TAG, this)
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
@@ -78,14 +94,21 @@ class PncActionsView @JvmOverloads constructor(
|
||||
var actions: String? = null
|
||||
planningActionMsg.actionMsg?.let { it ->
|
||||
try {
|
||||
actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number)
|
||||
} catch (e:Exception){
|
||||
actions = PncActionsHelper.getAction(
|
||||
it.drivingState.number,
|
||||
it.drivingAction.number
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
//如果是存在云端红绿灯数据条件下,设置云端数据
|
||||
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
|
||||
if (PncActionsHelper.isWaitingTrafficlight(
|
||||
it.drivingState.number,
|
||||
it.drivingAction.number
|
||||
)
|
||||
&& mTrafficLightResult != null
|
||||
&& getWaitTrafficLightTime().isNotBlank()) {
|
||||
&& getWaitTrafficLightTime().isNotBlank()
|
||||
) {
|
||||
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
|
||||
} else {
|
||||
mTrafficLightResult = null
|
||||
@@ -96,7 +119,8 @@ class PncActionsView @JvmOverloads constructor(
|
||||
this.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
} else {
|
||||
this.background = AppCompatResources.getDrawable(context, R.drawable.pnc_actions_bg)
|
||||
this.background =
|
||||
AppCompatResources.getDrawable(context, bgResources)
|
||||
tvHmiPncActions.text = actions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/dp_68"
|
||||
android:paddingEnd="@dimen/dp_68"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_34"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -73,4 +73,10 @@
|
||||
<attr name="day_light_mode" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PncActionsView">
|
||||
<attr name="background_resource" format="reference"/>
|
||||
<attr name="pnc_top_margin" format="reference"/>
|
||||
<attr name="pnc_size" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user