[6.8.0]冷启动三期进度条
This commit is contained in:
@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.util.FrameAnimatorContainerUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ResourceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo_core_function_devatools.coldstart.ColdStartConfig
|
||||
@@ -50,7 +51,6 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
const val COLD_START_SUCCESS_TICK_TIME = 500L //冷启动成功视图呼吸时长
|
||||
}
|
||||
|
||||
private var ipcConnectStatus = false //连接域控状态,默认是未连接
|
||||
private var ssmConnectStatus = false //SSM连接状态,默认是未连接
|
||||
private var coldStartStatus = false //冷启动状态,默认是未冷启动成功
|
||||
|
||||
@@ -106,6 +106,8 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
CallerColdStartStateListenerManager.removeListener(TAG)
|
||||
coldStartProcessNormalAnim?.release()
|
||||
coldStartProcessAbnormalAnim?.release()
|
||||
connectSSMTimer?.cancel()
|
||||
connectColdStartTimer?.cancel()
|
||||
}
|
||||
|
||||
override fun showColdStartProcessView() {
|
||||
@@ -125,6 +127,8 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
if(status == AdasConstants.IpcConnectionStatus.CONNECTED){
|
||||
//域控连接成功
|
||||
coldStartNormalView()
|
||||
//开启连接SSM倒计时
|
||||
connectSSMProcess()
|
||||
}else{
|
||||
//域控连接失败
|
||||
coldStartAbnormalView()
|
||||
@@ -138,7 +142,7 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
*/
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo){
|
||||
//SSM连接成功
|
||||
coldStartNormalView()
|
||||
connectSSMSuccess()
|
||||
//通过autoPilotReady判断冷启动是否成功
|
||||
if(status.hasAutoPilotReady() && status.autoPilotReady && !coldStartStatus){
|
||||
coldStartStatus = true
|
||||
@@ -156,7 +160,7 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
*/
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf){
|
||||
//SSM连接成功
|
||||
coldStartNormalView()
|
||||
connectSSMSuccess()
|
||||
//版本兼容
|
||||
if(parseVersion(true, statusInf.masterVersion) > 40600){
|
||||
//主动查询冷启动状态
|
||||
@@ -246,6 +250,12 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
*/
|
||||
private fun showColdStartSuccessView(){
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(coldStartProcessNormalAnim?.isPlaying() == true){
|
||||
coldStartProcessNormalAnim?.stop()
|
||||
}
|
||||
if(coldStartProcessAbnormalAnim?.isPlaying() == true){
|
||||
coldStartProcessAbnormalAnim?.stop()
|
||||
}
|
||||
var label = true
|
||||
coldStartSuccessTimer = object: CountDownTimer(COLD_START_SUCCESS_SHOW_TIME,COLD_START_SUCCESS_TICK_TIME){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
@@ -263,6 +273,8 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
override fun onFinish() {
|
||||
ThreadUtils.runOnUiThread {
|
||||
this@ColdStartProcessView.visibility = View.GONE
|
||||
coldStartProcessNormalAnim?.release()
|
||||
coldStartProcessAbnormalAnim?.release()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,10 +288,77 @@ class ColdStartProcessView @JvmOverloads constructor(
|
||||
*/
|
||||
private fun showColdStartFailView(){
|
||||
ThreadUtils.runOnUiThread {
|
||||
|
||||
if(coldStartProcessNormalAnim?.isPlaying() == true){
|
||||
coldStartProcessNormalAnim?.stop()
|
||||
}
|
||||
if(coldStartProcessAbnormalAnim?.isPlaying() == true){
|
||||
coldStartProcessAbnormalAnim?.stop()
|
||||
}
|
||||
ivColdStartProcess.setImageDrawable((ResourceUtils.getDrawable(R.drawable.icon_cold_start_fail_02)))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接SSM过程
|
||||
*/
|
||||
private fun connectSSMProcess(){
|
||||
ThreadUtils.runOnUiThread {
|
||||
connectSSMTimer = object: CountDownTimer(LOAD_SSM_WAITING_TIME,LOAD_SSM_WAITING_TIME){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//将SSM连接状态置为false
|
||||
ssmConnectStatus = false
|
||||
coldStartStatus = false
|
||||
currentColdStartSuccess = false
|
||||
//取消连接SSM超时等待倒计时
|
||||
connectSSMTimer?.cancel()
|
||||
//展示冷启动失败视图
|
||||
showColdStartFailView()
|
||||
}
|
||||
}
|
||||
connectSSMTimer?.start()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SSM连接成功
|
||||
*/
|
||||
private fun connectSSMSuccess(){
|
||||
if(!ssmConnectStatus){
|
||||
coldStartNormalView()
|
||||
//取消连接SSM超时等待倒计时
|
||||
connectSSMTimer?.cancel()
|
||||
//开始启动冷启动等待倒计时
|
||||
coldStartProcess()
|
||||
}
|
||||
ssmConnectStatus = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 冷启动过程
|
||||
*/
|
||||
private fun coldStartProcess(){
|
||||
ThreadUtils.runOnUiThread {
|
||||
connectColdStartTimer = object: CountDownTimer(COLD_START_WAITING_TIME,COLD_START_WAITING_TIME){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
//将冷启动状态置为false
|
||||
coldStartStatus = false
|
||||
currentColdStartSuccess = false
|
||||
//展示冷启动失败视图
|
||||
showColdStartFailView()
|
||||
}
|
||||
}
|
||||
connectColdStartTimer?.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+")
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user