diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java index 876105b948..9d6347d844 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java @@ -15,6 +15,8 @@ import com.mogo.aicloud.services.socket.IMogoLifecycleListener; import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.debug.DebugConfig; +import com.mogo.commons.module.intent.IMogoIntentListener; +import com.mogo.commons.module.intent.IntentManager; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener; @@ -42,7 +44,6 @@ import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager; import com.mogo.och.bus.passenger.network.BusPassengerServiceManager; import com.mogo.och.common.module.biz.network.OchCommonServiceCallback; import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil; -import com.mogo.service.intent.IMogoIntentListener; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; @@ -245,10 +246,7 @@ public class BusPassengerModel { // 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口 CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener); - MogoApisHandler.getInstance() - .getApis() - .getIntentManagerApi() - .registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener ); + IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener ); MogoApisHandler.getInstance() .getApis() .getStatusManagerApi() diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java index e9f730bdb4..b86e1da3bf 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java @@ -4,7 +4,6 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS import static com.mogo.och.bus.constant.BusConst.TIMER_START_AUTOPILOT_INTERVAL; import android.animation.ObjectAnimator; -import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -20,12 +19,9 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.Group; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.mvp.IView; import com.mogo.commons.mvp.MvpFragment; import com.mogo.commons.mvp.Presenter; -import com.mogo.commons.voice.AIAssist; import com.mogo.eagle.core.data.config.HmiBuildConfig; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; @@ -34,27 +30,21 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView; -import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.map.MogoMapUIController; -import com.mogo.map.MogoMarkerManager; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.uicontroller.VisualAngleMode; import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.constants.DataTypes; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.bus.R; import com.mogo.och.bus.bean.BusRoutesResult; -import com.mogo.och.bus.constant.BusConst; import com.mogo.och.bus.model.BusOrderModel; import com.mogo.och.bus.util.BDRouteDataTestUtils; import com.mogo.och.bus.view.SlidePanelView; import com.mogo.och.common.module.utils.SoundPoolHelper; import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.ThreadMode; import mogo.telematics.pad.MessagePad; import record_cache.RecordPanelOuterClass; @@ -66,7 +56,7 @@ import record_cache.RecordPanelOuterClass; * * @author tongchenfei */ -public abstract class BaseBusTabFragment> extends MvpFragment implements IMogoMapListener, IMoGoAutopilotRecordListener { +public abstract class BaseBusTabFragment> extends MvpFragment implements IMogoMapListener, IMoGoAutopilotRecordListener { private static final String TAG = "BaseOchFragment"; @@ -157,19 +147,9 @@ public abstract class BaseBusTabFragment } }); - if (DebugConfig.isDebug()) { - mTrafficDataView.setLongClickable(true); - mTrafficDataView.setOnLongClickListener(v -> { - CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏"); - Intent intent = new Intent(); - intent.putExtra("oper", 52); - MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent); - return true; - }); - } initListener(); setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()); - ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener(){ + ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() { @Override public void onClickImpl(View v) { @@ -198,7 +178,7 @@ public abstract class BaseBusTabFragment ); findViewById(R.id.btnAutopilotRoute).setOnClickListener(view -> debugArrivedRoute()); - + tvArrived.setOnClickListener(view -> { onArriveStation(); }); @@ -220,7 +200,7 @@ public abstract class BaseBusTabFragment } mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl); - if (mAICollectBtn != null){ + if (mAICollectBtn != null) { CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn); } } @@ -235,7 +215,7 @@ public abstract class BaseBusTabFragment protected abstract void onArriveStation(); - private void updateSwitchMapIcon(){ + private void updateSwitchMapIcon() { if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) { mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long); } else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) { @@ -295,14 +275,15 @@ public abstract class BaseBusTabFragment /** * 设置进站按钮状态 + * * @param isClickable */ - public void setArrivedClikable(boolean isClickable){ + public void setArrivedClikable(boolean isClickable) { getActivity().runOnUiThread(() -> { tvArrived.setEnabled(isClickable); - if (isClickable){ + if (isClickable) { tvArrived.setTextColor(getResources().getColor(R.color.bus_white)); - }else { + } else { tvArrived.setTextColor(getResources().getColor(R.color.bus_arrived_btn_un_clickable_color)); } }); @@ -317,9 +298,10 @@ public abstract class BaseBusTabFragment }); } - public void playDI(){ + public void playDI() { SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(getContext(), R.raw.bus_di); } + /** * 改变自动驾驶状态 * @@ -347,13 +329,13 @@ public abstract class BaseBusTabFragment ctvAutopilotStatus.setClickable(true); if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) {//1可用 ctvAutopilotStatus.setSelected(false); - }else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus){ + } else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) { ctvAutopilotStatus.setSelected(true); } } } - public void updateAutopilotStatus(int autopilotStatus){ + public void updateAutopilotStatus(int autopilotStatus) { if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {//2 running ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon); @@ -361,7 +343,7 @@ public abstract class BaseBusTabFragment ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_success_tv)); ctvAutopilotStatus.setSelected(false); ctvAutopilotStatus.setClickable(false); - }else { + } else { ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon); ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal)); ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_failure_tv)); @@ -373,7 +355,7 @@ public abstract class BaseBusTabFragment public void run() { setAutopilotBtnStatus(autopilotStatus); } - },1000); + }, 1000); } private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) { @@ -384,10 +366,10 @@ public abstract class BaseBusTabFragment // 主动开启自动驾驶中,不为2(为0、1)则继续loading return; } - if (isAnimateRunning){ + if (isAnimateRunning) { stopAutopilotAnimation(); updateAutopilotStatus(autopilotStatus); - }else { + } else { setAutopilotBtnStatus(autopilotStatus); } @@ -457,19 +439,20 @@ public abstract class BaseBusTabFragment } - private void startingAutoApilotCountDown(){ + private void startingAutoApilotCountDown() { //10s 若自动驾驶没有开启,则结束动画 UiThreadHandler.postDelayed(new Runnable() { @Override public void run() { //未启动成功做处理 - if (isAnimateRunning){// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态 + if (isAnimateRunning) {// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态 stopAutopilotAnimation(); updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()); } } - },TIMER_START_AUTOPILOT_INTERVAL); + }, TIMER_START_AUTOPILOT_INTERVAL); } + /** * 停止自动驾驶中间动画 */ @@ -489,7 +472,7 @@ public abstract class BaseBusTabFragment */ public void updateSpeedView(float newSpeed) { int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值 - if (mTrafficDataView != null){ + if (mTrafficDataView != null) { mTrafficDataView.updateSpeedWithValue(speed); } } @@ -524,7 +507,7 @@ public abstract class BaseBusTabFragment /** * Bus调试信息:线路、轨迹等信息 - * + *

* START */ private View busTestBar; diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java index 79e59a7b17..efe018353a 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java @@ -15,6 +15,8 @@ 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.commons.module.intent.IMogoIntentListener; +import com.mogo.commons.module.intent.IntentManager; import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.config.FunctionBuildConfig; @@ -57,7 +59,6 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum; import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager; import com.mogo.aicloud.services.socket.IMogoLifecycleListener; import com.mogo.och.taxi.passenger.utils.TaxiPassengerAnalyticsManager; -import com.mogo.service.intent.IMogoIntentListener; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; @@ -228,10 +229,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback // 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口 CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener); - MogoApisHandler.getInstance() - .getApis() - .getIntentManagerApi() - .registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener ); + IntentManager.getInstance().registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener ); MogoApisHandler.getInstance() .getApis() .getStatusManagerApi() diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java index 064730a4f2..b6ba11596d 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java @@ -18,6 +18,8 @@ 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.module.intent.IMogoIntentListener; +import com.mogo.commons.module.intent.IntentManager; import com.mogo.eagle.core.data.BaseData; import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; @@ -69,7 +71,6 @@ import com.mogo.och.taxi.utils.TaxiAnalyticsManager; import com.mogo.och.taxi.utils.OrderUtil; import com.mogo.aicloud.services.socket.IMogoLifecycleListener; import com.mogo.och.taxi.utils.TaxiTrajectoryManager; -import com.mogo.service.intent.IMogoIntentListener; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; import com.zhjt.service.chain.ChainLog; @@ -215,10 +216,7 @@ public class TaxiModel { // 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口 CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener); - MogoApisHandler.getInstance() - .getApis() - .getIntentManagerApi() - .registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener); + IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener); MogoApisHandler.getInstance() .getApis() .getStatusManagerApi() diff --git a/core/function-impl/mogo-core-function-bindingcar/src/main/res/layout/module_push_message_item.xml b/core/function-impl/mogo-core-function-bindingcar/src/main/res/layout/module_push_message_item.xml index a01bc6197c..836b55c2aa 100644 --- a/core/function-impl/mogo-core-function-bindingcar/src/main/res/layout/module_push_message_item.xml +++ b/core/function-impl/mogo-core-function-bindingcar/src/main/res/layout/module_push_message_item.xml @@ -17,7 +17,7 @@ android:layout_height="match_parent" android:background="@drawable/module_push_recycler_item_background"> - - ?) { - BridgeApi.analytics()?.track(eventType, data) + AnalyticsUtils.track(eventType, data) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt index cba2a2e7ec..c5203d60a2 100644 --- a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt @@ -21,13 +21,7 @@ internal object BridgeApi { internal fun context(): Context = contextHolder?.get() ?: Utils.getApp() - internal fun intentManager() = apis?.intentManagerApi - internal fun statusManager() = apis?.statusManagerApi - internal fun analytics() = apis?.analyticsApi - - internal fun topViewManager() = apis?.topViewManager - internal fun floatViewManager() = apis?.windowManagerApi } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt index 02d8a353b6..eba4663d41 100644 --- a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt @@ -30,8 +30,8 @@ import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi import com.mogo.eagle.core.function.chat.facade.utils.log import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade.REQUEST_CLOUD_VOICE_CALL import com.mogo.eagle.core.utilcode.kotlin.* -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform.CornerType.LEFT +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform.CornerType.LEFT import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt index 957641ded4..7ba0700ca1 100644 --- a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt @@ -3,13 +3,14 @@ package com.mogo.eagle.core.function.chat.facade.voice import android.content.Context import android.content.Intent import com.mogo.commons.AbsMogoApplication +import com.mogo.commons.module.intent.IMogoIntentListener +import com.mogo.commons.module.intent.IntentManager import com.mogo.commons.voice.AIAssist import com.mogo.commons.voice.IMogoVoiceCmdCallBack import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade.IMoGoVoiceCallback import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi import com.mogo.eagle.core.function.chat.facade.utils.log -import com.mogo.service.intent.IMogoIntentListener import java.lang.ref.WeakReference import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.atomic.AtomicBoolean @@ -48,10 +49,6 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo private var onSpeechFinish: WeakReference? = null - private val intentManager by lazy { - BridgeApi.intentManager() - } - override fun speak(context: Context, content: String, listener: IMoGoVoiceCallback) { listeners += WeakReference(listener) AIAssist.getInstance(context).speakTTSVoiceWithLevel(content,AIAssist.LEVEL3 ,this) @@ -123,10 +120,8 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo } hasRegister.set(true) AIAssist.getInstance(BridgeApi.context()).registerUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL, customCancelCallArray, this) - intentManager?.also { - it.registerIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this) - it.registerIntentListener(VOICE_INTENT_REFUSE_CALL, this) - } + IntentManager.getInstance().registerIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this) + IntentManager.getInstance().registerIntentListener(VOICE_INTENT_REFUSE_CALL, this) } override fun registerInviteJoinTeam(context: Context, listener: IMoGoVoiceCallback) { @@ -156,13 +151,13 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo override fun registerIntentInComingCall(listener: IMoGoVoiceCallback) { listeners += WeakReference(listener) - intentManager?.registerIntentListener(VOICE_INTENT_ANSWER_CALL, this) - intentManager?.registerIntentListener(VOICE_INTENT_REFUSE_CALL, this) + IntentManager.getInstance().registerIntentListener(VOICE_INTENT_ANSWER_CALL, this) + IntentManager.getInstance().registerIntentListener(VOICE_INTENT_REFUSE_CALL, this) } override fun unRegisterIntentInComingCall(context: Context) { - intentManager?.unregisterIntentListener(VOICE_INTENT_ANSWER_CALL, this) - intentManager?.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this) + IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_ANSWER_CALL, this) + IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this) } override fun speakAndRegisterCall(onCmdAgree: (Boolean) -> Unit, onSpeakFinish: () -> Unit, listener: IMoGoVoiceCallback) { @@ -204,10 +199,8 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo hasRegister.set(false) listeners.clear() AIAssist.getInstance(BridgeApi.context()).unregisterUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL, this) - intentManager?.also { - it.unregisterIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this) - it.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this) - } + IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this) + IntentManager.getInstance().unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this) } override fun onIntentReceived(cmd: String?, intent: Intent?) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 0f5783796b..e368fa3865 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -20,10 +20,10 @@ import androidx.core.view.* import androidx.lifecycle.lifecycleScope import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.launcher.ARouter -import com.kwai.koom.base.postOnMainThread import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.commons.AbsMogoApplication import com.mogo.commons.debug.DebugConfig +import com.mogo.module.common.enums.EventTypeEnum import com.mogo.commons.mvp.BaseFragment import com.mogo.commons.mvp.MvpFragment import com.mogo.commons.voice.* @@ -45,7 +45,6 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion.STATUS_AUTOPILOT_RUNNING import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy.IViewNotificationProvider import com.mogo.eagle.core.function.api.hmi.view.IOchBusView @@ -56,7 +55,6 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager import com.mogo.eagle.core.function.call.check.CallerCheckManager @@ -86,6 +84,7 @@ import com.mogo.eagle.core.function.hmi.ui.tools.MaskView import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView +import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper import com.mogo.eagle.core.utilcode.kotlin.* import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.logger.* @@ -108,7 +107,6 @@ import kotlinx.android.synthetic.main.view_auto_pilot_check.view.* import kotlinx.android.synthetic.main.view_och_bus_operation.view.* import kotlinx.coroutines.* import mogo_msg.MogoReportMsg -import org.greenrobot.eventbus.EventBus import record_cache.RecordPanelOuterClass import java.util.* @@ -592,6 +590,10 @@ class MoGoHmiFragment : MvpFragment(), return HmiPresenter(this) } + override fun displayEffects() { + DisplayEffectsHelper.getInstance().display() + } + override fun setSpeedChartViewVisibility(visibility: Int) { viewSpeedChart?.visibility = visibility } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java index 80bd913233..7b0271d048 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java @@ -18,7 +18,7 @@ import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.function.hmi.WaringConst; import com.mogo.eagle.core.function.hmi.notification.WarningFloat; import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform; +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform; import com.mogo.eagle.core.utilcode.util.BitmapHelper; import com.mogo.eagle.core.utilcode.util.ThreadUtils; diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt index 6960ca946b..609c34afd8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt @@ -12,7 +12,7 @@ import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform import com.mogo.eagle.core.utilcode.util.BitmapHelper import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer import com.mogo.module.common.MogoApisHandler @@ -125,7 +125,9 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO pushImageView?.let { GlideApp.with(context).load(noticeNormal.imageUrl).optionalTransform( GlideRoundedCornersTransform( - 20f, GlideRoundedCornersTransform.CornerType.ALL) + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) ).into(it) } @@ -191,8 +193,12 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO playImageView!!.visibility = View.VISIBLE playImageView!!.setImageResource(R.drawable.notice_video_play) thumbnailImageView!!.visibility = View.VISIBLE - GlideApp.with(context).load(firstbitmap).optionalTransform(GlideRoundedCornersTransform( - 20f, GlideRoundedCornersTransform.CornerType.ALL)).into(thumbnailImageView!!) + GlideApp.with(context).load(firstbitmap).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(thumbnailImageView!!) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java index 7f67613a45..a6d3af65ed 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java @@ -16,7 +16,7 @@ import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.function.hmi.WaringConst; import com.mogo.eagle.core.function.hmi.notification.WarningFloat; import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform; +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform; /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java index fb1058fcbc..3283441e03 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java @@ -26,14 +26,14 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.call.notice.CallerNoticeManager; import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform; +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform; import com.mogo.eagle.core.utilcode.util.BitmapHelper; import com.mogo.eagle.core.utilcode.util.DateTimeUtils; import com.mogo.eagle.core.widget.media.video.NoticeSimpleSmallVideoPlayer; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.dialog.BaseFloatDialog; import com.mogo.service.IMogoServiceApis; -import com.mogo.service.imageloader.MogoImageView; +import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; import com.shuyu.gsyvideoplayer.GSYVideoManager; diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java index bded69ba63..80f06dd994 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java @@ -28,6 +28,7 @@ import com.kwai.koom.base.MonitorManager; import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor; import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig; import com.kwai.koom.nativeoom.leakmonitor.LeakRecord; +import com.mogo.commons.analytics.AnalyticsUtils; import com.mogo.commons.context.ContextHolderUtil; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.mvp.BaseFragment; @@ -60,7 +61,6 @@ import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.module.common.MogoApisHandler; import com.mogo.service.IMogoServiceApis; -import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; import com.mogo.service.statusmanager.IMogoStatusManager; import com.rousetime.android_startup.StartupManager; import com.rousetime.android_startup.model.LoggerLevel; @@ -85,7 +85,6 @@ import system_master.SystemStatusInfo; */ public class MainActivity extends MvpActivity implements MainView, IMogoLocationListener, - FragmentStackTransactionListener, IMoGoAutopilotStatusListener { protected static final String TAG = "MainActivity"; @@ -218,7 +217,7 @@ public class MainActivity extends MvpActivity implement properties.put("app_launch_hotStartTime", hotStartTime); } } - MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("app_launch_time", properties); + AnalyticsUtils.track("app_launch_time", properties); } } @@ -286,15 +285,6 @@ public class MainActivity extends MvpActivity implement loadFunctionMapView(); } - @Override - public void onTransaction(int size) { - if (size == 0) { - showLayout(); - } else if (size == 1) { - hideLayout(); - } - } - /** * 加载其它模块 */ @@ -431,7 +421,6 @@ public class MainActivity extends MvpActivity implement @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); - mPresenter.handleSchemeIntent(intent, true); } @Override @@ -502,7 +491,6 @@ public class MainActivity extends MvpActivity implement CallerLogger.INSTANCE.d(M_HMI + TAG, "destroy."); ContextHolderUtil.releaseContext(); MogoModulesManager.getInstance().onDestroy(); - SchemeIntent.getInstance().clear(); FloatingViewHandler.clear(); ProcessUtils.killAllBackgroundProcesses(); } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index 5e4b73b40e..b449c1c00a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -13,7 +13,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.Process; import android.text.TextUtils; -import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.widget.FrameLayout; @@ -22,12 +21,13 @@ import androidx.annotation.Nullable; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.debug.DebugConfig; +import com.mogo.commons.module.intent.IMogoIntentListener; +import com.mogo.commons.module.intent.IntentManager; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider; import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager; import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver; @@ -36,8 +36,6 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.ToastUtils; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.service.intent.IMogoIntentListener; import com.rousetime.android_startup.model.CostTimesModel; import com.zhjt.service.chain.ChainLog; import com.zhjt.service.chain.TracingConstants; @@ -48,7 +46,6 @@ import org.greenrobot.eventbus.ThreadMode; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.Timer; @@ -71,7 +68,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis private BluetoothMonitorReceiver mBluetoothReceiver = null; private BluetoothAdapter mBluetoothAdapter; -// private List mAreadlyConnectedList = new ArrayList<>();//已连接设备集合 + // private List mAreadlyConnectedList = new ArrayList<>();//已连接设备集合 private int numberA = 0; private boolean isLongPressA = false; private int numberB = 0; @@ -121,7 +118,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis @Override protected void onStart() { super.onStart(); - getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this); + IntentManager.getInstance().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this); // 添加换肤监听 CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this); //ActivityLifecycleManager.getInstance().setAppActive(true); @@ -136,7 +133,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis @Override protected void onStop() { super.onStop(); - getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this); + IntentManager.getInstance().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this); //ActivityLifecycleManager.getInstance().setAppActive(false); } @@ -379,7 +376,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis /** * 查找蓝牙连接过的蓝牙设备 - * */ private void showBondedDevice(BluetoothAdapter bluetoothAdapter) { // mAreadlyConnectedList.clear(); diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index f99afd3f39..c52fb3a23d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -16,7 +16,6 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; -import com.mogo.eagle.core.function.notice.PushUIConstants; import com.mogo.eagle.core.function.overview.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; @@ -136,7 +135,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { MogoModulePaths.addModuleFunction(new MogoModule("/och/api", "IMoGoFunctionProvider")); MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder")); - MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY)); + //todo emArrow 此处业务调用放置map module MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY)); // MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME)); // OBU 模块 @@ -153,8 +152,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_MODULE, "V2XProvider")); // 自动驾驶系统检测模块 MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider")); - // 推送模块 - MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI")); // 绑定车辆 MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_BINDING_CAR, "IMoGoBindingcarProvider")); diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainPresenter.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainPresenter.java index 4880a355a2..c679dcc4e2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainPresenter.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainPresenter.java @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.main; import android.Manifest; import android.app.Activity; -import android.content.Intent; import android.content.pm.PackageManager; import android.os.Handler; import android.os.Looper; @@ -43,7 +42,6 @@ public class MainPresenter extends Presenter { public MainPresenter(MainView view) { super(view); - SchemeIntent.getInstance().init(getContext(), mView.getApis()); } @Override @@ -109,7 +107,4 @@ public class MainPresenter extends Presenter { mMsgHandler.sendMessage(msg); } - public void handleSchemeIntent(Intent intent, boolean isOnNewIntent) { - SchemeIntent.getInstance().handle(intent, isOnNewIntent); - } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java deleted file mode 100644 index cddf2eae4d..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.mogo.eagle.core.function.main; - -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.text.TextUtils; - -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.eagle.core.utilcode.util.CommonUtils; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.service.IMogoServiceApis; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.StatusDescriptor; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author congtaowang - * @since 2020-04-20 - *

- * scheme 意图处理 - *

- * 导航:adb shell am start -d "mogo://launcher/main/switch2?type=navi'&'lon=116.327007'&'lat=39.977639" - */ -public class SchemeIntent implements IMogoStatusChangedListener { - - private static final String TAG = "SchemeIntent"; - - public static final String TYPE_NAVI = "navi"; - - public static final String TYPE_SEARCH_ROAD_CONDITION = "search-road-condition"; - - public static final String TYPE_LAUNCH = "launch"; - - public static final String TYPE_SHOW_ONLINE_CAR_PANEL = "showOnlineCarPanel"; - - public static final String TYPE_SHOW_SHARE_PANEL = "showSharePanel"; - public static final String TYPE_SHOW_HISTORY_PANEL = "showHistoryPanel"; - public static final String TYPE_SHOW_SURROUNDING_PANEL = "showSurroundingPanel"; - - private IMogoServiceApis mApis; - private Context mContext; - - private IntentWrapper mNextIntent; - - private static class IntentWrapper { - public Intent mIntent; - public long mDelay; - - public IntentWrapper(Intent intent, long delay) { - this.mIntent = intent; - this.mDelay = delay; - } - } - - private static volatile SchemeIntent sInstance; - - private SchemeIntent() { - } - - public static SchemeIntent getInstance() { - if (sInstance == null) { - synchronized (SchemeIntent.class) { - if (sInstance == null) { - sInstance = new SchemeIntent(); - } - } - } - return sInstance; - } - - public synchronized void release() { - sInstance = null; - } - - public void init(Context context, IMogoServiceApis apis) { - mContext = context; - mApis = apis; - mApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this); - } - - public void clear() { - mApis.getStatusManagerApi().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this); - mContext = null; - mApis = null; - - } - - /** - * 处理scheme - * - * @param intent 跳转的intent - * @param isOnNewIntent 根据这个参数判断是从onCreate过来还是从onNewIntent过来,从而可以在{@link #isDelay(Intent, boolean)}里面确定延时逻辑,如果是从onNewIntent过来是不需要延时的 - */ - public void handle(Intent intent, boolean isOnNewIntent) { - if (intent == null || intent.getData() == null) { - return; - } - Uri target = intent.getData(); - String path = target.getPath(); - if (path == null || path.isEmpty()) { - return; - } - - if (!mApis.getStatusManagerApi().isMainPageOnResume()) { - long delay = 0L; - if (isDelay(intent, isOnNewIntent)) { - delay = 5_000L; - } - mNextIntent = new IntentWrapper(intent, delay); - return; - } - - switch (path) { - case "/main/switch2": - handleSwitch2Action(target); - break; - case "/main/share": - CallerLogger.INSTANCE.d(M_HMI + TAG, "收到打开分享框的scheme,准备打开分享框"); -// Map properties = new HashMap<>(); -// properties.put("from", "1"); -// mApis.getAnalyticsApi().track("v2x_share_click", properties); -// mApis.getShareManager().showShareDialog(); - break; - default: - break; - } - - - mNextIntent = null; - } - - private boolean isDelay(Intent intent, boolean isOnNewIntent) { - if (isOnNewIntent || intent == null || intent.getData() == null) { - return false; - } - Uri target = intent.getData(); - String type = target.getQueryParameter("type"); - return TextUtils.equals(TYPE_NAVI, type) || TextUtils.equals(TYPE_SHOW_SHARE_PANEL, type); - } - - private void handleSwitch2Action(Uri target) { - String type = target.getQueryParameter("type"); - if (TextUtils.isEmpty(type)) { - return; - } - CallerLogger.INSTANCE.d(M_HMI + TAG, "语音打开事件面板" + type); - switch (type) { - case TYPE_LAUNCH: - handleLaunchIntent(target); - break; - case TYPE_SHOW_HISTORY_PANEL: - handleShowEventPanel(0); - break; - case TYPE_SHOW_SURROUNDING_PANEL: - handleShowEventPanel(1); - break; - case TYPE_SHOW_SHARE_PANEL: - handleShowEventPanel(2); - break; - default: - break; - - } - } - - private void handleLaunchIntent(Uri uri) { - String type = uri.getQueryParameter("channelType"); - Map properties = new HashMap<>(); - properties.put("appname", CommonUtils.getAppName(mContext)); - properties.put("appversion", CommonUtils.getVersionName(mContext)); - properties.put("from", type); - mApis.getAnalyticsApi().track("appenterfront", properties); - } - - /** - * 语音打开事件面板 - */ - private void handleShowEventPanel(int item) { - CallerLogger.INSTANCE.d(M_HMI + TAG, "语音打开事件面板" + item); - //mApis.getEventPanelManager().showPanelWithSelectedItem(item); - } - - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) { - if (mNextIntent == null) { - return; - } - if (isTrue) { - // 保证回到桌面后在开始该规划路线。 - UiThreadHandler.postDelayed(() -> { - if (mNextIntent == null) { - return; - } - handle(mNextIntent.mIntent, false); - }, mNextIntent.mDelay); - } - } - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/utils/DisplayEffectsManager.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/utils/DisplayEffectsManager.java deleted file mode 100644 index d69b60df8c..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/utils/DisplayEffectsManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.eagle.core.function.main.utils; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.v2x.DisplayEffectsInterface; - -/** - * created by wujifei on 2021/3/30 15:45 - * describe: - */ -@Route(path = MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER) -public class DisplayEffectsManager implements DisplayEffectsInterface { - private Context context; - - @Override - public void init(Context context) { - this.context = context; - } - - @Override - public void displayEffects(String type) { - DisplayEffectsHelper.getInstance().display(); - } - -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml index ebd16a8339..70660fcd9b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_check_with_accessory.xml @@ -79,7 +79,7 @@ app:layout_constraintTop_toBottomOf="@+id/module_push_dialog_acc_title" /> - - - * 调用 #mogo-module-service# 模块的样式打点 - */ -@Route( path = MogoServicePaths.PATH_MARKER_SERVICE ) -public class MogoMarkerServiceImpl implements IMogoMarkerService { - - private static final String TAG = "MogoMarkerServiceImpl"; - - @Nullable - @Override - public IMogoMarker drawMarker( Object object ) { - if ( object instanceof MarkerShowEntity ) { - return MapMarkerManager.getInstance().drawMapMarker( ( ( MarkerShowEntity ) object ), MarkerDrawer.MARKER_Z_INDEX_HIGH ); - } - return null; - } - - @Override - public void init( Context context ) { - - } - - @Override - public IMogoMapUIController getMapUIController() { - return MogoMapUIController.getInstance(); - } -} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/marker/MogoMarkerServiceImpl.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/marker/MogoMarkerServiceImpl.java new file mode 100644 index 0000000000..313b5e0e39 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/marker/MogoMarkerServiceImpl.java @@ -0,0 +1,41 @@ +package com.mogo.eagle.core.function.marker; + +import androidx.annotation.Nullable; + +import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.module.common.drawer.MarkerDrawer; +import com.mogo.module.common.entity.MarkerShowEntity; +import com.mogo.module.service.marker.MapMarkerManager; + + +public class MogoMarkerServiceImpl implements IMogoMarkerService { + + private static volatile MogoMarkerServiceImpl sInstance; + private static final byte[] obj = new byte[0]; + + private MogoMarkerServiceImpl() { + + } + + public static MogoMarkerServiceImpl getInstance() { + if (sInstance == null) { + synchronized (obj) { + if (sInstance == null) { + sInstance = new MogoMarkerServiceImpl(); + } + } + } + return sInstance; + } + + @Nullable + @Override + public IMogoMarker drawMarker(Object object) { + if (object instanceof MarkerShowEntity) { + return MapMarkerManager.getInstance().drawMapMarker(((MarkerShowEntity) object), MarkerDrawer.MARKER_Z_INDEX_HIGH); + } + return null; + } + +} diff --git a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/PushCameraLiveWindow.java b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/PushCameraLiveWindow.java index 85ac2756bd..1c49303741 100644 --- a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/PushCameraLiveWindow.java +++ b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/PushCameraLiveWindow.java @@ -12,11 +12,11 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import com.mogo.cloud.socket.entity.SocketDownData; +import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.live.impl.ICameraWindow; import com.mogo.eagle.core.function.monitoring.R; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.service.imageloader.MogoImageView; +import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView; /** @@ -72,7 +72,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo if (!TextUtils.isEmpty(entity.getRtmpUrl())) { CallerLogger.INSTANCE.w(M_MONITOR + TAG, "entity.getRtmpUrl() = " + entity.getRtmpUrl()); mIvReportHead.setVisibility(INVISIBLE); - MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(entity.getRtmpUrl(), + GlideImageLoader.getInstance().displayImage(entity.getRtmpUrl(), mIvReportHead); mLiveGSYVideoView.startLive(entity.getRtmpUrl()); } diff --git a/core/function-impl/mogo-core-function-monitoring/src/main/res/layout/camera_item_v2x_live_video.xml b/core/function-impl/mogo-core-function-monitoring/src/main/res/layout/camera_item_v2x_live_video.xml index 590f227fd4..288fd4b9ff 100644 --- a/core/function-impl/mogo-core-function-monitoring/src/main/res/layout/camera_item_v2x_live_video.xml +++ b/core/function-impl/mogo-core-function-monitoring/src/main/res/layout/camera_item_v2x_live_video.xml @@ -16,7 +16,7 @@ app:layout_constraintTop_toTopOf="parent" app:roundLayoutRadius="@dimen/dp_30" /> - PushRepository.Companion.init(context)); - } -} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/PushUIConstants.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/PushUIConstants.java deleted file mode 100644 index 1668aae7d1..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/PushUIConstants.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.mogo.eagle.core.function.notice; - -public class PushUIConstants { - public static final String NAME = "PUSH_UI"; - public static final String PATH = "/push/ui"; - public static final String Push_MESSAGE_ACTIVITY_PATH = "/push/ui/message"; //消息列表activity -} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/adapter/PushMessageAdapter.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/adapter/PushMessageAdapter.kt deleted file mode 100644 index a097fe9fb3..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/adapter/PushMessageAdapter.kt +++ /dev/null @@ -1,125 +0,0 @@ -package com.mogo.eagle.core.function.notice.adapter - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.function.notice.R -import com.mogo.eagle.core.function.notice.model.PushBean -import com.mogo.eagle.core.function.notice.utils.dealSchema -import com.mogo.eagle.core.function.notice.utils.stringConverterBitmap -import com.mogo.eagle.core.function.notice.view.getApis -import com.mogo.service.imageloader.MogoImageView -import kotlin.math.abs - -class PushMessageAdapter : RecyclerView.Adapter() { - interface PushAdapterListener { - fun deleteBean(bean: PushBean, action: Boolean) - - fun lastItemShow(show: Boolean) - } - - var onAttachStateChangeListener = object : View.OnAttachStateChangeListener { - override fun onViewDetachedFromWindow(p0: View?) { - deletePushBean.lastItemShow(false) - } - - override fun onViewAttachedToWindow(p0: View?) { - deletePushBean.lastItemShow(true) - } - - } - - lateinit var deletePushBean: PushAdapterListener - - var datas: MutableList? = null - set(value) { - field = value - notifyDataSetChanged() - } - - fun removeItem(bean: PushBean) { - datas?.let { - val position = it.indexOf(bean) - if (position >= 0) { - it.removeAt(position) - notifyDataSetChanged() - } - if (itemCount == 0) { - deletePushBean.lastItemShow(false) - } - } - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MessageViewHolder { - return MessageViewHolder( - LayoutInflater.from(parent.context).inflate( - R.layout.module_push_message_item, - null - ) - ) - } - - override fun getItemCount(): Int { - return datas?.size ?: 0 - } - - override fun onBindViewHolder(holder: MessageViewHolder, position: Int) { - holder.setPushBean(datas!![position], position) - } - - - inner class MessageViewHolder(view: View) : RecyclerView.ViewHolder(view) { - private val pushAppIcon: MogoImageView = view.findViewById(R.id.module_push_item_app_icon) - private val pushTitle: TextView = view.findViewById(R.id.module_push_item_title) - private val pushContent: TextView = view.findViewById(R.id.module_push_item_content) - private val pushImage: MogoImageView = view.findViewById(R.id.module_push_item_image) - private val pushTimer: TextView = view.findViewById(R.id.module_push_item_time) - private val pushDelete: TextView = view.findViewById(R.id.module_push_item_delete) - private val pushClick: View = view.findViewById(R.id.module_push_item_click) - - fun setPushBean(bean: PushBean, position: Int) { - if (position == (datas?.size ?: 0) - 1) { - itemView.addOnAttachStateChangeListener(onAttachStateChangeListener) - } else { - itemView.removeOnAttachStateChangeListener(onAttachStateChangeListener) - } - pushDelete.setOnClickListener { - deletePushBean.deleteBean(bean, false) - } - if (bean.mainSchema.isNotEmpty()) { - pushClick.setOnClickListener { - dealSchema(bean.mainSchema, itemView.context) - deletePushBean.deleteBean(bean, true) - } - } else { - pushClick.setOnClickListener(null) - } -// getApis(itemView.context).imageLoaderApi.displayImage(bean.appIcon, pushAppIcon) - pushTitle.text = bean.title - pushContent.text = bean.content - pushContent.visibility = if (bean.content.isEmpty()) View.GONE else View.VISIBLE - if (bean.QRCode.isEmpty() && bean.imageUrl.isNotEmpty()) { - getApis(itemView.context).imageLoaderApi.displayImage(bean.imageUrl, pushImage) - } - if (bean.QRCode.isNotEmpty()) { - pushImage.setImageBitmap( - stringConverterBitmap( - bean.QRCode, - pushImage.context.resources.getDimensionPixelSize(R.dimen.module_push_message_item_image_size), - pushImage.context.resources.getDimensionPixelSize(R.dimen.module_push_message_item_image_size) - ) - ) - } - val diff = abs((System.currentTimeMillis() - bean.timestamp) / 1000).toInt() - pushTimer.text = when { - diff == 0 -> "现在" - diff < 60 -> "${diff}秒前" - diff < 60 * 60 -> "${diff / 60}分钟前" - diff < 60 * 60 * 24 -> "${diff / 60 / 60}小时前" - else -> "${diff / 60 / 60 / 24}天前" - } - } - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryFragment.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryFragment.java deleted file mode 100644 index 2055f76e42..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryFragment.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.mogo.eagle.core.function.notice.fragment; - -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.mvp.MvpFragment; -import com.mogo.eagle.core.function.notice.R; -import com.mogo.eagle.core.function.notice.adapter.PushMessageAdapter; -import com.mogo.eagle.core.function.notice.model.PushBean; -import com.mogo.eagle.core.function.notice.repository.PushRepository; -import com.mogo.eagle.core.function.notice.utils.AnimatorUtilsKt; -import com.mogo.eagle.core.function.notice.utils.HandlerUtils; -import com.mogo.eagle.core.function.notice.view.PushItemAnimator; -import com.mogo.eagle.core.function.notice.view.SwipeItemLayout; -import com.mogo.eagle.core.function.notice.viewmodel.MessageViewModel; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.module.common.view.OnPreventFastClickListener; - -import org.jetbrains.annotations.NotNull; - -/** - * @author congtaowang - * @since 2020/9/1 - * - * 描述 - */ -public class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHistoryPresenter > implements MessageHistoryView { - - private static final String TAG = "MessageHistoryFragment"; - - private View mClear; - private RecyclerView mHistoryList; - private TextView mTitle; - private View mEmptyPlaceHolder; - private View mClose; - - private boolean mClearing = false; - private PushMessageAdapter mAdapter = new PushMessageAdapter(); - private MessageViewModel mViewModel; - - @Override - protected int getLayoutId() { - return R.layout.module_push_message_hisotry_fragment; - } - - @Override - public String getTagName() { - return TAG; - } - - @Override - protected void initViews() { - mClear = findViewById( R.id.module_push_id_clear ); - mHistoryList = findViewById( R.id.module_push_id_recycler_view ); - mTitle = findViewById( R.id.module_push_id_title ); - mEmptyPlaceHolder = findViewById( R.id.module_push_id_not_data ); - mClose = findViewById( R.id.module_push_id_close ); - - mClose.setOnClickListener( new OnPreventFastClickListener() { - @Override - public void onClickImpl( View v ) { - exitSelf(); - } - } ); - mClear.setOnClickListener( new OnPreventFastClickListener() { - @Override - public void onClickImpl( View v ) { - if ( !mClearing ) { - mClearing = true; - AnimatorUtilsKt.startClearAnimator( - mHistoryList, - () -> { - mViewModel.deleteAll(); - mClearing = false; - } - ); - } - } - } ); - mAdapter.deletePushBean = new PushMessageAdapter.PushAdapterListener() { - @Override - public void deleteBean( @NotNull PushBean bean, boolean action ) { - if ( mClearing ) { - return; - } - mViewModel.delete( bean ); - if ( action ) { - exitSelf(); - } else { - mAdapter.removeItem( bean ); - if ( mAdapter.getItemCount() == 0 ) { - mEmptyPlaceHolder.setVisibility( View.VISIBLE ); - } - updateHistoryMessageCount(); - } - } - - @Override - public void lastItemShow( boolean show ) { - if ( !show && !mClearing ) { - if ( mViewModel.getList() != null ) { - int size = mViewModel.getList().size(); - if ( size > 0 && size < mHistoryList.getChildCount() ) { - return; - } - } - } - mClear.setVisibility( show ? View.VISIBLE : View.GONE ); - } - }; - mViewModel = new MessageViewModel( list -> { - UiThreadHandler.post( () -> { - int size = list == null ? 0 : list.size(); - mAdapter.setDatas( list ); - mEmptyPlaceHolder.setVisibility( size > 0 ? View.GONE : View.VISIBLE ); - updateHistoryMessageCount(); - } ); - } ); - - mHistoryList.setLayoutManager( new LinearLayoutManager( AbsMogoApplication.getApp() ) ); - mHistoryList.setAdapter( mAdapter ); - mHistoryList.setItemAnimator( new PushItemAnimator() ); - mHistoryList.addOnItemTouchListener( new SwipeItemLayout.OnSwipeItemTouchListener( getContext() ) ); - - mRootView.setOnClickListener( view -> { - } ); - } - - private void exitSelf() { - try { - getActivity().getSupportFragmentManager().beginTransaction() - .remove( this ) - .commitNowAllowingStateLoss(); - } catch ( Exception e ) { - e.printStackTrace(); - } - } - - private void updateHistoryMessageCount() { - HandlerUtils.INSTANCE.getMBgHandler().post( () -> { - int count = 0; - try { - count = PushRepository.Companion.getPushRepository().getPushBeanDao().getAllCount(); - } catch ( Exception e ) { - count = 0; - } - renderHistoryMessageCount( count ); - } ); - } - - private void renderHistoryMessageCount( int count ) { - UiThreadHandler.post( () -> { - try { - mTitle.setText( count > 0 ? "历史消息(" + count + ")" : "历史消息" ); - } catch ( Exception e ) { - e.printStackTrace(); - } - } ); - } - - @Override - public void onResume() { - super.onResume(); - } - - @NonNull - @Override - protected MessageHistoryPresenter createPresenter() { - return new MessageHistoryPresenter( this ); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - } -} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryPresenter.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryPresenter.java deleted file mode 100644 index a957d2eb12..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryPresenter.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.eagle.core.function.notice.fragment; - - -import com.mogo.commons.mvp.Presenter; - -public -/** - * @author congtaowang - * @since 2020/9/1 - * - * 描述 - */ -class MessageHistoryPresenter extends Presenter< MessageHistoryView > { - - public MessageHistoryPresenter( MessageHistoryView view ) { - super( view ); - } -} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryView.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryView.java deleted file mode 100644 index a4f66d8d23..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/fragment/MessageHistoryView.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.eagle.core.function.notice.fragment; - -import com.mogo.commons.mvp.IView; - -public -/** - * @author congtaowang - * @since 2020/9/1 - * - * 描述 - */ -interface MessageHistoryView extends IView { -} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/repository/PushRepository.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/repository/PushRepository.kt deleted file mode 100644 index 7100ee5146..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/repository/PushRepository.kt +++ /dev/null @@ -1,190 +0,0 @@ -package com.mogo.eagle.core.function.notice.repository - -import android.content.Context -import android.os.Handler -import android.os.Looper -import androidx.room.Room -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_NOTICE -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.function.notice.PushUIConstants -import com.mogo.eagle.core.function.notice.dao.PushBeanDatabase -import com.mogo.eagle.core.function.notice.model.PushBean -import com.mogo.eagle.core.function.notice.utils.HandlerUtils -import com.mogo.eagle.core.function.notice.view.getApis -import com.mogo.eagle.core.function.notice.viewmodel.PushViewModel -import com.mogo.map.MogoLocationClient -import com.mogo.service.statusmanager.IMogoStatusChangedListener -import com.mogo.service.statusmanager.StatusDescriptor -import java.util.* -import kotlin.collections.HashSet - -class PushRepository(mContext: Context) { - - companion object { - private const val TAG: String = "PushRepository" - private lateinit var appContext: Context - - fun init(context: Context) { - appContext = context.applicationContext - pushRepository - } - - val globalContext: Context by lazy { - appContext - } - - val pushRepository: PushRepository by lazy { - PushRepository(appContext) - } - } - - // 被中断的push消息仅再次展示一次 - private val singleRePushSet = HashSet() - - private val pushViewModel: PushViewModel = PushViewModel(mContext, this) - private val pushBeanQueue: Queue = LinkedList() - private val statusManager = getApis(mContext).statusManagerApi - val pushBeanDao by lazy { - Room.databaseBuilder(appContext, PushBeanDatabase::class.java, "database_push").build() - .pushBeanDao() - } - private val locationClient = - MogoLocationClient.getInstance(appContext) - - private val mHandler = Handler(Looper.getMainLooper()) - - private val statusChangedListener: IMogoStatusChangedListener = - IMogoStatusChangedListener { sd, open -> - CallerLogger.d("$M_NOTICE$TAG", "sd = $sd , open = $open") - } - - init { - HandlerUtils.mBgHandler.postDelayed({ - updateMsgNum() - }, 5000) - } - - private fun updateMsgNum() { - val num = pushBeanDao.getAllCount() - if (num > 100) { //历史消息最多保留100条 - pushBeanDao.deleteMin() - updateMsgNum() - return - } - - } - - private fun startIterate() { - CallerLogger.d("$M_NOTICE$TAG", "startIterate : ${pushViewModel.pushBean}") - if (!pushViewModel.isAddWindow()) { - val bean = pushBeanQueue.peek() - if (bean != null) { - if (needDelay(bean)) { - mHandler.removeCallbacks(delayRunnable) - mHandler.postDelayed(delayRunnable, 15000) - return - } - } else { - return - } - mHandler.post { - iterateNext() - } - } - } - - /** - * 缓存被中断的push消息 - */ - fun push(pushBean: PushBean) { - if (singleRePushSet.contains(pushBean)) { - return - } - CallerLogger.d("$M_NOTICE$TAG", "保存待下一次开启") - singleRePushSet.add(pushBean) - pushBeanQueue.offer(pushBean) - } - - private var delayRunnable = { - startIterate() - } - - private fun needDelay(bean: PushBean): Boolean { - if (locationClient.lastKnowLocation != null) { - if (bean.speedLimit > 0 && bean.speedLimit <= locationClient.lastKnowLocation.speed * 18 / 5) { - CallerLogger.d( - "$M_NOTICE$TAG", - "speedLimit : " + locationClient.lastKnowLocation.speed - ) - return true - } - } - if (statusManager.isV2XShow) { - return true - } - if (statusManager.isVoiceShow) { - return true - } - return false - } - - fun iterateNext(needSave: Boolean = false) { - try { - val nextBean = pushBeanQueue.peek() - if (nextBean == null) { - pushViewModel.pushBean = nextBean - return - } - if (needDelay(nextBean)) { - mHandler.removeCallbacksAndMessages(null) - mHandler.postDelayed({ - iterateNext(needSave) - }, 15000) - return - } - pushViewModel.pushBean = pushBeanQueue.poll() - } catch (e: Exception) { - CallerLogger.e("$M_NOTICE$TAG", "$e") - } - if (pushViewModel.pushBean != null) { - statusManager.registerStatusChangedListener( - PushUIConstants.PATH, - StatusDescriptor.V2X_UI, - statusChangedListener - ) - statusManager.registerStatusChangedListener( - PushUIConstants.PATH, - StatusDescriptor.VOICE_UI, - statusChangedListener - ) - } else { - statusManager.unregisterStatusChangedListener( - PushUIConstants.PATH, - StatusDescriptor.VOICE_UI, - statusChangedListener - ) - statusManager.unregisterStatusChangedListener( - PushUIConstants.PATH, - StatusDescriptor.V2X_UI, - statusChangedListener - ) - } - } - - fun delete(bean: PushBean) { - HandlerUtils.mBgHandler.post { - pushBeanDao.delete(bean) - updateMsgNum() - } - } - - fun deleteAll() { - HandlerUtils.mBgHandler.post { - pushBeanDao.deleteAll() - } - } - - fun getAll(): MutableList { - return pushBeanDao.getAll() - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnalyticsUtils.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnalyticsUtils.kt deleted file mode 100644 index 5c3025829a..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnalyticsUtils.kt +++ /dev/null @@ -1,24 +0,0 @@ -@file:Suppress("DEPRECATION") - -package com.mogo.eagle.core.function.notice.utils - -import android.util.ArrayMap -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.eagle.core.function.notice.repository.PushRepository -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.analytics.IMogoAnalytics - -object AnalyticsUtils { - private val Analytics = - ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(PushRepository.globalContext) as IMogoAnalytics - - fun track(event: String, vararg keyValue: String) { - val map = ArrayMap() - if (keyValue.isNotEmpty()) { - for (i in 0..keyValue.size - 2 step 2) { - map[keyValue[i]] = keyValue[i + 1] - } - } - Analytics.track(event, map) - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/HandlerUtils.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/HandlerUtils.kt deleted file mode 100644 index 6ccb309b27..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/HandlerUtils.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.eagle.core.function.notice.utils - -import android.os.Handler -import android.os.HandlerThread - -object HandlerUtils { - private val handlerThread = HandlerThread("push_ui_thread") - val mBgHandler: Handler - - init { - handlerThread.start() - mBgHandler = Handler(handlerThread.looper) - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/FloatView.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/FloatView.kt deleted file mode 100644 index 25fe5aa092..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/FloatView.kt +++ /dev/null @@ -1,494 +0,0 @@ -package com.mogo.eagle.core.function.notice.view - -import android.content.Context -import android.os.Handler -import android.os.Looper -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.Scroller -import android.widget.TextView -import androidx.annotation.LayoutRes -import com.mogo.commons.context.ContextHolderUtil -import com.mogo.eagle.core.function.notice.Config -import com.mogo.eagle.core.function.notice.R -import com.mogo.eagle.core.function.notice.model.PushBean -import com.mogo.eagle.core.function.notice.utils.AnalyticsUtils -import com.mogo.eagle.core.function.notice.utils.stringConverterBitmap -import com.mogo.eagle.core.function.notice.view.roundimage.RoundedImageView -import com.mogo.eagle.core.function.notice.viewmodel.PushViewModel -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp -import com.mogo.eagle.core.utilcode.util.ThreadPoolService -import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import com.mogo.service.windowview.IMogoTopViewManager -import com.mogo.service.windowview.IMogoTopViewStatusListener - -class FloatView constructor( - private val pushViewModel: PushViewModel, - private val context: Context -) { - - companion object { - const val TYPE_TOP_VIEW = 1 - const val TYPE_WINDOW_MANAGER = 2 - const val TAG: String = "FloatView.kt" - } - - interface PushViewController { - fun show(bean: PushBean?) - fun hide() - fun inflateView(@LayoutRes layoutId: Int) - } - - abstract inner class PushView(context: Context) : FrameLayout(context), - PushViewController { - private lateinit var titleIconContainer: View - private lateinit var pushTitle: TextView - private lateinit var pushImage: RoundedImageView - private lateinit var pushContent: TextView - private lateinit var pushCheck: TextView - - private var pushData: PushBean? = null - - override fun inflateView(layoutId: Int) { - LayoutInflater.from(context).inflate(layoutId, this, true) - pushTitle = findViewById(R.id.module_push_title) - pushCheck = findViewById(R.id.module_push_check) - pushImage = findViewById(R.id.module_push_image) - pushContent = findViewById(R.id.module_push_content) - titleIconContainer = findViewById(R.id.module_push_app_icon_title) - setOnClickListener { - pushViewModel.dealCmd(PushViewModel.VOICE_ACTION_PUSH_MAIN, "1") - turnNextMessage() - } - pushCheck.setOnClickListener { - pushData?.let { - if (pushCheckDialog == null) { - pushCheckDialog = PushCheckDialog(ContextHolderUtil.getContext()) - } - pushCheckDialog!!.showCheckDialog(it.title, it.content) - } - } - } - - private fun turnNextMessage() { - pushViewModel.pushBean?.apply { - showTimeout = 0 - updateTimer() - } - } - - open fun setBean(bean: PushBean) { - pushData = bean - // title - pushTitle.text = bean.title - - // image - if (bean.imageUrl.isEmpty() && bean.QRCode.isEmpty()) { - pushImage.gone() - } else if (bean.imageUrl.isNotEmpty()) { - val params = pushImage.layoutParams - params.width = getImgWidth() - params.height = getImgHeight() - pushImage.layoutParams = params - pushImage.visible() - GlideApp.with(this).load(bean.imageUrl).into(pushImage) - } else if (bean.QRCode.isNotEmpty()) { - val params = pushImage.layoutParams - params.width = getQrImgWidth() - params.height = getQrImgHeight() - pushImage.layoutParams = params - ThreadPoolService.execute { - val bmp = stringConverterBitmap( - bean.QRCode, - getQrImgWidth(), - getQrImgHeight() - ) - UiThreadHandler.post { - pushImage.setImageBitmap(bmp) - pushImage.visible() - } - } - } - - // content - if (bean.content.isEmpty()) { - pushContent.gone() - } else { - pushContent.text = bean.content - pushContent.visible() - } - - // 产品侧需要重新梳理,tts暂时不播报 -// if (bean.tts.isNotEmpty()) { -// AIAssist.getInstance(context).speakTTSVoice(bean.tts) -// } - } - - abstract fun getImgWidth(): Int - abstract fun getImgHeight(): Int - abstract fun getQrImgWidth(): Int - abstract fun getQrImgHeight(): Int - - override fun show(bean: PushBean?) { - isAddWindow = true - uiHandler.removeCallbacks(delayClosePush) - } - - override fun hide() { - isAddWindow = false - } - } - - open inner class PushViewInTopView(context: Context) : PushView(context) { - - private val mTopViewManager: IMogoTopViewManager = getApis(context).topViewManager - - init { - inflateView(R.layout.module_push_item) - } - - private var topViewStatusListener = object : IMogoTopViewStatusListener { - override fun onViewRemoved(view: View?) { - isAddWindow = false - if (pushViewModel.pushBean?.showTimeout ?: 0 > 0) { - if (getApis(context).statusManagerApi.isV2XShow) { - // 被中断的消息,需要再次被显示一次 - uiHandler.removeCallbacks(delayClosePush) - pushViewModel.push() - pushViewModel.pushMessageFinish() - return - } - } - pushViewModel.pushBean?.showTimeout = 0 - updateTimer() - } - - override fun onViewAdded(view: View?) { - if (pushViewModel.pushBean != null) { - startClosePush() - } - } - - override fun beforeViewRemoveAnim(view: View?) { - } - - override fun beforeViewAddAnim(view: View?) { - } - } - - override fun show(bean: PushBean?) { - super.show(bean) - mLastVisibleType = TYPE_TOP_VIEW - mTopViewManager.addView(this, topViewStatusListener) - setBean(bean!!) - } - - override fun hide() { - super.hide() - mTopViewManager.removeView(this) - } - - override fun getImgWidth(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width) - - override fun getImgHeight(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height) - - override fun getQrImgWidth(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height) - - override fun getQrImgHeight(): Int = - context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height) - } - -// inner class PushViewInWindowView(context: Context) : PushView(context), View.OnTouchListener { -// -// private val mContentContainer: View -// private val mWindowManager = -// context.getSystemService(Context.WINDOW_SERVICE) as WindowManager -// -// private val params = WindowManager.LayoutParams() -// -// init { -// -// @Suppress("DEPRECATION") -// params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT -// params.flags = (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN -// or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION -// or WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE -// or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH -// or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) -// params.width = WindowManager.LayoutParams.WRAP_CONTENT -// params.height = WindowManager.LayoutParams.WRAP_CONTENT -// params.gravity = Gravity.START or Gravity.BOTTOM -// params.format = PixelFormat.TRANSLUCENT -// params.x = context.resources.getDimensionPixelSize(R.dimen.module_push_window_x) -// params.y = context.resources.getDimensionPixelSize(R.dimen.module_push_window_x) -// if (Build.VERSION.SDK_INT > 25) { -// params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY -// } -// -// inflateView(R.layout.module_push_item_vertical) -// mContentContainer = findViewById(R.id.module_push_content_container) -// setOnTouchListener(this) -// } -// -// override fun show(bean: PushBean?) { -// super.show(bean) -// mLastVisibleType = TYPE_WINDOW_MANAGER -// setBean(bean!!) -// -// try { -// mWindowManager.addView(this, params) -// } catch (e: Exception) { -// mWindowManager.updateViewLayout(this, params) -// } -// translationXAnimation( -// -ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical), -// 0f -// ) { -// if (pushViewModel.pushBean != null) { -// startClosePush() -// } -// } -// } -// -// private fun translationXAnimation( -// from: Float, -// to: Float, -// doOnEnd: (animator: Animator) -> Unit -// ) { -// val transitionXAnimator: ObjectAnimator = -// ObjectAnimator.ofFloat( -// this, -// View.TRANSLATION_X, -// from, -// to -// ) -// transitionXAnimator.duration = 200 -// transitionXAnimator.doOnEnd(doOnEnd) -// transitionXAnimator.start() -// } -// -// override fun hide() { -// super.hide() -// translationXAnimation( -// this.x, -// -ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical) -// ) { -// this.x = 0f -// mWindowManager.removeViewImmediate(this) -// } -// } -// -// override fun onTouch(v: View?, ev: MotionEvent?): Boolean { -// -// if (mLastVisibleType != TYPE_WINDOW_MANAGER) { -// return false -// } -// when (ev?.action) { -// MotionEvent.ACTION_DOWN -> { -// needInterceptClick = false -// startX = ev.x -// } -// MotionEvent.ACTION_MOVE -> { -// moveX = startX - ev.x -// scrollBy(moveX.toInt(), 0) -// startX = ev.x -// if (scrollX < 0) { -// scrollTo(0, 0) -// } -// if (!needInterceptClick && scrollX > 20) { -// needInterceptClick = true -// } -// invalidate() -// } -// MotionEvent.ACTION_UP -> { -// if (scrollX > 0) { -// mScroller.startScroll(scrollX, 0, width - scrollX, 0) -// invalidate() -// return true -// } -// if (needInterceptClick) { -// return true -// } -// } -// else -> { -// startX = 0f -// moveX = 0f -// } -// } -// return false -// } -// -// override fun computeScroll() { -// if (mScroller.computeScrollOffset()) { -// scrollTo(mScroller.currX, mScroller.currY) -// invalidate() -// } else { -// if (mScroller.currX == 0) { -// return -// } -// mScroller.finalX = 0 -// removeCallbacks(delayClosePush) -// if (isAddWindow) { -// if (currentBean != null) { -// AnalyticsUtils.track(Config.NEWS_CARD_SWIPE, "trigger_type", "1") -// } -// mWindowManager.removeView(this) -// isAddWindow = false -// } -// pushViewModel.pushBean?.showTimeout = 0 -// updateTimer() -// } -// } -// -// override fun getImgWidth(): Int = -// context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width_vertical) -// -// override fun getImgHeight(): Int = -// context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height_vertical) -// -// override fun getQrImgWidth(): Int = -// context.resources.getDimensionPixelSize(R.dimen.module_push_image_qr_size_vertical) -// -// override fun getQrImgHeight(): Int = -// context.resources.getDimensionPixelSize(R.dimen.module_push_image_qr_size_vertical) -// } - - private var pushCheckDialog: PushCheckDialog? = null - private val delayClosePush: Runnable - private var isAddWindow = false - private val uiHandler = Handler(Looper.getMainLooper()) - - private var startX = 0f - private var moveX = 0f - private val mScroller: Scroller = Scroller(context) - private var needInterceptClick = false - private var pause = false - - private var currentBean: PushBean? = null - - - private var mLastVisibleType = -1 - private var pushViewController: PushViewController? = null - - init { - delayClosePush = Runnable { - updateTimer() - } - } - - fun pushBeanChanged(bean: PushBean?) { - uiHandler.post { - uiHandler.removeCallbacks(delayClosePush) - if (bean == null) { - if (currentBean != null) { - AnalyticsUtils.track(Config.NEWS_CARD_DISAPPEAR, "title", currentBean!!.title) - } - hide() - } else { - show(bean) - AnalyticsUtils.track(Config.NEWS_CARD_SHOW, "title", bean.title) - } - currentBean = bean - } - } - - private fun updateTimer() { - uiHandler.removeCallbacks(delayClosePush) - val time = pushViewModel.pushBean?.showTimeout ?: 0 - if (time > 0) { - pushViewModel.pushBean!!.showTimeout-- - uiHandler.postDelayed(delayClosePush, 1000) - } else { - pushViewModel.pushMessageFinish(true) - } - } - - private fun show(bean: PushBean) { - if (isAddWindow) { - if (getApis(context).statusManagerApi.isMainPageOnResume) { - if (mLastVisibleType != TYPE_TOP_VIEW) { - hide() - (pushViewController as View).postDelayed({ - show(bean) - }, 750L) - } else { - showByTopView(bean) - } - } else { - if (mLastVisibleType != TYPE_WINDOW_MANAGER) { - hide() - (pushViewController as View).postDelayed({ - show(bean) - }, 750L) - } else { - showByWindowManager(bean) - } - } - startClosePush() - } else { - if (getApis(context).statusManagerApi.isMainPageOnResume) { - showByTopView(bean) - } else { - showByWindowManager(bean) - } - } - } - - private fun showByTopView(bean: PushBean) { - if (pushViewController !is PushViewInTopView) { - pushViewController = PushViewInTopView(context) - } - pushViewController?.show(bean) - } - - private fun showByWindowManager(bean: PushBean?) { -// if (pushViewController !is PushViewInWindowView) { -// pushViewController = PushViewInWindowView(context) -// } -// pushViewController?.show(bean) - } - - private fun startClosePush() { - uiHandler.removeCallbacks(delayClosePush) - uiHandler.postDelayed( - delayClosePush, - 1000L - ) - } - - - fun hide() { - if (!isAddWindow) { - return - } - try { - pushViewController?.hide() - } catch (e: Exception) { - e.printStackTrace() - } - } - - - fun pauseTimer(on: Boolean) { - if (on) { - uiHandler.removeCallbacks(delayClosePush) - } else { - updateTimer() - uiHandler.post { - if (on) { - pause = true - uiHandler.removeCallbacks(delayClosePush) - } else if (pause) { - pause = false - updateTimer() - } - } - } - } - - fun isAddWindow(): Boolean = isAddWindow -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/PushCheckDialog.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/PushCheckDialog.kt deleted file mode 100644 index 4dad7cfbda..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/PushCheckDialog.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.mogo.eagle.core.function.notice.view - -import android.content.Context -import android.widget.ImageView -import android.widget.TextView -import com.mogo.eagle.core.function.notice.R -import com.mogo.module.common.dialog.BaseFloatDialog - -class PushCheckDialog(context: Context) : BaseFloatDialog(context) { - - private var pushCheckClose: ImageView? = null - private var pushCheckTitle: TextView? = null - private var pushCheckContent: TextView? = null - - init { - setContentView(R.layout.module_push_dialog_check) - setCanceledOnTouchOutside(true) - pushCheckClose = findViewById(R.id.module_push_dialog_close) - pushCheckTitle = findViewById(R.id.module_push_dialog_title) - pushCheckContent = findViewById(R.id.module_push_dialog_content) - pushCheckClose?.setOnClickListener { - dismiss() - } - } - - fun showCheckDialog(title: String, content: String) { - if (isShowing) { - return - } - if (title.isBlank() || content.isBlank()) { - return - } - pushCheckTitle?.text = title - pushCheckContent?.text = content - show() - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/viewmodel/MessageViewModel.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/viewmodel/MessageViewModel.kt deleted file mode 100644 index fee24db6bc..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/viewmodel/MessageViewModel.kt +++ /dev/null @@ -1,33 +0,0 @@ -package com.mogo.eagle.core.function.notice.viewmodel - -import com.mogo.eagle.core.function.notice.model.PushBean -import com.mogo.eagle.core.function.notice.repository.PushRepository -import com.mogo.eagle.core.function.notice.utils.HandlerUtils - -class MessageViewModel(private val messageViewModel: MessageListChange) { - - var list: MutableList? = null - set(value) { - field = value - messageViewModel.messageListChange(value) - } - - init { - HandlerUtils.mBgHandler.post { - list = PushRepository.pushRepository.getAll() - } - } - - interface MessageListChange { - fun messageListChange(list: MutableList?) - } - - fun delete(bean: PushBean) { - PushRepository.pushRepository.delete(bean) - } - - fun deleteAll() { - list = null - PushRepository.pushRepository.deleteAll() - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/viewmodel/PushViewModel.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/viewmodel/PushViewModel.kt deleted file mode 100644 index 8d880b21cf..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/viewmodel/PushViewModel.kt +++ /dev/null @@ -1,188 +0,0 @@ -package com.mogo.eagle.core.function.notice.viewmodel - -import android.content.Context -import android.text.TextUtils -import com.mogo.commons.voice.AIAssist -import com.mogo.commons.voice.IMogoVoiceCmdCallBack -import com.mogo.eagle.core.function.notice.Config -import com.mogo.eagle.core.function.notice.model.PushBean -import com.mogo.eagle.core.function.notice.repository.PushRepository -import com.mogo.eagle.core.function.notice.utils.AnalyticsUtils -import com.mogo.eagle.core.function.notice.utils.dealSchema -import com.mogo.eagle.core.function.notice.view.FloatView - -class PushViewModel( - private val mContext: Context, - private val pushRepository: PushRepository -) { - companion object { - const val VOICE_ACTION_PUSH_MAIN = "VOICE_ACTION_PUSH_MAIN" - const val VOICE_ACTION_PUSH_LEFT = "VOICE_ACTION_PUSH_LEFT" - const val VOICE_ACTION_PUSH_RIGHT = "VOICE_ACTION_PUSH_RIGHT" - const val VOICE_ACTION_PUSH_CANCEL = "VOICE_ACTION_PUSH_CANCEL" - } - - var floatView: FloatView? = null - - private var mVoiceClient: AIAssist = AIAssist.getInstance(mContext) - - private val voiceCmdCallback = object : IMogoVoiceCmdCallBack { - override fun onSpeakEnd(speakText: String?) { - } - - override fun onCmdSelected(cmd: String?) { - if (!cmd.isNullOrEmpty()) { - dealCmd(cmd) - } - } - - override fun onCmdAction(speakText: String?) { - } - - override fun onCmdCancel(speakText: String?) { - } - - override fun onSpeakSelectTimeOut(speakText: String?) { - } - } - - fun dealCmd(cmd: String, isClick: String = "2") { - if (TextUtils.isEmpty(cmd)) { - return - } - pushBean?.let { - when (cmd) { - VOICE_ACTION_PUSH_MAIN -> { - AnalyticsUtils.track(Config.NEWS_CARD_CLICK, "trigger_type", isClick) - if (isClick == "2") { - mVoiceClient.speakTTSVoiceWithLevel("好的",AIAssist.LEVEL1, voiceCmdCallback) - } - if (it.mainSchema.isNotEmpty()) { - dealSchema(it.mainSchema, mContext) - } - } - VOICE_ACTION_PUSH_LEFT -> { - if (it.buttons.isNullOrEmpty()) { - return - } - AnalyticsUtils.track( - Config.NEWS_CARD_CLICK_BTN, - "trigger_type", - isClick, "btn_text", it.buttons[0].text - ) - if (isClick == "2") { - mVoiceClient.speakTTSVoiceWithLevel("好的", AIAssist.LEVEL1,voiceCmdCallback) - } - if (it.buttons[0].action.isNotEmpty()) { - dealSchema(it.buttons[0].action, mContext) - } - } - VOICE_ACTION_PUSH_RIGHT -> { - if (it.buttons.isNullOrEmpty()) { - return - } - AnalyticsUtils.track( - Config.NEWS_CARD_CLICK_BTN, - "trigger_type", - isClick, "btn_text", it.buttons[1].text - ) - if (isClick == "2") { - mVoiceClient.speakTTSVoiceWithLevel("好的",AIAssist.LEVEL1 ,voiceCmdCallback) - } - if (it.buttons[1].action.isNotEmpty()) { - dealSchema(it.buttons[1].action, mContext) - } - } - VOICE_ACTION_PUSH_CANCEL -> { - AnalyticsUtils.track( - Config.NEWS_CARD_SWIPE, - "trigger_type", - isClick - ) - if (isClick == "2") { - mVoiceClient.speakTTSVoiceWithLevel("好的",AIAssist.LEVEL1, voiceCmdCallback) - } - } - } - } - } - - var pushBean: PushBean? = null - set(value) { - field = value - if (value == null) { - floatView?.hide() - floatView = null - return - } - field?.showTimeoutShadow = field?.showTimeout?:0 - if (value.imageUrl.isBlank()) { - value.imageUrl = "" - } - if (floatView == null) { - floatView = FloatView(this, mContext) - } - floatView?.pushBeanChanged(field) - registerVoiceCMD() - } - - fun pushMessageFinish(needSave: Boolean = false) { - pushRepository.iterateNext(needSave) - } - - private fun registerVoiceCMD() { - mVoiceClient.unregisterUnWakeupCommand(VOICE_ACTION_PUSH_CANCEL) - mVoiceClient.unregisterUnWakeupCommand(VOICE_ACTION_PUSH_MAIN) - mVoiceClient.unregisterUnWakeupCommand(VOICE_ACTION_PUSH_LEFT) - mVoiceClient.unregisterUnWakeupCommand(VOICE_ACTION_PUSH_RIGHT) - - if (pushBean != null && !pushBean!!.cancelVoiceCmd.isNullOrEmpty()) { - mVoiceClient.registerUnWakeupCommand( - VOICE_ACTION_PUSH_CANCEL, - pushBean!!.cancelVoiceCmd!!.toTypedArray(), - voiceCmdCallback - ) - } else { - mVoiceClient.registerUnWakeupCommand( - VOICE_ACTION_PUSH_CANCEL, - arrayOf("忽略", "取消", "算了", "不要", "不要了", "不看了", "关闭"), - voiceCmdCallback - ) - } - - if (pushBean != null && !pushBean!!.mainVoiceCmd.isNullOrEmpty()) { - mVoiceClient.registerUnWakeupCommand( - VOICE_ACTION_PUSH_MAIN, - pushBean!!.mainVoiceCmd!!.toTypedArray(), - voiceCmdCallback - ) - } - - pushBean?.buttons?.forEach { - it.voiceCmd?.apply { - mVoiceClient.registerUnWakeupCommand( - VOICE_ACTION_PUSH_RIGHT, - toTypedArray(), - voiceCmdCallback - ) - } - } - } - - fun speakDefault(voice: String) { - mVoiceClient.speakTTSVoiceWithLevel(voice,AIAssist.LEVEL3 ,voiceCmdCallback) - } - - fun pauseAnimator(on: Boolean) { - floatView?.pauseTimer(on) - } - - fun isAddWindow(): Boolean = floatView?.isAddWindow() ?: false - - fun push() { - pushBean?.apply { - showTimeout = showTimeoutShadow - pushRepository.push(this) - } - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_clear_bg.xml b/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_clear_bg.xml deleted file mode 100644 index cb38368310..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_clear_bg.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_left_button.xml b/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_left_button.xml deleted file mode 100644 index c17bfd5f97..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_left_button.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_recycler_item_background.xml b/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_recycler_item_background.xml deleted file mode 100644 index 2c16e3f684..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_recycler_item_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_right_button.xml b/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_right_button.xml deleted file mode 100644 index 3f828dcc61..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/drawable/module_push_right_button.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_dialog_check.xml b/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_dialog_check.xml deleted file mode 100644 index 8b13014fe8..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_dialog_check.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item.xml b/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item.xml deleted file mode 100644 index f6375db0f6..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item_origin.xml b/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item_origin.xml deleted file mode 100644 index 3b2d2dc278..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item_origin.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item_vertical.xml b/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item_vertical.xml deleted file mode 100644 index d7829a2fb7..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_item_vertical.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_message_hisotry_fragment.xml b/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_message_hisotry_fragment.xml deleted file mode 100644 index 15f8e2974e..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_message_hisotry_fragment.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_message_item.xml b/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_message_item.xml deleted file mode 100644 index a01bc6197c..0000000000 --- a/core/function-impl/mogo-core-function-notice/src/main/res/layout/module_push_message_item.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt index baa2036d14..9413369c04 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -849,21 +849,21 @@ class MogoPrivateObuManager private constructor() { } //前车急刹预警 EventTypeEnum.TYPE_USECASE_ID_EBW.poiType -> { - EventTypeHelper.getEBW(appId){ alert ,tts -> + EventTypeHelper.getEBW(appId){ alert, tts -> alertContent = alert ttsContent = tts } } //前向碰撞预警 EventTypeEnum.TYPE_USECASE_ID_FCW.poiType -> { - EventTypeHelper.getFCW(appId){ alert ,tts -> + EventTypeHelper.getFCW(appId){ alert, tts -> alertContent = alert ttsContent = tts } } //逆向超车预警 EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType -> { - EventTypeHelper.getDNPW(appId){ alert ,tts -> + EventTypeHelper.getDNPW(appId){ alert, tts -> alertContent = alert ttsContent = tts } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index ad0cabba5e..a1b4af8528 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -8,6 +8,8 @@ import androidx.core.util.Pair import androidx.localbroadcastmanager.content.* import com.mogo.cloud.commons.utils.* import com.mogo.cloud.passport.* +import com.mogo.module.common.enums.EventTypeEnum +import com.mogo.module.common.enums.EventTypeHelper import com.mogo.commons.network.* import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD_SHOW @@ -34,7 +36,6 @@ import com.mogo.eagle.core.function.v2x.events.receiver.* import com.mogo.eagle.core.function.v2x.events.scenario.impl.* import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.* import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker.Marker -import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.* import com.mogo.eagle.core.function.v2x.events.utils.* import com.mogo.eagle.core.function.v2x.events.utils.MapUtils import com.mogo.eagle.core.function.v2x.events.voice.* @@ -51,7 +52,6 @@ import com.mogo.module.common.* import com.mogo.module.common.drawer.* import com.mogo.module.common.entity.* import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum -import com.mogo.module.common.enums.* import com.mogo.service.statusmanager.* import com.mogo.service.statusmanager.StatusDescriptor.ACC_STATUS import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt index 7739068c3b..f439d2bee5 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt @@ -62,8 +62,6 @@ internal object BridgeApi { fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi - fun analytics() = apis?.analyticsApi - fun v2xMarker() = v2xMarker fun v2xPolyline() = v2xPolyline @@ -80,12 +78,4 @@ internal object BridgeApi { fun registerCenter() = apis?.registerCenterApi - fun imageLoader() = apis?.imageLoaderApi - - fun windowManager() = apis?.windowManagerApi - - fun displayEffects() = apis?.displayEffectsManager - - fun intentManager() = apis?.intentManagerApi - } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java index 563998de73..d7f8338c31 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java @@ -3,18 +3,10 @@ package com.mogo.eagle.core.function.v2x.events.manager; import android.content.Context; import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes; -import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.module.common.entity.MarkerCardResult; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerNoveltyInfo; -import com.mogo.module.common.entity.MarkerOnlineCar; -import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.v2x.data.V2XMarkerCardResult; -import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; /** @@ -43,23 +35,6 @@ public interface IMoGoV2XMarkerManager extends IProvider { */ void analysisV2XRoadEvent(V2XMarkerCardResult markerCardResult); - - /** - * 展开气泡 - * - * @param context - * @param currentMarker - */ - IMogoMarker openMarker(Context context, IMogoMarker currentMarker); - - /** - * 关闭气泡 - * - * @param context - * @param currentMarker - */ - void closeMarker(Context context, IMogoMarker currentMarker); - /** * 绘制正在预警的道路事件的POI点 * diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java index 25f438b6da..5540705d79 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java @@ -4,15 +4,14 @@ import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_EVENT_ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import android.content.Context; -import android.graphics.Bitmap; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; @@ -21,21 +20,16 @@ import com.mogo.eagle.core.function.v2x.events.marker.V2XMarkerAdapter; import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt; import com.mogo.eagle.core.function.v2x.events.utils.MapUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.eagle.core.utilcode.util.ViewUtils; 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.marker.MogoMarkerOptions; -import com.mogo.module.common.drawer.MarkerDrawer; -import com.mogo.module.common.drawer.marker.IMarkerView; -import com.mogo.module.common.drawer.marker.MapMarkerAdapter; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.common.utils.CarSeries; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.Utils; import com.mogo.service.statusmanager.IMogoStatusManager; @@ -45,6 +39,7 @@ import com.mogo.v2x.data.V2XMarkerExploreWay; import com.mogo.v2x.data.V2XMarkerLocation; import java.util.List; +import java.util.Objects; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; @@ -127,7 +122,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { // 探路目前只有上报拥堵 String poi = markerExploreWay.getPoiType(); v2XRoadEventEntity.setPoiType(poi); - v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay,markerCardResult.getExtras())); + v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay, markerCardResult.getExtras())); v2XRoadEventEntity.setExpireTime(20000); mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity); } @@ -139,67 +134,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { } } - - @Override - public IMogoMarker openMarker(Context context, IMogoMarker currentMarker) { - try { - if (currentMarker != null) { - Object object = currentMarker.getObject(); - if (object != null) { - // 修改数据 - MarkerShowEntity showEntity = (MarkerShowEntity) object; - showEntity.setChecked(true); - - // 获取数据对应的View - IMarkerView markerView = MapMarkerAdapter.getMarkerView(context, - showEntity, - currentMarker.getMogoMarkerOptions()); - - Bitmap bitmap; - if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_USER_DATA) - || showEntity.getMarkerType().equals(V2XConst.V2X_MARKER_SPECIAL_CAR)) { - bitmap = V2XMarkerAdapter.getV2XCarMarkerView(context, showEntity); - } else { - bitmap = ViewUtils.fromView(markerView.getView()); - } - - currentMarker.setIcon(bitmap); - currentMarker.setToTop(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return currentMarker; - } - - @Override - public void closeMarker(Context context, IMogoMarker currentMarker) { - try { - if (currentMarker != null) { - Object object = currentMarker.getObject(); - if (object != null) { - MarkerShowEntity showEntity = (MarkerShowEntity) object; - showEntity.setChecked(false); - IMarkerView markerView = MapMarkerAdapter.getMarkerView(context, - showEntity, - currentMarker.getMogoMarkerOptions()); - - Bitmap bitmap; - if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_USER_DATA) - || showEntity.getMarkerType().equals(V2XConst.V2X_MARKER_SPECIAL_CAR)) { - bitmap = V2XMarkerAdapter.getV2XCarMarkerView(context, showEntity); - } else { - bitmap = ViewUtils.fromView(markerView.getView()); - } - currentMarker.setIcon(bitmap); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - @Override public void drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener) { try { @@ -225,20 +159,15 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { markerShowEntity.setMarkerLocation(markerExploreWay.getLocation()); markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_NOVELTY); - // 由于性能问题,D车机不使用事件扩散动画 - if (!CarSeries.isF8xxSeries()) { - optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity)); - } else { - optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity)); - optionsRipple.period(1); - } + optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity)); + optionsRipple.period(1); boolean isVrMode = false; IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); if (statusManager != null) { isVrMode = statusManager.isVrMode(); } if (isVrMode) { - mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener); + mAlarmInfoMarker = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).drawMarker(markerShowEntity); } else { optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity)); IMogoMarkerManager marker = MogoMarkerManager.getInstance(context); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java index 451f7a4285..d5785ed71b 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java @@ -3,23 +3,11 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl; import android.content.Context; import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; -import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; -import com.mogo.map.MogoOverlayManager; -import com.mogo.map.overlay.IMogoOverlayManager; import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.overlay.MogoPolylineOptions; import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.service.statusmanager.IMogoStatusManager; - -import java.util.ArrayList; -import java.util.List; /** * author : donghongyu diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java index 3c8ae23d36..6c9fccb975 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java @@ -4,7 +4,6 @@ import android.content.Context; import android.graphics.Bitmap; import com.mogo.eagle.core.function.v2x.R; -import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.common.enums.EventTypeEnum; @@ -27,7 +26,7 @@ public class V2XMarkerAdapter { } /** - * 返回道路事件静态的图,因为D车机性能不行,会卡顿 + * 返回道路事件静态的图,因为车机性能不行,会卡顿 */ public static Bitmap getV2XRoadEventViewPng(Context context, V2XRoadEventEntity alarmInfo) { Bitmap bitmap; @@ -156,17 +155,4 @@ public class V2XMarkerAdapter { return icons; } - /** - * 获取模拟点 - * - * @param context 上下文 - * @return MarkerView - */ - public static Bitmap getV2XCarMarkerView(Context context, MarkerShowEntity showEntity) { - if (showEntity.isChecked()) { - return new V2XMarkerCarInfoView(context, showEntity).getView(); - } else { - return new V2XMarkerCarView(context, showEntity).getView(); - } - } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarInfoView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarInfoView.kt deleted file mode 100644 index aa3c0ac469..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarInfoView.kt +++ /dev/null @@ -1,144 +0,0 @@ -package com.mogo.eagle.core.function.v2x.events.marker - -import android.content.Context -import android.graphics.Bitmap -import android.text.TextUtils -import android.view.LayoutInflater -import android.view.View -import androidx.constraintlayout.widget.ConstraintLayout -import com.mogo.eagle.core.function.v2x.R -import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes.V2XMarkerEntity -import com.mogo.eagle.core.utilcode.util.ViewUtils -import com.mogo.module.common.entity.MarkerOnlineCar -import com.mogo.module.common.entity.MarkerShowEntity -import kotlinx.android.synthetic.main.view_marker_car.view.* -import kotlinx.android.synthetic.main.view_marker_car_info.view.* -import kotlinx.android.synthetic.main.view_marker_car_info.view.ivCar - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-0619:55 - * desc : 绘制在线车辆,特殊车辆 - * version: 1.0 - */ -class V2XMarkerCarInfoView(context: Context, showEntity: MarkerShowEntity) : - ConstraintLayout(context) { - - init { - initView(context, showEntity) - } - - private fun initView(context: Context, showEntity: MarkerShowEntity) { - val bindObj: Any = showEntity.bindObj - if (bindObj is MarkerOnlineCar) { - //1 老司机 2 安全驾驶 3 危险驾驶 4 可直播车辆 - when (bindObj.userInfo.safeLabelType) { - // 可直播车机 - 4 -> { - LayoutInflater.from(context) - .inflate(R.layout.view_marker_car, this) - ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_live_vedio) - } - else -> { - LayoutInflater.from(context) - .inflate(R.layout.view_marker_car_info, this) - } - } - } - if (bindObj is V2XMarkerEntity) { - LayoutInflater.from(context) - .inflate(R.layout.view_marker_car, this) - } - updateUI(showEntity) - } - - fun updateUI(showEntity: MarkerShowEntity) { - ivCar.rotation = showEntity.markerLocation.angle.toFloat() -// ivCar.rotation = 90f - - tvUserMarker.text = if (TextUtils.isEmpty(showEntity.textContent)) { - "" - } else { - showEntity.textContent - } - - val bindObj: Any = showEntity.bindObj - if (bindObj is MarkerOnlineCar) { - tvMarkerContent.text = - if (bindObj.userInfo == null && TextUtils.isEmpty(bindObj.userInfo.userName)) { - "蘑菇车主" - } else { - bindObj.userInfo.userName - } - - //车辆类型,0-普通车辆,1-警车,2-救护车,3-道路救援车辆', - when (bindObj.carInfo.vehicleType) { - // 普通车 - 0 -> { - clMarkerContent.visibility = View.VISIBLE - ivReverseTriangle.visibility = View.VISIBLE - ivCar.setImageResource(R.drawable.icon_car_gray) - } - // 警车 - 1 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_police) - } - // 救护车 - 2 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_ambulance) - } - // 道路救援车辆 - 3 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) - } - else -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_gray) - } - } - } - if (bindObj is V2XMarkerEntity) { - when (bindObj.targetId) { - 10001 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_gray) - } - 10002 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_ambulance) - } - 10003 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_police) - } - //失控车 - 10004 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) - } - // 故障车 - 20007 -> { - clMarkerContent.visibility = View.GONE - ivReverseTriangle.visibility = View.GONE - ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) - } - } - } - } - - fun getView(): Bitmap { - return ViewUtils.fromView(this) - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarView.kt deleted file mode 100644 index fb0ab56d62..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarView.kt +++ /dev/null @@ -1,114 +0,0 @@ -package com.mogo.eagle.core.function.v2x.events.marker - -import android.content.Context -import android.graphics.Bitmap -import android.view.LayoutInflater -import android.view.View -import androidx.constraintlayout.widget.ConstraintLayout -import com.mogo.eagle.core.function.v2x.R -import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes.V2XMarkerEntity -import com.mogo.eagle.core.utilcode.util.ViewUtils -import com.mogo.module.common.entity.MarkerOnlineCar -import com.mogo.module.common.entity.MarkerShowEntity -import kotlinx.android.synthetic.main.view_marker_car.view.* - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-0619:55 - * desc : 绘制在线车辆,特殊车辆 - * version: 1.0 - */ -class V2XMarkerCarView(context: Context, showEntity: MarkerShowEntity) : - ConstraintLayout(context) { - - init { - initView(context, showEntity) - } - - private fun initView(context: Context, showEntity: MarkerShowEntity) { - LayoutInflater.from(context) - .inflate(R.layout.view_marker_car, this) - updateUI(showEntity) - } - - fun updateUI(showEntity: MarkerShowEntity) { - ivCar.rotation = showEntity.markerLocation.angle.toFloat() - - val bindObj: Any = showEntity.bindObj - if (bindObj is MarkerOnlineCar) { - //1 老司机 2 安全驾驶 3 危险驾驶 4 可直播车辆 - when (bindObj.userInfo.safeLabelType) { - 1 -> { - ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_blue) - } - 2 -> { - ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_green) - } - 3 -> { - ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_red) - } - 4 -> { - ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_live_vedio) - } - } - - //车辆类型,0-普通车辆,1-警车,2-救护车,3-道路救援车辆', - when (bindObj.carInfo.vehicleType) { - // 普通车 - 0 -> { - ivMarkerTip.visibility = View.VISIBLE - ivCar.setImageResource(R.drawable.icon_car_gray) - } - // 警车 - 1 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_police) - } - // 救护车 - 2 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_ambulance) - } - // 道路救援车辆 - 3 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) - } - else -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_gray) - } - } - } - if (bindObj is V2XMarkerEntity) { - when (bindObj.targetId) { - 10001 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_gray) - } - 10002 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_ambulance) - } - 10003 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.icon_car_police) - } - 10004 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) - } - // 故障车 - 20007 -> { - ivMarkerTip.visibility = View.GONE - ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) - } - } - } - } - - fun getView(): Bitmap { - return ViewUtils.fromView(this) - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java index f992e577d8..e7a220dace 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; import androidx.core.util.Pair; -import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 9b6d11fc98..affddf3c20 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -2,11 +2,11 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; +import com.mogo.commons.analytics.AnalyticsUtils; import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager; -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; @@ -17,8 +17,6 @@ import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.service.v2x.DisplayEffectsInterface; import java.util.HashMap; import java.util.Map; @@ -73,26 +71,24 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp getV2XMessageEntity().getContent().getTts(false); } showWindow(); - IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); - if (analytics != null) { - String poiType = getV2XMessageEntity().getContent().getPoiType(); - String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat()); - String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon()); - String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId(); - String style = "1"; - Map properties = new HashMap<>(); - properties.put("dbid", infoId); - properties.put("type", poiType); - properties.put("lng", lon); - properties.put("lat", lat); - properties.put("style", style); - analytics.track(V2XConst.V2X_ROAD_SHOW, properties); - } + String poiType = getV2XMessageEntity().getContent().getPoiType(); + String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat()); + String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon()); + String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId(); + String style = "1"; + Map properties = new HashMap<>(); + properties.put("dbid", infoId); + properties.put("type", poiType); + properties.put("lng", lon); + properties.put("lat", lat); + properties.put("style", style); + AnalyticsUtils.track(V2XConst.V2X_ROAD_SHOW, properties); } } catch (Exception e) { e.printStackTrace(); } } + private void showWindow() { V2XMessageEntity entity = getV2XMessageEntity(); V2XRoadEventEntity content = entity != null ? entity.getContent() : null; @@ -131,12 +127,11 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp if (entity.isNeedAddLine()) { drawPOI(); } - DisplayEffectsInterface wu = BridgeApi.INSTANCE.displayEffects(); V2XRoadEventEntity content = entity.getContent(); - if (wu != null && content != null) { + if (content != null) { MarkerExploreWay noveltyInfo = content.getNoveltyInfo(); if (noveltyInfo != null && EventTypeEnum.FOURS_FOG.getPoiType().equals(content.getNoveltyInfo().getPoiType())) { - wu.displayEffects(EventTypeEnum.FOURS_FOG.getPoiType()); + CallerHmiManager.INSTANCE.displayEffects(); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt index e92c8eacae..09ec0fb754 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt @@ -5,11 +5,7 @@ import android.graphics.Rect import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi import com.mogo.eagle.core.utilcode.util.WindowUtils -import com.mogo.module.common.MogoApisHandler -import com.mogo.module.common.utils.CarSeries -import java.lang.Exception class MapUtils { @@ -22,34 +18,18 @@ class MapUtils { return } val mBoundRect = Rect() - val paddingTop: Int - val paddingBottom: Int - val paddingRight: Int - val paddingLeft: Int - if (CarSeries.isF8xxSeries()) { - paddingTop = WindowUtils.dip2px(context, 250f) - paddingBottom = WindowUtils.dip2px(context, 100f) - paddingRight = WindowUtils.dip2px(context, 100f) - paddingLeft = WindowUtils.dip2px(context, 475f) - } else { - paddingTop = WindowUtils.dip2px(context, 370f) - paddingBottom = WindowUtils.dip2px(context, 100f) - paddingRight = WindowUtils.dip2px(context, 100f) - paddingLeft = WindowUtils.dip2px(context, 575f) - } - mBoundRect.bottom = paddingBottom - mBoundRect.top = paddingTop - mBoundRect.left = paddingLeft - mBoundRect.right = paddingRight + mBoundRect.bottom = WindowUtils.dip2px(context, 100f) + mBoundRect.top = WindowUtils.dip2px(context, 370f) + mBoundRect.left = WindowUtils.dip2px(context, 575f) + mBoundRect.right = WindowUtils.dip2px(context, 100f) // 当前车辆位置 val carLocation = MogoLatLng( CallerAutoPilotStatusListenerManager.getCurWgs84Lat(), CallerAutoPilotStatusListenerManager.getCurWgs84Lon() ) // 调整自适应的地图镜头 - carLocation?.let { - CallerMapUIServiceManager.getMapUIController()?.showBounds("MapUtils", it, listOf(latLng), mBoundRect, true) - } + CallerMapUIServiceManager.getMapUIController() + ?.showBounds("MapUtils", carLocation, listOf(latLng), mBoundRect, true) } catch (e: Exception) { e.printStackTrace() } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java index 279fac491a..a1eec13954 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java @@ -1,9 +1,8 @@ package com.mogo.eagle.core.function.v2x.events.utils; -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.commons.analytics.AnalyticsUtils; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; -import com.mogo.service.analytics.IMogoAnalytics; import java.util.HashMap; import java.util.Map; @@ -15,17 +14,13 @@ public class TrackUtils { //埋点 public static void trackV2xRoadShow(String dbid, String type, String style) { try { - IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); - if (analytics == null) { - return; - } Map properties = new HashMap<>(); properties.put("dbid", dbid); properties.put("type", type); properties.put("lng", V2XStatusManager.getInstance().getLocation().getLongitude()); properties.put("lat", V2XStatusManager.getInstance().getLocation().getLatitude()); properties.put("style", style); - analytics.track(V2XConst.V2X_ROAD_SHOW, properties); + AnalyticsUtils.track(V2XConst.V2X_ROAD_SHOW, properties); } catch (Exception e) { e.printStackTrace(); } @@ -34,15 +29,11 @@ public class TrackUtils { //道路事件操作埋点 v2x_road_event public static void trackV2xRoadEvent(String dbid, String sn, String type) { try { - IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); - if (analytics == null) { - return; - } Map properties = new HashMap<>(); properties.put("dbid", dbid); properties.put("sn", sn); properties.put("type", type); - analytics.track(V2XConst.V2X_ROAD_EVET, properties); + AnalyticsUtils.track(V2XConst.V2X_ROAD_EVET, properties); } catch (Exception e) { e.printStackTrace(); } @@ -54,13 +45,9 @@ public class TrackUtils { */ public static void trackV2xRoadProduceEvent(int type) { try { - IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); - if (analytics == null) { - return; - } Map properties = new HashMap<>(); properties.put("type", type); - analytics.track(V2XConst.V2X_ROAD_PRODUCE, properties); + AnalyticsUtils.track(V2XConst.V2X_ROAD_PRODUCE, properties); } catch (Exception e) { e.printStackTrace(); } @@ -68,13 +55,9 @@ public class TrackUtils { public static void trackV2XMarkerClick(int type) { try { - IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); - if (analytics == null) { - return; - } Map properties = new HashMap<>(); properties.put("type", type); - analytics.track(V2XConst.LAUNCHER_ICON_CLICK, properties); + AnalyticsUtils.track(V2XConst.LAUNCHER_ICON_CLICK, properties); } catch (Exception e) { e.printStackTrace(); } @@ -95,13 +78,9 @@ public class TrackUtils { */ public static void trackV2xHistoryEvent(int type) { try { - IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); - if (analytics == null) { - return; - } Map properties = new HashMap<>(); properties.put("type", type); - analytics.track(V2XConst.V2X_ROAD_EVET_HISTORY_BUTTON, properties); + AnalyticsUtils.track(V2XConst.V2X_ROAD_EVET_HISTORY_BUTTON, properties); } catch (Exception e) { e.printStackTrace(); } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceManager.kt index d065055f7c..577567cd72 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceManager.kt @@ -3,10 +3,10 @@ package com.mogo.eagle.core.function.v2x.events.voice import android.content.Context import android.content.Intent import android.text.TextUtils +import com.mogo.commons.module.intent.IMogoIntentListener +import com.mogo.commons.module.intent.IntentManager import com.mogo.commons.voice.AIAssist import com.mogo.commons.voice.IMogoVoiceCmdCallBack -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi -import com.mogo.service.intent.IMogoIntentListener import java.lang.ref.WeakReference import java.util.concurrent.ConcurrentHashMap @@ -51,7 +51,7 @@ object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoIntentListener { try { unRegisterWakeCmd(cmd) voiceCallbackMap[cmd] = callbackListener - BridgeApi.intentManager()?.registerIntentListener(cmd, this) + IntentManager.getInstance().registerIntentListener(cmd, this) } catch (e: Exception) { e.printStackTrace() } @@ -63,7 +63,7 @@ object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoIntentListener { fun unRegisterWakeCmd(cmd: String): V2XVoiceManager { try { voiceCallbackMap.remove(cmd) - BridgeApi.intentManager()?.unregisterIntentListener(cmd, this) + IntentManager.getInstance().unregisterIntentListener(cmd, this) } catch (e: Exception) { e.printStackTrace() } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index fa0c9d62ae..c4ac037c7d 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -4,21 +4,22 @@ import android.location.Location import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_GREEN import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.data.map.MogoLatLng +import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.trafficlight.* import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight +import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.utilcode.util.ThreadUtils -import com.mogo.map.navi.IMogoCarLocationChangedListener2 -import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.enums.EventTypeEnum import com.zhjt.service_biz.BizConfig import kotlin.math.abs @@ -28,7 +29,7 @@ import kotlin.math.min class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, - IMogoCarLocationChangedListener2 { + IMoGoMapLocationListener { private var vip: Boolean = false @@ -38,7 +39,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, // 是否已进入到路口(停止线处) private var isEnter = false - private var mLocation: Location? = null + private var mLocation: MogoLocation? = null companion object { @@ -53,7 +54,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, // 到路口100m时回调 CallerLogger.d("$M_V2X$TAG", "处理路口交通数据:是否是第一次处理:${isFirst}是否进入路口:${isEnter}") if (trafficLightResult.currentRoadIsRight()) { - CallerLogger.d("$M_V2X$TAG","当前道路右转,不处理") + CallerLogger.d("$M_V2X$TAG", "当前道路右转,不处理") return } if (isFirst && !isEnter) { @@ -79,7 +80,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, fun listenTrafficLight() { CallerTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this) CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) - MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener(TAG, this) + CallerMapLocationListenerManager.addListener(TAG, this, false) CallVipSetListenerManager.registerVipSetListener(TAG, this) } @@ -177,7 +178,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, for (i in 0..size step 2) { if (i < size) { // 自车到0-1、2-3、4-5、6-7组成的线段的最小距离 - minValue = min(minValue, LocationUtils.pointToLine(points[i].lon, points[i].lat, points[i+1].lon, points[i+1].lat, lon, lat)) + minValue = min( + minValue, + LocationUtils.pointToLine( + points[i].lon, + points[i].lat, + points[i + 1].lon, + points[i + 1].lat, + lon, + lat + ) + ) } } return if (minValue > 9999) 0f else minValue.toFloat() @@ -186,18 +197,26 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, /** * 闯红灯预警 */ - @BizConfig(V2I,"",BIZ_IVP) + @BizConfig(V2I, "", BIZ_IVP) private fun redLightWarning() { CallerLogger.d("$M_V2X$TAG", "=====闯红灯预警=====") ThreadUtils.runOnUiThread { - CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, EventTypeEnum.TYPE_USECASE_ID_IVP.content, EventTypeEnum.TYPE_USECASE_ID_IVP.tts, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, 5000L) + CallerHmiManager.showWarningV2X( + EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, + EventTypeEnum.TYPE_USECASE_ID_IVP.content, + EventTypeEnum.TYPE_USECASE_ID_IVP.tts, + EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, + null, + true, + 5000L + ) } } /** * 绿灯通行提示 */ - @BizConfig(V2I,"",BIZ_IVP_GREEN) + @BizConfig(V2I, "", BIZ_IVP_GREEN) private fun greenLightWarning(speed: String = "50") { CallerLogger.d("$M_V2X$TAG", "=====绿灯通行预警=====") ThreadUtils.runOnUiThread { @@ -209,7 +228,15 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) - CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, 5000L) + CallerHmiManager.showWarningV2X( + EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + content, + tts, + EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + null, + true, + 5000L + ) } } @@ -221,13 +248,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) CallVipSetListenerManager.unRegisterVipSetListener(TAG) CallerTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG) - MogoApisHandler.getInstance().apis.registerCenterApi.unregisterCarLocationChangedListener( - TAG, this - ) + CallerMapLocationListenerManager.removeListener(TAG,false) } - override fun onCarLocationChanged2(latLng: Location?) { - latLng?.let { + override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) { + location?.let { mLocation = it } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_talk.png deleted file mode 100644 index 3f90fd4af5..0000000000 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_talk.png and /dev/null differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png deleted file mode 100644 index 89680bd182..0000000000 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png and /dev/null differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_talk.png deleted file mode 100644 index 89680bd182..0000000000 Binary files a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_talk.png and /dev/null differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml deleted file mode 100644 index e71c897020..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml deleted file mode 100644 index eefd1be813..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml deleted file mode 100644 index 9320416f62..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml index a87f69c85b..2bc87bd48c 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml @@ -20,7 +20,7 @@ app:layout_constraintTop_toTopOf="parent" app:roundLayoutRadius="@dimen/dp_18"> - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/view_marker_car_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/view_marker_car_info.xml deleted file mode 100644 index a0444b91fc..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/view_marker_car_info.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/window_road_video_layout.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/window_road_video_layout.xml index 98bddcdc78..e841406bcb 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/window_road_video_layout.xml +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/window_road_video_layout.xml @@ -20,7 +20,7 @@ android:layout_alignParentBottom="true" android:clickable="true" /> - - dataType; // 要查询的类型 + private List carChat; + private List shareMusic; + private List noveltyInfo; + + private List onlineCar; + private List exploreWay; + private long messageTime; + + public List getCarChat() { + return carChat; + } + + public void setCarChat(List carChat) { + this.carChat = carChat; + } + + public List getExploreWay() { + return exploreWay; + } + + public void setExploreWay(List exploreWay) { + this.exploreWay = exploreWay; + } + + public List getOnlineCar() { + return onlineCar; + } + + public void setOnlineCar(List onlineCar) { + this.onlineCar = onlineCar; + } + + public List getShareMusic() { + return shareMusic; + } + + public void setShareMusic(List shareMusic) { + this.shareMusic = shareMusic; + } + + public List getNoveltyInfo() { + return noveltyInfo; + } + + public void setNoveltyInfo(List noveltyInfo) { + this.noveltyInfo = noveltyInfo; + } + + public List getDataType() { + return dataType; + } + + public void setDataType(List dataType) { + this.dataType = dataType; + } + + public long getMessageTime() { + return messageTime; + } + + public void setMessageTime(long messageTime) { + this.messageTime = messageTime; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerDynamicData.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerDynamicData.java new file mode 100644 index 0000000000..60ac614813 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerDynamicData.java @@ -0,0 +1,166 @@ + +package com.mogo.eagle.core.data.map.entity; + + +import android.text.TextUtils; + +import java.io.Serializable; + +@SuppressWarnings("unused") +public class MarkerDynamicData implements Serializable { + //QQ音乐,懒人听书,乐听头条 2 为书籍听书,3 为新闻,1 为qq音乐 + private int type; + private String mediaId;//qq音乐id,书的bookId + //qq音乐url 懒人听书为“” + private String mediaUrl; + //歌曲名 ,当前播放书名,新闻标题内容 + private String mediaName; + //演唱歌手,当前章节,新闻来源 + private String mediaSinger; + //歌曲封面,书籍封面,新闻预览图 + private String mediaImg; + //音乐类别,类似经典 ,流行只有qq特有 + private String mediaType; + private int maxTime;//音频总时长 + private String bookInfo;//懒人听书json串 + //当前播放时长,可以不加,播放进度单独独立出来 + private int curTime; + //是否是本地音频,只有qq音乐 + private boolean isLocalMedia;//本地 + //播放模式,顺序,单曲循环,随机 + private int mediaPlayMode; + //1 播放 2 缓冲 0 暂停/停止 -1 播放错误 + private int playState; + + public String getMediaId() { + return mediaId; + } + + public void setMediaId(String mediaId) { + this.mediaId = mediaId; + } + + public String getMediaUrl() { + return mediaUrl; + } + + public void setMediaUrl(String mediaUrl) { + this.mediaUrl = mediaUrl; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getPlayState() { + return playState; + } + + public void setPlayState(int playState) { + this.playState = playState; + } + + public String getMediaName() { + if (TextUtils.isEmpty(mediaName)) { + return ""; + } + return mediaName; + } + + public void setMediaName(String mediaName) { + this.mediaName = mediaName; + } + + public String getMediaSinger() { + if (TextUtils.isEmpty(mediaSinger)) { + return ""; + } + return mediaSinger; + } + + public void setMediaSinger(String mediaSinger) { + this.mediaSinger = mediaSinger; + } + + public String getMediaImg() { + return mediaImg; + } + + public void setMediaImg(String mediaImg) { + this.mediaImg = mediaImg; + } + + public long getMaxTime() { + return maxTime; + } + + public void setMaxTime(int maxTime) { + this.maxTime = maxTime; + } + + public long getCurTime() { + return curTime; + } + + public void setCurTime(int curTime) { + this.curTime = curTime; + } + + public String getMediaType() { + if (TextUtils.isEmpty(mediaType)) { + return ""; + } + return mediaType; + } + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + public boolean isLocalMedia() { + return isLocalMedia; + } + + public void setLocalMedia(boolean localMedia) { + isLocalMedia = localMedia; + } + + public int getMediaPlayMode() { + return mediaPlayMode; + } + + public void setMediaPlayMode(int mediaPlayMode) { + this.mediaPlayMode = mediaPlayMode; + } + + public String getBookInfo() { + return bookInfo; + } + + public void setBookInfo(String bookInfo) { + this.bookInfo = bookInfo; + } + + @Override + public String toString() { + return "MarkerDynamicData{" + + "type=" + type + + ", mediaId='" + mediaId + '\'' + + ", mediaUrl='" + mediaUrl + '\'' + + ", mediaName='" + mediaName + '\'' + + ", mediaSinger='" + mediaSinger + '\'' + + ", mediaImg='" + mediaImg + '\'' + + ", mediaType='" + mediaType + '\'' + + ", maxTime=" + maxTime + + ", bookInfo='" + bookInfo + '\'' + + ", curTime=" + curTime + + ", isLocalMedia=" + isLocalMedia + + ", mediaPlayMode=" + mediaPlayMode + + ", playState=" + playState + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerExploreWay.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerExploreWay.java new file mode 100644 index 0000000000..8516d97fcf --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerExploreWay.java @@ -0,0 +1,234 @@ + +package com.mogo.eagle.core.data.map.entity; + +import android.text.TextUtils; + + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@SuppressWarnings("unused") +public class MarkerExploreWay implements Serializable { + + private String infoId; + private String type;//卡片类型, + private String poiType; + private String sn; + private MarkerLocation location;//位置信息 + private int direction;//方位角度 + private boolean canLive;//是否可直播(1为可直播,0不可直播) + private int fileType;//是图片还是视频(1视频,0图片) + private String addr;//北京市朝阳区三里屯街道108号 + private long generateTime;//时间戳 + private String cityName;//:"城市名称", + private double distance;//距离 + private MarkerUserInfo userInfo;//用户信息 + private List items;//视频地址和图片地址 + //上报类型:1-用户上报,2-后台上报 3-三方上报 + private String uploadType; + + private boolean fabulous; + + // http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 + // 1 需要用户判断是否拥堵 进行UGC问答 + private int infoCheckNode; + + public Map extras = null; + + public String getAddr() { + if (TextUtils.isEmpty(addr)) { + return "未知道路"; + } + return addr; + } + + public void setAddr(String addr) { + this.addr = addr; + } + + public boolean getCanLive() { + return canLive; + } + + public void setCanLive(boolean canLive) { + this.canLive = canLive; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public float getDirection() { + return direction; + } + + public void setDirection(int direction) { + this.direction = direction; + } + + public double getDistance() { + return distance; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public double getFileType() { + return fileType; + } + + public void setFileType(int fileType) { + this.fileType = fileType; + } + + public Long getGenerateTime() { + return generateTime; + } + + public void setGenerateTime(Long generateTime) { + this.generateTime = generateTime; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public MarkerUserInfo getUserInfo() { + return userInfo; + } + + public void setUserInfo(MarkerUserInfo userInfo) { + this.userInfo = userInfo; + } + + public String getInfoId() { + return infoId; + } + + + public int getInfoIdInt() { + try { + return Integer.parseInt(infoId); + } catch (NumberFormatException e) { + e.printStackTrace(); + return -1; + } + } + + public void setInfoId(String infoId) { + this.infoId = infoId; + } + + public String getPoiType() { + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public String getUploadType() { + return uploadType; + } + + public void setUploadType(String uploadType) { + this.uploadType = uploadType; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MarkerExploreWay that = (MarkerExploreWay) o; + return Objects.equals(infoId, that.infoId) && + Objects.equals(type, that.type) && + Objects.equals(poiType, that.poiType); + } + + @Override + public int hashCode() { + return Objects.hash(infoId, type, poiType); + } + + public boolean isCanLive() { + return canLive; + } + + public void setGenerateTime(long generateTime) { + this.generateTime = generateTime; + } + + public int getInfoCheckNode() { + return infoCheckNode; + } + + public void setInfoCheckNode(int infoCheckNode) { + this.infoCheckNode = infoCheckNode; + } + + public boolean isFabulous() { + return fabulous; + } + + public void setFabulous(boolean fabulous) { + this.fabulous = fabulous; + } + + @Override + public String toString() { + return "MarkerExploreWay{" + + "infoId='" + infoId + '\'' + + ", type='" + type + '\'' + + ", poiType='" + poiType + '\'' + + ", sn='" + sn + '\'' + + ", location=" + location + + ", direction=" + direction + + ", canLive=" + canLive + + ", fileType=" + fileType + + ", addr='" + addr + '\'' + + ", generateTime=" + generateTime + + ", cityName='" + cityName + '\'' + + ", distance=" + distance + + ", userInfo=" + userInfo + + ", items=" + items + + ", uploadType='" + uploadType + '\'' + + ", fabulous=" + fabulous + + ", infoCheckNode=" + infoCheckNode + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerExploreWayItem.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerExploreWayItem.java new file mode 100644 index 0000000000..ada9e398a6 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerExploreWayItem.java @@ -0,0 +1,67 @@ + +package com.mogo.eagle.core.data.map.entity; + + +import android.text.TextUtils; + +import java.io.Serializable; + +/** + * 道路情报,V2X预警,地图道路事件POI,违章停车POI等 + */ +@SuppressWarnings("unused") +public class MarkerExploreWayItem implements Serializable { + + private String thumbnail; + private String url; + private String content; + private double illegalCount; + + public String getThumbnail() { + if (TextUtils.isEmpty(thumbnail)) { + return ""; + } + return thumbnail; + } + + public void setThumbnail(String thumbnail) { + this.thumbnail = thumbnail; + } + + public String getUrl() { + if (TextUtils.isEmpty(url)) { + return ""; + } + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public double getIllegalCount() { + return illegalCount; + } + + public void setIllegalCount(double illegalCount) { + this.illegalCount = illegalCount; + } + + @Override + public String toString() { + return "MarkerExploreWayItem{" + + "thumbnail='" + thumbnail + '\'' + + ", url='" + url + '\'' + + ", content='" + content + '\'' + + ", illegalCount='" + illegalCount + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerHobbyDatum.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerHobbyDatum.java new file mode 100644 index 0000000000..9f0a995afd --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerHobbyDatum.java @@ -0,0 +1,71 @@ +package com.mogo.eagle.core.data.map.entity; + +import java.io.Serializable; +import java.util.List; + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020-01-1615:12 + * desc : 爱好 + * version: 1.0 + */ +public class MarkerHobbyDatum implements Serializable { + private List singerTop2; // 最喜欢的两位歌手 + private List songTypeTop2; // 最喜欢的两种音乐类型 + private List newsType; // 最喜欢的资讯类型 + private List listenBookTop2; // 最喜欢听的两本书 + private List ifSociety; // 是否喜爱社交 + + + public List getSingerTop2() { + return singerTop2; + } + + public void setSingerTop2(List singerTop2) { + this.singerTop2 = singerTop2; + } + + public List getSongTypeTop2() { + return songTypeTop2; + } + + public void setSongTypeTop2(List songTypeTop2) { + this.songTypeTop2 = songTypeTop2; + } + + public List getNewsType() { + return newsType; + } + + public void setNewsType(List newsType) { + this.newsType = newsType; + } + + public List getListenBookTop2() { + return listenBookTop2; + } + + public void setListenBookTop2(List listenBookTop2) { + this.listenBookTop2 = listenBookTop2; + } + + public List getIfSociety() { + return ifSociety; + } + + public void setIfSociety(List ifSociety) { + this.ifSociety = ifSociety; + } + + @Override + public String toString() { + return "MarkerHobbyDatum{" + + "singerTop2=" + singerTop2 + + ", songTypeTop2=" + songTypeTop2 + + ", newsType=" + newsType + + ", listenBookTop2=" + listenBookTop2 + + ", ifSociety=" + ifSociety + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerLocation.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerLocation.java new file mode 100644 index 0000000000..385e92d337 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerLocation.java @@ -0,0 +1,61 @@ + +package com.mogo.eagle.core.data.map.entity; + + +import android.text.TextUtils; + +import java.io.Serializable; + +@SuppressWarnings("unused") +public class MarkerLocation implements Serializable { + + private double lat;//纬度 + private double lon;//经度 + private double angle;//车头角度,可以没有 + private String address;//具体的位置信息 + + 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 getAngle() { + return angle; + } + + public void setAngle(double angle) { + this.angle = angle; + } + + public String getAddress() { + if (TextUtils.isEmpty(address)) { + return ""; + } + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "MarkerLocation{" + + "lat=" + lat + + ", lon=" + lon + + ", angle=" + angle + + ", address='" + address + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerNoveltyInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerNoveltyInfo.java new file mode 100644 index 0000000000..4339f7003b --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerNoveltyInfo.java @@ -0,0 +1,195 @@ + +package com.mogo.eagle.core.data.map.entity; + + +/** + * 新鲜事儿Marker数据 + */ +public class MarkerNoveltyInfo { + private String type; + private String sn; + private MarkerLocation location; + private String poiType; + private ContentData contentData; + + public ContentData getContentData() { + return contentData; + } + + public void setContentData(ContentData contentData) { + this.contentData = contentData; + } + + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + public String getPoiType() { + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public static class ContentData { + private String content; + private String iconUrl; + private String imgUrl; + private String infoId; + private long likeNum; + private String title; + private String gasPrices; + private boolean displayNavigation; + private boolean desplayHost; + private boolean fabulous; + private String styleType; + //上报类型:1-用户上报,2-后台上报 3-三方上报 + private String uploadType; + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getIconUrl() { + return iconUrl; + } + + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public String getInfoId() { + return infoId; + } + + public void setInfoId(String infoId) { + this.infoId = infoId; + } + + public long getLikeNum() { + return likeNum; + } + + public void setLikeNum(long likeNum) { + this.likeNum = likeNum; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public boolean isDisplayNavigation() { + return displayNavigation; + } + + public void setDisplayNavigation(boolean displayNavigation) { + this.displayNavigation = displayNavigation; + } + + public String getStyleType() { + return styleType; + } + + public void setStyleType(String styleType) { + this.styleType = styleType; + } + + public String getGasPrices() { + return gasPrices; + } + + public void setGasPrices(String gasPrices) { + this.gasPrices = gasPrices; + } + + public boolean isDesplayHost() { + return desplayHost; + } + + public void setDesplayHost(boolean desplayHost) { + this.desplayHost = desplayHost; + } + + public boolean isFabulous() { + return fabulous; + } + + public void setFabulous(boolean fabulous) { + this.fabulous = fabulous; + } + + public String getUploadType() { + return uploadType; + } + + public void setUploadType(String uploadType) { + this.uploadType = uploadType; + } + + @Override + public String toString() { + return "ContentData{" + + "content='" + content + '\'' + + ", iconUrl='" + iconUrl + '\'' + + ", imgUrl='" + imgUrl + '\'' + + ", infoId='" + infoId + '\'' + + ", likeNum=" + likeNum + + ", title='" + title + '\'' + + ", gasPrices='" + gasPrices + '\'' + + ", displayNavigation=" + displayNavigation + + ", desplayHost=" + desplayHost + + ", fabulous=" + fabulous + + ", styleType='" + styleType + '\'' + + ", uploadType='" + uploadType + '\'' + + '}'; + } + } + + @Override + public String toString() { + return "MarkerNoveltyInfo{" + + "type='" + type + '\'' + + ", sn='" + sn + '\'' + + ", location=" + location + + ", poiType='" + poiType + '\'' + + ", contentData=" + contentData + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerOnlineCar.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerOnlineCar.java new file mode 100644 index 0000000000..a66f73a6ad --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerOnlineCar.java @@ -0,0 +1,105 @@ +package com.mogo.eagle.core.data.map.entity; + +import java.io.Serializable; +import java.util.List; + + +public class MarkerOnlineCar implements Serializable { + + private String type;//卡片类型 + private MarkerLocation location;//所在位置 + private Boolean isFocus;//isFocus":"0-未关注,1-关注 + private MarkerUserInfo userInfo;//用户数据 + private MarkerCarInfo carInfo;//车辆数据 + private List pois;//车辆路线 + private MarkerDynamicData dynamicData;//动态数据 + private MarkerHobbyDatum hobbyData;//爱好数据集合 + private List activitiesScope;//活动范围数据集合 + private int compatibility;//匹配度 + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + public Boolean getFocus() { + return isFocus; + } + + public void setFocus(Boolean focus) { + isFocus = focus; + } + + public MarkerUserInfo getUserInfo() { + return userInfo; + } + + public void setUserInfo(MarkerUserInfo userInfo) { + this.userInfo = userInfo; + } + + public MarkerCarInfo getCarInfo() { + return carInfo; + } + + public void setCarInfo(MarkerCarInfo carInfo) { + this.carInfo = carInfo; + } + + public List getPois() { + return pois; + } + + public void setPois(List pois) { + this.pois = pois; + } + + public MarkerDynamicData getDynamicData() { + return dynamicData; + } + + public void setDynamicData(MarkerDynamicData dynamicData) { + this.dynamicData = dynamicData; + } + + public MarkerHobbyDatum getHobbyData() { + return hobbyData; + } + + public void setHobbyData(MarkerHobbyDatum hobbyData) { + this.hobbyData = hobbyData; + } + + public List getActivitiesScope() { + return activitiesScope; + } + + public void setActivitiesScope(List activitiesScope) { + this.activitiesScope = activitiesScope; + } + + public int getCompatibility() { + return compatibility; + } + + public void setCompatibility(int compatibility) { + this.compatibility = compatibility; + } + + @Override + public String toString() { + return "MarkerOnlineCar{" + "type='" + type + '\'' + ", location=" + location + ", " + + "isFocus=" + isFocus + ", userInfo=" + userInfo + ", carInfo=" + carInfo + ", " + "pois=" + pois + ", dynamicData=" + dynamicData + ", hobbyData=" + hobbyData + "," + " activitiesScope=" + activitiesScope + ", compatibility=" + compatibility + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerOnlineTag.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerOnlineTag.java new file mode 100644 index 0000000000..31645b1d88 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerOnlineTag.java @@ -0,0 +1,41 @@ + +package com.mogo.eagle.core.data.map.entity; + + +import android.text.TextUtils; + +import java.io.Serializable; + +@SuppressWarnings("unused") +public class MarkerOnlineTag implements Serializable { + + private String content; + private boolean isCheck; + + public String getContent() { + if (TextUtils.isEmpty(content)) { + return ""; + } + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public boolean getIsCheck() { + return isCheck; + } + + public void setIsCheck(boolean isCheck) { + this.isCheck = isCheck; + } + + @Override + public String toString() { + return "MarkerHobbyDatum{" + + "content='" + content + '\'' + + ", isCheck=" + isCheck + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerResponse.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerResponse.java new file mode 100644 index 0000000000..5d8161a0b7 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerResponse.java @@ -0,0 +1,54 @@ + +package com.mogo.eagle.core.data.map.entity; + + +import com.mogo.eagle.core.data.BaseData; + +import java.io.Serializable; + +@SuppressWarnings("unused") +public class MarkerResponse extends BaseData implements Serializable { + +// private int code; +// private String msg; + private MarkerCardResult result; + private String sign; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public MarkerCardResult getResult() { + return result; + } + + + public void setResult(MarkerCardResult result) { + this.result = result; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + @Override + public String toString() { + return "MarkerResponse{" + "result=" + result + ", sign='" + sign + '\'' + ", code=" + code + ", msg='" + msg + '\'' + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerShareMusic.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerShareMusic.java new file mode 100644 index 0000000000..6a77bf6297 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerShareMusic.java @@ -0,0 +1,155 @@ + +package com.mogo.eagle.core.data.map.entity; + + +import android.text.TextUtils; + +import java.io.Serializable; + +@SuppressWarnings("unused") +public class MarkerShareMusic implements Serializable { + + private String bookInfo; + private int id; + private int likeNumber; + private MarkerLocation location; + private String mediaId; + private String mediaImg; + private String mediaName; + private String mediaSinger; + private String mediaUrl; + private String shareContentText; + private int shareType; + private String type; + private MarkerUserInfo userInfo; + + public String getBookInfo() { + return bookInfo; + } + + public void setBookInfo(String bookInfo) { + this.bookInfo = bookInfo; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getLikeNumber() { + return likeNumber; + } + + public void setLikeNumber(int likeNumber) { + this.likeNumber = likeNumber; + } + + public String getMediaId() { + return mediaId; + } + + public void setMediaId(String mediaId) { + this.mediaId = mediaId; + } + + public String getMediaImg() { + if (TextUtils.isEmpty(mediaImg)) { + return ""; + } + return mediaImg; + } + + public void setMediaImg(String mediaImg) { + this.mediaImg = mediaImg; + } + + public String getMediaName() { + if (TextUtils.isEmpty(mediaName)) { + return ""; + } + return mediaName; + } + + public void setMediaName(String mediaName) { + this.mediaName = mediaName; + } + + public String getMediaSinger() { + return mediaSinger; + } + + public void setMediaSinger(String mediaSinger) { + this.mediaSinger = mediaSinger; + } + + public String getMediaUrl() { + return mediaUrl; + } + + public void setMediaUrl(String mediaUrl) { + this.mediaUrl = mediaUrl; + } + + public String getShareContentText() { + return shareContentText; + } + + public void setShareContentText(String shareContentText) { + this.shareContentText = shareContentText; + } + + public int getShareType() { + return shareType; + } + + public void setShareType(int shareType) { + this.shareType = shareType; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public MarkerUserInfo getUserInfo() { + return userInfo; + } + + public void setUserInfo(MarkerUserInfo userInfo) { + this.userInfo = userInfo; + } + + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + + @Override + public String toString() { + return "MarkerShareMusic{" + + "bookInfo='" + bookInfo + '\'' + + ", id=" + id + + ", likeNumber=" + likeNumber + + ", location=" + location + + ", mediaId='" + mediaId + '\'' + + ", mediaImg='" + mediaImg + '\'' + + ", mediaName='" + mediaName + '\'' + + ", mediaSinger='" + mediaSinger + '\'' + + ", mediaUrl='" + mediaUrl + '\'' + + ", shareContentText='" + shareContentText + '\'' + + ", shareType=" + shareType + + ", type='" + type + '\'' + + ", userInfo=" + userInfo + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerShowEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerShowEntity.java new file mode 100644 index 0000000000..6b57cbf3bd --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerShowEntity.java @@ -0,0 +1,129 @@ +package com.mogo.eagle.core.data.map.entity; + +import android.text.TextUtils; + + +import java.util.Objects; + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020-01-1015:47 + * desc : 用来跟Marker View 绑定使用,内容、状态等设置 + * version: 1.0 + */ +public class MarkerShowEntity { + + // false - 没选中,true - 选中 + private boolean isChecked; + // false - 非高亮,true - 高亮 + private boolean isHighlighted; + // icon 地址,例如:头像,唱片图片,探路缩略,可能为空展示默认图 + private String iconUrl; + // 要展示的文本 + private String textContent; + // Marker 类型 + private String markerType; + // 绑定 MarkerView 的数据 + private Object bindObj; + //Marker 经纬度位置信息 + private MarkerLocation markerLocation; + private IMogoMarker mMarker; + + public boolean isChecked() { + return isChecked; + } + + public void setChecked(boolean checked) { + isChecked = checked; + } + + public boolean isHighlighted() { + return isHighlighted; + } + + public void setHighlighted(boolean highlighted) { + isHighlighted = highlighted; + } + + public String getIconUrl() { + return iconUrl; + } + + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl; + } + + public String getTextContent() { + if (TextUtils.isEmpty(textContent)) { + return ""; + } + return textContent; + } + + public void setTextContent(String textContent) { + this.textContent = textContent; + } + + public String getMarkerType() { + return markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public Object getBindObj() { + return bindObj; + } + + public void setBindObj(Object bindObj) { + this.bindObj = bindObj; + } + + public MarkerLocation getMarkerLocation() { + return markerLocation; + } + + public void setMarkerLocation(MarkerLocation markerLocation) { + this.markerLocation = markerLocation; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MarkerShowEntity that = (MarkerShowEntity) o; + return Objects.equals(iconUrl, that.iconUrl) && + Objects.equals(textContent, that.textContent) && + Objects.equals(markerType, that.markerType) && + Objects.equals(bindObj, that.bindObj) && + Objects.equals(markerLocation, that.markerLocation); + } + + public void setMarker( IMogoMarker marker ) { + this.mMarker = marker; + } + + public IMogoMarker getMarker() { + return mMarker; + } + + @Override + public int hashCode() { + return Objects.hash(iconUrl, textContent, markerType, bindObj, markerLocation); + } + + @Override + public String toString() { + return "MarkerShowEntity{" + + "isChecked=" + isChecked + + ", isHighlighted=" + isHighlighted + + ", iconUrl='" + iconUrl + '\'' + + ", textContent='" + textContent + '\'' + + ", markerType='" + markerType + '\'' + + ", bindObj=" + bindObj + + ", markerLocation=" + markerLocation + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerUserInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerUserInfo.java new file mode 100644 index 0000000000..d38a08955b --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/MarkerUserInfo.java @@ -0,0 +1,208 @@ + +package com.mogo.eagle.core.data.map.entity; + +import android.text.TextUtils; + +import java.io.Serializable; +import java.util.Calendar; + +@SuppressWarnings("unused") +public class MarkerUserInfo implements Serializable { + + private String sn; + private long userId; + private String userName;//用户昵称 + private String userHead;//用户头像 + private String gender;//gender": "男|女|无(也可以0|1|2根据实际库存返回即可) + private Integer age;// 年龄段,可以为空,与车聊聊一致 + + // TODO V2X临时字段,接口出好后进行修改 + private String lastActiveweekAvgscore;//末次活跃周驾驶行为平均得分 + private String safeLabel;//车辆安全标签 + private int safeLabelType;//1老司机 2安全驾驶 3危险驾驶 + + public void setAge(Integer age) { + this.age = age; + } + + public int getAgeNumber() { + if (age != null) { + return age; + } + return -1; + } + + public String getAge() { + try { + if (getAgeNumber() >= 0) { + + Calendar cal = Calendar.getInstance(); + int year = cal.get(Calendar.YEAR); + + //2020-30=1990 + double ageDiffer = year - getAgeNumber(); + String ageStr = "" + ageDiffer; + char[] ageChars = ageStr.toCharArray(); + + //1990 + char ageChar = ageChars[2]; + + String ageString = "未设置"; + + switch (ageChar) { + case '0': + ageString = "00后"; + break; + case '1': + ageString = "10后"; + break; + case '2': + ageString = "20后"; + break; + case '3': + ageString = "30后"; + break; + case '4': + ageString = "40后"; + break; + case '5': + ageString = "50后"; + break; + case '6': + ageString = "60后"; + break; + case '7': + ageString = "70后"; + break; + case '8': + ageString = "80后"; + break; + case '9': + ageString = "90后"; + break; + } + + return ageString; + } else { + return ""; + } + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + public int getGenderValue() { + if (!TextUtils.isEmpty(gender)) { + if ("男".equals(gender)) { + return 0; + } + return 1; + } else { + return 0; + } + } + + public String getGender() { + if (TextUtils.isEmpty(gender)) { + return "未设置"; + } + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public void setGender(int gender) { + if (gender == 0) { + this.gender = "男"; + } else { + this.gender = "女"; + } + } + + public String getSn() { + if (TextUtils.isEmpty(sn)) { + return ""; + } + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getUserHead() { + if (TextUtils.isEmpty(userHead)) { + return ""; + } + return userHead; + } + + public void setUserHead(String userHead) { + this.userHead = userHead; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUserName() { + if (TextUtils.isEmpty(userName)) { + return "用户未设置昵称"; + } + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public String getLastActiveweekAvgscore() { + return lastActiveweekAvgscore; + } + + public void setLastActiveweekAvgscore(String lastActiveweekAvgscore) { + this.lastActiveweekAvgscore = lastActiveweekAvgscore; + } + + public String getSafeLabel() { + return safeLabel; + } + + public void setSafeLabel(String safeLabel) { + this.safeLabel = safeLabel; + } + + public int getSafeLabelType() { + return safeLabelType; + } + + public void setSafeLabelType(int safeLabelType) { + this.safeLabelType = safeLabelType; + } + + @Override + public String toString() { + return "MarkerUserInfo{" + + "sn='" + sn + '\'' + + ", userId=" + userId + + ", userName='" + userName + '\'' + + ", userHead='" + userHead + '\'' + + ", gender='" + gender + '\'' + + ", age=" + age + + ", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' + + ", safeLabel='" + safeLabel + '\'' + + ", safeLabelType=" + safeLabelType + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XEventZanData.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XEventZanData.java new file mode 100644 index 0000000000..a348611558 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XEventZanData.java @@ -0,0 +1,51 @@ +package com.mogo.eagle.core.data.map.entity; + +import com.mogo.utils.sqlite.annotation.DbDatabase; +import com.mogo.utils.sqlite.annotation.DbField; +import com.mogo.utils.sqlite.annotation.DbTable; + +/** + * V2X 被点赞的事件 + * + * @author donghongyu + */ +@DbDatabase(dbName = "MoGoScenario.db") +@DbTable(tableName = "tb_event_zan") +public class V2XEventZanData { + + /** + * 事件ID + */ + @DbField(fieldName = "eventId") + public String eventId; + + /** + * 触发时间 + */ + @DbField(fieldName = "triggerTime") + public Long triggerTime; + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + public Long getTriggerTime() { + return triggerTime; + } + + public void setTriggerTime(Long triggerTime) { + this.triggerTime = triggerTime; + } + + @Override + public String toString() { + return "V2XEventZanData{" + + "eventId=" + eventId + + ", triggerTime=" + triggerTime + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XHistoryScenarioData.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XHistoryScenarioData.java new file mode 100644 index 0000000000..51fe4c2871 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XHistoryScenarioData.java @@ -0,0 +1,97 @@ +package com.mogo.eagle.core.data.map.entity; + +import com.mogo.module.common.constants.RoomConstants; +import com.mogo.utils.sqlite.annotation.DbDatabase; +import com.mogo.utils.sqlite.annotation.DbField; +import com.mogo.utils.sqlite.annotation.DbTable; + +/** + * V2X 道路历史事件 + * + * @author donghongyu + */ +@DbDatabase(dbName = RoomConstants.DB_NAME_V2X) +@DbTable(tableName = RoomConstants.TB_NAME_SCENARIO) +public class V2XHistoryScenarioData { + + /** + * 事件类型 + */ + @DbField(fieldName = "scenarioType") + public Integer scenarioType; + + /** + * 事件触发时间 + */ + @DbField(fieldName = "triggerTime") + public Long triggerTime; + + /** + * 事件json + */ + @DbField(fieldName = "eventJsonData") + public String eventJsonData; + + /** + * 事件json HashCode + * 只取json中的几个代表性字段,表示唯一性,因为图片地址会经常被改变 + */ + @DbField(fieldName = "eventJsonDataHashCode") + public Integer eventJsonDataHashCode; + + /** + * 事件是否被处理过了,true-处理过了。false-未处理过 + */ + @DbField(fieldName = "isDispose") + public Boolean isDispose; + + public Integer getScenarioType() { + return scenarioType; + } + + public void setScenarioType(Integer scenarioType) { + this.scenarioType = scenarioType; + } + + public String getEventJsonData() { + return eventJsonData; + } + + public void setEventJsonData(String eventJsonData) { + this.eventJsonData = eventJsonData; + } + + public Long getTriggerTime() { + return triggerTime; + } + + public void setTriggerTime(Long triggerTime) { + this.triggerTime = triggerTime; + } + + public Boolean isDispose() { + return isDispose; + } + + public void setDispose(Boolean dispose) { + isDispose = dispose; + } + + public Integer getEventJsonDataHashCode() { + return eventJsonDataHashCode; + } + + public void setEventJsonDataHashCode(Integer eventJsonDataHashCode) { + this.eventJsonDataHashCode = eventJsonDataHashCode; + } + + @Override + public V2XHistoryScenarioData clone() { + try { + return (V2XHistoryScenarioData) super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + return this; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XLiveCarInfoEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XLiveCarInfoEntity.java new file mode 100644 index 0000000000..485dde6de8 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XLiveCarInfoEntity.java @@ -0,0 +1,66 @@ +package com.mogo.eagle.core.data.map.entity; + +import java.util.Objects; + +/** + * 可直播车机基本信息,再通过 appDataService/integratedServices/app/push/no/livePush/v1 + * 获取直播信息 + * @author donghongyu + */ +public class V2XLiveCarInfoEntity { + private String sn; + private double lon; + private double lat; + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + V2XLiveCarInfoEntity that = (V2XLiveCarInfoEntity) o; + return Double.compare(that.lon, lon) == 0 && + Double.compare(that.lat, lat) == 0 && + Objects.equals(sn, that.sn); + } + + @Override + public int hashCode() { + return Objects.hash(sn, lon, lat); + } + + @Override + public String toString() { + return "V2XLiveCarEntity{" + + "sn='" + sn + '\'' + + ", lon=" + lon + + ", lat=" + lat + + '}'; + } +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XMessageEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XMessageEntity.java new file mode 100644 index 0000000000..0bc8351697 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XMessageEntity.java @@ -0,0 +1,212 @@ +package com.mogo.eagle.core.data.map.entity; + +import androidx.annotation.IntDef; + +import java.io.Serializable; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Objects; + +/** + * e-mail : 1358506549@qq.com + * date : 2020/5/15 4:35 PM + * desc : V2X 场景消息聚合 + * version: 1.0 + * + * @author donghongyu + */ +public class V2XMessageEntity implements Serializable { + + /** + * 场景类型 + * + * @see V2XTypeEnum + */ + @MessageType + int type; + + /** + * 是否展示对话框 + * true-展示,false-不展示 + */ + boolean showState; + + /** + * 是否需要判断重复事件 + * true-判断,false-不判断 + * 默认需要判断 + */ + boolean isNeedCompareSameScenario = true; + + //是否播报tts + private boolean onlyShow = false; + + //本机与事件是否连线 + private boolean needAddLine = true; + + /** + * 场景具体的数据内容 + */ + T content; + + public int getType() { + return type; + } + + public void setType(@MessageType int type) { + this.type = type; + } + + public boolean isShowState() { + return showState; + } + + public void setShowState(boolean showState) { + this.showState = showState; + } + + public boolean isNeedCompareSameScenario() { + return isNeedCompareSameScenario; + } + + public void setNeedCompareSameScenario(boolean needCompareSameScenario) { + isNeedCompareSameScenario = needCompareSameScenario; + } + + public T getContent() { + return content; + } + + public void setContent(T content) { + this.content = content; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + V2XMessageEntity that = (V2XMessageEntity) o; + return type == that.type && + content.equals(that.content); + } + + @Override + public int hashCode() { + return Objects.hash(type, content); + } + + public boolean isOnlyShow() { + return onlyShow; + } + + public void setOnlyShow(boolean onlyShow) { + this.onlyShow = onlyShow; + } + + public boolean isNeedAddLine() { + return needAddLine; + } + + public void setNeedAddLine(boolean needAddLine) { + this.needAddLine = needAddLine; + } + + /** + * V2X 场景类型 + */ + public interface V2XTypeEnum { + // 默认展示详情 + int DEFAULT_WINDOW = 0; + // 道路事件预警 + int ALERT_ROAD_WARNING = 1_000; + // 他车求助预警 + int ALERT_SEEK_WARNING = 1_001; + // 疲劳驾驶预警 + int ALERT_FATIGUE_DRIVING = 1_002; + // 后台推送展示 Window + int ALERT_PUSH_WINDOW_WARNING = 1_003; + // 后台推送展示 Toast + int ALERT_PUSH_TOAST_WARNING = 1_004; + // 后台推送展示 展示的直播 + int ALERT_PUSH_LIVE_CAR_WARNING = 1_005; + // V2X场景动画展示 + int ALERT_ANIMATION_WARNING = 1_006; + // 道路事件直播预警 + int ALERT_ROAD_LIVE_CAR_WARNING = 1_007; + // 道路事件违章停车 + int ALERT_ILLEGAL_PARK_WARNING = 1_008; + // 用户UGC反馈事件准确性弹窗 + int ALERT_EVENT_UGC_WARNING = 1_009; + // 呼叫、请求直播事件 + int ALERT_VOICE_CALL_FOR_LIVECAR_SHOW = 1_010; + // 基于预判目的地道路事件的路线推荐 + int ALERT_RECOMMEND_ROUTE = 1_011; + // 基于预判目的地违章高发停车场推荐 + int ALERT_RECOMMEND_PARKING = 1_012; + // 弱势交通参与者401018 + int ALERT_THE_FRONT_WEAKNESS = 40_1018; + // 关闭红色边框预警 + int ALERT_THE_FRONT_CRASH_WARNING_NON = 0; + // 前方行人碰撞预警 + int ALERT_THE_FRONT_CRASH_WARNING_TOP = 1; + // 后方碰撞预警 + int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM = 2; + // 左前方碰撞预警 + int ALERT_THE_FRONT_CRASH_WARNING_LEFT = 3; + // 右前方碰撞预警 + int ALERT_THE_FRONT_CRASH_WARNING_RIGHT = 4; + // 左后方碰撞预警 + int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_LEFT = 5; + // 右后方碰撞预警 + int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_RIGHT = 6; + + // 推送VR消息展示 + int ALERT_PUSH_VR_SHOW = 2_000; + // 自车求助 + int ALERT_CAR_FOR_HELP = 8_000; + // obu事件 + int ALERT_OBU_EVENT = 9_000; + } + + @IntDef(value = { + V2XTypeEnum.ALERT_ROAD_WARNING, + V2XTypeEnum.ALERT_SEEK_WARNING, + V2XTypeEnum.ALERT_FATIGUE_DRIVING, + V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING, + V2XTypeEnum.ALERT_PUSH_TOAST_WARNING, + V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING, + V2XTypeEnum.ALERT_ANIMATION_WARNING, + V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING, + V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING, + V2XTypeEnum.ALERT_EVENT_UGC_WARNING, + V2XTypeEnum.ALERT_CAR_FOR_HELP, + V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW, + V2XTypeEnum.ALERT_RECOMMEND_ROUTE, + V2XTypeEnum.ALERT_RECOMMEND_PARKING, + V2XTypeEnum.ALERT_PUSH_VR_SHOW, + V2XTypeEnum.ALERT_OBU_EVENT, + V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS, + }) + @Target({ + ElementType.PARAMETER, + ElementType.FIELD, + ElementType.METHOD, + }) //表示注解作用范围,参数注解,成员注解,方法注解 + @Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中 + public @interface MessageType { //接口,定义新的注解类型 + } + + @Override + public String toString() { + return "V2XMessageEntity{" + + "type=" + type + + ", showState=" + showState + + ", isNeedCompareSameScenario=" + isNeedCompareSameScenario + + ", onlyShow=" + onlyShow + + ", needAddLine=" + needAddLine + + ", content=" + content + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java new file mode 100644 index 0000000000..809d6463a5 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java @@ -0,0 +1,138 @@ +package com.mogo.eagle.core.data.map.entity; + +import android.text.TextUtils; + + +import java.io.Serializable; +import java.util.Objects; + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020/4/13 11:17 AM + * desc : 道路事件的聚合,位置、详情,用于V2X情况下展示 + * version: 1.0 + */ +public class V2XRoadEventEntity implements Serializable { + + // 事件类型 + private String poiType; + // 事件位置 + private MarkerLocation location; + // 具体的信息 + private MarkerExploreWay noveltyInfo; + // tts 提示 + private String tts; + + // ADAS 展示文案 + private String alarmContent; + // 距离当前车辆的距离 + private double distance; + // 默认展示时间 + private int expireTime; + // 展示Button + private boolean isShowEventButton; + // 绑定 MarkerView 的数据, 业务需要啥数据就传入啥数据 + private Object bindObj; + + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + public String getPoiType() { + if (TextUtils.isEmpty(poiType)) { + return ""; + } + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public String getTts() { + return tts; + } + + public void setTts(String tts) { + this.tts = tts; + } + + public boolean isShowEventButton() { + return isShowEventButton; + } + + public void setShowEventButton(boolean showEventButton) { + isShowEventButton = showEventButton; + } + + public void setAlarmContent(String alarmContent) { + this.alarmContent = alarmContent; + } + + public double getDistance() { + return distance; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public int getExpireTime() { + return expireTime; + } + + public void setExpireTime(int expireTime) { + this.expireTime = expireTime; + } + + public MarkerExploreWay getNoveltyInfo() { + return noveltyInfo; + } + + public void setNoveltyInfo(MarkerExploreWay noveltyInfo) { + this.noveltyInfo = noveltyInfo; + } + + public Object getBindObj() { + return bindObj; + } + + public void setBindObj(Object bindObj) { + this.bindObj = bindObj; + } + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + V2XRoadEventEntity that = (V2XRoadEventEntity) o; + return Objects.equals(noveltyInfo.getInfoId(), that.noveltyInfo.getInfoId()) && + Objects.equals(poiType, that.poiType); + } + + @Override + public int hashCode() { + return Objects.hash(poiType, noveltyInfo.getInfoId()); + } + + @Override + public String toString() { + return "V2XRoadEventEntity{" + + "poiType='" + poiType + '\'' + + ", location=" + location + + ", noveltyInfo=" + noveltyInfo + + ", tts='" + tts + '\'' + + ", alarmContent='" + alarmContent + '\'' + + ", distance=" + distance + + ", expireTime=" + expireTime + + ", isShowEventButton=" + isShowEventButton + + ", bindObj=" + bindObj + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XWarningEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XWarningEntity.java new file mode 100644 index 0000000000..9f9e66a8cc --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XWarningEntity.java @@ -0,0 +1,268 @@ +package com.mogo.eagle.core.data.map.entity; + +import com.mogo.eagle.core.data.map.MogoLatLng; + +import java.io.Serializable; +import java.util.List; + +/** + * @author liujing + * @description 预警目标物数据模型 + * @since: 2021/3/26 + */ +public class V2XWarningEntity implements Serializable { + + //事件类型 行人1/自行车2/摩托车4/骑行车辆11 + private int type; + //目标物位置 + private double lat; + private double lon; + //目标物颜色 + public String targetColor; + //目标物距离 + private double distance; + //预测碰撞点位置 + private double collisionLat; + private double collisionLon; + //朝向 角度 + private double angle; + //方位 前 后 左 右 + private int direction; + //速度 + private float speed; + //停止线经纬度 + private List stopLines; + //自车到停止线距离 + private double stopLineDistance; + //道路唯一标识 + public String roadId; + //车道唯一标识 + public String laneId; + //识别物体唯一标识 + public String uuid; + //红绿灯颜色 + public String color; + //车ID 暂不使用 + public String carId; + //预警文案 + private String warningContent; + //车头朝向 + public double heading; + //系统时间 暂时没用 + public long systemTime; + //定位卫星时间 暂时没用 + public long satelliteTime; + //预警蒙层等展示时长 + private long showTime; + //设计划线宽度与道路同宽 + private float roadwidth; + + //自组字段 + //tts播报 + private String tts; + //自车位置 + private MogoLatLng carLocation; + + public MogoLatLng getCarLocation() { + return carLocation; + } + + public void setTts(int type) { + switch (type) { + case 1: + case 11: + this.tts = "注意行人"; + break; + case 2: + this.tts = "注意自行车"; + break; + case 4: + this.tts = "注意摩托车"; + break; + default: + break; + } + } + + public void setType(int type) { + this.type = type; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public void setCollisionLat(double collisionLat) { + this.collisionLat = collisionLat; + } + + public void setCollisionLon(double collisionLon) { + this.collisionLon = collisionLon; + } + + public void setAngle(double angle) { + this.angle = angle; + } + + public void setDirection(int direction) { + this.direction = direction; + } + + public void setTts(String tts) { + this.tts = tts; + } + + public void setSpeed(float speed) { + this.speed = speed; + } + + public long getShowTime() { + return showTime; + } + + public void setShowTime(long showTime) { + this.showTime = showTime; + } + + + public void setStopLineDistance(double stopLineDistance) { + this.stopLineDistance = stopLineDistance; + } + + public void setWarningContent(String warningContent) { + this.warningContent = warningContent; + } + + public void setStopLines(List stopLines) { + this.stopLines = stopLines; + } + + public void setCarLocation(MogoLatLng carLocation) { + this.carLocation = carLocation; + } + + public int getType() { + return type; + } + + public double getLat() { + return lat; + } + + public double getLon() { + return lon; + } + + public double getCollisionLat() { + return collisionLat; + } + + public double getCollisionLon() { + return collisionLon; + } + + public double getDistance() { + return distance; + } + + public double getAngle() { + return angle; + } + + public int getDirection() { + return direction; + } + + public float getSpeed() { + return speed; + } + + public String getUuid() { + return uuid; + } + + public String getColor() { + return color; + } + + public String getWarningContent() { + return warningContent; + } + + public double getHeading() { + return heading; + } + + public long getSystemTime() { + return systemTime; + } + + public long getSatelliteTime() { + return satelliteTime; + } + + + public String getTts() { + if (warningContent == null) { + setTts(type); + return tts; + } + return warningContent; + } + + public double getStopLineDistance() { + return stopLineDistance; + } + + public List getStopLines() { + return stopLines; + } + + public float getRoadwidth() { + return roadwidth; + } + + public void setRoadwidth(float roadwidth) { + this.roadwidth = roadwidth; + } + + @Override + public String toString() { + return "V2XWarningEntity{" + + "type=" + type + + ", lat=" + lat + + ", lon=" + lon + + ", targetColor='" + targetColor + '\'' + + ", distance=" + distance + + ", collisionLat=" + collisionLat + + ", collisionLon=" + collisionLon + + ", angle=" + angle + + ", direction=" + direction + + ", speed=" + speed + + ", stopLines=" + stopLines + + ", stopLineDistance=" + stopLineDistance + + ", roadId='" + roadId + '\'' + + ", laneId='" + laneId + '\'' + + ", uuid='" + uuid + '\'' + + ", color='" + color + '\'' + + ", carId='" + carId + '\'' + + ", warningContent='" + warningContent + '\'' + + ", heading=" + heading + + ", systemTime=" + systemTime + + ", satelliteTime=" + satelliteTime + + ", showTime=" + showTime + + ", roadwidth=" + roadwidth + + ", tts='" + tts + '\'' + + ", carLocation=" + carLocation + + '}'; + } +} + diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index 2ab37413c9..46e773b7bb 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -17,6 +17,11 @@ import com.mogo.eagle.core.function.api.hmi.view.IOchBusView */ interface IMoGoWaringProvider : IMoGoHmiViewProxy { + /** + * 浓雾预警 + */ + fun displayEffects() + /** * 隐藏 脉速表 * @param visibility View.VISIBLE, View.INVISIBLE,View.GONE diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/IMogoMapService.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/IMogoMapService.java index 90b86a1810..d760fbeec0 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/IMogoMapService.java +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/IMogoMapService.java @@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.api.map; import android.content.Context; import com.alibaba.android.arouter.facade.template.IProvider; +import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService; import com.mogo.map.listener.IMogoHosListenerRegister; import com.mogo.map.location.IMogoLocationClient; import com.mogo.map.marker.IMogoMarkerManager; @@ -54,6 +55,12 @@ public interface IMogoMapService extends IProvider { */ IMogoMarkerManager getMarkerManager( Context context ); + /** + * 带有业务标注的服务marker + * @return + */ + IMogoMarkerService getMarkerService(); + /** * 地图UI控制 * diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMogoMarkerService.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMogoMarkerService.java index 7bfe77bd25..e411c3b652 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMogoMarkerService.java +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMogoMarkerService.java @@ -2,24 +2,15 @@ package com.mogo.eagle.core.function.api.map.marker; import androidx.annotation.Nullable; -import com.alibaba.android.arouter.facade.template.IProvider; import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.uicontroller.IMogoMapUIController; -/** - * @author congtaowang - * @since 2020-05-27 - *

- * 描述 - */ -public interface IMogoMarkerService extends IProvider { + +public interface IMogoMarkerService { /** * @param object instance of com.mogo.module.common.entity.MarkerShowEntity * @return */ @Nullable - IMogoMarker drawMarker( Object object ); - - IMogoMapUIController getMapUIController(); + IMogoMarker drawMarker(Object object); } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 20a408e34c..8392c124bd 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -32,6 +32,13 @@ object CallerHmiManager : CallerBase() { get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI) .navigation() as? IMoGoWaringProvider + /** + * 浓雾预警 + */ + fun displayEffects(){ + waringProviderApi?.displayEffects() + } + /** * 隐藏 脉速表 * @param visibility View.VISIBLE, View.INVISIBLE,View.GONE diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt index bab7121e86..2c2698f641 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt @@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.call.map import android.content.Context import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.api.map.IMogoMapService +import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.map.listener.IMogoHosListenerRegister import com.mogo.map.location.IMogoLocationClient @@ -11,10 +12,11 @@ import com.mogo.map.search.geo.IMogoGeoSearch import com.mogo.map.uicontroller.IMogoMapUIController object CallerMapUIServiceManager { - private val serviceProvider : IMogoMapService? by lazy { + private val serviceProvider: IMogoMapService? by lazy { CallerBase.getApiInstance( IMogoMapService::class.java, - MogoServicePaths.PATH_SERVICES_MAP) + MogoServicePaths.PATH_SERVICES_MAP + ) } fun getMapUIController(): IMogoMapUIController? { @@ -36,4 +38,8 @@ object CallerMapUIServiceManager { fun getMarkerManager(context: Context): IMogoMarkerManager? { return serviceProvider?.getMarkerManager(context) } + + fun getMarkerService(): IMogoMarkerService? { + return serviceProvider?.markerService + } } \ No newline at end of file diff --git a/core/mogo-core-utils/build.gradle b/core/mogo-core-utils/build.gradle index 692a87bf80..db971b5dbd 100644 --- a/core/mogo-core-utils/build.gradle +++ b/core/mogo-core-utils/build.gradle @@ -54,6 +54,7 @@ dependencies { kapt rootProject.ext.dependencies.androidxannotation api rootProject.ext.dependencies.glide kapt rootProject.ext.dependencies.glidecompiler + api rootProject.ext.dependencies.fresco implementation rootProject.ext.dependencies.kotlinstdlibjdk7 implementation rootProject.ext.dependencies.androidxannotation implementation rootProject.ext.dependencies.material diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/GlideImageLoader.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideImageLoader.java similarity index 88% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/GlideImageLoader.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideImageLoader.java index 0f521405eb..9d81c90944 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/GlideImageLoader.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideImageLoader.java @@ -1,4 +1,4 @@ -package com.mogo.service.impl.imageloader.glide; +package com.mogo.eagle.core.utilcode.mogo.glide; import android.content.Context; import android.graphics.Bitmap; @@ -10,14 +10,12 @@ import androidx.annotation.Nullable; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp; -import com.mogo.service.imageloader.IMogoImageLoaderListener; -import com.mogo.service.imageloader.IMogoImageloader; -import com.mogo.service.imageloader.MogoImageView; -import com.mogo.service.impl.imageloader.glide.transform.GlideBlurTransform; -import com.mogo.service.impl.imageloader.glide.transform.GlideCircleBitmapTransform; -import com.mogo.service.impl.imageloader.glide.transform.GlideRoundBitmapTransform; -import com.mogo.service.impl.imageloader.glide.utils.DiskLruCacheManager; +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideBlurTransform; +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideCircleBitmapTransform; +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundBitmapTransform; +import com.mogo.eagle.core.utilcode.mogo.glide.utils.DiskLruCacheManager; +import com.mogo.eagle.core.utilcode.mogo.imageloader.IMogoImageLoaderListener; +import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView; /** * @author congtaowang @@ -25,7 +23,7 @@ import com.mogo.service.impl.imageloader.glide.utils.DiskLruCacheManager; *

* 实现图片接口 */ -public class GlideImageLoader implements IMogoImageloader { +public class GlideImageLoader{ private static final String TAG = "GlideImageLoader"; @@ -45,27 +43,18 @@ public class GlideImageLoader implements IMogoImageloader { return sInstance; } - @Override - public void init( Context context ) { - - } - - @Override public void displayImage( String url, MogoImageView imageView ) { displayImage( url, imageView, null ); } - @Override - public void displayImage( String url, MogoImageView imageView, int width, int height ) { + public void displayImage(String url, MogoImageView imageView, int width, int height ) { displayImage( url, imageView, width, height, null ); } - @Override public void displayImage( String url, MogoImageView imageView, IMogoImageLoaderListener listener ) { displayImage( url, imageView, 0, 0, listener ); } - @Override public void displayImage( String url, MogoImageView imageView, int width, int height, final IMogoImageLoaderListener listener ) { if ( listener != null ) { @@ -149,7 +138,6 @@ public class GlideImageLoader implements IMogoImageloader { } ); } - @Override public void downloadImage( Context context, String url, final IMogoImageLoaderListener listener ) { if ( listener != null ) { listener.onStart(); @@ -179,7 +167,4 @@ public class GlideImageLoader implements IMogoImageloader { } ); } - @Override - public void destroy() { - } } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideBlurTransform.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideBlurTransform.java similarity index 84% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideBlurTransform.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideBlurTransform.java index 65f1c49fbf..0d443b66dd 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideBlurTransform.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideBlurTransform.java @@ -1,4 +1,4 @@ -package com.mogo.service.impl.imageloader.glide.transform; +package com.mogo.eagle.core.utilcode.mogo.glide.transform; import android.content.Context; import android.graphics.Bitmap; @@ -7,8 +7,8 @@ import androidx.annotation.NonNull; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; -import com.mogo.service.impl.imageloader.glide.utils.DiskLruCacheManager; -import com.mogo.service.impl.imageloader.glide.utils.FastBlurUtil; +import com.mogo.eagle.core.utilcode.mogo.glide.utils.DiskLruCacheManager; +import com.mogo.eagle.core.utilcode.mogo.glide.utils.FastBlurUtil; import java.security.MessageDigest; diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideBlurTransformation.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideBlurTransformation.java similarity index 98% rename from core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideBlurTransformation.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideBlurTransformation.java index 6458b189c9..795cb12f6d 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideBlurTransformation.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideBlurTransformation.java @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.utilcode.mogo.glide; +package com.mogo.eagle.core.utilcode.mogo.glide.transform; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideCircleBitmapTransform.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java similarity index 95% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideCircleBitmapTransform.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java index 340b8d1627..b56d33102a 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideCircleBitmapTransform.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideCircleBitmapTransform.java @@ -1,5 +1,5 @@ -package com.mogo.service.impl.imageloader.glide.transform; +package com.mogo.eagle.core.utilcode.mogo.glide.transform; import android.content.Context; import android.graphics.Bitmap; @@ -11,7 +11,7 @@ import androidx.annotation.NonNull; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; -import com.mogo.service.impl.imageloader.glide.utils.DiskLruCacheManager; +import com.mogo.eagle.core.utilcode.mogo.glide.utils.DiskLruCacheManager; import java.security.MessageDigest; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideRoundBitmapTransform.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideRoundBitmapTransform.java similarity index 95% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideRoundBitmapTransform.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideRoundBitmapTransform.java index 261d7f9be4..fe2a63f1d5 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/transform/GlideRoundBitmapTransform.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideRoundBitmapTransform.java @@ -1,5 +1,5 @@ -package com.mogo.service.impl.imageloader.glide.transform; +package com.mogo.eagle.core.utilcode.mogo.glide.transform; import android.content.Context; import android.graphics.Bitmap; @@ -12,7 +12,7 @@ import androidx.annotation.NonNull; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; -import com.mogo.service.impl.imageloader.glide.utils.DiskLruCacheManager; +import com.mogo.eagle.core.utilcode.mogo.glide.utils.DiskLruCacheManager; import java.security.MessageDigest; diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideRoundedCornersTransform.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideRoundedCornersTransform.java similarity index 99% rename from core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideRoundedCornersTransform.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideRoundedCornersTransform.java index 1beeae7e25..a16f333132 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/GlideRoundedCornersTransform.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/transform/GlideRoundedCornersTransform.java @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.utilcode.mogo.glide; +package com.mogo.eagle.core.utilcode.mogo.glide.transform; import android.graphics.Bitmap; import android.graphics.BitmapShader; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/DiskLruCache.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/DiskLruCache.java similarity index 99% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/DiskLruCache.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/DiskLruCache.java index b0beddced2..89431ce387 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/DiskLruCache.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/DiskLruCache.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.mogo.service.impl.imageloader.glide.utils; +package com.mogo.eagle.core.utilcode.mogo.glide.utils; import java.io.BufferedWriter; import java.io.Closeable; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/DiskLruCacheManager.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/DiskLruCacheManager.java similarity index 97% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/DiskLruCacheManager.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/DiskLruCacheManager.java index 0c38ed7c12..5742564602 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/DiskLruCacheManager.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/DiskLruCacheManager.java @@ -1,4 +1,4 @@ -package com.mogo.service.impl.imageloader.glide.utils; +package com.mogo.eagle.core.utilcode.mogo.glide.utils; import android.content.Context; import android.graphics.Bitmap; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/FastBlurUtil.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/FastBlurUtil.java similarity index 99% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/FastBlurUtil.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/FastBlurUtil.java index 9de44f0cd3..5b0ccdf2a9 100755 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/FastBlurUtil.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/FastBlurUtil.java @@ -1,4 +1,4 @@ -package com.mogo.service.impl.imageloader.glide.utils; +package com.mogo.eagle.core.utilcode.mogo.glide.utils; import android.graphics.Bitmap; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/StrictLineReader.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/StrictLineReader.java similarity index 99% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/StrictLineReader.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/StrictLineReader.java index 6083bb107a..a7ab8e7994 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/StrictLineReader.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/StrictLineReader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.mogo.service.impl.imageloader.glide.utils; +package com.mogo.eagle.core.utilcode.mogo.glide.utils; import java.io.ByteArrayOutputStream; import java.io.Closeable; diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/Util.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/Util.java similarity index 97% rename from services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/Util.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/Util.java index eaf34b7a49..895f7e0e1d 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/glide/utils/Util.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/glide/utils/Util.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.mogo.service.impl.imageloader.glide.utils; +package com.mogo.eagle.core.utilcode.mogo.glide.utils; import java.io.Closeable; import java.io.File; diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/IMogoImageLoaderListener.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/imageloader/IMogoImageLoaderListener.java similarity index 88% rename from services/mogo-service-api/src/main/java/com/mogo/service/imageloader/IMogoImageLoaderListener.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/imageloader/IMogoImageLoaderListener.java index ead28da3fb..d584393027 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/IMogoImageLoaderListener.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/imageloader/IMogoImageLoaderListener.java @@ -1,4 +1,4 @@ -package com.mogo.service.imageloader; +package com.mogo.eagle.core.utilcode.mogo.imageloader; import android.graphics.Bitmap; diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/MogoImageView.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/imageloader/MogoImageView.java similarity index 98% rename from services/mogo-service-api/src/main/java/com/mogo/service/imageloader/MogoImageView.java rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/imageloader/MogoImageView.java index 69c88fecf4..a3ef83ef6a 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/MogoImageView.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/imageloader/MogoImageView.java @@ -1,4 +1,4 @@ -package com.mogo.service.imageloader; +package com.mogo.eagle.core.utilcode.mogo.imageloader; import android.content.Context; import android.content.res.TypedArray; @@ -10,7 +10,7 @@ import androidx.annotation.DrawableRes; import androidx.annotation.Keep; import com.facebook.drawee.view.GenericDraweeView; -import com.mogo.service.R; +import com.mogo.eagle.core.utilcode.util.R; /** * @author congtaowang diff --git a/services/mogo-service-api/src/main/res/values/attrs.xml b/core/mogo-core-utils/src/main/res/values/attrs.xml similarity index 100% rename from services/mogo-service-api/src/main/res/values/attrs.xml rename to core/mogo-core-utils/src/main/res/values/attrs.xml diff --git a/foudations/mogo-commons/src/main/AndroidManifest.xml b/foudations/mogo-commons/src/main/AndroidManifest.xml index b4d9c66476..2eed2c43cb 100644 --- a/foudations/mogo-commons/src/main/AndroidManifest.xml +++ b/foudations/mogo-commons/src/main/AndroidManifest.xml @@ -2,4 +2,18 @@ package="com.mogo.commons" > + + + + + + + + + + + + diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java index f8a0228209..12f0f30b22 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/AbsMogoApplication.java @@ -10,6 +10,7 @@ import android.widget.ImageView; import android.widget.TextView; import com.mogo.commons.crash.FinalizeCrashFixer; +import com.mogo.commons.module.MogoServices; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.toast.TipDrawable; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; @@ -41,6 +42,7 @@ public abstract class AbsMogoApplication extends Application { initRxJavaErrorHandler(); FinalizeCrashFixer.fix(); Utils.init(this); + MogoServices.getInstance().init(this); } private void initRxJavaErrorHandler() { @@ -93,4 +95,5 @@ public abstract class AbsMogoApplication extends Application { } return contentView; } + } diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/CloudPoiManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/CloudPoiManager.java new file mode 100644 index 0000000000..232c089ded --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/CloudPoiManager.java @@ -0,0 +1,110 @@ +package com.mogo.commons.module; + + +import android.content.Context; +import android.util.ArrayMap; + +import com.mogo.commons.R; +import com.mogo.eagle.core.data.map.PoiWrapper; +import com.mogo.eagle.core.network.utils.GsonUtil; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; + +import java.util.List; +import java.util.Map; + + +/** + * 云端配置poi数据管理公共类 + * + * @author tongchenfei + */ +public class CloudPoiManager { + private static final String TAG = "CloudPoiManager"; + + private final Map poiWrapper = new ArrayMap<>(); + private static CloudPoiManager instance = null; + + public static CloudPoiManager getInstance() { + if (instance == null) { + synchronized (CloudPoiManager.class) { + if (instance == null) { + instance = new CloudPoiManager(); + } + } + } + return instance; + } + + public void generateDefault() { + if (poiWrapper.isEmpty()) { + poiWrapper.put(EventTypeEnum.TRAFFIC_CHECK.getPoiType(), new PoiWrapper(EventTypeEnum.TRAFFIC_CHECK.getPoiType(), + R.drawable.module_common_icon_map_marker_road_check2, R.drawable.module_common_icon_map_marker_road_check2_white, "交通检查")); + poiWrapper.put(EventTypeEnum.ROAD_CLOSED.getPoiType(), new PoiWrapper(EventTypeEnum.ROAD_CLOSED.getPoiType(), + R.drawable.module_common_icon_map_marker_road_block_off2, R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路")); + poiWrapper.put(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(), + R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工")); + poiWrapper.put(EventTypeEnum.AI_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.AI_ROAD_WORK.getPoiType(), + R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工")); + poiWrapper.put(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(), + R.drawable.module_common_icon_map_marker_road_block_up2, R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵")); + poiWrapper.put(EventTypeEnum.FOURS_PONDING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_PONDING.getPoiType(), + R.drawable.module_common_icon_map_marker_pondingl2, R.drawable.module_common_icon_map_marker_pondingl2_white, "积水")); + poiWrapper.put(EventTypeEnum.FOURS_FOG.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_FOG.getPoiType(), + R.drawable.module_common_ic_rc_dark_frog2, R.drawable.module_common_ic_rc_dark_frog2_white, "浓雾")); + poiWrapper.put(EventTypeEnum.FOURS_ICE.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ICE.getPoiType(), + R.drawable.module_common_ic_rc_freeze2, R.drawable.module_common_ic_rc_freeze2_white, "结冰")); + poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT.getPoiType(), + R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "事故")); + poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(), + R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "重大事故")); + poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(), + R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "特大事故")); + poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(), + R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "较大事故")); + poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(), + R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "一般事故")); + poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(), + R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "轻微事故")); + poiWrapper.put(EventTypeEnum.FOURS_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_LIVING.getPoiType(), + R.drawable.module_common_icon_map_marker_living, R.drawable.module_common_icon_map_marker_living_white, "实时路况")); + poiWrapper.put(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(), + R.drawable.module_common_ic_rc_illegal_park, R.drawable.module_common_ic_rc_illegal_park_white, "违章停车")); + // 分享里用到的故障求助 + poiWrapper.put("9999", new PoiWrapper("9999", + R.drawable.module_common_icon_seek_help, R.drawable.module_common_icon_seek_help, "故障求助")); + } + } + + public void updateFromConfig(Context context) { + generateDefault(); + // 从sp中获取config属性,将服务端配置内容合并到本地 + String config = SharedPrefsMgr.getInstance(context).getString("SHARE_BUTTON_CONFIG", ""); + if (!config.isEmpty()) { + List configWrappers = GsonUtil.arrayFromJson(config, PoiWrapper.class); + CallerLogger.INSTANCE.d(TAG, "config: " + configWrappers); + if (configWrappers != null) { + for (PoiWrapper wrapper : configWrappers) { + wrapper.setIconInfoRes(R.drawable.module_common_icon_map_marker_road_block_up2_white); + wrapper.setIconRes(R.drawable.module_common_icon_map_marker_road_block_up2); + if (poiWrapper.containsKey(wrapper.getPoiType())) { + PoiWrapper defWrapper = poiWrapper.get(wrapper.getPoiType()); + if (defWrapper != null) { + wrapper.setIconRes(defWrapper.getIconRes()); + wrapper.setIconInfoRes(defWrapper.getIconInfoRes()); + } + } + CallerLogger.INSTANCE.d(TAG, "put===" + wrapper); + poiWrapper.put(wrapper.getPoiType(), wrapper); + } + } else { + CallerLogger.INSTANCE.e(TAG, "解析configWrapper异常: " + config); + } + } + } + + public PoiWrapper getWrapperByPoiType(String poiType) { + return poiWrapper.get(poiType); + } + +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoModule.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoModule.java new file mode 100644 index 0000000000..4e023c24ba --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoModule.java @@ -0,0 +1,63 @@ +package com.mogo.commons.module; + +/** + * @author congtaowang + * @since 2019-12-31 + *

+ * 模块描述信息 + */ +public class MogoModule { + + /** + * 模块加载路径 + */ + private String mPath; + + /** + * 模块名称 + */ + private String mName; + + /** + * 广播接收者 + */ + private String mBroadcastAction; + + /** + * @param path 模块加载路径 + * @param name 模块名称 + */ + public MogoModule( String path, String name ) { + this.mPath = path; + this.mName = name; + } + + + public String getPath() { + return mPath; + } + + public MogoModule setPath( String path ) { + this.mPath = path; + return this; + } + + public String getName() { + return mName; + } + + public MogoModule setName( String name ) { + this.mName = name; + return this; + } + + public String getBroadcastAction() { + return mBroadcastAction; + } + + public MogoModule setBroadcastAction( String broadcastAction ) { + this.mBroadcastAction = broadcastAction; + return this; + } +} + diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoModulePaths.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoModulePaths.java new file mode 100644 index 0000000000..4693d1cb44 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoModulePaths.java @@ -0,0 +1,88 @@ +package com.mogo.commons.module; + +import android.text.TextUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author congtaowang + * @since 2019-12-23 + *

+ * 模块路由路径 + */ +public class MogoModulePaths { + + private static final List mMogoModules = new ArrayList<>(); + + // 不需要启动APP也能运行的模块 + private static final List mMogoBaseModules = new ArrayList<>(); + + private static final List mModuleFunctions = new ArrayList<>(); + + private static final List mModuleFunctionServers = new ArrayList<>(); + + /** + * 添加卡片模块 + * + * @param module + */ + public static void addModule(MogoModule module) { + if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) { + throw new IllegalArgumentException("module path can't be empty or null or blank"); + } + mMogoModules.add(module); + } + + /** + * 添加模块功能 + * + * @param module 功能模块 + */ + public static void addModuleFunction(MogoModule module) { + if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) { + throw new IllegalArgumentException("module path can't be empty or null or blank"); + } + mModuleFunctions.add(module); + } + + /** + * 添加 功能服务, 不带UI Fragment的 + * + * @param module 功能模块 + */ + public static void addModuleFunctionServer(MogoModule module) { + if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) { + throw new IllegalArgumentException("module path can't be empty or null or blank"); + } + mModuleFunctionServers.add(module); + } + + /** + * 添加基础模块 + * + * @param module + */ + public static void addBaseModule(MogoModule module) { + if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) { + throw new IllegalArgumentException("module path can't be empty or null or blank"); + } + mMogoBaseModules.add(module); + } + + public static List getModules() { + return mMogoModules; + } + + public static List getBaseModules() { + return mMogoBaseModules; + } + + public static List getModuleFunctions() { + return mModuleFunctions; + } + + public static List getModuleFunctionServers() { + return mModuleFunctionServers; + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoServices.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoServices.java new file mode 100644 index 0000000000..a3e62b791a --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/MogoServices.java @@ -0,0 +1,112 @@ +package com.mogo.commons.module; + +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_OTHER; + +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.text.TextUtils; + +import com.mogo.commons.debug.DebugConfig; +import com.mogo.commons.module.intent.IMogoIntentListener; +import com.mogo.commons.module.intent.IntentHandlerFactory; +import com.mogo.commons.module.intent.IntentManager; +import com.mogo.commons.module.status.MogoStatusManager; +import com.mogo.commons.receiver.MogoReceiver; +import com.mogo.commons.voice.AIAssist; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.utilcode.util.NetworkUtils; +import com.mogo.realtime.api.MoGoAiCloudRealTime; + +import java.util.List; + + +public class MogoServices implements IMogoIntentListener { + + private MogoServices() { + } + + private static final class InstanceHolder { + private static final MogoServices INSTANCE = new MogoServices(); + } + + public static MogoServices getInstance() { + return InstanceHolder.INSTANCE; + } + + private static final String TAG = "MogoServices"; + + private IntentManager mIntentManager; + + private Context mContext; + + public void init(Context context) { + mContext = context; + MogoStatusManager.getInstance().setAIAssistReady(TAG, AIAssist.getInstance(mContext).hasFlush()); + CloudPoiManager.getInstance().updateFromConfig(context); + + registerMogoReceiver(context); + + mIntentManager = IntentManager.getInstance(); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_UI, this); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_READY, this); + mIntentManager.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this); + + Intent intent = new Intent("com.freedom.ser.ACTION"); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + mContext.sendBroadcast(intent); + + if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) { + MoGoAiCloudRealTime.startRealTime(mContext, DebugConfig.getSocketAppId()); + } + } + + private void registerMogoReceiver(Context context) { + if (context == null) { + return; + } + List modules = MogoModulePaths.getModules(); + if (modules.isEmpty()) { + return; + } + MogoReceiver receiver = new MogoReceiver(context); + IntentFilter filter = new IntentFilter(); + if (!modules.isEmpty()) { + for (MogoModule module : modules) { + if (TextUtils.isEmpty(module.getBroadcastAction())) { + continue; + } + filter.addAction(module.getBroadcastAction()); + } + } + filter.addAction(MogoReceiver.VOICE_ACTION); + // 小智语音 + filter.addAction(MogoReceiver.ACTION_VOICE_UI); + filter.addAction(MogoReceiver.ACTION_VOICE_READY); + filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); + filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); + try { + context.getApplicationContext().registerReceiver(receiver, filter); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_OLD_OTHER + TAG, "registerMogoReceiver error : " + e); + } + } + + @Override + public void onIntentReceived(String command, Intent intent) { + if (TextUtils.equals(command, ConnectivityManager.CONNECTIVITY_ACTION) + && NetworkUtils.isConnected(mContext)) { + mIntentManager.unregisterIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this); + } + IntentHandlerFactory.getInstance().handle(mContext, command, intent); + } + + public void destroy() { + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "MogoServices do nothings."); + if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) { + MoGoAiCloudRealTime.stopRealTime(); + } + } + +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/ServiceConst.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/ServiceConst.java new file mode 100644 index 0000000000..24dbd73b46 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/ServiceConst.java @@ -0,0 +1,36 @@ +package com.mogo.commons.module; + +/** + * @author congtaowang + * @since 2020-01-03 + *

+ * 描述 + */ +public class ServiceConst { + + /** + * 类型 + */ + public static final String TYPE = "STRATEGY_REFRESH"; + + /** + * 刷新策略模块地址 + */ + public static final String PATH_REFRESH_STRATEGY = "/strategy/refresh"; + + /** + * 卡片 用户数据 + */ + 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 int ONLINE_SEARCH_LIMIT = 20; + public static final int ONLINE_SEARCH_RADIUS = 2_000; + + +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AIAssistIntentHandler.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AIAssistIntentHandler.java new file mode 100644 index 0000000000..a01f8bcf1e --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AIAssistIntentHandler.java @@ -0,0 +1,25 @@ +package com.mogo.commons.module.intent; + +import android.content.Context; +import android.content.Intent; + +import com.mogo.commons.module.status.MogoStatusManager; +import com.mogo.commons.voice.AIAssist; + + +/** + * @author congtaowang + * @since 2020/6/5 + *

+ * 描述 + */ +public class AIAssistIntentHandler implements IntentHandler { + + private static final String TAG = "AIAssistIntentHandler"; + + @Override + public void handle( Context context, Intent intent ) { + AIAssist.getInstance( context ).flush(); + MogoStatusManager.getInstance().setAIAssistReady( TAG, true ); + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java new file mode 100644 index 0000000000..baa219f0a9 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/AccStatusIntentHandler.java @@ -0,0 +1,52 @@ +package com.mogo.commons.module.intent; + +import android.content.Context; +import android.content.Intent; + +import com.mogo.commons.module.ServiceConst; +import com.mogo.commons.module.status.MogoStatusManager; +import com.mogo.commons.utils.CarSeries; + + +/** + * @author congtaowang + * @since 2020/6/5 + * + * 描述 + */ +public class AccStatusIntentHandler implements IntentHandler { + + private static volatile AccStatusIntentHandler sInstance; + + private AccStatusIntentHandler() { + } + + public static AccStatusIntentHandler getInstance() { + if ( sInstance == null ) { + synchronized ( AccStatusIntentHandler.class ) { + if ( sInstance == null ) { + sInstance = new AccStatusIntentHandler(); + } + } + } + return sInstance; + } + + public synchronized void release() { + sInstance = null; + } + + @Override + public void handle( Context context, Intent intent ) { + String action = intent.getAction(); + if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) { + if ( CarSeries.isF8xxSeries() ) { + MogoStatusManager.getInstance().setAccStatus( ServiceConst.TYPE, true ); + } + } else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) { + if ( CarSeries.isF8xxSeries() ) { + MogoStatusManager.getInstance().setAccStatus( ServiceConst.TYPE, false ); + } + } + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/EmptyIntentHandler.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/EmptyIntentHandler.java new file mode 100644 index 0000000000..1597138519 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/EmptyIntentHandler.java @@ -0,0 +1,19 @@ +package com.mogo.commons.module.intent; + +import android.content.Context; +import android.content.Intent; + +/** + * @author congtaowang + * @since 2020-04-17 + *

+ * 描述 + */ +public class EmptyIntentHandler implements IntentHandler { + + private static final String TAG = "EmptyIntentHandler"; + + @Override + public void handle( Context context, Intent intent ) { + } +} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/intent/IMogoIntentListener.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IMogoIntentListener.java similarity index 88% rename from services/mogo-service-api/src/main/java/com/mogo/service/intent/IMogoIntentListener.java rename to foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IMogoIntentListener.java index 0767fcb4ed..f1acacee26 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/intent/IMogoIntentListener.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IMogoIntentListener.java @@ -1,4 +1,4 @@ -package com.mogo.service.intent; +package com.mogo.commons.module.intent; import android.content.Intent; diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/intent/IMogoIntentManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IMogoIntentManager.java similarity index 94% rename from services/mogo-service-api/src/main/java/com/mogo/service/intent/IMogoIntentManager.java rename to foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IMogoIntentManager.java index 9976066fef..510ca5ca32 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/intent/IMogoIntentManager.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IMogoIntentManager.java @@ -1,4 +1,4 @@ -package com.mogo.service.intent; +package com.mogo.commons.module.intent; import android.content.Intent; diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandler.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandler.java new file mode 100644 index 0000000000..526d235685 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandler.java @@ -0,0 +1,15 @@ +package com.mogo.commons.module.intent; + +import android.content.Context; +import android.content.Intent; + +/** + * @author congtaowang + * @since 2020-04-17 + *

+ * 描述 + */ +public interface IntentHandler { + + void handle( Context context, Intent intent ); +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java new file mode 100644 index 0000000000..1ca65f58df --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentHandlerFactory.java @@ -0,0 +1,59 @@ +package com.mogo.commons.module.intent; + +import android.content.Context; +import android.content.Intent; + + +import com.mogo.commons.receiver.MogoReceiver; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author congtaowang + * @since 2020-04-17 + *

+ * 描述 + */ +public class IntentHandlerFactory { + + private IntentHandlerFactory() { + // private constructor + mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() ); + mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() ); + mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() ); + mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() ); + } + + private static final class InstanceHolder { + private static final IntentHandlerFactory INSTANCE = new IntentHandlerFactory(); + } + + public static IntentHandlerFactory getInstance() { + return InstanceHolder.INSTANCE; + } + + private Object readResolve() { + // 阻止反序列化,必须实现 Serializable 接口 + return InstanceHolder.INSTANCE; + } + + private final Map< String, IntentHandler > mHandlers = new HashMap<>(); + + private final IntentHandler DEFAULT = new EmptyIntentHandler(); + + private IntentHandler getIntentHandler( String intent ) { + if ( mHandlers.containsKey( intent ) && mHandlers.get( intent ) != null ) { + return mHandlers.get( intent ); + } + return DEFAULT; + } + + public void handle( Context context, String intent, Intent obj ) { + IntentHandler handler = getIntentHandler( intent ); + if ( handler != null ) { + handler.handle( context, obj ); + } + } + +} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/intent/IntentManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentManager.java similarity index 82% rename from services/mogo-service/src/main/java/com/mogo/service/impl/intent/IntentManager.java rename to foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentManager.java index db2d0c4332..497990d942 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/intent/IntentManager.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/IntentManager.java @@ -1,19 +1,9 @@ -package com.mogo.service.impl.intent; +package com.mogo.commons.module.intent; import android.content.Context; import android.content.Intent; -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import androidx.annotation.NonNull; - -import com.mogo.service.intent.IMogoIntentListener; -import com.mogo.service.intent.IMogoIntentManager; - -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; @@ -24,16 +14,17 @@ import java.util.concurrent.CopyOnWriteArrayList; *

* 描述 */ -public class IntentManager implements IMogoIntentManager { +public class IntentManager implements IMogoIntentManager{ private static volatile IntentManager sInstance; + private static final byte[] obj = new byte[0]; private IntentManager() { } public static IntentManager getInstance() { if ( sInstance == null ) { - synchronized ( IntentManager.class ) { + synchronized ( obj ) { if ( sInstance == null ) { sInstance = new IntentManager(); } diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/VoiceUiIntentHandler.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/VoiceUiIntentHandler.java new file mode 100644 index 0000000000..6ffd0bb3ca --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/intent/VoiceUiIntentHandler.java @@ -0,0 +1,24 @@ +package com.mogo.commons.module.intent; + +import android.content.Context; +import android.content.Intent; +import android.text.TextUtils; + +import com.mogo.commons.module.status.MogoStatusManager; +import com.mogo.commons.receiver.MogoReceiver; + + +public class VoiceUiIntentHandler implements IntentHandler { + + private static final String TAG = "VoiceUiIntentHandler"; + + @Override + public void handle( Context context, Intent intent ) { + String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS ); + if ( TextUtils.equals( val, MogoReceiver.VALUE_DISMISS ) ) { + MogoStatusManager.getInstance().setVoiceUIShow( TAG, false ); + } else if ( TextUtils.equals( val, MogoReceiver.VALUE_SHOW ) ) { + MogoStatusManager.getInstance().setVoiceUIShow( TAG, true ); + } + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusChangedListener.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusChangedListener.java new file mode 100644 index 0000000000..168041de85 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusChangedListener.java @@ -0,0 +1,17 @@ +package com.mogo.commons.module.status; + +/** + * @author congtaowang + * @since 2020-01-04 + *

+ * 状态控制器监听 + */ +public interface IMogoStatusChangedListener { + + /** + * @param descriptor 状态类型 + * @param isTrue true - accOn、adas ui show、voice ui show、push ui show、v2x ui show + */ + void onStatusChanged(StatusDescriptor descriptor, boolean isTrue ); + +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java new file mode 100644 index 0000000000..5db99e5f23 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStatusManager.java @@ -0,0 +1,150 @@ +package com.mogo.commons.module.status; + +import com.alibaba.android.arouter.facade.template.IProvider; + +/** + * @author congtaowang + * @since 2020-01-02 + *

+ * 车机状态 + */ +public interface IMogoStatusManager extends IProvider { + + /** + * 是否在vr模式 + * @return true - 在vr模式 false - 不在vr模式 + */ + boolean isVrMode(); + + /** + * 小智语音 UI 是否在展示 + * + * @return + */ + boolean isVoiceShow(); + + /** + * v2x UI 是否在展示 + * + * @return + */ + boolean isV2XShow(); + + /** + * 是否开机 + * + * @return true - 开机 false - 关机 + */ + boolean isAccOn(); + + /** + * 主页是否显示 + * + * @return + */ + boolean isMainPageOnResume(); + + /** + * 主页是否在后台运行 + * + * @return true-在后台,false-不在后台 + */ + boolean isMainPageIsBackground(); + + /** + * 主页是否已启动 + * + * @return + */ + boolean isMainPageLaunched(); + + /** + * 设置vrMode状态 + * @param tag 业务类型 + * @param vrMode true - 在vr模式 false 不在vr模式 + */ + void setVrMode(String tag, boolean vrMode); + + /** + * 设置小智语音UI状态 + * + * @param tag 业务类型 + * @param show true - 显示 false - 隐藏 + */ + void setVoiceUIShow( String tag, boolean show ); + + /** + * 设置 V2X UI 状态 + *

+ * + * @param tag 业务类型 + * @param show true - 显示 false - 隐藏 + */ + void setV2XUIShow( String tag, boolean show ); + + /** + * 设置 acc 状态 + * + * @param tag 业务类型 + * @param isOn true - on, false - off + */ + void setAccStatus( String tag, boolean isOn ); + + /** + * 主页 resume 状态 + * + * @param tag + * @param resume + */ + void setMainPageResumeStatus( String tag, boolean resume ); + + /** + * 主页 后台运行 状态 + * + * @param tag 控制来源 + * @param isBackground true-在后台运行,false-不在后台运行(也可能是挂了) + */ + void setMainPageIsBackgroundStatus( String tag, boolean isBackground ); + + /** + * 设置小智语音状态 + * + * @param tag + * @param ready + */ + void setAIAssistReady( String tag, boolean ready ); + + /** + * 设置求助状态 + * + * @param tag + * @param seekHelping + */ + void setSeekHelping( String tag, boolean seekHelping ); + + /** + * 设置主页是否启动 + * + * @param tag + * @param launched + */ + void setMainPageLaunchedStatus( String tag, boolean launched ); + + /** + * 注册监听 + * + * @param tag 业务类型 + * @param descriptor 监听类型 + * @param listener 监听回调 + */ + void registerStatusChangedListener(String tag, StatusDescriptor descriptor, IMogoStatusChangedListener listener ); + + /** + * 注销 + * + * @param tag 业务类型 + * @param descriptor 注销类型 + * @param listener 注销回调 + */ + void unregisterStatusChangedListener( String tag, StatusDescriptor descriptor, IMogoStatusChangedListener listener ); +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStickyStatusChangedListener.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStickyStatusChangedListener.java new file mode 100644 index 0000000000..0a7c420a98 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/IMogoStickyStatusChangedListener.java @@ -0,0 +1,18 @@ +package com.mogo.commons.module.status; + +/** + * @author congtaowang + * @since 2020-01-04 + *

+ * 状态控制器监听 + */ +public interface IMogoStickyStatusChangedListener extends IMogoStatusChangedListener { + + /** + * 是否需要黏性状态: 先改变状态,后注册监听 + * + * @param descriptor 状态 + * @return 默认不需要 + */ + boolean requestStickyStatus( StatusDescriptor descriptor ); +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java new file mode 100644 index 0000000000..078bdb09a3 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/MogoStatusManager.java @@ -0,0 +1,187 @@ +package com.mogo.commons.module.status; + + +import android.content.Context; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author congtaowang + * @since 2020-01-02 + *

+ * 状态控制器 + */ +public class MogoStatusManager implements IMogoStatusManager { + + private static volatile MogoStatusManager sInstance; + private static final byte[] obj = new byte[0]; + + private MogoStatusManager() { + } + + public static MogoStatusManager getInstance() { + if (sInstance == null) { + synchronized (obj) { + if (sInstance == null) { + sInstance = new MogoStatusManager(); + } + } + } + return sInstance; + } + + /** + * 状态记录 + */ + private static final Map mStatus = new ConcurrentHashMap<>(); + + /** + * 回调集合 + */ + private static final Map> mListeners = new ConcurrentHashMap<>(); + + /** + * 状态类型修改记录 + */ + private static final Map mModifier = new ConcurrentHashMap<>(); + + @Override + public boolean isVoiceShow() { + return get_bool_val(StatusDescriptor.VOICE_UI); + } + + @Override + public boolean isVrMode() { + return get_bool_val(StatusDescriptor.VR_MODE); + } + + @Override + public boolean isV2XShow() { + return get_bool_val(StatusDescriptor.V2X_UI); + } + + @Override + public boolean isAccOn() { + return get_bool_val(StatusDescriptor.ACC_STATUS); + } + + @Override + public boolean isMainPageOnResume() { + return get_bool_val(StatusDescriptor.MAIN_PAGE_RESUME); + } + + @Override + public boolean isMainPageIsBackground() { + return get_bool_val(StatusDescriptor.MAIN_PAGE_IS_BACKGROUND); + } + + @Override + public boolean isMainPageLaunched() { + return get_bool_val(StatusDescriptor.MAIN_PAGE_CREATED); + } + + private boolean get_bool_val(StatusDescriptor descriptor) { + Boolean val = mStatus.get(descriptor); + return val != null && val; + } + + @Override + public void setVrMode(String tag, boolean vrMode) { + doSetStatus(tag, StatusDescriptor.VR_MODE, vrMode); + } + + @Override + public void setVoiceUIShow(String tag, boolean show) { + doSetStatus(tag, StatusDescriptor.VOICE_UI, show); + } + + @Override + public void setV2XUIShow(String tag, boolean show) { + doSetStatus(tag, StatusDescriptor.V2X_UI, show); + } + + @Override + public void setAccStatus(String tag, boolean isOn) { + doSetStatus(tag, StatusDescriptor.ACC_STATUS, isOn); + } + + @Override + public void setMainPageResumeStatus(String tag, boolean resume) { + doSetStatus(tag, StatusDescriptor.MAIN_PAGE_RESUME, resume); + } + + @Override + public void setMainPageIsBackgroundStatus(String tag, boolean isBackground) { + doSetStatus(tag, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, isBackground); + } + + @Override + public void setAIAssistReady(String tag, boolean ready) { + doSetStatus(tag, StatusDescriptor.AI_ASSIST_READY, ready); + } + + @Override + public void setSeekHelping(String tag, boolean seekHelping) { + doSetStatus(tag, StatusDescriptor.SEEK_HELPING, seekHelping); + } + + @Override + public void setMainPageLaunchedStatus(String tag, boolean launched) { + doSetStatus(tag, StatusDescriptor.MAIN_PAGE_CREATED, launched); + } + + private void doSetStatus(String tag, StatusDescriptor target, boolean value) { + mStatus.put(target, value); + invokeStatusChangedListener(target, value); + recordStatusModifier(tag, target); + } + + private void invokeStatusChangedListener(StatusDescriptor descriptor, boolean status) { + List listenerList = mListeners.get(descriptor); + if (listenerList != null && listenerList.size() > 0) { + IMogoStatusChangedListener[] listeners = new IMogoStatusChangedListener[listenerList.size()]; + listenerList.toArray(listeners); + for (IMogoStatusChangedListener listener : listeners) { + if (listener != null) { + listener.onStatusChanged(descriptor, status); + } + } + } + } + + private void recordStatusModifier(String tag, StatusDescriptor descriptor) { + mModifier.put(descriptor, tag); + } + + @Override + public void registerStatusChangedListener(String tag, StatusDescriptor descriptor, IMogoStatusChangedListener listener) { + if (listener == null || descriptor == null) { + return; + } + if (!mListeners.containsKey(descriptor)) { + mListeners.put(descriptor, new ArrayList<>()); + } + mListeners.get(descriptor).add(listener); + + if (listener instanceof IMogoStickyStatusChangedListener && ((IMogoStickyStatusChangedListener) listener).requestStickyStatus(descriptor)) { + Boolean val = mStatus.get(descriptor); + if (val != null) { + listener.onStatusChanged(descriptor, get_bool_val(descriptor)); + } + } + } + + @Override + public void unregisterStatusChangedListener(String tag, StatusDescriptor descriptor, IMogoStatusChangedListener listener) { + if (mListeners.get(descriptor) != null) { + mListeners.get(descriptor).remove(listener); + } + } + + @Override + public void init(Context context) { + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java new file mode 100644 index 0000000000..3a7de76c96 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/module/status/StatusDescriptor.java @@ -0,0 +1,57 @@ +package com.mogo.commons.module.status; + +/** + * @author congtaowang + * @since 2020-01-04 + *

+ * 状态描述 + */ +public enum StatusDescriptor { + + /** + * v2x UI + */ + V2X_UI, + + /** + * 小智语音交互 UI + */ + VOICE_UI, + + /** + * 开机状态 + */ + ACC_STATUS, + + /** + * 主页 resume 状态 + */ + MAIN_PAGE_RESUME, + + /** + * 主页 isBackground 状态 + */ + MAIN_PAGE_IS_BACKGROUND, + + /** + * 小智语音状态 + */ + AI_ASSIST_READY, + + /** + * 求助状态 + */ + SEEK_HELPING, + + /** + * 是否已经进入过主页 + */ + MAIN_PAGE_CREATED, + + /** + * 是否已经进入vr模式 + */ + VR_MODE, + + +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/receiver/AccStatusReceiver.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/receiver/AccStatusReceiver.java new file mode 100644 index 0000000000..d92b9b9a7e --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/receiver/AccStatusReceiver.java @@ -0,0 +1,16 @@ +package com.mogo.commons.receiver; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +import com.mogo.commons.module.intent.IntentHandlerFactory; + + +public class AccStatusReceiver extends BroadcastReceiver { + + @Override + public void onReceive( Context context, Intent intent ) { + IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent ); + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/receiver/MogoReceiver.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/receiver/MogoReceiver.java new file mode 100644 index 0000000000..1bf9ed8813 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/receiver/MogoReceiver.java @@ -0,0 +1,54 @@ +package com.mogo.commons.receiver; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.text.TextUtils; + +import com.mogo.commons.module.intent.IntentManager; + + +/** + * @author congtaowang + * @since 2019-10-03 + *

+ * 广播接收者 + */ +public class MogoReceiver extends BroadcastReceiver { + + /** + * 语音 + */ + public static final String VOICE_ACTION = "com.zhidao.speech.awake.notify"; + public static final String PARAM_COMMAND = "command"; + + // 小智语音唤醒UI + public static final String ACTION_VOICE_UI = "com.zhidao.xiaozhi.wake.status"; + public static final String PARRAM_WAKE_STATUS = "WAKE_STATUS"; + public static final String VALUE_DISMISS = "dismiss"; + public static final String VALUE_SHOW = "show"; + + /** + * 小智语音准备就绪 + */ + public static final String ACTION_VOICE_READY = "com.zhidao.auto.AIAssist.ready"; + + private final IntentManager mMogoIntentManager; + + public MogoReceiver(Context context) { + mMogoIntentManager = IntentManager.getInstance(); + } + + @Override + public void onReceive(Context context, Intent intent) { + final String action = intent.getAction(); + if (TextUtils.equals(VOICE_ACTION, action)) { + String cmd = intent.getStringExtra(PARAM_COMMAND); + if (!TextUtils.isEmpty(cmd)) { + mMogoIntentManager.invoke(cmd, intent); + } + } else { + mMogoIntentManager.invoke(action, intent); + } + } +} diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java new file mode 100644 index 0000000000..2b32ca441e --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/utils/CarSeries.java @@ -0,0 +1,125 @@ +package com.mogo.commons.utils; + +import android.text.TextUtils; + +import com.mogo.commons.debug.DebugConfig; + +import java.lang.reflect.Method; + +/** + * @author congtaowang + * @since 2020-03-26 + *

+ * 车机类型 + */ +public class CarSeries { + + private static boolean invokeFlag = false; + private static boolean isF8xxSeries = false; + + public static boolean isF8xxSeries() { + if ( invokeFlag ) { + return isF8xxSeries; + } + isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f" ); + invokeFlag = true; + return isF8xxSeries; + } + + @Deprecated + public static final int CAR_SERIES_C80X = 10; + @Deprecated + public static final int CAR_SERIES_D80X = 20; + @Deprecated + public static final int CAR_SERIES_D81X = 21; + @Deprecated + public static final int CAR_SERIES_D82X = 22; + @Deprecated + public static final int CAR_SERIES_D84X = 23; + @Deprecated + public static final int CAR_SERIES_F80X = 30; + @Deprecated + public static final int CAR_SERIES_G80X = 40; + @Deprecated + public static final int CAR_SERIES_E84X = 50; + @Deprecated + public static final int CAR_SERIES_E84XCD = 51; + @Deprecated + public static final int CAR_SERIES_E85X = 50; + @Deprecated + public static final int CAR_SERIES_E85XCD = 51; + @Deprecated + public static final int CAR_SERIES_E85XJD = 51; + + @Deprecated + public static int CAR_SERIES = 0; + + /** + * Deprecated. + * Use {@link DebugConfig#getProductFlavor()} instead. + * + * @return + */ + @Deprecated + public static int getSeries() { + if ( CAR_SERIES != 0 ) { + return CAR_SERIES; + } + synchronized ( CarSeries.class ) { + if ( CAR_SERIES != 0 ) { + return CAR_SERIES; + } + String device = get( "ro.fota.device" ); + if ( TextUtils.isEmpty( device ) ) { + return CAR_SERIES_F80X; + } + + if ( "FG166".equals( device ) ) { + CAR_SERIES = CAR_SERIES_C80X; + } else if ( "D801-802".equals( device ) ) { + CAR_SERIES = CAR_SERIES_D80X; + } else if ( "D801B-802B".equals( device ) ) { + // 2+16G + CAR_SERIES = CAR_SERIES_D80X; + } else if ( "D811-812".equals( device ) ) { + CAR_SERIES = CAR_SERIES_D81X; + } else if ( "D821-822".equals( device ) ) { + CAR_SERIES = CAR_SERIES_D82X; + } else if ( "D841-842".equals( device ) ) { + CAR_SERIES = CAR_SERIES_D84X; + } else if ( "G801-802".equals( device ) ) { + CAR_SERIES = CAR_SERIES_G80X; + } else if ( "F801-802".equals( device ) ) { + CAR_SERIES = CAR_SERIES_F80X; + } else if ( "E841-842".equals( device ) ) { + CAR_SERIES = CAR_SERIES_E84X; + } else if ( "E84XCD".equals( device ) ) { + CAR_SERIES = CAR_SERIES_E84XCD; + } else if ( "E851-852".equals( device ) ) { + CAR_SERIES = CAR_SERIES_E85X; + } else if ( "E85XCD".equals( device ) ) { + CAR_SERIES = CAR_SERIES_E85XCD; + } else if ( "E85XJD".equals( device ) ) { + CAR_SERIES = CAR_SERIES_E85XJD; + } else if ( device.startsWith( "E85" ) ) { + CAR_SERIES = CAR_SERIES_E85XJD; + } else { + CAR_SERIES = CAR_SERIES_F80X; + } + return CAR_SERIES; + } + } + + @Deprecated + private static String get( String key ) { + String value = ""; + try { + Class< ? > c = Class.forName( "android.os.SystemProperties" ); + Method get = c.getMethod( "get", new Class[]{String.class, String.class} ); + value = ( String ) get.invoke( c, new Object[]{key, "unknown"} ); + } catch ( Exception e ) { + value = ""; + } + return value; + } +} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java index f9bfce7e26..d4f16fb420 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java @@ -1,21 +1,12 @@ package com.mogo.module.common.drawer; -import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS; import android.content.Context; -import android.text.TextUtils; import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; -import com.mogo.map.marker.IMogoMarker; import com.mogo.module.common.R; import com.mogo.module.common.constants.AdasRecognizedType; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - /** * @author congtaowang * @since 2020/10/30 @@ -24,67 +15,12 @@ import java.util.concurrent.ConcurrentHashMap; */ public class BaseDrawer { - /** - * 移除过期的 marker - */ - public static final int MSG_REMOVE_DIRTY_MARKERS = 9990; - - /** - * 地图内部资源md5缓存,便于资源复用 - */ - protected static final ConcurrentHashMap mMarkerCachesResMd5Values = new ConcurrentHashMap<>(); - protected final Context mContext; public BaseDrawer() { mContext = AbsMogoApplication.getApp(); } - /** - * 清除无效[为 null 或者 已被销毁]的 marker - */ - protected void removeUselessMarker(Map mMarkersCaches) { - if (mMarkersCaches == null || mMarkersCaches.isEmpty()) { - return; - } - Iterator iterator = mMarkersCaches.values().iterator(); - while (iterator.hasNext()) { - IMogoMarker marker = iterator.next(); - if (marker != null) { - iterator.remove(); - marker.remove(); - marker.destroy(); - } - } - } - - /** - * 发送消息 - * - * @param msg 消息类型 - * @param data 数据体 - */ - public void sendMessage(int msg, Object data) { - - } - - /** - * 判断是否是绘制内容 - * - * @param type {@link AdasRecognizedType} - * @return render - */ - public boolean nonRenderType(int type) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); - return recognizedType != AdasRecognizedType.classIdCar - && recognizedType != AdasRecognizedType.classIdMoto - && recognizedType != AdasRecognizedType.classIdBicycle - && recognizedType != AdasRecognizedType.classIdPerson - && recognizedType != AdasRecognizedType.classIdTrafficBus - && recognizedType != AdasRecognizedType.classIdTrafficTruck - && recognizedType != AdasRecognizedType.classIdUnKnow; - } - /** * 获取3D锚点模型资源 * @@ -115,118 +51,4 @@ public class BaseDrawer { return R.raw.special_vehicle; } - /** - * 根据数据源判断车辆预警颜色 - * - * @param type 车辆类型 - * @param fromType 数据来源 - * @param drawLevel 危险等级 - * @return 实际车辆颜色 - */ - protected String getModelRenderColor(int type, int fromType, int drawLevel) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); - if (recognizedType == AdasRecognizedType.classIdUnKnow) { - return Car3DModelColor.Normal.color; - } - if (fromType == FROM_ADAS) { - switch (drawLevel) { - case 0: - case 1: - return Car3DModelColor.Normal.color; - case 2: - return Car3DModelColor.Warming.color; - case 3: - return Car3DModelColor.Dangerous.color; - default: - return Car3DModelColor.Error.color; - } - } - return Car3DModelColor.Normal.color; - } - - /** - * 返回当前自车经纬度 - * - * @return 0:lon 1:lat - */ - protected double[] getCurCoordinates() { - return new double[]{ - CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(), - CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat() - }; - } - - /** - * 模型颜色 - */ - public enum Car3DModelColor { - Normal("#D8D8D8FF"), - Warming("#FFD53EFF"), - Dangerous("#FF3C45FF"), - Error("#7fb80e"); - private final String color; - - Car3DModelColor(String color) { - this.color = color; - } - } - - /** - * 移除markers - * - * @param dirtyMarkers 缓存marker数据 - */ - protected static void removeDirtyMarkers(Map dirtyMarkers) { - if (dirtyMarkers == null || dirtyMarkers.isEmpty()) { - return; - } - final Collection dirSet = dirtyMarkers.values(); - for (IMogoMarker value : dirSet) { - if (value == null || value.isDestroyed()) { - continue; - } - try { - value.destroy(); - } catch (Exception e) { - e.printStackTrace(); - } - } - dirtyMarkers.clear(); - } - - /** - * 缓存绘制 marker 的 id 和 marker 资源缓存的 md5 的关系 - * - * @param id 缓存资源ID - * @param marker {@link IMogoMarker} - */ - protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) { - if (marker == null || marker.isDestroyed()) { - return; - } - String md5 = marker.getMarkerResName(); - if (TextUtils.isEmpty(md5) || TextUtils.isEmpty(id)) { - return; - } - mMarkerCachesResMd5Values.put(id, md5); - } - - /** - * 使用系统时间或卫星时间计算出动画的运动时间,最小值45,防止两个点距离过近设置的最小动画执行时间 - * - * @param lastSatelliteTime 上一个点SNTP时间,精确值 - * @param curSatelliteTime 当前点SNTP时间,精确值 - * @return 动画运动时间 - */ - public long computeAnimDuration(long lastSatelliteTime, long curSatelliteTime) { - if (lastSatelliteTime == 0 || curSatelliteTime == 0) { - return 45; - } - long interval = curSatelliteTime - lastSatelliteTime; - if (interval < 45) { - interval = 45; - } - return interval; - } - } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java index 85ce84649b..2ee64f7e3a 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java @@ -112,21 +112,6 @@ public class MarkerDrawer { return marker; } - private boolean isNewVehicleType(Object object, IMogoMarker marker) { - if (object instanceof MarkerOnlineCar - && marker != null - && marker.getObject() instanceof MarkerShowEntity - && ((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) { - try { - return ((MarkerOnlineCar) object).getCarInfo().getVehicleType() - != ((MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj()).getCarInfo().getVehicleType(); - } catch (Exception e) { - - } - } - return false; - } - public String getPrimaryKeyFromEntity(Object entity) { if (entity instanceof MarkerExploreWay) { String id = ((MarkerExploreWay) entity).getInfoId(); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java index 4dcb9fcc65..d8717ef1ca 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java @@ -4,34 +4,26 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.eagle.core.utilcode.util.ViewUtils; import com.mogo.map.MogoMarkerManager; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.marker.IMarkerView; import com.mogo.module.common.drawer.marker.MapMarkerAdapter; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.StatusDescriptor; /** * 云端 预警数据绘制 */ -public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedListener { +public class V2XWarnDataDrawer extends BaseDrawer { private static final String TAG = "V2XWarnDataDrawer"; private static volatile V2XWarnDataDrawer sInstance; private V2XWarnDataDrawer() { super(); - MogoApisHandler.getInstance().getApis() - .getStatusManagerApi() - .registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this); } public static V2XWarnDataDrawer getInstance() { @@ -49,21 +41,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL sInstance = null; } - private boolean mIsVrMode = false; - - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - CallerLogger.INSTANCE.d(TAG, descriptor + " , "+ isTrue); - } - - public boolean isVrMode() { - return mIsVrMode; - } - - /** * 识别物移动 - * */ public void renderWarnData(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) { MarkerLocation location = new MarkerLocation(); @@ -95,7 +74,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL return 1; } - public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) { MogoMarkerOptions options = new MogoMarkerOptions() .data(markerShowEntity) @@ -128,10 +106,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL marker.setRotateAngle(rotate); } - /** * 绘制停止线 marker - * */ public void renderStopLineData(double lon, double lat) { MarkerLocation location = new MarkerLocation(); @@ -162,5 +138,4 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL return marker; } - } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java index 9c86e8b67d..b6b6855efe 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java @@ -11,16 +11,16 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; +import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.eagle.core.utilcode.util.ViewUtils; import com.mogo.eagle.core.utilcode.util.WindowUtils; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.R; import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.service.imageloader.IMogoImageLoaderListener; -import com.mogo.service.imageloader.MogoImageView; +import com.mogo.eagle.core.utilcode.mogo.imageloader.IMogoImageLoaderListener; +import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView; /** * author : donghongyu @@ -93,7 +93,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV if (!url.isEmpty()) { ivIcon.setPlaceHolder(res); ivIcon.setFailureHolder(res); - MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(url, + GlideImageLoader.getInstance().displayImage(url, ivIcon, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50), new IMogoImageLoaderListener() { @Override @@ -118,7 +118,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV private void runOnUiThread(final MarkerShowEntity markerShowEntity) { if (!TextUtils.isEmpty(markerShowEntity.getIconUrl())) { - MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(markerShowEntity.getIconUrl(), + GlideImageLoader.getInstance().displayImage(markerShowEntity.getIconUrl(), ivUserHead, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50), new IMogoImageLoaderListener() { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/OnlineCarMarkerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/OnlineCarMarkerView.java index 81459e5a74..9054545a85 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/OnlineCarMarkerView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/OnlineCarMarkerView.java @@ -35,11 +35,6 @@ public class OnlineCarMarkerView implements IMarkerView { return InstanceHolder.INSTANCE; } - private Object readResolve() { - // 阻止反序列化,必须实现 Serializable 接口 - return InstanceHolder.INSTANCE; - } - @Override public View getView() { return null; @@ -72,20 +67,6 @@ public class OnlineCarMarkerView implements IMarkerView { return sRef.get( vehicleType ).get(); } - public Bitmap getSelectedBitmap( int vehicleType ) { - if ( sTypedRef.get( vehicleType ) == null || sTypedRef.get( vehicleType ).get() == null - || sTypedRef.get( vehicleType ).get().isRecycled() ) { - switch ( vehicleType ) { - case 2: - sTypedRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type2 ) ) ); - break; - default: - sTypedRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray_selected ) ) ); - } - } - return sTypedRef.get( vehicleType ).get(); - } - @Override public void setMarker( IMogoMarker marker ) { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerNoveltyInfo.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerNoveltyInfo.java index fe9375e3c8..bc83bb8531 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerNoveltyInfo.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerNoveltyInfo.java @@ -1,6 +1,7 @@ package com.mogo.module.common.entity; + /** * 新鲜事儿Marker数据 */ @@ -8,9 +9,6 @@ public class MarkerNoveltyInfo { private String type; private String sn; private MarkerLocation location; - /** - * @see com.mogo.module.common.enums.EventTypeEnum - */ private String poiType; private ContentData contentData; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt index 40edb00409..f9468f192f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt @@ -447,7 +447,7 @@ enum class EventTypeEnum( fun getPoiTypeBg(poiType: String, isVrMode: Boolean): Int { return when (poiType) { FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange - TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType, + TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read @@ -463,7 +463,7 @@ enum class EventTypeEnum( FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType -> R.drawable.bg_v2x_event_type_orange TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, - FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType, FOURS_PONDING.poiType, + FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, @@ -480,7 +480,7 @@ enum class EventTypeEnum( fun isRoadEvent(poiType: String?): Boolean { return when (poiType) { TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, - FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, + FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, @@ -496,7 +496,7 @@ enum class EventTypeEnum( @JvmStatic fun isNeedRoadEventUgc(poiType: String?): Boolean { return when (poiType) { - ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType, + ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, diff --git a/modules/mogo-module-common/src/main/res/layout/modudle_services_marker_layout.xml b/modules/mogo-module-common/src/main/res/layout/modudle_services_marker_layout.xml index d056cf267e..fef5eefbac 100644 --- a/modules/mogo-module-common/src/main/res/layout/modudle_services_marker_layout.xml +++ b/modules/mogo-module-common/src/main/res/layout/modudle_services_marker_layout.xml @@ -15,7 +15,7 @@ android:background="@drawable/module_services_marker_bkg" android:layout_height="@dimen/module_service_marker_bubble_height"> - - - - - - - - - - - - - - - - diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java index c147785033..6c97ca2e98 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java @@ -9,10 +9,8 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.commons.AbsMogoApplication; import com.mogo.module.service.routeoverlay.MogoRouteOverlayManager; import com.mogo.service.module.IMogoModuleProvider; -import com.mogo.service.module.ModuleType; /** * @author congtaowang @@ -32,7 +30,7 @@ public class MogoServiceProvider implements IMogoModuleProvider { @Override public int getType() { - return ModuleType.TYPE_SERVICE; + return 0; } @NonNull @@ -63,14 +61,10 @@ public class MogoServiceProvider implements IMogoModuleProvider { @Override public void init( Context context ) { - MarkerServiceHandler.init( context ); - MogoServices.getInstance().preInit( context ); - MogoServices.getInstance().init( AbsMogoApplication.getApp() ); MogoRouteOverlayManager.getInstance().init(); } @Override public void onDestroy() { - MogoServices.getInstance().destroy(); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java deleted file mode 100644 index 5c61fa611e..0000000000 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.mogo.module.service; - -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_OTHER; - -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.net.ConnectivityManager; -import android.text.TextUtils; - -import com.mogo.commons.debug.DebugConfig; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.eagle.core.utilcode.util.NetworkUtils; -import com.mogo.map.IDestroyable; -import com.mogo.map.MogoMarkerManager; -import com.mogo.map.listener.IMogoMapListener; -import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.MogoModule; -import com.mogo.module.common.MogoModulePaths; -import com.mogo.module.service.intent.IntentHandlerFactory; -import com.mogo.module.service.receiver.MogoReceiver; -import com.mogo.realtime.api.MoGoAiCloudRealTime; -import com.mogo.service.intent.IMogoIntentListener; -import com.mogo.service.intent.IMogoIntentManager; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.IMogoStatusManager; -import com.mogo.service.statusmanager.StatusDescriptor; - -import java.util.List; - -/** - * @author congtaowang - * @since 2020-01-03 - *

- * 数据刷新策略 - *

- * 1. 位置移动触发刷新 - * 2. 用户手势交互导致地图视图移动跨过当前视图,延时 1 分钟,不累加 - * 3. 用户手势缩小比例尺级别达2级,延时 1 分钟,不累加 - * 4. 用户交互语音导致地图视图移动,缩放,不触发刷新 - */ -public class MogoServices implements IMogoMapListener, - IMogoIntentListener, - IDestroyable { - - private MogoServices() { - // private constructor - } - - private static final class InstanceHolder { - private static final MogoServices INSTANCE = new MogoServices(); - } - - public static MogoServices getInstance() { - return InstanceHolder.INSTANCE; - } - - private static final String TAG = "MogoServices"; - - private MogoReceiver mAIAssistReceiver; - private IMogoIntentManager mIntentManager; - - private Context mContext; - - private final IMogoStatusChangedListener statusChangedListener = new StatusChangedAdapter() { - - }; - - public void preInit(Context context) { - mContext = context; - IMogoStatusManager mStatusManager = MarkerServiceHandler.getMogoStatusManager(); - mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener); - mStatusManager.setAIAssistReady(TAG, AIAssist.getInstance(mContext).hasFlush()); - } - - public void init(Context context) { - - registerMogoReceiver(context); - - mIntentManager = MarkerServiceHandler.getIntentManager(); - mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_UI, this); - mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_READY, this); - mIntentManager.registerIntentListener(MogoReceiver.ACTION_MOCK, this); - mIntentManager.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this); - - Intent intent = new Intent("com.freedom.ser.ACTION"); - intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); - mContext.sendBroadcast(intent); - - if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) { - MoGoAiCloudRealTime.startRealTime(mContext, DebugConfig.getSocketAppId()); - } - } - - private void registerMogoReceiver(Context context) { - if (context == null) { - return; - } - List modules = MogoModulePaths.getModules(); - if (modules.isEmpty()) { - return; - } - mAIAssistReceiver = new MogoReceiver(context); - IntentFilter filter = new IntentFilter(); - if (!modules.isEmpty()) { - for (MogoModule module : modules) { - if (TextUtils.isEmpty(module.getBroadcastAction())) { - continue; - } - filter.addAction(module.getBroadcastAction()); - } - } - filter.addAction(MogoReceiver.VOICE_ACTION); - // 小智语音 - filter.addAction(MogoReceiver.ACTION_VOICE_UI); - filter.addAction(MogoReceiver.ACTION_VOICE_READY); - filter.addAction(MogoReceiver.ACTION_MOCK); - filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); - filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); - try { - context.getApplicationContext().registerReceiver(mAIAssistReceiver, filter); - } catch (Exception e) { - CallerLogger.INSTANCE.e(M_OLD_OTHER + TAG, "registerMogoReceiver error : " + e); - } - } - - public void clearAllData() { - try { - MogoMarkerManager.getInstance(mContext).removeMarkers(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onIntentReceived(String command, Intent intent) { - if (TextUtils.equals(command, ConnectivityManager.CONNECTIVITY_ACTION) - && NetworkUtils.isConnected(mContext)) { - mIntentManager.unregisterIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this); - } - IntentHandlerFactory.getInstance().handle(mContext, command, intent); - } - - @Override - public void destroy() { - CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "MogoServices do nothings."); - MoGoAiCloudRealTime.stopRealTime(); - } - - private boolean mLastStatusIsVr = false; - - @Override - public void onMapModeChanged(EnumMapUI mCurrentUI) { - clearAllData(); - if (mCurrentUI == EnumMapUI.MAP_STYLE_NIGHT_VR || mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR) { - if (!mLastStatusIsVr) { - MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true); - if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) { - //AIAssist.getInstance(mContext).speakTTSVoice("已开启鹰眼模式"); - } - mLastStatusIsVr = true; - } - } else { - if (mLastStatusIsVr) { - mLastStatusIsVr = false; - MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, false); - if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) { - //AIAssist.getInstance(mContext).speakTTSVoice("已退出鹰眼模式"); - } - } - } - } - -} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java index cda010c182..7a00b2e765 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -16,12 +16,6 @@ import com.mogo.module.service.receiver.AccStatusReceiver; */ public class AccStatusIntentHandler implements IntentHandler { - public static final byte ACC_ON = 1; - public static final byte ACC_OFF = 0; - public static final byte ACC_OFF_DELAY = 3; - - private static final String TAG = "AccStatusIntentHandler"; - private static volatile AccStatusIntentHandler sInstance; private AccStatusIntentHandler() { @@ -53,17 +47,6 @@ public class AccStatusIntentHandler implements IntentHandler { if ( CarSeries.isF8xxSeries() ) { MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); } - } else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) { - int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF ); - if ( state != ACC_OFF && state != ACC_ON && state != ACC_OFF_DELAY ) { - return; - } - if ( state == ACC_ON || state == ACC_OFF_DELAY ) { - Intent newIntent = new Intent( "com.freedom.ser.ACTION" ); - newIntent.putExtra( "acc", true ); - newIntent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES ); - context.sendBroadcast( newIntent ); - } } } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java index d7d7f9102d..a83f8b12cf 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java @@ -19,11 +19,9 @@ public class IntentHandlerFactory { private IntentHandlerFactory() { // private constructor - mHandlers.put( MogoReceiver.ACTION_MOCK, new MockIntentHandler() ); mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() ); mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() ); mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() ); - mHandlers.put( AccStatusReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() ); mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() ); } @@ -40,9 +38,9 @@ public class IntentHandlerFactory { return InstanceHolder.INSTANCE; } - private Map< String, IntentHandler > mHandlers = new HashMap<>(); + private final Map< String, IntentHandler > mHandlers = new HashMap<>(); - private IntentHandler DEFAULT = new EmptyIntentHandler(); + private final IntentHandler DEFAULT = new EmptyIntentHandler(); private IntentHandler getIntentHandler( String intent ) { if ( mHandlers.containsKey( intent ) && mHandlers.get( intent ) != null ) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java deleted file mode 100644 index 6d9564632a..0000000000 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ /dev/null @@ -1,587 +0,0 @@ -package com.mogo.module.service.intent; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.os.Handler; -import android.os.Message; -import android.text.TextUtils; - -import com.mogo.cloud.commons.utils.CoordinateUtils; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; -import com.mogo.eagle.core.utilcode.util.AppStateManager; -import com.mogo.map.MogoMapUIController; -import com.mogo.map.MogoMarkerManager; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.map.search.geo.IMogoGeoSearch; -import com.mogo.map.search.geo.IMogoGeoSearchListener; -import com.mogo.map.search.geo.MogoGeocodeResult; -import com.mogo.map.search.geo.MogoRegeocodeResult; -import com.mogo.map.search.geo.query.MogoRegeocodeQuery; -import com.mogo.module.common.constants.DataTypes; -import com.mogo.module.common.dialog.WMDialog; -import com.mogo.module.service.MarkerServiceHandler; -import com.mogo.module.service.R; - -import org.json.JSONObject; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.List; - -/** - * @author congtaowang - * @since 2020-04-17 - *

- * 使用控制台发送广播,这里接收intent来处理场景 - */ -public class MockIntentHandler implements IntentHandler { - - private static final String TAG = "MockIntentHandler"; - private IMogoMarker centerMarker; - - @Override - public void handle(Context context, Intent intent) { - if (!DebugConfig.isDebug()) { - return; - } - - final int oper = intent.getIntExtra("oper", -1); - switch (oper) { - case 1: - // 展示自车位置 - MogoMapUIController.getInstance().showMyLocation(intent.getBooleanExtra("status", true)); - break; - case 2: - // 发起求助 - boolean status = intent.getBooleanExtra("status", false); - MarkerServiceHandler.getMogoStatusManager().setSeekHelping(TAG, status); - break; - case 3: - String msg = intent.getStringExtra("msg"); - if (!TextUtils.isEmpty(msg)) { - TipToast.shortTip(msg); - } - break; - case 9:// 测试弹窗 - Activity activity = AppStateManager.INSTANCE.currentActivity(); - if (activity != null) { - new WMDialog.Builder(activity) - .setOkButton("确认", (dlg, which) -> dlg.dismiss()) - .setCancelButton("取消", (dlg, which) -> dlg.dismiss()) - .setContent("内容内容内容内容内容内容内容内容") - .build() - .show(); - } - break; - case 10://测试GEO查询 - IMogoGeoSearch geoSearch = CallerMapUIServiceManager.INSTANCE.getGeoSearch(context); - geoSearch.setGeoSearchListener(new IMogoGeoSearchListener() { - @Override - public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { - } - - @Override - public void onGeocodeSearched(MogoGeocodeResult geocodeResult) { - - } - }); - MogoRegeocodeQuery query = new MogoRegeocodeQuery(); - query.setLatlngType("autonavi"); - query.setPoint(new MogoLatLng(intent.getFloatExtra("lat", 39.917366f), intent.getFloatExtra("lon", 116.39962f))); - query.setRadius(1000); - geoSearch.getFromLocationAsyn(query); - break; - case 14: {//测试点的动画移动,模拟周边车辆移动 - List mogoLatLngs = new ArrayList<>(); - mogoLatLngs.add(new MogoLatLng(39.615986, 116.396716)); - mogoLatLngs.add(new MogoLatLng(39.616007, 116.396995)); - mogoLatLngs.add(new MogoLatLng(39.616012, 116.397169)); - mogoLatLngs.add(new MogoLatLng(39.616017, 116.397343)); - mogoLatLngs.add(new MogoLatLng(39.616022, 116.397517)); - mogoLatLngs.add(new MogoLatLng(39.616029, 116.397693)); - mogoLatLngs.add(new MogoLatLng(39.616039, 116.397896)); - mogoLatLngs.add(new MogoLatLng(39.616051, 116.3981)); - mogoLatLngs.add(new MogoLatLng(39.616058, 116.39827)); - mogoLatLngs.add(new MogoLatLng(39.616066, 116.398441)); - mogoLatLngs.add(new MogoLatLng(39.616074, 116.398612)); - mogoLatLngs.add(new MogoLatLng(39.616083, 116.398787)); - mogoLatLngs.add(new MogoLatLng(39.616093, 116.39899)); - mogoLatLngs.add(new MogoLatLng(39.616105, 116.399195)); - mogoLatLngs.add(new MogoLatLng(39.616112, 116.399334)); - mogoLatLngs.add(new MogoLatLng(39.61612, 116.399473)); - mogoLatLngs.add(new MogoLatLng(39.616128, 116.399612)); - mogoLatLngs.add(new MogoLatLng(39.616136, 116.399751)); - mogoLatLngs.add(new MogoLatLng(39.616148, 116.399893)); - mogoLatLngs.add(new MogoLatLng(39.616153, 116.40008)); - mogoLatLngs.add(new MogoLatLng(39.616159, 116.400301)); - mogoLatLngs.add(new MogoLatLng(39.616167, 116.400471)); - mogoLatLngs.add(new MogoLatLng(39.616175, 116.400642)); - mogoLatLngs.add(new MogoLatLng(39.616183, 116.400813)); - mogoLatLngs.add(new MogoLatLng(39.616192, 116.400988)); - mogoLatLngs.add(new MogoLatLng(39.616201, 116.401191)); - mogoLatLngs.add(new MogoLatLng(39.616213, 116.401396)); - mogoLatLngs.add(new MogoLatLng(39.616235, 116.401728)); - mogoLatLngs.add(new MogoLatLng(39.616246, 116.401986)); - mogoLatLngs.add(new MogoLatLng(39.61625, 116.402146)); - mogoLatLngs.add(new MogoLatLng(39.616255, 116.402307)); - mogoLatLngs.add(new MogoLatLng(39.61626, 116.402468)); - mogoLatLngs.add(new MogoLatLng(39.616267, 116.40263)); - mogoLatLngs.add(new MogoLatLng(39.616272, 116.402762)); - mogoLatLngs.add(new MogoLatLng(39.616277, 116.402894)); - mogoLatLngs.add(new MogoLatLng(39.616282, 116.403026)); - mogoLatLngs.add(new MogoLatLng(39.616287, 116.403158)); - mogoLatLngs.add(new MogoLatLng(39.616292, 116.40329)); - mogoLatLngs.add(new MogoLatLng(39.616297, 116.403422)); - mogoLatLngs.add(new MogoLatLng(39.616302, 116.403554)); - mogoLatLngs.add(new MogoLatLng(39.616307, 116.403686)); - mogoLatLngs.add(new MogoLatLng(39.616321, 116.403821)); - mogoLatLngs.add(new MogoLatLng(39.616331, 116.404045)); - mogoLatLngs.add(new MogoLatLng(39.616343, 116.404272)); - mogoLatLngs.add(new MogoLatLng(39.616353, 116.404551)); - mogoLatLngs.add(new MogoLatLng(39.616363, 116.404753)); - mogoLatLngs.add(new MogoLatLng(39.616375, 116.404958)); - mogoLatLngs.add(new MogoLatLng(39.616375, 116.405055)); - mogoLatLngs.add(new MogoLatLng(39.616379, 116.405184)); - mogoLatLngs.add(new MogoLatLng(39.616384, 116.405313)); - mogoLatLngs.add(new MogoLatLng(39.616389, 116.405442)); - mogoLatLngs.add(new MogoLatLng(39.616394, 116.405571)); - mogoLatLngs.add(new MogoLatLng(39.616399, 116.4057)); - mogoLatLngs.add(new MogoLatLng(39.616404, 116.405829)); - mogoLatLngs.add(new MogoLatLng(39.616409, 116.405958)); - mogoLatLngs.add(new MogoLatLng(39.616414, 116.406087)); - mogoLatLngs.add(new MogoLatLng(39.616419, 116.406216)); - mogoLatLngs.add(new MogoLatLng(39.616424, 116.406345)); - mogoLatLngs.add(new MogoLatLng(39.616429, 116.406474)); - mogoLatLngs.add(new MogoLatLng(39.61644, 116.406611)); - mogoLatLngs.add(new MogoLatLng(39.616461, 116.406879)); - mogoLatLngs.add(new MogoLatLng(39.616465, 116.407033)); - mogoLatLngs.add(new MogoLatLng(39.616469, 116.407187)); - mogoLatLngs.add(new MogoLatLng(39.616473, 116.407341)); - mogoLatLngs.add(new MogoLatLng(39.616477, 116.407495)); - mogoLatLngs.add(new MogoLatLng(39.616483, 116.407694)); - mogoLatLngs.add(new MogoLatLng(39.616493, 116.407876)); - mogoLatLngs.add(new MogoLatLng(39.616504, 116.408059)); - mogoLatLngs.add(new MogoLatLng(39.616515, 116.408327)); - mogoLatLngs.add(new MogoLatLng(39.616526, 116.408596)); - mogoLatLngs.add(new MogoLatLng(39.616536, 116.408757)); - mogoLatLngs.add(new MogoLatLng(39.616547, 116.409025)); - mogoLatLngs.add(new MogoLatLng(39.616556, 116.409227)); - mogoLatLngs.add(new MogoLatLng(39.616568, 116.409432)); - mogoLatLngs.add(new MogoLatLng(39.616579, 116.409711)); - mogoLatLngs.add(new MogoLatLng(39.61659, 116.409914)); - mogoLatLngs.add(new MogoLatLng(39.616601, 116.410119)); - mogoLatLngs.add(new MogoLatLng(39.616601, 116.410387)); - mogoLatLngs.add(new MogoLatLng(39.616601, 116.410602)); - mogoLatLngs.add(new MogoLatLng(39.616622, 116.410816)); - mogoLatLngs.add(new MogoLatLng(39.616633, 116.411084)); - mogoLatLngs.add(new MogoLatLng(39.616643, 116.411395)); - mogoLatLngs.add(new MogoLatLng(39.616654, 116.411492)); - mogoLatLngs.add(new MogoLatLng(39.616665, 116.411771)); - mogoLatLngs.add(new MogoLatLng(39.616674, 116.411974)); - mogoLatLngs.add(new MogoLatLng(39.616686, 116.412178)); - mogoLatLngs.add(new MogoLatLng(39.616697, 116.412447)); - mogoLatLngs.add(new MogoLatLng(39.616697, 116.412586)); - mogoLatLngs.add(new MogoLatLng(39.616718, 116.412876)); - mogoLatLngs.add(new MogoLatLng(39.616729, 116.413144)); - mogoLatLngs.add(new MogoLatLng(39.616738, 116.413347)); - mogoLatLngs.add(new MogoLatLng(39.61675, 116.413551)); - mogoLatLngs.add(new MogoLatLng(39.61675, 116.41383)); - mogoLatLngs.add(new MogoLatLng(39.616761, 116.414002)); - mogoLatLngs.add(new MogoLatLng(39.616761, 116.414098)); - mogoLatLngs.add(new MogoLatLng(39.616767, 116.414279)); - mogoLatLngs.add(new MogoLatLng(39.616774, 116.414461)); - mogoLatLngs.add(new MogoLatLng(39.616782, 116.414645)); - mogoLatLngs.add(new MogoLatLng(39.616792, 116.41483)); - mogoLatLngs.add(new MogoLatLng(39.616802, 116.415016)); - mogoLatLngs.add(new MogoLatLng(39.616814, 116.415203)); - mogoLatLngs.add(new MogoLatLng(39.616824, 116.415395)); - mogoLatLngs.add(new MogoLatLng(39.616836, 116.415589)); - mogoLatLngs.add(new MogoLatLng(39.616842, 116.415745)); - mogoLatLngs.add(new MogoLatLng(39.616849, 116.415902)); - mogoLatLngs.add(new MogoLatLng(39.616857, 116.416061)); - mogoLatLngs.add(new MogoLatLng(39.616868, 116.416307)); - MogoMarkerOptions options = new MogoMarkerOptions(); - options.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray)) - .position(mogoLatLngs.get(0)) - .owner(TAG) - .autoManager(false); - int duration = intent.getIntExtra("duration", 30); - IMogoMarker marker = MogoMarkerManager.getInstance(context).addMarker(TAG, options); - if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) { - MogoMapUIController.getInstance().moveToCenter(mogoLatLngs.get(0)); - } - WorkThreadHandler.getInstance().post(() -> marker.startSmooth(mogoLatLngs, duration)); - break; - } - case 17:// 查询在线车辆数据 - DebugConfig.setRequestOnlineCarData(intent.getBooleanExtra("status", true)); - break; - case 18:// 设置是否使用自研地图 - TipToast.shortTip("设置完成,下次启动生效"); - SharedPrefsMgr.getInstance(context).putBoolean("useCustomMap", intent.getBooleanExtra("useCustomMap", false)); - break; - case 30:// 强制刷新地图 - MogoMapUIController.getInstance().forceRender(); - break; - case 31:// - Intent intent3 = new Intent(); - intent3.setAction("AUTONAVI_STANDARD_BROADCAST_RECV"); - intent3.putExtra("KEY_TYPE", 12404); - intent3.putExtra("EXTRA_REQUEST_AUTO_STATE", 0); - context.sendBroadcast(intent3); - break; - case 33:// 测试小智语音 - AIAssist.getInstance(context).speakTTSVoice("庞帆说这个是一个 hard coding."); - break; - case 36:// 测试打点功能 - MogoLatLng center = MogoMapUIController.getInstance() - .getWindowCenterLocation(); - centerMarker = MogoMarkerManager.getInstance(context) - .addMarker(TAG, new MogoMarkerOptions() - .position(center) - .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.bg_map_marker_red))); - break; - case 37:// 销毁测试打点 - if (centerMarker != null) { - centerMarker.destroy(); - } - break; - case 38:// 控制RTK - MogoMapUIController.getInstance() - .rtkEnable(false); - break; - case 40: - double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375}, - {40.20258331298828, 116.74071502685547}, - {40.202598571777344, 116.74067687988281}, - {40.20256805419922, 116.74071502685547}, - {40.202598571777344, 116.74064636230469}, - {40.20258712768555, 116.74067687988281}, - {40.202579498291016, 116.74068450927734}, - {40.202545166015625, 116.7406005859375}, - {40.202571868896484, 116.74054718017578}, - {40.20256042480469, 116.74057006835938}, - {40.202510833740234, 116.74053192138672}, - {40.202552795410156, 116.74053955078125}, - {40.202537536621094, 116.74044799804688}, - {40.202552795410156, 116.74042510986328}, - {40.202510833740234, 116.74038696289062}, - {40.202537536621094, 116.74044799804688}, - {40.202552795410156, 116.74042510986328}, - {40.202518463134766, 116.74039459228516}, - {40.202537536621094, 116.74038696289062}, - {40.202552795410156, 116.74036407470703}, - {40.20252227783203, 116.7403335571289}, - {40.20253372192383, 116.74038696289062}, - {40.202552795410156, 116.74036407470703}, - {40.2025260925293, 116.7403335571289}, - {40.20253372192383, 116.74030303955078}, - {40.20254898071289, 116.74028778076172}, - {40.20252990722656, 116.7402572631836}, - {40.2025260925293, 116.740234375}, - {40.202545166015625, 116.74022674560547}, - {40.20252990722656, 116.74020385742188}, - {40.20254898071289, 116.74014282226562}, - {40.20253372192383, 116.74011993408203}, - {40.2025260925293, 116.74014282226562}, - {40.20254898071289, 116.74014282226562}, - {40.202537536621094, 116.74011993408203}, - {40.2025260925293, 116.74014282226562}, - {40.20255661010742, 116.74008178710938}, - {40.20254135131836, 116.74005889892578}, - {40.20252990722656, 116.74007415771484}, - {40.20254898071289, 116.74008178710938}, - {40.20254135131836, 116.74005889892578}, - {40.20252227783203, 116.74006652832031}, - {40.20254898071289, 116.74002838134766}, - {40.20254135131836, 116.74000549316406}, - {40.20252227783203, 116.73999786376953}, - {40.20269012451172, 116.73983001708984}, - {40.20265579223633, 116.73978424072266}, - {40.202667236328125, 116.7397689819336}, - {40.20264434814453, 116.73973083496094}, - {40.202632904052734, 116.7397689819336}, - {40.202613830566406, 116.73974609375}, - {40.2026252746582, 116.73970794677734}, - {40.202613830566406, 116.73968505859375}, - {40.202598571777344, 116.73970031738281}, - {40.20258712768555, 116.73969268798828}, - {40.20258712768555, 116.73961639404297}, - {40.202579498291016, 116.73960876464844}, - {40.20257568359375, 116.7396240234375}, - {40.20256805419922, 116.73960876464844}, - {40.20256042480469, 116.73941802978516}, - {40.20255661010742, 116.73941802978516}, - {40.20256042480469, 116.73941802978516}, - {40.20254898071289, 116.73941802978516}, - {40.20255661010742, 116.7393569946289}, - {40.20254898071289, 116.7393569946289}, - {40.20256042480469, 116.7393569946289}, - {40.20254898071289, 116.7393569946289}, - {40.20255661010742, 116.73928833007812}, - {40.202545166015625, 116.7392807006836}, - {40.20254898071289, 116.73928833007812}, - {40.20254135131836, 116.7392807006836}}; - for (double[] coor : coors) { - double lat = coor[0], lon = coor[1]; - double[] translateCoor = CoordinateUtils.transformWgsToGcj(lat, lon); - double[] originCoor = CoordinateUtils.transformGcj02toWgs84(translateCoor[1], translateCoor[0]); - double delta = CoordinateUtils.calculateLineDistance(lon, lat, originCoor[0], originCoor[1]); - } - break; - - case 42:// - WorkThreadHandler.getInstance().post(() -> { - try { - InputStream is = context.getAssets().open("coors.json"); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - String line = ""; - List vals = new ArrayList<>(); - while ((line = br.readLine()) != null) { - String[] json = line.split(" - "); - long time = Long.parseLong(json[0]); - AutopilotCarStateInfo si = GsonUtil.objectFromJson(json[1], AutopilotCarStateInfo.class); -// si.getValues().setSatelliteTime( time + "" ); - vals.add(si); - } - long interval = -1; - AutopilotCarStateInfo last = null; - for (AutopilotCarStateInfo val : vals) { - if (last == null) { - interval = 0; - } else { - interval = Long.parseLong(val.getValues().getSatelliteTime()) - Long.parseLong(last.getValues().getSatelliteTime()); - } - last = val; - WorkThreadHandler.getInstance().postDelayed(() -> onAdasCarDataCallback(val), interval); - } - } catch (Exception e) { - e.printStackTrace(); - } - }); - break; - case 46:// 模拟鹰眼模式下绘制车辆周边的数据 - mTimeTickHandler.sendEmptyMessageDelayed(1, 0L); - break; - case 48:// 模拟3D模型绘制 - MogoMarkerOptions options = new MogoMarkerOptions() - .owner(DataTypes.TYPE_MARKER_ADAS) - .anchor(0.5f, 0.5f) - .set3DMode(true) - .position(new MogoLatLng(39.981971055705, 116.41150648393)) - .gps(true) - .controlAngle(true) - .icon3DRes(R.raw.special_vehicle) - .rotate((float) 358.526123); - IMogoMarker marker = MogoMarkerManager.getInstance(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options); - List latLngs = new ArrayList<>(); - latLngs.add(new MogoLatLng(39.981971055705, 116.41150648393)); - latLngs.add(new MogoLatLng(39.981990561932, 116.412893641626)); - marker.startSmoothInMs(latLngs, 20_000L); - break; - case 49:// 绘制marker - // 39.96741320378243, 116.41045709250723 - // 39.98232698552779,116.41879656379113; - MogoMarkerOptions options1 = new MogoMarkerOptions() - .owner(DataTypes.TYPE_MARKER_ADAS) - .anchor(0.5f, 0.5f) - .set3DMode(false) - .position(new MogoLatLng(39.96741320378243, 116.41045709250723)) - .gps(true) - .controlAngle(false) - .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.sy)) - .rotate((float) 358.526123); - IMogoMarker marker1 = MogoMarkerManager.getInstance(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options1); - MogoMarkerOptions options2 = new MogoMarkerOptions() - .owner(DataTypes.TYPE_MARKER_ADAS) - .anchor(0.5f, 0.5f) - .set3DMode(false) - .position(new MogoLatLng(39.98232698552779, 116.41879656379113)) - .gps(true) - .controlAngle(false) - .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.sr)) - .rotate((float) 358.526123); - IMogoMarker marker2 = MogoMarkerManager.getInstance(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options2); - MogoMarkerOptions options3 = new MogoMarkerOptions() - .owner(DataTypes.TYPE_MARKER_ADAS) - .anchor(0.5f, 0.5f) - .set3DMode(false) - .position(new MogoLatLng(39.97631642243, 116.418249382739)) - .gps(true) - .controlAngle(false) - .icon(BitmapFactory.decodeResource(context.getResources(), R.drawable.bg_map_marker_red)) - .rotate((float) 358.526123); - IMogoMarker marker3 = MogoMarkerManager.getInstance(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options3); - break; - case 53:// 控制 Adas识别 是否可用 - boolean isUseAdasRecognize = intent.getBooleanExtra("status", false); - DebugConfig.setUseAdasRecognize(isUseAdasRecognize); - break; - case 56: - // 开启数据采集 自车定位和视觉识别 - break; - } - } - - private BufferedReader roadSizeBr; - private JSONObject locJo = null; - - /** - * 处理模拟单Loc数据意图 - */ - private void handleMockSingleLocDataIntent() throws Exception { - if (locJo == null) { - String locLine = "{\"systemTime\":1615529718585,\"satelliteTime\":1615529718585,\"lon\":116.73573385415098,\"lat\":40.19907712731953,\"alt\":34.4018669128417,\"heading\":0.342695406938048,\"speed\":0.003303937}"; - locJo = new JSONObject(locLine); - locJo.put("satelliteTime", System.currentTimeMillis()); - locJo.put("systemTime", System.currentTimeMillis()); - } - MogoMapUIController.getInstance().syncLocation2Map(locJo); - mLocationMockHandler.sendEmptyMessageDelayed(100, 50L); - } - - - public void onAdasCarDataCallback(AutopilotCarStateInfo stateInfo) { - if (stateInfo != null && stateInfo.getValues() != null) { - JSONObject data = new JSONObject(); - try { - data.putOpt("lon", stateInfo.getValues().getLon()); - data.putOpt("lat", stateInfo.getValues().getLat()); - data.putOpt("alt", stateInfo.getValues().getAlt()); - data.putOpt("speed", stateInfo.getValues().getGnss_speed()); - data.putOpt("satelliteTime", stateInfo.getValues().getSatelliteTime()); - data.putOpt("heading", stateInfo.getValues().getHeading()); - data.putOpt("acceleration", stateInfo.getValues().getAcceleration()); - data.putOpt("yawRate", stateInfo.getValues().getYaw_rate()); - MogoMapUIController.getInstance().syncLocation2Map(data); -// SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data ); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - - private final Handler mLocationMockHandler = new Handler(WorkThreadHandler.newInstance("loc-mock-thread").getLooper()) { - @Override - public void handleMessage(Message msg) { - super.handleMessage(msg); - // 模拟处理当前车辆位置 - if (msg.what == 1) { - try { - if (!handleMockLocationIntent()) { - br.close(); - br = null; - } - } catch (Exception e) { - try { - br.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - br = null; - } - } - // 模拟单个车数据 - else if (msg.what == 100) { - try { - handleMockSingleLocDataIntent(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - }; - - - private final Handler mLocationMockHandler1 = new Handler(WorkThreadHandler.newInstance("loc-mock-thread1").getLooper()) { - @Override - public void handleMessage(Message msg) { - super.handleMessage(msg); - if (msg.what == 1) { - try { - if (!handleMockLocationIntent()) { - br.close(); - br = null; - } - } catch (Exception e) { - try { - br.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - br = null; - } - } - } - }; - - private long mLocDelay = 0; - - private final Handler mTimeTickHandler = new Handler(WorkThreadHandler.newInstance("loc-mock-thread2").getLooper()) { - @Override - public void handleMessage(Message msg) { - super.handleMessage(msg); - mLocDelay += 50; - // 这里处理自车移动,延时4秒 - if (mLocDelay > 4_000L) { - mLocationMockHandler1.sendEmptyMessageDelayed(1, 0L); - } - mLocationMockHandler.sendEmptyMessageDelayed(3, 0L); - // 延时50毫秒重复发送自己 - mTimeTickHandler.sendEmptyMessageDelayed(0, 50L); - } - }; - - private final Handler mTimeTickCarHandler = new Handler(WorkThreadHandler.newInstance("loc-time-mock-thread").getLooper()) { - @Override - public void handleMessage(Message msg) { - super.handleMessage(msg); - mLocDelay += 50; - if (mLocDelay > 4_000L) { - mLocationMockHandler1.sendEmptyMessageDelayed(1, 0L); - } - mLocationMockHandler.sendEmptyMessageDelayed(8, 0L); - mTimeTickCarHandler.sendEmptyMessageDelayed(0, 50L); - } - }; - - private BufferedReader br; - - /** - * 处理模拟位置意图 - */ - private boolean handleMockLocationIntent() throws Exception { - if (br == null) { - br = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("loc.txt"))); - } - final long start = System.currentTimeMillis(); - String line = br.readLine(); - if (line == null) { - throw new Exception("end of file."); - } - JSONObject jo = new JSONObject(line); - //改变rtk定位数据,触发自车移动 - MogoMapUIController.getInstance().syncLocation2Map(jo); - return true; - } - - private BufferedReader[] readers = null; - private BufferedReader[] readers2 = null; - -} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index 0a56407ba4..75b7357d08 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -46,8 +46,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener { private static final String TAG = "MapMarkerManager"; private Context mContext; - // 最后一次选中的气泡 - private IMogoMarker mLastCheckMarker; private static MapMarkerManager mMarkerManager; private RefreshModel mRefreshModel; @@ -87,123 +85,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener { */ @Override public boolean onMarkerClicked(IMogoMarker marker) { - try { - boolean result = switchMarkerOpenStatus(marker); - if (!result) { - return false; - } - } catch (Exception e) { - e.printStackTrace(); - } return false; } - /** - * 切换当前选中marker和上一个选中的状态 - * - * @param marker 地图marker抽象对象 - * @return markerOpenStatus - */ - private boolean switchMarkerOpenStatus(IMogoMarker marker) { - if (mLastCheckMarker != null) { - // 判断点击的是否是同一个 - if (marker.equals(mLastCheckMarker)) { - return false; - } - // 将上次选中 Marker 设置为未选中状态 - closeMarker(mLastCheckMarker); - } - // 将当前的Marker设置为选中 - openMarker(marker); - return true; - } - - // 展开气泡 - private void openMarker(IMogoMarker mogoMarker) { - if (mogoMarker == null) { - return; - } - mLastCheckMarker = mogoMarker; - // 在线车辆点击使用infoWindow - if (!TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) { - Object object = mogoMarker.getObject(); - if (object instanceof MarkerShowEntity) { - MarkerShowEntity markerShowEntity = (MarkerShowEntity) object; - markerShowEntity.setChecked(true); - IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions()); - markerView.setMarker(mogoMarker); - if (markerView instanceof OnlineCarMarkerView) { - try { - mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType())); - } catch (Exception e) { - mogoMarker.setIcon(markerView.getBitmap(0)); - } - } else { - if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) { - mogoMarker.hideInfoWindow(); - mogoMarker.showInfoWindow(); - } else { - mogoMarker.setIcon(ViewUtils.fromView(markerView.getView())); - } - } - mogoMarker.setToTop(); - } - } - if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) { - MogoMapUIController.getInstance().moveToCenter(mogoMarker.getPosition(), true); - } - } - - // 折叠气泡 - private void closeMarker(IMogoMarker mogoMarker) { - if (mogoMarker == null) { - return; - } - // 在线车辆点击使用infoWindow - if (TextUtils.equals(mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA)) { - mogoMarker.setIcon(OnlineCarMarkerView.getInstance().getBitmap(getCarVehicleType(mogoMarker))); - } else { - Object object = mogoMarker.getObject(); - if (object != null) { - MarkerShowEntity markerShowEntity = (MarkerShowEntity) object; - markerShowEntity.setChecked(false); - IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions()); - markerView.setMarker(mogoMarker); - if (markerView instanceof OnlineCarMarkerView) { - try { - mogoMarker.setIcon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType())); - } catch (Exception e) { - mogoMarker.setIcon(markerView.getBitmap(0)); - } - } else { - if (MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) { - mogoMarker.hideInfoWindow(); - mogoMarker.showInfoWindow(); - } else { - mogoMarker.setIcon(ViewUtils.fromView(markerView.getView())); - } - } - } - } - } - - /** - * 获取特殊车辆类型 - * - * @param marker - * @return - */ - private int getCarVehicleType(IMogoMarker marker) { - try { - return ((MarkerOnlineCar) - ((MarkerShowEntity) marker.getObject()).getBindObj()) - .getCarInfo() - .getVehicleType(); - } catch (Exception e) { - return 0; - } - } - /** * 绘制Marker,这里绘制的会使用markerShowEntities队列进行维护 * @@ -258,31 +142,25 @@ public class MapMarkerManager implements IMogoMarkerClickListener { return; } - mRefreshModel.queryOnLineCarWithRoute(latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() { - @Override - public void onSuccess(Object o) { - MarkerResponse data = (MarkerResponse) o; - MarkerCardResult result = data.getResult(); - if (result == null) { - return; - } - - List onlineCarList = result.getOnlineCar(); - final int size = onlineCarList == null ? 0 : onlineCarList.size(); - - if (mMarkerDisplayBounds == null) { - mMarkerDisplayBounds = new Rect( - ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin), - ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin), - ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin), - ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin) - ); - } - - runOnTargetThread(() -> { - UiThreadHandler.postDelayed(runnable, SMOOTH_DURATION * 1000); - }); + mRefreshModel.queryOnLineCarWithRoute(latLng, onlyFocus, onlySameCity, radius, limit, false, o -> { + MarkerResponse data = (MarkerResponse) o; + MarkerCardResult result = data.getResult(); + if (result == null) { + return; } + + if (mMarkerDisplayBounds == null) { + mMarkerDisplayBounds = new Rect( + ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin), + ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin), + ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin), + ResourcesHelper.getDimensionPixelSize(AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin) + ); + } + + runOnTargetThread(() -> { + UiThreadHandler.postDelayed(runnable, SMOOTH_DURATION * 1000); + }); }); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/AccStatusReceiver.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/AccStatusReceiver.java index dc256a9477..4587001bba 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/AccStatusReceiver.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/AccStatusReceiver.java @@ -4,29 +4,12 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.intent.IntentHandlerFactory; -public -/** - * @author congtaowang - * @since 2020/6/19 - * - * 描述 - */ -class AccStatusReceiver extends BroadcastReceiver { +public class AccStatusReceiver extends BroadcastReceiver { - private static final String TAG = "AccStatusReceiver"; - - // 诺威达 acc 状态 - public static final String PARAM_ACC_STATUS = "extra_mcu_state"; - - // 诺威达 acc 状态 - public static final String ACTION_NWD_ACC = "com.nwd.action.ACTION_MCU_STATE_CHANGE"; - @Override public void onReceive( Context context, Intent intent ) { - MarkerServiceHandler.init( context ); IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent ); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java index 8cec63deca..98ed106e41 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java @@ -33,8 +33,6 @@ public class MogoReceiver extends BroadcastReceiver { */ public static final String ACTION_VOICE_READY = "com.zhidao.auto.AIAssist.ready"; - public static final String ACTION_MOCK = "com.mogo.mock"; - private final IMogoIntentManager mMogoIntentManager; public MogoReceiver(Context context) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/utils/MortonCode.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/utils/MortonCode.java deleted file mode 100644 index 2e8196e40e..0000000000 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/utils/MortonCode.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.mogo.module.service.utils; - -import java.util.Arrays; - -/** - * 莫顿编码 - * - * @author linyang - * @since 2020.07.09 - */ -public class MortonCode { - - /** - * morton 转 经纬度 时的中间常量 - */ - private static final long NDS_180_DEGREES = 0x7fffffff; - - /** - * morton 转 经纬度 时的中间常量 - */ - private static final long NDS_360_DEGREES = 4294967295L; - - /** - * morton 转 经纬度 时的中间常量 - */ - private static final long NDS_90_DEGREES = 0x3fffffff; - - /** - * 经纬度转 morton 时的中间常量 - */ - private static final double RULE_MORTON = Math.pow( 2, 32 ) / 360; - - /** - * morton 转 经纬度 时的中间常量 - */ - private static final double RULE_MORTON_TO_LONLAT = 360.0 / Math.pow( 2, 32 ); - - /** - * 编码 morton code - * - * @param lon - * @param lat - * @return - */ - public static long encodeMorton( Double lon, Double lat ) { - - Long bit = 1L; - long mortonCode = 0L; - long x = ( long ) ( lon * RULE_MORTON ); - long y = ( long ) ( lat * RULE_MORTON ); - - if ( y < 0 ) { - y += 0x7FFFFFFF; - } - y = y << 1; - for ( int i = 0; i < 32; i++ ) { - // x-part - mortonCode = mortonCode | ( x & bit ); - x = x << 1; - bit = bit << 1; - // y-part - mortonCode = mortonCode | ( y & bit ); - y = y << 1; - bit = bit << 1; - } - - return mortonCode; - } - - /** - * 将莫顿码解码为坐标 - * - * @param mortonCode - * @return - */ - public static double[] decodeMorton( long mortonCode ) { - long[] midPoint = mortonCodeToCoord( mortonCode ); - normalizeCoord( midPoint ); - double[] point = new double[2]; - - // 将经纬度长整数转化为 浮点类型 - point[0] = midPoint[0] * RULE_MORTON_TO_LONLAT; - point[1] = midPoint[1] * RULE_MORTON_TO_LONLAT; - return point; - } - - /** - * 莫顿码分别拆解为 编码后的经纬度长整数 - * - * @param mortonCode - * @return - */ - private static long[] mortonCodeToCoord( long mortonCode ) { - long bit = 1L; - long[] longPoint = new long[2]; - - for ( int i = 0; i < 32; i++ ) { - longPoint[0] |= mortonCode & bit; - mortonCode >>= 1; - longPoint[1] |= mortonCode & bit; - bit <<= 1; - } - return longPoint; - } - - /** - * 对编码后的经纬度长整数进行解码 - * - * @param midPoint - */ - private static void normalizeCoord( long[] midPoint ) { - // if x > 180 degrees, then subtract 360 degrees - if ( midPoint[0] > NDS_180_DEGREES ) { - midPoint[0] -= - NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well - } else if ( midPoint[0] < -NDS_180_DEGREES ) // if x < 180 , x += 360 - { - midPoint[0] += - NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well - } - - // if y > 90 degrees, then subtract 180 degrees - if ( midPoint[1] > NDS_90_DEGREES ) { - midPoint[1] -= - NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well - } else if ( midPoint[1] < -NDS_90_DEGREES ) // if y < 90, y += 180 - { - midPoint[1] += - NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well - } - return; - } - - - public static void main( String[] args ) { - System.out.println( encodeMorton( 116.39584, 39.98152 ) ); - System.out.println( Arrays.toString( decodeMorton( 1415388919630379091L ) ) ); - } -} diff --git a/modules/mogo-module-service/src/main/res/drawable-ldpi/icon_map_marker_car_gray_selected.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/icon_map_marker_car_gray_selected.png deleted file mode 100644 index b701a8aae2..0000000000 Binary files a/modules/mogo-module-service/src/main/res/drawable-ldpi/icon_map_marker_car_gray_selected.png and /dev/null differ diff --git a/modules/mogo-module-service/src/main/res/drawable-mdpi/icon_map_marker_car_gray_selected.png b/modules/mogo-module-service/src/main/res/drawable-mdpi/icon_map_marker_car_gray_selected.png deleted file mode 100644 index b701a8aae2..0000000000 Binary files a/modules/mogo-module-service/src/main/res/drawable-mdpi/icon_map_marker_car_gray_selected.png and /dev/null differ diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_car_gray_selected.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_car_gray_selected.png deleted file mode 100644 index 725a560b4f..0000000000 Binary files a/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_car_gray_selected.png and /dev/null differ diff --git a/modules/mogo-module-service/src/main/res/layout/modudle_services_marker_info_window_layout.xml b/modules/mogo-module-service/src/main/res/layout/modudle_services_marker_info_window_layout.xml index a1f1d3dafb..a456d5b3dd 100644 --- a/modules/mogo-module-service/src/main/res/layout/modudle_services_marker_info_window_layout.xml +++ b/modules/mogo-module-service/src/main/res/layout/modudle_services_marker_info_window_layout.xml @@ -19,7 +19,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - * 埋点业务接口 - */ -@Keep -public interface IMogoAnalytics extends IProvider { - - /** - * 埋点 - * - * @param event 事件名称 - * @param properties 埋点参数 - */ - @Keep - @Deprecated - void track( String event, Map< String, Object > properties ); -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/FragmentDescriptor.java b/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/FragmentDescriptor.java deleted file mode 100644 index 0e60baa11e..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/FragmentDescriptor.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.mogo.service.fragmentmanager; - -import androidx.fragment.app.Fragment; - -/** - * @author congtaowang - * @since 2020-01-08 - *

- * 加入栈中的fragment - */ -public class FragmentDescriptor { - - private Fragment mFragment; - - private String mTag; - /** - * 是否需要主页面的UI联动 - */ - private boolean mNotifyMainModule = true; - - /** - * 是否有进入动画 - */ - private boolean mHasTransition = false; - - public FragmentDescriptor() { - } - - public Fragment getFragment() { - return mFragment; - } - - public String getTag() { - return mTag; - } - - public boolean isNotifyMainModule() { - return mNotifyMainModule; - } - - public boolean hasTransition() { - return mHasTransition; - } - - public static class Builder { - - private FragmentDescriptor descriptor; - - public Builder() { - descriptor = new FragmentDescriptor(); - } - - public Builder fragment( Fragment fragment ) { - descriptor.mFragment = fragment; - return this; - } - - public Builder tag( String tag ) { - descriptor.mTag = tag; - return this; - } - - public Builder notifyMainModule( boolean notify ) { - descriptor.mNotifyMainModule = notify; - return this; - } - - public Builder hasTransition( boolean hasTransition ) { - descriptor.mHasTransition = hasTransition; - return this; - } - - public FragmentDescriptor build() { - return descriptor; - } - } -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/FragmentStackTransactionListener.java b/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/FragmentStackTransactionListener.java deleted file mode 100644 index 67c1fa3642..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/FragmentStackTransactionListener.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.service.fragmentmanager; - -/** - * @author congtaowang - * @since 2020-01-08 - *

- * fragment 栈发生变化 - */ -public interface FragmentStackTransactionListener { - - /** - * @param size 栈内的fragment数量 - */ - void onTransaction( int size ); -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IFragmentProvider.java b/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IFragmentProvider.java deleted file mode 100644 index d7e96a313c..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IFragmentProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.service.fragmentmanager; - -import android.os.Bundle; - -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; - -import com.alibaba.android.arouter.facade.template.IProvider; - -public -/** - * @author congtaowang - * @since 2020/9/1 - * - * 描述 - */ -interface IFragmentProvider extends IProvider { - - Fragment createFragment( FragmentActivity activity, int containerId, Bundle date ); - - public void onDestroy(); -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java b/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java deleted file mode 100644 index 6770fd9477..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.mogo.service.fragmentmanager; - -import androidx.appcompat.app.AppCompatActivity; - -import com.alibaba.android.arouter.facade.template.IProvider; - -/** - * @author congtaowang - * @since 2020-01-08 - *

- * fragment 管理接口 - */ -public interface IMogoFragmentManager extends IProvider { - - /** - * 显示fragment并加入回退栈 - * - * @param descriptor fragment描述 - */ - void push( FragmentDescriptor descriptor ); - - /** - * 将当前 fragment 出栈 - */ - void pop(); - - /** - * 栈大小 - * - * @return 栈内的 fragment 数量 - */ - int getStackSize(); - - /** - * 退出栈中所有fragment - */ - void clearAll(); - - /** - * 主页注册栈变化监听 - * - * @param listener - */ - void registerMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ); - - /** - * 主页移除栈变化监听 - */ - void unregisterMainFragmentStackTransactionListener(); - - /** - * 其他注册栈变化监听 - * - * @param listener - */ - void addMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ); - - /** - * 移除其他注册栈变化监听 - * - * @param listener - */ - void removeMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ); - - /** - * 初始化 - * - * @param activity - * @param containerId - */ - void init( AppCompatActivity activity, int containerId ); - - /** - * 缓存历史消息 - * - * @param layoutId - */ - void initMessageHistoryContainerId( int layoutId ); - - int getMessageHistoryContainerId(); - - void destroy(); -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/IMogoImageloader.java b/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/IMogoImageloader.java deleted file mode 100644 index 494cb542ba..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/imageloader/IMogoImageloader.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.mogo.service.imageloader; - -import android.content.Context; - -import androidx.annotation.Keep; - -import com.alibaba.android.arouter.facade.template.IProvider; - -/** - * @author congtaowang - * @since 2019-12-23 - *

- * 图片接口,使用 - */ -@Keep -public interface IMogoImageloader extends IProvider { - - /** - * 加载图片 - * - * @param url 图片地址 - * @param imageView 特定的图片控件 - */ - @Keep - void displayImage( String url, MogoImageView imageView ); - - /** - * 加载图片 - * - * @param url 图片地址 - * @param imageView 图片控件 - * @param width 图片宽度 - * @param height 图片高度 - */ - @Keep - void displayImage( String url, MogoImageView imageView, int width, int height ); - - /** - * 加载图片 - * - * @param url 图片地址 - * @param imageView 图片控件 - * @param width 图片宽度 - * @param height 图片高度 - * @param listener 加载回调 - */ - @Keep - void displayImage( String url, MogoImageView imageView, int width, int height, final IMogoImageLoaderListener listener ); - - /** - * 加载图片 - * - * @param url 图片地址 - * @param imageView 图片控件 - * @param listener 加载回调 - */ - @Keep - void displayImage( String url, MogoImageView imageView, final IMogoImageLoaderListener listener ); - - /** - * 下载图片 - * - * @param context - * @param url 图片地址 - * @param listener 下载回调 - */ - @Keep - void downloadImage( Context context, String url, IMogoImageLoaderListener listener ); - - /** - * 请勿调用 - */ - @Keep - void destroy(); -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleProvider.java b/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleProvider.java index e6da176758..cf7c50e52a 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleProvider.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleProvider.java @@ -47,8 +47,6 @@ public interface IMogoModuleProvider extends IProvider { /** * 是哪种类型的提供者 *

- * {@link ModuleType} - * * @return */ int getType(); diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java b/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java deleted file mode 100644 index 664b3120e4..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.service.module; - -/** - * @author congtaowang - * @since 2020-01-03 - *

- * 模块类型 - */ -public interface ModuleType { - /** - * 服务类型的模块 - */ - int TYPE_SERVICE = 3; -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/v2x/DisplayEffectsInterface.java b/services/mogo-service-api/src/main/java/com/mogo/service/v2x/DisplayEffectsInterface.java deleted file mode 100644 index e89e7dfdc0..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/v2x/DisplayEffectsInterface.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.service.v2x; - -import com.alibaba.android.arouter.facade.template.IProvider; - -/** - * created by wujifei on 2021/3/30 15:41 - * describe: - */ -public interface DisplayEffectsInterface extends IProvider { - /** - * 展示浓雾等极端事件特殊效果 - * @param type 效果类型 - */ - void displayEffects(String type); -} diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java b/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java deleted file mode 100644 index 5993c28ca4..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/windowview/IMogoTopViewManager.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.mogo.service.windowview; - -import android.view.View; -import android.view.ViewGroup; - -import com.alibaba.android.arouter.facade.template.IProvider; - -/** - * 管理1/2屏界面的增添,为了配合导航展示新增接口 - */ -public interface IMogoTopViewManager extends IProvider { - /** - * 在1/2屏添加一个view,如果没显示,会有动画 - * 给了一个默认的LayoutParams(MatchParent,dp_350) - * - * @param view 增加的view - */ - void addView(View view); - - /** - * 在1/2屏添加一个view,如果没显示,会有动画,可通过设置监听,来监听增加的view的状态 - * 给了一个默认的LayoutParams(MatchParent,dp_350) - * - * @param statusListener 状态监听 - * @param view 增加的view - */ - void addView(View view, IMogoTopViewStatusListener statusListener); - - /** - * 在1/2屏添加一个view,如果没显示,会有动画 - * - * @param view 增加的view - * @param params 相关参数 - */ - void addView(View view, ViewGroup.LayoutParams params); - - /** - * 在1/2屏添加一个view,如果没显示,会有动画,可通过设置监听,来监听增加的view的状态 - * - * @param view 增加的view - * @param params 相关参数 - * @param statusListener 状态监听 - */ - void addView(View view, ViewGroup.LayoutParams params, - IMogoTopViewStatusListener statusListener); - - /** - * 移除view,如果是最后一个view,会有移除动画 - * - * @param view 待移除的 view - */ - void removeView(View view); - -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java b/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java index 431db41faa..193fbd5bc2 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java @@ -8,18 +8,9 @@ import com.alibaba.android.arouter.launcher.ARouter; 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.fragmentmanager.IMogoFragmentManager; -import com.mogo.service.imageloader.IMogoImageloader; -import com.mogo.service.impl.analytics.impl.MogoAnalyticsImpl; -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.IMogoRegisterCenter; import com.mogo.service.statusmanager.IMogoStatusManager; -import com.mogo.service.v2x.DisplayEffectsInterface; -import com.mogo.service.windowview.IMogoTopViewManager; import com.mogo.service.windowview.IMogoWindowManager; /** @@ -36,26 +27,6 @@ public class MogoServiceApis implements IMogoServiceApis { private static final Object sLock = new Object(); - @Override - public IMogoAnalytics getAnalyticsApi() { - return MogoAnalyticsImpl.getInstance(); - } - - @Override - public IMogoFragmentManager getFragmentManagerApi() { - return SingletonsHolder.get(IMogoFragmentManager.class); - } - - @Override - public IMogoImageloader getImageLoaderApi() { - return GlideImageLoader.getInstance(); - } - - @Override - public IMogoIntentManager getIntentManagerApi() { - return IntentManager.getInstance(); - } - @Override public IMogoStatusManager getStatusManagerApi() { return SingletonsHolder.get(IMogoStatusManager.class); @@ -66,27 +37,18 @@ public class MogoServiceApis implements IMogoServiceApis { } + // 定位相关 需要拆分页面 MainActivity页面逻辑后,进行接口隔离 @Override public IMogoRegisterCenter getRegisterCenterApi() { return getApiInstance(IMogoRegisterCenter.class, MogoServicePaths.PATH_REGISTER_CENTER); } - + // 父布局页面 ,添加小元素:语音通话 @Override public IMogoWindowManager getWindowManagerApi() { return getApiInstance(IMogoWindowManager.class, MogoServicePaths.PATH_WINDOW_MANAGER); } - @Override - public IMogoTopViewManager getTopViewManager() { - return getApiInstance(IMogoTopViewManager.class, MogoServicePaths.PATH_EXTENSIONS_TOP_VIEW_MANAGER); - } - - @Override - public DisplayEffectsInterface getDisplayEffectsManager() { - return getApiInstance(DisplayEffectsInterface.class, MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER); - } - private static T getApiInstance(Class clazz, String path) { T inst = SingletonsHolder.get(clazz); if (inst == null) { diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/analytics/MogoAnalytics.java b/services/mogo-service/src/main/java/com/mogo/service/impl/analytics/MogoAnalytics.java deleted file mode 100644 index faf8dcb35e..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/analytics/MogoAnalytics.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mogo.service.impl.analytics; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.service.impl.analytics.impl.MogoAnalyticsImpl; - -import java.util.Map; - -/** - * @author congtaowang - * @since 2019-12-23 - *

- * 描述 - */ -@Route( path = MogoServicePaths.PATH_UTILS_ANALYTICS ) -public class MogoAnalytics implements IMogoAnalytics { - - private IMogoAnalytics mDelegate; - - @Override - public void init( Context context ) { - mDelegate = MogoAnalyticsImpl.getInstance(); - } - - @Override - public void track( String event, Map< String, Object > properties ) { - if ( mDelegate != null ) { - mDelegate.track( event, properties ); - } - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/analytics/impl/MogoAnalyticsImpl.java b/services/mogo-service/src/main/java/com/mogo/service/impl/analytics/impl/MogoAnalyticsImpl.java deleted file mode 100644 index de04fc09a5..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/analytics/impl/MogoAnalyticsImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mogo.service.impl.analytics.impl; - -import android.content.Context; - -import com.mogo.commons.analytics.AnalyticsUtils; -import com.mogo.service.analytics.IMogoAnalytics; - -import java.util.Map; - -/** - * @author congtaowang - * @since 2019-12-23 - *

- * 公司埋点库实现 - */ -public class MogoAnalyticsImpl implements IMogoAnalytics { - - private static volatile MogoAnalyticsImpl sInstance; - - private MogoAnalyticsImpl() { - } - - public static MogoAnalyticsImpl getInstance() { - if ( sInstance == null ) { - synchronized ( MogoAnalyticsImpl.class ) { - if ( sInstance == null ) { - sInstance = new MogoAnalyticsImpl(); - } - } - } - return sInstance; - } - - public synchronized void release() { - sInstance = null; - } - - @Override - public void init( Context context ) { - - } - - @Override - public void track( String event, Map< String, Object > properties ) { - AnalyticsUtils.track( event, properties ); - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java b/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java deleted file mode 100644 index 86131a1c7c..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.mogo.service.impl.fragmentmanager; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentTransaction; - -import com.mogo.service.fragmentmanager.FragmentDescriptor; -import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - -/** - * @author congtaowang - * @since 2020-01-08 - *

- * fragment 任务栈 - */ -public class FragmentStack { - - private static final String TAG = "FragmentStack"; - - private static volatile FragmentStack sInstance; - - private final Stack< FragmentDescriptor > mFragmentStack = new Stack<>(); - private FragmentManager mFragmentManager; - private int mContainerId; - private FragmentDescriptor mCurrentFragment; - - private FragmentStackTransactionListener mFragmentStackTransactionListener; - private final List< FragmentStackTransactionListener > mFragmentStackTransactionListeners = new ArrayList<>(); - private int mMessageHistoryContainerId; - - private FragmentStack() { - } - - public static FragmentStack getInstance() { - if ( sInstance == null ) { - synchronized ( FragmentStack.class ) { - if ( sInstance == null ) { - sInstance = new FragmentStack(); - } - } - } - return sInstance; - } - - public static synchronized void release() { - sInstance = null; - } - - public void init( AppCompatActivity activity, int containerId ) { - mFragmentManager = activity.getSupportFragmentManager(); - mContainerId = containerId; - } - - /** - * 缓存历史消息 - * @param layoutId - */ - public void initMessageHistoryContainerId(int layoutId){ - mMessageHistoryContainerId = layoutId; - } - - public int getMessageHistoryContainerId() { - return mMessageHistoryContainerId; - } - - public void push( FragmentDescriptor descriptor ) { - if ( descriptor == null || descriptor.getFragment() == null ) { - return; - } - if ( mFragmentStack.contains( descriptor ) ) { - return; - } - - if ( mFragmentManager == null ) { - return; - } - - FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction(); - - if ( mCurrentFragment != null ) { - mFragmentTransaction.hide( mCurrentFragment.getFragment() ); - } - mFragmentTransaction.add( mContainerId, descriptor.getFragment() ); - if ( descriptor.hasTransition() ) { - mFragmentTransaction.setTransition( FragmentTransaction.TRANSIT_FRAGMENT_OPEN ); - } - mFragmentTransaction.show(descriptor.getFragment()); - mFragmentTransaction.commitNowAllowingStateLoss(); - if ( descriptor.hasTransition() ) { - mFragmentManager.executePendingTransactions(); - } - mFragmentStack.push( descriptor ); - mCurrentFragment = descriptor; - - if ( descriptor.isNotifyMainModule() ) { - if ( mFragmentStackTransactionListener != null ) { - mFragmentStackTransactionListener.onTransaction( getStackSize() ); - } - } - invokeCallback(); - } - - public void pop() { - if ( mFragmentStack.isEmpty() ) { - invokeCallback(); - return; - } - if ( mFragmentManager == null ) { - return; - } - - FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction(); - - mCurrentFragment = mFragmentStack.pop(); - if ( mCurrentFragment != null ) { - mFragmentTransaction.remove( mCurrentFragment.getFragment() ); - } - if ( mFragmentStack.isEmpty() ) { - mFragmentTransaction.commitNowAllowingStateLoss(); - if ( mCurrentFragment.isNotifyMainModule() ) { - if ( mFragmentStackTransactionListener != null ) { - mFragmentStackTransactionListener.onTransaction( getStackSize() ); - } - } - invokeCallback(); - mCurrentFragment = null; - return; - } - FragmentDescriptor fragment = mFragmentStack.peek(); - if ( fragment != null ) { - mFragmentTransaction.show( fragment.getFragment() ); - mFragmentTransaction.commitNowAllowingStateLoss(); - } - - if ( mCurrentFragment.isNotifyMainModule() ) { - if ( mFragmentStackTransactionListener != null ) { - mFragmentStackTransactionListener.onTransaction( getStackSize() ); - } - } - invokeCallback(); - mCurrentFragment = fragment; - } - - private void invokeCallback() { - if ( mFragmentStackTransactionListeners != null ) { - for ( FragmentStackTransactionListener fragmentStackTransactionListener : mFragmentStackTransactionListeners ) { - fragmentStackTransactionListener.onTransaction( getStackSize() ); - } - } - } - - public boolean isEmpty() { - return mFragmentStack.isEmpty(); - } - - public int getStackSize() { - return mFragmentStack.size(); - } - - public void addFragmentStackTransactionListener( FragmentStackTransactionListener fragmentStackTransactionListener ) { - this.mFragmentStackTransactionListeners.add( fragmentStackTransactionListener ); - } - - public void removeFragmentStackTransactionListener( FragmentStackTransactionListener fragmentStackTransactionListener ) { - this.mFragmentStackTransactionListeners.remove( fragmentStackTransactionListener ); - } - - public void setFragmentStackTransactionListener( FragmentStackTransactionListener fragmentStackTransactionListener ) { - this.mFragmentStackTransactionListener = fragmentStackTransactionListener; - } - - public void clearAll() { - - if ( mFragmentManager == null ) { - return; - } - - if ( mFragmentStack.isEmpty() ) { - invokeCallback(); - return; - } - FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction(); - for ( FragmentDescriptor descriptor : mFragmentStack ) { - mFragmentTransaction.remove( descriptor.getFragment() ); - } - mFragmentTransaction.commitNowAllowingStateLoss(); - mFragmentStack.clear(); - mCurrentFragment = null; - if ( mFragmentStackTransactionListener != null ) { - mFragmentStackTransactionListener.onTransaction( getStackSize() ); - } - invokeCallback(); - } - - public void destroy(){ - mFragmentManager = null; - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java deleted file mode 100644 index 087d75ab24..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.mogo.service.impl.fragmentmanager; - -import android.content.Context; - -import androidx.appcompat.app.AppCompatActivity; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.fragmentmanager.FragmentDescriptor; -import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; -import com.mogo.service.fragmentmanager.IMogoFragmentManager; - -/** - * @author congtaowang - * @since 2020-01-08 - *

- * 描述 - */ -@Route( path = MogoServicePaths.PATH_FRAGMENT_MANAGER ) -public class MogoFragmentManager implements IMogoFragmentManager { - - @Override - public void push( FragmentDescriptor descriptor ) { - FragmentStack.getInstance().push( descriptor ); - } - - @Override - public void pop() { - FragmentStack.getInstance().pop(); - } - - @Override - public int getStackSize() { - return FragmentStack.getInstance().getStackSize(); - } - - @Override - public void clearAll() { - FragmentStack.getInstance().clearAll(); - } - - @Override - public void registerMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ) { - FragmentStack.getInstance().setFragmentStackTransactionListener( listener ); - } - - @Override - public void unregisterMainFragmentStackTransactionListener() { - FragmentStack.getInstance().setFragmentStackTransactionListener( null ); - } - - @Override - public void addMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ) { - FragmentStack.getInstance().addFragmentStackTransactionListener( listener ); - } - - @Override - public void removeMainFragmentStackTransactionListener( FragmentStackTransactionListener listener ) { - FragmentStack.getInstance().removeFragmentStackTransactionListener( listener ); - } - - @Override - public void init( AppCompatActivity activity, int containerId ) { - FragmentStack.getInstance().init( activity, containerId ); - } - - @Override - public void initMessageHistoryContainerId( int layoutId ) { - FragmentStack.getInstance().initMessageHistoryContainerId( layoutId ); - } - - @Override - public int getMessageHistoryContainerId() { - return FragmentStack.getInstance().getMessageHistoryContainerId(); - } - - @Override - public void destroy() { - FragmentStack.getInstance().destroy(); - } - - @Override - public void init( Context context ) { - - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/MogoImageLoader.java b/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/MogoImageLoader.java deleted file mode 100644 index b5f635985e..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/imageloader/MogoImageLoader.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mogo.service.impl.imageloader; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.imageloader.IMogoImageLoaderListener; -import com.mogo.service.imageloader.IMogoImageloader; -import com.mogo.service.imageloader.MogoImageView; -import com.mogo.service.impl.imageloader.glide.GlideImageLoader; - -/** - * @author congtaowang - * @since 2019-12-23 - *

- * 实现图片接口 - */ -@Route( path = MogoServicePaths.PATH_UTILS_IMAGE_LOADER ) -public class MogoImageLoader implements IMogoImageloader { - - private IMogoImageloader mDelegate; - - @Override - public void init( Context context ) { - mDelegate = GlideImageLoader.getInstance(); - } - - @Override - public void displayImage( String url, MogoImageView imageView ) { - if ( mDelegate != null ) { - mDelegate.displayImage( url, imageView ); - } - } - - @Override - public void displayImage( String url, MogoImageView imageView, int width, int height ) { - if ( mDelegate != null ) { - mDelegate.displayImage( url, imageView, width, height ); - } - } - - @Override - public void displayImage( String url, MogoImageView imageView, int width, int height, IMogoImageLoaderListener listener ) { - if ( mDelegate != null ) { - mDelegate.displayImage( url, imageView, width, height, listener ); - } - } - - @Override - public void displayImage( String url, MogoImageView imageView, IMogoImageLoaderListener listener ) { - if ( mDelegate != null ) { - mDelegate.displayImage( url, imageView, 0, 0, listener ); - } - } - - @Override - public void downloadImage( Context context, String url, IMogoImageLoaderListener listener ) { - if ( mDelegate != null ) { - mDelegate.downloadImage( context, url, listener ); - } - } - - @Override - public void destroy() { - if ( mDelegate != null ) { - mDelegate.destroy(); - } - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/intent/MogoIntentManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/intent/MogoIntentManager.java deleted file mode 100644 index 4893f9db93..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/intent/MogoIntentManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mogo.service.impl.intent; - -import android.content.Context; -import android.content.Intent; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.intent.IMogoIntentListener; -import com.mogo.service.intent.IMogoIntentManager; - -/** - * @author congtaowang - * @since 2020-01-09 - *

- * 描述 - */ -@Route( path = MogoServicePaths.PATH_INTENT_MANAGER ) -public class MogoIntentManager implements IMogoIntentManager { - - @Override - public void unregisterIntentListener( String command, IMogoIntentListener listener ) { - IntentManager.getInstance().unregisterIntentListener( command, listener ); - } - - @Override - public void invoke( String command, Intent intent ) { - IntentManager.getInstance().invoke( command, intent ); - } - - @Override - public void registerIntentListener( String intent, IMogoIntentListener listener ) { - IntentManager.getInstance().registerIntentListener( intent, listener ); - } - - @Override - public void init( Context context ) { - IntentManager.getInstance().init( context ); - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java b/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java index 46dccb56bf..27da730979 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/singleton/SingletonsHolder.java @@ -1,9 +1,6 @@ package com.mogo.service.impl.singleton; import com.alibaba.android.arouter.facade.template.IProvider; -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.service.fragmentmanager.IMogoFragmentManager; -import com.mogo.service.impl.fragmentmanager.MogoFragmentManager; import com.mogo.service.impl.statusmanager.MogoStatusManager; import com.mogo.service.statusmanager.IMogoStatusManager; @@ -21,7 +18,6 @@ public class SingletonsHolder { private static final Map sSingletons = new ConcurrentHashMap<>(); static { - sSingletons.put(IMogoFragmentManager.class, new MogoFragmentManager()); sSingletons.put(IMogoStatusManager.class, new MogoStatusManager()); } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java index c53d677a8d..d319f85b4f 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/statusmanager/MogoStatusManager.java @@ -21,7 +21,6 @@ import java.util.concurrent.ConcurrentHashMap; *

* 状态控制器 */ -@Route( path = MogoServicePaths.PATH_STATUS_MANAGER ) public class MogoStatusManager implements IMogoStatusManager { private static final String TAG = "MogoStatusManager";