Merge branch 'dev_robotaxi-d_230412_2.15.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_230412_2.15.0

This commit is contained in:
lixiaopeng
2023-04-13 19:30:54 +08:00
11 changed files with 188 additions and 49 deletions

View File

@@ -70,29 +70,60 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
@SuppressLint("ClickableViewAccessibility")
private fun initView() {
background = ColorDrawable(Color.parseColor("#F0151D41"))
keyBoardUtil?.setActionListener { inputContent ->
inputContent.toIntOrNull()?.let { speed ->
when {
speed > 60 -> {
// 设置失败键盘不消失,让用户直接修改
ToastUtils.showShort("超过最大限速值60设置失败")
}
else -> {
// 设置自动驾驶速度
val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(speed)
when {
isSuccess -> {
ToastUtils.showShort("车速设置成功,立即生效")
}
else -> {
ToastUtils.showShort("设置车速失败,请启动域控制器")
if (keyBoardUtil == null) {
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
}
keyBoardUtil?.setActionListener(object: KeyBoardUtil.ActionListener{
override fun onComplete(inputContent: String?) {
inputContent?.toIntOrNull()?.let { speed ->
when {
speed > 60 -> {
// 设置失败键盘不消失,让用户直接修改
ToastUtils.showShort("超过最大限速值60设置失败")
}
else -> {
keyBoardUtil?.hideKeyboard()
etInputSpeed.clearFocus()
// 设置自动驾驶速度
val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(speed)
when {
isSuccess -> {
ToastUtils.showShort("车速设置成功,立即生效")
}
else -> {
ToastUtils.showShort("设置车速失败,请启动域控制器")
}
}
}
}
}
}
}
override fun onUpdate(inputContent: String?) {
if (inputContent != null) {
try {
if(inputContent.isEmpty()){
speedLimit = 0
}else{
speedLimit = inputContent.toInt()
if(speedLimit>60){
speedLimit = 60
ToastUtils.showShort("最大限速60")
}
}
}catch (t: Exception){
ToastUtils.showShort("最大限速60")
speedLimit = 60
}
etInputSpeed.setText(speedLimit.toString())
etInputSpeed.setSelection(speedLimit.toString().length)
}
}
})
KeyBoardUtil.hideSystemSoftKeyboard(context, etInputSpeed)
ivCloseIcon.setOnClickListener {
clickListener?.onClose(it)
}
@@ -123,16 +154,42 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
// }
tvAcceleration.text = "每次调整车速±5km/h,点击确定生效"
if (speedLimit > 0) {
tvSpeed.text = speedLimit.toString()
etInputSpeed.setText(speedLimit.toString())
}else{
tvSpeed.text = "0"
etInputSpeed.setText("0")
}
etInputSpeed.setOnTouchListener { _, _ ->
val curTime = System.currentTimeMillis()
if (curTime - lastTime < 1000) {
return@setOnTouchListener true
}
etInputSpeed.isFocusableInTouchMode = true
if (keyBoardUtil == null) {
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
}
keyBoardUtil?.showKeyboard()
//滑动滚动条
svLayout.post {
svLayout.fullScroll(View.FOCUS_DOWN)
}
if (!connectStatus) {
ToastUtils.showShort("设置车速失败,请启动域控制器")
keyBoardUtil?.hideKeyboard()
return@setOnTouchListener true
} else {
return@setOnTouchListener false
}
}
ivSpeedReduce.setOnClickListener {
if(speedLimit>=5){
speedLimit -= 5
tvSpeed.text = speedLimit.toString()
}else{
etInputSpeed.setText(speedLimit.toString())
}else if(speedLimit in 1..4){
speedLimit = 0
etInputSpeed.setText(speedLimit.toString())
} else{
ToastUtils.showShort("车速不能再减了")
}
}
@@ -140,19 +197,27 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
ivSpeedAdd.setOnClickListener {
if(speedLimit<=55){
speedLimit += 5
tvSpeed.text = speedLimit.toString()
}else{
etInputSpeed.setText(speedLimit.toString())
}else if(speedLimit in 56..59){
speedLimit = 60
etInputSpeed.setText(speedLimit.toString())
} else{
ToastUtils.showShort("车速不能再加了")
}
}
//速度确认
tvSureModify.setOnClickListener {
if(speedLimit>60){
// 设置失败键盘不消失,让用户直接修改
ToastUtils.showShort("超过最大限速值60设置失败")
return@setOnClickListener
}
val isSuccess = CallerAutoPilotControlManager.setAutoPilotSpeed(speedLimit)
when {
isSuccess -> {
//速度显示
tvSpeed.text = speedLimit.toString()
etInputSpeed.setText(speedLimit.toString())
ToastUtils.showShort("车速设置成功,立即生效")
}
else -> {
@@ -243,7 +308,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
// }
maxAcceleration = carConfigResp.maxAcceleration
speedLimit = (carConfigResp.speedLimit * 3.6).toInt()
tvSpeed.text = speedLimit.toString()
etInputSpeed.setText(speedLimit.toString())
}
}
}

View File

@@ -6,6 +6,7 @@ import android.inputmethodservice.KeyboardView;
import android.os.Build;
import android.text.Editable;
import android.text.InputType;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
@@ -78,6 +79,9 @@ public class KeyBoardUtil {
editable.delete(start - 1, start);
}
}
if(actionListener != null){
actionListener.onUpdate(editText.getText().toString());
}
break;
case Keyboard.KEYCODE_DONE:
if (actionListener != null) {
@@ -86,6 +90,9 @@ public class KeyBoardUtil {
break;
default:
editable.insert(start, Character.toString((char) primaryCode));
if(actionListener != null){
actionListener.onUpdate(editText.getText().toString());
}
break;
}
}
@@ -133,5 +140,6 @@ public class KeyBoardUtil {
public interface ActionListener {
void onComplete(String inputContent);
void onUpdate(String inputContent);
}
}

View File

@@ -7,10 +7,15 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.zhjt.mogo.adas.data.bean.MogoReport
@@ -54,18 +59,63 @@ class TakeOverView @JvmOverloads constructor(
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_PLANNING,
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_LOCATION,
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_CHASSIS,
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_DISTANCE -> {
CallerHmiManager.warningV2X(EventTypeEnumNew.TAKE_OVER_EVENT.poiType, EventTypeEnumNew.TAKE_OVER_EVENT.content, EventTypeEnumNew.TAKE_OVER_EVENT.tts, object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
}
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_DISTANCE ->{
CallerHmiManager.warningV2X(
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.content,
EventTypeEnumNew.TAKE_OVER_EVENT.tts,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
//加入消息盒子
saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X, V2XMsg(
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.content,
EventTypeEnumNew.TAKE_OVER_EVENT.tts
)
)
)
}
override fun onDismiss() {
takeOver = false
visibility = View.GONE
}
}, isFromObu = false)
override fun onDismiss() {
takeOver = false
visibility = View.GONE
}
},isFromObu = false
)
}
//弱网
MogoReport.Code.Error.EMAP.EPARALLEL_AICLOUD_NETWORK_WEAK,
MogoReport.Code.Error.EMAP.EPARALLEL_AICLOUD_CONNECTION_ERROR -> {
CallerHmiManager.warningV2X(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,
EventTypeEnumNew.NETWORK_WEAK_EVENT.tts,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
//加入消息盒子
saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X, V2XMsg(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,
EventTypeEnumNew.NETWORK_WEAK_EVENT.tts
)
)
)
}
override fun onDismiss() {
takeOver = false
visibility = View.GONE
}
},isFromObu = false
)
}
}
}

View File

@@ -1,6 +1,6 @@
<?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_393"
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_80"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#CCFFFFFF"

View File

@@ -1,6 +1,6 @@
<?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_393"
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_80"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#CCFFFFFF"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundCanClickConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_393"
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_80"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#CCFFFFFF"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rvMBoxBubbleList"
android:layout_width="@dimen/dp_393"
android:layout_width="@dimen/dp_400"
android:layout_height="wrap_content"
>

View File

@@ -6,6 +6,7 @@
android:layout_height="match_parent">
<ScrollView
android:id="@+id/svLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -252,8 +253,8 @@
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle"
/>
<TextView
android:id="@+id/tvSpeed"
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etInputSpeed"
android:layout_width="189dp"
android:layout_height="140dp"
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
@@ -263,15 +264,17 @@
android:textColor="#FFFFFFFF"
android:textSize="80dp"
android:gravity="center"
tools:ignore="SpeakableTextPresentCheck"
android:focusableInTouchMode="false"
/>
<ImageView
android:id="@+id/ivSpeedAdd"
android:layout_width="105dp"
android:layout_height="140dp"
app:layout_constraintTop_toTopOf="@id/tvSpeed"
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
app:layout_constraintTop_toTopOf="@id/etInputSpeed"
app:layout_constraintBottom_toBottomOf="@id/etInputSpeed"
app:layout_constraintLeft_toRightOf="@id/etInputSpeed"
android:src="@drawable/icon_speed_add"
/>
@@ -297,8 +300,8 @@
android:textColor="@android:color/white"
android:textSize="42dp"
android:layout_marginLeft="50dp"
app:layout_constraintTop_toTopOf="@id/tvSpeed"
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
app:layout_constraintLeft_toRightOf="@id/tvUnit"
tools:visibility="visible" />

View File

@@ -16,7 +16,6 @@ class AiCloudIdentifyNetWorkModel private constructor(){
val aiCloudIdentifyNetWorkModel by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
AiCloudIdentifyNetWorkModel()
}
}
private fun getNetWorkApi(baseUrl: String = getEagleHost()): IAiCloudIdentifyApiService {
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)