[6.7.0][状态栏改变] 状态栏小铃铛点击后弹出的窗口

This commit is contained in:
renwj
2024-09-25 19:59:23 +08:00
parent 6785b20662
commit dcfbeaae10
17 changed files with 47 additions and 117 deletions

View File

@@ -34,29 +34,24 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList<StatusS
fun bind(entity: StatusSummaryEntity) {
when(entity.type) {
0 -> {
ivFuncView.setImageResource(R.drawable.driver_server)
ivFuncView.setImageResource(if (entity.isException) R.drawable.icon_over_driver_start_error else R.drawable.icon_over_driver_start_ok)
}
1 -> {
ivFuncView.setImageResource(R.drawable.gps)
ivFuncView.setImageResource(if (entity.isException) R.drawable.icon_over_gps_error else R.drawable.icon_over_gps_ok)
}
2 -> {
ivFuncView.setImageResource(R.drawable.cloud_socket)
ivFuncView.setImageResource(if (entity.isException) R.drawable.icon_over_socket_error else R.drawable.icon_over_socket_ok)
}
3 -> {
ivFuncView.setImageResource(R.drawable.tracing)
ivFuncView.setImageResource(if (entity.isException) R.drawable.icon_over_route_error else R.drawable.icon_over_route_ok)
}
4 -> {
ivFuncView.setImageResource(R.drawable.controller)
ivFuncView.setImageResource(if (entity.isException) R.drawable.icon_over_ipc_error else R.drawable.icon_over_ipc_ok)
}
5 -> {
ivFuncView.setImageResource(R.drawable.ssl_check)
ivFuncView.setImageResource(if (entity.isException) R.drawable.icon_over_auth_error else R.drawable.icon_over_auth_ok)
}
}
if (entity.isException) {
tvStatusDesc.setTextColor(Color.parseColor("#FF4444"))
} else {
tvStatusDesc.setTextColor(Color.parseColor("#FFFFFF"))
}
tvStatusDesc.text = entity.desc
}
}

View File

@@ -32,21 +32,12 @@ import com.mogo.eagle.core.utilcode.kotlin.PX
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.mogo.adas.data.AdasConstants
import me.jessyan.autosize.utils.AutoSizeUtils
/**
* 状态汇总View控件
*/
class StatusSummaryView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(
context,
attrs,
defStyleAttr
), IConnectStatusListener, IMogoStatusChangedListener,
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarConfigListener,
IMoGoCloudListener {
class StatusSummaryView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr), IConnectStatusListener, IMogoStatusChangedListener, IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarConfigListener, IMoGoCloudListener {
companion object {
private const val TAG = "SummaryStatusView"
}
@@ -61,13 +52,7 @@ class StatusSummaryView @JvmOverloads constructor(
it.add(StatusSummaryEntity(2))
it.add(StatusSummaryEntity(3))
it.add(StatusSummaryEntity(4, "域控未连接", true))
it.add(
StatusSummaryEntity(
5,
CallerAutopilotCarConfigListenerManager.getCertFileResult(),
CallerCloudCertManager.getRootCrtF().isNullOrEmpty()
)
)
it.add(StatusSummaryEntity(5, CallerAutopilotCarConfigListenerManager.getCertFileResult(), CallerCloudCertManager.getRootCrtF().isNullOrEmpty()))
}
}
@@ -78,12 +63,9 @@ class StatusSummaryView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerDevaToolsListenerManager.addListener(TAG, this)
// 司机屏Server服务是否开启的状态
CallerTelematicStatusListenerManager.addListener(TAG, this)
// 云socket连接状态
MogoStatusManager.getInstance()
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerDevaToolsListenerManager.addListener(TAG, this) // 司机屏Server服务是否开启的状态
CallerTelematicStatusListenerManager.addListener(TAG, this) // 云socket连接状态
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerCloudListenerManager.addListener(TAG, this)
@@ -99,12 +81,7 @@ class StatusSummaryView @JvmOverloads constructor(
removeDuration = 0
}
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
it.addItemDecoration(
CommonDividerItemDecoration.Builder()
.spanCountTBCare(false)
.horizontalInnerSpace(10.PX)
.build()
)
it.addItemDecoration(CommonDividerItemDecoration.Builder().spanCountTBCare(false).verticalInnerSpace(AutoSizeUtils.dp2px(context, 20.0f)).build())
StatusSummaryAdapter(context, data).apply {
adapter = this
it.adapter = this
@@ -121,13 +98,10 @@ class StatusSummaryView @JvmOverloads constructor(
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 司机屏Server服务是否开启的状态
super.onDetachedFromWindow() // 司机屏Server服务是否开启的状态
CallerTelematicStatusListenerManager.removeListener(TAG)
CallerDevaToolsListenerManager.removeListener(TAG)
// 云socket连接状态
MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerDevaToolsListenerManager.removeListener(TAG) // 云socket连接状态
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerCloudListenerManager.removeListener(TAG)
@@ -171,8 +145,7 @@ class StatusSummaryView @JvmOverloads constructor(
}
override fun tracingStatus(status: Boolean) {
super.tracingStatus(status)
// 发送事件前限制了频率
super.tracingStatus(status) // 发送事件前限制了频率
UiThreadHandler.post({
if (data.size < 4) return@post
data[3].desc = "寻迹算路${if (status) "正常" else "异常"}"
@@ -181,10 +154,7 @@ class StatusSummaryView @JvmOverloads constructor(
}, UiThreadHandler.MODE.QUEUE)
}
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
reason: String?
) {
override fun onAutopilotIpcConnectStatusChanged(status: AdasConstants.IpcConnectionStatus, reason: String?) {
super.onAutopilotIpcConnectStatusChanged(status, reason)
var pair: Pair<String, Boolean>? = null
when (status) {
@@ -238,8 +208,8 @@ class StatusSummaryView @JvmOverloads constructor(
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
UiThreadHandler.post ({
if(CallerAutopilotCarConfigListenerManager.getCertFileResult()!= "未开启认证"){
UiThreadHandler.post({
if (CallerAutopilotCarConfigListenerManager.getCertFileResult() != "未开启认证") {
return@post
}
if (data.size < 6) return@post
@@ -251,7 +221,7 @@ class StatusSummaryView @JvmOverloads constructor(
override fun authCrtError(errorMsg: String) {
super.authCrtError(errorMsg)
UiThreadHandler.post ({
UiThreadHandler.post({
if (data.size < 6) return@post
data[5].desc = "本机证书下载异常:$errorMsg"
data[5].isException = true
@@ -262,14 +232,10 @@ class StatusSummaryView @JvmOverloads constructor(
override fun onCertificationResult(msg: String) {
super.onCertificationResult(msg)
hmiAction("证书验证状态", msg, true)
if (!SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
) {
if (!SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) {
return
}
UiThreadHandler.post ({
UiThreadHandler.post({
if (data.size < 6) return@post
data[5].desc = msg
data[5].isException = !msg.contains("成功校验")

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,35 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_600"
android:layout_height="@dimen/dp_80"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:roundLayoutRadius="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_12"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_509"
android:layout_height="wrap_content"
tools:background="#83000000"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivFuncView"
android:layout_width="@dimen/dp_64"
android:layout_height="@dimen/dp_64"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:scaleType="fitCenter"
android:layout_marginStart="12dp"
/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
tools:src="@drawable/icon_over_driver_start_ok"/>
<TextView
android:id="@+id/tvStatusDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已连接xxxxxxxxxxxxxxxx"
android:textSize="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_10"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="10dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dp_20"
android:textSize="@dimen/dp_28"
android:textColor="#ffffff"
tools:text="已连接xxxxxxxxxxxxxxxx" />
</LinearLayout>

View File

@@ -1,32 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_600"
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rvStatusView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/notice_dialog_check_background"
tools:ignore="MissingDefaultResource">
android:background="@drawable/bg_status_overview"
android:padding="@dimen/dp_60"
tools:ignore="MissingDefaultResource" />
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="12dp"
android:layout_marginStart="12dp"
android:text="状态汇总:"
android:textSize="@dimen/dp_32"
android:textColor="#FFFFFF"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvStatusView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTitle"
android:layout_marginTop="12dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>