merge
This commit is contained in:
@@ -2,19 +2,13 @@ package com.mogo.module.service;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
@@ -33,7 +27,6 @@ public class MarkerServiceHandler {
|
||||
private static IMogoStatusManager sMogoStatusManager;
|
||||
private static IMogoAnalytics sMogoAnalytics;
|
||||
private static IMogoRegisterCenter sRegisterCenter;
|
||||
private static IMogoActionManager sActionManager;
|
||||
private static IMogoDataManager sDataManager;
|
||||
private static IMogoIntentManager sIntentManager;
|
||||
private static IMogoFragmentManager sFragmentManager;
|
||||
@@ -43,7 +36,6 @@ public class MarkerServiceHandler {
|
||||
sMogoStatusManager = sApis.getStatusManagerApi();
|
||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||
sRegisterCenter = sApis.getRegisterCenterApi();
|
||||
sActionManager = sApis.getActionManagerApi();
|
||||
sDataManager = sApis.getDataManagerApi();
|
||||
sIntentManager = sApis.getIntentManagerApi();
|
||||
sFragmentManager = sApis.getFragmentManagerApi();
|
||||
@@ -66,10 +58,6 @@ public class MarkerServiceHandler {
|
||||
return sRegisterCenter;
|
||||
}
|
||||
|
||||
public static IMogoActionManager getActionManager() {
|
||||
return sActionManager;
|
||||
}
|
||||
|
||||
public static IMogoIntentManager getIntentManager() {
|
||||
return sIntentManager;
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
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;
|
||||
@@ -125,7 +123,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
private IMogoStatusManager mStatusManager;
|
||||
private IMogoIntentManager mIntentManager;
|
||||
private IMogoActionManager mActionManager;
|
||||
private IMogoFragmentManager mFragmentManager;
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
|
||||
@@ -146,7 +143,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
protected void handleRefreshDecrease(Message msg) {
|
||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
invokeAutoRefreshStrategy();
|
||||
return;
|
||||
}
|
||||
@@ -161,7 +158,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
protected void handleLoopRequestMessage(Message msg) {
|
||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
return;
|
||||
}
|
||||
if (mLoopRequest) {
|
||||
@@ -171,18 +168,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
};
|
||||
|
||||
public RefreshModel getRefreshModel() {
|
||||
if (mRefreshModel == null) {
|
||||
mRefreshModel = new RefreshModel(mContext);
|
||||
}
|
||||
return mRefreshModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动刷新:锁车、缩放比例:16、半径 2KM
|
||||
*/
|
||||
private void invokeAutoRefresh() {
|
||||
if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) {
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
MogoMapUIController.getInstance().recoverLockMode();
|
||||
return;
|
||||
@@ -254,28 +244,15 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
private final IMogoStatusChangedListener statusChangedListener = new StatusChangedAdapter() {
|
||||
|
||||
@Override
|
||||
public void onSearchUIShow(boolean visible) {
|
||||
if (visible) {
|
||||
// 搜索时,不在自动刷新打点策略
|
||||
stopAutoRefreshStrategy();
|
||||
} else {
|
||||
// 搜索后,打开打点策略
|
||||
if (mAutoRefreshCallback != null) {
|
||||
mAutoRefreshCallback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public void preInit(Context context) {
|
||||
mContext = context;
|
||||
|
||||
mRefreshModel = new RefreshModel( context );
|
||||
mRefreshModel = new RefreshModel(context);
|
||||
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);
|
||||
@@ -299,20 +276,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
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);
|
||||
|
||||
mFragmentManager = MarkerServiceHandler.getFragmentManager();
|
||||
@@ -382,9 +350,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
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);
|
||||
@@ -497,13 +462,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
// 搜索页面显示时不做任何策略
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动刷新触发
|
||||
if (mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel()) {
|
||||
// 缩放级别缩小
|
||||
@@ -574,10 +532,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
@@ -588,12 +542,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
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);
|
||||
MogoMapUIController.getInstance().recoverLockMode();
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
MogoMapUIController.getInstance().changeZoom( ServiceConst.DEFAULT_ZOOM_LEVEL );
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
MogoMapUIController.getInstance().changeZoom(ServiceConst.DEFAULT_ZOOM_LEVEL);
|
||||
mLastAutoRefreshLocation = point;
|
||||
notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback);
|
||||
}
|
||||
@@ -634,9 +588,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mStatusManager.isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
int amount = 20;
|
||||
|
||||
Message msg = Message.obtain();
|
||||
@@ -654,7 +605,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
public void clearAllData() {
|
||||
try {
|
||||
MogoMarkerManager.getInstance(mContext).removeMarkers();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -678,26 +629,19 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
|
||||
public void refreshStrategy() {
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false);
|
||||
MogoMapUIController.getInstance().recoverLockMode();// 锁车代替移到中心点
|
||||
restartAutoRefreshAtTime( 0 );
|
||||
restartAutoRefreshAtTime(0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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);
|
||||
} else {
|
||||
if (TextUtils.equals(command, ConnectivityManager.CONNECTIVITY_ACTION)
|
||||
&& NetworkUtils.isConnected(mContext)) {
|
||||
mIntentManager.unregisterIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this);
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle(mContext, command, intent);
|
||||
if (TextUtils.equals(command, ConnectivityManager.CONNECTIVITY_ACTION)
|
||||
&& NetworkUtils.isConnected(mContext)) {
|
||||
mIntentManager.unregisterIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this);
|
||||
}
|
||||
IntentHandlerFactory.getInstance().handle(mContext, command, intent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -723,13 +667,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
|
||||
@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_WAKEUP_MY_LOCATION, cmd)) {
|
||||
if (mStatusManager.isMainPageOnResume()) {
|
||||
MogoMapUIController.getInstance().recoverLockMode();
|
||||
}
|
||||
} else if (TextUtils.equals(ServiceConst.CMD_BACK, cmd)) {
|
||||
@@ -737,31 +677,15 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
private void onActionDone(MogoAction action) {
|
||||
if (!mStatusManager.isMainPageOnResume()) {
|
||||
return;
|
||||
}
|
||||
if (mStatusManager.isV2XShow()) {
|
||||
// 分发到V2X
|
||||
mActionManager.invoke("V2X_UI", action);
|
||||
} else {
|
||||
String biz = MapMarkerManager.getInstance().getCurrentModuleName();
|
||||
mActionManager.invoke(biz, action);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransaction( int size ) {
|
||||
if ( size == 0 ) {
|
||||
MogoMapUIController.getInstance().showMyLocation( true );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK );
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
}
|
||||
public void onTransaction(int size) {
|
||||
if (size == 0) {
|
||||
MogoMapUIController.getInstance().showMyLocation(true);
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ServiceConst.CMD_BACK);
|
||||
MogoMapUIController.getInstance().recoverLockMode();
|
||||
} else {
|
||||
MogoMapUIController.getInstance().showMyLocation( false );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
MogoMapUIController.getInstance().showMyLocation(false);
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String PATH_REFRESH_STRATEGY = "/strategy/refresh";
|
||||
|
||||
|
||||
/**
|
||||
* 倒计时消息
|
||||
*/
|
||||
@@ -95,24 +94,6 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final int MSG_LOCK_CAR = 0x202;
|
||||
|
||||
/**
|
||||
* 切换卡片内容-上一个
|
||||
*/
|
||||
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 COMMAND_NEXT = "com.zhidao.desk.next";
|
||||
public static final String CMD_UN_WAKE_NEXT = "CMD_UN_WAKE_NEXT";
|
||||
|
||||
/**
|
||||
* 查看多媒体卡片、探路卡片、在线车辆、首页、新鲜事
|
||||
*/
|
||||
public static final String COMMAND_SWITCH_CARD = "com.zhidao.desk.switchCard";
|
||||
|
||||
|
||||
/**
|
||||
* 回到自车
|
||||
*/
|
||||
@@ -128,11 +109,6 @@ public class ServiceConst {
|
||||
public static final String CMD_BACK = "back";
|
||||
public static final String[] CMD_BACK_WORDS = new String[]{"关闭", "返回"};
|
||||
|
||||
/**
|
||||
* 返回桌面
|
||||
*/
|
||||
public static final String COMMAND_BACK = "com.ileja.launcher.back";
|
||||
|
||||
public static final int ONLINE_SEARCH_LIMIT = 20;
|
||||
public static final int ONLINE_SEARCH_RADIUS = 2_000;
|
||||
|
||||
|
||||
@@ -1,33 +1,26 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
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.json.JSONObject;
|
||||
|
||||
public
|
||||
/**
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/8/6
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
public abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "StatusChangedAdapter";
|
||||
|
||||
private boolean mIsMainPageFirstResume = true;
|
||||
|
||||
|
||||
private boolean mIsFirstAccOn = true;
|
||||
|
||||
@Override
|
||||
@@ -36,24 +29,12 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
case USER_INTERACTED:
|
||||
onUserInteracted(isTrue);
|
||||
break;
|
||||
case SEARCH_UI:
|
||||
onSearchUIShow(isTrue);
|
||||
break;
|
||||
case MAIN_PAGE_RESUME:
|
||||
onMainPageResumeStatusChanged(isTrue);
|
||||
break;
|
||||
case MAIN_PAGE_IS_BACKGROUND:
|
||||
onMainPageIsBackgroundStatusChanged(isTrue);
|
||||
break;
|
||||
case SEEK_HELPING:
|
||||
onSeekHelpingStatusChanged(isTrue);
|
||||
break;
|
||||
case ACC_STATUS:
|
||||
onAccStatusChanged(isTrue);
|
||||
break;
|
||||
case VR_MODE:
|
||||
onVrModeChanged(isTrue);
|
||||
break;
|
||||
case TOP_VIEW:
|
||||
onTopViewStatusChanged(isTrue);
|
||||
break;
|
||||
@@ -66,8 +47,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onSearchUIShow(boolean visible);
|
||||
|
||||
public void onMainPageResumeStatusChanged(boolean resume) {
|
||||
if (resume) {
|
||||
MogoServices.getInstance().registerInternalUnWakeupWords();
|
||||
@@ -75,81 +54,27 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
MogoServices.getInstance().restartAutoRefreshAtTime(2_000L);
|
||||
}
|
||||
mIsMainPageFirstResume = false;
|
||||
LauncherCardRefresher.getInstance(AbsMogoApplication.getApp()).stop();
|
||||
} else {
|
||||
MogoServices.getInstance().unregisterInternalUnWakeupWords();
|
||||
MogoServices.getInstance().stopAutoRefreshStrategy();
|
||||
}
|
||||
}
|
||||
|
||||
public void onMainPageIsBackgroundStatusChanged(boolean isBackground) {
|
||||
if (isBackground) {
|
||||
closeAllPanel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭所有模块的控制面板
|
||||
*/
|
||||
private void closeAllPanel() {
|
||||
//
|
||||
// if (mCallProviderResponse == null) {
|
||||
// mCallProviderResponse = new ICallChatResponse() {
|
||||
// @Override
|
||||
// public void hideUserWindowError(@NotNull String errorMsg) {
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// if (mCarsChattingProvider == null) {
|
||||
// mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
// }
|
||||
// if (mCarsChattingProvider != null) {
|
||||
// mCarsChattingProvider.hideUserWindow(TAG, AbsMogoApplication.getApp(), mCallProviderResponse);
|
||||
// }
|
||||
}
|
||||
|
||||
public void onSeekHelpingStatusChanged(boolean isSeekingHelping) {
|
||||
notifySeekHelpingStatusChanged(isSeekingHelping);
|
||||
}
|
||||
|
||||
private void notifySeekHelpingStatusChanged(boolean seekHelpingStatus) {
|
||||
Intent intent = new Intent("com.mogo.launcher.adas.app");
|
||||
try {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("object", "辅助驾驶");
|
||||
data.put("action", seekHelpingStatus ? "2" : "1");
|
||||
data.put("des", "自身故障报警");
|
||||
data.put("v2x_warning_type", "20007");// 后台返回
|
||||
intent.putExtra("data", data.toString());
|
||||
AbsMogoApplication.getApp().sendBroadcast(intent);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "notifySeekHelpingStatusChanged exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void onAccStatusChanged(boolean accOn) {
|
||||
if (accOn) {
|
||||
if (mIsFirstAccOn) {
|
||||
mIsFirstAccOn = false;
|
||||
return;
|
||||
}
|
||||
MogoLocationClient.getInstance(AbsMogoApplication.getApp()).start();
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
MogoServices.getInstance().refreshStrategy();
|
||||
}, 3_000L);
|
||||
} else {
|
||||
MogoLocationClient.getInstance(AbsMogoApplication.getApp()).stop();
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
public void onVrModeChanged(boolean isVrMode) {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSeekHelping()) {
|
||||
onSeekHelpingStatusChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void onTopViewStatusChanged(boolean visible) {
|
||||
if (visible) {
|
||||
return;
|
||||
@@ -160,4 +85,5 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
CallerLogger.INSTANCE.e(TAG, "onTopViewStatusChanged exception : " + e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
package com.mogo.module.service.actionmanager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionListener;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoActionHandler implements IMogoActionManager {
|
||||
|
||||
private static final String TAG = "MogoActionHandler";
|
||||
|
||||
private MogoActionHandler() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final MogoActionHandler INSTANCE = new MogoActionHandler();
|
||||
}
|
||||
|
||||
public static MogoActionHandler getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Map< String, List< IMogoActionListener > > mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
private IMogoBizActionDoneListener mBizActionDoneListener;
|
||||
|
||||
@Override
|
||||
public void registerActionListener( String biz, IMogoActionListener listener ) {
|
||||
if ( TextUtils.isEmpty( biz ) || listener == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mListeners.containsKey( biz ) ) {
|
||||
mListeners.put( biz, new ArrayList<>() );
|
||||
}
|
||||
mListeners.get( biz ).add( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterActionListener( String biz, IMogoActionListener listener ) {
|
||||
if ( TextUtils.isEmpty( biz ) || listener == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mListeners.containsKey( biz ) ) {
|
||||
mListeners.get( biz ).remove( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( String biz, MogoAction action ) {
|
||||
if ( !mListeners.containsKey( biz ) ) {
|
||||
return;
|
||||
}
|
||||
List< IMogoActionListener > listeners = mListeners.get( biz );
|
||||
if ( listeners != null ) {
|
||||
Iterator< IMogoActionListener > iterator = listeners.iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoActionListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onActionDone( action );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBizActionDoneListener( IMogoBizActionDoneListener listener ) {
|
||||
mBizActionDoneListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBizActionDoneListener() {
|
||||
mBizActionDoneListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bizInvoke( String biz, int position, Object data ) {
|
||||
if ( mBizActionDoneListener != null ) {
|
||||
try {
|
||||
mBizActionDoneListener.onBizActionDone( biz, position, data );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.module.service.actionmanager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionListener;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_ACTION_APIS )
|
||||
public class MogoActionManager implements IMogoActionManager {
|
||||
|
||||
@Override
|
||||
public void registerActionListener( String biz, IMogoActionListener listener ) {
|
||||
MogoActionHandler.getInstance().registerActionListener( biz, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterActionListener( String biz, IMogoActionListener listener ) {
|
||||
MogoActionHandler.getInstance().unregisterActionListener( biz, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke( String biz, MogoAction action ) {
|
||||
MogoActionHandler.getInstance().invoke( biz, action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBizActionDoneListener( IMogoBizActionDoneListener listener ) {
|
||||
MogoActionHandler.getInstance().registerBizActionDoneListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBizActionDoneListener() {
|
||||
MogoActionHandler.getInstance().unregisterBizActionDoneListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bizInvoke( String biz, int position, Object data ) {
|
||||
MogoActionHandler.getInstance().bizInvoke( biz, position, data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
MogoActionHandler.getInstance().init( context );
|
||||
}
|
||||
}
|
||||
@@ -53,9 +53,6 @@ abstract class RefreshWorkThreadHandler extends Handler {
|
||||
protected abstract void handleRequestDataMessage(Message msg);
|
||||
|
||||
protected void handleLockCarMessage(Message msg) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.content.Intent;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.receiver.AccStatusReceiver;
|
||||
|
||||
/**
|
||||
@@ -65,16 +64,6 @@ public class AccStatusIntentHandler implements IntentHandler {
|
||||
newIntent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
context.sendBroadcast( newIntent );
|
||||
}
|
||||
boolean accOn = state == ACC_ON;
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) {
|
||||
return;
|
||||
}
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn );
|
||||
if ( state == ACC_ON ) {
|
||||
LauncherCardRefresher.getInstance( context ).start();
|
||||
} else if ( state == ACC_OFF ) {
|
||||
LauncherCardRefresher.getInstance( context ).stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ public class IntentHandlerFactory {
|
||||
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( AccStatusReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_BACK, WholeVoiceCommandIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_MOGO, new MogoControllerIntentHandler() );
|
||||
mHandlers.put( ConnectivityManager.CONNECTIVITY_ACTION, new NetworkChangedIntentHandler() );
|
||||
}
|
||||
|
||||
|
||||
@@ -86,10 +86,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
TipToast.shortTip(msg);
|
||||
}
|
||||
break;
|
||||
case 6://
|
||||
boolean status1 = intent.getBooleanExtra("status", false);
|
||||
MarkerServiceHandler.getMogoStatusManager().setUploadingStatus(TAG, status1);
|
||||
break;
|
||||
case 8:// 测试修改车头角度
|
||||
float bearing = intent.getFloatExtra("bearing", 0);
|
||||
MogoMapUIController.getInstance().changeBearing(bearing);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.network.NetConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/8/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoControllerIntentHandler implements IntentHandler {
|
||||
|
||||
public static final String KEY_OPER = "oper";
|
||||
public static final int TYPE_OPER_OPEN_LOG = 1;
|
||||
public static final int TYPE_OPER_CLOSE_LOG = 2;
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
int oper = intent.getIntExtra( KEY_OPER, 0 );
|
||||
switch ( oper ) {
|
||||
case TYPE_OPER_OPEN_LOG:
|
||||
Logger.init( LogLevel.DEBUG );
|
||||
NetConfig.instance().setLoggable( true );
|
||||
break;
|
||||
case TYPE_OPER_CLOSE_LOG:
|
||||
Logger.init( LogLevel.OFF );
|
||||
NetConfig.instance().setLoggable( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,6 @@ public class MyLocationHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
MogoMapUIController.getInstance().recoverLockMode();
|
||||
} else {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/11
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
public class WholeVoiceCommandIntentHandler implements IntentHandler {
|
||||
|
||||
private final String TAG = this.getClass().getName();
|
||||
|
||||
private static volatile WholeVoiceCommandIntentHandler sInstance;
|
||||
|
||||
private WholeVoiceCommandIntentHandler() {
|
||||
}
|
||||
|
||||
public static WholeVoiceCommandIntentHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( WholeVoiceCommandIntentHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new WholeVoiceCommandIntentHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String command = intent.getStringExtra( MogoReceiver.PARAM_COMMAND );
|
||||
if ( TextUtils.isEmpty( command ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.module.service.launchercard;
|
||||
|
||||
public class LauncherCardRefreshStrategy {
|
||||
|
||||
private long interval; // 间隔时间
|
||||
|
||||
private LauncherCardRefreshStrategy next;
|
||||
|
||||
private int msgType;// 触发的消息类型
|
||||
|
||||
public LauncherCardRefreshStrategy( long interval, LauncherCardRefreshStrategy next, int msgType ) {
|
||||
this.interval = interval;
|
||||
this.next = next;
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
|
||||
public long getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return 2_000;
|
||||
}
|
||||
|
||||
public LauncherCardRefreshStrategy getNext() {
|
||||
if ( next == null ) {
|
||||
return this;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
package com.mogo.module.service.launchercard;
|
||||
|
||||
public enum LauncherCardRefreshType {
|
||||
|
||||
Weather( "News", "weather", "天气" ),
|
||||
News( "NearRoads", "news", "新闻" ),
|
||||
NearRoads( "ExplorerWay", "nearRoads", "近路" ),
|
||||
TrafficRestriction( "NearRoads", "trafficRestriction", "限行" ),
|
||||
ExplorerWay( "OnlineCar", "friendAndPois", "道路事件" ),
|
||||
OnlineCar( "Weather", "friendAndPois", "车友" );
|
||||
|
||||
private String next;
|
||||
private String val;
|
||||
private String desc;
|
||||
|
||||
LauncherCardRefreshType( String next, String val, String desc ) {
|
||||
this.next = next;
|
||||
this.val = val;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
public String getVal() {
|
||||
return val;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -1,723 +0,0 @@
|
||||
package com.mogo.module.service.launchercard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
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.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.network.ZhidaoRefreshModel;
|
||||
import com.mogo.module.service.network.bean.LauncherCardAdvertisementData;
|
||||
import com.mogo.module.service.network.bean.TtsConfigBody;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
import com.mogo.service.cloud.passport.IMogoTicketCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/8/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class LauncherCardRefresher {
|
||||
|
||||
private static final String TAG = "LauncherCardRefresher";
|
||||
|
||||
public static final String KEY_LauncherCardTipCounter = "LauncherCardTipCounter";
|
||||
public static final String KEY_LauncherCardTipLastTipTime = "LauncherCardTipLastTipTime";
|
||||
|
||||
public static final String KEY_LAST_LOAD_TTS_TYPE = "keyLastLoadTtsType";
|
||||
public static final String KEY_LAST_LOAD_TTS_DATE = "keyLastLoadTtsDate";
|
||||
|
||||
|
||||
private static volatile LauncherCardRefresher sInstance;
|
||||
|
||||
// 开始引导策略
|
||||
public static final int MSG_INDUCE = 2019;
|
||||
// 刷新卡片默认显示内容
|
||||
public static final int MSG_REFRESH_DEFAULT_CARD = 2021;
|
||||
// 刷新卡片广告
|
||||
public static final int MSG_REFRESH_ADVERTISEMENT = 2022;
|
||||
// 加载网络配置数据
|
||||
public static final int MSG_LOAD_NET_CONFIG = 2023;
|
||||
// 加载网络配置数据2
|
||||
public static final int MSG_LOAD_NET_CONFIG2 = 2026;
|
||||
// 默认播报
|
||||
public static final int MSG_START_LOOP_DEFAULT_CARD = 2024;
|
||||
// 等待网络
|
||||
public static final int MSG_WAIT_NETWORK = 2025;
|
||||
|
||||
public static final long ONE_SECOND = 1000L;
|
||||
public static final long ONE_MINUTE = 60 * 1000L;
|
||||
public static final long ONE_DAY = 24 * 60 * ONE_MINUTE;
|
||||
private String mLaunchTTSText;
|
||||
private long mDefaultTTSPlayInterval = 60 * ONE_MINUTE;
|
||||
private LauncherCardAdvertisementData.LauncherCardAdvertisement mDefaultLauncherCardConfig;
|
||||
private List< LauncherCardAdvertisementData.LauncherCardAdvertisement > mAdvertisements;
|
||||
|
||||
/**
|
||||
* 默认播报/后台配置播报次数限制
|
||||
*/
|
||||
private int mDefaultConfigCounter = 0;
|
||||
|
||||
/**
|
||||
* 因为缓存ticket失效导致失败的情况,需要重新请求ticket然后再次获取数据,这里重试3次
|
||||
*/
|
||||
private int mRefreshTicketCounter = 0;
|
||||
|
||||
private LauncherCardRefresher( Context context ) {
|
||||
mContext = context;
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
mZhidaoRefreshModel = new ZhidaoRefreshModel( mContext );
|
||||
}
|
||||
|
||||
public static LauncherCardRefresher getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( LauncherCardRefresher.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new LauncherCardRefresher( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( mRefreshStop ) {
|
||||
return;
|
||||
}
|
||||
switch ( msg.what ) {
|
||||
case MSG_WAIT_NETWORK:
|
||||
trtRequestNetworkConfigStrategy();
|
||||
break;
|
||||
case MSG_LOAD_NET_CONFIG:
|
||||
loadNetworkConfigStrategy();
|
||||
break;
|
||||
case MSG_LOAD_NET_CONFIG2:
|
||||
requestTtsStrategyConfig();
|
||||
break;
|
||||
case MSG_REFRESH_DEFAULT_CARD:
|
||||
renderDefaultLauncherCardConfig( false );
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
restart();
|
||||
break;
|
||||
case MSG_INDUCE:
|
||||
handleInduceStrategy();
|
||||
break;
|
||||
case MSG_START_LOOP_DEFAULT_CARD:
|
||||
renderDefaultLauncherCardConfig( false );
|
||||
break;
|
||||
case MSG_REFRESH_ADVERTISEMENT:
|
||||
int index = msg.arg1;// 当前广告索引
|
||||
loopRenderAdvertisements( index );
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final Context mContext;
|
||||
private boolean mRefreshStop = true;
|
||||
private boolean mStart = false;
|
||||
private RefreshModel mRefreshModel;
|
||||
private ZhidaoRefreshModel mZhidaoRefreshModel;
|
||||
|
||||
private LauncherCardRefreshStrategy mLauncherCardConfigStrategy = new LauncherCardRefreshStrategy(
|
||||
2 * ONE_MINUTE, null, MSG_REFRESH_DEFAULT_CARD
|
||||
);
|
||||
private LauncherCardRefreshStrategy mRefreshStrategy = mLauncherCardConfigStrategy;
|
||||
|
||||
public void start() {
|
||||
if ( !DebugConfig.isIsSupportLauncherCardRefreshStrategy() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStart ) {
|
||||
return;
|
||||
}
|
||||
mDefaultConfigCounter = 0;
|
||||
mRefreshTicketCounter = 0;
|
||||
mRefreshStrategy = mLauncherCardConfigStrategy;
|
||||
trtRequestNetworkConfigStrategy();
|
||||
startInduceStrategy();
|
||||
}
|
||||
|
||||
private void trtRequestNetworkConfigStrategy() {
|
||||
if ( NetworkUtils.isConnected( mContext ) && MogoLocationClient.getInstance(mContext)
|
||||
.getLastKnowLocation() != null ) {
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOAD_NET_CONFIG, 0L );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOAD_NET_CONFIG2, 2 * ONE_MINUTE );
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( MSG_WAIT_NETWORK, 10 * ONE_SECOND );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 引导策略:本地策略 & 网络策略
|
||||
*/
|
||||
private void startInduceStrategy() {
|
||||
if ( mRefreshStrategy == null ) {
|
||||
return;
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( mRefreshStrategy.getMsgType(), mRefreshStrategy.getInterval() );
|
||||
mRefreshStop = false;
|
||||
mStart = true;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
mRefreshStop = true;
|
||||
mStart = false;
|
||||
mHandler.removeMessages( MSG_INDUCE );
|
||||
mHandler.removeMessages( MSG_REFRESH_DEFAULT_CARD );
|
||||
mHandler.removeMessages( MSG_START_LOOP_DEFAULT_CARD );
|
||||
mHandler.removeMessages( MSG_REFRESH_ADVERTISEMENT );
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG );
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG2 );
|
||||
mHandler.removeMessages( MSG_WAIT_NETWORK );
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
if ( !mStart ) {
|
||||
return;
|
||||
}
|
||||
if ( mRefreshStrategy == null ) {
|
||||
return;
|
||||
}
|
||||
mRefreshStop = false;
|
||||
mHandler.removeMessages( mRefreshStrategy.getMsgType() );
|
||||
mHandler.sendEmptyMessageDelayed( mRefreshStrategy.getMsgType(), mRefreshStrategy.getInterval() );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始诱导策略
|
||||
* 第一次如果有活动,则优先播报活动,否则播报道路事件/车友
|
||||
* 后面的按各自的时间间隔播报
|
||||
*/
|
||||
private void handleInduceStrategy() {
|
||||
if ( mAdvertisements != null && !mAdvertisements.isEmpty() ) {
|
||||
loopRenderAdvertisements( 0 );
|
||||
startNextRefreshStrategy();
|
||||
}
|
||||
}
|
||||
|
||||
private void startNextRefreshStrategy() {
|
||||
if ( mRefreshStrategy != null ) {
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
}
|
||||
restart();
|
||||
}
|
||||
|
||||
private void speakTTS( String msg, boolean checkAppForeground ) {
|
||||
if ( TextUtils.isEmpty( msg ) ) {
|
||||
return;
|
||||
}
|
||||
if ( checkAppForeground ) {
|
||||
if ( AppUtils.isAppForeground( mContext ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( msg );
|
||||
}
|
||||
|
||||
private void notifyRefreshChanged( String info, int amount, String tts ) {
|
||||
Intent intent = new Intent( "com.mogo.launcher.v2x" );
|
||||
intent.putExtra( "v2x_warning_type", "20000" );
|
||||
intent.putExtra( "v2x_warining_timeout", 20 * 1000 );
|
||||
intent.putExtra( "v2x_warning_tts", tts );
|
||||
intent.putExtra( "v2x_warning_eventCount", amount );
|
||||
intent.putExtra( "v2x_warning_info", info );
|
||||
mContext.sendBroadcast( intent );
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 刷新默认卡片样式
|
||||
* <p>
|
||||
* 2. 播报默认卡片语音
|
||||
*
|
||||
* @param sendConfigOnly 仅发送配置到
|
||||
*/
|
||||
private void renderDefaultLauncherCardConfig( boolean sendConfigOnly ) {
|
||||
if ( mDefaultLauncherCardConfig != null ) {
|
||||
long curr = System.currentTimeMillis();
|
||||
if ( mDefaultLauncherCardConfig.endTime > curr && mDefaultLauncherCardConfig.startTime < curr ) {
|
||||
Intent intent = new Intent( "com.mogo.launcher.v2x.card" );
|
||||
intent.putExtra( "v2x_card_title", mDefaultLauncherCardConfig.name );
|
||||
intent.putExtra( "v2x_card_icon", mDefaultLauncherCardConfig.filePath );
|
||||
intent.putExtra( "v2x_card_content", mDefaultLauncherCardConfig.cardContent );
|
||||
intent.putExtra( "v2x_card_button_name", mDefaultLauncherCardConfig.buttonContent );
|
||||
intent.putExtra( "v2x_card_startTime", mDefaultLauncherCardConfig.startTime );
|
||||
intent.putExtra( "v2x_card_endTime", mDefaultLauncherCardConfig.endTime );
|
||||
intent.putExtra( "v2x_card_is_default", true );
|
||||
mContext.sendBroadcast( intent );
|
||||
if ( !TextUtils.isEmpty( mDefaultLauncherCardConfig.content ) ) {
|
||||
mLaunchTTSText = mDefaultLauncherCardConfig.content;
|
||||
}
|
||||
if ( mDefaultLauncherCardConfig.popupNum > 0 ) {
|
||||
mDefaultTTSPlayInterval = mDefaultLauncherCardConfig.popupNum * ONE_MINUTE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( sendConfigOnly ) {
|
||||
return;
|
||||
}
|
||||
|
||||
int counter = SharedPrefsMgr.getInstance( mContext ).getInt( KEY_LauncherCardTipCounter, 0 );
|
||||
if ( counter >= 1 ) {
|
||||
long lastTipTime = SharedPrefsMgr.getInstance( mContext ).getLong( KEY_LauncherCardTipLastTipTime, 0L );
|
||||
if ( System.currentTimeMillis() - lastTipTime < 7 * ONE_DAY ) {
|
||||
return;
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, 0 );
|
||||
counter = 0;
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardTipLastTipTime, 0L );
|
||||
}
|
||||
}
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, ++counter );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardTipLastTipTime, System.currentTimeMillis() );
|
||||
|
||||
try {
|
||||
speakTTS( mLaunchTTSText, true );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( mDefaultConfigCounter++ >= 1 ) {
|
||||
return;
|
||||
}
|
||||
startLoopDefaultConfigStrategy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求广告数据
|
||||
*/
|
||||
private void loadNetworkConfigStrategy() {
|
||||
loadAdvertisementConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求广告数据
|
||||
*/
|
||||
private void loadAdvertisementConfig() {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext )
|
||||
.append( "modelType", 30 )
|
||||
.build();
|
||||
mZhidaoRefreshModel.getRefreshApiService().getCarAdvertisingList( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< LauncherCardAdvertisementData >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess( LauncherCardAdvertisementData data ) {
|
||||
super.onSuccess( data );
|
||||
if ( data == null || data.result == null ) {
|
||||
return;
|
||||
}
|
||||
handleGotCarAdvertisingList( data.result );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
if ( code == 100046 ) {
|
||||
refreshTicket();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求花式的tts播报内容
|
||||
*/
|
||||
private void requestTtsStrategyConfig() {
|
||||
|
||||
long lastPlayDateTime = SharedPrefsMgr.getInstance( mContext ).getLong( KEY_LAST_LOAD_TTS_DATE, 0L );
|
||||
if ( lastPlayDateTime != 0 ) {
|
||||
Date lastPlayDate = new Date( lastPlayDateTime );
|
||||
if ( lastPlayDate.getDate() == new Date( System.currentTimeMillis() ).getDate() ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String name = SharedPrefsMgr.getInstance( mContext ).getString( KEY_LAST_LOAD_TTS_TYPE, LauncherCardRefreshType.Weather.name() );
|
||||
LauncherCardRefreshType type = LauncherCardRefreshType.valueOf( name );
|
||||
|
||||
MogoLocation location = MogoLocationClient.getInstance(mContext).getLastKnowLocation();
|
||||
TtsConfigBody body = new TtsConfigBody()
|
||||
.addType( LauncherCardRefreshType.NearRoads.getVal() )
|
||||
.addType( LauncherCardRefreshType.News.getVal() )
|
||||
.addType( LauncherCardRefreshType.ExplorerWay.getVal() )
|
||||
.addType( LauncherCardRefreshType.Weather.getVal() )
|
||||
.sn( MoGoAiCloudClientConfig.getInstance().getSn() )
|
||||
.cityCode( location.getCityCode() )
|
||||
.cityName( location.getCityName() )
|
||||
.location( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext )
|
||||
.append( "data", GsonUtil.jsonFromObject( body ) )
|
||||
.build();
|
||||
mRefreshModel.getRefreshApiService().queryBroadCastInfo( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< TtsConfigData >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess( TtsConfigData data ) {
|
||||
super.onSuccess( data );
|
||||
if ( data == null || data.result == null ) {
|
||||
return;
|
||||
}
|
||||
handleTtsConfig( data, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
if ( code == 100046 ) {
|
||||
refreshTicket();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 策略:
|
||||
* 优先车辆限行
|
||||
* 剩下的按顺序播报
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
private void handleTtsConfig( TtsConfigData data, LauncherCardRefreshType type ) {
|
||||
List< TtsConfigData.TrafficRestriction > trafficRestrictions = data.result.trafficRestriction;
|
||||
if ( trafficRestrictions != null && !trafficRestrictions.isEmpty() ) {
|
||||
for ( TtsConfigData.TrafficRestriction trafficRestriction : trafficRestrictions ) {
|
||||
if ( trafficRestriction == null || TextUtils.isEmpty( trafficRestriction.tts ) ) {
|
||||
continue;
|
||||
}
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", LauncherCardRefreshType.TrafficRestriction.name() );
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "v2x_play", properties );
|
||||
speakTTS( trafficRestriction.tts, false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TtsConfigNode weather = new TtsConfigNode( data.result.weather, LauncherCardRefreshType.Weather );
|
||||
TtsConfigNode news = new TtsConfigNode( data.result.news, LauncherCardRefreshType.News );
|
||||
TtsConfigNode nearRoads = new TtsConfigNode( data.result.nearRoads, LauncherCardRefreshType.NearRoads );
|
||||
TtsConfigNode explorerWay = new TtsConfigNode( data.result.friendAndPois, LauncherCardRefreshType.ExplorerWay );
|
||||
TtsConfigNode onlineCar = new TtsConfigNode( data.result.friendAndPois, LauncherCardRefreshType.OnlineCar );
|
||||
|
||||
weather.next = news;
|
||||
news.next = nearRoads;
|
||||
nearRoads.next = explorerWay;
|
||||
explorerWay.next = onlineCar;
|
||||
onlineCar.next = weather;
|
||||
|
||||
TtsConfigNode header = null;
|
||||
switch ( type ) {
|
||||
case News:
|
||||
header = news;
|
||||
break;
|
||||
case NearRoads:
|
||||
header = nearRoads;
|
||||
break;
|
||||
case OnlineCar:
|
||||
header = onlineCar;
|
||||
break;
|
||||
case Weather:
|
||||
header = weather;
|
||||
break;
|
||||
case ExplorerWay:
|
||||
header = explorerWay;
|
||||
break;
|
||||
}
|
||||
|
||||
TtsConfigNode pointer = header;
|
||||
|
||||
do {
|
||||
if ( handleTtsNode( pointer ) ) {
|
||||
writeNextLoadType( pointer.type );
|
||||
return;
|
||||
}
|
||||
pointer = pointer.next;
|
||||
} while ( pointer != header );
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理每个配置项
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
private boolean handleTtsNode( TtsConfigNode node ) {
|
||||
if ( node.data == null || node.data.isEmpty() ) {
|
||||
return false;
|
||||
}
|
||||
for ( Object datum : node.data ) {
|
||||
boolean result = false;
|
||||
if ( datum instanceof TtsConfigData.Weather ) {
|
||||
result = handleWeatherTtsConfig( ( ( TtsConfigData.Weather ) datum ) );
|
||||
} else if ( datum instanceof TtsConfigData.News ) {
|
||||
result = handleNewsTtsConfig( ( ( TtsConfigData.News ) datum ) );
|
||||
} else if ( datum instanceof TtsConfigData.NearRoads ) {
|
||||
result = handleNearRoadsTtsConfig( ( ( TtsConfigData.NearRoads ) datum ) );
|
||||
} else if ( datum instanceof TtsConfigData.OnlineCarVsExplorerWay ) {
|
||||
if ( node.type == LauncherCardRefreshType.ExplorerWay ) {
|
||||
result = handleExplorerWayTtsConfig( ( ( TtsConfigData.OnlineCarVsExplorerWay ) datum ) );
|
||||
if ( !result ) {
|
||||
node.type = LauncherCardRefreshType.OnlineCar;
|
||||
result = handleOnlineCarTtsConfig( ( ( TtsConfigData.OnlineCarVsExplorerWay ) datum ) );
|
||||
}
|
||||
} else if( node.type == LauncherCardRefreshType.OnlineCar ){
|
||||
result = handleOnlineCarTtsConfig( ( ( TtsConfigData.OnlineCarVsExplorerWay ) datum ) );
|
||||
if ( !result ) {
|
||||
node.type = LauncherCardRefreshType.ExplorerWay;
|
||||
result = handleExplorerWayTtsConfig( ( ( TtsConfigData.OnlineCarVsExplorerWay ) datum ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( result ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 天气
|
||||
*
|
||||
* @param weather
|
||||
* @return
|
||||
*/
|
||||
private boolean handleWeatherTtsConfig( TtsConfigData.Weather weather ) {
|
||||
if ( weather == null ) {
|
||||
return false;
|
||||
}
|
||||
speakTTS( weather.tts, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新闻
|
||||
*
|
||||
* @param news
|
||||
* @return
|
||||
*/
|
||||
private boolean handleNewsTtsConfig( TtsConfigData.News news ) {
|
||||
if ( news == null ) {
|
||||
return false;
|
||||
}
|
||||
speakTTS( news.tts, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 常走道路
|
||||
*
|
||||
* @param nearRoads
|
||||
* @return
|
||||
*/
|
||||
private boolean handleNearRoadsTtsConfig( TtsConfigData.NearRoads nearRoads ) {
|
||||
if ( nearRoads == null ) {
|
||||
return false;
|
||||
}
|
||||
speakTTS( nearRoads.tts, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路事件
|
||||
*
|
||||
* @param explorerWay
|
||||
* @return
|
||||
*/
|
||||
private boolean handleExplorerWayTtsConfig( TtsConfigData.OnlineCarVsExplorerWay explorerWay ) {
|
||||
if ( explorerWay == null || explorerWay.poiTotal == 0 ) {
|
||||
return false;
|
||||
}
|
||||
String tts = mContext.getString( R.string.module_service_launcher_card_tips );
|
||||
String info = mContext.getString( R.string.module_service_launcher_card_info );
|
||||
speakTTS( String.format( tts, explorerWay.poiTotal, LauncherCardRefreshType.ExplorerWay.getDesc() ), false );
|
||||
notifyRefreshChanged( String.format( info, explorerWay.poiTotal, LauncherCardRefreshType.ExplorerWay.getDesc() ), explorerWay.poiTotal, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车友
|
||||
*
|
||||
* @param onlineCar
|
||||
* @return
|
||||
*/
|
||||
private boolean handleOnlineCarTtsConfig( TtsConfigData.OnlineCarVsExplorerWay onlineCar ) {
|
||||
if ( onlineCar == null || onlineCar.carTotal == 0 ) {
|
||||
return false;
|
||||
}
|
||||
String tts = mContext.getString( R.string.module_service_launcher_card_tips );
|
||||
String info = mContext.getString( R.string.module_service_launcher_card_info );
|
||||
speakTTS( String.format( tts, onlineCar.carTotal, LauncherCardRefreshType.OnlineCar.getDesc() ), false );
|
||||
notifyRefreshChanged( String.format( info, onlineCar.carTotal, LauncherCardRefreshType.OnlineCar.getDesc() ), onlineCar.carTotal, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存下次需要首先播报的内容类型
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
private void writeNextLoadType( LauncherCardRefreshType type ) {
|
||||
SharedPrefsMgr.getInstance( mContext ).putString( KEY_LAST_LOAD_TTS_TYPE, type.getNext() );
|
||||
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type.name() );
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "v2x_play", properties );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LAST_LOAD_TTS_DATE, System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
|
||||
private void refreshTicket() {
|
||||
mRefreshTicketCounter++;
|
||||
MarkerServiceHandler.getApis().getPassportManagerApi().requestTicket( new IMogoTicketCallback() {
|
||||
@Override
|
||||
public void onTicketGot( String ticket ) {
|
||||
if ( mRefreshTicketCounter < 3 ) {
|
||||
loadNetworkConfigStrategy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( int code, String msg ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess( String token, String sn ) {
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void handleGotCarAdvertisingList( List< LauncherCardAdvertisementData.LauncherCardAdvertisement > data ) {
|
||||
if ( data == null ) {
|
||||
mAdvertisements = null;
|
||||
return;
|
||||
}
|
||||
|
||||
mAdvertisements = new ArrayList<>();
|
||||
for ( LauncherCardAdvertisementData.LauncherCardAdvertisement launcherCardAdvertisement : data ) {
|
||||
if ( launcherCardAdvertisement == null ) {
|
||||
continue;
|
||||
}
|
||||
if ( launcherCardAdvertisement.cardType == LauncherCardAdvertisementData.TYPE_DEFAULT_CONFIG ) {
|
||||
mDefaultLauncherCardConfig = launcherCardAdvertisement;
|
||||
renderDefaultLauncherCardConfig( true );
|
||||
} else if ( launcherCardAdvertisement.cardType == LauncherCardAdvertisementData.TYPE_ACTIVITY ) {
|
||||
long curr = System.currentTimeMillis();
|
||||
if ( curr > launcherCardAdvertisement.startTime && curr < launcherCardAdvertisement.endTime ) {
|
||||
mAdvertisements.add( launcherCardAdvertisement );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !mAdvertisements.isEmpty() && mAdvertisements.size() > 1 ) {
|
||||
LauncherCardAdvertisementData.LauncherCardAdvertisement[] sorted = new LauncherCardAdvertisementData.LauncherCardAdvertisement[mAdvertisements.size()];
|
||||
sorted = mAdvertisements.toArray( sorted );
|
||||
Arrays.sort( sorted, ( ( o1, o2 ) -> {
|
||||
return o1.sort > o2.sort ? 1 : ( o1.sort == o2.sort ? 0 : -1 );
|
||||
} ) );
|
||||
mAdvertisements = Arrays.asList( sorted );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认播报 / 后台配置默认项播报策略
|
||||
*/
|
||||
private void startLoopDefaultConfigStrategy() {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_START_LOOP_DEFAULT_CARD;
|
||||
mHandler.sendMessageDelayed( msg, mDefaultTTSPlayInterval );
|
||||
}
|
||||
|
||||
private void loopRenderAdvertisements( int index ) {
|
||||
try {
|
||||
index = index % mAdvertisements.size();
|
||||
LauncherCardAdvertisementData.LauncherCardAdvertisement advertisement = mAdvertisements.get( index );
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_REFRESH_ADVERTISEMENT;
|
||||
msg.arg1 = ++index;
|
||||
mHandler.sendMessageDelayed( msg, advertisement.popupNum * ONE_MINUTE );
|
||||
renderAdvertisement( advertisement );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新广告
|
||||
*/
|
||||
private void renderAdvertisement( LauncherCardAdvertisementData.LauncherCardAdvertisement advertisement ) {
|
||||
if ( advertisement == null ) {
|
||||
return;
|
||||
}
|
||||
long curr = System.currentTimeMillis();
|
||||
if ( advertisement.endTime > curr && advertisement.startTime < curr ) {
|
||||
Intent intent = new Intent( "com.mogo.launcher.v2x.card" );
|
||||
intent.putExtra( "v2x_card_title", advertisement.name );
|
||||
intent.putExtra( "v2x_card_icon", advertisement.filePath );
|
||||
intent.putExtra( "v2x_card_content", advertisement.cardContent );
|
||||
intent.putExtra( "v2x_card_button_name", advertisement.buttonContent );
|
||||
intent.putExtra( "v2x_card_startTime", advertisement.startTime );
|
||||
intent.putExtra( "v2x_card_endTime", advertisement.endTime );
|
||||
intent.putExtra( "v2x_card_activity_id", advertisement.id );
|
||||
intent.putExtra( "v2x_card_timeout", 20 * 1000 );
|
||||
intent.putExtra( "v2x_card_is_default", false );
|
||||
mContext.sendBroadcast( intent );
|
||||
if ( !AppUtils.isAppForeground( mContext ) ) {
|
||||
speakTTS( advertisement.content, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.mogo.module.service.launchercard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class TtsConfigNode {
|
||||
|
||||
public List data;
|
||||
public LauncherCardRefreshType type;
|
||||
public TtsConfigNode next;
|
||||
|
||||
public TtsConfigNode( List data, LauncherCardRefreshType type ) {
|
||||
this.data = data;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
|
||||
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;
|
||||
@@ -16,7 +15,6 @@ import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
@@ -35,10 +33,7 @@ import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -57,7 +52,6 @@ import java.util.Map;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoBizActionDoneListener,
|
||||
IMogoADASControlStatusChangedListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
|
||||
@@ -103,33 +97,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
mContext = context.getApplicationContext();
|
||||
mRefreshModel = new RefreshModel(mContext);
|
||||
CloudPoiManager.getInstance().updateFromConfig(context);
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener(this);
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
|
||||
|
||||
// if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
// CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener(TAG, mContext, new ICallChatResponse() {
|
||||
//
|
||||
// @Override
|
||||
// public void userWindowStatus(boolean show) {
|
||||
// try {
|
||||
// if (mLastCheckMarker == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (TextUtils.equals(mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)
|
||||
// && !show) {
|
||||
// closeMarker(mLastCheckMarker);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
@@ -138,7 +108,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
try {
|
||||
boolean result = switchMarkerOpenStatus(marker);
|
||||
if (!result) {
|
||||
updateCarUserInfoWindow(marker);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,9 +162,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
mLastCheckMarker = mogoMarker;
|
||||
// 在线车辆点击使用infoWindow
|
||||
if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
updateCarUserInfoWindow(mogoMarker);
|
||||
} else {
|
||||
if (!TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object instanceof MarkerShowEntity) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
@@ -225,25 +192,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据点击 marker 更新用户信息面板内容
|
||||
*
|
||||
* @param marker
|
||||
*/
|
||||
private void updateCarUserInfoWindow(IMogoMarker marker) {
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
try {
|
||||
if (!TextUtils.equals(marker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) {
|
||||
return;
|
||||
}
|
||||
marker.setIcon(OnlineCarMarkerView.getInstance().getSelectedBitmap(getCarVehicleType(marker)));
|
||||
MarkerOnlineCar onlineCar = (MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
//车聊聊显示用户信息界面
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 折叠气泡
|
||||
private void closeMarker(IMogoMarker mogoMarker) {
|
||||
if (mogoMarker == null) {
|
||||
@@ -301,10 +249,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
@@ -312,10 +256,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
|
||||
// 在首页时才埋点
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()) {
|
||||
trackData(mLastDataResult);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,19 +264,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private synchronized void drawMarkerByCurrentType(MarkerCardResult markerCardResult) {
|
||||
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawAllMarker(markerCardResult);
|
||||
}
|
||||
|
||||
@@ -350,60 +283,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
RoadConditionDrawer.getInstance().drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_ALL, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计地图内数据获取
|
||||
*
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void trackData(MarkerCardResult markerCardResult) {
|
||||
if (markerCardResult == null) {
|
||||
return;
|
||||
}
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
|
||||
JSONArray array = new JSONArray();
|
||||
int size = 0;
|
||||
size = exploreWayList == null ? 0 : exploreWayList.size();
|
||||
final Map<String, Integer> typeCounterMap = new HashMap<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
String poiType = exploreWay.getPoiType();
|
||||
int counter = 0;
|
||||
if (!typeCounterMap.containsKey(poiType)) {
|
||||
counter = 0;
|
||||
} else {
|
||||
counter = typeCounterMap.get(poiType);
|
||||
}
|
||||
typeCounterMap.put(poiType, counter + 1);
|
||||
}
|
||||
if (!typeCounterMap.isEmpty()) {
|
||||
for (Map.Entry<String, Integer> entry : typeCounterMap.entrySet()) {
|
||||
if (entry == null || entry.getKey() == null) {
|
||||
continue;
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("type", entry.getKey());
|
||||
object.put("num", entry.getValue());
|
||||
array.put(object);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (array.length() == 0) {
|
||||
return;
|
||||
}
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("data", array.toString());
|
||||
MarkerServiceHandler.getMogoAnalytics().track("v2x_data_get", properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发数据到各个业务模块
|
||||
* <p>
|
||||
@@ -533,9 +412,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()) {
|
||||
return;
|
||||
}
|
||||
final int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
|
||||
if (mMarkerDisplayBounds == null) {
|
||||
@@ -596,8 +472,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @return
|
||||
*/
|
||||
private boolean ignoreDrawRequest() {
|
||||
return MarkerServiceHandler.getMogoStatusManager().isSearchUIShow()
|
||||
|| MarkerServiceHandler.getMogoStatusManager().isV2XShow()
|
||||
return MarkerServiceHandler.getMogoStatusManager().isV2XShow()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched()
|
||||
|| !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume()
|
||||
|| MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight();
|
||||
@@ -610,27 +485,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
ThreadPoolService.execute(runnable);
|
||||
}
|
||||
|
||||
public String getCurrentModuleName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBizActionDone(String biz, int position, Object data) {
|
||||
if (data instanceof MarkerShowEntity && ((MarkerShowEntity) data).getMarker() != null) {
|
||||
switchMarkerOpenStatus(((MarkerShowEntity) data).getMarker());
|
||||
} else {
|
||||
IMogoMarkerManager markerManager = MogoMarkerManager.getInstance(mContext);
|
||||
List<IMogoMarker> markers = markerManager.getMarkers(biz);
|
||||
if (markers != null) {
|
||||
try {
|
||||
IMogoMarker marker = markers.get(position);
|
||||
switchMarkerOpenStatus(marker);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
switch (mapUI) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -31,7 +30,4 @@ public interface RefreshApiService {
|
||||
@POST("/yycp-launcherSnapshot/user/queryOnLineCarWithRoute")
|
||||
Observable<MarkerResponse> queryOnLineCarWithRoute(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/appCard/queryAppCardData")
|
||||
Observable<TtsConfigData> queryBroadCastInfo(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
|
||||
@@ -37,10 +37,6 @@ public class RefreshModel {
|
||||
this.mRefreshApiService = MoGoRetrofitFactory.getInstance(HostConst.LAUNCHER_SNAPSHOT_HOST).create(RefreshApiService.class);
|
||||
}
|
||||
|
||||
public RefreshApiService getRefreshApiService() {
|
||||
return mRefreshApiService;
|
||||
}
|
||||
|
||||
public void refreshExplorerWayData(MogoLatLng latLng, int radius, int limit, final RefreshCallback callback) {
|
||||
if (mRefreshApiService != null) {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface TimeDelayApiService {
|
||||
|
||||
|
||||
/**
|
||||
* 上报延时时间
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-computer-vision-service/mockEye/delayTimeCallBack")
|
||||
Observable<BaseData> uploadDelayData(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.module.service.network.bean.LauncherCardAdvertisementData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* 接口描述
|
||||
*/
|
||||
public interface ZhidaoApiService {
|
||||
|
||||
/**
|
||||
* 获取桌面卡片配置
|
||||
*
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
@GET( "/marketing/advertisingPosition/getCarAdvertisingList" )
|
||||
Observable< LauncherCardAdvertisementData > getCarAdvertisingList( @QueryMap Map< String, Object > parameters );
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* 使用智道的域名
|
||||
*/
|
||||
public class ZhidaoRefreshModel {
|
||||
|
||||
private static final String TAG = "RefreshModel";
|
||||
|
||||
private final ZhidaoApiService mRefreshApiService;
|
||||
|
||||
public ZhidaoRefreshModel(Context context) {
|
||||
this.mRefreshApiService = MoGoRetrofitFactory.getInstance(HostConst.CARLIFE_HOST).create(ZhidaoApiService.class);
|
||||
}
|
||||
|
||||
public ZhidaoApiService getRefreshApiService() {
|
||||
return mRefreshApiService;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/8/24
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class LauncherCardAdvertisementData extends BaseData {
|
||||
|
||||
// 启动展示
|
||||
public static final int TYPE_DEFAULT_CONFIG = 1;
|
||||
// 活动
|
||||
public static final int TYPE_ACTIVITY = 2;
|
||||
|
||||
public List< LauncherCardAdvertisement > result;
|
||||
|
||||
/**
|
||||
* 卡片名称 name
|
||||
* 卡片类型 fileType 1-启动展示、2-活动播报
|
||||
* 卡片样式 filePath
|
||||
* 卡片文案 cardContent
|
||||
* 按钮文案 url
|
||||
* 语音文案 content
|
||||
* 活动期限 是时间戳 ,还是标准时间 startTime endTime Date类型
|
||||
* 播报频次(间隔):popupNum
|
||||
* 活动展示顺序 sort
|
||||
*/
|
||||
public static class LauncherCardAdvertisement {
|
||||
public String id;
|
||||
public String name;
|
||||
public int cardType;
|
||||
public String filePath;
|
||||
public String cardContent;
|
||||
public String buttonContent;
|
||||
public String content;
|
||||
public int sort;
|
||||
public long startTime;
|
||||
public long endTime;
|
||||
public int popupNum; // 间隔时间:分钟
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
public class MockSocketReceiverData {
|
||||
|
||||
public static final int MOCK_RECEIVER_STATUS_START = 0;
|
||||
public static final int MOCK_RECEIVER_STATUS_STOP = 1;
|
||||
|
||||
private int status;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private double heading;
|
||||
private long systemTime;
|
||||
private long satelliteTime;
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MockSocketReceiverData{" +
|
||||
"status=" + status +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", heading=" + heading +
|
||||
", systemTime=" + systemTime +
|
||||
", satelliteTime=" + satelliteTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
public class MockSocketSendData {
|
||||
private long systemTime;
|
||||
private String uuid;
|
||||
private long satelliteTime;
|
||||
|
||||
public MockSocketSendData(long systemTime, String uuid, long satelliteTime) {
|
||||
this.systemTime = systemTime;
|
||||
this.uuid = uuid;
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(long satelliteTime) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/17
|
||||
*
|
||||
* 请求参数
|
||||
*/
|
||||
class TtsConfigBody implements Parcelable {
|
||||
|
||||
private MogoLatLng location;
|
||||
private List< String > dataType;
|
||||
private String sn;
|
||||
private String cityCode;
|
||||
private String cityName;
|
||||
|
||||
public TtsConfigBody cityCode( String cityCode ) {
|
||||
this.cityCode = cityCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody cityName( String cityName ) {
|
||||
this.cityName = cityName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody addType( String type ) {
|
||||
if ( dataType == null ) {
|
||||
dataType = new ArrayList<>();
|
||||
}
|
||||
dataType.add( type );
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody sn( String sn ) {
|
||||
this.sn = sn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody location( MogoLatLng location ) {
|
||||
this.location = location;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public TtsConfigBody() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeParcelable( this.location, flags );
|
||||
dest.writeStringList( this.dataType );
|
||||
dest.writeString( this.sn );
|
||||
dest.writeString( this.cityCode );
|
||||
dest.writeString( this.cityName );
|
||||
}
|
||||
|
||||
protected TtsConfigBody( Parcel in ) {
|
||||
this.location = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
this.dataType = in.createStringArrayList();
|
||||
this.sn = in.readString();
|
||||
this.cityCode = in.readString();
|
||||
this.cityName = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator< TtsConfigBody > CREATOR = new Creator< TtsConfigBody >() {
|
||||
@Override
|
||||
public TtsConfigBody createFromParcel( Parcel source ) {
|
||||
return new TtsConfigBody( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TtsConfigBody[] newArray( int size ) {
|
||||
return new TtsConfigBody[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class TtsConfigData extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
public String sn;
|
||||
public List< String > dataType;
|
||||
public List< Weather > weather;
|
||||
public List< News > news;
|
||||
public List< NearRoads > nearRoads;
|
||||
public List< TrafficRestriction > trafficRestriction;
|
||||
public List< OnlineCarVsExplorerWay > friendAndPois;
|
||||
}
|
||||
|
||||
public static class BaseConfig {
|
||||
public String tts;
|
||||
}
|
||||
|
||||
public static class Weather extends BaseConfig {
|
||||
public String cityName;
|
||||
public String cityId;
|
||||
public String weather;
|
||||
public int hour;
|
||||
public int weatherCode;
|
||||
public double weatherTime;
|
||||
public int alarmLevel;
|
||||
public int alarmType;
|
||||
}
|
||||
|
||||
public static class News extends BaseConfig {
|
||||
|
||||
public String title;
|
||||
public String content;
|
||||
@SerializedName( "img_width" )
|
||||
public String imgWidth;
|
||||
@SerializedName( "full_title" )
|
||||
public String fullTitle;
|
||||
@SerializedName( "pdate" )
|
||||
public String time;
|
||||
public String src;
|
||||
@SerializedName( "img_length" )
|
||||
public String imgLength;
|
||||
public String img;
|
||||
public String url;
|
||||
@SerializedName( "pdate_src" )
|
||||
public String date;
|
||||
}
|
||||
|
||||
public static class NearRoads extends BaseConfig {
|
||||
|
||||
}
|
||||
|
||||
public static class TrafficRestriction extends BaseConfig {
|
||||
}
|
||||
|
||||
public static class OnlineCarVsExplorerWay extends BaseConfig {
|
||||
|
||||
/**
|
||||
* 车友数量
|
||||
*/
|
||||
public int carTotal;
|
||||
|
||||
/**
|
||||
* 道路事件数量
|
||||
*/
|
||||
public int poiTotal;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,13 +35,6 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String ACTION_MOCK = "com.mogo.mock";
|
||||
|
||||
// 接受其他app发给高德的广播
|
||||
public static final String ACTION_AUTO_NAVI_RECEIVER = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
// 接受高德发过来的广播
|
||||
public static final String ACTION_AUTO_NAVI_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
|
||||
public static final String ACTION_MOGO = "com.mogo.ACTION";
|
||||
|
||||
//车辆监控
|
||||
public static final String ACTION_CHECK_VEHICLE_MONITORING = "ACTION_CHECK_VEHICLE_MONITORING";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user