Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!729
This commit is contained in:
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -42,6 +43,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.selects.*
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,8 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
private var lastShowV2XJob: Job? = null
|
||||
private var context: Context? = null
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.Default + SupervisorJob()) }
|
||||
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
}
|
||||
@@ -137,13 +141,37 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
CallerV2XWarningListenerManager.dismiss()
|
||||
}
|
||||
|
||||
Log.d("CODE", "---- 00 ------ tts_content: $ttsContent")
|
||||
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
|
||||
val last = lastSpeakJob.get()
|
||||
if (last != null && !last.isCompleted) {
|
||||
Log.d("CODE", "---- 0 ------: last: $last")
|
||||
if (last != null && !last.isCompleted) {
|
||||
Log.d("CODE", "---- 1 ------")
|
||||
return
|
||||
}
|
||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
|
||||
speak(it, ttsContent)
|
||||
scope.launch {
|
||||
Log.d("CODE", "---- 2 ------")
|
||||
val d1 = async {
|
||||
Log.d("CODE", "---- 2_1 start ------")
|
||||
speak(it, ttsContent)
|
||||
Log.d("CODE", "---- 2_1 end ------")
|
||||
}
|
||||
val d2 = async {
|
||||
Log.d("CODE", "---- 2_2 start ------")
|
||||
delay((305.75 * ttsContent.length).toLong())
|
||||
Log.d("CODE", "---- 2_2 end ------")
|
||||
}
|
||||
val ret = select<Int> {
|
||||
d1.onAwait { 1 }
|
||||
d2.onAwait { 2 }
|
||||
}
|
||||
if (ret == 1) {
|
||||
d2.cancel()
|
||||
Log.d("CODE", "---- 3 ------")
|
||||
} else {
|
||||
d1.cancel()
|
||||
Log.d("CODE", "---- 4 ------")
|
||||
}
|
||||
}.also { itx ->
|
||||
lastSpeakJob.set(itx)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
@@ -64,9 +65,7 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
@@ -81,7 +80,7 @@ import com.mogo.map.uicontroller.VisualAngleMode.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
|
||||
import kotlinx.android.synthetic.main.view_sop_setting.view.*
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -642,6 +641,18 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbIsDemoMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
tbIsStrictMode?.also {
|
||||
it.isChecked = SharedPrefs.getInstance(Utils.getApp()).getBoolean("MOGO_STRICT_MODE_ENABLED", false)
|
||||
it.setOnCheckedChangeListener { _, isChecked ->
|
||||
SharedPrefs.getInstance(Utils.getApp()).putBoolean("MOGO_STRICT_MODE_ENABLED", isChecked)
|
||||
scope.launch {
|
||||
ToastUtils.showShort("配置生效, 2秒后重启应用...")
|
||||
delay(2000)
|
||||
restartApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 雨天模式,上一次勾选的数据
|
||||
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
//雨天模式
|
||||
@@ -1651,11 +1662,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
mRouteInfoSize = 0
|
||||
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
tbIsDemoMode.text = "关闭美化模式"
|
||||
tbIsDemoMode?.text = "关闭美化模式"
|
||||
} else {
|
||||
tbIsDemoMode.text = "开启美化模式"
|
||||
tbIsDemoMode?.text = "开启美化模式"
|
||||
}
|
||||
|
||||
//obu信息,排查obu相关问题使用
|
||||
tvObuInfoContent.text = mObuInfoStr
|
||||
|
||||
@@ -2058,6 +2068,11 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun restartApp() {
|
||||
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
|
||||
override fun fwThreadClose() {
|
||||
refreshTraceInfo()
|
||||
}
|
||||
|
||||
@@ -230,6 +230,18 @@
|
||||
android:layout_height="1dp"
|
||||
android:background="#F0F0F0" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbIsStrictMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="开启严格模式"
|
||||
android:textOn="关闭严格模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbIsDemoMode"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user