[2.13.0-arch-opt] fix bug of limit speed and move view

This commit is contained in:
zhongchao
2023-01-31 15:26:32 +08:00
parent e01716f30a
commit d3f0ac654b
16 changed files with 136 additions and 240 deletions

View File

@@ -45,7 +45,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
private var driverMsgBoxListAdapter: DriverMsgBoxListAdapter ?=null
private fun initView() {
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context as Activity)
driverMsgBoxListAdapter= DriverMsgBoxListAdapter(context)
rvMsgBoxList.adapter = driverMsgBoxListAdapter
rvMsgBoxList.layoutManager = LinearLayoutManager(context)

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -27,7 +28,7 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
* @description 司机端消息盒子列表视图RecyclerView适配器
* @since: 2022/11/25
*/
class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Adapter<RecyclerView.ViewHolder>(){
class DriverMsgBoxListAdapter(private val context: Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>(){
private var data: List<MsgBoxBean> ?= null
@@ -39,10 +40,13 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
private val record: Int = 6
private val traffic: Int = 7
//Error
val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
companion object{
//Error
private const val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
private const val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
private const val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
}
fun setData(data: List<MsgBoxBean>){
this.data = data
@@ -77,7 +81,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,activity,false)
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,false)
}
}
}else if(holder is MsgBoxIpcReportHolder){
@@ -180,7 +184,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideApp.with(context).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
@@ -194,7 +198,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideApp.with(context).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
@@ -214,10 +218,10 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
holder.ivV2XImage.setImageDrawable(context.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
holder.ivV2XImage.setImageDrawable(context.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}
}

View File

@@ -10,23 +10,21 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
class DemoModeHiddenSwitch(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
class DemoModeHiddenSwitch(context: Context, attrs: AttributeSet?) : View(context, attrs) {
override fun onAttachedToWindow() {
super.onAttachedToWindow()
init {
isClickable = true
setOnClickListener {
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
//单次查询,是否有行程信息(订单进行中时点击不生效),autopilotControlParameters为null代表不处于自动驾驶状态下
if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) {
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
context?.let {
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(it)
)
}
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(context)
)
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
@@ -17,11 +17,10 @@ import kotlinx.android.synthetic.main.view_limiting_speed_vr.view.*
/**
* 限速控件
*/
class LimitingVelocityView @JvmOverloads constructor(
class LimitingVelocityView constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr), ILimitingVelocityListener, IViewControlListener {
) : ConstraintLayout(context, attrs), ILimitingVelocityListener, IViewControlListener {
companion object {
private const val TAG = "LimitingVelocityView"
@@ -39,21 +38,18 @@ class LimitingVelocityView @JvmOverloads constructor(
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
if (limitingVelocity > 0) {
tvLimitingVelocity.visibility = View.VISIBLE
tvLimitingSource.visibility = View.VISIBLE
this.visibility = View.VISIBLE
tvLimitingVelocity.text = "$limitingVelocity"
tvLimitingSource.text = sourceType.name
} else {
tvLimitingVelocity.visibility = View.GONE
tvLimitingSource.visibility = View.GONE
this.visibility = View.GONE
tvLimitingSource.text = ""
}
}
override fun visible(v: Int) {
super.visible(v)
tvLimitingVelocity.visibility = v
tvLimitingSource.visibility = v
this.visibility = v
}
override fun onDetachedFromWindow() {

View File

@@ -52,7 +52,7 @@ class VersionNameView @JvmOverloads constructor(
@SuppressLint("SetTextI18n")
private fun showCurrentPadVersion() {
tvAppVersionName?.let {
it.text = "APP:${AppUtils.getAppVersionName()}"
// it.text = "APP:${AppUtils.getAppVersionName()}"
}
}

View File

@@ -21,43 +21,6 @@
android:layout_height="match_parent"
android:paddingTop="72dp">
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:background="@drawable/bg_waring_limiting_velocity"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="60dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginEnd="40dp"
app:layout_goneMarginTop="40dp"
tools:visibility="gone" />
<!-- todo 需要放入使用方 -->
<!-- app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"-->
<!--限速来源-->
<TextView
android:id="@+id/tvLimitingSource"
android:layout_width="120dp"
android:layout_height="35dp"
android:gravity="center"
android:text=""
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/dp_30"
android:textStyle="bold"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" />
<!--消息盒子司机端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxDriver"
@@ -68,9 +31,10 @@
android:background="@drawable/selector_msg_box"
android:button="@null"
android:visibility="gone"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!-- todo 需要放入使用方 , view先gone掉方便重组 -->
<!-- app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />-->
<!--司机端消息提示-->

View File

@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<TextView
android:id="@+id/tvLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@drawable/bg_waring_limiting_velocity"
android:elevation="@dimen/dp_10"
android:gravity="center"
@@ -27,6 +29,8 @@
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/dp_30"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvLimitingVelocity"
android:visibility="gone" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>