This commit is contained in:
wangcongtao
2020-06-04 17:35:42 +08:00
parent 82e0a15f2e
commit 0298578b55
20 changed files with 317 additions and 98 deletions

View File

@@ -46,14 +46,14 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener {
}
public void notifyXiaozhi( MogoNaviInfo naviinfo ) {
Intent intent = new Intent( ACTION_NAV_SEND );
intent.putExtra( "KEY_TYPE", 10001 );
intent.putExtra( "NEXT_ROAD_NAME", naviinfo.getNextRoadName() );
intent.putExtra( "ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime() );
intent.putExtra( "ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance() );
intent.putExtra( "ICON", naviinfo.getIconResId() );
mContext.sendBroadcast( intent );
Log.v( "MapBroadCastHelper", "action=" + ACTION_NAV_SEND + " NaviInfo" );
// Intent intent = new Intent( ACTION_NAV_SEND );
// intent.putExtra( "KEY_TYPE", 10001 );
// intent.putExtra( "NEXT_ROAD_NAME", naviinfo.getNextRoadName() );
// intent.putExtra( "ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime() );
// intent.putExtra( "ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance() );
// intent.putExtra( "ICON", naviinfo.getIconResId() );
// mContext.sendBroadcast( intent );
// Log.v( "MapBroadCastHelper", "action=" + ACTION_NAV_SEND + " NaviInfo" );
}
@@ -67,30 +67,30 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener {
}
public void mapFrount() {
notifyXizhiNavStatus( STATUS_NAV_FRONT );
// notifyXizhiNavStatus( STATUS_NAV_FRONT );
}
public void mapBackground() {
notifyXizhiNavStatus( STATUS_NAV_BACKGROUND );
// notifyXizhiNavStatus( STATUS_NAV_BACKGROUND );
}
public void startNavi() {
notifyXizhiNavStatus( STATUS_NAV_START );
// notifyXizhiNavStatus( STATUS_NAV_START );
}
public void stopNavi() {
notifyXizhiNavStatus( STATUS_NAV_STOP );
// notifyXizhiNavStatus( STATUS_NAV_STOP );
}
@Override
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
if ( descriptor == StatusDescriptor.AI_ASSIST_READY ) {
if ( isTrue ) {
if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) {
mapBackground();
} else {
mapFrount();
}
// if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) {
// mapBackground();
// } else {
// mapFrount();
// }
}
}
}

View File

@@ -116,10 +116,10 @@ public class MapPresenter extends Presenter< MapView > implements
onChangeDayNightMode( day_night_mode );
//继续导航
} else if ( key_type == 10049 ) {
boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
if ( extra_endurance_data ) {
onContinueNavigation();
}
// boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
// if ( extra_endurance_data ) {
// onContinueNavigation();
// }
} else if ( key_type == 10006 ) {
// 避免冲突,会同时发送两个广播,这里不操作。
//int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 );
@@ -131,12 +131,12 @@ public class MapPresenter extends Presenter< MapView > implements
} else if ( key_type == 10005 ) {
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
} else if ( key_type == 20009 ) {
onOpenNavi();
// onOpenNavi();
} else if ( key_type == 10038 || key_type == 10007 ) {
mLauncher.backToLauncher( getContext() );
onChoosePath( intent, key_type );
// mLauncher.backToLauncher( getContext() );
// onChoosePath( intent, key_type );
} else if ( key_type == 10021 ) {
onStopNaviInternal();
// onStopNaviInternal();
} else if ( key_type == 10005 ) {
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
// 避免收费 | 1
@@ -149,12 +149,12 @@ public class MapPresenter extends Presenter< MapView > implements
// 不走高速躲避收费和拥堵 | 8
// 高速优先 | 20
// 躲避拥堵且高速优先 | 24
int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 );
MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 )
.cost( prefer == 1 || prefer == 7 )
.highSpeed( prefer == 20 )
.avoidSpeed( prefer == 3 );
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
// int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 );
// MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 )
// .cost( prefer == 1 || prefer == 7 )
// .highSpeed( prefer == 20 )
// .avoidSpeed( prefer == 3 );
// mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
}
}
@@ -220,7 +220,6 @@ public class MapPresenter extends Presenter< MapView > implements
} else {
lat = intent.getDoubleExtra( "LAT", 0.0 );
lon = intent.getDoubleExtra( "LON", 0.0 );
}
mMogoSearchManager.calculatePath( new MogoLatLng( lat, lon ) );
}
@@ -280,16 +279,16 @@ public class MapPresenter extends Presenter< MapView > implements
private void zoomMap( boolean zoomIn ) {
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
if ( result == MapControlResult.TARGET ) {
UiThreadHandler.postDelayed( () -> {
if ( zoomIn ) {
AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最大", VoicePreemptType.PREEMPT_TYPE_NEXT, null );
} else {
AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最小", VoicePreemptType.PREEMPT_TYPE_NEXT, null );
}
}, 1_000L ); // 避免小智障播放完毕之前播报
return;
}
// if ( result == MapControlResult.TARGET ) {
// UiThreadHandler.postDelayed( () -> {
// if ( zoomIn ) {
// AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最大", VoicePreemptType.PREEMPT_TYPE_NEXT, null );
// } else {
// AIAssist.getInstance( getContext() ).speakTTSVoice( "地图已是最小", VoicePreemptType.PREEMPT_TYPE_NEXT, null );
// }
// }, 1_000L ); // 避免小智障播放完毕之前播报
// return;
// }
if ( isLocked ) {
// 保持锁车状态
UiThreadHandler.postDelayed( () -> {