From 49f6a5778e897ccd4ff3cbc30b18917018793cb6 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Mon, 24 Oct 2022 10:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=AE=B1=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmi/ui/tools/AutoPilotAndCheckView.kt | 116 +++++++++--------- .../res/drawable-xxhdpi/icon_speed_add.png | Bin 0 -> 1879 bytes .../res/drawable-xxhdpi/icon_speed_reduce.png | Bin 0 -> 1597 bytes .../main/res/layout/view_auto_pilot_check.xml | 71 ++++++----- 4 files changed, 99 insertions(+), 88 deletions(-) create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_speed_add.png create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_speed_reduce.png diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt index a41a6c77d8..c6c1ce249a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt @@ -59,15 +59,13 @@ class AutoPilotAndCheckView @JvmOverloads constructor( companion object { private var maxAcceleration: Double = 2.0 - private var speedLimit: Double = 0.0 + private var speedLimit: Int = 0 } @SuppressLint("ClickableViewAccessibility") private fun initView() { background = ColorDrawable(Color.parseColor("#F0151D41")) - if (keyBoardUtil == null) { - keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed) - } + keyBoardUtil?.setActionListener { inputContent -> inputContent.toIntOrNull()?.let { speed -> when { @@ -76,10 +74,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor( ToastUtils.showShort("超过最大限速值60,设置失败") } else -> { - llSpeedPosition.background = - resources.getDrawable(R.drawable.pilot_speed_bg) - keyBoardUtil?.hideKeyboard() - etInputSpeed.clearFocus() // 设置自动驾驶速度 val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed) when { @@ -94,7 +88,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor( } } } - KeyBoardUtil.hideSystemSoftKeyboard(context, etInputSpeed) ivCloseIcon.setOnClickListener { clickListener?.onClose(it) } @@ -113,49 +106,60 @@ class AutoPilotAndCheckView @JvmOverloads constructor( ivDebugFeedback.onClick { clickListener?.showFeedbackView() } - etInputSpeed.setOnFocusChangeListener { v, hasFocus -> - when { - hasFocus -> { - llSpeedPosition.background = - resources.getDrawable(R.drawable.pilot_speed_high_light_bg) - if (keyBoardUtil == null) { - keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed) - } - keyBoardUtil?.showKeyboard() - } - else -> llSpeedPosition.background = - resources.getDrawable(R.drawable.pilot_speed_bg) - } - } - etInputSpeed.setOnTouchListener { v, event -> - var curTime = System.currentTimeMillis() - if (curTime - lastTime < 1000) { - return@setOnTouchListener true - } - if (!connectStatus) { - ToastUtils.showShort("设置车速失败,请启动域控制器") - keyBoardUtil?.hideKeyboard() - return@setOnTouchListener true - } else { - return@setOnTouchListener false - } - } - updateSpeedSettingViews() + if (AppConfigInfo.isConnectAutopilot) { CallerAutoPilotManager.getCarConfig() } - if (maxAcceleration > 0) { - tvAcceleration.text = "加速度 $maxAcceleration m/s²" - } +// if (maxAcceleration > 0) { +// tvAcceleration.text = "加速度 $maxAcceleration m/s²" +// } + tvAcceleration.text = "每次调整车速±5km/h" if (speedLimit > 0) { - etInputSpeed.setText((speedLimit * 3.6).toInt().toString()) + tvSpeed.text = speedLimit.toString() + }else{ + tvSpeed.text = "0" + } + ivSpeedReduce.setOnClickListener { + if(speedLimit>=5){ + speedLimit -= 5 + //速度显示 + val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speedLimit) + when { + isSuccess -> { + //速度显示 + tvSpeed.text = speedLimit.toString() + ToastUtils.showShort("车速设置成功,立即生效") + } + else -> { + ToastUtils.showShort("设置车速失败,请启动域控制器") + } + } + }else{ + ToastUtils.showShort("车速不能再减了") + } + } + ivSpeedAdd.setOnClickListener { + if(speedLimit<=55){ + speedLimit += 5 + //速度显示 + val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speedLimit) + when { + isSuccess -> { + //速度显示 + tvSpeed.text = speedLimit.toString() + ToastUtils.showShort("车速设置成功,立即生效") + } + else -> { + ToastUtils.showShort("设置车速失败,请启动域控制器") + } + } + }else{ + ToastUtils.showShort("车速不能再加了") + } } - initOchView() -// // 比如需要设置默认速度 -// val speed = "30" -// etInputSpeed.setText(speed) -// etInputSpeed.setSelection(speed.length) + + initOchView() } private fun initOchView() { @@ -192,11 +196,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor( this.clickListener = clickListener } - private fun updateSpeedSettingViews() { - tvSpeedTitle.visibility = View.VISIBLE - llSpeedPosition.visibility = View.VISIBLE - } - fun showAdUpgradeStatus(ipcUpgradeStateInfo: IPCUpgradeStateInfo) { systemVersionView?.showAdUpgradeStatus(ipcUpgradeStateInfo) } @@ -228,12 +227,15 @@ class AutoPilotAndCheckView @JvmOverloads constructor( override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) { UiThreadHandler.post { - tvAcceleration?.let { - maxAcceleration = carConfigResp.maxAcceleration - speedLimit = carConfigResp.speedLimit - tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²" - etInputSpeed.setText((carConfigResp.speedLimit * 3.6).toInt().toString()) - } +// tvAcceleration?.let { +// maxAcceleration = carConfigResp.maxAcceleration +// speedLimit = carConfigResp.speedLimit +//// tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²" +// tvSpeed.text = (carConfigResp.speedLimit * 3.6).toInt().toString() +// } + maxAcceleration = carConfigResp.maxAcceleration + speedLimit = (carConfigResp.speedLimit * 3.6).toInt() + tvSpeed.text = speedLimit.toString() } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_speed_add.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_speed_add.png new file mode 100644 index 0000000000000000000000000000000000000000..bbd0601d2752a94faae25f674d371cc8a5584312 GIT binary patch literal 1879 zcmd5-eKga17~hN;TVcHqmoZ9|@|yG_8}^H-q^QiK*D1Hw3bE!Ma>zyNSF{)zqi~S7 zD}`m;B(`Z{p^Z^0S8VbUDtDcGZs-1c|GM{&&+~bn&-e43^PK08=X-6huh$Y?j4lKM zSppCVerl$wk%EA$V=OWesU|4h&&wTBCNlbWW72^K%j|Kh~{^T8W=So z5Lhl00#h^eyOyi*yz?68z6AlXuFNNbvg!3gMfhn_Pxc(uxZ;_W$rayGwWUTQD_)?mu7FgCfyDVi!%w) zpJK80m|6C^MT{P*k^FvKk|kReT|9tVOemntUhIzfwD3aK-MvYeH6zkhlm}~c*mIld zgm0*Qv}7P{a~Ztw22TX~{;E_I zj4k!4of{KwD5>oLF8J6cCGx@uHQ~kvLp6eJO*V${Ek!-Ao;7|jt{-etgjqw4HxNRc zI5W%(Lpu@D+cHsCmvrL--}&Q>Ql#TmUIJoTL4Wtw)+`5guSxHk>)mZH8o!N~O57x+ z@23{*ZPyA4PChoToo;KW8t|z;K|QdWSeysaj;uy4&q z#`(UOl_2W5mA9^W!`%ku==t~sh;O9DikS98t&D9xEj#ppnK!)TmIX?4$J{a2E!Hcf z;8-e>kR4;%mXqagfFz?}$^(DtgIHo-I_tQYRGefiWD$`d8vPiG>%DYyeLU}~;AaRB zA>%zawc&D=$<5E&F3PkJv_tvH)ndD;n_HU-L8oIY?K0AL(Sx_>y z@U48S$ycRzwsbm_KEZVX<&3A{M=DZ!R-_%Kt&xVCNdp`mz^4;~UXS?9iRjr=@hkOG zdCL4M??;N+vdCDc)2dD)#zC1GjRo)}+$-23tTMBj#p8B&HnLvoN0AN_C7ofXDa0^D zz2ycR^|WKPEzVIh_~uH`p&HXCeQguP5vJYDr;U^BYnBDm=*`u8gBHuk{*4|5$u$Tv z|8x158M&1Cyl)Ke@e|=wLsBgR)h~TH&Z$cO(OlLyWcp`!Hnw? zJW1o4I6t$4lHSkZeST6_+!@rLDWXho7Xrz9{Ka3*TU~R?=Fevbj>UH0K61AIA*Ey0 zr>9>ITyd-mKOKA&qphRr^An^D-VKY)v6gDn)-cya+Ayw*g~mWUqH4eq@5k4XcJ9P= zLn;QyZvUoO>?9_O;~!m~`g?WBdSm}sqV$JcuDT!UYb#Z^UkXJ4Qx*Y%1gKZ_xt6F3w@D?w4UKUEshR`;2{R)X=ogxIT{h z;zS=MIkfbc%N3q*t*`-(T?YF^ZE4puFiA^r2X~R>ss_d3YMNDDX~j0qIBNF=Ie+>1 zjl#lyhEqnOd0Qr~^$)`5#vXQmKn7fWL}2a8Bkm>j&mzE~?hnR{0vnxsk3mAS_q%nX zt_BMmZT>(j<>Kvl^P((IJZKt2q}eJZbtG?6Yuy&m z&btmvUX5!x!+NkY@RDZwg1aAJHf$%?b^%v4PqfHQv~|4Jo~wsXXK1L~=WBPM;qWsF zm(Aq&qrsw{%Fw)+<<68*7eL+>_%KRQZmBW!&NFOSb$Ku2^%K!{jPDu4p&%n2<1~An zu8*PPo|iUTE$#%_JC>ZQ7f{HWM&hewB3e|4R}jYxJco?1ZEchE11b~pR>2JNpd#e^ Orv`ZV63W~|;{F6FL2)hs literal 0 HcmV?d00001 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_speed_reduce.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_speed_reduce.png new file mode 100644 index 0000000000000000000000000000000000000000..905094d4617be6873bf42d12e01dfb7225bcd3db GIT binary patch literal 1597 zcmc&!YdF&j82_)yT#nmHvdHB)IjFSGIN_8w!&Zj0rKW}DwhD!sL{^mJ+HyoAYsqao zoa8JasiVzYvLSM5k2SYiO>wMgVrRbe{d_s+!|(mQm*4xm&+|Ud`)2z4dh6-HbN~R* z!(z|@YNn`>qot{~sk#}uY68Uvc%y*2UbA=V03Ci98-c?C_G(`X0A)}Bja7*nFf{-G z%mM*mHG@`jtTo@N6c+fKpR+3b;m#Zm0M=Gv(MWtENLGrBG9zs4X!}@!B3qO9L-W(D zU#1!9*iRSI5Blyivf`F>gdl~72hyHbR1FbzvhD~E&ROb|v8pzg50_MErt`A#N%eo; zTnL%aY+l;a*4P~Cv883qrj+6SMG$^fBst^P>y$Zv1*{xg8iIzO4S2yN$7jD6xr$R4dHqKHlb6kd z+AK`cIxXP*&XBpGnCu2syNhr`KYHq!X}$9I8s@rz3h~H9ejAuUPxcp{Jfz|oggGvL ziR>*Cbq2#6oXz>^1ps3dbBzyy$5{#y_p0R^Fu5MLY=5O?p&oE%w_qsrPvb89>6@(D z2xHES3dzL4BC>g01m;sHLV)x%>a1=7*^wY$EZtP7@UX;9ZYSWiokve-BH>q2yH_O?j4xT!pGMTv+#n}y4sGN){&YlQBL6Y}v z?@i3FYk5f2mLJG>6Vnr3laE$znmYSbfR*Cn`k4I}IRTLA>Rax^Bn))JNSD9d`#UZ2)rm|F@`r zGkK%Wf<)(xNeEww0e%n#@+mA@uLxatElSBr$`5fyE{AA^Lu@wKR zb$CZ01V&GCx<%jwl7*3RwY_ALi;$MkR7S-~W~_LP%~Gyc)9Pv1f0kS93WqUoupFmr zXk1s<`=EF8+N5>5u_Yt7+(%L#9rttQzqq7_VN3j~790+?h`(<&@DL{-i&^iwepJJb z(@H#l>R3d`b2DV-k=t%CebIHOkjwu7OD&|S literal 0 HcmV?d00001 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml index ade0a7ce16..a41f32557b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml @@ -43,6 +43,7 @@ android:gravity="center_vertical" android:orientation="horizontal" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="@+id/tv_check_title" app:layout_constraintTop_toBottomOf="@+id/v_second_group"> @@ -205,43 +206,51 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/sopLayout" /> - + app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle" + /> - + - + - + x` + app:layout_constraintTop_toBottomOf="@id/ivSpeedReduce" />