Merge branch 'dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_MogoAP_eagle-220_211207_8.0.17_merge
This commit is contained in:
@@ -189,9 +189,15 @@ public class MoGoAdasListenerImpl implements OnAdasListener {
|
||||
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
|
||||
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
|
||||
// 初始化自动驾驶状态信息
|
||||
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
|
||||
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
|
||||
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
|
||||
if (autopilotStatusInfo.getVersion() == null) {
|
||||
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
|
||||
}
|
||||
if (autopilotStatusInfo.getConnectIP() == null) {
|
||||
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
|
||||
}
|
||||
if (autopilotStatusInfo.getDockVersion() == null) {
|
||||
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
|
||||
}
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogoaicloudtrafficlive
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
|
||||
@@ -7,7 +7,10 @@ import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.transition.*
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
@@ -42,6 +45,7 @@ import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotBadCaseView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.Repository
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.post
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
@@ -91,6 +95,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
private var autoPilotBadCaseView: AutoPilotBadCaseView? = null
|
||||
|
||||
private var onBadCaseShow: (() -> Unit)? = null
|
||||
private var onBadCaseHide: (() -> Unit)? = null
|
||||
|
||||
companion object {
|
||||
private const val MSG_WHAT_DISMISS_BAD_CASE_ENTRY = 0x1010
|
||||
private val CASE_EXPIRE_DURATION = TimeUnit.HOURS.toMillis(4)
|
||||
@@ -154,8 +161,13 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
showBadCaseEntrance(it)
|
||||
}
|
||||
} else {
|
||||
entrance.takeIf { it.visibility != View.VISIBLE }?.also {
|
||||
it.visibility = View.VISIBLE
|
||||
withContext(Dispatchers.Main) {
|
||||
entrance.takeIf { it.visibility != View.VISIBLE }?.also {
|
||||
(entrance.parent as? ViewGroup)?.let { g ->
|
||||
TransitionManager.beginDelayedTransition(g, AutoTransition())
|
||||
}
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
Log.d("QQQ", "record: [$old] hasn't been consumed~~~~" )
|
||||
}
|
||||
@@ -169,7 +181,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
|
||||
private val handler by lazy {
|
||||
Handler(Handler.Callback {
|
||||
Handler(Handler.Callback { it ->
|
||||
if (it.what == MSG_WHAT_DISMISS_BAD_CASE_ENTRY) {
|
||||
val entrance = autoPilotBadCaseEntrance
|
||||
if (entrance != null && entrance.visibility == View.VISIBLE) {
|
||||
@@ -186,7 +198,13 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
dismissBadCaseFloatView()
|
||||
entrance.visibility = View.GONE
|
||||
if (entrance.visibility != View.GONE) {
|
||||
(entrance.parent as? ViewGroup)?.let { g ->
|
||||
TransitionManager.beginDelayedTransition(g, AutoTransition())
|
||||
}
|
||||
entrance.visibility = View.GONE
|
||||
onBadCaseHide?.invoke()
|
||||
}
|
||||
}
|
||||
return@Callback true
|
||||
}
|
||||
@@ -230,7 +248,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
@@ -248,7 +266,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {
|
||||
record ?: return
|
||||
Log.d("QQQ", "onAutopilotRecordResult:$record")
|
||||
@@ -277,27 +295,66 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
private fun showBadCaseEntrance(record: AutoPilotRecordResult) {
|
||||
Log.d("QQQ", "showBadCaseEntrance:$record")
|
||||
lifecycleScope.launch {
|
||||
if (vs_bad_case_entrance?.parent != null) {
|
||||
val inflateView = vs_bad_case_entrance.inflate()
|
||||
autoPilotBadCaseEntrance = inflateView
|
||||
if (HmiBuildConfig.isShowBadCaseView) {
|
||||
if (vsBadCaseToolsView?.parent != null) {
|
||||
val inflateView = vsBadCaseToolsView.inflate()
|
||||
autoPilotBadCaseEntrance = inflateView
|
||||
}
|
||||
}
|
||||
val entrance = autoPilotBadCaseEntrance
|
||||
Log.d("QQQ", "show --- 1 ----")
|
||||
if (entrance != null) {
|
||||
if (entrance.visibility != View.VISIBLE) {
|
||||
(entrance.parent as? ViewGroup)?.let { g ->
|
||||
TransitionManager.beginDelayedTransition(g, AutoTransition())
|
||||
}
|
||||
entrance.visibility = View.VISIBLE
|
||||
}
|
||||
entrance.setTag(R.id.autopilot_badcase_record, record)
|
||||
entrance.onClick {
|
||||
showBadCasesFloat {
|
||||
it.visibility = View.GONE
|
||||
if (it.visibility != View.GONE) {
|
||||
(entrance.parent as? ViewGroup)?.let { g ->
|
||||
TransitionManager.beginDelayedTransition(g, AutoTransition())
|
||||
}
|
||||
it.visibility = View.GONE
|
||||
onBadCaseHide?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
dismissBadCaseEntryAfterSomeTime()
|
||||
} else {
|
||||
onBadCaseShow?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun showBadCaseEntrance(entrance: View) {
|
||||
entrance.lifecycleOwner.lifecycle.addObserver(badCaseEntranceObserver)
|
||||
autoPilotBadCaseEntrance = entrance
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val dao = Repository.dao()
|
||||
dao.getAllUnConsumedRecords()?.first()?.let {
|
||||
showBadCaseEntrance(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val badCaseEntranceObserver = LifecycleEventObserver { _, event ->
|
||||
if (event == ON_DESTROY) {
|
||||
onBadCaseShow = null
|
||||
onBadCaseHide = null
|
||||
autoPilotBadCaseEntrance = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun registerBadCaseCallback(onShow: () -> Unit, onHide: (() -> Unit)?) {
|
||||
onBadCaseShow = onShow
|
||||
onBadCaseHide = onHide
|
||||
}
|
||||
|
||||
private fun showBadCasesFloat(dismiss: (() -> Unit)?) {
|
||||
Log.d("QQQ", "showBadCaseToolsFloat")
|
||||
context?.let { it ->
|
||||
@@ -502,7 +559,6 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
} else {
|
||||
setToolsViewVisibility(View.GONE)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -42,6 +43,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.map.MogoMap
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -62,11 +64,26 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
private var logInfoView: LogInfoView? = null
|
||||
private var logViewAttach = false
|
||||
|
||||
private var mAutoPilotStatusInfo: AutopilotStatusInfo?=null
|
||||
private var mAutoPilotCarStateInfo: AutopilotCarStateInfo?=null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_debug_setting, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时刷新视图数据,防止因为过快更新导致anr异常
|
||||
*/
|
||||
private val timerTaskRefresh = object : TimerTask() {
|
||||
override fun run() {
|
||||
UiThreadHandler.post {
|
||||
// 绘制应用基本信息
|
||||
drawAppInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
// 添加 OBU状态 监听
|
||||
@@ -82,6 +99,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterForeground()
|
||||
}
|
||||
// 开启定时查询速度
|
||||
Timer().schedule(timerTaskRefresh, Date(), 100)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -99,6 +118,11 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterBackground()
|
||||
}
|
||||
try {
|
||||
timerTaskRefresh.cancel()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
@@ -260,10 +284,16 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.IS_DEMO_MODE, false)
|
||||
CallerAutoPilotManager.setDemoMode(isDemoMode)
|
||||
tbIsDemoMode.isChecked = isDemoMode
|
||||
if (isDemoMode){
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
}
|
||||
// 演示模式
|
||||
tbIsDemoMode.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
CallerAutoPilotManager.setDemoMode(isChecked)
|
||||
FunctionBuildConfig.isDemoMode = isChecked
|
||||
if (!FunctionBuildConfig.isDemoMode){
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
SharedPrefsMgr.getInstance(context).putBoolean(MoGoConfig.IS_DEMO_MODE, isChecked)
|
||||
}
|
||||
|
||||
@@ -371,35 +401,33 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
AppConfigInfo.isConnectSocket = DebugConfig.isDownloadSnapshot()
|
||||
|
||||
// 将数据绘制
|
||||
tvAppInfo.text = AppConfigInfo.toString()
|
||||
tvAppInfo.text = Html.fromHtml(AppConfigInfo.toString())
|
||||
|
||||
tvAutopilotInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo)
|
||||
|
||||
tvCarInfo.text =
|
||||
"GPS时间:${mAutoPilotCarStateInfo?.values?.satelliteTime}\n" +
|
||||
"自车经纬度:\n${mAutoPilotCarStateInfo?.values?.lon}\n${mAutoPilotCarStateInfo?.values?.lat}\n"
|
||||
}
|
||||
|
||||
/**
|
||||
* OBU状态回调
|
||||
*/
|
||||
override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) {
|
||||
UiThreadHandler.post {
|
||||
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
|
||||
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
|
||||
|
||||
AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
|
||||
AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
|
||||
drawAppInfo()
|
||||
}
|
||||
AppConfigInfo.obuSdkVersion = obuStatusInfo.obuSdkVersion
|
||||
AppConfigInfo.isConnectObu = obuStatusInfo.obuStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态回调
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
UiThreadHandler.post {
|
||||
tvAutopilotInfo.post {
|
||||
tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo)
|
||||
mAutoPilotStatusInfo = autoPilotStatusInfo
|
||||
|
||||
AppConfigInfo.adasSdkVersion = autoPilotStatusInfo.version
|
||||
AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus
|
||||
drawAppInfo()
|
||||
}
|
||||
}
|
||||
AppConfigInfo.adasSdkVersion = autoPilotStatusInfo.version
|
||||
AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
|
||||
@@ -408,13 +436,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
//Logger.d(TAG, "autoPilotCarStateInfo:$autoPilotCarStateInfo")
|
||||
UiThreadHandler.post {
|
||||
tvAutopilotInfo.post {
|
||||
tvCarInfo.text =
|
||||
"GPS时间:${autoPilotCarStateInfo?.values?.satelliteTime}\n" +
|
||||
"自车经纬度:\n${autoPilotCarStateInfo?.values?.lon}\n${autoPilotCarStateInfo?.values?.lat}\n"
|
||||
}
|
||||
}
|
||||
mAutoPilotCarStateInfo = autoPilotCarStateInfo
|
||||
}
|
||||
|
||||
override fun onAutopilotSNRequest() {
|
||||
|
||||
@@ -99,8 +99,8 @@
|
||||
app:layout_goneMarginStart="50px" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_bad_case_entrance"
|
||||
android:inflatedId="@+id/bad_case_entrance"
|
||||
android:id="@+id/vsBadCaseToolsView"
|
||||
android:inflatedId="@+id/badCaseToolsView"
|
||||
android:layout_width="@dimen/module_hmi_check_size"
|
||||
android:layout_height="@dimen/module_hmi_check_size"
|
||||
android:layout_marginStart="25px"
|
||||
|
||||
@@ -31,27 +31,6 @@
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- <LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="PAD系统时间:"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/tvNowTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:format12Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
|
||||
android:format24Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
</LinearLayout>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppInfo"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -44,38 +44,26 @@ object AppConfigInfo {
|
||||
// 是否OBU
|
||||
var isConnectObu: Boolean = false
|
||||
|
||||
/*应用配置信息,这里的配置将影响功能,用来替换productFlavors配置的那种编译渠道*/
|
||||
// GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
var GPS_PROVIDER = 1
|
||||
|
||||
// 是否在地图上绘制感知元素
|
||||
// 网络下发 false--不绘制,true--绘制
|
||||
var TRAFFIC_PROVIDER_NET_STATUS = false
|
||||
|
||||
// 域控制器 false--不绘制,true--绘制
|
||||
var TRAFFIC_PROVIDER_AUTOPILOT_STATUS = true
|
||||
|
||||
// OBU false--不绘制,true--绘制
|
||||
var TRAFFIC_PROVIDER_OBU_STATUS = false
|
||||
|
||||
// 进入应用的地图模式。0-2D模式,1-VR模式
|
||||
var MAP_STYLE_MODE = 1
|
||||
|
||||
override fun toString(): String {
|
||||
return "应用名称:${appName}\n" +
|
||||
"应用版本:${appVersionCode}\n" +
|
||||
"应用版本名称:${appVersionName}\n" +
|
||||
"Git分支名称:${workingBranchName}\n" +
|
||||
"Git分支HASH:${workingBranchHash}\n" +
|
||||
"HD-MAP-SDK版本:${mapSdkVersion}\n" +
|
||||
"ADAS-SDK版本:${adasSdkVersion}\n" +
|
||||
"OBU-SDK版本:${obuSdkVersion}\n" +
|
||||
"PAD唯一标志:${uniqueDeviceId}\n" +
|
||||
//"mogoToken:${mogoToken}\n"+
|
||||
"中台分配的SN:${mogoSN}\n" +
|
||||
"网络是否正常:${isConnectNet}\n" +
|
||||
return "<font color='red' size='30'>-------------------应用信息--------------------</font><br/>" +
|
||||
"应用名称:${appName}<br/>" +
|
||||
"应用版本号:${appVersionCode}<br/>" +
|
||||
"应用版本名称:${appVersionName}<br/>" +
|
||||
"<font color='red' size='30'>------------------Git信息---------------------</font><br/>" +
|
||||
"Git分支名称:<br/>${workingBranchName}<br/>" +
|
||||
"Git分支HASH:${workingBranchHash}<br/>" +
|
||||
"<font color='red' size='30'>------------------依赖信息---------------------</font><br/>" +
|
||||
"MAP-SDK版本:${mapSdkVersion}<br/>" +
|
||||
"ADAS-SDK版本:${adasSdkVersion}<br/>" +
|
||||
"OBU-SDK版本:${obuSdkVersion}<br/>" +
|
||||
"<font color='red' size='30'>------------------鉴权信息---------------------</font><br/>" +
|
||||
"PAD唯一标志:${uniqueDeviceId}<br/>" +
|
||||
//"mogoToken:${mogoToken}<br/>"+
|
||||
"中台分配的SN:${mogoSN}<br/>" +
|
||||
"<font color='red' size='30'>------------------连接信息---------------------</font><br/>" +
|
||||
"当前网络服务连接:${netMode} -- ${
|
||||
(when (netMode) {
|
||||
when (netMode) {
|
||||
2 -> {
|
||||
"测试环境"
|
||||
}
|
||||
@@ -88,10 +76,35 @@ object AppConfigInfo {
|
||||
else -> {
|
||||
"未知环境"
|
||||
}
|
||||
})
|
||||
}\n" +
|
||||
"Socket是否正常:${isConnectSocket}\n" +
|
||||
"ADAS连接是否正常:${isConnectAutopilot}\n" +
|
||||
"OBU连接是否正常:${isConnectObu}\n"
|
||||
}
|
||||
}<br/>" +
|
||||
"网络是否正常:${
|
||||
if (isConnectNet) {
|
||||
"<font color='green'>"
|
||||
} else {
|
||||
"<font color='red'>"
|
||||
}
|
||||
}${isConnectNet}</font><br/>" +
|
||||
"Socket是否正常:${
|
||||
if (isConnectSocket) {
|
||||
"<font color='green'>"
|
||||
} else {
|
||||
"<font color='red'>"
|
||||
}
|
||||
}${isConnectSocket}</font><br/>" +
|
||||
"ADAS连接是否正常:${
|
||||
if (isConnectAutopilot) {
|
||||
"<font color='green'>"
|
||||
} else {
|
||||
"<font color='red'>"
|
||||
}
|
||||
}${isConnectAutopilot}</font><br/>" +
|
||||
"OBU连接是否正常:${
|
||||
if (isConnectObu) {
|
||||
"<font color='green'>"
|
||||
} else {
|
||||
"<font color='red'>"
|
||||
}
|
||||
}${isConnectObu}</font><br/>"
|
||||
}
|
||||
}
|
||||
@@ -60,12 +60,12 @@ class AutopilotStatusInfo : Serializable {
|
||||
var rtk = 0
|
||||
|
||||
/**
|
||||
* 自动驾驶状态 0非自动驾驶,1自动驾驶
|
||||
* 底盘的自动驾驶状态 0非自动驾驶,1自动驾驶
|
||||
*/
|
||||
var pilotmode = 0
|
||||
|
||||
/**
|
||||
* 自动驾驶状态 0非自动驾驶,1自动驾驶
|
||||
* 底盘的自动驾驶状态 0非自动驾驶,1自动驾驶
|
||||
*/
|
||||
var control_pilotmode = 0
|
||||
|
||||
|
||||
@@ -29,4 +29,10 @@ object HmiBuildConfig {
|
||||
*/
|
||||
@JvmField
|
||||
var isShowToolsView = true
|
||||
|
||||
/**
|
||||
* 是否展示BadCase按钮
|
||||
*/
|
||||
@JvmField
|
||||
var isShowBadCaseView = true
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.warning
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
@@ -179,4 +180,17 @@ interface IMoGoWaringProvider {
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode : Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int)
|
||||
|
||||
|
||||
/**
|
||||
* 显示BadCase入口
|
||||
*/
|
||||
fun showBadCaseEntrance(entrance: View)
|
||||
|
||||
/**
|
||||
* 注册badcase入口展示和隐藏的回调
|
||||
* 当[onShow]被调用时,调用[showBadCaseEntrance]
|
||||
* [onHide]回调不用关心,可以不注册
|
||||
*/
|
||||
fun registerBadCaseCallback(onShow:() -> Unit, onHide: (() -> Unit)?)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import android.view.View
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
@@ -16,16 +17,16 @@ import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
* HMI 调用者管理,这里对外及其他模块提供功能的调用,用啥写啥,不要过度设计,不允许直接将Provider暴露出去
|
||||
*/
|
||||
object CallerHmiManager : CallerBase() {
|
||||
private val waringProviderApi: IMoGoWaringProvider
|
||||
private val waringProviderApi
|
||||
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI)
|
||||
.navigation() as IMoGoWaringProvider;
|
||||
.navigation() as? IMoGoWaringProvider;
|
||||
|
||||
/**
|
||||
* 隐藏 脉速表
|
||||
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
|
||||
*/
|
||||
fun setSpeedChartViewVisibility(visibility: Int) {
|
||||
waringProviderApi.setSpeedChartViewVisibility(visibility)
|
||||
waringProviderApi?.setSpeedChartViewVisibility(visibility)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
|
||||
*/
|
||||
fun setAutopilotStatusViewVisibility(visibility: Int) {
|
||||
waringProviderApi.setAutopilotStatusViewVisibility(visibility)
|
||||
waringProviderApi?.setAutopilotStatusViewVisibility(visibility)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +42,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
|
||||
*/
|
||||
fun setPerspectiveSwitchViewVisibility(visibility: Int) {
|
||||
waringProviderApi.setPerspectiveSwitchViewVisibility(visibility)
|
||||
waringProviderApi?.setPerspectiveSwitchViewVisibility(visibility)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,21 +50,21 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
|
||||
*/
|
||||
fun setToolsViewVisibility(visibility: Int) {
|
||||
waringProviderApi.setToolsViewVisibility(visibility)
|
||||
waringProviderApi?.setToolsViewVisibility(visibility)
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制转向灯和刹车功能
|
||||
*/
|
||||
fun setTurnLightFunction(isOpen: Boolean) {
|
||||
waringProviderApi.setTurnLightFunction(isOpen)
|
||||
waringProviderApi?.setTurnLightFunction(isOpen)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关DebugView
|
||||
*/
|
||||
fun toggleDebugView(){
|
||||
waringProviderApi.toggleDebugView()
|
||||
waringProviderApi?.toggleDebugView()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +76,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) {
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime)
|
||||
waringProviderApi?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +84,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param tag 弹窗标识
|
||||
*/
|
||||
fun disableWarningV2X(tag: String?) {
|
||||
waringProviderApi.disableWarningV2X(tag)
|
||||
waringProviderApi?.disableWarningV2X(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,42 +93,42 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
fun showWarningTrafficLight(checkLightId: Int) {
|
||||
waringProviderApi.showWarningTrafficLight(checkLightId)
|
||||
waringProviderApi?.showWarningTrafficLight(checkLightId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警
|
||||
*/
|
||||
fun disableWarningTrafficLight() {
|
||||
waringProviderApi.disableWarningTrafficLight()
|
||||
waringProviderApi?.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
/**
|
||||
* 红绿灯是否展示
|
||||
*/
|
||||
fun isWarningTrafficLightShow(): Boolean {
|
||||
return waringProviderApi.isWarningTrafficLightShow()
|
||||
return waringProviderApi?.isWarningTrafficLightShow() ?: false
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改红灯倒计时
|
||||
*/
|
||||
fun changeCountdownRed(redNum: Int) {
|
||||
waringProviderApi.changeCountdownRed(redNum)
|
||||
waringProviderApi?.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改黄灯倒计时
|
||||
*/
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
waringProviderApi.changeCountdownYellow(yellowNum)
|
||||
waringProviderApi?.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownGreen(greenNum: Int) {
|
||||
waringProviderApi.changeCountdownGreen(greenNum)
|
||||
waringProviderApi?.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +137,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
waringProviderApi.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
waringProviderApi?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,14 +146,14 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param limitingSpeed 限速速度
|
||||
*/
|
||||
fun showLimitingVelocity(limitingSpeed: Int) {
|
||||
waringProviderApi.showLimitingVelocity(limitingSpeed)
|
||||
waringProviderApi?.showLimitingVelocity(limitingSpeed)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭限速预警
|
||||
*/
|
||||
fun disableLimitingVelocity() {
|
||||
waringProviderApi.disableLimitingVelocity()
|
||||
waringProviderApi?.disableLimitingVelocity()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +162,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @see WarningDirectionEnum
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum) {
|
||||
waringProviderApi.showWarning(direction)
|
||||
waringProviderApi?.showWarning(direction)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,14 +172,14 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param closeTime 倒计时
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
waringProviderApi.showWarning(direction, closeTime)
|
||||
waringProviderApi?.showWarning(direction, closeTime)
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动消失边框预警
|
||||
*/
|
||||
fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
waringProviderApi.dismissWarning(direction)
|
||||
waringProviderApi?.dismissWarning(direction)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,7 +188,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param trafficStylePushData
|
||||
*/
|
||||
fun showTrafficBanner(trafficStylePushData: NoticeTrafficStylePushData?) {
|
||||
waringProviderApi.showNoticeForTrafficWithData(trafficStylePushData)
|
||||
waringProviderApi?.showNoticeForTrafficWithData(trafficStylePushData)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,21 +196,21 @@ object CallerHmiManager : CallerBase() {
|
||||
*
|
||||
*/
|
||||
fun showNoticeNormalData(noticeNormal: NoticeNormalData) {
|
||||
waringProviderApi.showNoticeNormalData(noticeNormal)
|
||||
waringProviderApi?.showNoticeNormalData(noticeNormal)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示VIP标识
|
||||
*/
|
||||
fun vipIdentification(visible: Boolean) {
|
||||
waringProviderApi.vipIdentification(visible)
|
||||
waringProviderApi?.vipIdentification(visible)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启道路视频直播
|
||||
*/
|
||||
fun startRoadCameraLive(flvUrl: String) {
|
||||
waringProviderApi.startRoadCameraLive(flvUrl)
|
||||
waringProviderApi?.startRoadCameraLive(flvUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +219,7 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param light
|
||||
*/
|
||||
fun showTurnLight(light: Int) {
|
||||
waringProviderApi.showTurnLight(light)
|
||||
waringProviderApi?.showTurnLight(light)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,19 +228,19 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param brakeLight
|
||||
*/
|
||||
fun showBrakeLight(brakeLight: Int) {
|
||||
waringProviderApi.showBrakeLight(brakeLight)
|
||||
waringProviderApi?.showBrakeLight(brakeLight)
|
||||
}
|
||||
|
||||
fun showNoSignalView() {
|
||||
waringProviderApi.showNoSignView()
|
||||
waringProviderApi?.showNoSignView()
|
||||
}
|
||||
|
||||
fun showToolsView() {
|
||||
waringProviderApi.showToolsView()
|
||||
waringProviderApi?.showToolsView()
|
||||
}
|
||||
|
||||
fun hideToolsView() {
|
||||
waringProviderApi.hideToolsView()
|
||||
waringProviderApi?.hideToolsView()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,8 +254,23 @@ object CallerHmiManager : CallerBase() {
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode : Int, downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int){
|
||||
waringProviderApi.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
waringProviderApi?.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示BadCase入口
|
||||
*/
|
||||
fun showBadCaseEntrance(entrance: View) {
|
||||
waringProviderApi?.showBadCaseEntrance(entrance)
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册badcase入口展示和隐藏的回调
|
||||
* 当[onShow]被调用时,调用[showBadCaseEntrance]
|
||||
* [onHide]回调不用关心,可以不注册
|
||||
*/
|
||||
fun registerBadCaseCallback(onShow:() -> Unit, onHide: (() -> Unit)?) {
|
||||
waringProviderApi?.registerBadCaseCallback(onShow, onHide)
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -8,10 +8,60 @@ import android.util.TypedValue
|
||||
import android.view.View
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.IntRange
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.LifecycleRegistry
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.R
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import java.util.*
|
||||
|
||||
val <T: View> T.lifecycleOwner: LifecycleOwner
|
||||
get() = getTag(R.id.view_lifecycle_owner) as? LifecycleOwner ?: object : LifecycleOwner, LifecycleEventObserver {
|
||||
|
||||
private val lifecycle = LifecycleRegistry(this)
|
||||
|
||||
init {
|
||||
if (ViewCompat.isAttachedToWindow(this@lifecycleOwner)) {
|
||||
lifecycle.let {
|
||||
if (it.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
|
||||
it.currentState = Lifecycle.State.CREATED
|
||||
}
|
||||
}
|
||||
}
|
||||
addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View?) {
|
||||
lifecycle.let {
|
||||
if (it.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
|
||||
it.currentState = Lifecycle.State.CREATED
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(v: View?) {
|
||||
lifecycle.let {
|
||||
if (it.currentState.isAtLeast(Lifecycle.State.CREATED)) {
|
||||
this@lifecycleOwner.removeOnAttachStateChangeListener(this)
|
||||
it.currentState = Lifecycle.State.DESTROYED
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
|
||||
lifecycle.currentState = event.targetState
|
||||
}
|
||||
|
||||
override fun getLifecycle(): Lifecycle {
|
||||
return lifecycle
|
||||
}
|
||||
|
||||
}.also {
|
||||
setTag(R.id.view_lifecycle_owner, it)
|
||||
}
|
||||
|
||||
fun View.onClick(block: (View) -> Unit) {
|
||||
this.setOnClickListener {
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.doOnAttach
|
||||
import androidx.core.view.doOnDetach
|
||||
import androidx.lifecycle.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.util.R
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -106,52 +107,6 @@ interface IReminder : Comparable<IReminder> {
|
||||
}
|
||||
}
|
||||
|
||||
val <T: View> T.lifecycleOwner: LifecycleOwner
|
||||
get() = getTag(R.id.view_lifecycle_owner) as? LifecycleOwner ?: object : LifecycleOwner, LifecycleEventObserver {
|
||||
|
||||
private val lifecycle = LifecycleRegistry(this)
|
||||
|
||||
init {
|
||||
if (ViewCompat.isAttachedToWindow(this@lifecycleOwner)) {
|
||||
lifecycle.let {
|
||||
if (it.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
|
||||
it.currentState = Lifecycle.State.CREATED
|
||||
}
|
||||
}
|
||||
}
|
||||
addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
||||
override fun onViewAttachedToWindow(v: View?) {
|
||||
lifecycle.let {
|
||||
if (it.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
|
||||
it.currentState = Lifecycle.State.CREATED
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewDetachedFromWindow(v: View?) {
|
||||
lifecycle.let {
|
||||
if (it.currentState.isAtLeast(Lifecycle.State.CREATED)) {
|
||||
this@lifecycleOwner.removeOnAttachStateChangeListener(this)
|
||||
it.currentState = Lifecycle.State.DESTROYED
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
|
||||
lifecycle.currentState = event.targetState
|
||||
}
|
||||
|
||||
override fun getLifecycle(): Lifecycle {
|
||||
return lifecycle
|
||||
}
|
||||
|
||||
}.also {
|
||||
setTag(R.id.view_lifecycle_owner, it)
|
||||
}
|
||||
|
||||
|
||||
val <T: PopupWindow> T.lifecycleOwner: LifecycleOwner
|
||||
get() = popupWindowLifecycleMap[this]
|
||||
?: object : LifecycleOwner, LifecycleEventObserver {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.utilcode.reminder.api.impl
|
||||
import android.view.View
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.IReminder
|
||||
|
||||
abstract class ViewReminder(private val content: View): IReminder {
|
||||
|
||||
Reference in New Issue
Block a user