[6.7.0][FSM] feat: 增加 启动自动驾驶状态 view (有FSM/无FSM);

feat: 增加相关状态的资源文件;
feat: 无人化司机端增加bone 新 tab 的自定义 view;
This commit is contained in:
aibingbing
2024-09-11 19:32:09 +08:00
parent 6695c5e19b
commit 52253f1076
27 changed files with 167 additions and 5 deletions

View File

@@ -459,5 +459,12 @@
app:layout_constraintStart_toStartOf="parent"
/>
<com.mogo.eagle.core.function.hmi.ui.bone.BoneContainerView
android:id="@+id/boneContainerView"
android:layout_width="@dimen/dp_1046"
android:layout_height="match_parent"
android:elevation="100dp"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -36,12 +36,12 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { (it !is IAutopilotPreLaunchStatus) || (it is FSMStatus)}) }?.also { adapter -> rv.adapter = adapter }
val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { it !is IAutopilotPreLaunchStatus }) }?.also { adapter -> rv.adapter = adapter }
adapter?.let { _ ->
observer?.also { model.status.removeObserver(it) }
model.status.observeForever(Observer<Pair<Status?, ArrayList<Status>>> { data ->
val old = adapter.data
val update = data.second.filter { (it !is IAutopilotPreLaunchStatus) || (it is FSMStatus) }
val update = data.second.filter { it !is IAutopilotPreLaunchStatus }
val result = DiffUtil.calculateDiff(StatusDiffCallback(old, update))
adapter.data = update
result.dispatchUpdatesTo(adapter)

View File

@@ -13,7 +13,7 @@ class BoneTopStatusLayout @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
LayoutInflater.from(context).inflate(R.layout.view_bone_tab, this, true)
LayoutInflater.from(context).inflate(R.layout.view_bone_top_status, this, true)
initView()
}

View File

@@ -0,0 +1,57 @@
package com.mogo.eagle.core.function.hmi.ui.bone.status
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
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.Logger
import com.zhjt.mogo_core_function_devatools.status.StatusManager
import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus
import com.zhjt.mogo_core_function_devatools.status.entity.Status
import com.zhjt.mogo_core_function_devatools.status.ui.AutoPilotLaunchBeforeView
class StartAutoPilotStatusView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , StatusManager.IStatusListener {
companion object {
private const val TAG = "StartAutoPilotStatusView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_start_autopilot_status, this, true)
initView()
}
private fun initView() {
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
StatusManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
StatusManager.removeListener(TAG)
}
/**
* @param changed: 变化的数据
* @param all: 所有状态数据
*/
override fun onStatusChanged(changed: List<Status>, all: List<Status>) {
changed.filter { it is IAutopilotPreLaunchStatus }.forEach { status ->
val isError = status.isException() && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
CallerLogger.d(TAG, "--- onChanged ---:$isError")
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/icon_status_accelerator_error" />
<item android:drawable="@drawable/icon_status_accelerator_normal" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/icon_status_brake_error" />
<item android:drawable="@drawable/icon_status_brake_normal" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/icon_status_double_flash_error" />
<item android:drawable="@drawable/icon_status_double_flash_normal" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/icon_status_gear_bg_error" />
<item android:drawable="@drawable/icon_status_gear_bg_normal" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/icon_status_steer_error" />
<item android:drawable="@drawable/icon_status_steer_normal" />
</selector>

View File

@@ -7,6 +7,7 @@
android:layout_gravity="center">
<com.mogo.eagle.core.function.hmi.ui.bone.BoneTopStatusLayout
android:id="@+id/boneTopStatusLayout"
android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -5,5 +5,10 @@
android:layout_height="@dimen/dp_357">
<com.mogo.eagle.core.function.hmi.ui.bone.status.StartAutoPilotStatusView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_865"
android:layout_height="@dimen/dp_102">
<ImageView
android:id="@+id/clFSMStatusLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:background="@drawable/icon_fsm_status_bg_normal"
tools:visibility="visible"/>
<LinearLayout
android:id="@+id/llBeforeLaunchStatusLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/dp_34"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="gone"
tools:background="@drawable/icon_no_fsm_status_bg_error">
<TextView
android:id="@+id/tv_gear"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:gravity="center"
android:maxLines="1"
android:text="P"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_36"
android:layout_marginEnd="@dimen/dp_22"
android:background="@drawable/bg_autopilot_status_gear"
tools:text="P" />
<ImageView
android:id="@+id/iv_steer"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_marginEnd="@dimen/dp_22"
android:src="@drawable/bg_autopilot_status_steer" />
<ImageView
android:id="@+id/iv_accelerator"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_marginEnd="@dimen/dp_22"
android:src="@drawable/bg_autopilot_status_accelerator" />
<ImageView
android:id="@+id/iv_brake"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:layout_marginEnd="@dimen/dp_22"
android:src="@drawable/bg_autopilot_status_brake" />
<ImageView
android:id="@+id/iv_double_flash"
android:layout_width="@dimen/dp_55"
android:layout_height="@dimen/dp_55"
android:src="@drawable/bg_autopilot_status_double_flash" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>