opt
This commit is contained in:
@@ -475,14 +475,6 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
style.strokeWidth( 0 );
|
||||
style.radiusFillColor( Color.TRANSPARENT );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
mMapView.getMap().setOnMyLocationChangeListener(
|
||||
new AMap.OnMyLocationChangeListener() {
|
||||
@Override
|
||||
public void onMyLocationChange( Location location ) {
|
||||
Logger.d( TAG, location.toString() );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.common;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-13
|
||||
* <p>
|
||||
* 各个卡片模块类型
|
||||
*/
|
||||
public class ModuleNames {
|
||||
|
||||
/**
|
||||
* 卡片 车聊聊
|
||||
*/
|
||||
public static final String CARD_TYPE_CARS_CHATTING = "CARD_TYPE_CARS_CHATTING";
|
||||
|
||||
/**
|
||||
* 卡片 探路数据
|
||||
*/
|
||||
public static final String CARD_TYPE_ROAD_CONDITION = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
/**
|
||||
* 卡片 分享音乐
|
||||
*/
|
||||
public static final String CARD_TYPE_SHARE_MUSIC = "CARD_TYPE_SHARE_MUSIC";
|
||||
|
||||
/**
|
||||
* 卡片 用户数据
|
||||
*/
|
||||
public static final String CARD_TYPE_USER_DATA = "CARD_TYPE_USER_DATA";
|
||||
|
||||
/**
|
||||
* 卡片 新鲜事
|
||||
*/
|
||||
public static final String CARD_TYPE_NOVELTY = "CARD_TYPE_NOVELTY";
|
||||
|
||||
/**
|
||||
* 运营位
|
||||
*/
|
||||
public static final String CARD_TYPE_BUSINESS_OPERATION = "CARD_TYPE_BUSINESS_OPERATION";
|
||||
|
||||
}
|
||||
@@ -201,17 +201,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
init();
|
||||
mPresenter.postLoadModuleMsg();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
mMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadModules() {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
getWindow().setBackgroundDrawable( null );
|
||||
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager( this );
|
||||
@@ -255,7 +259,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
}
|
||||
} );
|
||||
|
||||
mMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@@ -344,12 +347,14 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected void onResume() {
|
||||
MapBroadCastHelper.getInstance( this ).mapFrount();
|
||||
super.onResume();
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
MapBroadCastHelper.getInstance( this ).mapBackground();
|
||||
super.onPause();
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,6 +71,7 @@ public class MapPresenter extends Presenter<MapView> implements
|
||||
mView.getUIController().setTrafficEnabled(opera_type == 0);
|
||||
} else if (type == 1) {
|
||||
mView.getUIController().changeZoom(opera_type == 0);
|
||||
mMogoMapService.getMapUIController().recoverLockMode();//缩放地图会导致锁车发生改变,这里强制锁车
|
||||
} else if (type == 2) {
|
||||
if (opera_type == 0) {
|
||||
mView.getUIController().changeMapMode(EnumMapUI.CarUp_2D);
|
||||
|
||||
@@ -15,6 +15,8 @@ import android.view.MotionEvent;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
@@ -42,9 +44,9 @@ import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -71,7 +73,10 @@ public class MogoServices implements IMogoMapListener,
|
||||
IMogoNaviListener,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoIntentListener,
|
||||
IMogoAimlessModeListener {
|
||||
IMogoAimlessModeListener,
|
||||
IMogoVoiceCmdCallBack {
|
||||
|
||||
private boolean mInternalUnWakeupRegisterStatus = false;
|
||||
|
||||
private MogoServices() {
|
||||
// private constructor
|
||||
@@ -127,7 +132,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
private IMogoIntentManager mIntentManager;
|
||||
private IMogoActionManager mFlipContentManager;
|
||||
private IMogoActionManager mActionManager;
|
||||
|
||||
/**
|
||||
* 地图视图初始化
|
||||
@@ -257,9 +262,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ADAS_UI, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
|
||||
MarkerServiceHandler.init( mContext );
|
||||
registerAIReceiver( context );
|
||||
registerMogoReceiver( context );
|
||||
registerInternalUnWakeupWords();
|
||||
|
||||
IMogoRegisterCenter registerCenter = apis.getRegisterCenterApi();
|
||||
registerCenter.registerMogoLocationListener( ServiceConst.TYPE, this );
|
||||
@@ -267,6 +274,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
registerCenter.registerMogoMapListener( ServiceConst.TYPE, this );
|
||||
registerCenter.registerMogoAimlessModeListener( ServiceConst.TYPE, this );
|
||||
|
||||
mActionManager = apis.getActionManagerApi();
|
||||
|
||||
mIntentManager = apis.getIntentManagerApi();
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTIION_ADAS, this );
|
||||
mIntentManager.registerIntentListener( Intent.ACTION_POWER_CONNECTED, this );
|
||||
@@ -307,7 +316,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
};
|
||||
}
|
||||
|
||||
private void registerAIReceiver( Context context ) {
|
||||
private void registerMogoReceiver( Context context ) {
|
||||
if ( context == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -618,6 +627,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case MAIN_PAGE_RESUME:
|
||||
if ( isTrue ) {
|
||||
registerInternalUnWakeupWords();
|
||||
} else {
|
||||
unregisterInternalUnWakeupWords();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,9 +708,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.setVoiceUIShow( TAG, true );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
|
||||
mFlipContentManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
|
||||
mFlipContentManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_SWITCH_CARD.equals( command ) ) {
|
||||
String data = intent.getStringExtra( "data" );
|
||||
try {
|
||||
@@ -712,4 +732,51 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void registerInternalUnWakeupWords() {
|
||||
if ( mInternalUnWakeupRegisterStatus ) {
|
||||
return;
|
||||
}
|
||||
mInternalUnWakeupRegisterStatus = true;
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKE_PREV, ServiceConst.CMD_UN_WAKE_PREV_UN_WAKE_WORDS, this );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKE_NEXT, ServiceConst.CMD_UN_WAKE_NEXT_UN_WAKE_WORDS, this );
|
||||
}
|
||||
|
||||
private void unregisterInternalUnWakeupWords() {
|
||||
if ( !mInternalUnWakeupRegisterStatus ) {
|
||||
return;
|
||||
}
|
||||
mInternalUnWakeupRegisterStatus = false;
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKE_PREV, this );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKE_NEXT, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,14 +109,35 @@ public class ServiceConst {
|
||||
|
||||
|
||||
/**
|
||||
* 切换上一张卡片
|
||||
* 切换卡片内容-上一个
|
||||
*/
|
||||
public static final String COMMAND_PREVIOUS = "com.zhidao.desk.switchCard.previous";
|
||||
public static final String COMMAND_PREVIOUS = "com.zhidao.desk.previous";
|
||||
public static final String CMD_UN_WAKE_PREV = "CMD_UN_WAKE_PREV";
|
||||
public static final String[] CMD_UN_WAKE_PREV_UN_WAKE_WORDS = new String[]{
|
||||
"上一条",
|
||||
"上一张卡片",
|
||||
"上一个卡片",
|
||||
"切换上一张",
|
||||
"向上滑动卡片",
|
||||
"上一辆车",
|
||||
"上一条消息",
|
||||
};
|
||||
|
||||
/**
|
||||
* 切换下一张卡片
|
||||
* 切换卡片内容下一个
|
||||
*/
|
||||
public static final String COMMAND_NEXT = "com.zhidao.desk.switchCard.next";
|
||||
public static final String COMMAND_NEXT = "com.zhidao.desk.next";
|
||||
public static final String CMD_UN_WAKE_NEXT = "CMD_UN_WAKE_NEXT";
|
||||
public static final String[] CMD_UN_WAKE_NEXT_UN_WAKE_WORDS = new String[]{
|
||||
"下一条",
|
||||
"换一个",
|
||||
"切换下一张",
|
||||
"下一张卡片",
|
||||
"下一个卡片",
|
||||
"向下滑动卡片",
|
||||
"下一辆车",
|
||||
"下一条消息"
|
||||
};
|
||||
|
||||
/**
|
||||
* 查看多媒体卡片、探路卡片
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.flipcontent;
|
||||
package com.mogo.module.service.actionmanager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
@@ -6,6 +6,7 @@ import android.text.TextUtils;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionListener;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -19,17 +20,19 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoFlipContentHandler implements IMogoActionManager {
|
||||
public class MogoActionHandler implements IMogoActionManager {
|
||||
|
||||
private MogoFlipContentHandler() {
|
||||
private static final String TAG = "MogoActionHandler";
|
||||
|
||||
private MogoActionHandler() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final MogoFlipContentHandler INSTANCE = new MogoFlipContentHandler();
|
||||
private static final MogoActionHandler INSTANCE = new MogoActionHandler();
|
||||
}
|
||||
|
||||
public static MogoFlipContentHandler getInstance() {
|
||||
public static MogoActionHandler getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@@ -68,6 +71,7 @@ public class MogoFlipContentHandler 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;
|
||||
}
|
||||
@@ -77,7 +81,11 @@ public class MogoFlipContentHandler implements IMogoActionManager {
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoActionListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
listener.onActionDone( action );
|
||||
try {
|
||||
listener.onActionDone( action );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.flipcontent;
|
||||
package com.mogo.module.service.actionmanager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -19,21 +19,21 @@ public class MogoActionManager implements IMogoActionManager {
|
||||
|
||||
@Override
|
||||
public void registerActionListener( String biz, IMogoActionListener listener ) {
|
||||
MogoFlipContentHandler.getInstance().registerActionListener( biz, listener );
|
||||
MogoActionHandler.getInstance().registerActionListener( biz, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterActionListener( String biz, IMogoActionListener listener ) {
|
||||
MogoFlipContentHandler.getInstance().unregisterActionListener( biz, listener );
|
||||
MogoActionHandler.getInstance().unregisterActionListener( biz, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( String biz, MogoAction action ) {
|
||||
MogoFlipContentHandler.getInstance().invoke( biz, action );
|
||||
MogoActionHandler.getInstance().invoke( biz, action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
MogoFlipContentHandler.getInstance().init( context );
|
||||
MogoActionHandler.getInstance().init( context );
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,9 @@ package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.TextureView;
|
||||
import android.view.animation.BounceInterpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
|
||||
import com.alibaba.idst.nls.internal.utils.L;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -108,14 +106,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|| TextUtils.equals( mCurrentModuleName, ServiceConst.CARD_TYPE_BUSINESS_OPERATION ) )
|
||||
&& mIsMarkerClicked ) {
|
||||
mIsMarkerClicked = false;
|
||||
runOnTargetThread( () -> {
|
||||
// 在广告位(默认位置)点击marker造成卡片切换的,还是现实全部marker 【需求:os2.0.2-2.5-4】
|
||||
highlightedMarker( moduleName, false );
|
||||
mCurrentModuleName = moduleName;
|
||||
} );
|
||||
// 在广告位(默认位置)点击marker造成卡片切换的,还是现实全部marker 【需求:os2.0.2-2.5-4】
|
||||
highlightedMarker( moduleName, false );
|
||||
mCurrentModuleName = moduleName;
|
||||
} else {
|
||||
mCurrentModuleName = moduleName;
|
||||
runOnTargetThread( () -> {
|
||||
mCurrentModuleName = moduleName;
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers();
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
} );
|
||||
@@ -326,27 +322,26 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
if ( response != null && response.getResult() != null ) {
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
mLastDataResult = response.getResult();
|
||||
dispatchDataToBiz();
|
||||
|
||||
// 语音触发的在线车辆搜索,采用增量的形式绘制
|
||||
if ( mIsAISearchOnlineData = isOnlineCarDataOnly( mLastDataResult ) ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else {
|
||||
mLastCheckMarker = null;
|
||||
// 清空所有地图上绘制的Marker
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers();
|
||||
}
|
||||
// 语音触发的在线车辆搜索,采用增量的形式绘制
|
||||
if ( mIsAISearchOnlineData = isOnlineCarDataOnly( mLastDataResult ) ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else {
|
||||
mLastCheckMarker = null;
|
||||
// 清空所有地图上绘制的Marker
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers();
|
||||
}
|
||||
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
// 同步新绘制的气泡状态
|
||||
alreadySmallMarker.clear();
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
// 同步新绘制的气泡状态
|
||||
alreadySmallMarker.clear();
|
||||
// highlightedMarker( mCurrentModuleName, true );
|
||||
|
||||
trackData( mLastDataResult );
|
||||
}
|
||||
trackData( mLastDataResult );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,10 +426,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
private void drawOnlineCarMarkers( List< MarkerOnlineCar > onlineCarList, int maxAmount ) {
|
||||
// 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗
|
||||
if ( onlineCarList == null || onlineCarList.isEmpty() ) {
|
||||
dispatchDataToBiz( ServiceConst.CARD_TYPE_USER_DATA, new ArrayList<>() );
|
||||
return;
|
||||
}
|
||||
dispatchDataToBiz( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList );
|
||||
double nearlyDistance = Float.MAX_VALUE;
|
||||
int size = getAppropriateSize( maxAmount, onlineCarList );
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
@@ -496,7 +489,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*/
|
||||
private void drawRoadConditionMarker( List< MarkerExploreWay > exploreWayList, int maxAmount ) {
|
||||
// 将数据同步给探路,避免探路每次 perform 的时候去拉取,造成消耗
|
||||
dispatchDataToBiz( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList );
|
||||
if ( exploreWayList == null || exploreWayList.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
@@ -547,7 +539,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param noveltyInfoList
|
||||
*/
|
||||
private void drawNoveltyMarker( List< MarkerNoveltyInfo > noveltyInfoList, int maxAmount ) {
|
||||
dispatchDataToBiz( ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList );
|
||||
if ( noveltyInfoList == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -642,13 +633,30 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发数据到各个业务模块
|
||||
* <p>
|
||||
* 仅在数据刷新的时候分发
|
||||
*/
|
||||
private void dispatchDataToBiz() {
|
||||
if ( mLastDataResult == null ) {
|
||||
return;
|
||||
}
|
||||
List< MarkerOnlineCar > onlineCarList = mLastDataResult.getOnlineCar();
|
||||
List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = mLastDataResult.getNoveltyInfo();
|
||||
dispatchDataToBiss( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList );
|
||||
dispatchDataToBiss( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
dispatchDataToBiss( ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList == null ? new ArrayList<>() : noveltyInfoList );
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据分发
|
||||
*
|
||||
* @param biz
|
||||
* @param object
|
||||
*/
|
||||
private void dispatchDataToBiz( String biz, Object object ) {
|
||||
private void dispatchDataToBiss( String biz, Object object ) {
|
||||
if ( TextUtils.isEmpty( biz ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -683,7 +691,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @return 绘制的Marker
|
||||
*/
|
||||
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity ) {
|
||||
return drawMapMarker( markerShowEntity, isSmallType() );
|
||||
try {
|
||||
return drawMapMarker( markerShowEntity, isSmallType() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSmallType() {
|
||||
@@ -694,35 +707,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
private IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity, boolean isSmall ) {
|
||||
//Logger.i(TAG, "绘制Marker====drawMapMarker:" + markerShowEntity);
|
||||
try {
|
||||
if ( markerShowEntity.getMarkerLocation() != null ) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( markerShowEntity.getMarkerType() )
|
||||
.object( markerShowEntity )
|
||||
.latitude( markerShowEntity.getMarkerLocation().getLat() )
|
||||
.longitude( markerShowEntity.getMarkerLocation().getLon() );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, options );
|
||||
options.icon( markerView.getView() );
|
||||
|
||||
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( markerShowEntity.getMarkerType(), options );
|
||||
marker.setOwner( markerShowEntity.getMarkerType() );
|
||||
markerView.setMarker( marker );
|
||||
marker.setOnMarkerClickListener( this );
|
||||
|
||||
if ( isSmall ) {
|
||||
List< IMogoMarker > markers = new ArrayList<>();
|
||||
markers.add( marker );
|
||||
setMarkersSmall( markers );
|
||||
}
|
||||
return marker;
|
||||
} else {
|
||||
Logger.e( TAG, "Location 必须进行初始化!!!!!" );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( markerShowEntity.getMarkerType() )
|
||||
.object( markerShowEntity )
|
||||
.latitude( markerShowEntity.getMarkerLocation().getLat() )
|
||||
.longitude( markerShowEntity.getMarkerLocation().getLon() );
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView( mContext, markerShowEntity, options );
|
||||
options.icon( markerView.getView() );
|
||||
|
||||
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( markerShowEntity.getMarkerType(), options );
|
||||
marker.setOwner( markerShowEntity.getMarkerType() );
|
||||
markerView.setMarker( marker );
|
||||
marker.setOnMarkerClickListener( this );
|
||||
|
||||
if ( isSmall ) {
|
||||
List< IMogoMarker > markers = new ArrayList<>();
|
||||
markers.add( marker );
|
||||
setMarkersSmall( markers );
|
||||
}
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
@@ -733,12 +739,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( final MarkerResponse response ) {
|
||||
if ( !ignoreDrawRequest() ) {
|
||||
Logger.d( TAG, "接收到了地图大而全数据" );
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
if ( ignoreDrawRequest() ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "接收到了地图大而全数据" );
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
}
|
||||
|
||||
private boolean ignoreDrawRequest() {
|
||||
|
||||
@@ -141,9 +141,9 @@ public interface IMogoServiceApis extends IProvider {
|
||||
IMogoADASController getAdasControllerApi();
|
||||
|
||||
/**
|
||||
* 内容翻页
|
||||
* 动作控制
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoActionManager getFlipContentManager();
|
||||
IMogoActionManager getActionManagerApi();
|
||||
}
|
||||
|
||||
@@ -66,6 +66,12 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isAppListUIShow();
|
||||
|
||||
/**
|
||||
* 主页是否显示
|
||||
* @return
|
||||
*/
|
||||
boolean isMainPageOnResume();
|
||||
|
||||
/**
|
||||
* 设置小智语音UI状态
|
||||
*
|
||||
@@ -127,6 +133,13 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setAppListUIShow( String tag, boolean isShow );
|
||||
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
* @param tag
|
||||
* @param resume
|
||||
*/
|
||||
void setMainPageResumeStatus(String tag, boolean resume);
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -46,5 +46,10 @@ public enum StatusDescriptor {
|
||||
/**
|
||||
* app 列表
|
||||
*/
|
||||
APP_LIST_UI;
|
||||
APP_LIST_UI,
|
||||
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
*/
|
||||
MAIN_PAGE_RESUME;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoActionManager getFlipContentManager() {
|
||||
public IMogoActionManager getActionManagerApi() {
|
||||
return getApiInstance( IMogoActionManager.class, MogoServicePaths.PATH_ACTION_APIS );
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,11 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val( StatusDescriptor.APP_LIST_UI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMainPageOnResume() {
|
||||
return get_bool_val( StatusDescriptor.MAIN_PAGE_RESUME );
|
||||
}
|
||||
|
||||
private boolean get_bool_val( StatusDescriptor descriptor ) {
|
||||
Boolean val = mStatus.get( descriptor );
|
||||
return val == null ? false : val;
|
||||
@@ -153,6 +158,13 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
recordStatusModifier( tag, StatusDescriptor.APP_LIST_UI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainPageResumeStatus( String tag, boolean resume ) {
|
||||
mStatus.put( StatusDescriptor.MAIN_PAGE_RESUME, resume );
|
||||
invokeStatusChangedListener( StatusDescriptor.MAIN_PAGE_RESUME, resume );
|
||||
recordStatusModifier( tag, StatusDescriptor.MAIN_PAGE_RESUME );
|
||||
}
|
||||
|
||||
private void invokeStatusChangedListener( StatusDescriptor descriptor, boolean status ) {
|
||||
if ( mListeners.containsKey( descriptor ) ) {
|
||||
Iterator< IMogoStatusChangedListener > iterator = mListeners.get( descriptor ).iterator();
|
||||
|
||||
Reference in New Issue
Block a user