调试窗修改
添加鹰眼参数配置—设置刹车加速度阈值
This commit is contained in:
@@ -257,6 +257,18 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
tbEagleEyeController.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if(isChecked){
|
||||
buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
//展示参数配置
|
||||
eagleEyeControllerLayout.visibility = View.VISIBLE
|
||||
}else{
|
||||
buttonView.setCompoundDrawables(null, null, iconRight, null)
|
||||
//隐藏参数配置
|
||||
eagleEyeControllerLayout.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 域控制器
|
||||
*/
|
||||
@@ -388,6 +400,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
//设置鹰眼本地参数配置监听
|
||||
setEagleEyeConfigListener()
|
||||
//域控制器中心事件点击监听
|
||||
setDomainControllerCheckedChangeListener()
|
||||
//Hmi控制中心事件点击监听
|
||||
@@ -500,6 +514,39 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置鹰眼本地参数配置监听
|
||||
*/
|
||||
private fun setEagleEyeConfigListener(){
|
||||
//初始化刹车加速度阈值信息
|
||||
val brakeThreshold = SharedPrefsMgr.getInstance(context)
|
||||
.getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,-2.5F)
|
||||
etInputBrakeThreshold.setText(brakeThreshold.toString())
|
||||
etInputBrakeThreshold.text?.let { etInputBrakeThreshold.setSelection(brakeThreshold.toString().length) }
|
||||
//设置刹车加速度阈值信息
|
||||
btnBrakeThreshold.setOnClickListener {
|
||||
val thresholdStr = etInputBrakeThreshold.text.toString()
|
||||
if(thresholdStr.isNullOrEmpty()){
|
||||
ToastUtils.showShort("请输入正确的判定刹车加速度阈值")
|
||||
}else{
|
||||
try{
|
||||
val thresholdStrFloat = thresholdStr.toFloat()
|
||||
if(thresholdStrFloat<0){
|
||||
SharedPrefsMgr.getInstance(context).putFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD,thresholdStrFloat)
|
||||
ToastUtils.showShort("刹车阈值设置成功")
|
||||
}else{
|
||||
ToastUtils.showShort("刹车阈值加速度值应小于0")
|
||||
}
|
||||
}catch (e: Exception){
|
||||
ToastUtils.showShort("判定刹车加速度阈值格式设置不正确")
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置域控制器点击监听
|
||||
*/
|
||||
|
||||
@@ -472,6 +472,75 @@
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbEagleEyeController"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/setting_toggle_button_background"
|
||||
android:drawableEnd="@drawable/icon_right"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="鹰眼参数配置"
|
||||
android:textOn="鹰眼参数配置" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/eagleEyeControllerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnBrakeThreshold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_5"
|
||||
android:text="设置刹车加速度阈值"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
android:paddingEnd="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="@drawable/debug_setting_edit_bg"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnBrakeThreshold"
|
||||
app:layout_constraintLeft_toRightOf="@id/btnBrakeThreshold"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/btnBrakeThreshold">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/etInputBrakeThreshold"
|
||||
style="@style/DebugSettingText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="90px"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center"
|
||||
tools:ignore="SpeakableTextPresentCheck" />
|
||||
|
||||
<TextView
|
||||
style="@style/DebugSettingText"
|
||||
android:layout_width="93px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:text="m/s²" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDomainController"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user