[8.1.0]OTA升级优化
This commit is contained in:
@@ -61,6 +61,7 @@ import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.OTADownloadStatusDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.OTAPowerOffFinishDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.OTAUpgradeDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.OTAUpgradeResultDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.ToBindingCarDialog
|
||||
@@ -667,6 +668,7 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
private var otaUpgradeDialog: OTAUpgradeDialog ?= null
|
||||
private var otaDownloadStatusDialog: OTADownloadStatusDialog ?= null
|
||||
private var otaUpgradeResultDialog: OTAUpgradeResultDialog ?= null
|
||||
private var otaPowerOffFinishDialog: OTAPowerOffFinishDialog ?= null
|
||||
|
||||
/**
|
||||
* 展示OTA升级弹窗
|
||||
@@ -720,18 +722,42 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
|
||||
/**
|
||||
* 展示OTA升级结果弹窗
|
||||
* @param isShow 是否展示
|
||||
* @param result true升级成功 false升级失败
|
||||
*/
|
||||
override fun showOTAResultDialog(result: Boolean) {
|
||||
override fun showOTAResultDialog(isShow: Boolean,result: Boolean) {
|
||||
ThreadUtils.runOnUiThread{
|
||||
context?.let{
|
||||
if(otaUpgradeResultDialog == null){
|
||||
otaUpgradeResultDialog = OTAUpgradeResultDialog(it)
|
||||
if(isShow){
|
||||
context?.let{
|
||||
if(otaUpgradeResultDialog == null){
|
||||
otaUpgradeResultDialog = OTAUpgradeResultDialog(it)
|
||||
}
|
||||
if(otaUpgradeResultDialog?.isShowing == false){
|
||||
otaUpgradeResultDialog?.show()
|
||||
}
|
||||
otaUpgradeResultDialog?.showResult(result)
|
||||
}
|
||||
if(otaUpgradeResultDialog?.isShowing == false){
|
||||
otaUpgradeResultDialog?.show()
|
||||
}else{
|
||||
if(otaUpgradeResultDialog?.isShowing == true){
|
||||
otaUpgradeResultDialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OTA升级完成且优雅停服完成、需要车辆下电的时候车端告知鹰眼,司机屏弹窗提示用车人执行车辆下电操作
|
||||
*/
|
||||
override fun showOTAPowerOffFinishDialog() {
|
||||
ThreadUtils.runOnUiThread {
|
||||
context?.let {
|
||||
if(otaPowerOffFinishDialog == null){
|
||||
otaPowerOffFinishDialog = OTAPowerOffFinishDialog(it)
|
||||
}
|
||||
if(otaPowerOffFinishDialog?.isShowing == false){
|
||||
otaPowerOffFinishDialog?.show()
|
||||
}
|
||||
otaUpgradeResultDialog?.showResult(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.tools
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
|
||||
import kotlinx.android.synthetic.main.dialog_ota_power_off_finish.tvPowerOffClose
|
||||
|
||||
/**
|
||||
* OTA升级完成且优雅停服完成、需要车辆下电的时候车端告知鹰眼,
|
||||
* 司机屏弹窗提示用车人执行车辆下电操作
|
||||
*/
|
||||
class OTAPowerOffFinishDialog(context: Context) :
|
||||
BaseFloatDialog(context,TAG), LifecycleObserver {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "OTAPowerOffFinishDialog"
|
||||
}
|
||||
|
||||
init{
|
||||
setContentView(R.layout.dialog_ota_power_off_finish)
|
||||
setCanceledOnTouchOutside(false)
|
||||
tvPowerOffClose.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
//语音提示下电重启
|
||||
AIAssist.getInstance(context).speakTTSVoice("优雅停服完成,请操作车辆下电重启")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
|
||||
import com.mogo.eagle.core.utilcode.util.ResourceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinSecondFormat
|
||||
import kotlinx.android.synthetic.main.dialog_ota_upgrade_result.ivUpgradeResult
|
||||
import kotlinx.android.synthetic.main.dialog_ota_upgrade_result.tvResultClose
|
||||
import kotlinx.android.synthetic.main.dialog_ota_upgrade_result.tvResultContent
|
||||
@@ -43,16 +45,18 @@ class OTAUpgradeResultDialog(context: Context) :
|
||||
//升级成功
|
||||
ivUpgradeResult.setImageDrawable(ResourceUtils.getDrawable(R.drawable.icon_ota_upgrade_success))
|
||||
tvResultContent.text = context.resources.getString(R.string.ota_result_success)
|
||||
tvResultTip.text = context.resources.getString(R.string.ota_result_success_tip)
|
||||
tvResultTip.text =
|
||||
String.format(context.resources.getString(R.string.ota_result_success_tip),
|
||||
TimeUtils.millis2String(System.currentTimeMillis()+60000,getHourMinSecondFormat()))
|
||||
//消息盒子和语音提示升级成功结果
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.OTA,
|
||||
OTAMsg(
|
||||
"成功", "车辆部署任务执行结果", "车辆部署任务执行成功,请重启车辆")
|
||||
"成功", "车辆部署任务执行结果", "任务下载完成,一分钟后操作车辆下电重启")
|
||||
)
|
||||
)
|
||||
AIAssist.getInstance(context).speakTTSVoice("车辆部署任务执行成功,请重启车辆")
|
||||
AIAssist.getInstance(context).speakTTSVoice("任务下载完成,一分钟后操作车辆下电重启")
|
||||
}else{
|
||||
//升级失败
|
||||
ivUpgradeResult.setImageDrawable(ResourceUtils.getDrawable(R.drawable.icon_ota_upgrade_fail))
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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"
|
||||
android:layout_width="@dimen/dp_900"
|
||||
android:layout_height="@dimen/dp_620"
|
||||
android:background="@drawable/bg_bone_dialog"
|
||||
app:roundLayoutRadius="@dimen/dp_50">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivPowerOffFinish"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_87"
|
||||
android:contentDescription="@string/ota_result_image"
|
||||
android:src="@drawable/icon_ota_upgrade_success"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPowerOffContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivPowerOffFinish"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_45"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/ota_power_off_finish_title"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPowerOffTip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPowerOffContent"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_36"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="@string/ota_power_off_finish_tip"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPowerOffClose"
|
||||
android:layout_width="@dimen/dp_356"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:gravity="center"
|
||||
android:text="@string/ota_result_close"
|
||||
android:background="@drawable/bg_dialog_btn"
|
||||
android:textColor="@color/color_2EACFF"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_62"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -267,11 +267,13 @@
|
||||
<string name="ota_upgrade_later">稍后升级</string>
|
||||
<string name="ota_download_title">资源下载中</string>
|
||||
<string name="ota_result_image">OTA升级结果图片示例</string>
|
||||
<string name="ota_result_success">⻋辆部署任务执⾏成功</string>
|
||||
<string name="ota_result_success">⻋辆部署任务下载完成</string>
|
||||
<string name="ota_result_fail">⻋辆部署任务执⾏失败</string>
|
||||
<string name="ota_result_success_tip">请重启⻋辆</string>
|
||||
<string name="ota_result_success_tip">已自动发起优雅停服,%s后可操作车辆下电重启</string>
|
||||
<string name="ota_result_fail_tip">请联系管理员</string>
|
||||
<string name="ota_result_close">关闭</string>
|
||||
<string name="ota_power_off_finish_title">车辆优雅停服完成</string>
|
||||
<string name="ota_power_off_finish_tip">请操作车辆下电重启</string>
|
||||
|
||||
<string name="fsm_demo_mode_error">FSM美化模式状态下异常标识</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user