Merge remote-tracking branch 'origin/dev_robotaxi-d_230412_2.15.0' into dev_robotaxi-d_230412_2.15.0

This commit is contained in:
xinfengkun
2023-04-13 15:28:42 +08:00
4 changed files with 71 additions and 63 deletions

View File

@@ -121,19 +121,19 @@ class MoGoHmiProvider : IMoGoHmiProvider {
return
}
listener?.onShow()
CallerV2XWarningListenerManager.dismiss()
CallerV2XWarningListenerManager.show(v2xType, direction, expireTime)
CallerLogger.d(
"$M_HMI$TAG",
"--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime"
)
lastShowV2XJob?.safeCancel()
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Default) {
delay(expireTime)
}.also { itx ->
lastShowV2XJob = itx
}.invokeOnCompletion {
listener?.onDismiss()
CallerV2XWarningListenerManager.dismiss()
}
Log.d("CODE", "---- 00 ------ tts_content: $ttsContent")

View File

@@ -75,6 +75,9 @@ class V2XFogEventView(context: Context, attrs: AttributeSet) :
override fun show(v2xType: String, direction: WarningDirectionEnum, time: Long) {
ThreadUtils.runOnUiThread {
if(v2xType == EventTypeEnumNew.FOURS_FOG.poiType){
if (animatorSet.isStarted) {
return@runOnUiThread
}
animatorSet.start()
}
}

View File

@@ -18,6 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_v2x_warning.view.*
import java.util.concurrent.atomic.AtomicReference
class V2XWarningView @JvmOverloads constructor(
@@ -35,6 +36,8 @@ class V2XWarningView @JvmOverloads constructor(
showWarning(ALERT_WARNING_NON)
}
private val oldDirection = AtomicReference<WarningDirectionEnum>()
init {
LayoutInflater.from(context).inflate(R.layout.view_v2x_warning, this, true)
}
@@ -45,18 +48,11 @@ class V2XWarningView @JvmOverloads constructor(
}
override fun show(v2xType: String, direction: WarningDirectionEnum, time: Long) {
ThreadUtils.runOnUiThread {
if (direction != ALERT_WARNING_NON) {
showWarning(direction)
}
}
showWarning(direction, time)
}
override fun dismiss(direction: WarningDirectionEnum) {
ThreadUtils.runOnUiThread {
dismissWarning(direction)
}
dismissWarning(direction)
}
/**
@@ -65,12 +61,16 @@ class V2XWarningView @JvmOverloads constructor(
* @see WarningDirectionEnum
*/
private fun showWarning(direction: WarningDirectionEnum, time: Long = ALL_CLOSE_TIMER) {
UiThreadHandler.post {
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
if (direction != ALERT_WARNING_NON) {
removeCallbacks(closeWarningTask)
postDelayed(closeWarningTask, time)
}
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
if (oldDirection.get() == direction) {
return
}
if (direction != ALERT_WARNING_NON) {
oldDirection.set(direction)
removeCallbacks(closeWarningTask)
postDelayed(closeWarningTask, time)
}
post {
when (direction) {
ALERT_WARNING_NON -> {
// nothing
@@ -166,12 +166,16 @@ class V2XWarningView @JvmOverloads constructor(
hmiWarningRightBottomImg.visibility = View.GONE
}
}
val alphaAnimation = AlphaAnimation(0f, 0.88f)
alphaAnimation.duration = 600
alphaAnimation.interpolator = LinearInterpolator()
alphaAnimation.repeatCount = Animation.INFINITE
alphaAnimation.repeatMode = Animation.REVERSE
startAnimation(alphaAnimation)
if (direction == ALERT_WARNING_NON) {
dismissWarning(ALERT_WARNING_ALL)
} else {
val alphaAnimation = AlphaAnimation(0f, 0.88f)
alphaAnimation.duration = 600
alphaAnimation.interpolator = LinearInterpolator()
alphaAnimation.repeatCount = Animation.INFINITE
alphaAnimation.repeatMode = Animation.REVERSE
startAnimation(alphaAnimation)
}
}
}
@@ -180,51 +184,52 @@ class V2XWarningView @JvmOverloads constructor(
return
}
removeCallbacks(closeWarningTask)
when (direction) {
ALERT_WARNING_TOP -> {
hmiWarningRightTopImg.visibility = View.GONE
}
ALERT_WARNING_RIGHT -> {
hmiWarningRightImg.visibility = View.GONE
}
ALERT_WARNING_BOTTOM -> {
hmiWarningBottomImg.visibility = View.GONE
}
ALERT_WARNING_LEFT -> {
hmiWarningLeftImg.visibility = View.GONE
}
ALERT_WARNING_TOP_RIGHT -> {
hmiWarningRightTopImg.visibility = View.GONE
}
ALERT_WARNING_BOTTOM_RIGHT -> {
hmiWarningRightBottomImg.visibility = View.GONE
}
ALERT_WARNING_BOTTOM_LEFT -> {
hmiWarningLeftBottomImg.visibility = View.GONE
}
ALERT_WARNING_TOP_LEFT -> {
hmiWarningLeftTopImg.visibility = View.GONE
}
ALERT_WARNING_ALL -> {
hmiWarningTopImg.visibility = View.GONE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
hmiWarningLeftImg.visibility = View.GONE
hmiWarningLeftTopImg.visibility = View.GONE
hmiWarningLeftBottomImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
hmiWarningRightBottomImg.visibility = View.GONE
}
else -> {
CallerLogger.d("$M_HMI$TAG", "Not Support Direction")
post {
when (direction) {
ALERT_WARNING_TOP -> {
hmiWarningRightTopImg.visibility = View.GONE
}
ALERT_WARNING_RIGHT -> {
hmiWarningRightImg.visibility = View.GONE
}
ALERT_WARNING_BOTTOM -> {
hmiWarningBottomImg.visibility = View.GONE
}
ALERT_WARNING_LEFT -> {
hmiWarningLeftImg.visibility = View.GONE
}
ALERT_WARNING_TOP_RIGHT -> {
hmiWarningRightTopImg.visibility = View.GONE
}
ALERT_WARNING_BOTTOM_RIGHT -> {
hmiWarningRightBottomImg.visibility = View.GONE
}
ALERT_WARNING_BOTTOM_LEFT -> {
hmiWarningLeftBottomImg.visibility = View.GONE
}
ALERT_WARNING_TOP_LEFT -> {
hmiWarningLeftTopImg.visibility = View.GONE
}
ALERT_WARNING_ALL -> {
hmiWarningTopImg.visibility = View.GONE
hmiWarningRightImg.visibility = View.GONE
hmiWarningBottomImg.visibility = View.GONE
hmiWarningLeftImg.visibility = View.GONE
hmiWarningLeftTopImg.visibility = View.GONE
hmiWarningLeftBottomImg.visibility = View.GONE
hmiWarningRightTopImg.visibility = View.GONE
hmiWarningRightBottomImg.visibility = View.GONE
}
else -> {
CallerLogger.d("$M_HMI$TAG", "Not Support Direction")
}
}
clearAnimation()
}
clearAnimation()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerV2XWarningListenerManager.removeListener(TAG)
}
}

View File

@@ -1,6 +1,6 @@
ext {
gradle_version = '3.5.3'
kotlin_version = '1.5.30'
plugin_version = '10.0.0_mogo'
plugin_version = '10.0.1_mogo'
hook_log_plugin_version = '1.7.2'
}