[Upload]
删除冗余代码 MoGoEagleEye.modules.mogo-module-map MoGoEagleEye.modules.mogo-module-service MoGoEagleEye.modules.mogo-module-share MoGoEagleEye.services.mogo-service-api Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
@@ -11,9 +11,6 @@ import com.mogo.service.map.IMogoMapService;
|
||||
public class ExtensionServiceManager {
|
||||
private static boolean isInit;
|
||||
private static Context mContext;
|
||||
private static IMogoServiceApis mMogoServiceApis;
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoNavi mNavi;
|
||||
|
||||
private ExtensionServiceManager() {
|
||||
|
||||
@@ -23,10 +20,6 @@ public class ExtensionServiceManager {
|
||||
if (!isInit) {
|
||||
isInit = true;
|
||||
mContext = context;
|
||||
mMogoServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
mMapService = mMogoServiceApis.getMapServiceApi();
|
||||
mNavi = mMapService.getNavi(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +27,5 @@ public class ExtensionServiceManager {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNavi() {
|
||||
return mNavi;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.main.EventDispatchCenter;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
@@ -49,7 +49,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
loadBaseModules();
|
||||
startTanluService();
|
||||
initADAS();
|
||||
initGpsSimulatorListener();
|
||||
HdMapBuildConfig.isMapLoaded = true;
|
||||
}, 5_000L
|
||||
);
|
||||
@@ -81,12 +80,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void initGpsSimulatorListener() {
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getMapServiceApi().getNavi(this).registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
#-----ModuleMap-----
|
||||
-keep class com.mogo.module.map.NavConstants{*;}
|
||||
-keep class com.mogo.module.map.VoiceConstants{*;}
|
||||
@@ -1,147 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/30
|
||||
*
|
||||
* 接收高德地图车机版广播
|
||||
*/
|
||||
class AutoNaviBroadcastIntentHandler implements IMogoIntentListener {
|
||||
|
||||
public static final String TAG = "AutoNaviBroadcastReceiver";
|
||||
|
||||
// 发送高德:部分是小智语音发给高德的,这里顺便接收处理,都是历史遗留问题
|
||||
public static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
// 接收高德
|
||||
public static final String AUTONAVI_STANDARD_BROADCAST_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
private EnumMapUI mLastAMapUiType = null;
|
||||
|
||||
public void register( IMogoIntentManager manager ) {
|
||||
manager.registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, this );
|
||||
manager.registerIntentListener( AUTONAVI_STANDARD_BROADCAST_SEND, this );
|
||||
}
|
||||
|
||||
public void unregister( IMogoIntentManager manager ) {
|
||||
mCallback = null;
|
||||
manager.unregisterIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, this );
|
||||
manager.unregisterIntentListener( AUTONAVI_STANDARD_BROADCAST_SEND, this );
|
||||
}
|
||||
|
||||
private OnMapControlCallback mCallback;
|
||||
|
||||
public void setCallback( OnMapControlCallback mCallback ) {
|
||||
this.mCallback = mCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
|
||||
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int operaType = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV )
|
||||
&& !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_SEND ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mCallback == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( keyType == 10027 ) {
|
||||
if ( type == 0 ) {
|
||||
mCallback.onTrafficModeChanged( operaType == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
if ( operaType == 0 ) {
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_2D );
|
||||
} else if ( operaType == 1 ) {
|
||||
mCallback.onCameraModeChanged( EnumMapUI.NorthUP_2D );
|
||||
} else if ( operaType == 2 ) {
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
}
|
||||
} else if ( keyType == 10048 ) {
|
||||
if ( !intent.getBooleanExtra( "callback", true ) ) {
|
||||
return;
|
||||
}
|
||||
//0:自动; 1:白天; 2:黑夜;
|
||||
int dayNightMode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
if ( dayNightMode == 0 ) {
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( dayNightMode == 1 ) {
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Light );
|
||||
} else if ( dayNightMode == 2 ) {
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Night );
|
||||
}
|
||||
} else if ( keyType == 10049 ) {
|
||||
//继续导航
|
||||
boolean extraEnduranceData = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extraEnduranceData ) {
|
||||
mCallback.onContinueNavi();
|
||||
}
|
||||
} else if ( keyType == 20009 ) {
|
||||
mCallback.onOpenNavi();
|
||||
} else if ( keyType == 10038 || keyType == 10007 ) {
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
if ( type == 10007 ) {
|
||||
lat = intent.getDoubleExtra( "ENTRY_LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "ENTRY_LON", 0.0 );
|
||||
} else {
|
||||
lat = intent.getDoubleExtra( "LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "LON", 0.0 );
|
||||
}
|
||||
mCallback.onCalculatePath( lon, lat );
|
||||
} else if ( keyType == 10021 ) {
|
||||
mCallback.onStopNaviInternal( intent );
|
||||
} else if ( keyType == 10005 ) {
|
||||
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// 避免收费 | 1
|
||||
// 多策略算路 | 2
|
||||
// 不走高速 | 3
|
||||
// 躲避拥堵 | 4
|
||||
// 不走高速且避免收费 | 5
|
||||
// 不走高速且躲避拥堵 | 6
|
||||
// 躲避收费和拥堵 | 7
|
||||
// 不走高速躲避收费和拥堵 | 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 );
|
||||
mCallback.onReCalculatePath( config );
|
||||
} else if ( keyType == 10019 ) {
|
||||
int extraState = intent.getIntExtra( "EXTRA_STATE", -1 );
|
||||
// 高德改变黑夜白天模式后,传递给launcher,顺便改变其他
|
||||
if ( extraState == 37 ) {
|
||||
// 白天模式
|
||||
mLastAMapUiType = EnumMapUI.Type_Light;
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().changeAdasControlMode( EnumMapUI.Type_Light );
|
||||
} else if ( extraState == 38 ) {
|
||||
// 夜间模式
|
||||
mLastAMapUiType = EnumMapUI.Type_Night;
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().changeAdasControlMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnumMapUI getLastAMapUiType() {
|
||||
return mLastAMapUiType;
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-01-17.
|
||||
*/
|
||||
public class MapBroadCastHelper implements IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "MapBroadCastHelper";
|
||||
|
||||
private static volatile MapBroadCastHelper sInstance;
|
||||
private static final String ACTION_NAV_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
private static final int STATUS_NAV_FRONT = 3;
|
||||
private static final int STATUS_NAV_BACKGROUND = 4;
|
||||
private static final int STATUS_NAV_START = 8;
|
||||
private static final int STATUS_NAV_STOP = 9;
|
||||
private Context mContext;
|
||||
|
||||
private MapBroadCastHelper( Context context ) {
|
||||
this.mContext = context;
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
|
||||
}
|
||||
|
||||
public static MapBroadCastHelper getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MapBroadCastHelper.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MapBroadCastHelper( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void notifyXiaozhi( MogoNaviInfo naviinfo ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
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" );
|
||||
}
|
||||
|
||||
|
||||
public void notifyXizhiNavStatus( int status ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent( ACTION_NAV_SEND );
|
||||
intent.putExtra( "KEY_TYPE", 10019 );
|
||||
intent.putExtra( "EXTRA_STATE", status );
|
||||
intent.putExtra( "SOURCE_APP", mContext.getPackageName() );
|
||||
mContext.sendBroadcast( intent );
|
||||
Log.v( "MapBroadCastHelper", "NavStatus=" + status );
|
||||
}
|
||||
|
||||
public void mapFrount() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_FRONT );
|
||||
}
|
||||
|
||||
public void mapBackground() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_BACKGROUND );
|
||||
}
|
||||
|
||||
public void startNavi() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_START );
|
||||
}
|
||||
|
||||
public void stopNavi() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void release(){
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().unregisterStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
|
||||
mContext = null;
|
||||
sInstance = null;
|
||||
}
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/30
|
||||
* <p>
|
||||
* 语音控制地图
|
||||
*/
|
||||
class MapControlCommandHandler {
|
||||
|
||||
private static final String TAG = "CustomVoiceCommandHandler";
|
||||
|
||||
private OnMapControlCallback mCallback;
|
||||
|
||||
public void setCallback( OnMapControlCallback mCallback ) {
|
||||
this.mCallback = mCallback;
|
||||
}
|
||||
|
||||
public void handleVoiceCommand( String cmd ) {
|
||||
Logger.d( TAG, cmd );
|
||||
switch ( cmd ) {
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
mCallback.onTrafficModeChanged( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
mCallback.onTrafficModeChanged( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN:
|
||||
mCallback.onZoomMap( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT:
|
||||
mCallback.onZoomMap( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_2D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_2D:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
|
||||
mCallback.onCameraModeChanged( EnumMapUI.NorthUP_2D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_3D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Light );
|
||||
notifyAMap( EnumMapUI.Type_Light );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
mCallback.onOpenNavi();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Night );
|
||||
notifyAMap( EnumMapUI.Type_Night );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
notifyAMap( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
mCallback.onDisplayOverview();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
mCallback.onContinueNavi();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_2D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_OPEN_VR:
|
||||
case VoiceConstants.CMD_MAP_OPEN_VR_UN_WAKEUP:
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeToVRMode();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CLOSE_VR:
|
||||
case VoiceConstants.CMD_MAP_CLOSE_VR_UN_WAKEUP:
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyAMap( EnumMapUI ui ) {
|
||||
if ( ui == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mCallback.getAMapLastType() == ui ) {
|
||||
return;
|
||||
}
|
||||
|
||||
int KEY_TYPE = 10048;
|
||||
int state = 0;//2黑夜;1白天 ;0自动
|
||||
switch ( ui ) {
|
||||
case Type_Light:
|
||||
state = 1;
|
||||
break;
|
||||
case Type_Night:
|
||||
state = 2;
|
||||
break;
|
||||
case Type_AUTO_LIGHT_Night:
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.setAction( "AUTONAVI_STANDARD_BROADCAST_RECV" );
|
||||
intent.putExtra( "KEY_TYPE", KEY_TYPE );
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
// 避免在内部再次调用
|
||||
intent.putExtra( "callback", false );
|
||||
intent.putExtra( "EXTRA_DAY_NIGHT_MODE", state );
|
||||
AbsMogoApplication.getApp().sendBroadcast( intent );
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
mMogoMap = mMogoMapView.getMap();
|
||||
if ( mMogoMap != null ) {
|
||||
mMogoMap.getUIController().showMyLocation( true );
|
||||
mMogoMap.getUIController().recoverLockMode();// 启动锁车
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +127,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onPause();
|
||||
}
|
||||
MapBroadCastHelper.getInstance( getContext() ).mapBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,7 +138,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onResume();
|
||||
}
|
||||
MapBroadCastHelper.getInstance( getContext() ).mapFrount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,9 +175,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
uiSettings.setZoomControlsEnabled( false );
|
||||
//设置双指缩放手势是否可用。
|
||||
uiSettings.setZoomGesturesEnabled( true );
|
||||
if ( mMogoMap.getUIController() != null ) {
|
||||
mMogoMap.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +190,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
MapBroadCastHelper.getInstance( getContext() ).release();
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onDestroy();
|
||||
mMogoMapView = null;
|
||||
@@ -222,17 +215,16 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
mMogoMapView.getMap().getUIController().changeCurrentIcon(iconId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sight mode
|
||||
* @param mode
|
||||
*/
|
||||
|
||||
public static final int SIGHT_MODE_NORMAL = 0;
|
||||
public static final int SIGHT_MODE_TOP = 1;
|
||||
public static final int SIGHT_MODE_BACK = 2;
|
||||
public static final int SIGHT_MODE_CROSS = 3;
|
||||
public static final int SIGHT_MODE_FAR = 4;
|
||||
|
||||
@Override
|
||||
public void setMapDAngle(int mode) {
|
||||
float angle = getSightModeAngle(mode);
|
||||
|
||||
@@ -1,40 +1,6 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -42,315 +8,12 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MapPresenter extends Presenter< MapView > implements
|
||||
IMogoIntentListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
IMogoNaviListener2,
|
||||
OnMapControlCallback,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
public class MapPresenter extends Presenter<MapView> {
|
||||
|
||||
private static final String TAG = "MapPresenter";
|
||||
private IMogoServiceApis mApis;
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
private IMogoRefreshStrategyController mRefreshStrategyController;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
private Rect mDisplayOverviewBounds;
|
||||
|
||||
|
||||
private Runnable mLockCarRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if ( !mStatusManager.isDisplayOverview() ) {
|
||||
return;
|
||||
}
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
}
|
||||
};
|
||||
private AutoNaviBroadcastIntentHandler mAutoNaviReceiver;
|
||||
private MapControlCommandHandler mCustomVoiceCommandHandler;
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
super( view );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrafficModeChanged( boolean open ) {
|
||||
mView.getUIController().setTrafficEnabled( open );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraModeChanged( EnumMapUI mode ) {
|
||||
mView.getUIController().changeMapMode( mode );
|
||||
mApis.getAdasControllerApi().changeAdasControlMode( mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDayNightModeChanged( EnumMapUI mode ) {
|
||||
mView.getUIController().changeMapMode( mode );
|
||||
mApis.getAdasControllerApi().changeAdasControlMode( mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
mView.getUIController().changeMapMode( mapUI );
|
||||
mCustomVoiceCommandHandler.notifyAMap( mapUI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContinueNavi() {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
} else {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
try {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 2_000L );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpenNavi() {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculatePath( double lon, double lat ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNaviInternal( Intent intent ) {
|
||||
mMogoMapService.getNavi( getContext() ).stopNavi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReCalculatePath( MogoNaviConfig config ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
|
||||
}
|
||||
|
||||
private boolean hasOthersActivity() {
|
||||
ActivityManager am = ( ActivityManager ) getContext().getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > list = am.getRunningTasks( 1 );
|
||||
if ( list != null && !list.isEmpty() ) {
|
||||
for ( ActivityManager.RunningTaskInfo runningTaskInfo : list ) {
|
||||
if ( TextUtils.equals( runningTaskInfo.topActivity.getPackageName(), getContext().getPackageName() ) ) {
|
||||
return runningTaskInfo.numActivities > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayOverview() {
|
||||
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() ) {
|
||||
Logger.d( TAG, "未开始导航." );
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isV2XShow() ) {
|
||||
Logger.d( TAG, "ADAS模式忽略该请求." );
|
||||
return;
|
||||
}
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setDisplayOverview( TAG, true );
|
||||
mView.getUIController().displayOverview( mDisplayOverviewBounds );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
|
||||
} else {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setDisplayOverview( TAG, true );
|
||||
mView.getUIController().displayOverview( mDisplayOverviewBounds );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
|
||||
}, 2_000L );
|
||||
}
|
||||
|
||||
UiThreadHandler.postDelayed( mLockCarRunnable, 20_000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onZoomMap( boolean zoomIn ) {
|
||||
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
|
||||
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
|
||||
if ( !CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
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( () -> {
|
||||
mView.getUIController().setLockZoom( ( ( int ) mMogoMapService.getMapUIController().getZoomLevel() ) );
|
||||
mMogoMapService.getMapUIController().recoverLockMode();//缩放地图会导致锁车发生改变,这里强制锁车
|
||||
}, 1_000 );
|
||||
} else {
|
||||
// 30s后锁车刷新
|
||||
mRefreshStrategyController.restartAutoRefreshAtTime( 30_000 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
mMogoMapService = mApis.getMapServiceApi();
|
||||
mMogoIntentManager = mApis.getIntentManagerApi();
|
||||
mRefreshStrategyController = mApis.getRefreshStrategyControllerApi();
|
||||
mStatusManager = mApis.getStatusManagerApi();
|
||||
mRegisterCenter = mApis.getRegisterCenterApi();
|
||||
mRegisterCenter.registerMogoNaviListener( TAG, this );
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_left_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_top_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_right_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_calculate_path_display_overview_bottom_margin )
|
||||
) );
|
||||
|
||||
mDisplayOverviewBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_left_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.module_map_display_overview_top_margin ),
|
||||
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 );
|
||||
}
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sUnRegisterVoiceCmds.entrySet() ) {
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
|
||||
}
|
||||
|
||||
initBroadcast();
|
||||
mCustomVoiceCommandHandler = new MapControlCommandHandler();
|
||||
mCustomVoiceCommandHandler.setCallback( this );
|
||||
mRegisterCenter.registerADASControlStatusChangedListener( TAG, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getAMapLastType() {
|
||||
if ( mAutoNaviReceiver != null ) {
|
||||
return mAutoNaviReceiver.getLastAMapUiType();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initBroadcast() {
|
||||
mAutoNaviReceiver = new AutoNaviBroadcastIntentHandler();
|
||||
mAutoNaviReceiver.setCallback( this );
|
||||
mAutoNaviReceiver.register( mMogoIntentManager );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume( @NonNull LifecycleOwner owner ) {
|
||||
super.onResume( owner );
|
||||
registerVoiceCmd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause( @NonNull LifecycleOwner owner ) {
|
||||
super.onPause( owner );
|
||||
unregisterVoiceCmd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( mAutoNaviReceiver != null ) {
|
||||
mAutoNaviReceiver.unregister( mMogoIntentManager );
|
||||
}
|
||||
mRegisterCenter.unregisterMogoNaviListener( TAG );
|
||||
mRegisterCenter.unregisterADASControlStatusChangedListener( TAG );
|
||||
|
||||
for ( String cmd : VoiceConstants.sUnUnRegisterCmds ) {
|
||||
mMogoIntentManager.unregisterIntentListener( cmd, this );
|
||||
}
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sUnRegisterVoiceCmds.entrySet() ) {
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( entry.getKey(), this );
|
||||
}
|
||||
}
|
||||
|
||||
private void registerVoiceCmd() {
|
||||
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( entry.getKey(), entry.getValue(), this );
|
||||
}
|
||||
|
||||
for ( String cmd : VoiceConstants.sCmds ) {
|
||||
mMogoIntentManager.registerIntentListener( cmd, this );
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterVoiceCmd() {
|
||||
|
||||
for ( Map.Entry< String, String[] > entry : VoiceConstants.sVoiceCmds.entrySet() ) {
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( entry.getKey(), this );
|
||||
}
|
||||
|
||||
for ( String cmd : VoiceConstants.sCmds ) {
|
||||
mMogoIntentManager.unregisterIntentListener( cmd, this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String command, Intent intent ) {
|
||||
if ( TextUtils.isEmpty( command ) ) {
|
||||
return;
|
||||
}
|
||||
onCmdSelected( command );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
Logger.d( TAG, cmd );
|
||||
mCustomVoiceCommandHandler.handleVoiceCommand( cmd );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
MapBroadCastHelper.getInstance( getContext() ).notifyXiaozhi( naviinfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
MapBroadCastHelper.getInstance( getContext() ).startNavi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
MapBroadCastHelper.getInstance( getContext() ).stopNavi();
|
||||
public MapPresenter(MapView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
|
||||
public interface OnMapControlCallback {
|
||||
|
||||
// 交通态势
|
||||
void onTrafficModeChanged( boolean open );
|
||||
|
||||
// 2d、3d模式切换、正北、车头
|
||||
void onCameraModeChanged( EnumMapUI mode);
|
||||
|
||||
// 白天、黑夜模式切换
|
||||
void onDayNightModeChanged( EnumMapUI mode );
|
||||
|
||||
// 继续导航
|
||||
void onContinueNavi();
|
||||
|
||||
// 打开导航
|
||||
void onOpenNavi();
|
||||
|
||||
// 开始路径规划
|
||||
void onCalculatePath( double lon, double lat );
|
||||
|
||||
// 调用停止导航方法
|
||||
void onStopNaviInternal( Intent intent );
|
||||
|
||||
// 重新规划路线
|
||||
void onReCalculatePath( MogoNaviConfig config );
|
||||
|
||||
// 查看全程
|
||||
void onDisplayOverview();
|
||||
|
||||
// 缩放地图
|
||||
void onZoomMap( boolean zoomIn );
|
||||
|
||||
// 高德地图上次类型
|
||||
EnumMapUI getAMapLastType();
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class VoiceConstants {
|
||||
|
||||
// 地图免唤醒语音注册
|
||||
/**
|
||||
* 放大地图
|
||||
*/
|
||||
public static final String CMD_MAP_ZOOM_IN = "com.ileja.navi.map.enlarge";
|
||||
public static final String CMD_MAP_ZOOM_IN_UN_WAKEUP = "CMD_MAP_ZOOM_IN_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_ZOOM_IN_TRIGGER_WORDS = {"放大地图"};
|
||||
|
||||
/**
|
||||
* 导航历史记录
|
||||
*/
|
||||
public static final String CMD_MAP_HISTORY = "com.zhidao.navi.history.query";
|
||||
public static final String CMD_MAP_HISTORY_UN_WAKEUP = "CMD_MAP_HISTORY_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_HISTORY_TRIGGER_WORDS = {"查询导航历史记录"};
|
||||
|
||||
|
||||
/**
|
||||
* 缩小地图
|
||||
*/
|
||||
public static final String CMD_MAP_ZOOM_OUT = "com.ileja.navi.map.reduce";
|
||||
public static final String CMD_MAP_ZOOM_OUT_UN_WAKEUP = "CMD_MAP_ZOOM_OUT_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_ZOOM_OUT_TRIGGER_WORDS = {"缩小地图"};
|
||||
|
||||
/**
|
||||
* 2D模式
|
||||
*/
|
||||
public static final String CMD_MAP_2D = "com.ileja.navi.mode.2d";
|
||||
public static final String CMD_MAP_2D_UN_WAKEUP = "CMD_MAP_2D_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_2D_TRIGGER_WORDS = {"二地模式"};
|
||||
|
||||
/**
|
||||
* 打开vr
|
||||
*/
|
||||
public static final String CMD_MAP_OPEN_VR = "com.ileja.navi.mode.vr.open";
|
||||
public static final String CMD_MAP_OPEN_VR_UN_WAKEUP = "CMD_MAP_OPEN_VR_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_OPEN_VR_TRIGGER_WORDS = {"打开VR模式", "VR模式", "切换到VR模式"};
|
||||
|
||||
/**
|
||||
* 关闭vr
|
||||
*/
|
||||
public static final String CMD_MAP_CLOSE_VR = "com.ileja.navi.mode.vr.close";
|
||||
public static final String CMD_MAP_CLOSE_VR_UN_WAKEUP = "CMD_MAP_CLOSE_VR_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_CLOSE_VR_TRIGGER_WORDS = {"关闭VR模式", "切换到地图模式"};
|
||||
|
||||
/**
|
||||
* 3D模式
|
||||
*/
|
||||
public static final String CMD_MAP_3D = "com.ileja.navi.mode.3d";
|
||||
public static final String CMD_MAP_3D_UN_WAKEUP = "CMD_MAP_3D_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_3D_TRIGGER_WORDS = {"三地模式"};
|
||||
|
||||
/**
|
||||
* 白天模式
|
||||
*/
|
||||
public static final String CMD_MAP_DAY_TIME_MODE = "com.ileja.navi.mode.daytime";
|
||||
public static final String CMD_MAP_DAY_TIME_MODE_UN_WAKEUP = "CMD_MAP_DAY_TIME_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS = {"白天模式"};
|
||||
|
||||
/**
|
||||
* 黑夜模式
|
||||
*/
|
||||
public static final String CMD_MAP_NIGHT_MODE = "com.ileja.navi.mode.night";
|
||||
public static final String CMD_MAP_NIGHT_MODE_UN_WAKEUP = "CMD_MAP_NIGHT_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_NIGHT_MODE_TRIGGER_WORDS = {"夜间模式"};
|
||||
|
||||
/**
|
||||
* 自动模式
|
||||
*/
|
||||
public static final String CMD_MAP_AUTO_LIGHT_NIGHT_MODE = "com.ileja.navi.mode.autodaynight";
|
||||
public static final String CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP = "CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS = {"自动模式"};
|
||||
|
||||
/**
|
||||
* 查看路况
|
||||
*/
|
||||
public static final String CMD_MAP_TRAFFIC_MODE = "com.ileja.navi.traffic.open";
|
||||
public static final String CMD_MAP_TRAFFIC_MODE_UN_WAKEUP = "CMD_MAP_TRAFFIC_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_TRAFFIC_MODE_TRIGGER_WORDS = {"打开路况", "打开实况"};
|
||||
/**
|
||||
* 关闭路况
|
||||
*/
|
||||
public static final String CMD_MAP_UN_TRAFFIC_MODE = "com.ileja.navi.traffic.close";
|
||||
public static final String CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP = "CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_UN_TRAFFIC_MODE_TRIGGER_WORDS = {"关闭路况", "关闭实况"};
|
||||
|
||||
/**
|
||||
* 导航全览
|
||||
*/
|
||||
public static final String CMD_MAP_DISPLAY_OVERVIEW_MODE = "com.ileja.navi.map.full";
|
||||
|
||||
/**
|
||||
* 继续导航
|
||||
*/
|
||||
public static final String CMD_MAP_CONTINUE_NAVI_MODE = "com.ileja.navi.route.continue";
|
||||
|
||||
|
||||
/**
|
||||
* 停止导航
|
||||
*/
|
||||
public static final String CMD_MAP_STOP_NAVI_MODE = "com.ileja.navi.route.stop";
|
||||
public static final String CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP = "CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_STOP_NAVI_MODE_TRIGGER_WORDS = {"停止导航/结束导航/取消导航/放弃导航/退出导航/关闭导航"};
|
||||
|
||||
/**
|
||||
* 附近类命令
|
||||
*/
|
||||
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_CAR_UP_MODE = "com.ileja.traffic.head.up";
|
||||
public static final String CMD_MAP_CAR_UP_MODE_UN_WAKEUP = "CMD_MAP_CAR_UP_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS = {"车头朝上"};
|
||||
|
||||
/**
|
||||
* 北朝上
|
||||
*/
|
||||
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_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_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 = {"还有多久", "多久到", "还有多远"};
|
||||
|
||||
// 免唤醒
|
||||
public static final Map< String, String[] > sVoiceCmds = new HashMap<>();
|
||||
// 不注销的免唤醒
|
||||
public static final Map< String, String[] > sUnRegisterVoiceCmds = new HashMap<>();
|
||||
// 唤醒
|
||||
public static final List< String > sCmds = new ArrayList<>();
|
||||
// 不注销的唤醒
|
||||
public static final List< String > sUnUnRegisterCmds = new ArrayList<>();
|
||||
|
||||
static {
|
||||
// 免唤醒
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_TRAFFIC_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP, VoiceConstants.CMD_MAP_HISTORY_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_TRIGGER_WORDS );
|
||||
|
||||
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );
|
||||
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NIGHT_MODE_TRIGGER_WORDS );
|
||||
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS );
|
||||
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_OPEN_VR_UN_WAKEUP, VoiceConstants.CMD_MAP_OPEN_VR_TRIGGER_WORDS );
|
||||
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_CLOSE_VR_UN_WAKEUP, VoiceConstants.CMD_MAP_CLOSE_VR_TRIGGER_WORDS );
|
||||
|
||||
// 唤醒
|
||||
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_IN );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_OUT );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_2D );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_3D );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_TRAFFIC_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CAR_UP_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_NORTH_UP_MODE );
|
||||
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 );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_OPEN_VR );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CLOSE_VR );
|
||||
|
||||
// 退到后台不注销的命令
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_HISTORY );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_DAY_TIME_MODE );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_NIGHT_MODE );
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE );
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,4 @@
|
||||
-keep interface com.mogo.module.service.network.RefreshCallback{*;}
|
||||
-keep interface com.mogo.module.service.network.bean.DemoUserInfoEntity{*;}
|
||||
-keep interface com.mogo.module.service.ttsConfig.TtsConfigApiService{*;}
|
||||
-keep class com.mogo.module.service.strategy.CarIconDisplayStrategy{
|
||||
public static final <fields>;
|
||||
}
|
||||
-keep class com.mogo.module.service.ServiceConst{*;}
|
||||
@@ -25,11 +25,7 @@
|
||||
-keep class com.mogo.module.service.network.RefreshBody.*{*;}
|
||||
-keep class com.mogo.module.service.network.bean.DemoUserInfoEntity.*{*;}
|
||||
-keep interface com.mogo.module.service.intent.IntentHandler
|
||||
-keep interface com.mogo.module.service.marker.IMarkerView
|
||||
-keep interface com.mogo.module.service.network.RefreshApiService
|
||||
-keep interface com.mogo.module.service.network.RefreshCallback
|
||||
-keep interface com.mogo.module.service.network.bean.DemoUserInfoEntity
|
||||
-keep class com.mogo.module.service.strategy.CarIconDisplayStrategy{
|
||||
public static final <fields>;
|
||||
}
|
||||
-keep class com.mogo.module.service.ServiceConst
|
||||
@@ -7,7 +7,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -44,7 +43,6 @@ public class MarkerServiceHandler {
|
||||
|
||||
private static IMogoMapService sMapService;
|
||||
private static IMogoMarkerManager sMarkerManager;
|
||||
private static IMogoNavi sNavi;
|
||||
private static IMogoMapUIController sMapUIController;
|
||||
private static IMogoLocationClient sLocationClient;
|
||||
private static IMogoStatusManager sMogoStatusManager;
|
||||
@@ -60,8 +58,6 @@ public class MarkerServiceHandler {
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IMogoOverlayManager sIMogoOverlayManager;
|
||||
|
||||
// private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
public static synchronized void init( final Context context ) {
|
||||
|
||||
if ( sCarChatting != null ) {
|
||||
@@ -76,7 +72,6 @@ public class MarkerServiceHandler {
|
||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||
sMarkerManager = sMapService.getMarkerManager( context );
|
||||
sIMogoOverlayManager = sMapService.getOverlayManager(context);
|
||||
sNavi = sMapService.getNavi( context );
|
||||
sMapUIController = sMapService.getMapUIController();
|
||||
sLocationClient = sMapService.getSingletonLocationClient( context );
|
||||
sRegisterCenter = sApis.getRegisterCenterApi();
|
||||
@@ -88,8 +83,6 @@ public class MarkerServiceHandler {
|
||||
sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
|
||||
|
||||
MapMarkerManager.getInstance().init( context );
|
||||
|
||||
// sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class );
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis() {
|
||||
@@ -104,10 +97,6 @@ public class MarkerServiceHandler {
|
||||
return sMarkerManager;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNavi() {
|
||||
return sNavi;
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIController() {
|
||||
return sMapUIController;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -50,7 +49,6 @@ import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
@@ -150,7 +148,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
private IMogoActionManager mActionManager;
|
||||
private IMogoADASController mADASController;
|
||||
private IMogoFragmentManager mFragmentManager;
|
||||
private IMogoNavi mNavi;
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
|
||||
|
||||
@@ -316,7 +313,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
mTtsModle = new TtsConfigModleData();
|
||||
mMogoMapService = MarkerServiceHandler.getMapService();
|
||||
mUiController = mMogoMapService.getMapUIController();
|
||||
mNavi = mMogoMapService.getNavi( context );
|
||||
|
||||
mStatusManager = MarkerServiceHandler.getMogoStatusManager();
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener );
|
||||
@@ -333,7 +329,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
initWorkThread();
|
||||
|
||||
registerMogoReceiver( context );
|
||||
@@ -377,8 +372,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
mFragmentManager.addMainFragmentStackTransactionListener( this );
|
||||
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus( mStatusManager.isSeekHelping() );
|
||||
|
||||
AutoPilotRemoteController.getInstance().start();
|
||||
|
||||
Intent intent = new Intent( "com.freedom.ser.ACTION" );
|
||||
@@ -864,11 +857,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
}
|
||||
if ( mNavi.isNaviing() ) {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mUiController, Scene.NAVI );
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mUiController, Scene.AIMLESS );
|
||||
}
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mUiController, Scene.AIMLESS );
|
||||
mUiController.recoverLockMode();
|
||||
mADASController.showADAS();
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
@@ -121,7 +120,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
|
||||
public void onSeekHelpingStatusChanged(boolean isSeekingHelping) {
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus(isSeekingHelping);
|
||||
notifySeekHelpingStatusChanged(isSeekingHelping);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,55 +133,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 13: {// 唤起高德地图
|
||||
double lat = intent.getFloatExtra("lat", 0.0f);
|
||||
double lon = intent.getFloatExtra("lon", 0.0f);
|
||||
boolean real = intent.getBooleanExtra("real", false);
|
||||
MarkerServiceHandler.getRegisterCenter().registerMogoNaviListener(TAG, new IMogoNaviListener() {
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
MarkerServiceHandler.getRegisterCenter().unregisterMogoNaviListener(TAG);
|
||||
MarkerServiceHandler.getNavi().startNavi(real);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
});
|
||||
MarkerServiceHandler.getNavi().naviTo(new MogoLatLng(lat, lon));
|
||||
break;
|
||||
}
|
||||
case 14: {//测试点的动画移动,模拟周边车辆移动
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
mogoLatLngs.add(new MogoLatLng(39.615986, 116.396716));
|
||||
|
||||
@@ -1,282 +0,0 @@
|
||||
package com.mogo.module.service.strategy;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 上报故障求助之后自车的图标显示策略
|
||||
*/
|
||||
public class CarIconDisplayStrategy {
|
||||
|
||||
private static final String TAG = "CarIconDisplayStrategy";
|
||||
|
||||
public static final int MSG_SEEK_HELPING_ANIM = 2000;
|
||||
public static final int MSG_STOP_SEEK_HELPING_ANIM = 2001;
|
||||
|
||||
// F 系列才有这个帧动画
|
||||
public static final int[] sFrame = {
|
||||
R.drawable.module_service_ic_warning_circle_orange_00000,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00001,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00002,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00003,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00004,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00005,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00006,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00007,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00008,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00009,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00010,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00011,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00012,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00013,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00014,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00015,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00016,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00017,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00018,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00019,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00020,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00021,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00022,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00023,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00024,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00025,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00026,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00027,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00028,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00029,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00030,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00031,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00032,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00033,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00034,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00035,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00036,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00037,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00038,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00039,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00040,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00041,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00042,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00043,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00044,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00045,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00046
|
||||
};
|
||||
|
||||
// F 系列才有这个帧动画
|
||||
public static final int[] sFrameVr = {
|
||||
R.drawable.module_service_ic_car_for_help_0000,
|
||||
R.drawable.module_service_ic_car_for_help_0001,
|
||||
R.drawable.module_service_ic_car_for_help_0002,
|
||||
R.drawable.module_service_ic_car_for_help_0003,
|
||||
R.drawable.module_service_ic_car_for_help_0004,
|
||||
R.drawable.module_service_ic_car_for_help_0005,
|
||||
R.drawable.module_service_ic_car_for_help_0006,
|
||||
R.drawable.module_service_ic_car_for_help_0007,
|
||||
R.drawable.module_service_ic_car_for_help_0008,
|
||||
R.drawable.module_service_ic_car_for_help_0009,
|
||||
R.drawable.module_service_ic_car_for_help_0010,
|
||||
R.drawable.module_service_ic_car_for_help_0011,
|
||||
R.drawable.module_service_ic_car_for_help_0012,
|
||||
R.drawable.module_service_ic_car_for_help_0013,
|
||||
R.drawable.module_service_ic_car_for_help_0014,
|
||||
R.drawable.module_service_ic_car_for_help_0015,
|
||||
R.drawable.module_service_ic_car_for_help_0016,
|
||||
R.drawable.module_service_ic_car_for_help_0017,
|
||||
R.drawable.module_service_ic_car_for_help_0018,
|
||||
R.drawable.module_service_ic_car_for_help_0019,
|
||||
R.drawable.module_service_ic_car_for_help_0020,
|
||||
R.drawable.module_service_ic_car_for_help_0021,
|
||||
R.drawable.module_service_ic_car_for_help_0022,
|
||||
R.drawable.module_service_ic_car_for_help_0023,
|
||||
R.drawable.module_service_ic_car_for_help_0024
|
||||
};
|
||||
|
||||
private static volatile CarIconDisplayStrategy sInstance;
|
||||
|
||||
private IMogoMarker mSeekHelpingMarker;
|
||||
private ArrayList<Bitmap> mBitmapFrames = new ArrayList<>();
|
||||
|
||||
private CarIconDisplayStrategy() {
|
||||
mOption =
|
||||
new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping).build();
|
||||
}
|
||||
|
||||
public static CarIconDisplayStrategy getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (CarIconDisplayStrategy.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new CarIconDisplayStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Handler mSeekHelpingHandler;
|
||||
private CarCursorOption mOption;
|
||||
private MogoMarkerOptions seekHelpMarkerOptions;
|
||||
// private IMogoMarker seekHelpMarker;
|
||||
|
||||
|
||||
public void changeCarIconStatus(boolean seekHelpingStatus) {
|
||||
if (CarSeries.isF8xxSeries()) {
|
||||
if (seekHelpingStatus) {
|
||||
playSeekHelpingAnim();
|
||||
} else {
|
||||
stopSeekHelpingAnim();
|
||||
}
|
||||
} else {
|
||||
if (seekHelpingStatus) {
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption( mOption );
|
||||
} else {
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
try {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playSeekHelpingAnim() {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void initHandler() {
|
||||
if (mSeekHelpingHandler != null) {
|
||||
return;
|
||||
}
|
||||
mSeekHelpingHandler = new Handler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MSG_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
playAnim();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case MSG_STOP_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void stopSeekHelpingAnim() {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_STOP_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void playAnim() {
|
||||
try {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isVrMode()) {
|
||||
for (int i : sFrameVr) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
} else {
|
||||
for (int i : sFrame) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
}
|
||||
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icons(mBitmapFrames)
|
||||
.period(20)
|
||||
.zIndex(0)
|
||||
.scale(MarkerServiceHandler.getMogoStatusManager().isVrMode() ? 0.4f : 1.0f)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getMapUIController().getWindowCenterLocation()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping_00036).build());
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
}
|
||||
|
||||
private void stopAnim() {
|
||||
try {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
if (!mBitmapFrames.isEmpty()) {
|
||||
for (Bitmap bitmapFrame : mBitmapFrames) {
|
||||
if (bitmapFrame != null && !bitmapFrame.isRecycled()) {
|
||||
bitmapFrame.recycle();
|
||||
}
|
||||
}
|
||||
mBitmapFrames.clear();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 159 KiB |
|
Before Width: | Height: | Size: 168 KiB |
|
Before Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 183 KiB |
|
Before Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 203 KiB |
|
Before Width: | Height: | Size: 214 KiB |
|
Before Width: | Height: | Size: 218 KiB |
|
Before Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 228 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 58 KiB |
@@ -5,6 +5,7 @@ import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
@@ -15,7 +16,6 @@ import com.mogo.module.common.entity.RoadTrafficSegment;
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus;
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.net.TrafficModelData;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -39,12 +39,6 @@ public class GaoDeAimlessProvider implements IProvider {
|
||||
mTanluModelData = new TrafficModelData();
|
||||
}
|
||||
|
||||
// 开启巡航监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getAimless(context)
|
||||
.setAimlessModeStatus(true);
|
||||
|
||||
// 注册高德巡航回调
|
||||
MogoApisHandler.getInstance()
|
||||
|
||||
@@ -3,9 +3,6 @@ package com.mogo.module.share;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -13,7 +10,6 @@ import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -23,15 +19,12 @@ import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
*/
|
||||
public class TanluServiceManager {
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoPoiSearch mPoiSearch;
|
||||
private static IMogoLocationClient mLocationClient;
|
||||
private static IMogoServiceApis mServiceApis;
|
||||
private static IMogoStatusManager mIMogoStatusManager;
|
||||
private static IMogoAnalytics mAnalytics;
|
||||
private static IMogoIntentManager mogoIntentManager;
|
||||
private static IMogoRegisterCenter mogoRegisterCenter;
|
||||
private static IMogoTopViewManager mIMogoTopViewManager;
|
||||
private static IMogoAimless mIMogoAimless;
|
||||
|
||||
public static void init(Context context) {
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
@@ -40,16 +33,9 @@ public class TanluServiceManager {
|
||||
mAnalytics = mServiceApis.getAnalyticsApi();
|
||||
mogoIntentManager = mServiceApis.getIntentManagerApi();
|
||||
mogoRegisterCenter = mServiceApis.getRegisterCenterApi();
|
||||
mIMogoAimless = mMapService.getAimless(context);
|
||||
|
||||
mIMogoTopViewManager = mServiceApis.getTopViewManager();
|
||||
mPoiSearch = mMapService.getPoiSearch(context, new MogoPoiSearchQuery());
|
||||
mLocationClient = mMapService.getSingletonLocationClient(context);
|
||||
}
|
||||
|
||||
public static IMogoTopViewManager getIMogoTopViewManager() {
|
||||
return mIMogoTopViewManager;
|
||||
}
|
||||
|
||||
public static IMogoRegisterCenter getIMogoRegisterCenter() {
|
||||
return mogoRegisterCenter;
|
||||
@@ -59,10 +45,6 @@ public class TanluServiceManager {
|
||||
return mMapService;
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearch() {
|
||||
return mPoiSearch;
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClient() {
|
||||
return mLocationClient;
|
||||
}
|
||||
@@ -83,7 +65,4 @@ public class TanluServiceManager {
|
||||
return mServiceApis;
|
||||
}
|
||||
|
||||
public static IMogoAimless getMogoAimless() {
|
||||
return mIMogoAimless;
|
||||
}
|
||||
}
|
||||
|
||||