[Feat]添加自动驾驶设置车速功能
This commit is contained in:
@@ -57,7 +57,7 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun recordPackage(): Boolean {
|
||||
return AdasManager.getInstance().recordPackage()
|
||||
return AdasManager.getInstance().recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
}
|
||||
|
||||
override fun setEnableLog(isEnableLog: Boolean) {
|
||||
@@ -72,5 +72,7 @@ class MoGoAutopilotProvider :
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int) {
|
||||
AdasManager.getInstance().setSpeed(speed)
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
@@ -29,9 +30,11 @@ import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView
|
||||
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView
|
||||
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.visible
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.fragment_hmi.*
|
||||
@@ -62,6 +65,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
private var cameraListView: CameraListView? = null
|
||||
private var cameraViewFloat: WarningFloat.Builder? = null
|
||||
|
||||
private var toolsView: AutoPilotAndCheckView? = null
|
||||
// 检测、自动驾驶速度设置
|
||||
private var toolsViewFloat: WarningFloat.Builder? = null
|
||||
|
||||
override fun vipIdentification(visible: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
Logger.d(TAG, "vipIdentification")
|
||||
@@ -80,6 +87,11 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
showCameraList(CallerMonitorManager.getCameraList())
|
||||
}
|
||||
}
|
||||
viewCheckStatus?.setOnClickListener {
|
||||
if (toolsViewFloat == null) {
|
||||
showToolsFloat()
|
||||
}
|
||||
}
|
||||
|
||||
viewShowDebugView.setOnLongClickListener {
|
||||
Log.d(TAG, "长按显示状态工具栏")
|
||||
@@ -126,6 +138,65 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
private fun showToolsFloat() {
|
||||
Logger.d(TAG, "showToolsFloat")
|
||||
context?.let {
|
||||
if (toolsViewFloat == null) {
|
||||
if (toolsView == null) {
|
||||
toolsView = AutoPilotAndCheckView(it)
|
||||
toolsView!!.setClickListener(object : AutoPilotAndCheckView.ClickListener {
|
||||
override fun go2CheckPage() {
|
||||
// 启动检测页面
|
||||
CallerCheckManager.startCheckActivity(context)
|
||||
dismissToolsFloatView()
|
||||
}
|
||||
|
||||
override fun onClose(v: View) {
|
||||
dismissToolsFloatView()
|
||||
}
|
||||
})
|
||||
}
|
||||
toolsViewFloat = WarningFloat.with(it)
|
||||
.setTag("ToolsViewFloat")
|
||||
.setLayout(toolsView!!)
|
||||
.setSidePattern(SidePattern.LEFT)
|
||||
.setGravity(Gravity.LEFT, offsetY = 72)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
toolsViewFloat = null
|
||||
toolsView = null
|
||||
// TODO:("")
|
||||
}
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
toolsViewFloat?.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置文件初始化视图显示
|
||||
*/
|
||||
@@ -468,6 +539,18 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
cameraListView?.showNoSignal()
|
||||
}
|
||||
|
||||
override fun showToolsView() {
|
||||
if (toolsViewFloat == null) {
|
||||
showToolsFloat()
|
||||
} else {
|
||||
ToastUtils.showShort("弹窗状态有误!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun hideToolsView() {
|
||||
dismissToolsFloatView()
|
||||
}
|
||||
|
||||
private fun showCameraList(cameraList: List<CameraEntity>?) {
|
||||
context?.let {
|
||||
if (cameraViewFloat == null) {
|
||||
@@ -544,6 +627,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
private fun dismissToolsFloatView() {
|
||||
toolsViewFloat?.let {
|
||||
WarningFloat.dismiss(it.config.floatTag, false)
|
||||
toolsViewFloat = null
|
||||
toolsView = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d(TAG, "onDestroy")
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.tools
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlinx.android.synthetic.main.view_auto_pilot_check.view.*
|
||||
|
||||
/**
|
||||
* @author ChenFufeng
|
||||
* 设置自动驾驶速度和检测页入口
|
||||
*/
|
||||
class AutoPilotAndCheckView : FrameLayout {
|
||||
|
||||
private val TAG = "AutoPilotAndCheckView"
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
@JvmOverloads
|
||||
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_auto_pilot_check, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
ivCloseIcon.setOnClickListener {
|
||||
clickListener?.onClose(it)
|
||||
}
|
||||
ivCheckIcon.setOnClickListener {
|
||||
clickListener?.go2CheckPage()
|
||||
}
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun go2CheckPage()
|
||||
fun onClose(v: View)
|
||||
}
|
||||
}
|
||||
@@ -27,10 +27,10 @@ class CheckStatusView @JvmOverloads constructor(
|
||||
|
||||
setBackgroundResource(R.drawable.module_ext_check)
|
||||
|
||||
setOnClickListener {
|
||||
// 启动检测页面
|
||||
CallerCheckManager.startCheckActivity(getContext())
|
||||
}
|
||||
// setOnClickListener {
|
||||
// // 启动检测页面
|
||||
// CallerCheckManager.startCheckActivity(getContext())
|
||||
// }
|
||||
}
|
||||
|
||||
private fun showErrorIcon() {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#263869" />
|
||||
<corners android:radius="20px" />
|
||||
<stroke android:color="#5EBFFF" android:width="2px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="960px"
|
||||
android:layout_height="1600px"
|
||||
android:background="@color/notice_check_dialog_bg_color"
|
||||
>
|
||||
|
||||
<View
|
||||
android:layout_width="14px"
|
||||
android:layout_height="50px"
|
||||
android:background="#FF2966EC"
|
||||
android:layout_marginStart="80px"
|
||||
android:layout_marginTop="158px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="84px"
|
||||
android:layout_height="86px"
|
||||
android:text="检测"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="42px"
|
||||
android:layout_marginStart="113px"
|
||||
android:layout_marginTop="140px"
|
||||
android:gravity="center"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCheckIcon"
|
||||
android:layout_width="150px"
|
||||
android:layout_height="150px"
|
||||
android:layout_marginTop="266px"
|
||||
android:layout_marginStart="113px"
|
||||
android:background="@drawable/check_car_nor"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCheck"
|
||||
android:layout_width="128px"
|
||||
android:layout_height="42px"
|
||||
android:text="车辆检测"
|
||||
android:textColor="#FFA7B6F0"
|
||||
android:textSize="32px"
|
||||
android:layout_marginStart="124px"
|
||||
android:layout_marginTop="23px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivCheckIcon"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="14px"
|
||||
android:layout_height="50px"
|
||||
android:background="#FF2966EC"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCheck"
|
||||
android:layout_marginTop="94px"
|
||||
android:layout_marginStart="80px"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeedTitle"
|
||||
android:layout_width="168px"
|
||||
android:layout_height="86px"
|
||||
android:text="车速设置"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="42px"
|
||||
android:gravity="center"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCheck"
|
||||
android:layout_marginStart="113px"
|
||||
android:layout_marginTop="76px"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="390px"
|
||||
android:layout_height="140px"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle"
|
||||
android:background="@drawable/pilot_speed_bg"
|
||||
android:layout_marginTop="40px"
|
||||
android:layout_marginStart="113px"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="92px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:text="30"
|
||||
android:textSize="80px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="93px"
|
||||
android:layout_height="53px"
|
||||
android:text="km/h"
|
||||
android:textColor="#B3FFFFFF"
|
||||
android:textSize="38px"
|
||||
android:layout_marginEnd="28px"
|
||||
/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCloseIcon"
|
||||
android:layout_width="107px"
|
||||
android:layout_height="107px"
|
||||
android:layout_marginTop="65px"
|
||||
android:layout_marginEnd="40px"
|
||||
android:background="@drawable/icon_close_nor"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="500px"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="@color/notice_blue"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user