merge
This commit is contained in:
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
@@ -43,8 +44,9 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.och.taxi.passenger.utils.TPCoordinateCalculateRouteUtil;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -164,9 +166,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.registerLifecycleListener(10010,mSocketLifeCycleLisnter);
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
@@ -204,9 +204,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
@@ -56,7 +57,7 @@ import com.mogo.och.taxi.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.taxi.utils.OchTaxiAnalyticsUtil;
|
||||
import com.mogo.och.taxi.utils.OrderUtil;
|
||||
import com.mogo.och.taxi.utils.PinYinUtil;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -195,9 +196,7 @@ public class MogoOCHTaxiModelNew {
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.registerLifecycleListener(10010, mSocketLifeCycleLisnter);
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
@@ -232,9 +231,7 @@ public class MogoOCHTaxiModelNew {
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -19,8 +20,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.zhidao.loglib.bean.RemoteLogPushContent
|
||||
import com.zhidao.loglib.call.LogInfoManagerFactory
|
||||
import com.zhidao.loglib.core.ILogListener
|
||||
@@ -48,8 +48,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
MogoApisHandler.getInstance().apis
|
||||
.getSocketManagerApi(AbsMogoApplication.getApp().applicationContext)
|
||||
MogoAiCloudSocketManager.getInstance(AbsMogoApplication.getApp().applicationContext)
|
||||
.registerOnMessageListener(LOG_PUSH_TYPE, this)
|
||||
manualContent.pkgName = context.packageName
|
||||
logCheck(context)
|
||||
@@ -225,8 +224,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
MogoApisHandler.getInstance().apis
|
||||
.getSocketManagerApi(AbsMogoApplication.getApp().applicationContext)
|
||||
MogoAiCloudSocketManager.getInstance(AbsMogoApplication.getApp().applicationContext)
|
||||
.unregisterLifecycleListener(LOG_PUSH_TYPE)
|
||||
|
||||
if (handler.hasMessages(MSG_TRY_CLOSE_LOG)) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
@@ -25,7 +26,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.zhjt.dispatch.model.DispatchServiceModel;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
|
||||
import com.zhjt.dispatch.model.IDispatch;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -102,7 +103,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
mContext = context;
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
mApis.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
MogoAiCloudSocketManager.getInstance(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
mApis.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
// 添加自动驾驶按钮选中监听
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.content.Context;
|
||||
import android.os.Process;
|
||||
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices;
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
||||
@@ -21,6 +23,7 @@ import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.function.notice.PushUIConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
@@ -30,16 +33,15 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
import com.mogo.map.MapApiPath;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
import com.zhjt.mogo_core_function_devatools.DevaToolsProvider;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -109,6 +111,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SocketBuildConfig.isPrintLog = false;
|
||||
// 初始化DevaTools,开始链路记录
|
||||
CallerDevaToolsManager.INSTANCE.init(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -265,24 +269,21 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
*/
|
||||
private void uploadLocPerFiveSecond() {
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
apis.getLocationInfoApi().start();
|
||||
MogoLocationInfoServices.getInstance().init(getApplicationContext());
|
||||
MogoLocationInfoServices.getInstance().start();
|
||||
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApplicationContext());
|
||||
if (locationClient != null) {
|
||||
locationClient.addLocationListener(location -> {
|
||||
apis.getLocationInfoApi().provideLocation(location);
|
||||
});
|
||||
locationClient.addLocationListener(location -> MogoLocationInfoServices.getInstance().provideLocation(location));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startSocketService() {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "startSocketService");
|
||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
MogoLocation location = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApp()).getLastKnowLocation();
|
||||
// 关闭长链服务
|
||||
apis.getSocketManagerApi(getApplicationContext()).destroy();
|
||||
apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() {
|
||||
MogoAiCloudSocketManager.getInstance(getApplicationContext()).destroy();
|
||||
MogoAiCloudSocketManager.getInstance(getApplicationContext()).registerLifecycleListener(10020, new IMogoLifecycleListener() {
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "socket-onConnectFailure");
|
||||
@@ -304,7 +305,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
// 开启Socket长链服务
|
||||
double lat = location.getLatitude();
|
||||
double lon = location.getLongitude();
|
||||
apis.getSocketManagerApi(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId(),lat,lon);
|
||||
MogoAiCloudSocketManager.getInstance(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId(),lat,lon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -315,8 +316,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
|
||||
private void initModules() {
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "initModules");
|
||||
//mogo deva tools
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider"));
|
||||
// 初始化 bugly 升级
|
||||
MogoModulePaths.addBaseModule(new MogoModule(UpgradeReportConstants.PATH, UpgradeReportConstants.NAME));
|
||||
// 初始化 apm 日志采集
|
||||
|
||||
@@ -4,13 +4,13 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NOT
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
@@ -33,16 +33,16 @@ class NoticeSocketManager {
|
||||
|
||||
public void registerSocketMessageListener(Context context) {
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
MogoAiCloudSocketManager.getInstance(context).
|
||||
registerOnMessageListener(301001, mTrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
MogoAiCloudSocketManager.getInstance(context).
|
||||
registerOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
|
||||
public void unRegisterSocketMessageListener() {
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
MogoAiCloudSocketManager.getInstance(mContext).
|
||||
unregisterOnMessageListener(301001, mTrafficNoticeListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
MogoAiCloudSocketManager.getInstance(mContext).
|
||||
unregisterOnMessageListener(100, mNormalNoticeListener);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,10 +171,6 @@ class PushRepository(mContext: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
fun setPushUIShow(show: Boolean) {
|
||||
statusManager.setPushUIShow(PushUIConstants.PATH, show)
|
||||
}
|
||||
|
||||
fun delete(bean: PushBean) {
|
||||
HandlerUtils.mBgHandler.post {
|
||||
pushBeanDao.delete(bean)
|
||||
|
||||
@@ -124,7 +124,6 @@ class PushViewModel(
|
||||
}
|
||||
floatView?.pushBeanChanged(field)
|
||||
registerVoiceCMD()
|
||||
pushRepository.setPushUIShow(field != null)
|
||||
}
|
||||
|
||||
fun pushMessageFinish(needSave: Boolean = false) {
|
||||
|
||||
@@ -88,5 +88,4 @@ internal object BridgeApi {
|
||||
|
||||
fun intentManager() = apis?.intentManagerApi
|
||||
|
||||
fun actionManager() = apis?.actionManagerApi
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import android.location.Location
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import androidx.core.content.contentValuesOf
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
@@ -20,9 +20,8 @@ import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
|
||||
import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
|
||||
import com.mogo.eagle.core.function.v2x.vip.network.VipNetWorkModel
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import kotlin.math.abs
|
||||
|
||||
class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListener,
|
||||
@@ -56,8 +55,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
MogoApisHandler.getInstance()
|
||||
.apis.getSocketManagerApi(context)
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
.registerOnMessageListener(401025, this)
|
||||
|
||||
//首次进入应用查询是否为VIP车辆
|
||||
@@ -262,7 +260,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
MogoApisHandler.getInstance().apis.getSocketManagerApi(mContext)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(401025)
|
||||
mContext = null
|
||||
}
|
||||
|
||||
@@ -37,20 +37,6 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_UTILS_ANALYTICS = "/utils/analytics";
|
||||
|
||||
/**
|
||||
* netty 长链
|
||||
*/
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_SOCKET_MANAGER = "/socket/manager";
|
||||
|
||||
/**
|
||||
* WebSocket 长链
|
||||
*/
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_WEB_SOCKET_MANAGER = "/websocket/manager";
|
||||
|
||||
/**
|
||||
* 状态管理接口
|
||||
*/
|
||||
@@ -116,13 +102,6 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_SERVICE_APIS = "/mogoservice/apis";
|
||||
|
||||
/**
|
||||
* 动作指令
|
||||
*/
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_ACTION_APIS = "/mogoaction/api";
|
||||
|
||||
/**
|
||||
* 顶部1/2屏管理
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,10 @@ object CallerDevaToolsManager {
|
||||
MogoServicePaths.PATH_DEVA_TOOLS
|
||||
)
|
||||
|
||||
fun init(context: Context){
|
||||
devaToolsProviderApi?.init(context)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始抓取全量日志
|
||||
*/
|
||||
|
||||
@@ -86,8 +86,6 @@ public abstract class BaseParams {
|
||||
public BaseParams put(String key, Object value) {
|
||||
if (checkKey(key) && checkValue(value)) {
|
||||
urlParams.put(key, value);
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(M_NETWORK + TAG, "parameter key is illegal or parameter value is illegal");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -7,10 +7,9 @@ import androidx.annotation.Keep;
|
||||
import com.mogo.cloud.location.LocationManager;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.cloud.location.IMogoLocationInfoService;
|
||||
|
||||
@Keep
|
||||
public class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
public class MogoLocationInfoServices {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoServices-sdk";
|
||||
|
||||
@@ -36,29 +35,24 @@ public class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideLocation(MogoLocation location) {
|
||||
mLocation = location;
|
||||
// CallerLogger.INSTANCE.d(TAG, "sdk - provideLocation");
|
||||
}
|
||||
|
||||
public MogoLocation getLocation() {
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
LocationManager.getInstance().start();
|
||||
CallerLogger.INSTANCE.d(TAG, "sdk - start");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
LocationManager.getInstance().stop();
|
||||
CallerLogger.INSTANCE.d(TAG, "sdk - stop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
LocationManager.getInstance().init(context);
|
||||
CallerLogger.INSTANCE.d(TAG, "sdk - init");
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.aicloud.services.passport;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.service.cloud.passport.IMogoPassportManager;
|
||||
import com.mogo.service.cloud.passport.IMogoTicketCallback;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Keep
|
||||
class PassportManager implements IMogoPassportManager {
|
||||
|
||||
private static volatile PassportManager sInstance;
|
||||
private IMogoTicketCallback mCallBack;
|
||||
|
||||
private PassportManager() {
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() {
|
||||
@Override
|
||||
public void onTokenGot(String token, String sn) {
|
||||
if (mCallBack != null) {
|
||||
mCallBack.onTicketGot(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
if (mCallBack != null) {
|
||||
mCallBack.onError(code, msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static PassportManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (PassportManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new PassportManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
mCallBack = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTicket(final IMogoTicketCallback callback) {
|
||||
this.mCallBack = callback;
|
||||
MoGoAiCloudClient.getInstance().refreshToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
package com.mogo.aicloud.services.socket;
|
||||
|
||||
public interface IMogoLifecycleListener {
|
||||
void onConnectFailure();
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
package com.mogo.aicloud.services.socket;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
package com.mogo.aicloud.services.socket;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
package com.mogo.aicloud.services.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -9,10 +9,6 @@ import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.cloud.socket.IMogoMsgAckListener;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
import com.zhidao.socket.ConnectionLifecycleListener;
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public abstract class AbsMogoApplication extends Application {
|
||||
if (shouldInit()) {
|
||||
initHttpDns();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initRxJavaErrorHandler() {
|
||||
|
||||
@@ -7,35 +7,13 @@ package com.mogo.module.common;
|
||||
* 各个卡片模块类型
|
||||
*/
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
@@ -42,18 +42,4 @@ public class MapMarkerAdapter {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 MarkerShowEntity 填充好的 MarkerView
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param markerShowEntity 要填充的数据
|
||||
* @return MarkerView
|
||||
*/
|
||||
public static IMarkerView getMarkerInfoWindowView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
|
||||
// if ( markerShowEntity.isChecked() ) {
|
||||
// return new MapMarkerInfoView( context, markerShowEntity, options );
|
||||
// } else {
|
||||
// }
|
||||
return new MapMarkerView( context, markerShowEntity, options );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
@@ -83,7 +82,6 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_yellow_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_yellow);
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ModuleNames.CARD_TYPE_CARS_CHATTING:
|
||||
case ModuleNames.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
@@ -93,7 +91,6 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
break;
|
||||
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
|
||||
case ModuleNames.CARD_TYPE_NOVELTY:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -109,29 +106,6 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
CallerLogger.INSTANCE.e(TAG, "未能根据poiType获取对应poi信息,无法渲染info marker====" + poiType);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ModuleNames.CARD_TYPE_SHARE_MUSIC:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
if (bindObj instanceof MarkerShareMusic) {
|
||||
// 2 为书籍听书,3 为新闻,1 为qq音乐,int
|
||||
switch (((MarkerShareMusic) bindObj).getShareType()) {
|
||||
case 1:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
break;
|
||||
case 2:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_book);
|
||||
break;
|
||||
case 3:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_news);
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -70,7 +70,6 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
switch ( markerShowEntity.getMarkerType() ) {
|
||||
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
|
||||
case ModuleNames.CARD_TYPE_NOVELTY:
|
||||
if ( mMarkerShowEntity != null && mMarkerShowEntity.isChecked() ) {
|
||||
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg_checked );
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -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";
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-service</string>
|
||||
<string name="module_service_launcher_card_tips">你的周围有%d个%s,请点击查看,你也可以对我说打开’蘑菇车联‘</string>
|
||||
<string name="module_service_launcher_card_info">周围有%d个%s</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package com.mogo.service;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cloud.location.IMogoLocationInfoService;
|
||||
import com.mogo.service.cloud.passport.IMogoPassportManager;
|
||||
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;
|
||||
import com.mogo.service.v2x.DisplayEffectsInterface;
|
||||
@@ -34,13 +29,6 @@ public interface IMogoServiceApis extends IProvider {
|
||||
*/
|
||||
IMogoAnalytics getAnalyticsApi();
|
||||
|
||||
/**
|
||||
* 获取socket操作api
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoSocketManager getSocketManagerApi(Context context);
|
||||
|
||||
/**
|
||||
* 大而全的数据管理接口
|
||||
*
|
||||
@@ -90,13 +78,6 @@ public interface IMogoServiceApis extends IProvider {
|
||||
*/
|
||||
IMogoWindowManager getWindowManagerApi();
|
||||
|
||||
/**
|
||||
* 动作控制
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoActionManager getActionManagerApi();
|
||||
|
||||
|
||||
/**
|
||||
* 获取顶部1/2屏界面管理类
|
||||
@@ -112,17 +93,4 @@ public interface IMogoServiceApis extends IProvider {
|
||||
*/
|
||||
DisplayEffectsInterface getDisplayEffectsManager();
|
||||
|
||||
/**
|
||||
* 获取位置上报服务接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoLocationInfoService getLocationInfoApi();
|
||||
|
||||
/**
|
||||
* 获取位置上报服务接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoPassportManager getPassportManagerApi();
|
||||
}
|
||||
|
||||
@@ -1,314 +0,0 @@
|
||||
package com.mogo.service.cloud.location;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
*/
|
||||
public class CloudLocationInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private double lat;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private double lon;
|
||||
|
||||
/**
|
||||
* 车头方向
|
||||
*/
|
||||
private double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
private long systemTime;
|
||||
|
||||
/**
|
||||
* 卫星时间
|
||||
*/
|
||||
private long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private double alt;
|
||||
|
||||
/**
|
||||
* 车速
|
||||
*/
|
||||
private double speed;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
* 0:普通车辆、家用车
|
||||
*/
|
||||
private int vehicleType = 0;
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
private String roadId;
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
private String laneId;
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
private int laneNum;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
private double rateLimiting;
|
||||
|
||||
/**
|
||||
* 瓦片id
|
||||
*/
|
||||
private String tileId;
|
||||
|
||||
/**
|
||||
* 车道宽度
|
||||
*/
|
||||
private double roadWidth;
|
||||
|
||||
public CloudLocationInfo() {
|
||||
}
|
||||
|
||||
public CloudLocationInfo(CloudLocationInfo info) {
|
||||
this.lat = info.getLat();
|
||||
this.lon = info.getLon();
|
||||
this.heading = info.getHeading();
|
||||
this.systemTime = System.currentTimeMillis();
|
||||
this.satelliteTime = System.currentTimeMillis();
|
||||
this.alt = info.alt;
|
||||
this.speed = info.speed;
|
||||
this.vehicleType = info.vehicleType;
|
||||
this.roadId = info.roadId;
|
||||
this.laneId = info.laneId;
|
||||
this.laneNum = info.laneNum;
|
||||
this.rateLimiting = info.rateLimiting;
|
||||
this.tileId = info.tileId;
|
||||
this.roadWidth = info.roadWidth;
|
||||
}
|
||||
|
||||
protected CloudLocationInfo(Parcel in) {
|
||||
lat = in.readDouble();
|
||||
lon = in.readDouble();
|
||||
heading = in.readDouble();
|
||||
systemTime = in.readLong();
|
||||
satelliteTime = in.readLong();
|
||||
alt = in.readDouble();
|
||||
speed = in.readDouble();
|
||||
vehicleType = in.readInt();
|
||||
roadId = in.readString();
|
||||
laneId = in.readString();
|
||||
laneNum = in.readInt();
|
||||
rateLimiting = in.readDouble();
|
||||
tileId = in.readString();
|
||||
roadWidth = in.readDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeDouble(lat);
|
||||
dest.writeDouble(lon);
|
||||
dest.writeDouble(heading);
|
||||
dest.writeLong(systemTime);
|
||||
dest.writeLong(satelliteTime);
|
||||
dest.writeDouble(alt);
|
||||
dest.writeDouble(speed);
|
||||
dest.writeInt(vehicleType);
|
||||
dest.writeString(roadId);
|
||||
dest.writeString(laneId);
|
||||
dest.writeInt(laneNum);
|
||||
dest.writeDouble(rateLimiting);
|
||||
dest.writeString(tileId);
|
||||
dest.writeDouble(roadWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<CloudLocationInfo> CREATOR = new Creator<CloudLocationInfo>() {
|
||||
@Override
|
||||
public CloudLocationInfo createFromParcel(Parcel in) {
|
||||
return new CloudLocationInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudLocationInfo[] newArray(int size) {
|
||||
return new CloudLocationInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(long satelliteTime) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public double getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(double alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public int getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(int vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public String getRoadId() {
|
||||
return roadId;
|
||||
}
|
||||
|
||||
public void setRoadId(String roadId) {
|
||||
this.roadId = roadId;
|
||||
}
|
||||
|
||||
public String getLaneId() {
|
||||
return laneId;
|
||||
}
|
||||
|
||||
public void setLaneId(String laneId) {
|
||||
this.laneId = laneId;
|
||||
}
|
||||
|
||||
public int getLaneNum() {
|
||||
return laneNum;
|
||||
}
|
||||
|
||||
public void setLaneNum(int laneNum) {
|
||||
this.laneNum = laneNum;
|
||||
}
|
||||
|
||||
public double getRateLimiting() {
|
||||
return rateLimiting;
|
||||
}
|
||||
|
||||
public void setRateLimiting(double rateLimiting) {
|
||||
this.rateLimiting = rateLimiting;
|
||||
}
|
||||
|
||||
public String getTileId() {
|
||||
return tileId;
|
||||
}
|
||||
|
||||
public void setTileId(String tileId) {
|
||||
this.tileId = tileId;
|
||||
}
|
||||
|
||||
public double getRoadWidth() {
|
||||
return roadWidth;
|
||||
}
|
||||
|
||||
public void setRoadWidth(double roadWidth) {
|
||||
this.roadWidth = roadWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CloudLocationInfo{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", heading=" + heading +
|
||||
", systemTime=" + systemTime +
|
||||
", satelliteTime=" + satelliteTime +
|
||||
", alt=" + alt +
|
||||
", speed=" + speed +
|
||||
", vehicleType=" + vehicleType +
|
||||
", roadId='" + roadId + '\'' +
|
||||
", laneId='" + laneId + '\'' +
|
||||
", laneNum=" + laneNum +
|
||||
", rateLimiting=" + rateLimiting +
|
||||
", tileId=" + tileId +
|
||||
", roadWidth=" + roadWidth +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String print() {
|
||||
return "CloudLocation{ lon: " + lon + " lat: " + lat + " heading: " + heading + " speed: "
|
||||
+ speed + " vehicleType: " + vehicleType + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CloudLocationInfo that = (CloudLocationInfo) o;
|
||||
return Double.compare(that.lat, lat) == 0 &&
|
||||
Double.compare(that.lon, lon) == 0;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(lat, lon);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.service.cloud.location;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 位置服务:上报位置信息和车机状态
|
||||
*/
|
||||
interface IMogoLocationInfoService extends IProvider {
|
||||
|
||||
/**
|
||||
* 提供位置信息
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
void provideLocation( MogoLocation location );
|
||||
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.service.cloud.passport;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoPassportManager extends IProvider {
|
||||
|
||||
void requestTicket( IMogoTicketCallback callback );
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.service.cloud.passport;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
* <p>
|
||||
* ticket 回调
|
||||
*/
|
||||
interface IMogoTicketCallback {
|
||||
|
||||
void onTicketGot( String ticket );
|
||||
|
||||
void onError( int code, String msg );
|
||||
|
||||
void onLoginSuccess(String token, String sn);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-20
|
||||
* <p>
|
||||
* 长链接口数据接口
|
||||
*/
|
||||
public interface IMessageResponse {
|
||||
|
||||
/**
|
||||
* 设置消息id
|
||||
*
|
||||
* @param msgId
|
||||
*/
|
||||
void setMsgId( long msgId );
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
|
||||
/**
|
||||
* 消息回调
|
||||
*/
|
||||
public interface IMogoOnWebSocketMessageListener<T> {
|
||||
|
||||
default WebSocketMsgType getDownLinkType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default WebSocketMsgType getUpLinkType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Class<T> target() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default void onMsgReceived(T obj) {
|
||||
|
||||
}
|
||||
|
||||
default void onError(String errorMsg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
public interface IMogoWebSocketManager<T> extends IProvider {
|
||||
|
||||
/**
|
||||
* 初始化,各模块不用关心
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param appId 一般为包名,不参与通道的建立,一般用于发消息
|
||||
*/
|
||||
void init( Context context, String appId );
|
||||
|
||||
/**
|
||||
* 注册消息监听
|
||||
*
|
||||
* @param listener 回调
|
||||
*/
|
||||
void registerOnWebSocketMessageListener(IMogoOnWebSocketMessageListener listener );
|
||||
|
||||
/**
|
||||
* 注销消息监听
|
||||
*
|
||||
*/
|
||||
void unregisterOnWebSocketMessageListener(IMogoOnWebSocketMessageListener listener );
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param body 消息体
|
||||
* @param listener 回执监听
|
||||
*/
|
||||
default void sendMsg( T body, IMogoOnWebSocketMessageListener listener ){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止socket服务
|
||||
*/
|
||||
default void stop(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.service.cloud.socket;
|
||||
|
||||
public enum WebSocketMsgType {
|
||||
|
||||
MSG_TYPE_UPLINK_CAR_DATA(0,"自车与ADAS数据"),
|
||||
MSG_TYPE_DOWNLINK_CAR_DATA(1,"服务端下发车辆信息"),
|
||||
MSG_TYPE_ACK(3, "ACK");
|
||||
|
||||
private int msgType;
|
||||
private String msg;
|
||||
|
||||
WebSocketMsgType(int msgType, String msg) {
|
||||
this.msgType = msgType;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
|
||||
public void setMsgType(int msgType) {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 翻页回调
|
||||
*/
|
||||
public interface IMogoActionListener {
|
||||
|
||||
/**
|
||||
* 执行动作
|
||||
*
|
||||
* @param action
|
||||
*/
|
||||
void onActionDone( MogoAction action );
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 基础动作指令控制
|
||||
*/
|
||||
public interface IMogoActionManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 注册动作监听回调
|
||||
*
|
||||
* @param biz 具体业务
|
||||
* @param listener 回调
|
||||
*/
|
||||
void registerActionListener( String biz, IMogoActionListener listener );
|
||||
|
||||
/**
|
||||
* 取消动作翻页回调
|
||||
*
|
||||
* @param biz 具体业务
|
||||
* @param listener 回调
|
||||
*/
|
||||
void unregisterActionListener( String biz, IMogoActionListener listener );
|
||||
|
||||
/**
|
||||
* 回调
|
||||
*
|
||||
* @param biz 业务
|
||||
* @param action 动作
|
||||
*/
|
||||
void invoke( String biz, MogoAction action );
|
||||
|
||||
/**
|
||||
* 主模块注册业务回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerBizActionDoneListener( IMogoBizActionDoneListener listener );
|
||||
|
||||
/**
|
||||
* 主模块注销业务回调
|
||||
*/
|
||||
void unregisterBizActionDoneListener();
|
||||
|
||||
/**
|
||||
* 业务回调信息到主模块
|
||||
*
|
||||
* @param biz
|
||||
* @param position
|
||||
* @param data
|
||||
*/
|
||||
void bizInvoke( String biz, int position, Object data );
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 业务回调各自的当前动作
|
||||
*/
|
||||
public interface IMogoBizActionDoneListener {
|
||||
|
||||
/**
|
||||
* @param biz 业务
|
||||
* @param position 位置
|
||||
* @param data 数据
|
||||
*/
|
||||
void onBizActionDone( String biz, int position, Object data );
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public enum MogoAction {
|
||||
|
||||
/**
|
||||
* 上一个
|
||||
*/
|
||||
Prev,
|
||||
|
||||
/**
|
||||
* 下一个
|
||||
*/
|
||||
Next
|
||||
}
|
||||
@@ -30,13 +30,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isV2XShow();
|
||||
|
||||
/**
|
||||
* push UI 是否在展示
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isPushShow();
|
||||
|
||||
/**
|
||||
* 是否开机
|
||||
*
|
||||
@@ -44,7 +37,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isAccOn();
|
||||
|
||||
|
||||
/**
|
||||
* 是否有用户交互
|
||||
*
|
||||
@@ -52,19 +44,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isUserInteracted();
|
||||
|
||||
/**
|
||||
* 用户是否在搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isSearchUIShow();
|
||||
|
||||
/**
|
||||
* APP 列表是否显示
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isAppListUIShow();
|
||||
|
||||
/**
|
||||
* 主页是否显示
|
||||
@@ -80,34 +59,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isMainPageIsBackground();
|
||||
|
||||
/**
|
||||
* 小智语音是否准备完毕
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isAIAssistReady();
|
||||
|
||||
/**
|
||||
* 求助状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isSeekHelping();
|
||||
|
||||
/**
|
||||
* 是否在查看全程状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDisplayOverview();
|
||||
|
||||
/**
|
||||
* 是否在查看全程状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isUploading();
|
||||
|
||||
/**
|
||||
* 主页是否已启动
|
||||
*
|
||||
@@ -115,19 +66,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isMainPageLaunched();
|
||||
|
||||
/**
|
||||
* 对话框是否展示
|
||||
* @return
|
||||
*/
|
||||
boolean isCallViewShow();
|
||||
|
||||
/**
|
||||
* 设置对话框展示状态
|
||||
* @param tag
|
||||
* @param status
|
||||
*/
|
||||
void setCallViewShow(String tag, boolean status);
|
||||
|
||||
/**
|
||||
* 设置vrMode状态
|
||||
* @param tag 业务类型
|
||||
@@ -135,19 +73,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setVrMode(String tag, boolean vrMode);
|
||||
|
||||
/**
|
||||
* 媒体是否正在播放
|
||||
* @return true - 正在播放 false - 没有播放
|
||||
*/
|
||||
boolean isMediaPlaying();
|
||||
|
||||
/**
|
||||
* 设置媒体播放状态
|
||||
* @param tag 业务类型
|
||||
* @param status true - 正在播放 false - 未在播放
|
||||
*/
|
||||
void setMediaPlayStatus(String tag, boolean status);
|
||||
|
||||
/**
|
||||
* 设置topView展示状态
|
||||
* @param tag 业务类型
|
||||
@@ -163,15 +88,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setVoiceUIShow( String tag, boolean show );
|
||||
|
||||
/**
|
||||
* 设置 ADAS UI 状态
|
||||
*
|
||||
* @param tag 业务类型
|
||||
* @param show true - 显示 false - 隐藏
|
||||
*/
|
||||
@Deprecated
|
||||
void setADASUIShow( String tag, boolean show );
|
||||
|
||||
/**
|
||||
* 设置 V2X UI 状态
|
||||
* <p>
|
||||
@@ -181,14 +97,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setV2XUIShow( String tag, boolean show );
|
||||
|
||||
/**
|
||||
* 设置 PUSH UI 状态
|
||||
*
|
||||
* @param tag 业务类型
|
||||
* @param show true - 显示 false - 隐藏
|
||||
*/
|
||||
void setPushUIShow( String tag, boolean show );
|
||||
|
||||
/**
|
||||
* 设置 acc 状态
|
||||
*
|
||||
@@ -206,19 +114,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setUserInteractionStatus( String tag, boolean interrupt, boolean callback );
|
||||
|
||||
/**
|
||||
* 搜索页面显示状态
|
||||
*/
|
||||
void setSearchUIShow( String tag, boolean isShow );
|
||||
|
||||
/**
|
||||
* app 列表是否显示
|
||||
*
|
||||
* @param tag
|
||||
* @param isShow
|
||||
*/
|
||||
void setAppListUIShow( String tag, boolean isShow );
|
||||
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
*
|
||||
@@ -251,22 +146,6 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setSeekHelping( String tag, boolean seekHelping );
|
||||
|
||||
/**
|
||||
* 设置展示全程状态
|
||||
*
|
||||
* @param tag
|
||||
* @param display
|
||||
*/
|
||||
void setDisplayOverview( String tag, boolean display );
|
||||
|
||||
/**
|
||||
* 设置展示全程状态
|
||||
*
|
||||
* @param tag
|
||||
* @param uploading
|
||||
*/
|
||||
void setUploadingStatus( String tag, boolean uploading );
|
||||
|
||||
/**
|
||||
* 设置主页是否启动
|
||||
*
|
||||
|
||||
@@ -8,18 +8,6 @@ package com.mogo.service.statusmanager;
|
||||
*/
|
||||
public enum StatusDescriptor {
|
||||
|
||||
/**
|
||||
* adas UI
|
||||
* Deprecated, use {@link #V2X_UI} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ADAS_UI,
|
||||
|
||||
/**
|
||||
* 推送UI:弹窗
|
||||
*/
|
||||
PUSH_UI,
|
||||
|
||||
/**
|
||||
* v2x UI
|
||||
*/
|
||||
@@ -40,16 +28,6 @@ public enum StatusDescriptor {
|
||||
*/
|
||||
USER_INTERACTED,
|
||||
|
||||
/**
|
||||
* 搜索页面
|
||||
*/
|
||||
SEARCH_UI,
|
||||
|
||||
/**
|
||||
* app 列表
|
||||
*/
|
||||
APP_LIST_UI,
|
||||
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
*/
|
||||
@@ -70,28 +48,16 @@ public enum StatusDescriptor {
|
||||
*/
|
||||
SEEK_HELPING,
|
||||
|
||||
/**
|
||||
* 展示全程
|
||||
*/
|
||||
DISPLAY_OVERVIEW,
|
||||
|
||||
/**
|
||||
* 上报状态
|
||||
*/
|
||||
UPLOADING,
|
||||
|
||||
/**
|
||||
* 是否已经进入过主页
|
||||
*/
|
||||
MAIN_PAGE_CREATED,
|
||||
|
||||
/**
|
||||
* topView展示状态
|
||||
*/
|
||||
TOP_VIEW,
|
||||
/**
|
||||
* 媒体播放状态
|
||||
*/
|
||||
MEDIA_PLAYER_STATUS,
|
||||
|
||||
/**
|
||||
* 是否已经进入vr模式
|
||||
*/
|
||||
@@ -101,8 +67,6 @@ public enum StatusDescriptor {
|
||||
* 顶部弹框容器准备就绪
|
||||
*/
|
||||
TOP_CONTAINER_READY,
|
||||
/**
|
||||
* 聊天框是否正在展示
|
||||
*/
|
||||
CALL_VIEW
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cloud.location.IMogoLocationInfoService;
|
||||
import com.mogo.service.cloud.passport.IMogoPassportManager;
|
||||
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;
|
||||
@@ -20,7 +17,6 @@ import com.mogo.service.impl.imageloader.glide.GlideImageLoader;
|
||||
import com.mogo.service.impl.intent.IntentManager;
|
||||
import com.mogo.service.impl.singleton.SingletonsHolder;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.v2x.DisplayEffectsInterface;
|
||||
@@ -46,11 +42,6 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return MogoAnalyticsImpl.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoSocketManager getSocketManagerApi(Context context) {
|
||||
return getApiInstance(IMogoSocketManager.class, MogoServicePaths.PATH_SOCKET_MANAGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoFragmentManager getFragmentManagerApi() {
|
||||
return SingletonsHolder.get(IMogoFragmentManager.class);
|
||||
@@ -92,11 +83,6 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance(IMogoWindowManager.class, MogoServicePaths.PATH_WINDOW_MANAGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoActionManager getActionManagerApi() {
|
||||
return getApiInstance(IMogoActionManager.class, MogoServicePaths.PATH_ACTION_APIS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTopViewManager getTopViewManager() {
|
||||
return getApiInstance(IMogoTopViewManager.class, MogoServicePaths.PATH_EXTENSIONS_TOP_VIEW_MANAGER);
|
||||
@@ -107,16 +93,6 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance(DisplayEffectsInterface.class, MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationInfoService getLocationInfoApi() {
|
||||
return getApiInstance(IMogoLocationInfoService.class, MogoServicePaths.PATH_LOCATION_INFO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPassportManager getPassportManagerApi() {
|
||||
return getApiInstance(IMogoPassportManager.class, MogoServicePaths.PATH_PASSPORT);
|
||||
}
|
||||
|
||||
private static <T extends IProvider> T getApiInstance(Class<T> clazz, String path) {
|
||||
T inst = SingletonsHolder.get(clazz);
|
||||
if (inst == null) {
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.service.impl.cloud.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.cloud.location.IMogoLocationInfoService;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_LOCATION_INFO)
|
||||
class MogoLocationInfoService implements IMogoLocationInfoService {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoService";
|
||||
|
||||
private IMogoLocationInfoService mDelegate;
|
||||
|
||||
@Override
|
||||
public void provideLocation(MogoLocation location) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.provideLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
try {
|
||||
Class<?> clazz = Class.forName("com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices");
|
||||
Method getInstanceMethod = clazz.getMethod("getInstance");
|
||||
getInstanceMethod.setAccessible(true);
|
||||
mDelegate = (IMogoLocationInfoService) getInstanceMethod.invoke(null);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "init error : " + e);
|
||||
}
|
||||
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.mogo.service.impl.cloud.passport;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.cloud.passport.IMogoPassportManager;
|
||||
import com.mogo.service.cloud.passport.IMogoTicketCallback;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_PASSPORT)
|
||||
class MogoPassportManager implements IMogoPassportManager {
|
||||
|
||||
private static final String TAG = "MogoPassportManager";
|
||||
|
||||
private IMogoPassportManager mDelegate;
|
||||
|
||||
@Override
|
||||
public void requestTicket(IMogoTicketCallback callback) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.requestTicket(callback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName("com.mogo.aicloud.services.passport.PassportManager");
|
||||
Method getInstanceMethod = clazz.getMethod("getInstance");
|
||||
getInstanceMethod.setAccessible(true);
|
||||
mDelegate = (IMogoPassportManager) getInstanceMethod.invoke(null);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "init error : " + e);
|
||||
}
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.mogo.service.impl.cloud.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.cloud.socket.IMogoMsgAckListener;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 长链操作管理
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_SOCKET_MANAGER)
|
||||
public class MogoSocketManager implements IMogoSocketManager {
|
||||
|
||||
private static final String TAG = "MogoSocketManager";
|
||||
private IMogoSocketManager mDelegate;
|
||||
|
||||
@Override
|
||||
public void init(Context context, String appId, double lat, double lon) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context, appId, lat, lon);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerOnMessageListener(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener(int msgType) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.unregisterOnMessageListener(msgType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.unregisterOnMessageListener(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLifecycleListener(int msgType, IMogoLifecycleListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerLifecycleListener(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterLifecycleListener(int msgType) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.unregisterLifecycleListener(msgType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.sendMsg(body, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
try {
|
||||
Class<?> clazz = Class.forName("com.mogo.aicloud.services.socket.MogoAiCloudSocketManager");
|
||||
Method getInstanceMethod = clazz.getMethod("getInstance", Context.class);
|
||||
getInstanceMethod.setAccessible(true);
|
||||
mDelegate = (IMogoSocketManager) getInstanceMethod.invoke(null, context);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "init error : " + e);
|
||||
}
|
||||
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.mogo.service.impl.cloud.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.service.cloud.socket.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoWebSocketManager;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_WEB_SOCKET_MANAGER;
|
||||
|
||||
@Route(path = PATH_WEB_SOCKET_MANAGER)
|
||||
public class MogoWebSocketManager implements IMogoWebSocketManager {
|
||||
|
||||
private static final String TAG = "MogoWebSocketManager";
|
||||
private IMogoWebSocketManager mDelegate;
|
||||
|
||||
@Override
|
||||
public void init(Context context, String appId) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context, appId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnWebSocketMessageListener( IMogoOnWebSocketMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerOnWebSocketMessageListener( listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnWebSocketMessageListener( IMogoOnWebSocketMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.unregisterOnWebSocketMessageListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(Object body, IMogoOnWebSocketMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.sendMsg(body, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName("com.mogo.base.websocket.WebSocketManager");
|
||||
Method getInstanceMethod = clazz.getMethod("getInstance", Context.class);
|
||||
getInstanceMethod.setAccessible(true);
|
||||
mDelegate = (IMogoWebSocketManager) getInstanceMethod.invoke(null, context);
|
||||
} catch (Exception e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "init error : " + e);
|
||||
}
|
||||
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,11 +56,6 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val( StatusDescriptor.V2X_UI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPushShow() {
|
||||
return get_bool_val( StatusDescriptor.PUSH_UI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccOn() {
|
||||
return get_bool_val( StatusDescriptor.ACC_STATUS );
|
||||
@@ -78,16 +73,6 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSearchUIShow() {
|
||||
return get_bool_val( StatusDescriptor.SEARCH_UI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAppListUIShow() {
|
||||
return get_bool_val( StatusDescriptor.APP_LIST_UI );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMainPageOnResume() {
|
||||
return get_bool_val( StatusDescriptor.MAIN_PAGE_RESUME );
|
||||
@@ -98,52 +83,11 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val( StatusDescriptor.MAIN_PAGE_IS_BACKGROUND );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIAssistReady() {
|
||||
return get_bool_val( StatusDescriptor.AI_ASSIST_READY );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSeekHelping() {
|
||||
return get_bool_val( StatusDescriptor.SEEK_HELPING );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayOverview() {
|
||||
return get_bool_val( StatusDescriptor.DISPLAY_OVERVIEW );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUploading() {
|
||||
return get_bool_val( StatusDescriptor.UPLOADING );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMainPageLaunched() {
|
||||
return get_bool_val( StatusDescriptor.MAIN_PAGE_CREATED );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMediaPlaying() {
|
||||
return get_bool_val( StatusDescriptor.MEDIA_PLAYER_STATUS );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCallViewShow() {
|
||||
return get_bool_val(StatusDescriptor.CALL_VIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallViewShow(String tag, boolean status) {
|
||||
doSetStatus(tag,StatusDescriptor.CALL_VIEW,status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMediaPlayStatus(String tag, boolean status) {
|
||||
doSetStatus(tag, StatusDescriptor.MEDIA_PLAYER_STATUS, status);
|
||||
}
|
||||
|
||||
private boolean get_bool_val(StatusDescriptor descriptor ) {
|
||||
Boolean val = mStatus.get( descriptor );
|
||||
return val != null && val;
|
||||
@@ -164,21 +108,11 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
doSetStatus( tag, StatusDescriptor.VOICE_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setADASUIShow( String tag, boolean show ) {
|
||||
doSetStatus( tag, StatusDescriptor.ADAS_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setV2XUIShow( String tag, boolean show ) {
|
||||
doSetStatus( tag, StatusDescriptor.V2X_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPushUIShow( String tag, boolean show ) {
|
||||
doSetStatus( tag, StatusDescriptor.PUSH_UI, show );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccStatus( String tag, boolean isOn ) {
|
||||
doSetStatus( tag, StatusDescriptor.ACC_STATUS, isOn );
|
||||
@@ -193,25 +127,13 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
recordStatusModifier( tag, StatusDescriptor.USER_INTERACTED );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchUIShow( String tag, boolean isShow ) {
|
||||
doSetStatus( tag, StatusDescriptor.SEARCH_UI, isShow );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppListUIShow( String tag, boolean isShow ) {
|
||||
doSetStatus( tag, StatusDescriptor.APP_LIST_UI, isShow );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainPageResumeStatus( String tag, boolean resume ) {
|
||||
final long start = System.currentTimeMillis();
|
||||
doSetStatus( tag, StatusDescriptor.MAIN_PAGE_RESUME, resume );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainPageIsBackgroundStatus(String tag, boolean isBackground) {
|
||||
final long start = System.currentTimeMillis();
|
||||
doSetStatus( tag, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, isBackground );
|
||||
}
|
||||
|
||||
@@ -225,16 +147,6 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
doSetStatus( tag, StatusDescriptor.SEEK_HELPING, seekHelping );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayOverview( String tag, boolean display ) {
|
||||
doSetStatus( tag, StatusDescriptor.DISPLAY_OVERVIEW, display );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUploadingStatus( String tag, boolean uploading ) {
|
||||
doSetStatus( tag, StatusDescriptor.UPLOADING, uploading );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainPageLaunchedStatus( String tag, boolean launched ) {
|
||||
doSetStatus( tag, StatusDescriptor.MAIN_PAGE_CREATED, launched );
|
||||
|
||||
Reference in New Issue
Block a user