change the callerlogger
This commit is contained in:
@@ -2,7 +2,6 @@ package com.mogo.module.service;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@@ -136,6 +135,5 @@ public class MarkerServiceHandler {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void highlightedMarker(String typeTag) {
|
||||
Logger.w(TAG, "do not invoke this method any more.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
@@ -95,7 +94,6 @@ public class MogoServiceProvider implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
MarkerServiceHandler.init( context );
|
||||
MogoServices.getInstance().preInit( context );
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_OTHER;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
@@ -9,7 +11,6 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -17,7 +18,7 @@ import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.IDestroyable;
|
||||
@@ -144,38 +145,38 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private boolean mLoopRequest = false;
|
||||
|
||||
private final Handler mHandler = new MainLooperHandler( Looper.getMainLooper() ) {
|
||||
private final Handler mHandler = new MainLooperHandler(Looper.getMainLooper()) {
|
||||
|
||||
@Override
|
||||
protected void handleRefreshDecrease( Message msg ) {
|
||||
if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) {
|
||||
protected void handleRefreshDecrease(Message msg) {
|
||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||
invokeAutoRefreshStrategy();
|
||||
return;
|
||||
}
|
||||
mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL;
|
||||
if ( mRefreshRemainingTime <= 0 ) {
|
||||
Logger.d( TAG, "move to center and refresh data." );
|
||||
if (mRefreshRemainingTime <= 0) {
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "move to center and refresh data.");
|
||||
invokeAutoRefresh();
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( msg.what, ServiceConst.DECREASE_INTERVAL );
|
||||
mHandler.sendEmptyMessageDelayed(msg.what, ServiceConst.DECREASE_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleLoopRequestMessage( Message msg ) {
|
||||
if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) {
|
||||
protected void handleLoopRequestMessage(Message msg) {
|
||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||
return;
|
||||
}
|
||||
if ( mLoopRequest ) {
|
||||
Logger.d( TAG, "补偿刷新触发" );
|
||||
if (mLoopRequest) {
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "补偿刷新触发");
|
||||
invokeAutoRefresh();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public RefreshModel getRefreshModel() {
|
||||
if ( mRefreshModel == null ) {
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
if (mRefreshModel == null) {
|
||||
mRefreshModel = new RefreshModel(mContext);
|
||||
}
|
||||
return mRefreshModel;
|
||||
}
|
||||
@@ -184,16 +185,16 @@ public class MogoServices implements IMogoMapListener,
|
||||
* 自动刷新:锁车、缩放比例:16、半径 2KM
|
||||
*/
|
||||
private void invokeAutoRefresh() {
|
||||
if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mUiController.recoverLockMode();
|
||||
return;
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
||||
mUiController.changeZoom(ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL);
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mUiController.recoverLockMode();
|
||||
notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback );
|
||||
notifyRefreshData(mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback);
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
@@ -211,13 +212,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
/**
|
||||
* 手动刷新回调
|
||||
*/
|
||||
private final RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() {
|
||||
private final RefreshCallback mCustomRefreshCallback = new RefreshCallback<MarkerResponse>() {
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse o ) {
|
||||
MapMarkerManager.getInstance().onSyncMarkerResponse( o );
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
MapMarkerManager.getInstance().onSyncMarkerResponse(o);
|
||||
mLoopRequest = false;
|
||||
// 用户手动操作地图刷新成功后,设置状态为 true,引发延时策略
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true );
|
||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,19 +230,19 @@ public class MogoServices implements IMogoMapListener,
|
||||
/**
|
||||
* 自动刷新回调
|
||||
*/
|
||||
private final RefreshCallback mAutoRefreshCallback = new RefreshCallback< MarkerResponse >() {
|
||||
private final RefreshCallback mAutoRefreshCallback = new RefreshCallback<MarkerResponse>() {
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse o ) {
|
||||
MapMarkerManager.getInstance().onSyncMarkerResponse( o );
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
MapMarkerManager.getInstance().onSyncMarkerResponse(o);
|
||||
mLoopRequest = false;
|
||||
invokeAutoRefreshStrategy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if ( mLoopRequest ) {
|
||||
Logger.d( TAG, "onFail and loop" );
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOOP_REQUEST, ServiceConst.LOOP_INTERVAL );
|
||||
if (mLoopRequest) {
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onFail and loop");
|
||||
mHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOOP_REQUEST, ServiceConst.LOOP_INTERVAL);
|
||||
} else {
|
||||
invokeAutoRefreshStrategy();
|
||||
}
|
||||
@@ -249,7 +250,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
};
|
||||
|
||||
private void invokeAutoRefreshStrategy() {
|
||||
restartAutoRefreshAtTime( mAutoRefreshStrategy.getInterval() );
|
||||
restartAutoRefreshAtTime(mAutoRefreshStrategy.getInterval());
|
||||
}
|
||||
|
||||
private Handler mThreadHandler;
|
||||
@@ -257,144 +258,144 @@ public class MogoServices implements IMogoMapListener,
|
||||
private final IMogoStatusChangedListener statusChangedListener = new StatusChangedAdapter() {
|
||||
|
||||
@Override
|
||||
public void onSearchUIShow( boolean visible ) {
|
||||
if ( visible ) {
|
||||
public void onSearchUIShow(boolean visible) {
|
||||
if (visible) {
|
||||
// 搜索时,不在自动刷新打点策略
|
||||
stopAutoRefreshStrategy();
|
||||
} else {
|
||||
// 搜索后,打开打点策略
|
||||
if ( mAutoRefreshCallback != null ) {
|
||||
mAutoRefreshCallback.onSuccess( null );
|
||||
if (mAutoRefreshCallback != null) {
|
||||
mAutoRefreshCallback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public void preInit( Context context ) {
|
||||
public void preInit(Context context) {
|
||||
mContext = context;
|
||||
|
||||
mRefreshModel = new RefreshModel( context );
|
||||
mRefreshModel = new RefreshModel(context);
|
||||
mMogoMapService = MarkerServiceHandler.getMapService();
|
||||
mUiController = mMogoMapService.getMapUIController();
|
||||
|
||||
mStatusManager = MarkerServiceHandler.getMogoStatusManager();
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.VR_MODE, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener );
|
||||
mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() );
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.VR_MODE, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener);
|
||||
mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener);
|
||||
mStatusManager.setAIAssistReady(TAG, AIAssist.getInstance(mContext).hasFlush());
|
||||
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
|
||||
initWorkThread();
|
||||
|
||||
registerMogoReceiver( context );
|
||||
registerMogoReceiver(context);
|
||||
registerInternalUnWakeupWords();
|
||||
|
||||
mRegisterCenter = MarkerServiceHandler.getRegisterCenter();
|
||||
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoLocationListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoMapListener(ServiceConst.TYPE, this);
|
||||
mRegisterCenter.registerMogoLocationListener(ServiceConst.TYPE, this);
|
||||
mRegisterCenter.registerMogoNaviListener(ServiceConst.TYPE, this);
|
||||
mRegisterCenter.registerCarLocationChangedListener(ServiceConst.TYPE, this);
|
||||
|
||||
mActionManager = MarkerServiceHandler.getActionManager();
|
||||
|
||||
mIntentManager = MarkerServiceHandler.getIntentManager();
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_UI, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_NEXT, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_PREVIOUS, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_SWITCH_CARD, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_MY_LOCATION, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_READY, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOCK, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_BACK, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_SEND, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOGO, this );
|
||||
mIntentManager.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, this );
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_UI, this);
|
||||
mIntentManager.registerIntentListener(ServiceConst.COMMAND_NEXT, this);
|
||||
mIntentManager.registerIntentListener(ServiceConst.COMMAND_PREVIOUS, this);
|
||||
mIntentManager.registerIntentListener(ServiceConst.COMMAND_SWITCH_CARD, this);
|
||||
mIntentManager.registerIntentListener(ServiceConst.COMMAND_MY_LOCATION, this);
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_READY, this);
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_MOCK, this);
|
||||
mIntentManager.registerIntentListener(ServiceConst.COMMAND_BACK, this);
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, this);
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_AUTO_NAVI_SEND, this);
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_MOGO, this);
|
||||
mIntentManager.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this);
|
||||
|
||||
mFragmentManager = MarkerServiceHandler.getFragmentManager();
|
||||
|
||||
mFragmentManager.addMainFragmentStackTransactionListener( this );
|
||||
mFragmentManager.addMainFragmentStackTransactionListener(this);
|
||||
|
||||
Intent intent = new Intent( "com.freedom.ser.ACTION" );
|
||||
intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
mContext.sendBroadcast( intent );
|
||||
Intent intent = new Intent("com.freedom.ser.ACTION");
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
mContext.sendBroadcast(intent);
|
||||
|
||||
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
MoGoAiCloudRealTime.startRealTime( mContext, DebugConfig.getSocketAppId() );
|
||||
if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) {
|
||||
MoGoAiCloudRealTime.startRealTime(mContext, DebugConfig.getSocketAppId());
|
||||
}
|
||||
}
|
||||
|
||||
private void initWorkThread() {
|
||||
mThreadHandler = new RefreshWorkThreadHandler( WorkThreadHandler.getInstance().getLooper() ) {
|
||||
mThreadHandler = new RefreshWorkThreadHandler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
@Override
|
||||
protected void handleMapChangedMessage( Message msg ) {
|
||||
if ( msg.obj instanceof RefreshObject ) {
|
||||
RefreshObject ro = ( ( RefreshObject ) msg.obj );
|
||||
if ( invokeRefreshWhenTranslationByUser( ro.mLonLat ) ) {
|
||||
notifyRefreshData( ro.mLonLat, ro.mRadius, ro.mCallback );
|
||||
protected void handleMapChangedMessage(Message msg) {
|
||||
if (msg.obj instanceof RefreshObject) {
|
||||
RefreshObject ro = ((RefreshObject) msg.obj);
|
||||
if (invokeRefreshWhenTranslationByUser(ro.mLonLat)) {
|
||||
notifyRefreshData(ro.mLonLat, ro.mRadius, ro.mCallback);
|
||||
mLastCustomRefreshCenterLocation = ro.mLonLat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleRequestDataMessage( Message msg ) {
|
||||
if ( msg.obj instanceof RefreshObject ) {
|
||||
RefreshObject ro = ( ( RefreshObject ) msg.obj );
|
||||
if ( ro.mLonLat == null ) {
|
||||
protected void handleRequestDataMessage(Message msg) {
|
||||
if (msg.obj instanceof RefreshObject) {
|
||||
RefreshObject ro = ((RefreshObject) msg.obj);
|
||||
if (ro.mLonLat == null) {
|
||||
invokeAutoRefreshStrategy();
|
||||
Logger.w( TAG, "lonLat is null." );
|
||||
CallerLogger.INSTANCE.w(M_OLD_OTHER + TAG, "lonLat is null.");
|
||||
return;
|
||||
}
|
||||
//请求大而全数据,刷新地图POI
|
||||
mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
mRefreshModel.refreshExplorerWayData(ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback);
|
||||
CallerLogger.INSTANCE.i(M_OLD_OTHER + TAG, "刷新半径 = " + ro.mRadius + ", 点 = " + ro.mLonLat + " , zoomLevel = " + mLastZoomLevel + ", amount = " + ro.mAmount);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void registerMogoReceiver( Context context ) {
|
||||
if ( context == null ) {
|
||||
private void registerMogoReceiver(Context context) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
List< MogoModule > modules = MogoModulePaths.getModules();
|
||||
List<MogoModule> modules = MogoModulePaths.getModules();
|
||||
if (modules.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
mAIAssistReceiver = new MogoReceiver( context );
|
||||
mAIAssistReceiver = new MogoReceiver(context);
|
||||
IntentFilter filter = new IntentFilter();
|
||||
if (!modules.isEmpty()) {
|
||||
for ( MogoModule module : modules ) {
|
||||
if ( TextUtils.isEmpty( module.getBroadcastAction() ) ) {
|
||||
for (MogoModule module : modules) {
|
||||
if (TextUtils.isEmpty(module.getBroadcastAction())) {
|
||||
continue;
|
||||
}
|
||||
filter.addAction( module.getBroadcastAction() );
|
||||
filter.addAction(module.getBroadcastAction());
|
||||
}
|
||||
}
|
||||
filter.addAction( MogoReceiver.VOICE_ACTION );
|
||||
filter.addAction(MogoReceiver.VOICE_ACTION);
|
||||
// 小智语音
|
||||
filter.addAction( MogoReceiver.ACTION_VOICE_UI );
|
||||
filter.addAction( MogoReceiver.ACTION_VOICE_READY );
|
||||
filter.addAction( MogoReceiver.ACTION_MOCK );
|
||||
filter.addAction( Intent.ACTION_CLOSE_SYSTEM_DIALOGS );
|
||||
filter.addAction( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER );
|
||||
filter.addAction( MogoReceiver.ACTION_AUTO_NAVI_SEND );
|
||||
filter.addAction( MogoReceiver.ACTION_MOGO );
|
||||
filter.addAction( ConnectivityManager.CONNECTIVITY_ACTION );
|
||||
filter.addAction(MogoReceiver.ACTION_VOICE_UI);
|
||||
filter.addAction(MogoReceiver.ACTION_VOICE_READY);
|
||||
filter.addAction(MogoReceiver.ACTION_MOCK);
|
||||
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||
filter.addAction(MogoReceiver.ACTION_AUTO_NAVI_RECEIVER);
|
||||
filter.addAction(MogoReceiver.ACTION_AUTO_NAVI_SEND);
|
||||
filter.addAction(MogoReceiver.ACTION_MOGO);
|
||||
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
try {
|
||||
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error. " );
|
||||
context.getApplicationContext().registerReceiver(mAIAssistReceiver, filter);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_OLD_OTHER + TAG, "registerMogoReceiver error : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +405,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
|
||||
private void initMapStatus() {
|
||||
if ( mIsMapStatusOk ) {
|
||||
if (mIsMapStatusOk) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -412,7 +413,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
float height = getMapCameraFactHeight();
|
||||
mIsVertical = width < height;
|
||||
mIsMapStatusOk = true;
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -422,8 +423,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private float getMapCameraFactWidth() {
|
||||
try {
|
||||
return Utils.calculateLineDistance( mCameraNorthEastPosition, new MogoLatLng( mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon ) );
|
||||
} catch ( Exception e ) {
|
||||
return Utils.calculateLineDistance(mCameraNorthEastPosition, new MogoLatLng(mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon));
|
||||
} catch (Exception e) {
|
||||
return ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS;
|
||||
}
|
||||
}
|
||||
@@ -433,55 +434,55 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private float getMapCameraFactHeight() {
|
||||
try {
|
||||
return Utils.calculateLineDistance( mCameraSouthWestPosition, new MogoLatLng( mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon ) );
|
||||
} catch ( Exception e ) {
|
||||
return Utils.calculateLineDistance(mCameraSouthWestPosition, new MogoLatLng(mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon));
|
||||
} catch (Exception e) {
|
||||
return ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
switch ( motionEvent.getActionMasked() ) {
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
switch (motionEvent.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if ( mLastZoomLevel == 0 ) {
|
||||
if (mLastZoomLevel == 0) {
|
||||
mLastZoomLevel = mUiController.getZoomLevel();
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT, false );
|
||||
mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR );
|
||||
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT );
|
||||
restartAutoRefreshAtTime(ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT, false);
|
||||
mThreadHandler.removeMessages(ServiceConst.MSG_LOCK_CAR);
|
||||
mThreadHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopAutoRefreshStrategy() {
|
||||
stopAutoRefreshStrategy( true );
|
||||
stopAutoRefreshStrategy(true);
|
||||
}
|
||||
|
||||
private void stopAutoRefreshStrategy( boolean stopOnlineCarRefresh ) {
|
||||
mHandler.removeMessages( ServiceConst.MSG_TYPE_REFRESH_DECREASE );
|
||||
if ( stopOnlineCarRefresh ) {
|
||||
private void stopAutoRefreshStrategy(boolean stopOnlineCarRefresh) {
|
||||
mHandler.removeMessages(ServiceConst.MSG_TYPE_REFRESH_DECREASE);
|
||||
if (stopOnlineCarRefresh) {
|
||||
MapMarkerManager.getInstance().stopAutoRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR );
|
||||
if ( !isLock ) {
|
||||
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT );
|
||||
public void onLockMap(boolean isLock) {
|
||||
mThreadHandler.removeMessages(ServiceConst.MSG_LOCK_CAR);
|
||||
if (!isLock) {
|
||||
mThreadHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
|
||||
public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
|
||||
|
||||
MapMarkerManager.getInstance().syncLocation( latLng.lon, latLng.lat );
|
||||
MapMarkerManager.getInstance().syncLocation(latLng.lon, latLng.lat);
|
||||
|
||||
Logger.d( TAG, "zoom = %s", zoom );
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "zoom = " + zoom);
|
||||
|
||||
if ( mIsCameraInited ) {
|
||||
if (mIsCameraInited) {
|
||||
mLastZoomLevel = zoom;
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mIsCameraInited = false;
|
||||
@@ -491,40 +492,40 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
// 部分非用户操作导致地图视图变化:绘线、圈点等不触发用户刷新
|
||||
// 消费状态
|
||||
if ( mStatusManager.isUserInteracted() ) {
|
||||
if (mStatusManager.isUserInteracted()) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
return;
|
||||
}
|
||||
|
||||
// v2x // adas 状态下不做任何操作
|
||||
if ( mStatusManager.isV2XShow() ) {
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
return;
|
||||
}
|
||||
|
||||
// 搜索页面显示时不做任何策略
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动刷新触发
|
||||
if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) {
|
||||
if (mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel()) {
|
||||
// 缩放级别缩小
|
||||
notifyRefreshData( latLng, getQueryRadius(), mCustomRefreshCallback );
|
||||
notifyRefreshData(latLng, getQueryRadius(), mCustomRefreshCallback);
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
} else if ( mLastZoomLevel - zoom < 0 ) {
|
||||
} else if (mLastZoomLevel - zoom < 0) {
|
||||
mLastZoomLevel = zoom;
|
||||
} else if ( mLastZoomLevel == zoom ) {
|
||||
} else if (mLastZoomLevel == zoom) {
|
||||
// 手动平移
|
||||
Message msg = Message.obtain();
|
||||
msg.what = ServiceConst.MSG_MAP_CHANGED;
|
||||
msg.obj = new RefreshObject( mCustomRefreshCallback, getQueryRadius(), latLng, 0 );
|
||||
mThreadHandler.sendMessage( msg );
|
||||
msg.obj = new RefreshObject(mCustomRefreshCallback, getQueryRadius(), latLng, 0);
|
||||
mThreadHandler.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,10 +533,10 @@ public class MogoServices implements IMogoMapListener,
|
||||
mCameraSouthWestPosition = mUiController.getCameraSouthWestPosition();
|
||||
mCameraNorthEastPosition = mUiController.getCameraNorthEastPosition();
|
||||
int radius;
|
||||
if ( mIsVertical ) {
|
||||
radius = ( ( int ) ( getMapCameraFactWidth() / 2 ) );
|
||||
if (mIsVertical) {
|
||||
radius = ((int) (getMapCameraFactWidth() / 2));
|
||||
} else {
|
||||
radius = ( ( int ) ( getMapCameraFactHeight() / 2 ) );
|
||||
radius = ((int) (getMapCameraFactHeight() / 2));
|
||||
}
|
||||
return Math.max(radius, 1000);
|
||||
}
|
||||
@@ -543,66 +544,66 @@ public class MogoServices implements IMogoMapListener,
|
||||
/**
|
||||
* 平移地图刷新策略
|
||||
*/
|
||||
private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) {
|
||||
private boolean invokeRefreshWhenTranslationByUser(MogoLatLng latLng) {
|
||||
try {
|
||||
float factor;
|
||||
if ( mIsVertical ) {
|
||||
if (mIsVertical) {
|
||||
factor = getMapCameraFactWidth();
|
||||
} else {
|
||||
factor = getMapCameraFactHeight();
|
||||
}
|
||||
if ( factor == 0.0f ) {
|
||||
if (factor == 0.0f) {
|
||||
return false;
|
||||
}
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
return distance > ( factor / 2 );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "warming. " );
|
||||
float distance = Utils.calculateLineDistance(latLng, mLastCustomRefreshCenterLocation);
|
||||
return distance > (factor / 2);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(M_OLD_OTHER + TAG, "invokeRefreshWhenTranslationByUser warming : " + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
|
||||
if ( !DebugConfig.isMapBased() ) {
|
||||
if (!DebugConfig.isMapBased()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mStatusManager.isMainPageLaunched() ) {
|
||||
if (!mStatusManager.isMainPageLaunched()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
if (!mStatusManager.isMainPageOnResume()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mStatusManager.isV2XShow() ) {
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( location == null ) {
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 自动刷新触发
|
||||
final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
if ( mLastAutoRefreshLocation == null ) {
|
||||
startFirstLocationRequest( point );
|
||||
final MogoLatLng point = new MogoLatLng(location.getLatitude(), location.getLongitude());
|
||||
if (mLastAutoRefreshLocation == null) {
|
||||
startFirstLocationRequest(point);
|
||||
return;
|
||||
}
|
||||
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point );
|
||||
if ( distance > mAutoRefreshStrategy.getDistance() ) {
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
float distance = Utils.calculateLineDistance(mLastAutoRefreshLocation, point);
|
||||
if (distance > mAutoRefreshStrategy.getDistance()) {
|
||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
||||
mUiController.recoverLockMode();
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mUiController.changeZoom( ServiceConst.DEFAULT_ZOOM_LEVEL );
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mUiController.changeZoom(ServiceConst.DEFAULT_ZOOM_LEVEL);
|
||||
mLastAutoRefreshLocation = point;
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,99 +612,99 @@ public class MogoServices implements IMogoMapListener,
|
||||
*
|
||||
* @param point {@link MogoLatLng}
|
||||
*/
|
||||
private void startFirstLocationRequest( MogoLatLng point ) {
|
||||
private void startFirstLocationRequest(MogoLatLng point) {
|
||||
mLastAutoRefreshLocation = point;
|
||||
mLoopRequest = true;
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
if ( latLng == null ) {
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
if (latLng == null) {
|
||||
return;
|
||||
}
|
||||
// poi 定位无法获取时,使用该定位
|
||||
if ( mLastAutoRefreshLocation == null ) {
|
||||
MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
|
||||
startFirstLocationRequest( point );
|
||||
if (mLastAutoRefreshLocation == null) {
|
||||
MogoLatLng point = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
startFirstLocationRequest(point);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private void notifyRefreshData( MogoLatLng latLng, int radius, RefreshCallback callback ) {
|
||||
if ( !mStatusManager.isMainPageLaunched() ) {
|
||||
private void notifyRefreshData(MogoLatLng latLng, int radius, RefreshCallback callback) {
|
||||
if (!mStatusManager.isMainPageLaunched()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
if (!mStatusManager.isMainPageOnResume()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
int amount = 20;
|
||||
|
||||
Message msg = Message.obtain();
|
||||
msg.what = ServiceConst.MSG_REQUEST_DATA;
|
||||
msg.obj = new RefreshObject( callback, radius, latLng, amount );
|
||||
if ( mThreadHandler != null ) {
|
||||
mThreadHandler.sendMessage( msg );
|
||||
msg.obj = new RefreshObject(callback, radius, latLng, amount);
|
||||
if (mThreadHandler != null) {
|
||||
mThreadHandler.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public void restartAutoRefreshAtTime( long time ) {
|
||||
restartAutoRefreshAtTime( time, true );
|
||||
public void restartAutoRefreshAtTime(long time) {
|
||||
restartAutoRefreshAtTime(time, true);
|
||||
}
|
||||
|
||||
public void clearAllData() {
|
||||
try {
|
||||
MarkerServiceHandler.getMapService().getMarkerManager( mContext ).removeMarkers();
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getMapService().getMarkerManager(mContext).removeMarkers();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void restartAutoRefreshAtTime( long time, boolean stopOnlineCarRefresh ) {
|
||||
if ( time < 0 ) {
|
||||
Logger.w( TAG, "refresh request case time < 0, set to 0 and go on." );
|
||||
private void restartAutoRefreshAtTime(long time, boolean stopOnlineCarRefresh) {
|
||||
if (time < 0) {
|
||||
CallerLogger.INSTANCE.w(M_OLD_OTHER + TAG, "refresh request case time < 0, set to 0 and go on.");
|
||||
time = 0;
|
||||
}
|
||||
stopAutoRefreshStrategy( stopOnlineCarRefresh );
|
||||
stopAutoRefreshStrategy(stopOnlineCarRefresh);
|
||||
mRefreshRemainingTime = time;
|
||||
long delay = ServiceConst.DECREASE_INTERVAL;
|
||||
if ( mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL ) {
|
||||
if (mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL) {
|
||||
delay = mRefreshRemainingTime;
|
||||
}
|
||||
if ( time == 0 ) {
|
||||
if (time == 0) {
|
||||
invokeAutoRefresh();
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay );
|
||||
mHandler.sendEmptyMessageDelayed(ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay);
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshStrategy() {
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
||||
mUiController.recoverLockMode();// 锁车代替移到中心点
|
||||
restartAutoRefreshAtTime( 0 );
|
||||
restartAutoRefreshAtTime(0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String command, Intent intent ) {
|
||||
public void onIntentReceived(String command, Intent intent) {
|
||||
|
||||
if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
|
||||
onActionDone( MogoAction.Next );
|
||||
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
|
||||
onActionDone( MogoAction.Prev );
|
||||
if (ServiceConst.COMMAND_NEXT.equals(command)) {
|
||||
onActionDone(MogoAction.Next);
|
||||
} else if (ServiceConst.COMMAND_PREVIOUS.equals(command)) {
|
||||
onActionDone(MogoAction.Prev);
|
||||
} else {
|
||||
if ( TextUtils.equals( command, ConnectivityManager.CONNECTIVITY_ACTION )
|
||||
&& NetworkUtils.isConnected( mContext ) ) {
|
||||
mIntentManager.unregisterIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, this );
|
||||
if (TextUtils.equals(command, ConnectivityManager.CONNECTIVITY_ACTION)
|
||||
&& NetworkUtils.isConnected(mContext)) {
|
||||
mIntentManager.unregisterIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this);
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
|
||||
IntentHandlerFactory.getInstance().handle(mContext, command, intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,96 +712,96 @@ public class MogoServices implements IMogoMapListener,
|
||||
* 注册桌面免唤醒指令
|
||||
*/
|
||||
public void registerInternalUnWakeupWords() {
|
||||
if ( mInternalUnWakeupRegisterStatus ) {
|
||||
if (mInternalUnWakeupRegisterStatus) {
|
||||
return;
|
||||
}
|
||||
mInternalUnWakeupRegisterStatus = true;
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, ServiceConst.CMD_UN_WAKEUP_WORDS_MY_LOCATION, this );
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, ServiceConst.CMD_UN_WAKEUP_WORDS_MY_LOCATION, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销桌面免唤醒指令
|
||||
*/
|
||||
public void unregisterInternalUnWakeupWords() {
|
||||
if ( !mInternalUnWakeupRegisterStatus ) {
|
||||
if (!mInternalUnWakeupRegisterStatus) {
|
||||
return;
|
||||
}
|
||||
mInternalUnWakeupRegisterStatus = false;
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, this );
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) {
|
||||
onActionDone( MogoAction.Prev );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) {
|
||||
onActionDone( MogoAction.Next );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
public void onCmdSelected(String cmd) {
|
||||
if (TextUtils.equals(ServiceConst.CMD_UN_WAKE_PREV, cmd)) {
|
||||
onActionDone(MogoAction.Prev);
|
||||
} else if (TextUtils.equals(ServiceConst.CMD_UN_WAKE_NEXT, cmd)) {
|
||||
onActionDone(MogoAction.Next);
|
||||
} else if (TextUtils.equals(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd)) {
|
||||
if (mStatusManager.isMainPageOnResume()) {
|
||||
mUiController.recoverLockMode();
|
||||
}
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_BACK, cmd ) ) {
|
||||
} else if (TextUtils.equals(ServiceConst.CMD_BACK, cmd)) {
|
||||
mFragmentManager.clearAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void onActionDone( MogoAction action ) {
|
||||
if ( !mStatusManager.isMainPageOnResume() ) {
|
||||
private void onActionDone(MogoAction action) {
|
||||
if (!mStatusManager.isMainPageOnResume()) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isV2XShow() ) {
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
// 分发到V2X
|
||||
mActionManager.invoke( "V2X_UI", action );
|
||||
mActionManager.invoke("V2X_UI", action);
|
||||
} else {
|
||||
String biz = MapMarkerManager.getInstance().getCurrentModuleName();
|
||||
mActionManager.invoke( biz, action );
|
||||
mActionManager.invoke(biz, action);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransaction( int size ) {
|
||||
if ( size == 0 ) {
|
||||
mUiController.showMyLocation( true );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK );
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
public void onTransaction(int size) {
|
||||
if (size == 0) {
|
||||
mUiController.showMyLocation(true);
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ServiceConst.CMD_BACK);
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
mStatusManager.setSearchUIShow(TAG, false);
|
||||
}
|
||||
mUiController.recoverLockMode();
|
||||
} else {
|
||||
mUiController.showMyLocation( false );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
mUiController.showMyLocation(false);
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
if ( DebugConfig.isIsScheduleCalculateNotHomeCompanyDistanceForPush() ) {
|
||||
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush" );
|
||||
scheduleCalculationNotHomeCompanyDistanceForPush( 1, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
|
||||
if (DebugConfig.isIsScheduleCalculateNotHomeCompanyDistanceForPush()) {
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush");
|
||||
scheduleCalculationNotHomeCompanyDistanceForPush(1, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH);
|
||||
} else {
|
||||
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush un support" );
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush un support");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
Logger.d( TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg" );
|
||||
mHandler.removeMessages( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg");
|
||||
mHandler.removeMessages(ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH);
|
||||
}
|
||||
|
||||
/**
|
||||
* 延时一分钟发起计算导航目的地推送策略
|
||||
*/
|
||||
public void scheduleCalculationNotHomeCompanyDistanceForPush( int time, long delay ) {
|
||||
public void scheduleCalculationNotHomeCompanyDistanceForPush(int time, long delay) {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH;
|
||||
msg.arg1 = time;
|
||||
mHandler.sendMessageDelayed( msg, delay );
|
||||
mHandler.sendMessageDelayed(msg, delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
Logger.d( TAG, "MogoServices do nothings." );
|
||||
CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "MogoServices do nothings.");
|
||||
MoGoAiCloudRealTime.stopRealTime();
|
||||
}
|
||||
|
||||
@@ -815,25 +816,24 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
Log.i(TAG, "onMapModeChanged:" + ui + " mLastStatusIsVr:" + mLastStatusIsVr);
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
clearAllData();
|
||||
if ( ui == EnumMapUI.Type_VR ) {
|
||||
if ( !mLastStatusIsVr ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
if (ui == EnumMapUI.Type_VR) {
|
||||
if (!mLastStatusIsVr) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已开启鹰眼模式" );
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("已开启鹰眼模式");
|
||||
}
|
||||
mLastStatusIsVr = true;
|
||||
}
|
||||
} else {
|
||||
if ( mLastStatusIsVr ) {
|
||||
if (mLastStatusIsVr) {
|
||||
mLastStatusIsVr = false;
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, false);
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已退出鹰眼模式" );
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("已退出鹰眼模式");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,14 @@ package com.mogo.module.service;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public
|
||||
@@ -123,7 +121,7 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
intent.putExtra("data", data.toString());
|
||||
AbsMogoApplication.getApp().sendBroadcast(intent);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "error.");
|
||||
CallerLogger.INSTANCE.e(TAG, "notifySeekHelpingStatusChanged exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +155,7 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
try {
|
||||
MapMarkerManager.getInstance().onCloseCurrentSelectedMarker();
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "onTopViewStatusChanged");
|
||||
CallerLogger.INSTANCE.e(TAG, "onTopViewStatusChanged exception : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.service.actionmanager;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionListener;
|
||||
@@ -74,7 +73,6 @@ public class MogoActionHandler implements IMogoActionManager {
|
||||
|
||||
@Override
|
||||
public void invoke( String biz, MogoAction action ) {
|
||||
Logger.d( TAG, "dispatch action %s to %s", action, biz );
|
||||
if ( !mListeners.containsKey( biz ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.module.service.datamanager;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.datamanager.IMogoDataChanged2Listener;
|
||||
import com.mogo.service.datamanager.IMogoDataChangedListener;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
@@ -24,7 +24,7 @@ public class MogoDataHandler implements IMogoDataManager {
|
||||
|
||||
private static final String TAG = "MogoDataHandler";
|
||||
|
||||
private Map< String, List< IMogoDataChangedListener > > mListeners = new HashMap<>();
|
||||
private Map<String, List<IMogoDataChangedListener>> mListeners = new HashMap<>();
|
||||
|
||||
private MogoDataHandler() {
|
||||
// private constructor
|
||||
@@ -39,87 +39,87 @@ public class MogoDataHandler implements IMogoDataManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void registerDataListener(String tag, IMogoDataChangedListener listener ) {
|
||||
if ( listener == null || TextUtils.isEmpty( tag ) ) {
|
||||
public synchronized void registerDataListener(String tag, IMogoDataChangedListener listener) {
|
||||
if (listener == null || TextUtils.isEmpty(tag)) {
|
||||
return;
|
||||
}
|
||||
if ( !mListeners.containsKey( tag ) || mListeners.get( tag ) == null ) {
|
||||
mListeners.put( tag, new ArrayList<>() );
|
||||
if (!mListeners.containsKey(tag) || mListeners.get(tag) == null) {
|
||||
mListeners.put(tag, new ArrayList<>());
|
||||
}
|
||||
mListeners.get( tag ).add( listener );
|
||||
mListeners.get(tag).add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void unregisterListener(String tag, IMogoDataChangedListener listener ) {
|
||||
if ( listener == null || TextUtils.isEmpty( tag ) ) {
|
||||
public synchronized void unregisterListener(String tag, IMogoDataChangedListener listener) {
|
||||
if (listener == null || TextUtils.isEmpty(tag)) {
|
||||
return;
|
||||
}
|
||||
if ( mListeners.containsKey( tag ) && mListeners.get( tag ) != null ) {
|
||||
mListeners.get( tag ).remove( listener );
|
||||
if (mListeners.containsKey(tag) && mListeners.get(tag) != null) {
|
||||
mListeners.get(tag).remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataFrom( String module, Object object ) {
|
||||
if ( module == null || mListeners.get( module ) == null ) {
|
||||
public void removeDataFrom(String module, Object object) {
|
||||
if (module == null || mListeners.get(module) == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Iterator< IMogoDataChangedListener > iterator = mListeners.get( module ).iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
Iterator<IMogoDataChangedListener> iterator = mListeners.get(module).iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoDataChangedListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoDataChanged2Listener ) {
|
||||
( ( IMogoDataChanged2Listener ) listener ).onDataRemoved( module, object );
|
||||
if (listener instanceof IMogoDataChanged2Listener) {
|
||||
((IMogoDataChanged2Listener) listener).onDataRemoved(module, object);
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "removeDataFrom exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addData2( String module, Object object ) {
|
||||
if ( module == null || mListeners.get( module ) == null ) {
|
||||
public void addData2(String module, Object object) {
|
||||
if (module == null || mListeners.get(module) == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Iterator< IMogoDataChangedListener > iterator = mListeners.get( module ).iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
Iterator<IMogoDataChangedListener> iterator = mListeners.get(module).iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoDataChangedListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoDataChanged2Listener ) {
|
||||
( ( IMogoDataChanged2Listener ) listener ).onDataAdded( module, object );
|
||||
if (listener instanceof IMogoDataChanged2Listener) {
|
||||
((IMogoDataChanged2Listener) listener).onDataAdded(module, object);
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "addData2 exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncData( String module, Object object ) {
|
||||
if ( module == null || mListeners.get( module ) == null ) {
|
||||
public void syncData(String module, Object object) {
|
||||
if (module == null || mListeners.get(module) == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Iterator< IMogoDataChangedListener > iterator = mListeners.get( module ).iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
Iterator<IMogoDataChangedListener> iterator = mListeners.get(module).iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoDataChangedListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
listener.onDataSetChanged( object );
|
||||
if (listener != null) {
|
||||
listener.onDataSetChanged(object);
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "syncData exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void invoke( String tag, Object data ) {
|
||||
syncData( tag, data );
|
||||
public void invoke(String tag, Object data) {
|
||||
syncData(tag, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
|
||||
@@ -19,46 +19,46 @@ abstract class RefreshWorkThreadHandler extends Handler {
|
||||
|
||||
private static final String TAG = "RefreshWorkThreadHandler";
|
||||
|
||||
public RefreshWorkThreadHandler( Looper looper ) {
|
||||
super( looper );
|
||||
public RefreshWorkThreadHandler(Looper looper) {
|
||||
super(looper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) {
|
||||
public final void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == ServiceConst.MSG_MAP_CHANGED) {
|
||||
try {
|
||||
handleMapChangedMessage( msg );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "handleMapChangedMessage" );
|
||||
handleMapChangedMessage(msg);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "handleMapChangedMessage exception : " + e);
|
||||
}
|
||||
} else if ( msg.what == ServiceConst.MSG_REQUEST_DATA ) {
|
||||
} else if (msg.what == ServiceConst.MSG_REQUEST_DATA) {
|
||||
try {
|
||||
handleRequestDataMessage( msg );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "handleRequestDataMessage" );
|
||||
handleRequestDataMessage(msg);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "handleRequestDataMessage exception : " + e);
|
||||
}
|
||||
} else if ( msg.what == ServiceConst.MSG_LOCK_CAR ) {
|
||||
} else if (msg.what == ServiceConst.MSG_LOCK_CAR) {
|
||||
try {
|
||||
handleLockCarMessage( msg );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "handleLockCarMessage" );
|
||||
handleLockCarMessage(msg);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "handleLockCarMessage exception : " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void handleMapChangedMessage( Message msg );
|
||||
protected abstract void handleMapChangedMessage(Message msg);
|
||||
|
||||
protected abstract void handleRequestDataMessage( Message msg );
|
||||
protected abstract void handleRequestDataMessage(Message msg);
|
||||
|
||||
protected void handleLockCarMessage( Message msg ) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow() ) {
|
||||
protected void handleLockCarMessage(Message msg) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setUserInteractionStatus( TAG, true, false );
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setUserInteractionStatus(TAG, true, false);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().recoverLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.service.intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
@@ -50,12 +49,10 @@ public class AccStatusIntentHandler implements IntentHandler {
|
||||
if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true );
|
||||
Logger.d( TAG, "acc status: %s", true );
|
||||
}
|
||||
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
|
||||
Logger.d( TAG, "acc status: %s", false );
|
||||
}
|
||||
} else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) {
|
||||
int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF );
|
||||
@@ -67,13 +64,11 @@ public class AccStatusIntentHandler implements IntentHandler {
|
||||
newIntent.putExtra( "acc", true );
|
||||
newIntent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
context.sendBroadcast( newIntent );
|
||||
Logger.d( TAG, "发送广播:com.freedom.ser.ACTION" );
|
||||
}
|
||||
boolean accOn = state == ACC_ON;
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "acc status: %s", state );
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn );
|
||||
if ( state == ACC_ON ) {
|
||||
LauncherCardRefresher.getInstance( context ).start();
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.graphics.BitmapFactory;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
@@ -20,12 +19,10 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
@@ -110,7 +107,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
geoSearch.setGeoSearchListener(new IMogoGeoSearchListener() {
|
||||
@Override
|
||||
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
|
||||
Logger.d(TAG, GsonUtil.jsonFromObject(regeocodeResult));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -374,7 +370,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
double[] translateCoor = CoordinateUtils.transformWgsToGcj(lat, lon);
|
||||
double[] originCoor = CoordinateUtils.transformGcj02toWgs84(translateCoor[1], translateCoor[0]);
|
||||
double delta = CoordinateUtils.calculateLineDistance(lon, lat, originCoor[0], originCoor[1]);
|
||||
Logger.d(TAG, "偏差值:%s", delta);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -717,10 +712,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
JSONObject jo = new JSONObject(line);
|
||||
//改变rtk定位数据,触发自车移动
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo);
|
||||
Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(jo);
|
||||
Log.i("mock-timer-loc", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i("mock-timer-loc-info", jo.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -753,7 +745,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
//
|
||||
// final long start = System.currentTimeMillis();
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
// Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
//// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.service.intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
@@ -22,7 +21,6 @@ class NetworkChangedIntentHandler implements IntentHandler {
|
||||
public void handle( Context context, Intent intent ) {
|
||||
if ( NetworkUtils.isConnected( context ) ) {
|
||||
try {
|
||||
Logger.d( TAG, "setTrafficEnabled" );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
/**
|
||||
@@ -48,6 +47,5 @@ public class WholeVoiceCommandIntentHandler implements IntentHandler {
|
||||
if ( TextUtils.isEmpty( command ) ) {
|
||||
return;
|
||||
}
|
||||
Logger.i(TAG,"command:"+command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
@@ -173,7 +172,6 @@ class LauncherCardRefresher {
|
||||
if ( mStart ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "start" );
|
||||
mDefaultConfigCounter = 0;
|
||||
mRefreshTicketCounter = 0;
|
||||
mRefreshStrategy = mLauncherCardConfigStrategy;
|
||||
@@ -216,7 +214,6 @@ class LauncherCardRefresher {
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG );
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG2 );
|
||||
mHandler.removeMessages( MSG_WAIT_NETWORK );
|
||||
Logger.d( TAG, "stop" );
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
@@ -259,7 +256,6 @@ class LauncherCardRefresher {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, msg );
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( msg );
|
||||
}
|
||||
|
||||
@@ -271,7 +267,6 @@ class LauncherCardRefresher {
|
||||
intent.putExtra( "v2x_warning_eventCount", amount );
|
||||
intent.putExtra( "v2x_warning_info", info );
|
||||
mContext.sendBroadcast( intent );
|
||||
Logger.d( TAG, "发送广播到桌面卡片." );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +289,6 @@ class LauncherCardRefresher {
|
||||
intent.putExtra( "v2x_card_endTime", mDefaultLauncherCardConfig.endTime );
|
||||
intent.putExtra( "v2x_card_is_default", true );
|
||||
mContext.sendBroadcast( intent );
|
||||
Logger.d( TAG, "发送默认配置广播到桌面卡片." );
|
||||
if ( !TextUtils.isEmpty( mDefaultLauncherCardConfig.content ) ) {
|
||||
mLaunchTTSText = mDefaultLauncherCardConfig.content;
|
||||
}
|
||||
@@ -354,17 +348,14 @@ class LauncherCardRefresher {
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "获取配置失败" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess( LauncherCardAdvertisementData data ) {
|
||||
super.onSuccess( data );
|
||||
if ( data == null || data.result == null ) {
|
||||
Logger.d( TAG, "carAdvertisingList is empty." );
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "获取配置成功" );
|
||||
handleGotCarAdvertisingList( data.result );
|
||||
}
|
||||
|
||||
@@ -374,7 +365,6 @@ class LauncherCardRefresher {
|
||||
if ( code == 100046 ) {
|
||||
refreshTicket();
|
||||
}
|
||||
Logger.e( TAG, "获取配置失败 msg = %s, code = %s", message, code );
|
||||
}
|
||||
} );
|
||||
}
|
||||
@@ -388,7 +378,6 @@ class LauncherCardRefresher {
|
||||
if ( lastPlayDateTime != 0 ) {
|
||||
Date lastPlayDate = new Date( lastPlayDateTime );
|
||||
if ( lastPlayDate.getDate() == new Date( System.currentTimeMillis() ).getDate() ) {
|
||||
Logger.d( TAG, "一天只播报一次" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -396,8 +385,6 @@ class LauncherCardRefresher {
|
||||
String name = SharedPrefsMgr.getInstance( mContext ).getString( KEY_LAST_LOAD_TTS_TYPE, LauncherCardRefreshType.Weather.name() );
|
||||
LauncherCardRefreshType type = LauncherCardRefreshType.valueOf( name );
|
||||
|
||||
Logger.d( TAG, "本次播报:%s", name );
|
||||
|
||||
MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( mContext ).getLastKnowLocation();
|
||||
TtsConfigBody body = new TtsConfigBody()
|
||||
.addType( LauncherCardRefreshType.NearRoads.getVal() )
|
||||
@@ -418,14 +405,12 @@ class LauncherCardRefresher {
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "queryBroadCastInfo" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess( TtsConfigData data ) {
|
||||
super.onSuccess( data );
|
||||
if ( data == null || data.result == null ) {
|
||||
Logger.d( TAG, "获取数据为空" );
|
||||
return;
|
||||
}
|
||||
handleTtsConfig( data, type );
|
||||
@@ -437,7 +422,6 @@ class LauncherCardRefresher {
|
||||
if ( code == 100046 ) {
|
||||
refreshTicket();
|
||||
}
|
||||
Logger.e( TAG, "获取配置失败 msg = %s, code = %s", message, code );
|
||||
}
|
||||
} );
|
||||
}
|
||||
@@ -496,7 +480,6 @@ class LauncherCardRefresher {
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "header = %s", header.type.getVal() );
|
||||
TtsConfigNode pointer = header;
|
||||
|
||||
do {
|
||||
@@ -636,18 +619,15 @@ class LauncherCardRefresher {
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type.name() );
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "v2x_play", properties );
|
||||
Logger.d( TAG, "本次播报:%s,下次播报:%s", type.name(), LauncherCardRefreshType.valueOf( type.getNext() ).name() );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LAST_LOAD_TTS_DATE, System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
|
||||
private void refreshTicket() {
|
||||
mRefreshTicketCounter++;
|
||||
Logger.d( TAG, "刷新ticket" );
|
||||
MarkerServiceHandler.getApis().getPassportManagerApi().requestTicket( new IMogoTicketCallback() {
|
||||
@Override
|
||||
public void onTicketGot( String ticket ) {
|
||||
Logger.d( TAG, "ticket=%s", ticket );
|
||||
if ( mRefreshTicketCounter < 3 ) {
|
||||
loadNetworkConfigStrategy();
|
||||
}
|
||||
@@ -655,12 +635,10 @@ class LauncherCardRefresher {
|
||||
|
||||
@Override
|
||||
public void onError( int code, String msg ) {
|
||||
Logger.d( TAG, "code=%s, msg=%s", code, msg );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess( String token, String sn ) {
|
||||
Logger.d( TAG, "token=%s, sn=%s", token, sn );
|
||||
}
|
||||
} );
|
||||
}
|
||||
@@ -683,8 +661,6 @@ class LauncherCardRefresher {
|
||||
long curr = System.currentTimeMillis();
|
||||
if ( curr > launcherCardAdvertisement.startTime && curr < launcherCardAdvertisement.endTime ) {
|
||||
mAdvertisements.add( launcherCardAdvertisement );
|
||||
} else {
|
||||
Logger.w( TAG, "广告已过期 %s", launcherCardAdvertisement.cardContent );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,7 +694,6 @@ class LauncherCardRefresher {
|
||||
mHandler.sendMessageDelayed( msg, advertisement.popupNum * ONE_MINUTE );
|
||||
renderAdvertisement( advertisement );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "loopRenderAdvertisements" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,7 +720,6 @@ class LauncherCardRefresher {
|
||||
if ( !AppUtils.isAppForeground( mContext ) ) {
|
||||
speakTTS( advertisement.content, true );
|
||||
}
|
||||
Logger.d( TAG, "发送广告配置广播到桌面卡片." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
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.ThreadPoolService;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -95,7 +94,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param context 上下文对象
|
||||
*/
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "<------init------>");
|
||||
|
||||
if (mContext != null) {
|
||||
return;
|
||||
@@ -470,9 +468,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param response
|
||||
*/
|
||||
public void onSyncMarkerResponse(MarkerResponse response) {
|
||||
Logger.d(TAG, "onSyncMarkerResponse response ");
|
||||
if (ignoreDrawRequest()) {
|
||||
Logger.d(TAG, "onSyncMarkerResponse ignoreDraw ");
|
||||
return;
|
||||
}
|
||||
runOnTargetThread(() -> {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
@@ -30,7 +29,6 @@ public class MogoMarkerServiceImpl implements IMogoMarkerService {
|
||||
if ( object instanceof MarkerShowEntity ) {
|
||||
return MarkerServiceHandler.getMapMarkerManager().drawMapMarker( ( ( MarkerShowEntity ) object ), MarkerDrawer.MARKER_Z_INDEX_HIGH );
|
||||
}
|
||||
Logger.w( TAG, "object must instance of [com.mogo.module.common.entity.MarkerShowEntity]" );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
@@ -54,8 +53,6 @@ public class RefreshModel {
|
||||
|
||||
String data = GsonUtil.jsonFromObject( refreshBody );
|
||||
query.put( "data", data );
|
||||
Logger.d( TAG, data );
|
||||
|
||||
|
||||
mRefreshApiService.refreshDataSync( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
|
||||
@@ -27,7 +26,6 @@ class AccStatusReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
Logger.d(TAG, "收到诺威达acc广播");
|
||||
MarkerServiceHandler.init( context );
|
||||
IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent );
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ import com.mogo.service.intent.IMogoIntentManager;
|
||||
*/
|
||||
public class MogoReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "MogoReceiver";
|
||||
|
||||
/**
|
||||
* 语音
|
||||
*/
|
||||
@@ -56,7 +54,6 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
//Logger.d( TAG, action );
|
||||
if (TextUtils.equals(VOICE_ACTION, action)) {
|
||||
String cmd = intent.getStringExtra(PARAM_COMMAND);
|
||||
if (!TextUtils.isEmpty(cmd)) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.mogo.module.service.routeoverlay;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_ROUTE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
@@ -14,7 +15,7 @@ import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -81,9 +82,9 @@ public class MogoRouteOverlayManager implements
|
||||
builder.append(mLocation.getSpeed()).append(";");
|
||||
// ADASTrajectoryInfo adasTrajectoryInfo = trajectoryInfos.get(0);
|
||||
// long temp = SystemClock.currentThreadTimeMillis();
|
||||
// Log.d(TAG, "temp:"+temp+" size:" + trajectoryInfos.size());
|
||||
// Log.d(TAG, "trajectoryInfos:" + adasTrajectoryInfo.getLat()+":"+adasTrajectoryInfo.getLon());
|
||||
// Log.d(TAG, "temp:"+temp+" location:" + lat+":"+lon);
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "temp:"+temp+" size:" + trajectoryInfos.size());
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "trajectoryInfos:" + adasTrajectoryInfo.getLat()+":"+adasTrajectoryInfo.getLon());
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "temp:"+temp+" location:" + lat+":"+lon);
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
for (int i = 0; i < trajectoryInfos.size(); i++) {
|
||||
// 临时解决车尾拖线问题,丢弃距离车最近的几个经纬度,原因是惯性导航的中心靠近车尾,会导致经纬度靠近尾部,且两个数据不同频
|
||||
@@ -97,7 +98,7 @@ public class MogoRouteOverlayManager implements
|
||||
|
||||
mTrajectoryList = mogoLatLngs;
|
||||
builder.append("}");
|
||||
Log.d(TAG, builder.toString());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, builder.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,7 +121,7 @@ public class MogoRouteOverlayManager implements
|
||||
return;
|
||||
}
|
||||
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getPilotmode();
|
||||
//Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT);
|
||||
//CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG ,"onAutopilotStatusResponse:"+STATUS_AUTOPILOT);
|
||||
// if (STATUS_AUTOPILOT == 1 ){
|
||||
// if (mEnding != null){
|
||||
// RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon);
|
||||
@@ -140,7 +141,7 @@ public class MogoRouteOverlayManager implements
|
||||
if (arrivalNotification == null) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + arrivalNotification.toString());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "onArriveAt data : " + arrivalNotification.toString());
|
||||
// //演示模式下 到达终点将忽略 引导线绘制 选项关闭
|
||||
// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
|
||||
}
|
||||
@@ -157,7 +158,7 @@ public class MogoRouteOverlayManager implements
|
||||
// if (mTrajectoryList.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// Log.d(TAG, "onLocationChanged : " + mTrajectoryList.size());
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged : " + mTrajectoryList.size());
|
||||
// ArrayList list = new ArrayList();
|
||||
// for (MogoLatLng latLng : mTrajectoryList) {
|
||||
// if (!isPointOnCarFront(mLocation, latLng)) {
|
||||
@@ -171,8 +172,8 @@ public class MogoRouteOverlayManager implements
|
||||
// builder.append(latLng.getLon()).append(",");
|
||||
// builder.append(latLng.getLat()).append(",");
|
||||
// }
|
||||
// Log.d(TAG, "onLocationChanged : " + GsonUtils.toJson(builder.toString()));
|
||||
// Log.d(TAG,"onLocationChanged size = " + list.size() + "---TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "----" + STATUS_AUTOPILOT);
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged : " + GsonUtils.toJson(builder.toString()));
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG ,"onLocationChanged size = " + list.size() + "---TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "----" + STATUS_AUTOPILOT);
|
||||
// if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1) {
|
||||
// RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list);
|
||||
// }
|
||||
@@ -182,14 +183,14 @@ public class MogoRouteOverlayManager implements
|
||||
if (temp.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// Log.e(TAG, "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude());
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude());
|
||||
ArrayList list = new ArrayList();
|
||||
for (MogoLatLng latLng : temp) {
|
||||
// if(!isPointOnCarFront(mLocation,latLng)){
|
||||
list.add(latLng);
|
||||
// }
|
||||
}
|
||||
Log.d(TAG, "TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size());
|
||||
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1) {
|
||||
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list);
|
||||
}
|
||||
@@ -205,7 +206,7 @@ public class MogoRouteOverlayManager implements
|
||||
// 计算车辆与点之间的夹角
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
// Log.e(TAG,"diffAngle:"+diffAngle);
|
||||
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"diffAngle:"+diffAngle);
|
||||
if (diffAngle <= 90) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.mogo.module.service.routeoverlay;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_ROUTE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
@@ -23,6 +23,8 @@ import java.util.List;
|
||||
|
||||
public class RouteOverlayDrawer {
|
||||
|
||||
private static final String TAG = "MogoRouteOverlayManager";
|
||||
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
@@ -37,6 +39,7 @@ public class RouteOverlayDrawer {
|
||||
private Bitmap endingBitmap;
|
||||
private static volatile RouteOverlayDrawer sInstance;
|
||||
private static final String markerType = "route_ending";
|
||||
|
||||
private RouteOverlayDrawer(Context context) {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
mPolylineOptions.zIndex(75000f);
|
||||
@@ -46,7 +49,7 @@ public class RouteOverlayDrawer {
|
||||
// 引导线颜色,
|
||||
mPolylineColors = new ArrayList<>();
|
||||
mContext = context;
|
||||
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
||||
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
||||
endingBitmap = BitmapFactory.decodeResource(context.getResources(),
|
||||
R.drawable.icon_route_ending);
|
||||
}
|
||||
@@ -61,6 +64,7 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
@@ -71,11 +75,11 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
|
||||
|
||||
public void addEndingMarker(double lat,double lon){
|
||||
if (endMarker != null){
|
||||
public void addEndingMarker(double lat, double lon) {
|
||||
if (endMarker != null) {
|
||||
return;
|
||||
}
|
||||
if (markderOptions == null){
|
||||
if (markderOptions == null) {
|
||||
markderOptions = new MogoMarkerOptions()
|
||||
.matchOnRoadSide(true)
|
||||
.gps(true)
|
||||
@@ -87,14 +91,14 @@ public class RouteOverlayDrawer {
|
||||
// .object(markerShowEntity)
|
||||
}
|
||||
markderOptions.latitude(lat).longitude(lon);
|
||||
//Log.d("lianglihui","addEndingMarker-"+lat+":"+lon);
|
||||
//CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"addEndingMarker-"+lat+":"+lon);
|
||||
endMarker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, markderOptions);
|
||||
// if (DebugConfig.isDebug()){
|
||||
// ToastUtils.showLong("绘制终点marker,"+lat+":"+lon);
|
||||
// }
|
||||
}
|
||||
|
||||
public void clearMogoRouteOverlay(){
|
||||
public void clearMogoRouteOverlay() {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
@@ -103,8 +107,8 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
}
|
||||
|
||||
public void clearEndingMarker(){
|
||||
//Log.d("lianglihui","clearEndingMarker");
|
||||
public void clearEndingMarker() {
|
||||
//CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"clearEndingMarker");
|
||||
endMarker = null;
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).removeMarkers(markerType);
|
||||
}
|
||||
@@ -122,47 +126,47 @@ public class RouteOverlayDrawer {
|
||||
mPolylineColors.clear();
|
||||
// mPolylineColors.addAll(ColorUtils.gradientAlpha_("#FF2AAFFD", "#7b2965ED", "#002965ED", mPolylinePointList.size()));
|
||||
long start = System.currentTimeMillis();
|
||||
List<Integer> list = new ArrayList<>();
|
||||
List<Integer> list = new ArrayList<>();
|
||||
// list = ColorUtils.gradientAlpha("#FF2AAFFD", "#002965ED", mPolylinePointList.size());
|
||||
int[] startColor = ColorUtils.hexToArgb("#CC64C3EA");
|
||||
int[] endColor = ColorUtils.hexToArgb("#0064C3EA");
|
||||
list.add(Color.argb(startColor[0],startColor[1],startColor[2],startColor[3]));
|
||||
list.add(Color.argb(endColor[0],endColor[1],endColor[2],endColor[3]));
|
||||
int[] endColor = ColorUtils.hexToArgb("#0064C3EA");
|
||||
list.add(Color.argb(startColor[0], startColor[1], startColor[2], startColor[3]));
|
||||
list.add(Color.argb(endColor[0], endColor[1], endColor[2], endColor[3]));
|
||||
long end = System.currentTimeMillis();
|
||||
Log.d("MogoRouteOverlayManager","get color cost : "+ (end-start));
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "get color cost : " + (end - start));
|
||||
|
||||
mPolylineColors.addAll(list);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(20).useGradient(true).colorValues(mPolylineColors);
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()){
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) {
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
|
||||
}else {
|
||||
} else {
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
mMoGoPolyline.setOption(mPolylineOptions);
|
||||
}
|
||||
}
|
||||
long drawend = System.currentTimeMillis();
|
||||
Log.d("MogoRouteOverlayManager","drawTrajectoryList cost : "+ (drawend-drawstart));
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawend - drawstart));
|
||||
}
|
||||
|
||||
public void initdraw() {
|
||||
mPolylinePointList.clear();
|
||||
MogoLatLng latLng = new MogoLatLng(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon());
|
||||
MogoLatLng latLng = new MogoLatLng(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon());
|
||||
mPolylinePointList.add(latLng);
|
||||
mPolylinePointList.add(latLng);
|
||||
mPolylineColors.clear();
|
||||
long start = System.currentTimeMillis();
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list = ColorUtils.gradientAlpha("#FF2AAFFD", "#002965ED", mPolylinePointList.size());
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list = ColorUtils.gradientAlpha("#FF2AAFFD", "#002965ED", mPolylinePointList.size());
|
||||
|
||||
mPolylineColors.addAll(list);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(12).useGradient(true).colorValues(mPolylineColors);
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()){
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) {
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
|
||||
}else {
|
||||
} else {
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
mMoGoPolyline.setOption(mPolylineOptions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user