new#增加tts播报
This commit is contained in:
@@ -7,8 +7,9 @@ import java.util.List;
|
||||
* describe:基于目的地预判的道路事件
|
||||
*/
|
||||
public class V2XRecommendRouteEntity {
|
||||
private List<Double> toPoint;
|
||||
private String formatAddress;
|
||||
private List<Double> toPoint; //目的地坐标
|
||||
private String formatAddress; //目的地地址
|
||||
private String tts; //播报内容
|
||||
|
||||
public List<Double> getToPoint() {
|
||||
return toPoint;
|
||||
@@ -25,4 +26,9 @@ public class V2XRecommendRouteEntity {
|
||||
public void setFormatAddress(String formatAddress) {
|
||||
this.formatAddress = formatAddress;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
tts = "主人,我发现前往" + formatAddress + "沿途有拥堵,推荐你导航最优路线,现在开启导航吗?";
|
||||
return tts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.VoicePreemptType
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity
|
||||
import com.mogo.module.v2x.R
|
||||
@@ -28,11 +30,9 @@ class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
v2XMessageEntity?.content?.let {
|
||||
if (v2XMessageEntity!!.isShowState) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
show()
|
||||
} else {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
}
|
||||
} else {
|
||||
@@ -52,7 +52,7 @@ class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
v2XWindow?.let {
|
||||
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
V2XUtils.getApp().resources.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground).toInt())
|
||||
V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams,mogoTopViewStatusListener)
|
||||
V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams, mogoTopViewStatusListener)
|
||||
it.show(v2XMessageEntity.content)
|
||||
|
||||
}
|
||||
@@ -83,6 +83,7 @@ class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
val mogoTopViewStatusListener: IMogoTopViewStatusListener = object : IMogoTopViewStatusListener {
|
||||
private val mainScope = MainScope()
|
||||
override fun onViewAdded(view: View?) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(v2XMessageEntity.content.getTts(),VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY,null)
|
||||
mainScope.launch {
|
||||
delay(1000 * 20)
|
||||
closeWindow()
|
||||
@@ -90,6 +91,7 @@ class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
}
|
||||
|
||||
override fun onViewRemoved(view: View?) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).breakOffSpeak()
|
||||
mainScope.cancel()
|
||||
}
|
||||
|
||||
|
||||
@@ -47,17 +47,6 @@ class V2XRecommendRouteWindow @JvmOverloads constructor(
|
||||
// 配置列表朝向
|
||||
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
rvRoadEventList?.setLayoutManager(layoutManager)
|
||||
rvRoadEventList?.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
super.onScrollStateChanged(recyclerView, newState)
|
||||
if (recyclerView.childCount > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
// countDownV2XEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +59,9 @@ class V2XRecommendRouteWindow @JvmOverloads constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {}
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {
|
||||
|
||||
}
|
||||
|
||||
override fun show(entity: V2XRecommendRouteEntity?) {
|
||||
entity.let {
|
||||
|
||||
Reference in New Issue
Block a user