This commit is contained in:
wangcongtao
2020-04-22 15:15:41 +08:00
parent cc118fddb4
commit 9e478e4a21
11 changed files with 279 additions and 157 deletions

View File

@@ -135,7 +135,7 @@ public class MapPresenter extends Presenter< MapView > implements
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
}else if (key_type == 20009) {
} else if ( key_type == 20009 ) {
onOpenNavi();
}
@@ -173,12 +173,14 @@ public class MapPresenter extends Presenter< MapView > implements
if ( mStatusManager.isMainPageOnResume() ) {
mStatusManager.setDisplayOverview( TAG, false );
mView.getUIController().recoverLockMode();
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
} else {
mLauncher.backToLauncher( getContext() );
UiThreadHandler.postDelayed( () -> {
try {
mStatusManager.setDisplayOverview( TAG, false );
mView.getUIController().recoverLockMode();
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
} catch ( Exception e ) {
e.printStackTrace();
}
@@ -195,9 +197,20 @@ public class MapPresenter extends Presenter< MapView > implements
Logger.d( TAG, "ADAS模式忽略该请求." );
return;
}
mStatusManager.setUserInteractionStatus( TAG, true, false );
mStatusManager.setDisplayOverview( TAG, true );
mView.getUIController().displayOverview( mDisplayOverviewBounds );
if ( !mStatusManager.isMainPageOnResume() ) {
mStatusManager.setUserInteractionStatus( TAG, true, false );
mStatusManager.setDisplayOverview( TAG, true );
mView.getUIController().displayOverview( mDisplayOverviewBounds );
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
} else {
mLauncher.backToLauncher( getContext() );
UiThreadHandler.postDelayed( () -> {
mStatusManager.setUserInteractionStatus( TAG, true, false );
mStatusManager.setDisplayOverview( TAG, true );
mView.getUIController().displayOverview( mDisplayOverviewBounds );
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
}, 2_000L );
}
}
private void zoomMap( boolean zoomIn ) {
@@ -225,11 +238,12 @@ public class MapPresenter extends Presenter< MapView > implements
}
}
private void onOpenNavi(){
private void onOpenNavi() {
mLauncher.backToLauncher( getContext() );
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() && !mStatusManager.isSearchUIShow() ) {
mMogoAddressManager.goSearch();
}
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开" );
}
@Override
@@ -261,6 +275,10 @@ public class MapPresenter extends Presenter< MapView > implements
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_right_margin ),
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_bottom_margin )
);
for ( String cmd : VoiceConstants.sUnUnRegisterCmds ) {
mMogoIntentManager.registerIntentListener( cmd, this );
}
}
@Override
@@ -342,34 +360,20 @@ public class MapPresenter extends Presenter< MapView > implements
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
case VoiceConstants.CMD_MAP_3D:
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
break;
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
break;
//case VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP:
//case VoiceConstants.CMD_MAP_GO_COMPANY:
// mSearchManager.goCompany();
// break;
//
//case VoiceConstants.CMD_MAP_GO_HOME_UN_WAKEUP:
//case VoiceConstants.CMD_MAP_GO_HOME:
// mSearchManager.goHome();
// break;
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
case VoiceConstants.CMD_MAP_HISTORY:
onOpenNavi();
break;
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP:
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
mSearchManager.showMain();
break;
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
case VoiceConstants.CMD_MAP_NIGHT_MODE:
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
@@ -391,25 +395,15 @@ public class MapPresenter extends Presenter< MapView > implements
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
break;
//case VoiceConstants.CMD_MAP_GEO_NEARBY:
// if (intent != null) {
// String keywords = intent.getStringExtra("keyword");
// mSearchManager.showCategory(keywords);
// }
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP:
mSearchManager.speakDraft();
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
break;
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP:
mSearchManager.speakDetail();
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
break;
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
break;

View File

@@ -121,7 +121,7 @@ public class VoiceConstants {
*/
public static final String CMD_MAP_GEO_NEARBY = "com.ileja.navi.geo.nearby";
public static final String CMD_MAP_GEO_NEARBY_WAKEUP = "CMD_MAP_GEO_NEARBY_WAKEUP";
public static final String[] CMD_MAP_GEO_NEARBY_TRIGGER_WORDS = {"查找附近的","查找附近的"};
public static final String[] CMD_MAP_GEO_NEARBY_TRIGGER_WORDS = {"查找附近的", "查找附近的"};
/**
* 车头朝上
@@ -136,12 +136,12 @@ public class VoiceConstants {
public static final String CMD_MAP_NORTH_UP_MODE = "com.ileja.traffic.north.up";
public static final String CMD_MAP_NORTH_UP_MODE_UN_WAKEUP = "CMD_MAP_NORTH_UP_MODE_UN_WAKEUP";
public static final String[] CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS = {"北朝上"};
/**
/**
* 简洁模式
*/
public static final String CMD_MAP_SPEAK_DRAFT_MODE = "com.ileja.traffic.speak.draft";
public static final String CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP = "CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP";
public static final String[] CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS = {"简洁模式","简洁播报"};
public static final String[] CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS = {"简洁模式", "简洁播报"};
/**
@@ -149,40 +149,18 @@ public class VoiceConstants {
*/
public static final String CMD_MAP_SPEAK_DETAIL_MODE = "com.ileja.traffic.speak.detail";
public static final String CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP = "CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP";
public static final String[] CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS = {"详细模式","详细播报"};
public static final String[] CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS = {"详细模式", "详细播报"};
/**
* 播报当前导航剩余里程和时间
*/
public static final String CMD_MAP_SPEAK_REMAIN = "com.ileja.traffic.speak.remain";
public static final String CMD_MAP_SPEAK_REMAIN_UN_WAKEUP = "CMD_MAP_SPEAK_REMAIN_UN_WAKEUP";
public static final String[] CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS = {"还有多久","多久到","还有多远"};
//mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OVERVIEW_BACK_NAVI).setWord("继续导航").setPinyin("ji xu dao hang").setThreshold("0.21").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("关闭导航").setPinyin("guan bi dao hang").setThreshold("0.19").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("关闭地图").setPinyin("guan bi di tu").setThreshold("0.215").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("退出导航").setPinyin("tui chu dao hang").setThreshold("0.2").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_CLOSEMAP).setWord("退出地图").setPinyin("tui chu di tu").setThreshold("0.16").addGreeting(""));
//
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_CAR).setWord("车头朝上").setPinyin("che tou chao shang").setThreshold("0.1").addGreeting("车头朝上"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_NORTH).setWord("北朝上").setPinyin("bei chao shang").setThreshold("0.14").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_3D).setWord("三地模式").setPinyin("san di mo shi").setThreshold("0.13").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_2D_NORTH).setWord("二地模式").setPinyin("er di mo shi").setThreshold("0.185").addGreeting(""));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_FLEX_UP).setWord("放大地图").setPinyin("fang da di tu").setThreshold("0.17").addGreeting("已放大"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_FLEX_DOWN).setWord("缩小地图").setPinyin("suo xiao di tu").setThreshold("0.125").addGreeting("已缩小"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_DAY).setWord("白天模式").setPinyin("bai tian mo shi").setThreshold("0.105").addGreeting("切换到白天模式"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_NIGHT).setWord("夜间模式").setPinyin("ye jian mo shi").setThreshold("0.11").addGreeting("切换到夜间模式"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_MODE_AUTO).setWord("自动模式").setPinyin("zi dong mo shi").setThreshold("0.11").addGreeting("切换到自动模式"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_OPEN_LIVE).setWord("打开路况").setPinyin("da kai lu kuang").setThreshold("0.125").addGreeting("路况已打开"));
// mWakeupWordsList.add(new WakeupWord().setAction(NavConstants.WakeUpCommandApi.COMMAND_MAP_NAVI_CLOSE_LIVE).setWord("关闭路况").setPinyin("guan bi lu kuang").setThreshold("0.1").addGreeting("路况已关闭"));
public static final String[] CMD_MAP_SPEAK_REMAIN_TRIGGER_WORDS = {"还有多久", "多久到", "还有多远"};
public static final Map< String, String[] > sVoiceCmds = new HashMap<>();
public static final List< String > sCmds = new ArrayList<>();
public static final List< String > sUnUnRegisterCmds = new ArrayList<>();
static {
// 免唤醒
@@ -217,16 +195,16 @@ public class VoiceConstants {
sCmds.add( VoiceConstants.CMD_MAP_TRAFFIC_MODE );
sCmds.add( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE );
sCmds.add( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE );
sCmds.add( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE );
sCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
sCmds.add( VoiceConstants.CMD_MAP_CAR_UP_MODE );
sCmds.add( VoiceConstants.CMD_MAP_NORTH_UP_MODE );
//sCmds.add( VoiceConstants.CMD_MAP_GO_HOME );
//sCmds.add( VoiceConstants.CMD_MAP_GO_COMPANY );
sCmds.add( VoiceConstants.CMD_MAP_HISTORY );
sCmds.add( VoiceConstants.CMD_MAP_STOP_NAVI_MODE );
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE );
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE );
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_REMAIN );
// 退到后台不注销的命令
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE );
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_HISTORY );
}
}