[语音] 查询事件面板 等语音指令定义替换

This commit is contained in:
liujing
2020-11-17 16:29:13 +08:00
parent 012abd52bc
commit 096c3b922a
7 changed files with 128 additions and 76 deletions

View File

@@ -55,6 +55,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
private val mV2XShareEventsFragment = V2XShareEventsFragment()
private val mV2XSurroundingFragment = V2XSurroundingFragment()
companion object {
private var fragment: V2XEventPanelFragment? = null
@@ -124,7 +125,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
fragments = arrayOf(
mV2XScenarioHistoryFragment,
V2XSurroundingFragment(),
mV2XSurroundingFragment,
mV2XShareEventsFragment
)
//禁用预加载
@@ -214,10 +215,14 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
public fun showPanelWithSelectedItem(item: Int) {
mV2XShareEventsFragment.fromVoice = true
if (isPanelShow()) {
if (mRbScenarioHistory?.isChecked == true) {
mV2XScenarioHistoryFragment.ttsForVoiceCheckout()
}
if (mRbSurroundingEvent?.isChecked == true) {
mV2XSurroundingFragment.ttsForVoiceCheckout()
}
if (mRbShareEvents?.isChecked == true) {
mV2XShareEventsFragment.ttsForVoiceCheck()
} else {
selectWithItem(item)
}
} else {
showPanel()
@@ -225,6 +230,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
}
}
private fun selectWithItem(item: Int) {
when (item) {
0 -> {

View File

@@ -134,7 +134,7 @@ public class V2XScenarioHistoryFragment
}
/*
* 出行动态 TTS播报
* 手动点击出行动态 TTS播报
* */
private void ttsForHistoryFirstToday() {
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_HISTORY_SELECTED");
@@ -150,6 +150,19 @@ public class V2XScenarioHistoryFragment
}
}
/*
* 语音查询出行动态 TTS播报
* */
public void ttsForVoiceCheckout(){
if (mV2XHistoryScenarioData.size() > 0) {
AIAssist.getInstance(V2XUtils.getApp()).
speakTTSVoice("为您找到以下动态请查看", null);
} else {
AIAssist.getInstance(V2XUtils.getApp()).
speakTTSVoice("今天暂无出行动态,试试对我说分享拥堵给其他车友吧", null);
}
}
@Override
public void onResume() {
super.onResume();

View File

@@ -138,7 +138,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
}
/*
* 语音打开我的分享,进行播报
* 语音打开我的分享,TTS播报
* */
public void ttsForVoiceCheck() {
int shareNum = resultData.getResult().getEnthusiasmIndex().getShareNum();

View File

@@ -224,7 +224,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
}
/*
* 出行动态 TTS播报
* 手动点击周边事件 TTS播报
* */
private void ttsForSurroundingFirstToday() {
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SURROUNDING_SELECTED");
@@ -237,6 +237,20 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
}
}
/*
* 语音查询周边事件 TTS播报
* */
public void ttsForVoiceCheckout(){
if (poiInfosList.size() > 0) {
AIAssist.getInstance(V2XUtils.getApp()).
speakTTSVoice("为您找到周边以下事件请查看", null);
} else {
AIAssist.getInstance(V2XUtils.getApp()).
speakTTSVoice("周边5公里内无事件试试对我说分享路况给其他车友吧", null);
}
}
private Map<String, SurroundingConstruction> getPoiTypeMap(List<MarkerExploreWay> list) {
Map<String, SurroundingConstruction> mPoiTypeMarkers = new HashMap<>();
for (int i = 0; i < list.size(); i++) {