[6.5.0]修复红绿灯显示Bug和自动探查语音播报提示

This commit is contained in:
xuxinchao
2024-07-08 17:56:33 +08:00
parent f5553850d3
commit 6a135049ff
7 changed files with 35 additions and 21 deletions

View File

@@ -52,6 +52,19 @@ class AutomaticExplorationAdapter(val context: Context,val user: Int): RecyclerV
data?.let {
val entity = it[position]
holder.tvExplorationContent.text = entity.explorationContent
if(user == 0){
holder.ivExplorationLoading.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_exploration_loading
))
}else{
holder.ivExplorationLoading.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_exploration_loading_p
))
}
val rotationAnim = ObjectAnimator.ofFloat(holder.ivExplorationLoading, "rotation", 0f, 360f)
rotationAnim.repeatCount = entity.explorationDuration.toInt()/1000
rotationAnim.repeatMode = ValueAnimator.RESTART

View File

@@ -126,7 +126,7 @@ class AutomaticExplorationView @JvmOverloads constructor(
}
if(allComplete){
//语音播放
AIAssist.getInstance(context).speakTTSVoice("道路畅通一切正常蘑菇车助手将持续守候您的出行")
AIAssist.getInstance(context).speakTTSVoice("道路畅通一切正常蘑菇车助手将持续守候您的出行")
//5秒后关闭弹窗
val hideViewTimer =object: CountDownTimer(EXPLORATION_HIDE_TIME,EXPLORATION_HIDE_TIME){
override fun onTick(millisUntilFinished: Long) {

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
@@ -15,6 +16,8 @@ import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import java.util.LinkedList
/**
* 融合红绿灯View
* 鹰眼6.5.0版本需求
@@ -105,18 +108,16 @@ class FusionTrafficLightView @JvmOverloads constructor(
AutopilotSummaryInfo.intersectionServicesNum++
AutopilotSummaryInfo.lightServicesNum++
//首次展示,需要将当前、下一、下二灯态的时间占比绘制出来,只绘制一次
val proportionList = ArrayList<Int>(3)
proportionList.add(0)
proportionList.add(0)
proportionList.add(0)
val proportionList = intArrayOf(0, 0, 0)
//按照绿、黄、红的顺序将灯态时间添加到数组
when (currentState) {
TrafficLightEnum.GREEN -> {
proportionList.add(0,currentDuration)
proportionList[0] = currentDuration
maxGreenDuration = currentDuration
}
TrafficLightEnum.YELLOW -> {
proportionList.add(1,currentDuration)
proportionList[1] = currentDuration
maxYellowDuration = if(currentDuration < 3){
3
}else{
@@ -124,17 +125,17 @@ class FusionTrafficLightView @JvmOverloads constructor(
}
}
else -> {
proportionList.add(2,currentDuration)
proportionList[2] = currentDuration
maxRedDuration = currentDuration
}
}
when(nextState){
TrafficLightEnum.GREEN -> {
proportionList.add(0,nextDuration)
proportionList[0] = nextDuration
maxGreenDuration = nextDuration
}
TrafficLightEnum.YELLOW -> {
proportionList.add(1,nextDuration)
proportionList[1] = nextDuration
maxYellowDuration = if(nextDuration<3){
3
}else{
@@ -142,17 +143,17 @@ class FusionTrafficLightView @JvmOverloads constructor(
}
}
else -> {
proportionList.add(2,nextDuration)
proportionList[2] = nextDuration
maxRedDuration = nextDuration
}
}
when(nextTwoState){
TrafficLightEnum.GREEN -> {
proportionList.add(0,nextTwoDuration)
proportionList[0] = nextTwoDuration
maxGreenDuration = nextTwoDuration
}
TrafficLightEnum.YELLOW -> {
proportionList.add(1,nextTwoDuration)
proportionList[1] = nextTwoDuration
maxYellowDuration = if(nextTwoDuration<3){
3
}else{
@@ -160,11 +161,11 @@ class FusionTrafficLightView @JvmOverloads constructor(
}
}
else -> {
proportionList.add(2,nextTwoDuration)
proportionList[2] = nextTwoDuration
maxRedDuration = nextTwoDuration
}
}
fusionTrafficLightProportion?.updateProportion(proportionList)
fusionTrafficLightProportion?.updateProportion(proportionList.asList())
totalDuration = maxGreenDuration + maxYellowDuration + maxRedDuration
}
//根据当前灯态设置转盘、刻度、指针背景

View File

@@ -27,7 +27,6 @@ public class ProportionChartView extends View {
private static final int DEFAULT_RING_WIDTH = 8;
private float mRingWidth = 0;
private Paint mRingPaint;
private float mRadius;
private RectF mRectF;
//红绿灯绿灯、黄灯、红灯灯色时间
private List<Integer> proportionList = new ArrayList<>();
@@ -125,7 +124,7 @@ public class ProportionChartView extends View {
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
//宽和高分别去掉padding值取min的一半即圆的半径(这里demo没有用到可自行做一些其他计算使用)
mRadius = Math.min(w - getPaddingLeft() - getPaddingRight(), h - getPaddingTop() - getPaddingBottom()) / 2f;
// mRadius = Math.min(w - getPaddingLeft() - getPaddingRight(), h - getPaddingTop() - getPaddingBottom()) / 2f;
}
@Override

View File

@@ -24,7 +24,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@id/tvPromptContent"
android:textSize="@dimen/sp_90"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginStart="@dimen/dp_30"
app:textType="DS_DIGIB_2"
android:layout_marginTop="@dimen/dp_20"
/>
@@ -35,9 +35,10 @@
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
app:layout_constraintLeft_toRightOf="@id/tvTrafficNum"
android:layout_marginLeft="@dimen/dp_2"
android:layout_marginStart="@dimen/dp_2"
android:textSize="@dimen/sp_48"
app:textType="DS_DIGIB_2"
android:layout_marginBottom="@dimen/dp_m_2"
/>
</androidx.constraintlayout.widget.ConstraintLayout>