diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java index 34f4ca03bd..5aaa2cfa0b 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java @@ -363,7 +363,7 @@ public class OchBusFragment extends BaseOchBusTabFragment trafficData) { + public void onAutopilotIdentifyDataUpdate(List trafficData) { } } diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java index 5f18ec96f6..7b8379cbed 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java @@ -336,7 +336,7 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment trafficData) { + public void onAutopilotIdentifyDataUpdate(List trafficData) { } } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 1c714d13ec..b46069a261 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -10,7 +10,7 @@ import com.mogo.eagle.core.data.autopilot.toRouteInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_ADAS_IMPL +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL import com.mogo.eagle.core.data.trafficlight.TrafficLightResult import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider @@ -19,10 +19,9 @@ import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer -import com.mogo.eagle.core.function.call.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index 13b928d2fe..a70930c467 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -4,18 +4,18 @@ import chassis.VehicleStateOuterClass import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HdMapBuildConfig -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS -import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_ADAS +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_ADAS +import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus @@ -31,7 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult -import com.mogo.eagle.core.function.call.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.datacenter.SnapshotLocationDataCenter import com.mogo.module.service.MarkerServiceHandler @@ -103,7 +103,7 @@ class MoGoAdasListenerImpl : OnAdasListener { trackedObjects: MessagePad.TrackedObjects ) { if (HdMapBuildConfig.isMapLoaded) { - invokeAutopilotIdentifyDataUpdate(trackedObjects.objsList as ArrayList?) + invokeAutopilotIdentifyDataUpdate(trackedObjects.objsList as List?) } } @@ -280,7 +280,7 @@ class MoGoAdasListenerImpl : OnAdasListener { override fun onUpgradeStateInfo(info: IPCUpgradeStateInfo) { if (info != null) { CallerLogger.d( - "$M_ADAS$TAG", "onUpgradeStateInfo " + + "$M_ADAS_IMPL$TAG", "onUpgradeStateInfo " + " upgrade mode=" + info.upgradeMode + " download status=" + info.downloadStatus + " download progress current=" + info.progress.current + @@ -293,7 +293,7 @@ class MoGoAdasListenerImpl : OnAdasListener { info.progress.total, info.images, info.upgradeStatus ) } else { - CallerLogger.w("$M_ADAS$TAG", "onUpgradeStateInfo : upgrade state info is null") + CallerLogger.w("$M_ADAS_IMPL$TAG", "onUpgradeStateInfo : upgrade state info is null") } } @@ -301,7 +301,7 @@ class MoGoAdasListenerImpl : OnAdasListener { if (info != null && "docker restart autocar_default_1" == info.cmd) { showDockerRebootResult(info.code, info.msg) } else { - CallerLogger.w("$M_ADAS$TAG", "onSSHResult : result info is null") + CallerLogger.w("$M_ADAS_IMPL$TAG", "onSSHResult : result info is null") } } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt index c6eceb27d3..2d948ba017 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt @@ -3,11 +3,11 @@ package com.mogo.eagle.core.function.autopilot.adapter import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_ADAS_IMPL +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasConnectStatusListener import com.zhidao.support.adas.high.common.Constants diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index abb479a00b..febe7b43e9 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -13,6 +13,7 @@ import com.mogo.module.common.drawer.IdentifyDataDrawer; import com.zhidao.support.obu.ami.AmiClientManager; import java.util.ArrayList; +import java.util.List; import chassis.Chassis; import mogo.telematics.pad.MessagePad; @@ -60,7 +61,7 @@ public class MoGoHandAdasMsgManager implements } @Override - public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList trafficData) { + public void onAutopilotIdentifyDataUpdate(List trafficData) { try { if (FunctionBuildConfig.isDrawIdentifyData) { ThreadUtils.getSinglePool().execute(() -> diff --git a/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/CarcorderService.kt b/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/CarcorderService.kt index c355159e07..e34f590acf 100644 --- a/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/CarcorderService.kt +++ b/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/CarcorderService.kt @@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.carcorder.service import android.content.Intent import android.hardware.usb.UsbDevice import android.os.IBinder -import android.util.Log -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CORDER import com.mogo.usbcamera.UVCCameraHelper import com.serenegiant.usb.IFrameCallback import com.serenegiant.usb.USBMonitor @@ -51,7 +51,7 @@ class CarcorderService : BaseService() { override fun onCreate() { super.onCreate() if (DEBUG) { - Logger.d(TAG, "onCreate……") + CallerLogger.d("$M_CORDER$TAG", "onCreate……") } if (mUSBMonitor == null) { mUSBMonitor = USBMonitor(applicationContext, mOnDeviceConnectListener) @@ -63,7 +63,7 @@ class CarcorderService : BaseService() { override fun onDestroy() { super.onDestroy() - if (DEBUG) Log.d(TAG, "onDestroy:") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:") if (mUSBMonitor != null) { mUSBMonitor!!.unregister() mUSBMonitor = null @@ -80,14 +80,14 @@ class CarcorderService : BaseService() { } override fun onRebind(intent: Intent) { - if (DEBUG) Log.d(TAG, "onRebind:$intent") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent") } override fun onUnbind(intent: Intent): Boolean { - if (DEBUG) Log.d(TAG, "onUnbind:$intent") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent") - if (DEBUG) Log.d(TAG, "onUnbind:finished") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished") return true } @@ -102,25 +102,25 @@ class CarcorderService : BaseService() { */ private val mOnDeviceConnectListener: OnDeviceConnectListener = object : OnDeviceConnectListener { override fun onAttach(device: UsbDevice) { - if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onAttach:${device.deviceName}---mDeviceList:${mDeviceList?.size}") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onAttach:${device.deviceName}---mDeviceList:${mDeviceList?.size}") mUSBMonitor!!.requestPermission(device) } override fun onConnect(device: UsbDevice, ctrlBlock: UsbControlBlock, createNew: Boolean) { - if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onConnect:${device.deviceName}") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onConnect:${device.deviceName}") openCamera(device, ctrlBlock, createNew) } override fun onDisconnect(device: UsbDevice, ctrlBlock: UsbControlBlock) { - if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onDisconnect:${device.deviceName}") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDisconnect:${device.deviceName}") } override fun onDettach(device: UsbDevice) { - if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onDettach:${device.deviceName}") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDettach:${device.deviceName}") } override fun onCancel(device: UsbDevice) { - if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onCancel:${device.deviceName}") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onCancel:${device.deviceName}") } } @@ -132,7 +132,7 @@ class CarcorderService : BaseService() { mUVCCamera = UVCCamera() mUVCCamera!!.open(ctrlBlock) mUVCCamera!!.setStatusCallback { statusClass, event, selector, statusAttribute, data -> - if (DEBUG) Log.d(TAG, "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})") } try { @@ -156,7 +156,7 @@ class CarcorderService : BaseService() { * 视频帧回掉 */ private val mIFrameCallback = IFrameCallback { frame -> - if (DEBUG) Log.d(TAG, "IFrameCallback#onFrame:${frame}") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IFrameCallback#onFrame:${frame}") } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/LivePushService.kt b/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/LivePushService.kt index 3940a4c9ee..f16acc8c4a 100644 --- a/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/LivePushService.kt +++ b/core/function-impl/mogo-core-function-carcorder/src/main/java/com/mogo/eagle/core/function/carcorder/service/LivePushService.kt @@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.carcorder.service import android.content.Intent import android.os.IBinder -import android.util.Log -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CORDER import com.serenegiant.usb.common.BaseService /** @@ -17,14 +17,14 @@ class LivePushService : BaseService() { override fun onCreate() { super.onCreate() if (DEBUG) { - Logger.d(TAG, "onCreate……") + CallerLogger.d("$M_CORDER$TAG", "onCreate……") } } override fun onDestroy() { super.onDestroy() - if (DEBUG) Log.d(TAG, "onDestroy:") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:") } @@ -38,14 +38,14 @@ class LivePushService : BaseService() { } override fun onRebind(intent: Intent) { - if (DEBUG) Log.d(TAG, "onRebind:$intent") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent") } override fun onUnbind(intent: Intent): Boolean { - if (DEBUG) Log.d(TAG, "onUnbind:$intent") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent") - if (DEBUG) Log.d(TAG, "onUnbind:finished") + if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished") return true } diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt index 9b7ea9196d..6dca672fa6 100644 --- a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt @@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.chat.facade.aop import android.os.Looper import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_CHAT -import com.mogo.eagle.core.function.call.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CHAT +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.reflect.CodeSignature import org.aspectj.lang.reflect.MethodSignature diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt index bac856ea26..3fdd657ff7 100644 --- a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt @@ -4,14 +4,11 @@ import android.content.Context import android.content.Intent import android.os.Handler import android.text.TextUtils -import android.util.Log import com.gme.TMG.ITMGContext import com.gme.av.sdk.AVError import com.gme.av.sig.AuthBuffer -import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.function.api.chat.biz.ChatConsts import com.mogo.eagle.core.function.chat.facade.utils.log -import com.mogo.eagle.core.utilcode.util.BuildConfig import com.mogo.eagle.core.utilcode.util.Utils import java.lang.ref.WeakReference import java.util.concurrent.atomic.AtomicBoolean @@ -30,7 +27,7 @@ internal object GMEApi { } private val Intent.result: Int - get() = getIntExtra("result" , -1) + get() = getIntExtra("result", -1) private val Intent.errorInfo: String get() = getStringExtra("error_info") ?: "" @@ -46,7 +43,7 @@ internal object GMEApi { private var ctx: WeakReference? = null private val tmgCtx by lazy { - ITMGContext.GetInstance(ctx?.get()?: Utils.getApp()) + ITMGContext.GetInstance(ctx?.get() ?: Utils.getApp()) } private val delegate = object : ITMGContext.ITMGDelegate() { @@ -79,7 +76,7 @@ internal object GMEApi { log(ChatConsts.TAG, "成员进房====$it===ownId:$openId") it.toInt() > 99999 }.toTypedArray() - if (filtered.isEmpty()) { + if (filtered.isEmpty()) { log(ChatConsts.TAG, "成员为空,无操作") return } @@ -95,11 +92,11 @@ internal object GMEApi { } fun enableAudio() { - Log.d(ChatConsts.TAG, "-- enable audio --- 1 ---") + log(ChatConsts.TAG, "-- enable audio --- 1 ---") if (!hasInit.get()) { return } - Log.d(ChatConsts.TAG, "-- enable audio --- 2 ---") + log(ChatConsts.TAG, "-- enable audio --- 2 ---") val audioCtrl = tmgCtx.GetAudioCtrl() //开启麦克 audioCtrl?.EnableMic(true) @@ -112,11 +109,11 @@ internal object GMEApi { } fun disableAudio() { - Log.d(ChatConsts.TAG, "-- disable audio --- 1 ---") + log(ChatConsts.TAG, "-- disable audio --- 1 ---") if (!hasInit.get()) { return } - Log.d(ChatConsts.TAG, "-- disable audio --- 2 ---") + log(ChatConsts.TAG, "-- disable audio --- 2 ---") val audioCtrl = tmgCtx.GetAudioCtrl() audioCtrl?.EnableSpeaker(false) //开启麦克 @@ -190,7 +187,7 @@ internal object GMEApi { return } if (mute) { - tmgCtx.GetAudioCtrl()?.SetMicVolume(0) + tmgCtx.GetAudioCtrl()?.SetMicVolume(0) } else { tmgCtx.GetAudioCtrl()?.SetMicVolume(100) } @@ -199,17 +196,17 @@ internal object GMEApi { sealed class GmeState { - class InitSuccess(val openId: String): GmeState() + class InitSuccess(val openId: String) : GmeState() - class InitFail(val code: Int): GmeState() + class InitFail(val code: Int) : GmeState() - object EnterRoomSuccess: GmeState() + object EnterRoomSuccess : GmeState() - class EnterRoomFail(val code: Int, val msg: String): GmeState() + class EnterRoomFail(val code: Int, val msg: String) : GmeState() - class UserChangeInRoom(val isEnter: Boolean, val left: Array): GmeState() + class UserChangeInRoom(val isEnter: Boolean, val left: Array) : GmeState() - object ExitRoomSuccess: GmeState() + object ExitRoomSuccess : GmeState() } diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckLinearLayout.java b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckLinearLayout.java index 09ffaafedc..8243f85519 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckLinearLayout.java +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckLinearLayout.java @@ -6,7 +6,6 @@ import android.util.AttributeSet; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.mogo.eagle.core.utilcode.util.LogUtils; /** * @author liujing @@ -32,7 +31,6 @@ class CheckLinearLayout extends LinearLayoutManager { super.onLayoutChildren(recycler, state); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); - LogUtils.dTag("CheckLinearLayout", "崩溃信息--" + e.toString()); } } } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt index cc30471b3c..251d6abdc6 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt @@ -4,7 +4,7 @@ import android.annotation.SuppressLint import android.content.Context import android.view.View import com.alibaba.android.arouter.facade.annotation.Route -import com.mogo.eagle.core.data.deva.chain.ChainLogParam +import com.mogo.eagle.core.data.chain.ChainLogParam import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt index 84802b0795..c83b4db0c7 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt @@ -2,7 +2,6 @@ package com.zhjt.mogo_core_function_devatools.badcase import android.transition.AutoTransition import android.transition.TransitionManager -import android.util.Log import android.view.View import android.view.ViewGroup import androidx.lifecycle.Lifecycle.Event @@ -12,7 +11,9 @@ import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.util.ToastUtils @@ -35,9 +36,10 @@ internal object BadCaseManager : LifecycleEventObserver { * 超过此时间,case入口自动消失 */ - private val CASE_EXPIRE_DURATION: Long = TimeUnit.HOURS.toMillis(4)/* TimeUnit.SECONDS.toMillis(10) */ + private val CASE_EXPIRE_DURATION: Long = + TimeUnit.HOURS.toMillis(4)/* TimeUnit.SECONDS.toMillis(10) */ - private var onShow: (() -> Unit)? = null + private var onShow: (() -> Unit)? = null private var onHide: (() -> Unit)? = null private var hideFloat: (() -> Unit)? = null @@ -46,7 +48,7 @@ internal object BadCaseManager : LifecycleEventObserver { private var record: AutoPilotRecord? = null @Volatile - private var viewHolder : WeakReference? = null + private var viewHolder: WeakReference? = null @Volatile private var dismissJob: Job? = null @@ -86,22 +88,22 @@ internal object BadCaseManager : LifecycleEventObserver { private fun register() { scope?.launch(Dispatchers.Default) { while (true) { - Log.d(TAG, "---- 开始监听BadCase事件 ----") + CallerLogger.d("$M_DEVA$TAG", "---- 开始监听BadCase事件 ----") val old = record if (old == null || old.consumed) { - Log.d(TAG, "---- 当前事件已消费 -- value: $old") + CallerLogger.d("$M_DEVA$TAG", "---- 当前事件已消费 -- value: $old") var receive = channel.receive() var oldT = record?.toLongTime() ?: 0L var newT = receive.toLongTime() if (isValid(oldT, newT)) { record = receive - Log.d(TAG, "---- 时间有效,开始展示入口 ---") + CallerLogger.d("$M_DEVA$TAG", "---- 时间有效,开始展示入口 ---") withContext(Dispatchers.Main) { showBadCaseInternal(receive) } continue } - Log.d(TAG, "---- 时间无效,移除管道中无用数据 ---") + CallerLogger.d("$M_DEVA$TAG", "---- 时间无效,移除管道中无用数据 ---") presenter.deleteRecord(receive) while (oldT != 0L && newT != 0L && (newT - oldT) >= CASE_EXPIRE_DURATION) { oldT = newT @@ -110,14 +112,17 @@ internal object BadCaseManager : LifecycleEventObserver { presenter.deleteRecord(receive) } receive.takeIf { it.key != old?.key }?.also { - Log.d(TAG, "record: [$record] is displaying for rest ...") + CallerLogger.d( + "$M_DEVA$TAG", + "record: [$record] is displaying for rest ..." + ) record = receive withContext(Dispatchers.Main) { showBadCaseInternal(it) } } } else { - Log.d(TAG, "record: [$old] hasn't been consumed~~~~") + CallerLogger.d("$M_DEVA$TAG", "record: [$old] hasn't been consumed~~~~") withContext(Dispatchers.Main) { showEntry() } @@ -133,26 +138,26 @@ internal object BadCaseManager : LifecycleEventObserver { val lastModified = presenter.getLastModified() val list = withContext(Dispatchers.IO) { try { - Log.d(TAG, " --- 1 ----") - Log.d(TAG, "恢复持久化的数据 - 最后修改时间:$lastModified") - presenter.getUnConsumedRecords().fold(mutableListOf()) { - acc, record -> - if (isValid(lastModified, record.toLongTime())) { - acc.add(record) - } else { - presenter.deleteRecord(record) + CallerLogger.d("$M_DEVA$TAG", " --- 1 ----") + CallerLogger.d("$M_DEVA$TAG", "恢复持久化的数据 - 最后修改时间:$lastModified") + presenter.getUnConsumedRecords() + .fold(mutableListOf()) { acc, record -> + if (isValid(lastModified, record.toLongTime())) { + acc.add(record) + } else { + presenter.deleteRecord(record) + } + acc } - acc - } } catch (t: Throwable) { emptyList() } } if (list.isEmpty()) { - Log.d(TAG, "没有要恢复的数据") + CallerLogger.d("$M_DEVA$TAG", "没有要恢复的数据") } else { list.forEach { - Log.d(TAG, "恢复的接管数据:$it") + CallerLogger.d("$M_DEVA$TAG", "恢复的接管数据:$it") channel.send(it) } } @@ -185,15 +190,16 @@ internal object BadCaseManager : LifecycleEventObserver { hideFloat = null }, onSelect = { reason -> - val uploadResult = presenter.upload(mutableMapOf().also { itx -> - itx["carLicense"] = MoGoAiCloudClientConfig.getInstance().sn - itx["filename"] = record.fileName ?: "" - itx["filesize"] = record.total.toString() - itx["key"] = record.key ?: "" - itx["reason"] = reason.reason ?: "" - itx["duration"] = record.duration.toInt().toString() - itx["timestamp"] = record.timestamp - }) + val uploadResult = + presenter.upload(mutableMapOf().also { itx -> + itx["carLicense"] = MoGoAiCloudClientConfig.getInstance().sn + itx["filename"] = record.fileName ?: "" + itx["filesize"] = record.total.toString() + itx["key"] = record.key ?: "" + itx["reason"] = reason.reason ?: "" + itx["duration"] = record.duration.toInt().toString() + itx["timestamp"] = record.timestamp + }) if (uploadResult == null || uploadResult.code != 200) { ToastUtils.showShort("接管反馈失败") } else { @@ -240,7 +246,10 @@ internal object BadCaseManager : LifecycleEventObserver { } } - private fun showBadCaseFloat(onDismiss: () -> Unit, onSelect:suspend (reason: Reason) -> Unit) { + private fun showBadCaseFloat( + onDismiss: () -> Unit, + onSelect: suspend (reason: Reason) -> Unit + ) { val context = viewHolder?.get()?.context ?: Utils.getApp() BadCaseView(context).also { it.register(record, onDismiss, onSelect) @@ -258,7 +267,7 @@ internal object BadCaseManager : LifecycleEventObserver { } } -fun T.toggle(show: Boolean) { +fun T.toggle(show: Boolean) { val group = (parent as? ViewGroup) ?: return val target = if (show) View.VISIBLE else View.GONE takeIf { it.visibility != target }?.also { @@ -267,15 +276,16 @@ fun T.toggle(show: Boolean) { } } -internal fun RecordPanelOuterClass.RecordPanel.toRecord(): AutoPilotRecord = AutoPilotRecord().also { - it.id = this.id - it.stat = this.stat - it.key = this.key.toString() - it.note = this.note - it.type = this.type - it.total = this.totalSize - it.fileName = this.filename - it.duration = this.duration.toDouble() - it.diskFree = this.diskFree - it.consumed = false -} \ No newline at end of file +internal fun RecordPanelOuterClass.RecordPanel.toRecord(): AutoPilotRecord = + AutoPilotRecord().also { + it.id = this.id + it.stat = this.stat + it.key = this.key.toString() + it.note = this.note + it.type = this.type + it.total = this.totalSize + it.fileName = this.filename + it.duration = this.duration.toDouble() + it.diskFree = this.diskFree + it.consumed = false + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/mvp/BadCasePresenter.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/mvp/BadCasePresenter.kt index cc70f3ab1d..857b814f8a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/mvp/BadCasePresenter.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/mvp/BadCasePresenter.kt @@ -1,14 +1,14 @@ package com.zhjt.mogo_core_function_devatools.badcase.mvp -import android.util.Log +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult import com.zhjt.mogo_core_function_devatools.badcase.mvp.biz.IBadCasePresenter import com.zhjt.mogo_core_function_devatools.badcase.repository.Repository import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord -import kotlinx.coroutines.flow.Flow -internal class BadCasePresenter: IBadCasePresenter { +internal class BadCasePresenter : IBadCasePresenter { private val repository by lazy { Repository() @@ -20,7 +20,7 @@ internal class BadCasePresenter: IBadCasePresenter { try { repository.insert(record) } catch (t: Throwable) { - Log.d(BadCaseManager.TAG, "-- 插入数据失败 -- msg: $t") + CallerLogger.e("$M_DEVA${BadCaseManager.TAG}", "-- 插入数据失败 -- msg: $t") } } @@ -28,7 +28,7 @@ internal class BadCasePresenter: IBadCasePresenter { return try { repository.getAllUnConsumedRecord() ?: emptyList() } catch (t: Throwable) { - Log.d(BadCaseManager.TAG, "-- 获取所有未消费的数据失败 -- msg: $t") + CallerLogger.e("$M_DEVA${BadCaseManager.TAG}", "-- 获取所有未消费的数据失败 -- msg: $t") emptyList() } } @@ -37,7 +37,7 @@ internal class BadCasePresenter: IBadCasePresenter { try { repository.deleteRecord(record) } catch (t: Throwable) { - Log.d(BadCaseManager.TAG, "-- 删除某条记录失败 -- msg: $t") + CallerLogger.e("$M_DEVA${BadCaseManager.TAG}", "-- 删除某条记录失败 -- msg: $t") } } @@ -48,7 +48,7 @@ internal class BadCasePresenter: IBadCasePresenter { } override suspend fun getLastModified(): Long { - Log.d(BadCaseManager.TAG, " --- 2 ----") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", " --- 2 ----") return repository.getLastModified() } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/Repository.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/Repository.kt index db0456fc37..b4916f254d 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/Repository.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/Repository.kt @@ -1,6 +1,7 @@ package com.zhjt.mogo_core_function_devatools.badcase.repository -import android.util.Log +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason import com.zhjt.mogo_core_function_devatools.badcase.api.entity.UploadResult @@ -8,7 +9,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.repository.db.BadCaseDbMode import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord import com.zhjt.mogo_core_function_devatools.badcase.repository.net.BadCaseNetModel import com.zhjt.mogo_core_function_devatools.badcase.repository.store.BadCaseStore -import kotlinx.coroutines.flow.Flow + internal class Repository { @@ -33,12 +34,12 @@ internal class Repository { } suspend fun getLastModified(): Long { - Log.d(BadCaseManager.TAG, " --- 3 ----") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", " --- 3 ----") return store.getLastModified() } private fun getBuildIn(): List { - Log.d(BadCaseManager.TAG, "-- load cases from buildin -- 1 --") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from buildin -- 1 --") val data = mutableListOf() data += Reason().also { it.id = "1" diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/net/BadCaseNetModel.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/net/BadCaseNetModel.kt index 6388faa7f3..6fdb7e6f1e 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/net/BadCaseNetModel.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/net/BadCaseNetModel.kt @@ -1,6 +1,7 @@ package com.zhjt.mogo_core_function_devatools.badcase.repository.net -import android.util.Log +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.network.MoGoRetrofitFactory import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager import com.zhjt.mogo_core_function_devatools.badcase.api.BadCaseApi @@ -11,7 +12,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseHost internal class BadCaseNetModel { suspend fun get(): BadCaseResponse? = try { - Log.d(BadCaseManager.TAG, "-- load cases from net -- 1 --") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from net -- 1 --") MoGoRetrofitFactory .getInstance(BadCaseHost.getHost()) .create(BadCaseApi::class.java) @@ -21,10 +22,10 @@ internal class BadCaseNetModel { it.isSuccessful && body != null && (body.code == 0 || body.code == 200) } ?.body()?.also { - Log.d(BadCaseManager.TAG, "-- load cases from net -- 2 --") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from net -- 2 --") } } catch (t: Throwable) { - Log.d(BadCaseManager.TAG, "-- load cases from net -- 3 --") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from net -- 3 --") null } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/store/BadCaseStore.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/store/BadCaseStore.kt index 3d906b63c8..0ad0314a3a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/store/BadCaseStore.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/repository/store/BadCaseStore.kt @@ -1,22 +1,24 @@ package com.zhjt.mogo_core_function_devatools.badcase.repository.store -import android.util.Log import androidx.datastore.core.DataStore import androidx.datastore.core.DataStoreFactory import androidx.datastore.core.Serializer +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.Utils import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager -import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse import com.zhjt.mogo_core_function_devatools.badcase.api.entity.BadCaseResponse.Reason import com.zhjt.mogo_core_function_devatools.badcase.generated.BadCauses import com.zhjt.mogo_core_function_devatools.badcase.generated.Cause -import kotlinx.coroutines.* -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.flow.catch +import kotlinx.coroutines.flow.firstOrNull +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.suspendCancellableCoroutine import java.io.File import java.io.IOException import java.io.InputStream import java.io.OutputStream -import kotlin.math.log internal object BadCaseStore { @@ -26,7 +28,7 @@ internal object BadCaseStore { get() = BadCauses.getDefaultInstance() override suspend fun readFrom(input: InputStream): BadCauses = suspendCancellableCoroutine { - Log.d(BadCaseManager.TAG, "--- readFrom ---") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "--- readFrom ---") it.invokeOnCancellation { Thread.currentThread().interrupt() } @@ -37,26 +39,32 @@ internal object BadCaseStore { } } - override suspend fun writeTo(t: BadCauses, output: OutputStream) = suspendCancellableCoroutine { - it.invokeOnCancellation { - Thread.currentThread().interrupt() + override suspend fun writeTo(t: BadCauses, output: OutputStream) = + suspendCancellableCoroutine { + it.invokeOnCancellation { + Thread.currentThread().interrupt() + } + try { + t.writeTo(output) + it.resumeWith(Result.success(Unit)) + } catch (t: Throwable) { + it.resumeWith(Result.failure(t)) + } } - try { - t.writeTo(output) - it.resumeWith(Result.success(Unit)) - } catch (t: Throwable) { - it.resumeWith(Result.failure(t)) - } - } } private val store: DataStore by lazy { - DataStoreFactory.create(serializer = serializer) { File(Utils.getApp().filesDir, "bad_cases.pb") } + DataStoreFactory.create(serializer = serializer) { + File( + Utils.getApp().filesDir, + "bad_cases.pb" + ) + } } suspend fun updateRecords(reasons: List): BadCauses { - Log.d(BadCaseManager.TAG, "--- updateRecords ---") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "--- updateRecords ---") val data = mutableListOf() reasons.forEach { itx -> data += Cause.newBuilder().let { @@ -71,14 +79,14 @@ internal object BadCaseStore { } suspend fun updateLastModified(timestamp: Long): BadCauses { - Log.d(BadCaseManager.TAG, "--- updateLastModified ---") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "--- updateLastModified ---") return store.updateData { itx -> - itx.toBuilder().setLastModified(timestamp).build() - } + itx.toBuilder().setLastModified(timestamp).build() + } } suspend fun getLastModified(): Long { - Log.d(BadCaseManager.TAG, " --- 4 ----") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", " --- 4 ----") return store .data .catch { @@ -94,7 +102,7 @@ internal object BadCaseStore { @OptIn(FlowPreview::class) suspend fun records(): List { - Log.d(BadCaseManager.TAG, "-- load cases from pb -- 1 -- ") + CallerLogger.d("$M_DEVA${BadCaseManager.TAG}", "-- load cases from pb -- 1 -- ") val causes = store.data.firstOrNull() return causes?.dataList?.map { Reason().also { itx -> diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt index 666439f45c..2cb25a49a9 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt @@ -10,13 +10,14 @@ import com.mogo.commons.AbsMogoApplication import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.constants.MoGoConfig +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.mogo.toast.TipToast -import com.mogo.eagle.core.utilcode.util.LogUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.module.common.MogoApisHandler import com.mogo.service.cloud.socket.IMogoOnMessageListener @@ -66,9 +67,9 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl } startCatchLog(logTime) } else { - Logger.d( - TAG, - "logCheck logger : $logger , logCatchDuration : $logCatchDuration" + CallerLogger.d( + "$M_DEVA$TAG", + "logCheck Logger : $logger , logCatchDuration : $logCatchDuration" ) } } @@ -79,7 +80,7 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl override fun onMsgReceived(obj: RemoteLogPushContent?) { obj?.let { - Logger.d(TAG, "收到push消息: $obj") + CallerLogger.d("$M_DEVA$TAG", "收到push消息: $obj") when (obj.type) { START_CATCH_LOG -> if (!catchingList.contains(obj.pkgName)) { startCatchLog(obj) @@ -106,7 +107,7 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl if (catchingList.contains(MANUAL_CATCH_PKG_NAME)) { TipToast.shortTip("已经在抓取日志了,请稍后再试") } else { - Logger.d(TAG, "开始抓取日志==== duration : $duration") + CallerLogger.d("$M_DEVA$TAG", "开始抓取日志==== duration : $duration") manualContent.type = START_CATCH_LOG manualContent.duration = duration startCatchLog(manualContent) @@ -114,7 +115,7 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl } fun stopCatchLog() { - Logger.d(TAG, "结束抓取日志====") + CallerLogger.d("$M_DEVA$TAG", "结束抓取日志====") manualContent.type = STOP_CATCH_LOG stopCatchLog(manualContent) } @@ -166,7 +167,6 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl * 放开Logger的限制 */ private fun openLoggerLevel() { - LogUtils.getConfig().isLogSwitch = true Logger.init(LogLevel.DEBUG) MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = true CallerAutoPilotManager.setEnableLog(true) @@ -176,7 +176,6 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl * 根据状态收紧Logger的限制 */ private fun closeLoggerLevel() { - LogUtils.getConfig().isLogSwitch = false Logger.init(if (DebugConfig.isDebug()) LogLevel.DEBUG else LogLevel.OFF) MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false CallerAutoPilotManager.setEnableLog(false) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/trace/TraceManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/trace/TraceManager.kt index c8e9ba3021..60444f2466 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/trace/TraceManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/trace/TraceManager.kt @@ -2,14 +2,14 @@ package com.zhjt.mogo_core_function_devatools.trace import android.content.Context import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.deva.chain.ChainConstant -import com.mogo.eagle.core.data.deva.chain.ChainLogParam -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.data.chain.ChainConstant +import com.mogo.eagle.core.data.chain.ChainLogParam +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.DeviceUtils import com.mogo.eagle.core.utilcode.util.Utils import com.zhidao.loglib.fw.FileWriteManager import com.zhidao.loglib.fw.FwBuild -import com.zhjt.mogo_core_function_devatools.DevaToolsProvider.Companion.MODULE_NAME import com.zhjt.service.chain.core.ChainTraceStarter class TraceManager { @@ -19,6 +19,8 @@ class TraceManager { companion object { + const val TAG = "TraceManager" + val traceManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { TraceManager() } @@ -51,7 +53,7 @@ class TraceManager { map.forEach { (type, param) -> val fwBuild = this.fwBuildMap[type] fwBuild?.let { - Logger.d(MODULE_NAME, "param : ${param.des} , record : ${param.record}") + CallerLogger.d("$M_DEVA$TAG", "param : ${param.des} , record : ${param.record}") it.isRecord = param.record } } diff --git a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAirportDialog.java b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAirportDialog.java index cb451f2fa8..e69cdf65f8 100644 --- a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAirportDialog.java +++ b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAirportDialog.java @@ -8,11 +8,9 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; public class DispatchAirportDialog extends DispatchBaseDialog { - private static final String TAG = "DispatchAirportDialog"; private IDispatchRemindClickListener mListener; private final TextView tvStartLoc; @@ -67,7 +65,6 @@ public class DispatchAirportDialog extends DispatchBaseDialog { @Override public void addIDispatchRemindListener(IDispatchRemindClickListener listener) { if (listener == null) { - Logger.d(TAG, "addIDispatchRemindListener listener is null"); return; } this.mListener = listener; diff --git a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java index 969c0b33ff..53c25185b0 100644 --- a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java +++ b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java @@ -8,9 +8,7 @@ import android.os.Message; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo; import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean; import com.mogo.eagle.core.data.map.MogoLatLng; @@ -22,7 +20,7 @@ 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.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.module.common.MogoApisHandler; import com.zhjt.dispatch.model.DispatchServiceModel; @@ -31,11 +29,11 @@ import com.mogo.service.cloud.socket.IMogoOnMessageListener; import com.zhjt.dispatch.model.IDispatch; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DISPATCH; import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIRM; import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL; import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL; @@ -87,7 +85,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener 0) { TIMER--; - Logger.d(TAG,"timer : " + TIMER); tvTimer.setText(String.valueOf(TIMER)); - handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER,1000L); + handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER, 1000L); } else { hideDialog(); } @@ -70,7 +67,7 @@ public class DispatchCarsDialog extends DispatchBaseDialog{ dismissDialog(); } - private void dismissDialog(){ + private void dismissDialog() { handler.removeMessages(MSG_TYPE_TIMER); TIMER = 10; dismiss(); @@ -79,7 +76,6 @@ public class DispatchCarsDialog extends DispatchBaseDialog{ @Override public void addIDispatchRemindListener(IDispatchRemindClickListener listener) { if (listener == null) { - Logger.d(TAG, "addIDispatchRemindListener listener is null"); return; } this.mListener = listener; @@ -87,7 +83,7 @@ public class DispatchCarsDialog extends DispatchBaseDialog{ @Override public void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent) { - if(TextUtils.isEmpty(dispatchContent.getEndLocAddress())){ + if (TextUtils.isEmpty(dispatchContent.getEndLocAddress())) { return; } show(); diff --git a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchDialogManager.java b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchDialogManager.java index b53c77393a..67ec158a58 100644 --- a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchDialogManager.java +++ b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchDialogManager.java @@ -10,11 +10,9 @@ import android.content.Context; import com.mogo.commons.voice.AIAssist; import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; public class DispatchDialogManager { - private static final String TAG = "DispatchDialogManager"; private static volatile DispatchDialogManager manager; private static final byte[] obj = new byte[0]; private final Context mContext; @@ -38,7 +36,6 @@ public class DispatchDialogManager { public void addIDispatchRemindListener(IDispatchRemindClickListener listener) { if (listener == null) { - Logger.d(TAG, "addIDispatchRemindListener listener is null"); return; } this.mListener = listener; diff --git a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchTestPanelBroadCastReceiver.java b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchTestPanelBroadCastReceiver.java index 6ae532bf38..caca3a4540 100644 --- a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchTestPanelBroadCastReceiver.java +++ b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchTestPanelBroadCastReceiver.java @@ -4,8 +4,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; - public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver { private static final String TAG = "DispatchTestPanelBroadCastReceiver"; @@ -19,7 +17,6 @@ public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { try { int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0); - Logger.d(TAG, "textPanelOpenType:" + sceneType); // 分发场景 dispatchSceneTest(sceneType); } catch (Exception e) { @@ -33,7 +30,6 @@ public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver { * @param sceneType 场景类型 */ private void dispatchSceneTest(int sceneType) { - Logger.d(TAG, "sceneType=" + sceneType); if (sceneType == 0) { DispatchAutoPilotManager.getInstance().testEZhouStart(); } else if (sceneType == 1) { diff --git a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/model/DispatchServiceModel.java b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/model/DispatchServiceModel.java index 5aa32a3407..60c04e640e 100644 --- a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/model/DispatchServiceModel.java +++ b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/model/DispatchServiceModel.java @@ -12,7 +12,6 @@ import com.mogo.eagle.core.data.dispatch.ReportedRoute; import com.mogo.eagle.core.network.RequestOptions; import com.mogo.eagle.core.network.SubscribeImpl; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.MogoApisHandler; import java.util.HashMap; @@ -25,7 +24,6 @@ import io.reactivex.schedulers.Schedulers; public class DispatchServiceModel { - private static final String TAG = "DispatchServiceModel"; private static volatile DispatchServiceModel instance; private static final byte[] obj = new byte[0]; @@ -73,13 +71,11 @@ public class DispatchServiceModel { @Override public void onNext(BaseData o) { super.onNext(o); - //Logger.d(TAG, "uploadAutopilotStatus success"); } @Override public void onError(Throwable e) { super.onError(e); - Logger.d(TAG, "uploadAutopilotStatus error : " + e.getMessage()); } @Override @@ -107,13 +103,11 @@ public class DispatchServiceModel { @Override public void onNext(BaseData o) { super.onNext(o); - Logger.d(TAG, "uploadAutopilotRoute success"); } @Override public void onError(Throwable e) { super.onError(e); - Logger.d(TAG, "uploadAutopilotRoute error : " + e.getMessage()); } @Override @@ -141,14 +135,12 @@ public class DispatchServiceModel { @Override public void onNext(BaseData o) { super.onNext(o); - Logger.d(TAG, "dispatchResultUpload success"); dispatch.onSuccess(); } @Override public void onError(Throwable e) { super.onError(e); - Logger.d(TAG, "dispatchResultUpload error : " + e.getMessage()); dispatch.onError(e.getMessage()); } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java index 3f5418d145..06018ca373 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java @@ -5,7 +5,6 @@ package com.mogo.eagle.core.function.hmi; * @date 2021/8/3 4:26 下午 */ public class WaringConst { - public static String MODULE_NAME = "MODULE_HMI_WARING"; // V2X 弹窗预警 // 是否展示:true-展示,false-关闭 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloat.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloat.kt index b614320418..aa27bd98ee 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloat.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloat.kt @@ -9,7 +9,9 @@ import androidx.lifecycle.ProcessLifecycleOwner import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern import com.mogo.eagle.core.function.hmi.notification.interfaces.OnFloatAnimator import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.utilcode.reminder.Reminder import com.mogo.eagle.core.utilcode.reminder.api.impl.ViewReminder import com.mogo.eagle.core.utilcode.util.WindowUtils @@ -175,7 +177,7 @@ class WarningFloat { when { // 未设置浮窗布局文件/布局视图,不予创建 config.layoutId == null && config.layoutView == null -> - Logger.e(TAG, "需要传入 layoutId 或 layoutView ") + CallerLogger.e("$M_HMI$TAG", "需要传入 layoutId 或 layoutView ") // 申请浮窗权限 else -> { var content: View? = null diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloatWindowHelper.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloatWindowHelper.kt index 566fb26c10..635188dc3a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloatWindowHelper.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/notification/WarningFloatWindowHelper.kt @@ -7,7 +7,6 @@ import android.app.Service import android.content.Context import android.graphics.PixelFormat import android.graphics.Rect -import android.util.Log import android.view.Gravity import android.view.LayoutInflater import android.view.View @@ -15,7 +14,8 @@ import android.view.WindowManager import com.mogo.eagle.core.function.hmi.notification.anim.AnimatorManager import com.mogo.eagle.core.function.hmi.notification.enums.ShowPattern import com.mogo.eagle.core.function.hmi.notification.widget.ParentFrameLayout -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.utilcode.util.WindowUtils /** @@ -47,7 +47,7 @@ internal class WarningFloatWindowHelper( config.isShow = true true } else { - Logger.e(TAG, "activity 必须是 Activity 的实现") + CallerLogger.e("$M_HMI$TAG", "activity 必须是 Activity 的实现") false } } @@ -125,7 +125,6 @@ internal class WarningFloatWindowHelper( fun resetDownTime() { // 设置倒计时指定秒数后自动关闭Window if (config.countDownTime > 0) { - Log.d(TAG, "重置弹窗时常") frameLayout?.removeCallbacks(closeWarningTask) frameLayout?.postDelayed(closeWarningTask, config.countDownTime) } @@ -217,7 +216,7 @@ internal class WarningFloatWindowHelper( // removeView是异步删除,在Activity销毁的时候会导致窗口泄漏,所以使用removeViewImmediate直接删除view windowManager.run { if (force) removeViewImmediate(frameLayout) else removeView(frameLayout) } } catch (e: Exception) { - Logger.e(TAG, "浮窗关闭出现异常:$e") + CallerLogger.e("$M_HMI$TAG", "浮窗关闭出现异常:$e") } @@ -259,7 +258,6 @@ internal class WarningFloatWindowHelper( // 上中 Gravity.CENTER_HORIZONTAL, Gravity.TOP or Gravity.CENTER_HORIZONTAL -> { params.x = (parentRect.right - view.width).shr(1) - Log.d(TAG, "layoutParams:${params.x},${params.y}") } // 下中 Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL -> { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/TurnLightBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/TurnLightBroadcastReceiver.kt index 5fcdff1252..a5a3e6f644 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/TurnLightBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/TurnLightBroadcastReceiver.kt @@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.hmi.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.util.Log import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.notice.NoticeNormalData diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt index 554c398818..3ffff859ef 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt @@ -7,7 +7,8 @@ import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.hmi.WaringConst -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.service.IMogoServiceApis /** @@ -40,8 +41,8 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() { 0 ) - Logger.d( - TAG, + CallerLogger.d( + "$M_HMI$TAG", "limitingVelocityIsShow:$limitingVelocityIsShow limitingVelocitySpeed:$limitingVelocitySpeed" ) if (limitingVelocityIsShow) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt index 9cfd191f6c..a68d67770c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt @@ -7,7 +7,6 @@ import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.hmi.WaringConst -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.service.IMogoServiceApis /** @@ -40,10 +39,6 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() { 0 ) - Logger.d( - TAG, - "trafficLightIsShow:$trafficLightIsShow trafficLightCheckType:$trafficLightCheckType" - ) if (trafficLightIsShow) { // 分发场景 dispatchShowWaring(trafficLightCheckType) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt index 3e435c02db..c3a6278fa2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt @@ -7,7 +7,8 @@ import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.hmi.WaringConst -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.module.common.enums.EventTypeEnum import com.mogo.service.IMogoServiceApis @@ -39,8 +40,8 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { intent.getStringExtra(WaringConst.BROADCAST_V2X_TTS_CONTENT_EXTRA_KEY) val tag = intent.getStringExtra(WaringConst.BROADCAST_V2X_TAG_EXTRA_KEY) - Logger.d( - TAG, + CallerLogger.d( + "$M_HMI$TAG", "v2xType:$v2xType alertContent:$alertContent ttsContent:$ttsContent tag:$tag" ) if (v2xIsShow) { 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 5d7aa151a5..693ebfd9b7 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 @@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.hmi.ui import android.animation.Animator import android.os.Bundle import android.text.TextUtils -import android.util.Log import android.view.Gravity import android.view.View import android.view.WindowManager @@ -16,6 +15,7 @@ import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper import com.mogo.eagle.core.data.camera.CameraEntity import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.constants.MoGoFragmentPaths +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData @@ -25,6 +25,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager import com.mogo.eagle.core.function.call.check.CallerCheckManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager import com.mogo.eagle.core.function.hmi.R @@ -38,7 +39,6 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.Utils @@ -55,8 +55,8 @@ import java.util.* */ @Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI) class MoGoHmiFragment : MvpFragment(), - IMoGoWaringProvider, - MoGoWarningContract.View, IMoGoAutopilotIdentifyListener { + IMoGoWaringProvider, + MoGoWarningContract.View, IMoGoAutopilotIdentifyListener { private val TAG = "MoGoHmiFragment" // DebugSettingView @@ -83,7 +83,6 @@ class MoGoHmiFragment : MvpFragment override fun vipIdentification(visible: Boolean) { ThreadUtils.runOnUiThread { - Logger.d(TAG, "vipIdentification") if (visible) { flVipIdentificationView?.visibility = View.VISIBLE } else { @@ -135,7 +134,13 @@ class MoGoHmiFragment : MvpFragment CallerDevaToolsManager.onReceiveBadCaseRecord(record) } if (record.type == 2 && (record.stat == 101 || record.stat == 100)) { - CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.filename ?: "", record.note ?: "") + CallerMapDataCollectorManager.finish( + record.id, + record.stat, + "", + record.filename ?: "", + record.note ?: "" + ) } } @@ -174,7 +179,6 @@ class MoGoHmiFragment : MvpFragment private fun showToolsFloat() { - Logger.d(TAG, "showToolsFloat") context?.let { if (toolsViewFloat == null) { if (toolsView == null) { @@ -196,41 +200,41 @@ class MoGoHmiFragment : MvpFragment }) } toolsViewFloat = WarningFloat.with(it) - .setTag("ToolsViewFloat") - .setLayout(toolsView!!) - .setSidePattern(SidePattern.LEFT) - .setGravity(Gravity.LEFT, offsetY = 72) - .setImmersionStatusBar(true) - .setWindowHeight(WindowManager.LayoutParams.MATCH_PARENT) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } + .setTag("ToolsViewFloat") + .setLayout(toolsView!!) + .setSidePattern(SidePattern.LEFT) + .setGravity(Gravity.LEFT, offsetY = 72) + .setImmersionStatusBar(true) + .setWindowHeight(WindowManager.LayoutParams.MATCH_PARENT) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern) + ?.apply { + interpolator = OvershootInterpolator() + } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onDismiss() { - toolsViewFloat = null - toolsView = null - // TODO:("") - } - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onDismiss() { + toolsViewFloat = null + toolsView = null + // TODO:("") + } + }) + .show() } else { toolsViewFloat?.show() } @@ -306,7 +310,7 @@ class MoGoHmiFragment : MvpFragment * 开关DebugView */ override fun toggleDebugView() { - Log.d(TAG, "长按显示状态工具栏") + CallerLogger.d("$M_HMI$TAG", "长按显示状态工具栏") context?.let { if (mDebugSettingViewFloat != null) { WarningFloat.dismiss(mDebugSettingViewFloat!!.config.floatTag, false) @@ -317,33 +321,33 @@ class MoGoHmiFragment : MvpFragment mDebugSettingView = DebugSettingView(it) } mDebugSettingViewFloat = WarningFloat.with(it) - .setTag("DebugSettingView") - .setLayout(mDebugSettingView!!) - .setSidePattern(SidePattern.RIGHT) - .setGravity(Gravity.RIGHT, offsetY = 70) - .setImmersionStatusBar(true) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } + .setTag("DebugSettingView") + .setLayout(mDebugSettingView!!) + .setSidePattern(SidePattern.RIGHT) + .setGravity(Gravity.RIGHT, offsetY = 70) + .setImmersionStatusBar(true) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern) + ?.apply { + interpolator = OvershootInterpolator() + } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .show() } } } @@ -357,7 +361,15 @@ class MoGoHmiFragment : MvpFragment * @param tag tag绑定弹窗的标志 */ @Synchronized - override fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) { + override fun showWarningV2X( + v2xType: Int, + alertContent: CharSequence?, + ttsContent: String?, + tag: String?, + listenerIMoGo: IMoGoWarningStatusListener?, + playTts: Boolean, + expireTime: Long + ) { lifecycleScope.launchWhenResumed { activity?.let { val floatWindow = mWarningFloat @@ -366,9 +378,9 @@ class MoGoHmiFragment : MvpFragment val notificationView = V2XNotificationView(it) notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString())) val warningContent = alertContent - ?: EventTypeEnum.getWarningContent(v2xType.toString()) + ?: EventTypeEnum.getWarningContent(v2xType.toString()) if (warningContent.isEmpty()) { - Logger.e(TAG, "Show warningContent is null or empty!") + CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!") return@launchWhenResumed } else { notificationView.setWarningContent(warningContent) @@ -377,48 +389,49 @@ class MoGoHmiFragment : MvpFragment WarningFloat.dismiss(floatWindow.config.floatTag, true) } mWarningFloat = WarningFloat.with(it) - .setTag(tag) - .setLayout(notificationView) - .setSidePattern(SidePattern.RESULT_TOP) - .setCountDownTime(expireTime) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .isEnqueue(true) - .addWarningStatusListener(listenerIMoGo) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 - Logger.d( - "MoGoWarningFragment", - "mWarningFloat = $mWarningFloat---ttsContent = $ttsContent" - ) - if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) { - Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent") - AIAssist.getInstance(activity) - .speakTTSVoice(ttsContent) - } + .setTag(tag) + .setLayout(notificationView) + .setSidePattern(SidePattern.RESULT_TOP) + .setCountDownTime(expireTime) + .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) + .setImmersionStatusBar(true) + .isEnqueue(true) + .addWarningStatusListener(listenerIMoGo) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onShow() { + // 创建弹窗成功才进行TTS播报 + CallerLogger.d( + "$M_HMI$TAG", + "mWarningFloat = $mWarningFloat---ttsContent = $ttsContent" + ) + if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) { + CallerLogger.d("$M_HMI$TAG", "---> ttsContent = $ttsContent") + AIAssist.getInstance(activity) + .speakTTSVoice(ttsContent) + } + } + }) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern)?.apply { + interpolator = OvershootInterpolator() } - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern)?.apply { - interpolator = OvershootInterpolator() - } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200) - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .show() } else { val notification = floatWindow.config.layoutView as? V2XNotificationView if (alertContent?.isNotEmpty() == true) { @@ -537,42 +550,42 @@ class MoGoHmiFragment : MvpFragment mNoticeFloat = it?.let { it1 -> noticeBannerView?.let { it2 -> WarningFloat.with(it1) - .setTag(WaringConst.NOTICE_FOR_TRAFFIC_KEY) - .setLayout(it2) - .setSidePattern(SidePattern.TOP) - .setCountDownTime(60 * 1000 * 3) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 + .setTag(WaringConst.NOTICE_FOR_TRAFFIC_KEY) + .setLayout(it2) + .setSidePattern(SidePattern.TOP) + .setCountDownTime(60 * 1000 * 3) + .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) + .setImmersionStatusBar(true) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onShow() { + // 创建弹窗成功才进行TTS播报 // AIAssist.getInstance(activity) // .speakTTSVoice("") - } + } - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } + }) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern) + ?.apply { + interpolator = OvershootInterpolator() + } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .show() } } } @@ -587,41 +600,41 @@ class MoGoHmiFragment : MvpFragment mNoticeFloat = it.let { it1 -> noticeBannerView?.let { it2 -> WarningFloat.with(it1) - .setTag(WaringConst.NOTICE_FOR_NORMAL_KEY) - .setLayout(it2) - .setSidePattern(SidePattern.TOP) - .setCountDownTime(10000) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 - // AIAssist.getInstance(activity) - // .speakTTSVoice("") - } - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } + .setTag(WaringConst.NOTICE_FOR_NORMAL_KEY) + .setLayout(it2) + .setSidePattern(SidePattern.TOP) + .setCountDownTime(10000) + .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) + .setImmersionStatusBar(true) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onShow() { + // 创建弹窗成功才进行TTS播报 + // AIAssist.getInstance(activity) + // .speakTTSVoice("") + } + }) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern) + ?.apply { + interpolator = OvershootInterpolator() + } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .show() } } } @@ -676,40 +689,40 @@ class MoGoHmiFragment : MvpFragment } }) cameraViewFloat = WarningFloat.with(it) - .setTag("CameraListFloat") - .setLayout(cameraListView!!) - .setSidePattern(SidePattern.RIGHT) - .setGravity(Gravity.RIGHT, -40, 280) - .setImmersionStatusBar(true) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } + .setTag("CameraListFloat") + .setLayout(cameraListView!!) + .setSidePattern(SidePattern.RIGHT) + .setGravity(Gravity.RIGHT, -40, 280) + .setImmersionStatusBar(true) + .setAnimator(object : DefaultAnimator() { + override fun enterAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.enterAnim(view, params, windowManager, sidePattern) + ?.apply { + interpolator = OvershootInterpolator() + } - override fun exitAnim( - view: View, - params: WindowManager.LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onDismiss() { - cameraViewFloat = null - cameraListView = null - ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_nor) - } - }) - .show() + override fun exitAnim( + view: View, + params: WindowManager.LayoutParams, + windowManager: WindowManager, + sidePattern: SidePattern + ): Animator? = + super.exitAnim(view, params, windowManager, sidePattern) + ?.setDuration(200) + }) + .addWarningStatusListener(object : IMoGoWarningStatusListener { + override fun onDismiss() { + cameraViewFloat = null + cameraListView = null + ivCameraIcon.setBackgroundResource(R.drawable.icon_camera_nor) + } + }) + .show() } else { cameraViewFloat?.show() } @@ -737,7 +750,6 @@ class MoGoHmiFragment : MvpFragment */ override fun showTurnLight(light: Int) { if (HmiBuildConfig.isShowTurnLightView) { - //Log.d("liyz", "showTurnLight light = $light") turnLightView.setTurnLight(light) } } @@ -747,7 +759,6 @@ class MoGoHmiFragment : MvpFragment */ override fun showBrakeLight(light: Int) { if (HmiBuildConfig.isShowBrakeLightView) { -// Log.d("liyz", "showBrakeLight light = $light") brakeView.setBrakeLight(light) } } @@ -770,20 +781,20 @@ class MoGoHmiFragment : MvpFragment * @param upgradeStatus 升级状态 */ override fun showAdUpgradeStatus( - upgradeMode: Int, - downloadStatus: Int, - currentProgress: Int, - totalProgress: Int, - downloadVersion: String, - upgradeStatus: Int + upgradeMode: Int, + downloadStatus: Int, + currentProgress: Int, + totalProgress: Int, + downloadVersion: String, + upgradeStatus: Int ) { ThreadUtils.runOnUiThread { val tipsView = upgradeTipsView?.invoke() //如果工控机处于“下载中”、“可升级(下载完成)”、“升级中”、“升级失败”状态时,工具箱入口显示红色角标 if (AdUpgradeStateHelper.showUpgradeTips(downloadStatus, upgradeStatus)) { - if (HmiBuildConfig.isShowUpgradeTipsView){ + if (HmiBuildConfig.isShowUpgradeTipsView) { viewUpgradeTips?.visibility = View.VISIBLE - }else{ + } else { tipsView?.let { it.visibility = View.VISIBLE } @@ -795,7 +806,14 @@ class MoGoHmiFragment : MvpFragment } } //将状态同步到工具箱 - toolsView?.showAdUpgradeStatus(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus) + toolsView?.showAdUpgradeStatus( + upgradeMode, + downloadStatus, + currentProgress, + totalProgress, + downloadVersion, + upgradeStatus + ) } } @@ -847,7 +865,7 @@ class MoGoHmiFragment : MvpFragment override fun onDestroy() { super.onDestroy() - Log.d(TAG, "onDestroy") + CallerLogger.d("$M_HMI$TAG", "onDestroy") } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt index 66a91604f8..0a02ae8999 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt @@ -23,7 +23,8 @@ import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive import com.mogo.eagle.core.data.camera.CameraEntity import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder @@ -33,7 +34,6 @@ import com.shuyu.gsyvideoplayer.player.PlayerFactory import com.shuyu.gsyvideoplayer.utils.GSYVideoType import kotlinx.android.synthetic.main.view_camera_list.view.* import tv.danmaku.ijk.media.player.IjkMediaPlayer -import java.lang.Exception /** * @author ChenFufeng @@ -100,16 +100,16 @@ class CameraListView : FrameLayout { when { !cameraEntity.isCarLive() -> { if (!cameraEntity.flvUrl.isNullOrEmpty()) { - Logger.d( - TAG, + CallerLogger.d( + "$M_HMI$TAG", "播放地址为:${cameraEntity.flvUrl!!},ip为:${cameraEntity.ip}" ) gsyVideoPlay(cameraEntity.flvUrl!!) } else if (!cameraEntity.ip.isNullOrEmpty()) { - Logger.d(TAG, "打开推流的摄像头ip为:${cameraEntity.ip}") + CallerLogger.d("$M_HMI$TAG", "打开推流的摄像头ip为:${cameraEntity.ip}") CallerMonitorManager.openCameraStream(cameraEntity.ip!!) } else { - Logger.e(TAG, "摄像头视频播放地址和ip均为空") + CallerLogger.e("$M_HMI$TAG", "摄像头视频播放地址和ip均为空") } } else -> { @@ -145,7 +145,7 @@ class CameraListView : FrameLayout { PlayerFactory.setPlayManager(IjkPlayerManager::class.java) svpPlayer.setPlayListener(object : SimpleVideoPlayer.PlayListener { override fun onPlayEvent(event: Int) { - Logger.d(TAG, "onPlayEvent: event is:$event") + CallerLogger.d("$M_HMI$TAG", "onPlayEvent: event is:$event") when (event) { SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING -> { // 会出现临时中断后又可以继续播放,需要停掉倒计时 @@ -162,7 +162,7 @@ class CameraListView : FrameLayout { } } else -> { - Logger.w(TAG, "播放视频异常,event is:$event") + CallerLogger.w("$M_HMI$TAG", "播放视频异常,event is:$event") showNoSignalView() if (!valueAnimator.isStarted && !valueAnimator.isRunning) { valueAnimator.start() @@ -217,8 +217,8 @@ class CameraListView : FrameLayout { liveStreamManager.setLiveStatusChangeCallback { textureView .post { - handleSnLiveStatus(it) - } + handleSnLiveStatus(it) + } } } @@ -250,11 +250,14 @@ class CameraListView : FrameLayout { private val trafficCarLiveCallBack = object : ITrafficCarLiveCallBack { override fun onLive(liveSn: String?) { - Logger.d(TAG, "onLive") + CallerLogger.d("$M_HMI$TAG", "onLive") } override fun onFirstFrame() { - Logger.d(TAG, "onFirstFrame:isFirstPage is:$isFirstPage,isCarLive is:${isCarLive()}") + CallerLogger.d( + "$M_HMI$TAG", + "onFirstFrame:isFirstPage is:$isFirstPage,isCarLive is:${isCarLive()}" + ) if (!isFirstPage && isCarLive()) { clickListener?.onShowLive(true) // 会出现临时中断后又可以继续播放,需要停掉倒计时 @@ -269,7 +272,7 @@ class CameraListView : FrameLayout { } override fun onDisConnect() { - Logger.e(TAG, "onDisConnect") + CallerLogger.e("$M_HMI$TAG", "onDisConnect") if (!isFirstPage && isCarLive()) { showNoSignalView() if (!valueAnimator.isStarted && !valueAnimator.isRunning) { @@ -279,7 +282,7 @@ class CameraListView : FrameLayout { } override fun onError(errorMsg: String?) { - Logger.e(TAG, "onError msg is:${errorMsg}") + CallerLogger.e("$M_HMI$TAG", "onError msg is:${errorMsg}") if (!isFirstPage && isCarLive()) { // 发生错误 showNoSignalView() @@ -299,7 +302,7 @@ class CameraListView : FrameLayout { @SuppressLint("NotifyDataSetChanged") fun refreshCameraList(cameraInfoList: List?) { - Logger.d(TAG, "refreshCameraList") + CallerLogger.d("$M_HMI$TAG", "refreshCameraList") this.cameraInfoList.clear() cameraInfoList?.let { this.cameraInfoList.addAll(it) @@ -338,13 +341,16 @@ class CameraListView : FrameLayout { } private fun stopLive() { - Logger.d(TAG, "stopLive") + CallerLogger.d("$M_HMI$TAG", "stopLive") when { !isCarLive() -> { try { GSYVideoManager.releaseAllVideos() } catch (e: Exception) { - Logger.e(TAG, "stopLive exception msg is:${e.message},cause is:${e.cause}") + CallerLogger.e( + "$M_HMI$TAG", + "stopLive exception msg is:${e.message},cause is:${e.cause}" + ) e.printStackTrace() } } @@ -352,7 +358,7 @@ class CameraListView : FrameLayout { if (!liveSn.isNullOrEmpty()) { MoGoAiCloudTrafficLive.stopCarLive(liveSn) } else { - Logger.d(TAG, "StopCarLive sn is null or empty!") + CallerLogger.d("$M_HMI$TAG", "StopCarLive sn is null or empty!") } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/carcorder/CarcorderPreviewView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/carcorder/CarcorderPreviewView.kt index b67917db9c..cbd7938af3 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/carcorder/CarcorderPreviewView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/carcorder/CarcorderPreviewView.kt @@ -5,17 +5,17 @@ import android.app.Activity import android.content.Context import android.hardware.usb.UsbDevice import android.os.Looper -import android.util.Log import android.view.* import android.view.animation.OvershootInterpolator import com.mogo.cloud.live.manager.ILiveStreamManager import com.mogo.cloud.live.manager.LiveStreamManagerImpl import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.notification.WarningFloat import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.usbcamera.UVCCameraHelper import com.serenegiant.usb.ParentPreviewConstraintLayout import com.serenegiant.usb.widget.CameraViewInterface @@ -116,7 +116,7 @@ class CarcorderPreviewView private constructor( private val listener: UVCCameraHelper.OnMyDevConnectListener = object : UVCCameraHelper.OnMyDevConnectListener { override fun onAttachDev(device: UsbDevice?) { - Log.d(TAG, "onAttachDev") + CallerLogger.d("$M_HMI$TAG", "onAttachDev") // request open permission if (!isRequest) { isRequest = true @@ -125,7 +125,7 @@ class CarcorderPreviewView private constructor( } override fun onDettachDev(device: UsbDevice) { - Log.d(TAG, "onDettachDev") + CallerLogger.d("$M_HMI$TAG", "onDettachDev") // close camera if (isRequest) { isRequest = false @@ -135,7 +135,7 @@ class CarcorderPreviewView private constructor( } override fun onConnectDev(device: UsbDevice?, isConnected: Boolean) { - Log.d(TAG, "onConnectDev:isConnected=$isConnected") + CallerLogger.d("$M_HMI$TAG", "onConnectDev:isConnected=$isConnected") if (!isConnected) { showShortMsg("fail to connect,please check resolution params") isPreview = false @@ -152,8 +152,8 @@ class CarcorderPreviewView private constructor( } Looper.prepare() if (mCameraHelper != null && mCameraHelper!!.isCameraOpened) { - Logger.d(TAG, "亮度(brightness):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_BRIGHTNESS)}") - Logger.d(TAG, "对比度(contrast):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_CONTRAST)}") + CallerLogger.d("$M_HMI$TAG", "亮度(brightness):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_BRIGHTNESS)}") + CallerLogger.d("$M_HMI$TAG", "对比度(contrast):${mCameraHelper!!.getModelValue(UVCCameraHelper.MODE_CONTRAST)}") } Looper.loop() }.start() @@ -161,12 +161,12 @@ class CarcorderPreviewView private constructor( } override fun onDisConnectDev(device: UsbDevice?) { - Log.d(TAG, "onDisConnectDev") + CallerLogger.d("$M_HMI$TAG", "onDisConnectDev") showShortMsg("相机断开连接") } override fun onCancelDev(device: UsbDevice?) { - Log.d(TAG, "onCancelDev:" + device?.deviceName) + CallerLogger.d("$M_HMI$TAG", "onCancelDev:" + device?.deviceName) } } @@ -183,8 +183,7 @@ class CarcorderPreviewView private constructor( mCameraHelper?.initUSBMonitor(context as Activity, carcorderPreview, listener) mCameraHelper?.setOnPreviewFrameListener { nv21Yuv -> - Log.d(TAG, "onPreviewResult: " + nv21Yuv.size) - //Log.i(TAG, "onVideoFrame byte length: " + bytesLength); + CallerLogger.d("$M_HMI$TAG", "onPreviewResult: " + nv21Yuv.size) if (liveStreamManager != null) { // 将摄像头采集的YUV数据推送到ZEGO liveStreamManager!!.notifyYUVData(nv21Yuv, 640, 480, 2) @@ -208,9 +207,9 @@ class CarcorderPreviewView private constructor( // 设置状态回调 liveStreamManager!!.setLiveStatusChangeCallback { status -> if (status == 0) { - Logger.d(TAG, "直播中……") + CallerLogger.d("$M_HMI$TAG", "直播中……") } else { - Logger.d(TAG, "直播结束……") + CallerLogger.d("$M_HMI$TAG", "直播结束……") } } } 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 652fc002f8..6d2c91ec3c 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 @@ -3,12 +3,13 @@ package com.mogo.eagle.core.function.hmi.ui.notice import android.content.Context import android.graphics.Bitmap import android.text.TextUtils -import android.util.Log import android.view.View import android.widget.ImageView import android.widget.TextView import androidx.lifecycle.LifecycleObserver +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI 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 @@ -209,15 +210,15 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO } override fun onClickStop(url: String, vararg objects: Any) { - Log.d(TAG, "onClickStop") + CallerLogger.d(M_HMI + TAG, "onClickStop") } override fun onStartPrepared(url: String, vararg objects: Any) { - Log.d(TAG, "onStartPrepared") + CallerLogger.d(M_HMI + TAG, "onStartPrepared") } override fun onPlayError(url: String, vararg objects: Any) { - Log.d(TAG, "onPlayError") + CallerLogger.d(M_HMI + TAG, "onPlayError") pushImageView?.visibility = View.GONE pushVideo?.visibility = View.GONE playImageView!!.visibility = View.GONE @@ -244,7 +245,7 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO override fun onClickStartThumb(url: String, vararg objects: Any) {} override fun onClickBlank(url: String, vararg objects: Any) {} override fun onClickBlankFullscreen(url: String, vararg objects: Any) { - Log.d(TAG, "onClickBlankFullscreen") + CallerLogger.d(M_HMI + TAG, "onClickBlankFullscreen") } }) }).start() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java index 6bcfe25e95..9b4c8ea91a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficAdapter.java @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.hmi.ui.notice; import android.content.Context; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -10,7 +9,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo; import com.mogo.eagle.core.data.notice.NoticeValue; import com.mogo.eagle.core.function.hmi.R; @@ -23,7 +21,6 @@ import java.util.List; * @since: 10/26/21 */ class NoticeTrafficAdapter extends RecyclerView.Adapter { - private String TAG = "AINotice"; LayoutInflater mLayoutInflater; private List data = new ArrayList(); @@ -41,8 +38,7 @@ class NoticeTrafficAdapter extends RecyclerView.Adapter { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View v = mLayoutInflater.inflate(R.layout.notice_traffice_info_list_adapter, parent, false); - TrafficInfoHolder holder = new TrafficInfoHolder(v); - return holder; + return new TrafficInfoHolder(v); } @Override @@ -61,13 +57,12 @@ class NoticeTrafficAdapter extends RecyclerView.Adapter { @Override public int getItemCount() { - Log.d(TAG, "getItemCount++" + String.valueOf(data.size())); return data.size(); } - public class TrafficInfoHolder extends RecyclerView.ViewHolder { - private TextView keyText; - private TextView valueText; + private static class TrafficInfoHolder extends RecyclerView.ViewHolder { + private final TextView keyText; + private final TextView valueText; public TrafficInfoHolder(@NonNull View itemView) { super(itemView); 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 45034361db..ba343cca12 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 @@ -1,8 +1,9 @@ package com.mogo.eagle.core.function.hmi.ui.notice; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; + import android.content.Context; import android.graphics.Bitmap; -import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; @@ -20,6 +21,7 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.data.notice.NoticeValue; import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; +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; @@ -56,12 +58,12 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs private ImageView close; private ImageView playImageView; private MogoImageView thumbnailImage; - private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); + private final GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); private TextView accept;//接受 private TextView refuse;//拒绝 private TextView connect;//连接 private NoticeTrafficAdapter adapter; - private ArrayList dataArrayList = new ArrayList(); + private final ArrayList dataArrayList = new ArrayList(); private NoticeTrafficStyleInfo.NoticeTrafficAccountInfo mTrafficStyleInfo; private IMogoServiceApis mServiceApis; @@ -82,7 +84,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs playerShow();//视频播放器及接操作按钮 recyclerVie();//详情信息列表 mServiceApis = MogoApisHandler.getInstance().getApis(); - mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice); + mServiceApis.getStatusManagerApi().registerStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice); } /** @@ -93,9 +95,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs mVideoPlayer = findViewById(R.id.video_player); thumbnailImage = findViewById(R.id.thumbnail_image); playImageView = this.findViewById(R.id.start_for_traffic); - playImageView.setOnClickListener(v -> { - startLive(); - }); + playImageView.setOnClickListener(v -> startLive()); close = findViewById(R.id.notice_traffic_dialog_close); close.setOnClickListener(v -> { releasePlayer(); @@ -104,12 +104,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs accept = findViewById(R.id.accept_traffic); refuse = findViewById(R.id.refuse_traffic); connect = findViewById(R.id.notice_connect); - accept.setOnClickListener(v -> { - feedBackTraffic(1); - }); - refuse.setOnClickListener(v -> { - feedBackTraffic(0); - }); + accept.setOnClickListener(v -> feedBackTraffic(1)); + refuse.setOnClickListener(v -> feedBackTraffic(0)); //重新连接 connect.setOnClickListener(v -> { netWorkStatus(); @@ -127,14 +123,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs playImageView.setVisibility(View.INVISIBLE); thumbnailImage.setVisibility(View.VISIBLE); } - mVideoPlayer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mVideoPlayer.getCurrentState() == GSYVideoView.CURRENT_STATE_PAUSE) {/*播放中*/ - resume(); - } else { - pause(); - } + mVideoPlayer.setOnClickListener(v -> { + if (mVideoPlayer.getCurrentState() == GSYVideoView.CURRENT_STATE_PAUSE) {/*播放中*/ + resume(); + } else { + pause(); } }); @@ -179,13 +172,13 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs parameters.isSpeakVoice = false; parameters.vehicleType = 10; //云平台使用的是火星坐标,自动驾驶需要wgs84 - double[] gcj02 = CoordinateUtils.transformGcj02toWgs84(mTrafficStyleInfo.getLat(),mTrafficStyleInfo.getLon()); + double[] gcj02 = CoordinateUtils.transformGcj02toWgs84(mTrafficStyleInfo.getLat(), mTrafficStyleInfo.getLon()); AutopilotControlParameters.AutoPilotLonLat startLocation = new AutopilotControlParameters.AutoPilotLonLat (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat()); parameters.startLatLon = startLocation; AutopilotControlParameters.AutoPilotLonLat endLocation = new AutopilotControlParameters.AutoPilotLonLat - (gcj02[0],gcj02[1]); + (gcj02[0], gcj02[1]); parameters.endLatLon = endLocation; CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters); } @@ -196,12 +189,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs private void pause() { playImageView.setVisibility(View.VISIBLE); thumbnailImage.setVisibility(View.GONE); - playImageView.setOnClickListener(v -> { - mVideoPlayer.onVideoResume(); - }); - thumbnailImage.setOnClickListener(v -> { - mVideoPlayer.onVideoResume(); - }); + playImageView.setOnClickListener(v -> mVideoPlayer.onVideoResume()); + thumbnailImage.setOnClickListener(v -> mVideoPlayer.onVideoResume()); } /** @@ -223,12 +212,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs (20f, GlideRoundedCornersTransform.CornerType.ALL)).into(thumbnailImage); playImageView.setImageResource(R.drawable.notice_video_play); playImageView.setVisibility(View.VISIBLE); - playImageView.setOnClickListener(v -> { - startLive(); - }); - thumbnailImage.setOnClickListener(v -> { - startLive(); - }); + playImageView.setOnClickListener(v -> startLive()); + thumbnailImage.setOnClickListener(v -> startLive()); } /** @@ -237,7 +222,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs private void startLive() { if (mPushData != null) { try { - Log.d(TAG, "交警事故开始播放视频startLive"); + CallerLogger.INSTANCE.d(M_HMI + TAG, "交警事故开始播放视频startLive"); String videoUrl = mPushData.getPoiImgUrl(); gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag("NoticeTrafficDialog") .build(mVideoPlayer); @@ -253,118 +238,115 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs } private void liveCallBack() { - new Thread(new Runnable() { - @Override - public void run() { - Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/ - mVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() { - @Override - public void onAutoComplete(String url, Object... objects) { - complete(firstBitmap); - } + new Thread(() -> { + Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/ + mVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() { + @Override + public void onAutoComplete(String url, Object... objects) { + complete(firstBitmap); + } - @Override - public void onClickResume(String url, Object... objects) { - thumbnailImage.setVisibility(View.GONE); - playImageView.setVisibility(View.GONE); - } + @Override + public void onClickResume(String url, Object... objects) { + thumbnailImage.setVisibility(View.GONE); + playImageView.setVisibility(View.GONE); + } - @Override - public void onClickStop(String url, Object... objects) { - Log.d(TAG, "onClickStop"); - } + @Override + public void onClickStop(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStop"); + } - @Override - public void onStartPrepared(String url, Object... objects) { - Log.d(TAG, "onStartPrepared"); - } + @Override + public void onStartPrepared(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onStartPrepared"); + } - @Override - public void onPrepared(String url, Object... objects) { - Log.d(TAG, "onPrepared"); - thumbnailImage.setVisibility(View.GONE); - playImageView.setVisibility(View.GONE); - connect.setVisibility(View.GONE); - } + @Override + public void onPrepared(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onPrepared"); + thumbnailImage.setVisibility(View.GONE); + playImageView.setVisibility(View.GONE); + connect.setVisibility(View.GONE); + } - @Override - public void onClickStartIcon(String url, Object... objects) { - Log.d(TAG, "onClickStartIcon"); - } + @Override + public void onClickStartIcon(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStartIcon"); + } - @Override - public void onClickStartError(String url, Object... objects) { - Log.e(TAG, "onClickStartError"); - } + @Override + public void onClickStartError(String url, Object... objects) { + CallerLogger.INSTANCE.e(M_HMI + TAG, "onClickStartError"); + } - @Override - public void onClickStopFullscreen(String url, Object... objects) { - Log.d(TAG, "onClickStopFullscreen"); - } + @Override + public void onClickStopFullscreen(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStopFullscreen"); + } - @Override - public void onClickResumeFullscreen(String url, Object... objects) { - } + @Override + public void onClickResumeFullscreen(String url, Object... objects) { + } - @Override - public void onClickSeekbar(String url, Object... objects) { - } + @Override + public void onClickSeekbar(String url, Object... objects) { + } - @Override - public void onClickSeekbarFullscreen(String url, Object... objects) { - } + @Override + public void onClickSeekbarFullscreen(String url, Object... objects) { + } - @Override - public void onEnterFullscreen(String url, Object... objects) { - } + @Override + public void onEnterFullscreen(String url, Object... objects) { + } - @Override - public void onQuitFullscreen(String url, Object... objects) { - } + @Override + public void onQuitFullscreen(String url, Object... objects) { + } - @Override - public void onQuitSmallWidget(String url, Object... objects) { - } + @Override + public void onQuitSmallWidget(String url, Object... objects) { + } - @Override - public void onEnterSmallWidget(String url, Object... objects) { - } + @Override + public void onEnterSmallWidget(String url, Object... objects) { + } - @Override - public void onTouchScreenSeekVolume(String url, Object... objects) { - } + @Override + public void onTouchScreenSeekVolume(String url, Object... objects) { + } - @Override - public void onTouchScreenSeekPosition(String url, Object... objects) { - } + @Override + public void onTouchScreenSeekPosition(String url, Object... objects) { + } - @Override - public void onTouchScreenSeekLight(String url, Object... objects) { - } + @Override + public void onTouchScreenSeekLight(String url, Object... objects) { + } - @Override - public void onPlayError(String url, Object... objects) { - thumbnailImage.setVisibility(View.VISIBLE); - connect.setVisibility(View.VISIBLE); - Log.d(TAG, "onPlayError"); - } + @Override + public void onPlayError(String url, Object... objects) { + thumbnailImage.setVisibility(View.VISIBLE); + connect.setVisibility(View.VISIBLE); + CallerLogger.INSTANCE.d(M_HMI + TAG, "onPlayError"); + } - @Override - public void onClickStartThumb(String url, Object... objects) { - Log.d(TAG, "onClickStartThumb"); - } + @Override + public void onClickStartThumb(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickStartThumb"); + } - @Override - public void onClickBlank(String url, Object... objects) { - } + @Override + public void onClickBlank(String url, Object... objects) { + } - @Override - public void onClickBlankFullscreen(String url, Object... objects) { - Log.d(TAG, "onClickBlankFullscreen"); + @Override + public void onClickBlankFullscreen(String url, Object... objects) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onClickBlankFullscreen"); - } - }); - } + } + }); }).start(); } @@ -372,11 +354,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs * 获取交通事故详情 */ private void requestTrafficInfo() { - Log.d(TAG, "requestTrafficInfo"); + CallerLogger.INSTANCE.d(M_HMI + TAG, "requestTrafficInfo"); CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), new NoticeNetCallBack() { @Override public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) { - Log.d(TAG, "交通事故详情::" + trafficInfo); + CallerLogger.INSTANCE.d(M_HMI + TAG, "交通事故详情::" + trafficInfo); mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo(); infoRefresh(mTrafficStyleInfo); } @@ -435,7 +417,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs */ private void netWorkStatus() { if (NetworkUtils.isAvailable(getContext())) { - Log.d(TAG, "网络可用"); + CallerLogger.INSTANCE.d(M_HMI + TAG, "网络可用"); thumbnailImage.setVisibility(View.GONE); connect.setVisibility(View.GONE); thumbnailImage.setBackgroundResource(R.drawable.notice_traffic_placeholder); @@ -461,17 +443,14 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs @Override public void dismiss() { super.dismiss(); - Log.d(TAG, "trafficdialog dismiss"); + CallerLogger.INSTANCE.d(M_HMI + TAG, "trafficDialog dismiss"); releasePlayer(); } - private IMogoStatusChangedListener statusChangedListenerForNotice = new IMogoStatusChangedListener() { - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) { - Log.d("AINotice", "onStatusChanged==MAIN_PAGE_IS_BACKGROUND"); - dismiss(); - } + private final IMogoStatusChangedListener statusChangedListenerForNotice = (descriptor, isTrue) -> { + if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) { + CallerLogger.INSTANCE.d(M_HMI + TAG, "onStatusChanged==MAIN_PAGE_IS_BACKGROUND"); + dismiss(); } }; } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedDrawable.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedDrawable.java index 33e75d1602..5a7c95c0e5 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedDrawable.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedDrawable.java @@ -1,21 +1,23 @@ /* -* Copyright (C) 2015 Vincent Mi -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2015 Vincent Mi + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.mogo.eagle.core.function.hmi.ui.notice.roundimage; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; + import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; @@ -32,602 +34,607 @@ import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import android.util.Log; import android.widget.ImageView.ScaleType; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; + import java.util.HashSet; import java.util.Set; @SuppressWarnings("UnusedDeclaration") public class RoundedDrawable extends Drawable { - public static final String TAG = "RoundedDrawable"; - public static final int DEFAULT_BORDER_COLOR = Color.BLACK; + public static final String TAG = "RoundedDrawable"; + public static final int DEFAULT_BORDER_COLOR = Color.BLACK; - private final RectF mBounds = new RectF(); - private final RectF mDrawableRect = new RectF(); - private final RectF mBitmapRect = new RectF(); - private final Bitmap mBitmap; - private final Paint mBitmapPaint; - private final int mBitmapWidth; - private final int mBitmapHeight; - private final RectF mBorderRect = new RectF(); - private final Paint mBorderPaint; - private final Matrix mShaderMatrix = new Matrix(); - private final RectF mSquareCornersRect = new RectF(); + private final RectF mBounds = new RectF(); + private final RectF mDrawableRect = new RectF(); + private final RectF mBitmapRect = new RectF(); + private final Bitmap mBitmap; + private final Paint mBitmapPaint; + private final int mBitmapWidth; + private final int mBitmapHeight; + private final RectF mBorderRect = new RectF(); + private final Paint mBorderPaint; + private final Matrix mShaderMatrix = new Matrix(); + private final RectF mSquareCornersRect = new RectF(); - private Shader.TileMode mTileModeX = Shader.TileMode.CLAMP; - private Shader.TileMode mTileModeY = Shader.TileMode.CLAMP; - private boolean mRebuildShader = true; + private Shader.TileMode mTileModeX = Shader.TileMode.CLAMP; + private Shader.TileMode mTileModeY = Shader.TileMode.CLAMP; + private boolean mRebuildShader = true; - // [ topLeft, topRight, bottomLeft, bottomRight ] - private float mCornerRadius = 0f; - private final boolean[] mCornersRounded = new boolean[] { true, true, true, true }; + // [ topLeft, topRight, bottomLeft, bottomRight ] + private float mCornerRadius = 0f; + private final boolean[] mCornersRounded = new boolean[]{true, true, true, true}; - private boolean mOval = false; - private float mBorderWidth = 0; - private ColorStateList mBorderColor = ColorStateList.valueOf(DEFAULT_BORDER_COLOR); - private ScaleType mScaleType = ScaleType.FIT_CENTER; + private boolean mOval = false; + private float mBorderWidth = 0; + private ColorStateList mBorderColor = ColorStateList.valueOf(DEFAULT_BORDER_COLOR); + private ScaleType mScaleType = ScaleType.FIT_CENTER; - public RoundedDrawable(Bitmap bitmap) { - mBitmap = bitmap; + public RoundedDrawable(Bitmap bitmap) { + mBitmap = bitmap; - mBitmapWidth = bitmap.getWidth(); - mBitmapHeight = bitmap.getHeight(); - mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight); + mBitmapWidth = bitmap.getWidth(); + mBitmapHeight = bitmap.getHeight(); + mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight); - mBitmapPaint = new Paint(); - mBitmapPaint.setStyle(Paint.Style.FILL); - mBitmapPaint.setAntiAlias(true); + mBitmapPaint = new Paint(); + mBitmapPaint.setStyle(Paint.Style.FILL); + mBitmapPaint.setAntiAlias(true); - mBorderPaint = new Paint(); - mBorderPaint.setStyle(Paint.Style.STROKE); - mBorderPaint.setAntiAlias(true); - mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); - mBorderPaint.setStrokeWidth(mBorderWidth); - } - - public static RoundedDrawable fromBitmap(Bitmap bitmap) { - if (bitmap != null) { - return new RoundedDrawable(bitmap); - } else { - return null; + mBorderPaint = new Paint(); + mBorderPaint.setStyle(Paint.Style.STROKE); + mBorderPaint.setAntiAlias(true); + mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); + mBorderPaint.setStrokeWidth(mBorderWidth); } - } - public static Drawable fromDrawable(Drawable drawable) { - if (drawable != null) { - if (drawable instanceof RoundedDrawable) { - // just return if it's already a RoundedDrawable + public static RoundedDrawable fromBitmap(Bitmap bitmap) { + if (bitmap != null) { + return new RoundedDrawable(bitmap); + } else { + return null; + } + } + + public static Drawable fromDrawable(Drawable drawable) { + if (drawable != null) { + if (drawable instanceof RoundedDrawable) { + // just return if it's already a RoundedDrawable + return drawable; + } else if (drawable instanceof LayerDrawable) { + LayerDrawable ld = (LayerDrawable) drawable; + int num = ld.getNumberOfLayers(); + + // loop through layers to and change to RoundedDrawables if possible + for (int i = 0; i < num; i++) { + Drawable d = ld.getDrawable(i); + ld.setDrawableByLayerId(ld.getId(i), fromDrawable(d)); + } + return ld; + } + + // try to get a bitmap from the drawable and + Bitmap bm = drawableToBitmap(drawable); + if (bm != null) { + return new RoundedDrawable(bm); + } + } return drawable; - } else if (drawable instanceof LayerDrawable) { - LayerDrawable ld = (LayerDrawable) drawable; - int num = ld.getNumberOfLayers(); + } - // loop through layers to and change to RoundedDrawables if possible - for (int i = 0; i < num; i++) { - Drawable d = ld.getDrawable(i); - ld.setDrawableByLayerId(ld.getId(i), fromDrawable(d)); + public static Bitmap drawableToBitmap(Drawable drawable) { + if (drawable instanceof BitmapDrawable) { + return ((BitmapDrawable) drawable).getBitmap(); } - return ld; - } - // try to get a bitmap from the drawable and - Bitmap bm = drawableToBitmap(drawable); - if (bm != null) { - return new RoundedDrawable(bm); - } - } - return drawable; - } + Bitmap bitmap; + int width = Math.max(drawable.getIntrinsicWidth(), 2); + int height = Math.max(drawable.getIntrinsicHeight(), 2); + try { + bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); + drawable.draw(canvas); + } catch (Exception e) { + e.printStackTrace(); + CallerLogger.INSTANCE.w(M_HMI + TAG, "Failed to create bitmap from drawable!"); + bitmap = null; + } - public static Bitmap drawableToBitmap(Drawable drawable) { - if (drawable instanceof BitmapDrawable) { - return ((BitmapDrawable) drawable).getBitmap(); + return bitmap; } - Bitmap bitmap; - int width = Math.max(drawable.getIntrinsicWidth(), 2); - int height = Math.max(drawable.getIntrinsicHeight(), 2); - try { - bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); - Canvas canvas = new Canvas(bitmap); - drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); - drawable.draw(canvas); - } catch (Exception e) { - e.printStackTrace(); - Log.w(TAG, "Failed to create bitmap from drawable!"); - bitmap = null; + public Bitmap getSourceBitmap() { + return mBitmap; } - return bitmap; - } - - public Bitmap getSourceBitmap() { - return mBitmap; - } - - @Override - public boolean isStateful() { - return mBorderColor.isStateful(); - } - - @Override - protected boolean onStateChange(int[] state) { - int newColor = mBorderColor.getColorForState(state, 0); - if (mBorderPaint.getColor() != newColor) { - mBorderPaint.setColor(newColor); - return true; - } else { - return super.onStateChange(state); + @Override + public boolean isStateful() { + return mBorderColor.isStateful(); } - } - private void updateShaderMatrix() { - float scale; - float dx; - float dy; - - switch (mScaleType) { - case CENTER: - mBorderRect.set(mBounds); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - - mShaderMatrix.reset(); - mShaderMatrix.setTranslate((int) ((mBorderRect.width() - mBitmapWidth) * 0.5f + 0.5f), - (int) ((mBorderRect.height() - mBitmapHeight) * 0.5f + 0.5f)); - break; - - case CENTER_CROP: - mBorderRect.set(mBounds); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - - mShaderMatrix.reset(); - - dx = 0; - dy = 0; - - if (mBitmapWidth * mBorderRect.height() > mBorderRect.width() * mBitmapHeight) { - scale = mBorderRect.height() / (float) mBitmapHeight; - dx = (mBorderRect.width() - mBitmapWidth * scale) * 0.5f; + @Override + protected boolean onStateChange(int[] state) { + int newColor = mBorderColor.getColorForState(state, 0); + if (mBorderPaint.getColor() != newColor) { + mBorderPaint.setColor(newColor); + return true; } else { - scale = mBorderRect.width() / (float) mBitmapWidth; - dy = (mBorderRect.height() - mBitmapHeight * scale) * 0.5f; + return super.onStateChange(state); + } + } + + private void updateShaderMatrix() { + float scale; + float dx; + float dy; + + switch (mScaleType) { + case CENTER: + mBorderRect.set(mBounds); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + + mShaderMatrix.reset(); + mShaderMatrix.setTranslate((int) ((mBorderRect.width() - mBitmapWidth) * 0.5f + 0.5f), + (int) ((mBorderRect.height() - mBitmapHeight) * 0.5f + 0.5f)); + break; + + case CENTER_CROP: + mBorderRect.set(mBounds); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + + mShaderMatrix.reset(); + + dx = 0; + dy = 0; + + if (mBitmapWidth * mBorderRect.height() > mBorderRect.width() * mBitmapHeight) { + scale = mBorderRect.height() / (float) mBitmapHeight; + dx = (mBorderRect.width() - mBitmapWidth * scale) * 0.5f; + } else { + scale = mBorderRect.width() / (float) mBitmapWidth; + dy = (mBorderRect.height() - mBitmapHeight * scale) * 0.5f; + } + + mShaderMatrix.setScale(scale, scale); + mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth / 2, + (int) (dy + 0.5f) + mBorderWidth / 2); + break; + + case CENTER_INSIDE: + mShaderMatrix.reset(); + + if (mBitmapWidth <= mBounds.width() && mBitmapHeight <= mBounds.height()) { + scale = 1.0f; + } else { + scale = Math.min(mBounds.width() / (float) mBitmapWidth, + mBounds.height() / (float) mBitmapHeight); + } + + dx = (int) ((mBounds.width() - mBitmapWidth * scale) * 0.5f + 0.5f); + dy = (int) ((mBounds.height() - mBitmapHeight * scale) * 0.5f + 0.5f); + + mShaderMatrix.setScale(scale, scale); + mShaderMatrix.postTranslate(dx, dy); + + mBorderRect.set(mBitmapRect); + mShaderMatrix.mapRect(mBorderRect); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); + break; + + default: + case FIT_CENTER: + mBorderRect.set(mBitmapRect); + mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.CENTER); + mShaderMatrix.mapRect(mBorderRect); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); + break; + + case FIT_END: + mBorderRect.set(mBitmapRect); + mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.END); + mShaderMatrix.mapRect(mBorderRect); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); + break; + + case FIT_START: + mBorderRect.set(mBitmapRect); + mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.START); + mShaderMatrix.mapRect(mBorderRect); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); + break; + + case FIT_XY: + mBorderRect.set(mBounds); + mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); + mShaderMatrix.reset(); + mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); + break; } - mShaderMatrix.setScale(scale, scale); - mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth / 2, - (int) (dy + 0.5f) + mBorderWidth / 2); - break; + mDrawableRect.set(mBorderRect); + } - case CENTER_INSIDE: - mShaderMatrix.reset(); + @Override + protected void onBoundsChange(@NonNull Rect bounds) { + super.onBoundsChange(bounds); - if (mBitmapWidth <= mBounds.width() && mBitmapHeight <= mBounds.height()) { - scale = 1.0f; + mBounds.set(bounds); + + updateShaderMatrix(); + } + + @Override + public void draw(@NonNull Canvas canvas) { + if (mRebuildShader) { + BitmapShader bitmapShader = new BitmapShader(mBitmap, mTileModeX, mTileModeY); + if (mTileModeX == Shader.TileMode.CLAMP && mTileModeY == Shader.TileMode.CLAMP) { + bitmapShader.setLocalMatrix(mShaderMatrix); + } + mBitmapPaint.setShader(bitmapShader); + mRebuildShader = false; + } + + if (mOval) { + if (mBorderWidth > 0) { + canvas.drawOval(mDrawableRect, mBitmapPaint); + canvas.drawOval(mBorderRect, mBorderPaint); + } else { + canvas.drawOval(mDrawableRect, mBitmapPaint); + } } else { - scale = Math.min(mBounds.width() / (float) mBitmapWidth, - mBounds.height() / (float) mBitmapHeight); + if (any(mCornersRounded)) { + float radius = mCornerRadius; + if (mBorderWidth > 0) { + canvas.drawRoundRect(mDrawableRect, radius, radius, mBitmapPaint); + canvas.drawRoundRect(mBorderRect, radius, radius, mBorderPaint); + redrawBitmapForSquareCorners(canvas); + redrawBorderForSquareCorners(canvas); + } else { + canvas.drawRoundRect(mDrawableRect, radius, radius, mBitmapPaint); + redrawBitmapForSquareCorners(canvas); + } + } else { + canvas.drawRect(mDrawableRect, mBitmapPaint); + if (mBorderWidth > 0) { + canvas.drawRect(mBorderRect, mBorderPaint); + } + } + } + } + + private void redrawBitmapForSquareCorners(Canvas canvas) { + if (all(mCornersRounded)) { + // no square corners + return; } - dx = (int) ((mBounds.width() - mBitmapWidth * scale) * 0.5f + 0.5f); - dy = (int) ((mBounds.height() - mBitmapHeight * scale) * 0.5f + 0.5f); + if (mCornerRadius == 0) { + return; // no round corners + } - mShaderMatrix.setScale(scale, scale); - mShaderMatrix.postTranslate(dx, dy); - - mBorderRect.set(mBitmapRect); - mShaderMatrix.mapRect(mBorderRect); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); - break; - - default: - case FIT_CENTER: - mBorderRect.set(mBitmapRect); - mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.CENTER); - mShaderMatrix.mapRect(mBorderRect); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); - break; - - case FIT_END: - mBorderRect.set(mBitmapRect); - mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.END); - mShaderMatrix.mapRect(mBorderRect); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); - break; - - case FIT_START: - mBorderRect.set(mBitmapRect); - mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.START); - mShaderMatrix.mapRect(mBorderRect); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); - break; - - case FIT_XY: - mBorderRect.set(mBounds); - mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2); - mShaderMatrix.reset(); - mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); - break; - } - - mDrawableRect.set(mBorderRect); - } - - @Override - protected void onBoundsChange(@NonNull Rect bounds) { - super.onBoundsChange(bounds); - - mBounds.set(bounds); - - updateShaderMatrix(); - } - - @Override - public void draw(@NonNull Canvas canvas) { - if (mRebuildShader) { - BitmapShader bitmapShader = new BitmapShader(mBitmap, mTileModeX, mTileModeY); - if (mTileModeX == Shader.TileMode.CLAMP && mTileModeY == Shader.TileMode.CLAMP) { - bitmapShader.setLocalMatrix(mShaderMatrix); - } - mBitmapPaint.setShader(bitmapShader); - mRebuildShader = false; - } - - if (mOval) { - if (mBorderWidth > 0) { - canvas.drawOval(mDrawableRect, mBitmapPaint); - canvas.drawOval(mBorderRect, mBorderPaint); - } else { - canvas.drawOval(mDrawableRect, mBitmapPaint); - } - } else { - if (any(mCornersRounded)) { + float left = mDrawableRect.left; + float top = mDrawableRect.top; + float right = left + mDrawableRect.width(); + float bottom = top + mDrawableRect.height(); float radius = mCornerRadius; - if (mBorderWidth > 0) { - canvas.drawRoundRect(mDrawableRect, radius, radius, mBitmapPaint); - canvas.drawRoundRect(mBorderRect, radius, radius, mBorderPaint); - redrawBitmapForSquareCorners(canvas); - redrawBorderForSquareCorners(canvas); + + if (!mCornersRounded[Corner.TOP_LEFT]) { + mSquareCornersRect.set(left, top, left + radius, top + radius); + canvas.drawRect(mSquareCornersRect, mBitmapPaint); + } + + if (!mCornersRounded[Corner.TOP_RIGHT]) { + mSquareCornersRect.set(right - radius, top, right, radius); + canvas.drawRect(mSquareCornersRect, mBitmapPaint); + } + + if (!mCornersRounded[Corner.BOTTOM_RIGHT]) { + mSquareCornersRect.set(right - radius, bottom - radius, right, bottom); + canvas.drawRect(mSquareCornersRect, mBitmapPaint); + } + + if (!mCornersRounded[Corner.BOTTOM_LEFT]) { + mSquareCornersRect.set(left, bottom - radius, left + radius, bottom); + canvas.drawRect(mSquareCornersRect, mBitmapPaint); + } + } + + private void redrawBorderForSquareCorners(Canvas canvas) { + if (all(mCornersRounded)) { + // no square corners + return; + } + + if (mCornerRadius == 0) { + return; // no round corners + } + + float left = mDrawableRect.left; + float top = mDrawableRect.top; + float right = left + mDrawableRect.width(); + float bottom = top + mDrawableRect.height(); + float radius = mCornerRadius; + float offset = mBorderWidth / 2; + + if (!mCornersRounded[Corner.TOP_LEFT]) { + canvas.drawLine(left - offset, top, left + radius, top, mBorderPaint); + canvas.drawLine(left, top - offset, left, top + radius, mBorderPaint); + } + + if (!mCornersRounded[Corner.TOP_RIGHT]) { + canvas.drawLine(right - radius - offset, top, right, top, mBorderPaint); + canvas.drawLine(right, top - offset, right, top + radius, mBorderPaint); + } + + if (!mCornersRounded[Corner.BOTTOM_RIGHT]) { + canvas.drawLine(right - radius - offset, bottom, right + offset, bottom, mBorderPaint); + canvas.drawLine(right, bottom - radius, right, bottom, mBorderPaint); + } + + if (!mCornersRounded[Corner.BOTTOM_LEFT]) { + canvas.drawLine(left - offset, bottom, left + radius, bottom, mBorderPaint); + canvas.drawLine(left, bottom - radius, left, bottom, mBorderPaint); + } + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSLUCENT; + } + + @Override + public int getAlpha() { + return mBitmapPaint.getAlpha(); + } + + @Override + public void setAlpha(int alpha) { + mBitmapPaint.setAlpha(alpha); + invalidateSelf(); + } + + @Override + public ColorFilter getColorFilter() { + return mBitmapPaint.getColorFilter(); + } + + @Override + public void setColorFilter(ColorFilter cf) { + mBitmapPaint.setColorFilter(cf); + invalidateSelf(); + } + + @Override + public void setDither(boolean dither) { + mBitmapPaint.setDither(dither); + invalidateSelf(); + } + + @Override + public void setFilterBitmap(boolean filter) { + mBitmapPaint.setFilterBitmap(filter); + invalidateSelf(); + } + + @Override + public int getIntrinsicWidth() { + return mBitmapWidth; + } + + @Override + public int getIntrinsicHeight() { + return mBitmapHeight; + } + + /** + * @return the corner radius. + */ + public float getCornerRadius() { + return mCornerRadius; + } + + /** + * @param corner the specific corner to get radius of. + * @return the corner radius of the specified corner. + */ + public float getCornerRadius(@Corner int corner) { + return mCornersRounded[corner] ? mCornerRadius : 0f; + } + + /** + * Sets all corners to the specified radius. + * + * @param radius the radius. + * @return the {@link RoundedDrawable} for chaining. + */ + public RoundedDrawable setCornerRadius(float radius) { + setCornerRadius(radius, radius, radius, radius); + return this; + } + + /** + * Sets the corner radius of one specific corner. + * + * @param corner the corner. + * @param radius the radius. + * @return the {@link RoundedDrawable} for chaining. + */ + public RoundedDrawable setCornerRadius(@Corner int corner, float radius) { + if (radius != 0 && mCornerRadius != 0 && mCornerRadius != radius) { + throw new IllegalArgumentException("Multiple nonzero corner radii not yet supported."); + } + + if (radius == 0) { + if (only(corner, mCornersRounded)) { + mCornerRadius = 0; + } + mCornersRounded[corner] = false; } else { - canvas.drawRoundRect(mDrawableRect, radius, radius, mBitmapPaint); - redrawBitmapForSquareCorners(canvas); + if (mCornerRadius == 0) { + mCornerRadius = radius; + } + mCornersRounded[corner] = true; } - } else { - canvas.drawRect(mDrawableRect, mBitmapPaint); - if (mBorderWidth > 0) { - canvas.drawRect(mBorderRect, mBorderPaint); + + return this; + } + + /** + * Sets the corner radii of all the corners. + * + * @param topLeft top left corner radius. + * @param topRight top right corner radius + * @param bottomRight bototm right corner radius. + * @param bottomLeft bottom left corner radius. + * @return the {@link RoundedDrawable} for chaining. + */ + public RoundedDrawable setCornerRadius(float topLeft, float topRight, float bottomRight, + float bottomLeft) { + Set radiusSet = new HashSet<>(4); + radiusSet.add(topLeft); + radiusSet.add(topRight); + radiusSet.add(bottomRight); + radiusSet.add(bottomLeft); + + radiusSet.remove(0f); + + if (radiusSet.size() > 1) { + throw new IllegalArgumentException("Multiple nonzero corner radii not yet supported."); } - } - } - } - private void redrawBitmapForSquareCorners(Canvas canvas) { - if (all(mCornersRounded)) { - // no square corners - return; + if (!radiusSet.isEmpty()) { + float radius = radiusSet.iterator().next(); + if (Float.isInfinite(radius) || Float.isNaN(radius) || radius < 0) { + throw new IllegalArgumentException("Invalid radius value: " + radius); + } + mCornerRadius = radius; + } else { + mCornerRadius = 0f; + } + + mCornersRounded[Corner.TOP_LEFT] = topLeft > 0; + mCornersRounded[Corner.TOP_RIGHT] = topRight > 0; + mCornersRounded[Corner.BOTTOM_RIGHT] = bottomRight > 0; + mCornersRounded[Corner.BOTTOM_LEFT] = bottomLeft > 0; + return this; } - if (mCornerRadius == 0) { - return; // no round corners + public float getBorderWidth() { + return mBorderWidth; } - float left = mDrawableRect.left; - float top = mDrawableRect.top; - float right = left + mDrawableRect.width(); - float bottom = top + mDrawableRect.height(); - float radius = mCornerRadius; - - if (!mCornersRounded[Corner.TOP_LEFT]) { - mSquareCornersRect.set(left, top, left + radius, top + radius); - canvas.drawRect(mSquareCornersRect, mBitmapPaint); + public RoundedDrawable setBorderWidth(float width) { + mBorderWidth = width; + mBorderPaint.setStrokeWidth(mBorderWidth); + return this; } - if (!mCornersRounded[Corner.TOP_RIGHT]) { - mSquareCornersRect.set(right - radius, top, right, radius); - canvas.drawRect(mSquareCornersRect, mBitmapPaint); + public int getBorderColor() { + return mBorderColor.getDefaultColor(); } - if (!mCornersRounded[Corner.BOTTOM_RIGHT]) { - mSquareCornersRect.set(right - radius, bottom - radius, right, bottom); - canvas.drawRect(mSquareCornersRect, mBitmapPaint); + public RoundedDrawable setBorderColor(@ColorInt int color) { + return setBorderColor(ColorStateList.valueOf(color)); } - if (!mCornersRounded[Corner.BOTTOM_LEFT]) { - mSquareCornersRect.set(left, bottom - radius, left + radius, bottom); - canvas.drawRect(mSquareCornersRect, mBitmapPaint); - } - } - - private void redrawBorderForSquareCorners(Canvas canvas) { - if (all(mCornersRounded)) { - // no square corners - return; + public ColorStateList getBorderColors() { + return mBorderColor; } - if (mCornerRadius == 0) { - return; // no round corners + public RoundedDrawable setBorderColor(ColorStateList colors) { + mBorderColor = colors != null ? colors : ColorStateList.valueOf(0); + mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); + return this; } - float left = mDrawableRect.left; - float top = mDrawableRect.top; - float right = left + mDrawableRect.width(); - float bottom = top + mDrawableRect.height(); - float radius = mCornerRadius; - float offset = mBorderWidth / 2; - - if (!mCornersRounded[Corner.TOP_LEFT]) { - canvas.drawLine(left - offset, top, left + radius, top, mBorderPaint); - canvas.drawLine(left, top - offset, left, top + radius, mBorderPaint); + public boolean isOval() { + return mOval; } - if (!mCornersRounded[Corner.TOP_RIGHT]) { - canvas.drawLine(right - radius - offset, top, right, top, mBorderPaint); - canvas.drawLine(right, top - offset, right, top + radius, mBorderPaint); + public RoundedDrawable setOval(boolean oval) { + mOval = oval; + return this; } - if (!mCornersRounded[Corner.BOTTOM_RIGHT]) { - canvas.drawLine(right - radius - offset, bottom, right + offset, bottom, mBorderPaint); - canvas.drawLine(right, bottom - radius, right, bottom, mBorderPaint); + public ScaleType getScaleType() { + return mScaleType; } - if (!mCornersRounded[Corner.BOTTOM_LEFT]) { - canvas.drawLine(left - offset, bottom, left + radius, bottom, mBorderPaint); - canvas.drawLine(left, bottom - radius, left, bottom, mBorderPaint); - } - } - - @Override - public int getOpacity() { - return PixelFormat.TRANSLUCENT; - } - - @Override - public int getAlpha() { - return mBitmapPaint.getAlpha(); - } - - @Override - public void setAlpha(int alpha) { - mBitmapPaint.setAlpha(alpha); - invalidateSelf(); - } - - @Override - public ColorFilter getColorFilter() { - return mBitmapPaint.getColorFilter(); - } - - @Override - public void setColorFilter(ColorFilter cf) { - mBitmapPaint.setColorFilter(cf); - invalidateSelf(); - } - - @Override - public void setDither(boolean dither) { - mBitmapPaint.setDither(dither); - invalidateSelf(); - } - - @Override - public void setFilterBitmap(boolean filter) { - mBitmapPaint.setFilterBitmap(filter); - invalidateSelf(); - } - - @Override - public int getIntrinsicWidth() { - return mBitmapWidth; - } - - @Override - public int getIntrinsicHeight() { - return mBitmapHeight; - } - - /** - * @return the corner radius. - */ - public float getCornerRadius() { - return mCornerRadius; - } - - /** - * @param corner the specific corner to get radius of. - * @return the corner radius of the specified corner. - */ - public float getCornerRadius(@Corner int corner) { - return mCornersRounded[corner] ? mCornerRadius : 0f; - } - - /** - * Sets all corners to the specified radius. - * - * @param radius the radius. - * @return the {@link RoundedDrawable} for chaining. - */ - public RoundedDrawable setCornerRadius(float radius) { - setCornerRadius(radius, radius, radius, radius); - return this; - } - - /** - * Sets the corner radius of one specific corner. - * - * @param corner the corner. - * @param radius the radius. - * @return the {@link RoundedDrawable} for chaining. - */ - public RoundedDrawable setCornerRadius(@Corner int corner, float radius) { - if (radius != 0 && mCornerRadius != 0 && mCornerRadius != radius) { - throw new IllegalArgumentException("Multiple nonzero corner radii not yet supported."); + public RoundedDrawable setScaleType(ScaleType scaleType) { + if (scaleType == null) { + scaleType = ScaleType.FIT_CENTER; + } + if (mScaleType != scaleType) { + mScaleType = scaleType; + updateShaderMatrix(); + } + return this; } - if (radius == 0) { - if (only(corner, mCornersRounded)) { - mCornerRadius = 0; - } - mCornersRounded[corner] = false; - } else { - if (mCornerRadius == 0) { - mCornerRadius = radius; - } - mCornersRounded[corner] = true; + public Shader.TileMode getTileModeX() { + return mTileModeX; } - return this; - } - - /** - * Sets the corner radii of all the corners. - * - * @param topLeft top left corner radius. - * @param topRight top right corner radius - * @param bottomRight bototm right corner radius. - * @param bottomLeft bottom left corner radius. - * @return the {@link RoundedDrawable} for chaining. - */ - public RoundedDrawable setCornerRadius(float topLeft, float topRight, float bottomRight, - float bottomLeft) { - Set radiusSet = new HashSet<>(4); - radiusSet.add(topLeft); - radiusSet.add(topRight); - radiusSet.add(bottomRight); - radiusSet.add(bottomLeft); - - radiusSet.remove(0f); - - if (radiusSet.size() > 1) { - throw new IllegalArgumentException("Multiple nonzero corner radii not yet supported."); + public RoundedDrawable setTileModeX(Shader.TileMode tileModeX) { + if (mTileModeX != tileModeX) { + mTileModeX = tileModeX; + mRebuildShader = true; + invalidateSelf(); + } + return this; } - if (!radiusSet.isEmpty()) { - float radius = radiusSet.iterator().next(); - if (Float.isInfinite(radius) || Float.isNaN(radius) || radius < 0) { - throw new IllegalArgumentException("Invalid radius value: " + radius); - } - mCornerRadius = radius; - } else { - mCornerRadius = 0f; + public Shader.TileMode getTileModeY() { + return mTileModeY; } - mCornersRounded[Corner.TOP_LEFT] = topLeft > 0; - mCornersRounded[Corner.TOP_RIGHT] = topRight > 0; - mCornersRounded[Corner.BOTTOM_RIGHT] = bottomRight > 0; - mCornersRounded[Corner.BOTTOM_LEFT] = bottomLeft > 0; - return this; - } - - public float getBorderWidth() { - return mBorderWidth; - } - - public RoundedDrawable setBorderWidth(float width) { - mBorderWidth = width; - mBorderPaint.setStrokeWidth(mBorderWidth); - return this; - } - - public int getBorderColor() { - return mBorderColor.getDefaultColor(); - } - - public RoundedDrawable setBorderColor(@ColorInt int color) { - return setBorderColor(ColorStateList.valueOf(color)); - } - - public ColorStateList getBorderColors() { - return mBorderColor; - } - - public RoundedDrawable setBorderColor(ColorStateList colors) { - mBorderColor = colors != null ? colors : ColorStateList.valueOf(0); - mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); - return this; - } - - public boolean isOval() { - return mOval; - } - - public RoundedDrawable setOval(boolean oval) { - mOval = oval; - return this; - } - - public ScaleType getScaleType() { - return mScaleType; - } - - public RoundedDrawable setScaleType(ScaleType scaleType) { - if (scaleType == null) { - scaleType = ScaleType.FIT_CENTER; + public RoundedDrawable setTileModeY(Shader.TileMode tileModeY) { + if (mTileModeY != tileModeY) { + mTileModeY = tileModeY; + mRebuildShader = true; + invalidateSelf(); + } + return this; } - if (mScaleType != scaleType) { - mScaleType = scaleType; - updateShaderMatrix(); + + private static boolean only(int index, boolean[] booleans) { + for (int i = 0, len = booleans.length; i < len; i++) { + if (booleans[i] != (i == index)) { + return false; + } + } + return true; } - return this; - } - public Shader.TileMode getTileModeX() { - return mTileModeX; - } - - public RoundedDrawable setTileModeX(Shader.TileMode tileModeX) { - if (mTileModeX != tileModeX) { - mTileModeX = tileModeX; - mRebuildShader = true; - invalidateSelf(); - } - return this; - } - - public Shader.TileMode getTileModeY() { - return mTileModeY; - } - - public RoundedDrawable setTileModeY(Shader.TileMode tileModeY) { - if (mTileModeY != tileModeY) { - mTileModeY = tileModeY; - mRebuildShader = true; - invalidateSelf(); - } - return this; - } - - private static boolean only(int index, boolean[] booleans) { - for (int i = 0, len = booleans.length; i < len; i++) { - if (booleans[i] != (i == index)) { + private static boolean any(boolean[] booleans) { + for (boolean b : booleans) { + if (b) { + return true; + } + } return false; - } } - return true; - } - private static boolean any(boolean[] booleans) { - for (boolean b : booleans) { - if (b) { return true; } + private static boolean all(boolean[] booleans) { + for (boolean b : booleans) { + if (b) { + return false; + } + } + return true; } - return false; - } - private static boolean all(boolean[] booleans) { - for (boolean b : booleans) { - if (b) { return false; } + public Bitmap toBitmap() { + return drawableToBitmap(this); } - return true; - } - - public Bitmap toBitmap() { - return drawableToBitmap(this); - } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedImageView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedImageView.java index bfa6420fe7..ab4a3f0dd2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedImageView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/roundimage/RoundedImageView.java @@ -16,6 +16,8 @@ package com.mogo.eagle.core.function.hmi.ui.notice.roundimage; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; + import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; @@ -28,13 +30,13 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.net.Uri; import android.util.AttributeSet; -import android.util.Log; import androidx.annotation.ColorInt; import androidx.annotation.DimenRes; import androidx.annotation.DrawableRes; import androidx.appcompat.widget.AppCompatImageView; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.hmi.R; @@ -271,7 +273,7 @@ public class RoundedImageView extends AppCompatImageView { try { d = rsrc.getDrawable(mResource); } catch (Exception e) { - Log.w(TAG, "Unable to find resource: " + mResource, e); + CallerLogger.INSTANCE.w(M_HMI + TAG, "Unable to find resource : " + mResource + " exception : " + e); // Don't try again. mResource = 0; } @@ -309,7 +311,7 @@ public class RoundedImageView extends AppCompatImageView { try { d = rsrc.getDrawable(mBackgroundResource); } catch (Exception e) { - Log.w(TAG, "Unable to find resource: " + mBackgroundResource, e); + CallerLogger.INSTANCE.w(M_HMI + TAG, "Unable to find resource : " + mBackgroundResource + " exception : " + e); // Don't try again. mBackgroundResource = 0; } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 3aa35ed140..4985482949 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -11,13 +11,12 @@ import com.mogo.commons.AbsMogoApplication import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.autopilot.* -import com.mogo.eagle.core.data.deva.chain.ChainConstant +import com.mogo.eagle.core.data.chain.ChainConstant import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.obu.ObuStatusInfo -import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener @@ -369,11 +368,9 @@ class DebugSettingView @JvmOverloads constructor( tbSelfLog.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { - LogUtils.getConfig().isLogSwitch = false Logger.init(LogLevel.OFF) MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false } else { - LogUtils.getConfig().isLogSwitch = true Logger.init(LogLevel.DEBUG) MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = true } @@ -555,7 +552,7 @@ class DebugSettingView @JvmOverloads constructor( mGnssInfo = gnssInfo } - override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { + override fun onAutopilotIdentifyDataUpdate(trafficData: List?) { // 重制数据 mIdentifyDataSize = 0 mUnknownIdentifyDataSize = 0 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AdUpgradeDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AdUpgradeDialog.kt index 4d33814662..8023e363b8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AdUpgradeDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AdUpgradeDialog.kt @@ -4,7 +4,6 @@ import android.content.Context import android.widget.TextView import androidx.lifecycle.LifecycleObserver import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.module.common.dialog.BaseFloatDialog /** @@ -14,10 +13,6 @@ import com.mogo.module.common.dialog.BaseFloatDialog */ class AdUpgradeDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver { - companion object { - const val TAG = "AdUpgradeDialog" - } - private var upgradeConfirm : TextView? = null private var upgradeCancel : TextView? = null @@ -30,12 +25,10 @@ class AdUpgradeDialog(context: Context) : BaseFloatDialog(context), LifecycleObs upgradeCancel=findViewById(R.id.tv_upgrade_cancel) upgradeConfirm?.setOnClickListener{ - Logger.i(TAG,"upgradeConfirm click") clickListener?.confirm() dismiss() } upgradeCancel?.setOnClickListener { - Logger.i(TAG,"upgradeCancel click") clickListener?.cancel() dismiss() } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt index be94fe594c..831b2716fe 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/DockerRebootDialog.kt @@ -4,7 +4,6 @@ import android.content.Context import android.widget.TextView import androidx.lifecycle.LifecycleObserver import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.module.common.dialog.BaseFloatDialog /** @@ -14,10 +13,6 @@ import com.mogo.module.common.dialog.BaseFloatDialog */ class DockerRebootDialog(context: Context): BaseFloatDialog(context), LifecycleObserver { - companion object { - const val TAG = "DockerRebootDialog" - } - private var rebootConfirm : TextView? = null private var rebootCancel : TextView? = null @@ -30,12 +25,10 @@ class DockerRebootDialog(context: Context): BaseFloatDialog(context), LifecycleO rebootCancel=findViewById(R.id.tv_reboot_cancel) rebootConfirm?.setOnClickListener{ - Logger.i(TAG,"rebootConfirm click") clickListener?.confirm() dismiss() } rebootCancel?.setOnClickListener { - Logger.i(TAG,"rebootCancel click") clickListener?.cancel() dismiss() } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/BrakeViewStatus.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/BrakeViewStatus.kt index 91d6923ff3..a5c9f77a40 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/BrakeViewStatus.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/BrakeViewStatus.kt @@ -3,9 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.turnlight import android.animation.AnimatorSet import android.animation.ObjectAnimator import android.content.Context -import android.os.Looper import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.animation.AlphaAnimation diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/TurnLightViewStatus.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/TurnLightViewStatus.kt index c05d125c8b..f71a762d9d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/TurnLightViewStatus.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/turnlight/TurnLightViewStatus.kt @@ -2,17 +2,14 @@ package com.mogo.eagle.core.function.hmi.ui.turnlight import android.content.Context import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.animation.AlphaAnimation import android.view.animation.Animation import android.view.animation.LinearInterpolator -import android.widget.FrameLayout import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.hmi.R -import kotlinx.android.synthetic.main.view_brake_light_status.view.* import kotlinx.android.synthetic.main.view_turn_light_status.view.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt index a85bad4529..545ae2765b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt @@ -6,14 +6,14 @@ import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener 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.CallerHmiListenerManager import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.util.LogUtils +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.module.common.MogoApisHandler @@ -51,14 +51,14 @@ class AutoPilotStatusView @JvmOverloads constructor( // 自动驾驶状态监听 CallerAutoPilotStatusListenerManager.addListener(TAG, this) - LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus") + CallerLogger.d("$M_HMI$TAG", "autopilotStatus: $mAutopilotStatus") setAutoPilotStatus(mAutopilotStatus) } override fun onClick(v: View?) { when (mAutopilotStatus) { 0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常 - LogUtils.eTag(TAG, "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查") + CallerLogger.e("$M_HMI$TAG", "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查") ToastUtils.showShort("不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查") // TODO 这里临时触发自动驾驶能力,测试功过这里删除 //CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckStatusView.kt index 96a62ac937..bae066eb4c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckStatusView.kt @@ -8,7 +8,6 @@ import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.api.check.IMogoCheckListener import com.mogo.eagle.core.function.call.check.CallerCheckManager import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import kotlinx.android.synthetic.main.view_check_status.view.* /** @@ -35,7 +34,6 @@ class CheckStatusView @JvmOverloads constructor( } override fun updateMonitoringStatus(state: Int?) { - Logger.d(TAG, "updateCheckStatus") if (state == 1) { dismissErrorIcon() } else { @@ -46,14 +44,12 @@ class CheckStatusView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - Logger.d(TAG, "onAttachedToWindow") //车辆监控 CallerCheckManager.registerVehicleMonitoringListener(TAG, this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - Logger.d(TAG, "onDetachedFromWindow") //车辆监控 CallerCheckManager.unregisterListener(TAG) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt index fc1127e263..5fc33d3bca 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/CheckSystemView.kt @@ -8,13 +8,14 @@ import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.notification.WarningFloat import com.mogo.eagle.core.function.hmi.ui.tools.DockerRebootDialog -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.ToastUtils import kotlinx.android.synthetic.main.view_check_system.view.* @@ -29,11 +30,11 @@ class CheckSystemView @JvmOverloads constructor( } private var connectStatus = false //是否连接工控机 - private var autopilotStatus:Int ?=null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中 + private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中 private var dockerRebootDialog: DockerRebootDialog? = null - private var downloadStatus: Int=-1 //下载状态 - private var upgradeStatus: Int=-1 //升级状态 + private var downloadStatus: Int = -1 //下载状态 + private var upgradeStatus: Int = -1 //升级状态 init { LayoutInflater.from(context).inflate(R.layout.view_check_system, this, true) @@ -47,26 +48,30 @@ class CheckSystemView @JvmOverloads constructor( } viewCheckReboot.setOnClickListener { //dialog - if(dockerRebootDialog == null){ + if (dockerRebootDialog == null) { dockerRebootDialog = DockerRebootDialog(context) - dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener{ + dockerRebootDialog?.setClickListener(object : DockerRebootDialog.ClickListener { override fun confirm() { - if(autopilotStatus==2){ + if (autopilotStatus == 2) { //当前处于自动驾驶状态,不可进行重启,Toast提示 ToastUtils.showShort("请先退出自动驾驶状态") - }else if(AdUpgradeStateHelper.showCannotReboot(downloadStatus, upgradeStatus)){ + } else if (AdUpgradeStateHelper.showCannotReboot( + downloadStatus, + upgradeStatus + ) + ) { //当工控机处于下载或者升级状态,需要先进行升级 ToastUtils.showShort("请先完成新自动驾驶系统的下载/升级") - } else{ + } else { //确认重启 - Logger.i(TAG,"reboot confirm") + CallerLogger.d("$M_HMI$TAG", "reboot confirm") CallerAutoPilotManager.setIPCReboot() } } override fun cancel() { //取消重启 - Logger.i(TAG,"reboot cancel") + CallerLogger.d("$M_HMI$TAG", "reboot cancel") } }) @@ -75,9 +80,9 @@ class CheckSystemView @JvmOverloads constructor( } } - fun setAdUpgradeStatus(downloadStatus : Int,upgradeStatus : Int){ - this.downloadStatus=downloadStatus - this.upgradeStatus=upgradeStatus + fun setAdUpgradeStatus(downloadStatus: Int, upgradeStatus: Int) { + this.downloadStatus = downloadStatus + this.upgradeStatus = upgradeStatus } private fun showSystemOperationWindow(view: View) { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt index 124e75efbc..da9c059d33 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedPanelView.kt @@ -10,7 +10,6 @@ import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.map.navi.IMogoCarLocationChangedListener2 import com.mogo.service.IMogoServiceApis @@ -37,6 +36,7 @@ class SpeedPanelView @JvmOverloads constructor( var mLatLng: Location? = null var mSpeedLimmit = 60; + init { initEvent(context) @@ -55,7 +55,6 @@ class SpeedPanelView @JvmOverloads constructor( private fun initEvent(context: Context) { setOnLongClickListener { - Logger.d(TAG, "长按显示状态工具栏") CallerHmiManager.toggleDebugView() false } @@ -65,7 +64,11 @@ class SpeedPanelView @JvmOverloads constructor( override fun run() { if (mLatLng != null) { if (mMogoServiceApis.mapServiceApi != null && mMogoServiceApis.mapServiceApi.mapUIController != null) { - mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit(mLatLng!!.longitude, mLatLng!!.latitude, mLatLng!!.bearing) + mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit( + mLatLng!!.longitude, + mLatLng!!.latitude, + mLatLng!!.bearing + ) UiThreadHandler.post { val speed = (mLatLng!!.speed * 3.6f).toInt() mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6")) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt index aaf4dbac60..6549db378f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt @@ -7,12 +7,13 @@ import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.AppUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler @@ -37,58 +38,70 @@ class SystemVersionView @JvmOverloads constructor( } private var connectStatus = false - private var dockerVersion :String ?=null //工控机版本 - private var autopilotStatus:Int ?=null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中 - private var adUpgradeDialog : AdUpgradeDialog? = null + private var dockerVersion: String? = null //工控机版本 + private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中 + private var adUpgradeDialog: AdUpgradeDialog? = null - private var upgradeMode: Int=-1 //升级模式 - private var downloadStatus: Int=-1 //下载状态 - private var currentProgress: Int=-1 //当前已下载包体大小 - private var previousProgress: Int=-1 //前一秒的下载进度,用于计算下载剩余时间 - private var totalProgress: Int=-1 //包体总大小 - private var downloadVersion: String?=null //工控机docker版本 - private var upgradeStatus: Int=-1 //升级状态 + private var upgradeMode: Int = -1 //升级模式 + private var downloadStatus: Int = -1 //下载状态 + private var currentProgress: Int = -1 //当前已下载包体大小 + private var previousProgress: Int = -1 //前一秒的下载进度,用于计算下载剩余时间 + private var totalProgress: Int = -1 //包体总大小 + private var downloadVersion: String? = null //工控机docker版本 + private var upgradeStatus: Int = -1 //升级状态 init { LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true) initView() } - private fun initView(){ + private fun initView() { showCurrentPadVersion() showCurrentAdVersion() - //鹰眼版本视图点击事件 ivPadVersion.setOnClickListener { - Logger.i(TAG,"pad version view clicked") - } + CallerLogger.i("$M_HMI$$TAG", "pad version view clicked") + } //工控机版本视图点击事件 ivAdVersion.setOnClickListener { - Logger.i(TAG,"ad version view clicked") - Logger.i(TAG,"upgradeMode="+upgradeMode+" downloadStatus="+downloadStatus+" upgradeStatus="+upgradeStatus) - if(AdUpgradeStateHelper.isDownloading(downloadStatus)){ + CallerLogger.i("$M_HMI$$TAG", "ad version view clicked") + CallerLogger.i( + "$M_HMI$$TAG", + "upgradeMode=$upgradeMode , downloadStatus=$downloadStatus , upgradeStatus=$upgradeStatus" + ) + if (AdUpgradeStateHelper.isDownloading(downloadStatus)) { //点击Toast提示:下载剩余时间 - ToastUtils.showShort("预计"+AdUpgradeStateHelper.getRemainingTime(totalProgress,previousProgress,currentProgress)+"下载完成") - }else if(AdUpgradeStateHelper.getUpgradeStatus()){ + ToastUtils.showShort( + "预计" + AdUpgradeStateHelper.getRemainingTime( + totalProgress, + previousProgress, + currentProgress + ) + "下载完成" + ) + } else if (AdUpgradeStateHelper.getUpgradeStatus()) { //工控机状态为“升级中” ToastUtils.showShort("新版本升级中,预计5分钟升级完成") - }else if(AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)){ + } else if (AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)) { //如果升级失败,则Toast提示:升级失败,请联系运维人员 ToastUtils.showShort("升级失败,请联系运维人员") - }else if(AdUpgradeStateHelper.isHintUpgradeMode(upgradeMode) && AdUpgradeStateHelper.isDownloadFinish(downloadStatus,upgradeStatus)){ + } else if (AdUpgradeStateHelper.isHintUpgradeMode(upgradeMode) && AdUpgradeStateHelper.isDownloadFinish( + downloadStatus, + upgradeStatus + ) + ) { //如果升级模式为“提示升级”,并且下载状态为已经下载完成,点击弹出升级确认弹窗 - if(adUpgradeDialog == null){ + if (adUpgradeDialog == null) { adUpgradeDialog = AdUpgradeDialog(context) - adUpgradeDialog?.setClickListener(object : AdUpgradeDialog.ClickListener{ + adUpgradeDialog?.setClickListener(object : AdUpgradeDialog.ClickListener { override fun confirm() { - if(autopilotStatus==2){ + if (autopilotStatus == 2) { //当前处于自动驾驶状态,不可进行升级,Toast提示 ToastUtils.showShort("升级前请先退出自动驾驶模式") - }else{ + } else { //确认升级 - Logger.i(TAG,"upgrade confirm") + CallerLogger.i("$M_HMI$$TAG", "upgrade confirm") //设置当前状态为“升级中” AdUpgradeStateHelper.setUpgradeStatus(true) CallerAutoPilotManager.setIPCUpgradeAffirm() @@ -101,7 +114,7 @@ class SystemVersionView @JvmOverloads constructor( override fun cancel() { //取消升级 - Logger.i(TAG,"upgrade cancel") + CallerLogger.i("$M_HMI$$TAG", "upgrade cancel") //取消升级命令不下发 // CallerAutoPilotManager.setIPCUpgradeCancel() } @@ -124,15 +137,17 @@ class SystemVersionView @JvmOverloads constructor( * @param downloadVersion 下载版本 * @param upgradeStatus 升级状态 */ - fun setAdUpgradeInfo(upgradeMode: Int,downloadStatus: Int,currentProgress: Int,totalProgress: Int, - downloadVersion: String,upgradeStatus: Int){ - this.upgradeMode=upgradeMode - this.downloadStatus=downloadStatus - this.previousProgress=this.currentProgress - this.currentProgress=currentProgress - this.totalProgress=totalProgress - this.downloadVersion=downloadVersion - this.upgradeStatus=upgradeStatus + fun setAdUpgradeInfo( + upgradeMode: Int, downloadStatus: Int, currentProgress: Int, totalProgress: Int, + downloadVersion: String, upgradeStatus: Int + ) { + this.upgradeMode = upgradeMode + this.downloadStatus = downloadStatus + this.previousProgress = this.currentProgress + this.currentProgress = currentProgress + this.totalProgress = totalProgress + this.downloadVersion = downloadVersion + this.upgradeStatus = upgradeStatus } /** @@ -144,53 +159,77 @@ class SystemVersionView @JvmOverloads constructor( * @param downloadVersion 下载版本 * @param upgradeStatus 升级状态 */ - fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus: Int,currentProgress: Int,totalProgress: Int - ,downloadVersion: String,upgradeStatus: Int){ + fun showAdUpgradeStatus( + upgradeMode: Int, + downloadStatus: Int, + currentProgress: Int, + totalProgress: Int, + downloadVersion: String, + upgradeStatus: Int + ) { - GlobalScope.launch(Dispatchers.Main){ + GlobalScope.launch(Dispatchers.Main) { //设置工控机下载、升级状态信息 - setAdUpgradeInfo(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus) + setAdUpgradeInfo( + upgradeMode, + downloadStatus, + currentProgress, + totalProgress, + downloadVersion, + upgradeStatus + ) - if(AdUpgradeStateHelper.isDownloading(downloadStatus)){ + if (AdUpgradeStateHelper.isDownloading(downloadStatus)) { //正在下载,展示“下载中”角标,展示进度条,并设置当前下载进度 ivAdStatus?.setImageResource(R.drawable.icon_downloading) adCircularProgressView?.let { it.visibility = View.VISIBLE - Logger.i(TAG,"下载中="+"currentProgress="+currentProgress+" totalProgress="+totalProgress+" downloadProgress="+AdUpgradeStateHelper.downloadProgress(currentProgress,totalProgress)) + CallerLogger.i( + "$M_HMI$$TAG", + "下载中=currentProgress=$currentProgress , totalProgress=$totalProgress , downloadProgress=" + AdUpgradeStateHelper.downloadProgress( + currentProgress, + totalProgress + ) + ) - it.setProgress(AdUpgradeStateHelper.downloadProgress(currentProgress,totalProgress)) + it.setProgress( + AdUpgradeStateHelper.downloadProgress( + currentProgress, + totalProgress + ) + ) } - }else if(AdUpgradeStateHelper.isDownloadFinish(downloadStatus,upgradeStatus)){ + } else if (AdUpgradeStateHelper.isDownloadFinish(downloadStatus, upgradeStatus)) { //下载完成,处于可升级状态,展示“可升级”角标,将AD背景变为蓝色,并隐藏下载进度条(当状态为“升级中”时,不进行设置(存在升级命令已下发,但工控机未立即升级现象)) - if(!AdUpgradeStateHelper.getUpgradeStatus()){ + if (!AdUpgradeStateHelper.getUpgradeStatus()) { ivAdStatus?.setImageResource(R.drawable.icon_upgradeable) ivAdVersion?.setBackgroundResource(R.drawable.version_upgradeable_background) adCircularProgressView?.visibility = View.GONE - if(AdUpgradeStateHelper.isQuietUpgradeMode(upgradeMode)){ + if (AdUpgradeStateHelper.isQuietUpgradeMode(upgradeMode)) { //如果升级模式为“静默升级”,则下载完成后,调用升级命令进行升级 CallerAutoPilotManager.setIPCUpgradeAffirm() AdUpgradeStateHelper.setUpgradeStatus(true) } } - }else if(AdUpgradeStateHelper.isDownloadFailed(downloadStatus)){ + } else if (AdUpgradeStateHelper.isDownloadFailed(downloadStatus)) { //下载失败,将状态设为“最新版”角标,并隐藏进度条 ivAdStatus?.setImageResource(R.drawable.icon_latest_version) adCircularProgressView?.visibility = View.GONE ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background) - } else if(AdUpgradeStateHelper.isUpgradeSuccess(upgradeStatus)){ + } else if (AdUpgradeStateHelper.isUpgradeSuccess(upgradeStatus)) { //升级成功,将状态设为“最新版”角标,并隐藏进度条 ivAdStatus?.setImageResource(R.drawable.icon_latest_version) adCircularProgressView?.visibility = View.GONE AdUpgradeStateHelper.setUpgradeStatus(false) ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background) - }else if(AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)){ + } else if (AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)) { //升级失败,将状态设为“升级失败”角标,并隐藏进度条 ivAdStatus?.setImageResource(R.drawable.icon_upgrade_failed) adCircularProgressView?.visibility = View.GONE AdUpgradeStateHelper.setUpgradeStatus(false) ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background) - }else{ + } else { //其他状态,均显示“最新版”,并隐藏进度条 ivAdStatus?.setImageResource(R.drawable.icon_latest_version) adCircularProgressView?.visibility = View.GONE @@ -205,7 +244,7 @@ class SystemVersionView @JvmOverloads constructor( /** * 展示当前鹰眼版本 */ - private fun showCurrentPadVersion(){ + private fun showCurrentPadVersion() { tvPadVersionContent?.let { it.text = AppUtils.getAppVersionName() } @@ -214,11 +253,11 @@ class SystemVersionView @JvmOverloads constructor( /** * 展示当前工控机版本 */ - private fun showCurrentAdVersion(){ + private fun showCurrentAdVersion() { UiThreadHandler.post { tvAdVersionContent?.let { // it.text = AdasManager.getInstance().getAdasConfig().getDockVersion()) - if(!dockerVersion.isNullOrEmpty()){ + if (!dockerVersion.isNullOrEmpty()) { it.text = dockerVersion } } @@ -239,11 +278,14 @@ class SystemVersionView @JvmOverloads constructor( connectStatus = autoPilotStatusInfo.connectStatus dockerVersion = autoPilotStatusInfo.dockVersion autopilotStatus = autoPilotStatusInfo.state - Logger.i(TAG,"onAutopilotStatusResponse connectStatus="+connectStatus+" dockerVersion="+dockerVersion+" autopilotStatus="+autopilotStatus) + CallerLogger.i( + "$M_HMI$TAG", + "onAutopilotStatusResponse connectStatus=$connectStatus , dockerVersion=$dockerVersion , autopilotStatus=$autopilotStatus" + ) setViewStatus() } - private fun setViewStatus(){ + private fun setViewStatus() { showCurrentAdVersion() } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XWarningView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XWarningView.kt index b18e526cf9..8ceca5e6fe 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XWarningView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XWarningView.kt @@ -2,23 +2,14 @@ package com.mogo.eagle.core.function.hmi.ui.widget import android.content.Context import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.widget.RelativeLayout +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.data.enums.WarningDirectionEnum -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_ALL -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_LEFT -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_NON -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_RIGHT -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP_LEFT -import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT +import com.mogo.eagle.core.data.enums.WarningDirectionEnum.* +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.module_hmi_warning_v2x.view.* @@ -32,10 +23,12 @@ class V2XWarningView @JvmOverloads constructor( defStyleAttr: Int = 0 ) : RelativeLayout(context, attrs, defStyleAttr) { - private val ALL_CLOSE_TIMER = 10000L + companion object { + private const val ALL_CLOSE_TIMER = 10000L + private const val TAG = "V2XWarningView" + } private val closeWarningTask: Runnable = Runnable { - Logger.d("V2XWarningView", "预警红边:倒计时结束") showWarning(ALERT_WARNING_NON) } @@ -59,7 +52,7 @@ class V2XWarningView @JvmOverloads constructor( * @param closeTime 倒计时 */ fun showWarning(direction: WarningDirectionEnum, closeTime: Long) { - Logger.d("V2XWarningView", "预警红边:预警方向->$direction 预警倒计时->$closeTime") + CallerLogger.d("$M_HMI$TAG", "预警红边:预警方向->$direction 预警倒计时->$closeTime") UiThreadHandler.post { // 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示 @@ -174,7 +167,7 @@ class V2XWarningView @JvmOverloads constructor( hmiWarningLeftImg.visibility = View.GONE } else -> { - Log.d("XXX", "Not Support Direction") + CallerLogger.d("$M_HMI$TAG", "Not Support Direction") } } } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/EventDispatchCenter.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/EventDispatchCenter.java index d6232c0f28..c4fe332a4d 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/EventDispatchCenter.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/EventDispatchCenter.java @@ -1,11 +1,14 @@ package com.mogo.eagle.core.function.main; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.location.Location; import android.view.MotionEvent; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.marker.IMogoMarker; @@ -17,7 +20,6 @@ import com.mogo.map.navi.IMogoNaviListener; import com.mogo.map.navi.MogoNaviInfo; import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.map.uicontroller.VisualAngleMode; -import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler; import com.mogo.service.adas.IMogoADASControlStatusChangedListener; import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode; import com.zhidao.adasconfig.listener.IAdasSettingUIListener; @@ -49,9 +51,9 @@ public class EventDispatchCenter implements } public static EventDispatchCenter getInstance() { - if ( sInstance == null ) { - synchronized ( EventDispatchCenter.class ) { - if ( sInstance == null ) { + if (sInstance == null) { + synchronized (EventDispatchCenter.class) { + if (sInstance == null) { sInstance = new EventDispatchCenter(); } } @@ -62,13 +64,13 @@ public class EventDispatchCenter implements private static final String TAG = "DispatchCenter"; @Override - public boolean onMarkerClicked( IMogoMarker marker ) { - IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() ); - if ( listener != null ) { + public boolean onMarkerClicked(IMogoMarker marker) { + IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener(marker.getOwner()); + if (listener != null) { try { - return listener.onMarkerClicked( marker ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + return listener.onMarkerClicked(marker); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMarkerClicked error : " + e); } } return false; @@ -76,34 +78,34 @@ public class EventDispatchCenter implements @Override public boolean onStaticMarkerClicked(IMogoMarker marker) { - ArrayList list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener( marker.getOwner() ); - if(list == null){ + ArrayList list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener(marker.getOwner()); + if (list == null) { return false; } try { for (IMogoMarkerClickListener listener : list) { - return listener.onStaticMarkerClicked( marker ); + return listener.onStaticMarkerClicked(marker); } - } catch ( Exception e){ - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStaticMarkerClicked error : " + e); } return false; } @Override - public void onCarLocationChanged2( Location latLng ) { + public void onCarLocationChanged2(Location latLng) { - Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener(); + if (iterator == null) { return; } MogoLatLng target = null; - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoCarLocationChangedListener listener = iterator.next(); - if ( listener instanceof IMogoCarLocationChangedListener2 ) { + if (listener instanceof IMogoCarLocationChangedListener2) { try { - ( ( IMogoCarLocationChangedListener2 ) listener ).onCarLocationChanged2( latLng ); - } catch ( Exception e ) { + ((IMogoCarLocationChangedListener2) listener).onCarLocationChanged2(latLng); + } catch (Exception e) { e.printStackTrace(); } } @@ -115,118 +117,118 @@ public class EventDispatchCenter implements * * @param callback */ - void setMapLoadedCallback( Runnable callback ) { + void setMapLoadedCallback(Runnable callback) { this.mMapLoadedCallback = callback; } @Override public void onMapLoaded() { - if ( mMapLoadedCallback != null ) { + if (mMapLoadedCallback != null) { mMapLoadedCallback.run(); mMapLoadedCallback = null; } - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onMapLoaded(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapLoaded error : " + e); } } } } @Override - public void onTouch( MotionEvent motionEvent ) { - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + public void onTouch(MotionEvent motionEvent) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onTouch( motionEvent ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onTouch(motionEvent); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onTouch error : " + e); } } } } @Override - public void onPOIClick( MogoPoi poi ) { - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + public void onPOIClick(MogoPoi poi) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onPOIClick( poi ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onPOIClick(poi); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onPOIClick error : " + e); } } } } @Override - public void onMapClick( MogoLatLng latLng ) { - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + public void onMapClick(MogoLatLng latLng) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onMapClick( latLng ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onMapClick(latLng); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapClick error : " + e); } } } } @Override - public void onLockMap( boolean isLock ) { - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + public void onLockMap(boolean isLock) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onLockMap( isLock ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onLockMap(isLock); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onLockMap error : " + e); } } } } @Override - public void onMapModeChanged( EnumMapUI ui ) { - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + public void onMapModeChanged(EnumMapUI ui) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onMapModeChanged( ui ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onMapModeChanged(ui); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapModeChanged error :" + e); } } } @@ -234,56 +236,56 @@ public class EventDispatchCenter implements @Override public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) { - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onMapVisualAngleChanged( visualAngleMode ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onMapVisualAngleChanged(visualAngleMode); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapVisualAngleChanged error : " + e); } } } } @Override - public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) { + public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) { final long start = System.currentTimeMillis(); - Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getMapListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoMapListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onMapChanged( location, zoom, tilt, bearing ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onMapChanged(location, zoom, tilt, bearing); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onMapChanged error :" + e); } } } - Logger.i( TAG, "onMapChanged event cost " + ( System.currentTimeMillis() - start ) + "ms" ); + CallerLogger.INSTANCE.i(M_MAIN +TAG, "onMapChanged event cost " + (System.currentTimeMillis() - start) + "ms"); } @Override public void onInitNaviFailure() { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onInitNaviFailure(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onInitNaviFailure error : " + e); } } } @@ -291,36 +293,36 @@ public class EventDispatchCenter implements @Override public void onInitNaviSuccess() { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onInitNaviSuccess(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onInitNaviSuccess error : " + e); } } } } @Override - public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + public void onNaviInfoUpdate(MogoNaviInfo naviinfo) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onNaviInfoUpdate( naviinfo ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onNaviInfoUpdate(naviinfo); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onNaviInfoUpdate error : " + e); } } } @@ -328,18 +330,18 @@ public class EventDispatchCenter implements @Override public void onStartNavi() { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onStartNavi(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStartNavi error : " + e); } } } @@ -347,17 +349,17 @@ public class EventDispatchCenter implements @Override public void onStopNavi() { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onStopNavi(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onStopNavi error : " + e); } } } @@ -365,17 +367,17 @@ public class EventDispatchCenter implements @Override public void onCalculateSuccess() { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onCalculateSuccess(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onCalculateSuccess error : " + e); } } } @@ -383,17 +385,17 @@ public class EventDispatchCenter implements @Override public void onoCalculateFailed() { - Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoNaviListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { listener.onoCalculateFailed(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onoCalculateFailed error : " + e); } } } @@ -401,19 +403,19 @@ public class EventDispatchCenter implements @Override - public void onLocationChanged( MogoLocation location ) { + public void onLocationChanged(MogoLocation location) { - Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoLocationListener listener = iterator.next(); - if ( listener != null ) { + if (listener != null) { try { - listener.onLocationChanged( location ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + listener.onLocationChanged(location); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "onLocationChanged error : " + e); } } } @@ -421,95 +423,95 @@ public class EventDispatchCenter implements @Override public void northModel() { - Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoADASControlStatusChangedListener listener = iterator.next(); - if ( listener == null ) { + if (listener == null) { continue; } try { - listener.onMapUiModeChanged( EnumMapUI.NorthUP_2D ); - } catch ( Exception e ) { - Logger.e( TAG, e, "onMapUiModeChanged" ); + listener.onMapUiModeChanged(EnumMapUI.NorthUP_2D); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "northModel error : " + e); } } } @Override public void carHeadUp() { - Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoADASControlStatusChangedListener listener = iterator.next(); - if ( listener == null ) { + if (listener == null) { continue; } try { - listener.onMapUiModeChanged( EnumMapUI.CarUp_2D ); - } catch ( Exception e ) { - Logger.e( TAG, e, "onMapUiModeChanged" ); + listener.onMapUiModeChanged(EnumMapUI.CarUp_2D); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "carHeadUp error : " + e); } } } @Override - public void switchCarChat( EnumCarChatIncognitoMode enumCarChatIncognitoMode ) { - Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); - if ( iterator == null ) { + public void switchCarChat(EnumCarChatIncognitoMode enumCarChatIncognitoMode) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoADASControlStatusChangedListener listener = iterator.next(); - if ( listener == null ) { + if (listener == null) { continue; } try { - listener.onCarStatusChanged( enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN ); - } catch ( Exception e ) { - Logger.e( TAG, e, "onMapUiModeChanged" ); + listener.onCarStatusChanged(enumCarChatIncognitoMode == EnumCarChatIncognitoMode.OPEN); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "switchCarChat error : " + e); } } } @Override public void whiteModel() { - Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoADASControlStatusChangedListener listener = iterator.next(); - if ( listener == null ) { + if (listener == null) { continue; } try { - listener.onMapUiModeChanged( EnumMapUI.Type_Light ); - } catch ( Exception e ) { - Logger.e( TAG, e, "onMapUiModeChanged" ); + listener.onMapUiModeChanged(EnumMapUI.Type_Light); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "whiteModel error : " + e); } } } @Override public void blackModel() { - Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); - if ( iterator == null ) { + Iterator iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners(); + if (iterator == null) { return; } - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { IMogoADASControlStatusChangedListener listener = iterator.next(); - if ( listener == null ) { + if (listener == null) { continue; } try { - listener.onMapUiModeChanged( EnumMapUI.Type_Night ); - } catch ( Exception e ) { - Logger.e( TAG, e, "onMapUiModeChanged" ); + listener.onMapUiModeChanged(EnumMapUI.Type_Night); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN +TAG, "blackModel error : " + e); } } } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java index e6aad11a00..b410b7d63f 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.main; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; import static com.mogo.eagle.core.function.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE; import android.content.Intent; @@ -7,7 +8,6 @@ import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.provider.Settings; -import android.util.Log; import android.view.View; import android.widget.FrameLayout; @@ -24,12 +24,12 @@ import com.mogo.commons.mvp.MvpActivity; import com.mogo.commons.mvp.MvpFragment; import com.mogo.eagle.core.data.constants.MoGoFragmentPaths; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.main.cards.MogoModulesManager; import com.mogo.eagle.core.function.main.service.MogoMainService; import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper; import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils; import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper; import com.mogo.eagle.core.utilcode.util.NetworkUtils; @@ -159,14 +159,14 @@ public class MainActivity extends MvpActivity implement // 过滤掉异常启动时间 if (coldStartTime < 50000) { // 上传冷启动时间coldStartTime - Logger.i(TAG, "coldStartTime:" + coldStartTime); + CallerLogger.INSTANCE.i(M_MAIN + TAG, "coldStartTime:" + coldStartTime); properties.put("app_launch_coldStartTime", coldStartTime); } } else if (hotStartTime > 0) { // 过滤掉异常启动时间 if (hotStartTime < 30000) { // 上传热启动时间hotStartTime - Logger.i(TAG, "hotStartTime:" + hotStartTime); + CallerLogger.INSTANCE.i(M_MAIN + TAG, "hotStartTime:" + hotStartTime); properties.put("app_launch_hotStartTime", hotStartTime); } } @@ -198,20 +198,17 @@ public class MainActivity extends MvpActivity implement if (DebugConfig.isMapBased()) { EventDispatchCenter.getInstance().setMapLoadedCallback(() -> { - Logger.d(TAG, "map loaded." + Thread.currentThread().getName()); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "map loaded." + Thread.currentThread().getName()); // 延时加载其他模块 - getWindow().getDecorView().postDelayed(new Runnable() { - @Override - public void run() { - loadOthersModules(); - loadFunctionFragment(); + getWindow().getDecorView().postDelayed(() -> { + loadOthersModules(); + loadFunctionFragment(); - // TODO 这里临时兼容进入VR模式 - MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true); - MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR); - } + // TODO 这里临时兼容进入VR模式 + MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true); + MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR); }, 3000); - Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms"); + CallerLogger.INSTANCE.i(M_MAIN + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms"); }); loadFunctionMapView(); } else { @@ -279,7 +276,7 @@ public class MainActivity extends MvpActivity implement @Override public void loadFunctionFragment() { - Logger.d(TAG, "loadFunctionFragment……"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadFunctionFragment……"); // 加载 HMI 图层 BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation(); addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment); @@ -392,7 +389,7 @@ public class MainActivity extends MvpActivity implement mServiceApis.getMapServiceApi().getMapUIController().destroy(); AdasConfigApiController.getInstance().release(); mServiceApis.getAdasControllerApi().release(); - Logger.d(TAG, "destroy."); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy."); ContextHolderUtil.releaseContext(); MogoModulesManager.getInstance().onDestroy(); SchemeIntent.getInstance().clear(); @@ -447,7 +444,7 @@ public class MainActivity extends MvpActivity implement @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); - Logger.d(TAG, "requestCode: " + requestCode + " resultCode: " + resultCode); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "requestCode: " + requestCode + " resultCode: " + resultCode); if (requestCode == REQUEST_CODE_DIALOG) { //申请悬浮窗权限 @@ -467,7 +464,7 @@ public class MainActivity extends MvpActivity implement fragment = newFragment; } if (fragment == null) { - Logger.e(TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById(getApplicationContext(), containerId)); + CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId)); return; } getSupportFragmentManager().beginTransaction() diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index 086cb93c48..eecde1072f 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -1,18 +1,19 @@ package com.mogo.eagle.core.function.main; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Process; import android.text.TextUtils; -import android.util.Log; import androidx.annotation.Nullable; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.service.intent.IMogoIntentListener; import com.mogo.service.statusmanager.StatusDescriptor; @@ -25,17 +26,16 @@ import com.mogo.service.statusmanager.StatusDescriptor; public class MainLauncherActivity extends MainActivity implements IMogoIntentListener { private static final String TAG = "MainLauncherActivity"; protected boolean mIsHomeKeyDown = false; - private static Handler handlerV2XEvent = new Handler(); + private final static Handler handlerV2XEvent = new Handler(); private static Runnable runnableV2XEvent; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); DebugConfig.setNeedRequestUserInfo(true); - Log.d(TAG, "onCreate"); + CallerLogger.INSTANCE.i(M_MAIN +TAG, "onCreate"); } - @Override protected void initViews() { super.initViews(); @@ -71,7 +71,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis @Override protected void loadOthersModules() { super.loadOthersModules(); - Logger.d(TAG, "loadOthersModules"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadOthersModules"); loadOCHModule(); } @@ -113,12 +113,12 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis intent.putExtra("type", 0); } sendBroadcast(intent); - Logger.d(TAG, "send msg to AI Voice"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "send msg to AI Voice"); } private void stopCountDown() { - if (handlerV2XEvent != null && runnableV2XEvent != null) { + if (runnableV2XEvent != null) { handlerV2XEvent.removeCallbacks(runnableV2XEvent); runnableV2XEvent = null; } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index 8a7b87e2d6..7b3f6d6a64 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -1,8 +1,9 @@ package com.mogo.eagle.core.function.main; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.content.Context; import android.os.Process; -import android.util.Log; import com.bytedance.boost_multidex.BoostMultiDex; import com.mogo.cloud.httpdns.MogoHttpDnsConfig; @@ -20,11 +21,10 @@ import com.mogo.eagle.core.data.constants.MoGoConfig; import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.notice.PushUIConstants; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.DeviceUtils; import com.mogo.eagle.core.utilcode.util.ProcessUtils; import com.mogo.map.MapApiPath; import com.mogo.module.common.MogoApisHandler; @@ -38,7 +38,6 @@ import com.mogo.test.crashreport.CrashReportConstants; import com.mogo.test.crashreport.upgrade.UpgradeReportConstants; import com.zhidao.boot.persistent.lib.PersistentManager; import com.zhidao.support.obu.ami.AmiClientManager; -import com.zhjt.service.chain.core.ChainTraceStarter; import java.lang.reflect.Field; @@ -71,7 +70,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { @Override protected boolean shouldInit() { - Logger.w(TAG, "evaluate shouldInit() with: %s", ProcessUtils.getProcessName(Process.myPid())); + CallerLogger.INSTANCE.w(M_MAIN + TAG, "evaluate shouldInit() with: " + ProcessUtils.getProcessName(Process.myPid())); return ProcessUtils.isMainProcess(this); } @@ -215,7 +214,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { e.printStackTrace(); httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1); } - Logger.i(TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "使用缓存GPS信息:" + httpDnsSimpleLocation); } return httpDnsSimpleLocation; }); @@ -225,7 +224,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { new IMoGoTokenCallback() { @Override public void onTokenGot(String token, String sn) { - Logger.d("TEST-SOCKET", "onTokenGot "); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "onTokenGot "); // 异步初始化NetConfig asyncInit(); // HttpDns ttl回调 --- socketTTL @@ -236,7 +235,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { @Override public void onError(int code, String msg) { - Log.d(TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务"); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务"); } } ); @@ -247,7 +246,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { */ private void connectAmiIp() { String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199"); - //Logger.d("OnAdasListenerAdapter", "application --ipAddress = " + ipAddress); AmiClientManager.getInstance().setObuIp(ipAddress); } @@ -265,26 +263,26 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { } private void startSocketService() { - Logger.d(TAG, "startSocketService"); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "startSocketService"); IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); // 关闭长链服务 apis.getSocketManagerApi(getApplicationContext()).destroy(); apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() { @Override public void onConnectFailure() { - Logger.d(TAG, "socket-onConnectFailure"); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectFailure"); DebugConfig.setDownloadSnapshot(false); } @Override public void onConnectSuccess() { - Logger.d(TAG, "socket-onConnectSuccess"); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectSuccess"); DebugConfig.setDownloadSnapshot(true); } @Override public void onConnectLost() { - Logger.d(TAG, "socket-onConnectLost"); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "socket-onConnectLost"); DebugConfig.setDownloadSnapshot(false); } }); @@ -299,7 +297,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { } private void initModules() { - Logger.d(TAG, "initModules"); + CallerLogger.INSTANCE.d(M_MAIN+TAG, "initModules"); //mogo deva tools MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider")); // 初始化 bugly 升级 @@ -311,7 +309,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder")); MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY)); - // MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME)); + // MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME)); // 域控制器模块(新) MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider")); @@ -352,7 +350,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { .getInstance().initManager(this); } - Log.i(TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms"); + CallerLogger.INSTANCE.i(M_MAIN+TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms"); } @Override diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java index 2196d218d6..6868114781 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/SchemeIntent.java @@ -1,12 +1,13 @@ package com.mogo.eagle.core.function.main; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.content.Context; import android.content.Intent; import android.net.Uri; import android.text.TextUtils; -import android.util.Log; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.CommonUtils; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.service.IMogoServiceApis; @@ -47,7 +48,7 @@ public class SchemeIntent implements IMogoStatusChangedListener { private static class IntentWrapper { public Intent mIntent; - public long mDelay = 0L; + public long mDelay; public IntentWrapper(Intent intent, long delay) { this.mIntent = intent; @@ -118,7 +119,7 @@ public class SchemeIntent implements IMogoStatusChangedListener { handleSwitch2Action(target); break; case "/main/share": - Logger.d(TAG, "收到打开分享框的scheme,准备打开分享框"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "收到打开分享框的scheme,准备打开分享框"); // Map properties = new HashMap<>(); // properties.put("from", "1"); // mApis.getAnalyticsApi().track("v2x_share_click", properties); @@ -146,7 +147,7 @@ public class SchemeIntent implements IMogoStatusChangedListener { if (TextUtils.isEmpty(type)) { return; } - Log.d("语音打开事件面板type", type); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + type); switch (type) { case TYPE_LAUNCH: handleLaunchIntent(target); @@ -179,7 +180,7 @@ public class SchemeIntent implements IMogoStatusChangedListener { * 语音打开事件面板 * */ private void handleShowEventPanel(int item) { - Logger.d(TAG, "语音打开事件面板" + item); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + item); //mApis.getEventPanelManager().showPanelWithSelectedItem(item); } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/cards/MogoModulesManager.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/cards/MogoModulesManager.java index fcaff50d95..a237a1036e 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/cards/MogoModulesManager.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/cards/MogoModulesManager.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.main.cards; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.app.Application; import android.content.Context; @@ -9,11 +11,11 @@ import com.alibaba.android.arouter.facade.template.IProvider; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider; import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.function.main.MainActivity; import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper; import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; -import com.mogo.eagle.core.function.main.MainActivity; import com.mogo.service.module.IMogoModuleProvider; import java.util.Collection; @@ -34,17 +36,17 @@ public class MogoModulesManager implements MogoModulesHandler { private MainActivity mActivity; private Application mApp; - private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>(); + private Map mModuleProviders = new HashMap<>(); // 空间换效率 - private Map< String, IMogoModuleProvider > mModuleNameProviders = new HashMap<>(); + private Map mModuleNameProviders = new HashMap<>(); // 架构升级后的加载功能模块的方式 - private Map< MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>(); - private Map< String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>(); + private Map mModuleFunctionProviders = new HashMap<>(); + private Map mModuleNameFunctionProviders = new HashMap<>(); // 架构升级后的加载功能模块的方式 - private Map< MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>(); - private Map< String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>(); + private Map mModuleFunctionServerProviders = new HashMap<>(); + private Map mModuleNameFunctionServerProviders = new HashMap<>(); private static volatile MogoModulesManager sInstance; @@ -52,9 +54,9 @@ public class MogoModulesManager implements MogoModulesHandler { } public static MogoModulesManager getInstance() { - if ( sInstance == null ) { - synchronized ( MogoModulesManager.class ) { - if ( sInstance == null ) { + if (sInstance == null) { + synchronized (MogoModulesManager.class) { + if (sInstance == null) { sInstance = new MogoModulesManager(); } } @@ -66,9 +68,9 @@ public class MogoModulesManager implements MogoModulesHandler { sInstance = null; } - public void init( MainActivity activity ) { - if ( activity == null ) { - throw new NullPointerException( "activity can't be null." ); + public void init(MainActivity activity) { + if (activity == null) { + throw new NullPointerException("activity can't be null."); } this.mActivity = activity; mApp = mActivity.getApplication(); @@ -84,14 +86,14 @@ public class MogoModulesManager implements MogoModulesHandler { @Override public void loadModules() { - final List< MogoModule > modules = MogoModulePaths.getModules(); - if ( modules != null && !modules.isEmpty() ) { - for ( MogoModule module : modules ) { - Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() ); - IMogoModuleProvider provider = load( module.getPath() ); - if ( provider != null ) { - mModuleProviders.put( module, provider ); - mModuleNameProviders.put( module.getName(), provider ); + final List modules = MogoModulePaths.getModules(); + if (modules != null && !modules.isEmpty()) { + for (MogoModule module : modules) { + CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName()); + IMogoModuleProvider provider = load(module.getPath()); + if (provider != null) { + mModuleProviders.put(module, provider); + mModuleNameProviders.put(module.getName(), provider); } } } @@ -99,14 +101,14 @@ public class MogoModulesManager implements MogoModulesHandler { @Override public void loadFunctionModules() { - final List< MogoModule > modules = MogoModulePaths.getModuleFunctions(); - if ( modules != null && !modules.isEmpty() ) { - for ( MogoModule module : modules ) { - Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() ); - IMoGoFunctionProvider provider = loadFunction( module.getPath() ); - if ( provider != null ) { - mModuleFunctionProviders.put( module, provider ); - mModuleNameFunctionProviders.put( module.getName(), provider ); + final List modules = MogoModulePaths.getModuleFunctions(); + if (modules != null && !modules.isEmpty()) { + for (MogoModule module : modules) { + CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName()); + IMoGoFunctionProvider provider = loadFunction(module.getPath()); + if (provider != null) { + mModuleFunctionProviders.put(module, provider); + mModuleNameFunctionProviders.put(module.getName(), provider); } } } @@ -114,14 +116,14 @@ public class MogoModulesManager implements MogoModulesHandler { @Override public void loadFunctionModulesServer() { - final List< MogoModule > modules = MogoModulePaths.getModuleFunctionServers(); - if ( modules != null && !modules.isEmpty() ) { - for ( MogoModule module : modules ) { - Logger.d( TAG, "module.getPath():" + module.getPath() + " name: " + module.getName() ); - IMoGoFunctionServerProvider provider = loadFunctionServer( module.getPath() ); - if ( provider != null ) { - mModuleFunctionServerProviders.put( module, provider ); - mModuleNameFunctionServerProviders.put( module.getName(), provider ); + final List modules = MogoModulePaths.getModuleFunctionServers(); + if (modules != null && !modules.isEmpty()) { + for (MogoModule module : modules) { + CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName()); + IMoGoFunctionServerProvider provider = loadFunctionServer(module.getPath()); + if (provider != null) { + mModuleFunctionServerProviders.put(module, provider); + mModuleNameFunctionServerProviders.put(module.getName(), provider); } } } @@ -129,124 +131,124 @@ public class MogoModulesManager implements MogoModulesHandler { @Override public void loadBaseModule() { - List< MogoModule > baseModules = MogoModulePaths.getBaseModules(); - for ( MogoModule baseModule : baseModules ) { - if ( baseModule == null ) { + List baseModules = MogoModulePaths.getBaseModules(); + for (MogoModule baseModule : baseModules) { + if (baseModule == null) { continue; } - Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() ); - loadBaseProvider( baseModule.getPath() ); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块 : " + baseModule.getPath()); + loadBaseProvider(baseModule.getPath()); } } - private IProvider loadBaseProvider(String path ) { + private IProvider loadBaseProvider(String path) { try { - return ( IProvider ) ARouter.getInstance().build( path ).navigation( getContext() ); - } catch ( Exception e ) { + return (IProvider) ARouter.getInstance().build(path).navigation(getContext()); + } catch (Exception e) { e.printStackTrace(); return null; } } - private IMogoModuleProvider load( String path ) { + private IMogoModuleProvider load(String path) { try { - return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() ); - } catch ( Exception e ) { + return (IMogoModuleProvider) ARouter.getInstance().build(path).navigation(getContext()); + } catch (Exception e) { e.printStackTrace(); return null; } } - private IMoGoFunctionProvider loadFunction( String path ) { + private IMoGoFunctionProvider loadFunction(String path) { try { - return ( IMoGoFunctionProvider ) ARouter.getInstance().build( path ).navigation( getContext() ); - } catch ( Exception e ) { + return (IMoGoFunctionProvider) ARouter.getInstance().build(path).navigation(getContext()); + } catch (Exception e) { e.printStackTrace(); return null; } } - private IMoGoFunctionServerProvider loadFunctionServer(String path ) { + private IMoGoFunctionServerProvider loadFunctionServer(String path) { try { - return ( IMoGoFunctionServerProvider ) ARouter.getInstance().build( path ).navigation( getContext() ); - } catch ( Exception e ) { + return (IMoGoFunctionServerProvider) ARouter.getInstance().build(path).navigation(getContext()); + } catch (Exception e) { e.printStackTrace(); return null; } } - private void addFragment( IMogoModuleProvider provider, int containerId ) { - if ( provider == null ) { - Logger.e( TAG, "add fragment fail cause provider == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) ); + private void addFragment(IMogoModuleProvider provider, int containerId) { + if (provider == null) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause provider == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId)); return; } Fragment fragment = null; - fragment = mActivity.getSupportFragmentManager().findFragmentByTag( provider.getModuleName() ); - if ( fragment == null ) { - fragment = provider.createFragment( getContext(), null ); + fragment = mActivity.getSupportFragmentManager().findFragmentByTag(provider.getModuleName()); + if (fragment == null) { + fragment = provider.createFragment(getContext(), null); } - if ( fragment == null ) { - Logger.e( TAG, "add fragment fail cause fragment == null, container is %s", ResourcesHelper.getResNameById( getApplicationContext(), containerId ) ); + if (fragment == null) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId)); return; } mActivity.getSupportFragmentManager().beginTransaction() - .replace( containerId, fragment, provider.getModuleName() ) + .replace(containerId, fragment, provider.getModuleName()) .commitAllowingStateLoss(); } @Override public void onDestroy() { - if ( mModuleNameProviders != null ) { - Collection< IMogoModuleProvider > modules = mModuleNameProviders.values(); - if ( modules != null ) { - for ( IMogoModuleProvider module : modules ) { + if (mModuleNameProviders != null) { + Collection modules = mModuleNameProviders.values(); + if (modules != null) { + for (IMogoModuleProvider module : modules) { try { - Logger.d( TAG, "destroy module: " + module.getModuleName() ); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getModuleName()); module.onDestroy(); - } catch ( Exception e ) { - Logger.e( TAG, e, "onDestroy" ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy"); } } } mModuleNameProviders.clear(); } - if ( mModuleProviders != null ) { + if (mModuleProviders != null) { mModuleProviders.clear(); } - if ( mModuleFunctionProviders != null ) { - Collection< IMoGoFunctionProvider > modules = mModuleFunctionProviders.values(); - if ( modules != null ) { - for ( IMoGoFunctionProvider module : modules ) { + if (mModuleFunctionProviders != null) { + Collection modules = mModuleFunctionProviders.values(); + if (modules != null) { + for (IMoGoFunctionProvider module : modules) { try { - Logger.d( TAG, "destroy module: " + module.getFunctionName() ); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName()); module.onDestroy(); - } catch ( Exception e ) { - Logger.e( TAG, e, "onDestroy" ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy"); } } } mModuleNameFunctionProviders.clear(); } - if ( mModuleFunctionProviders != null ) { + if (mModuleFunctionProviders != null) { mModuleFunctionProviders.clear(); } - if ( mModuleFunctionServerProviders != null ) { - Collection< IMoGoFunctionServerProvider > modules = mModuleFunctionServerProviders.values(); - if ( modules != null ) { - for ( IMoGoFunctionServerProvider module : modules ) { + if (mModuleFunctionServerProviders != null) { + Collection modules = mModuleFunctionServerProviders.values(); + if (modules != null) { + for (IMoGoFunctionServerProvider module : modules) { try { - Logger.d( TAG, "destroy module: " + module.getFunctionName() ); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName()); module.onDestroy(); - } catch ( Exception e ) { - Logger.e( TAG, e, "onDestroy" ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy"); } } } mModuleNameFunctionProviders.clear(); } - if ( mModuleFunctionServerProviders != null ) { + if (mModuleFunctionServerProviders != null) { mModuleFunctionServerProviders.clear(); } mActivity = null; diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java index 3da6c520c1..ab6834db00 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java @@ -11,7 +11,6 @@ import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.network.RequestOptions; import com.mogo.eagle.core.network.SubscribeImpl; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.module.common.MogoApisHandler; @@ -25,7 +24,6 @@ import okhttp3.RequestBody; * @author tongchenfei */ public class DelayCheckUtil implements Handler.Callback { - private static final String TAG = "DelayCheckUtil"; private final Handler handler = new Handler(this); private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001; @@ -51,11 +49,10 @@ public class DelayCheckUtil implements Handler.Callback { * 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报 */ public void waitingForCheck() { - Logger.d(TAG, "waitingForCheck==="); handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY); } - private long requestTime, netDelay, requestStartSystemTime,requestEndSystem; + private long requestTime, netDelay, requestStartSystemTime, requestEndSystem; @Override public boolean handleMessage(Message msg) { @@ -77,43 +74,40 @@ public class DelayCheckUtil implements Handler.Callback { } private void startEmptyRequest() { - Logger.d(TAG, "start empty request"); requestTime = SystemClock.elapsedRealtime(); requestStartSystemTime = System.currentTimeMillis(); MogoApisHandler.getInstance().getApis().getNetworkApi() .create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl()) .emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io()) .subscribe(new SubscribeImpl(RequestOptions.create(context)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - requestEndSystem = System.currentTimeMillis(); - netDelay = SystemClock.elapsedRealtime() - requestTime; - startUpload(); - } + @Override + public void onSuccess(BaseData o) { + super.onSuccess(o); + requestEndSystem = System.currentTimeMillis(); + netDelay = SystemClock.elapsedRealtime() - requestTime; + startUpload(); + } - @Override - public void onError(Throwable e) { - super.onError(e); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } + @Override + public void onError(Throwable e) { + super.onError(e); + handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - }); + @Override + public void onError(String message, int code) { + super.onError(message, code); + handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); + } + }); } private void startUpload() { - Logger.d(TAG, "start upload"); MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation(); if (lastLocation == null) { handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY); return; } - Logger.d(TAG, "lastLocation: " + lastLocation); DelayCheckUploadRequest request = new DelayCheckUploadRequest(); request.setSn(MoGoAiCloudClientConfig.getInstance().getSn()); request.setStartTime(requestStartSystemTime); @@ -131,27 +125,26 @@ public class DelayCheckUtil implements Handler.Callback { .create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl()) .uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io()) .subscribe(new SubscribeImpl(RequestOptions.create(context)) { - @Override - public void onSuccess(DelayCheckResponse o) { - super.onSuccess(o); - Logger.d(TAG, "上报时延成功 " + o); - DelayCheckResult result = o.getResult(); - if(result.isNecessary()) { - handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000); - } - } + @Override + public void onSuccess(DelayCheckResponse o) { + super.onSuccess(o); + DelayCheckResult result = o.getResult(); + if (result.isNecessary()) { + handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000L); + } + } - @Override - public void onError(String message, int code) { - super.onError(message, code); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } + @Override + public void onError(String message, int code) { + super.onError(message, code); + handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); + } - @Override - public void onError(Throwable e) { - super.onError(e); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - }); + @Override + public void onError(Throwable e) { + super.onError(e); + handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); + } + }); } } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/monitoring/VehicleMonitoring.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/monitoring/VehicleMonitoring.java index 27bdeeffe7..8f788213cb 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/monitoring/VehicleMonitoring.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/monitoring/VehicleMonitoring.java @@ -1,14 +1,16 @@ package com.mogo.eagle.core.function.main.monitoring; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.content.Context; import android.os.Handler; import android.os.Message; -import android.util.Log; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.check.CallerCheckManager; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; /** * @author liujing @@ -33,10 +35,10 @@ public class VehicleMonitoring implements Handler.Callback { public void vehicleCheck() { if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { - Log.d(TAG, "自动驾驶中..."); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "自动驾驶中..."); mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY); } else { - Log.d(TAG, "非自动驾驶状态"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "非自动驾驶状态"); //非自动驾驶状态只展示一次 mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY); } @@ -61,7 +63,7 @@ public class VehicleMonitoring implements Handler.Callback { } public void vehicleMonitor() { - Log.d(TAG, "vehicleMonitor"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "vehicleMonitor"); CallerCheckManager.checkMonitor(mContext); } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java index 463c0a4b51..d80ef1a1bc 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.main.service; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.app.Service; import android.content.Intent; import android.os.IBinder; @@ -10,16 +12,16 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.data.config.HdMapBuildConfig; import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.function.main.EventDispatchCenter; +import com.mogo.eagle.core.function.main.cards.MogoModulesManager; +import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil; +import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.map.location.IMogoLocationClient; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.navi.MogoCarLocationChangedListenerRegister; import com.mogo.module.common.MogoApisHandler; -import com.mogo.eagle.core.function.main.EventDispatchCenter; -import com.mogo.eagle.core.function.main.cards.MogoModulesManager; -import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil; -import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring; import com.mogo.service.IMogoServiceApis; public @@ -42,11 +44,11 @@ class MogoMainService extends Service implements IMogoLocationListener { @Override public void onCreate() { - Logger.d(TAG, "基本服务启动"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "基本服务启动"); mServiceApis = MogoApisHandler.getInstance().getApis(); initAndStartLocation(); UiThreadHandler.postDelayed(() -> { - Logger.d(TAG, "5秒已过,启动基础服务……"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "5秒已过,启动基础服务……"); loadBaseModules(); initADAS(); initGpsSimulatorListener(); @@ -73,7 +75,7 @@ class MogoMainService extends Service implements IMogoLocationListener { } private void initAndStartLocation() { - Logger.d(TAG, "开始定位"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "开始定位"); if (mServiceApis != null) { mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp()); mLocationClient.addLocationListener(this); @@ -85,12 +87,12 @@ class MogoMainService extends Service implements IMogoLocationListener { * 初始化自车定位监听 */ private void initGpsSimulatorListener() { - Logger.d(TAG, "注册自车位置监听"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "注册自车位置监听"); MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener(EventDispatchCenter.getInstance()); } private void loadBaseModules() { - Logger.d(TAG, "加载基本模块"); + CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块"); MogoModulesManager.getInstance().loadBaseModule(); } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/windowview/FloatingViewHandler.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/windowview/FloatingViewHandler.java index 4c757da4e2..4fdcd2f158 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/windowview/FloatingViewHandler.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/windowview/FloatingViewHandler.java @@ -1,11 +1,13 @@ package com.mogo.eagle.core.function.main.windowview; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN; + import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.FrameLayout; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; /** @@ -16,7 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger; */ public class FloatingViewHandler { - private static final String TAG = "WindowViewHandler"; + private static final String TAG = "FloatingViewHandler"; /** * 上次显示的优先级 @@ -38,11 +40,11 @@ public class FloatingViewHandler { private static FrameLayout sFloatingLayout = null; - public static void init( FrameLayout frameLayout ) { + public static void init(FrameLayout frameLayout) { sFloatingLayout = frameLayout; } - public static void clear(){ + public static void clear() { sFloatingLayout = null; } @@ -54,20 +56,20 @@ public class FloatingViewHandler { * @param y * @param movable */ - public static void addView( View view, int x, int y, boolean movable ) { - if ( view == null ) { + public static void addView(View view, int x, int y, boolean movable) { + if (view == null) { return; } - if ( sFloatingLayout == null ) { - Logger.e( TAG, "no floating frame. " ); + if (sFloatingLayout == null) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. "); return; } - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.leftMargin = x; params.topMargin = y; - sFloatingLayout.addView( view, params ); + sFloatingLayout.addView(view, params); } /** @@ -77,16 +79,16 @@ public class FloatingViewHandler { * @param params * @param movable */ - public static void addView( View view, FrameLayout.LayoutParams params, boolean movable ) { - if ( view == null ) { + public static void addView(View view, FrameLayout.LayoutParams params, boolean movable) { + if (view == null) { return; } - if ( sFloatingLayout == null ) { - Logger.e( TAG, "no floating frame. " ); + if (sFloatingLayout == null) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. "); return; } - sFloatingLayout.addView( view, params ); + sFloatingLayout.addView(view, params); } /** @@ -98,27 +100,27 @@ public class FloatingViewHandler { * @param y * @param movable */ - public static void addView( View view, int priority, int x, int y, boolean movable ) { - if ( view == null ) { + public static void addView(View view, int priority, int x, int y, boolean movable) { + if (view == null) { return; } - if ( sFloatingLayout == null ) { - Logger.e( TAG, "no floating frame. " ); + if (sFloatingLayout == null) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. "); return; } - if ( sView == view ) { - Logger.w( TAG, "改布局已添加且没有移除,不操作" ); + if (sView == view) { + CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作"); return; } - if ( sView != null ) { - if ( priority < sPriority ) { - Logger.w( TAG, "过滤低优先级布局" ); + if (sView != null) { + if (priority < sPriority) { + CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局"); return; } - sFloatingLayout.removeView( sView ); + sFloatingLayout.removeView(sView); } sView = view; sMovable = movable; @@ -136,27 +138,27 @@ public class FloatingViewHandler { * @param params * @param movable */ - public static void addView( View view, int priority, FrameLayout.LayoutParams params, boolean movable ) { - if ( view == null ) { + public static void addView(View view, int priority, FrameLayout.LayoutParams params, boolean movable) { + if (view == null) { return; } - if ( sFloatingLayout == null ) { - Logger.e( TAG, "no floating frame. " ); + if (sFloatingLayout == null) { + CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. "); return; } - if ( sView == view ) { - Logger.w( TAG, "改布局已添加且没有移除,不操作" ); + if (sView == view) { + CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作"); return; } - if ( sView != null ) { - if ( priority < sPriority ) { - Logger.w( TAG, "过滤低优先级布局" ); + if (sView != null) { + if (priority < sPriority) { + CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局"); return; } - sFloatingLayout.removeView( sView ); + sFloatingLayout.removeView(sView); } sView = view; sMovable = movable; @@ -165,15 +167,15 @@ public class FloatingViewHandler { addView(); } - public static void removeView( View view ) { - if ( sFloatingLayout == null ) { + public static void removeView(View view) { + if (sFloatingLayout == null) { return; } - if ( view == null ) { + if (view == null) { return; } - sFloatingLayout.removeView( view ); - if ( sView == view ) { + sFloatingLayout.removeView(view); + if (sView == view) { sView = null; sPriority = Integer.MIN_VALUE; sMovable = false; @@ -182,34 +184,34 @@ public class FloatingViewHandler { } private static void addView() { - if ( sView == null ) { + if (sView == null) { return; } FrameLayout.LayoutParams params = sParams; - if ( params == null ) { - params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ); + if (params == null) { + params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.leftMargin = sX; params.topMargin = sY; } - sFloatingLayout.addView( sView, params ); + sFloatingLayout.addView(sView, params); } - public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) { - if ( view == null ) { + public static void attachMovementEvent(View view, WindowManager.LayoutParams params) { + if (view == null) { return; } - view.setOnTouchListener( ( v, event ) -> { + view.setOnTouchListener((v, event) -> { DispatchTouchEventWrapper.getInstance() - .attach( view, params ) - .handle( event ); + .attach(view, params) + .handle(event); return false; - } ); + }); } - public static void setVisible( boolean visible ) { - if ( sFloatingLayout != null ) { - sFloatingLayout.setVisibility( visible ? View.VISIBLE : View.INVISIBLE ); + public static void setVisible(boolean visible) { + if (sFloatingLayout != null) { + sFloatingLayout.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/collect/MoGoMapDataCollectProvider.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/collect/MoGoMapDataCollectProvider.kt index 522ef2a40c..7d182921df 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/collect/MoGoMapDataCollectProvider.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/collect/MoGoMapDataCollectProvider.kt @@ -8,14 +8,14 @@ import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.zhidaoauto.map.operational.open.GatherApi import com.zhidaoauto.map.operational.open.GatherParams -import com.zhidaoauto.map.operational.open.GatherParams.Companion import com.zhidaoauto.map.operational.open.abs.OnTaskListener import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArrayList @@ -40,7 +40,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, ConcurrentHashMap() } - override val functionName: String = TAG + override val functionName: String = "$M_MAP$TAG" @Volatile private var hasInit = false @@ -60,20 +60,20 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, executor.get()?.setCarSn(carSn) } MoGoAiCloudClient.getInstance().addTokenCallbacks(this) - Logger.d(TAG, "--------- init --------") - Logger.d(TAG, "executor: ${ executor.get()?.hashCode() ?: 0 }") + CallerLogger.d("$M_MAP$TAG", "--------- init --------") + CallerLogger.d("$M_MAP$TAG", "executor: ${ executor.get()?.hashCode() ?: 0 }") } override fun onDestroy() { - CallerMapLocationListenerManager.removeListener(TAG) - Logger.d(TAG, "--------- onDestroy --------") + CallerMapLocationListenerManager.removeListener("$M_MAP$TAG") + CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------") executor.get()?.setOnTaskListener(null) listeners.clear() map.clear() } override fun registerOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) { - Logger.d(TAG, "--------- registerOnMapCollectTaskListener --------") + CallerLogger.d("$M_MAP$TAG", "--------- registerOnMapCollectTaskListener --------") listener ?: return if (listeners.contains(listener)) { return @@ -82,7 +82,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, } override fun unRegisterOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) { - Logger.d(TAG, "--------- unRegisterOnMapCollectTaskListener --------") + CallerLogger.d("$M_MAP$TAG", "--------- unRegisterOnMapCollectTaskListener --------") listener ?: return if (!listeners.contains(listener)) { return @@ -97,40 +97,40 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, videoPath: String, reason: String ) { - Logger.d(TAG, "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]") + CallerLogger.d("$M_MAP$TAG", "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]") try { if (isInValidStatus()) { - Logger.w(TAG, "-- finish: 状态无效") + CallerLogger.w("$M_MAP$TAG", "-- finish: 状态无效") return } if (!map.containsKey(id)) { - Logger.w(TAG, "-- finish: 无相关指令") + CallerLogger.w("$M_MAP$TAG", "-- finish: 无相关指令") return } - Logger.d(TAG, "-- finish: 结束任务[$id]") + CallerLogger.d("$M_MAP$TAG", "-- finish: 结束任务[$id]") executor.get()?.finishTask(id, state, gpsPath, videoPath, reason) } catch (e : Throwable) { e.printStackTrace() - Logger.e(TAG, "-- finish:\n$e"); + CallerLogger.e("$M_MAP$TAG", "-- finish:\n$e") } finally { map[id] = Status.FINISH } } override fun onTaskFinish(id: Int, time: Long) { - Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time]") + CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time]") if (!map.containsKey(id) || map[id] == Status.FINISH) { - Logger.w(TAG, "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集") + CallerLogger.w("$M_MAP$TAG", "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集") return } - Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集") + CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集") listeners.forEach { it.onMapCollectEnd(id, time) } } override fun onTaskStart(id: Int, time: Long) { - Logger.d(TAG, "地图模块下发开始采集指令 -> [$id, $time]") + CallerLogger.d("$M_MAP$TAG", "地图模块下发开始采集指令 -> [$id, $time]") map[id] = Status.INIT listeners.forEach { it.onMapCollectStart(id, time) @@ -142,7 +142,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, if (!hasInit) { executor.get()?.also { hasInit = true - Logger.d(TAG, "告之地图sdk,定义数据可以用了") + CallerLogger.d("$M_MAP$TAG", "告之地图sdk,定义数据可以用了") it.setIsInit() } } @@ -177,7 +177,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, } override fun onTokenGot(token: String?, sn: String?) { - Logger.d(TAG, "-- onTokenGot --> $sn") + CallerLogger.d("$M_MAP$TAG", "-- onTokenGot --> $sn") sn?.let { executor.get()?.setCarSn(it) } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java index 048d656dd8..e92b3ff768 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java @@ -10,7 +10,6 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.mvp.MvpFragment; import com.mogo.eagle.core.data.constants.MoGoFragmentPaths; import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoUiSettings; import com.mogo.map.MogoMapView; @@ -35,7 +34,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > private MogoMapView mMogoMapView; private IMogoMap mMogoMap; - private boolean mIsControllerByOthersStatus = false; + private final boolean mIsControllerByOthersStatus = false; @Override protected int getLayoutId() { @@ -96,7 +95,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > @Override public void onActivityCreated( @Nullable Bundle savedInstanceState ) { super.onActivityCreated( savedInstanceState ); - Logger.d( TAG, "onActivityCreated" ); initMapView(); } @@ -236,8 +234,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > angle = 16.5f; } return angle; - - } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java index 0b29881729..0531987cb2 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java @@ -1,11 +1,12 @@ package com.mogo.eagle.core.function.smp; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP; + import android.content.Context; import android.graphics.Color; import android.location.Location; import android.os.Bundle; import android.util.AttributeSet; -import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -32,11 +33,11 @@ import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.function.map.R; import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils; import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.widget.RoundLayout; import com.mogo.module.common.utils.DrivingDirectionUtils; @@ -64,8 +65,8 @@ public class SmallMapDirectionView private Marker mEndMarker; private int zoomLevel = 15; - private List mCoordinatesLatLng = new ArrayList<>(); - private List mCoordinatesLatLngCurrent = new ArrayList<>(); + private final List mCoordinatesLatLng = new ArrayList<>(); + private final List mCoordinatesLatLngCurrent = new ArrayList<>(); private Polyline mPolyline; private CameraUpdate mCameraUpdate; private Context mContext; @@ -88,11 +89,10 @@ public class SmallMapDirectionView } private void initView(Context context) { - Logger.d(TAG, "initView"); mContext = context; View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this); - mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.aMapNaviView); + mAMapNaviView = smpView.findViewById(R.id.aMapNaviView); // rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder); // rlSmallMapBorder.addView(mAMapNaviView); @@ -141,19 +141,16 @@ public class SmallMapDirectionView uiSettings.setAllGesturesEnabled(false);// 所有手势 uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮 uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可 - mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() { - @Override - public void onMapLoaded() { - Logger.d(TAG, "smp---onMapLoaded"); - // 加载自定义样式 - CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions() - .setEnable(true) - .setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext())) - .setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext())); - // 设置自定义样式 - mAMap.setCustomMapStyle(customMapStyleOptions); - mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2); - } + mAMap.setOnMapLoadedListener(() -> { + CallerLogger.INSTANCE.d(M_MAP + TAG, "smp---onMapLoaded"); + // 加载自定义样式 + CustomMapStyleOptions customMapStyleOptions1 = new CustomMapStyleOptions() + .setEnable(true) + .setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext())) + .setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext())); + // 设置自定义样式 + mAMap.setCustomMapStyle(customMapStyleOptions1); + mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2); }); } @@ -166,8 +163,7 @@ public class SmallMapDirectionView @Override public void onLocationChanged(@Nullable MogoLocation location) { - //Logger.d(TAG, "onCarLocationChanged2 :" + location.getLatitude()+":"+location.getLongitude()); - if (location == null){ + if (location == null) { return; } LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude()); @@ -192,15 +188,13 @@ public class SmallMapDirectionView // 与结束位置进行 GeoHash 0-12 // GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7); // GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7); -// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash); -// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash); float calculateDistance = CoordinateUtils.calculateLineDistance( endLatLng.latitude, endLatLng.longitude, currentLatLng.latitude, currentLatLng.longitude ); - Log.d(TAG, "calculateDistance=" + calculateDistance); + CallerLogger.INSTANCE.d(M_MAP + TAG, "calculateDistance=" + calculateDistance); if (calculateDistance <= 5) { clearPolyline(); mCoordinatesLatLng.clear(); @@ -214,7 +208,7 @@ public class SmallMapDirectionView mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } - private void removeLoction(Location latLng) { + private void removeLocation(Location latLng) { for (LatLng l : mCoordinatesLatLng) { if (!isPointOnCarFront(latLng, l)) { mCoordinatesLatLng.remove(l); @@ -233,11 +227,7 @@ public class SmallMapDirectionView int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( carLon, carLat, poiLon, poiLat, (int) carAngle); - if (diffAngle <= 90) { - return true; - } else { - return false; - } + return diffAngle <= 90; } @@ -249,7 +239,6 @@ public class SmallMapDirectionView // mCoordinatesLatLng.addAll(latLngs); // for (LatLng coordinate : mCoordinatesLatLng) { // mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon())); -// Log.e("",coordinate.latitude+":"+coordinate.longitude); // } if (mAMap != null) { if (mCoordinatesLatLng.size() > 2) { @@ -288,8 +277,7 @@ public class SmallMapDirectionView CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext); mCoordinateConverter.from(CoordinateConverter.CoordType.GPS); mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon)); - LatLng latLng = mCoordinateConverter.convert(); - return latLng; + return mCoordinateConverter.convert(); } public List CoordinateConverterFrom84ForList(Context mContext, List mogoLatLngList) { @@ -315,7 +303,7 @@ public class SmallMapDirectionView } } - public void resetPolyine() { + public void resetPolyLine() { mCoordinatesLatLng.clear(); if (mPolyline != null) { mPolyline.remove(); diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java index 45a6fc9602..6de360c5ca 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.smp; import android.content.Context; import android.os.Bundle; -import android.util.Log; import android.view.View; import com.alibaba.android.arouter.facade.annotation.Route; @@ -166,7 +165,6 @@ public class SmallMapFragment extends BaseFragment for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) { latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude())); } - Log.e(TAG, "routeResult:" + latLngList.size()); if (latLngList.size() > 0) { drawablePolyline(latLngList); } else { diff --git a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveGSYVideoView.java b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveGSYVideoView.java index 5bb6f798d6..ffcb761f8a 100644 --- a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveGSYVideoView.java +++ b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveGSYVideoView.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.live; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MONITOR; + import android.content.Context; import android.os.Bundle; import android.text.TextUtils; @@ -11,8 +13,8 @@ import android.widget.TextView; import androidx.constraintlayout.widget.ConstraintLayout; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.monitoring.R; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.widget.LiveRoundLayout; import com.tencent.rtmp.ITXLivePlayListener; import com.tencent.rtmp.TXLiveConstants; @@ -67,7 +69,7 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout { mLivePlayer.enableHardwareDecode(true); mLoading = findViewById(R.id.loading); - // mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.module_live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY); + // mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.module_live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY); mClLoadError = findViewById(R.id.clLoadError); mTvRefreshButton = findViewById(R.id.tvRefreshButton); @@ -108,11 +110,11 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout { mLivePlayer.setPlayListener(new ITXLivePlayListener() { @Override public void onPlayEvent(int event, Bundle bundle) { - Logger.w(TAG, + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "直播信息= " + "\n播放器:onPlayEvent==" + event + - "\nbundle===" + bundle); - Logger.d(TAG, "liveUrl = " + liveUrl); + "\nbundle===" + bundle + + "liveUrl = " + liveUrl); if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) { mLoading.setVisibility(VISIBLE); mClLoadError.setVisibility(GONE); @@ -128,13 +130,13 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout { @Override public void onNetStatus(Bundle bundle) { - Logger.w(TAG, "播放器:onNetStatus===bundle===" + bundle); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "播放器:onNetStatus===bundle===" + bundle); } }); } } catch (Exception e) { e.printStackTrace(); - Logger.w(TAG, "播放器:onNetStatus e = " + e); + CallerLogger.INSTANCE.e(M_MONITOR + TAG, "播放器:onNetStatus e = " + e); mLoading.setVisibility(GONE); mClLoadError.setVisibility(VISIBLE); } @@ -142,7 +144,7 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout { public void stopLive(String liveUrl) { try { - Logger.w(TAG, "心跳:关闭直播..."); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "心跳:关闭直播..."); // 暂停 mLivePlayer.pause(); // true 代表清除最后一帧画面 diff --git a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveManager.java b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveManager.java index 8d15184971..24663a573d 100644 --- a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveManager.java +++ b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/live/CameraLiveManager.java @@ -1,12 +1,10 @@ package com.mogo.eagle.core.function.live; -import android.util.Log; import android.view.View; import androidx.annotation.Nullable; import com.mogo.cloud.socket.entity.SocketDownData; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.function.live.impl.AbsCameraScenario; import com.mogo.service.windowview.IMogoTopViewStatusListener; @@ -35,7 +33,6 @@ public class CameraLiveManager extends AbsCameraScenario isShowWindow = " + isShowWindow); if (isShowWindow) { close(); } @@ -51,7 +48,6 @@ public class CameraLiveManager extends AbsCameraScenario>>>mCurrentUuid = " + mCurrentUuid + ">>>mCloudRoadData.getUuid() = " + mCloudRoadData.getUuid()); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "onMsgReceived getRtmpUrl = " + mCloudRoadData.getRtmpUrl() + "--- isVrMode = " + isVrMode + " ---isVrModeMarker = " + isVrModeMarker + ">>>>mCurrentUuid = " + mCurrentUuid + ">>>mCloudRoadData.getUuid() = " + mCloudRoadData.getUuid()); if (TextUtils.equals(mCurrentUuid, mCloudRoadData.getUuid())) { if (isVrMode == isVrModeMarker) { // do nothing. - Log.d(TAG, "-------------1------------"); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------1------------"); } else { if (isVrMode) { - Log.d(TAG, "-------------2------------"); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------2------------"); addVrCameraMarker(mCloudRoadData); isVrModeMarker = true; } else { - Log.d(TAG, "-------------3------------"); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------3------------"); addNormalCameraMarker(mCloudRoadData); isVrModeMarker = false; } @@ -146,11 +145,11 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener { mCurrentUuid = mCloudRoadData.getUuid(); // 是否需要延迟 if (isVrMode) { - Log.d(TAG, "-------------4------------"); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------4------------"); addVrCameraMarker(mCloudRoadData); isVrModeMarker = true; } else { - Log.d(TAG, "-------------5------------"); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "-------------5------------"); addNormalCameraMarker(mCloudRoadData); isVrModeMarker = false; } @@ -158,20 +157,20 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener { } else { //删除marker if (obj.getCamera() != null) { - Log.e(TAG, "onMsgReceived RtmpUrl() = " + obj.getCamera().getRtmpUrl()); + CallerLogger.INSTANCE.e(M_MONITOR + TAG, "onMsgReceived RtmpUrl() = " + obj.getCamera().getRtmpUrl()); } else { - Log.e(TAG, "obj.getCamera() == null ----------- "); + CallerLogger.INSTANCE.e(M_MONITOR + TAG, "obj.getCamera() == null ----------- "); } removeCameraMarker(); } } else { - Log.e(TAG, "onMsgReceived obj == null "); + CallerLogger.INSTANCE.e(M_MONITOR + TAG, "onMsgReceived obj == null "); } } @Override public void onMsgSend(long id) { - //Logger.d(TAG, "onMsgSend id : " + id); + // CallerLogger.INSTANCEger.d(M_MONITOR + TAG, "onMsgSend id : " + id); } @Override 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 83da794e66..85ac2756bd 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 @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.live; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MONITOR; + import android.content.Context; import android.os.Handler; import android.text.TextUtils; @@ -10,10 +12,10 @@ import android.widget.ImageView; import android.widget.RelativeLayout; import com.mogo.cloud.socket.entity.SocketDownData; -import com.mogo.eagle.core.function.monitoring.R; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.MogoApisHandler; +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; @@ -49,7 +51,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo } public void initView(Context context) { - Logger.w(TAG, "initView 。。。。。"); + CallerLogger.INSTANCE.w(M_MONITOR + TAG, "initView 。。。。。"); LayoutInflater.from(context).inflate(R.layout.camera_push_live_video, this); // 详情列表 mLiveGSYVideoView = findViewById(R.id.videoPlayer); @@ -66,9 +68,9 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo @Override public void show(SocketDownData.CloudRoadDataProto entity) { if (entity != null) { - Logger.w(TAG, "更新直播信息 show entity = " + entity); + CallerLogger.INSTANCE.w(M_MONITOR + TAG, "更新直播信息 show entity = " + entity); if (!TextUtils.isEmpty(entity.getRtmpUrl())) { - Logger.w(TAG, "entity.getRtmpUrl() = " + entity.getRtmpUrl()); + CallerLogger.INSTANCE.w(M_MONITOR + TAG, "entity.getRtmpUrl() = " + entity.getRtmpUrl()); mIvReportHead.setVisibility(INVISIBLE); MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(entity.getRtmpUrl(), mIvReportHead); @@ -101,14 +103,14 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo // 倒计时 if (runnableV2XEvent == null) { runnableV2XEvent = () -> { - //Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); + // CallerLogger.INSTANCE.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); //TODO 移除窗体 }; } else { handlerV2XEvent.removeCallbacks(runnableV2XEvent); } - Logger.d(TAG, "V2X=== Window 展示开始倒计时:" ); + CallerLogger.INSTANCE.d(M_MONITOR + TAG, "V2X=== Window 展示开始倒计时:"); handlerV2XEvent.postDelayed(runnableV2XEvent, 20000); } diff --git a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/CronTaskManager.kt b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/CronTaskManager.kt index 14bc50cb20..f7c780b33e 100644 --- a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/CronTaskManager.kt +++ b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/CronTaskManager.kt @@ -4,10 +4,12 @@ import android.content.Context import android.os.Handler import android.os.Looper import android.os.Message -import com.mogo.eagle.core.data.camera.* +import com.mogo.eagle.core.data.camera.CameraEntity +import com.mogo.eagle.core.data.camera.ReqLiveCarBean +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MONITOR import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.monitoring.net.CameraListServices -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.constants.HostConst import io.reactivex.android.schedulers.AndroidSchedulers @@ -15,8 +17,11 @@ import io.reactivex.disposables.Disposable import io.reactivex.schedulers.Schedulers class CronTaskManager(private var context: Context?) { - private val TAG = "CronTaskManager" - private val CRON_TASK_TYPE = 1011 + + companion object { + private const val TAG = "CronTaskManager" + private const val CRON_TASK_TYPE = 1011 + } private val netWork by lazy { MogoApisHandler.getInstance().apis.networkApi @@ -70,10 +75,10 @@ class CronTaskManager(private var context: Context?) { .observeOn(AndroidSchedulers.mainThread()) .subscribe({ cameraList = it - Logger.d(TAG, "requestCameraList返回结果为:$it") + CallerLogger.d("$M_MONITOR$TAG", "requestCameraList返回结果为:$it") }, { it.printStackTrace() - Logger.e(TAG, "message is:${it.message}, cause is:${it.cause}") + CallerLogger.e("$M_MONITOR$TAG", "message is:${it.message}, cause is:${it.cause}") }) } @@ -100,16 +105,16 @@ class CronTaskManager(private var context: Context?) { .observeOn(AndroidSchedulers.mainThread()) .subscribe({ cameraList = it - Logger.d(TAG, "requestDeviceList返回结果为:$it") + CallerLogger.d("$M_MONITOR$TAG", "requestDeviceList返回结果为:$it") }, { it.printStackTrace() - Logger.e( - TAG, + CallerLogger.e( + "$M_MONITOR$TAG", "requestDeviceList:message is:${it.message}, cause is:${it.cause}" ) }) } ?: run { - Logger.e(TAG, "CurrentLocation is null!") + CallerLogger.e("$M_MONITOR$TAG", "CurrentLocation is null!") } } @@ -133,13 +138,16 @@ class CronTaskManager(private var context: Context?) { .observeOn(AndroidSchedulers.mainThread()) .subscribe({ carCameraList = it - Logger.d(TAG, "requestCarCameraList返回结果为:$it") + CallerLogger.d("$M_MONITOR$TAG", "requestCarCameraList返回结果为:$it") }, { - Logger.e(TAG, "message is:${it.message}, cause is:${it.cause}") + CallerLogger.e( + "$M_MONITOR$TAG", + "message is:${it.message}, cause is:${it.cause}" + ) it.printStackTrace() }) } ?: run { - Logger.e(TAG, "CurrentLocation is null!") + CallerLogger.e("$M_MONITOR$TAG", "CurrentLocation is null!") } } @@ -157,14 +165,17 @@ class CronTaskManager(private var context: Context?) { .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ - Logger.d(TAG, "openCameraStream返回结果为:$it") + CallerLogger.d("$M_MONITOR$TAG", "openCameraStream返回结果为:$it") it.result?.let { streamResult -> if (!streamResult.flvUrl.isNullOrEmpty()) CallerHmiManager.startRoadCameraLive( streamResult.flvUrl!! ) } }, { - Logger.e(TAG, "openCameraStream&message is:${it.message}, cause is:${it.cause}") + CallerLogger.e( + "$M_MONITOR$TAG", + "openCameraStream&message is:${it.message}, cause is:${it.cause}" + ) CallerHmiManager.showNoSignalView() it.printStackTrace() }) @@ -182,14 +193,17 @@ class CronTaskManager(private var context: Context?) { .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ - Logger.d(TAG, "reqOpenCameraStream返回结果为:$it") + CallerLogger.d("$M_MONITOR$TAG", "reqOpenCameraStream返回结果为:$it") if (!it.flvUrl.isNullOrEmpty()) { CallerHmiManager.startRoadCameraLive(it.flvUrl!!) } else { CallerHmiManager.showNoSignalView() } }, { - Logger.e(TAG, "reqOpenCameraStream&message is:${it.message}, cause is:${it.cause}") + CallerLogger.e( + "$M_MONITOR$TAG", + "reqOpenCameraStream&message is:${it.message}, cause is:${it.cause}" + ) CallerHmiManager.showNoSignalView() it.printStackTrace() }) diff --git a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/MoGoMonitoringProvider.java b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/MoGoMonitoringProvider.java index 672ee0cd64..b69be6c483 100644 --- a/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/MoGoMonitoringProvider.java +++ b/core/function-impl/mogo-core-function-monitoring/src/main/java/com/mogo/eagle/core/function/monitoring/MoGoMonitoringProvider.java @@ -8,7 +8,6 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.eagle.core.data.camera.CameraEntity; import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.function.api.monitoring.IMoGoMonitoringProvider; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import java.util.List; @@ -30,7 +29,6 @@ public class MoGoMonitoringProvider implements IMoGoMonitoringProvider { @Override public void init(Context context) { - Logger.d(TAG, "初始化……"); mCronTaskManager = new CronTaskManager(context); mCronTaskManager.startCronTask(); } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java index 330f19a602..4069db45b6 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeProvider.java @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.notice; import android.content.Context; -import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.eagle.core.data.constants.MogoServicePaths; @@ -19,8 +18,6 @@ import org.jetbrains.annotations.NotNull; */ @Route(path = MogoServicePaths.PATH_AI_NOTICE) public class NoticeProvider implements IMoGoNoticeProvider { - private String TAG = "AINotice"; - private Context mContext; @NotNull @Override @@ -35,8 +32,6 @@ public class NoticeProvider implements IMoGoNoticeProvider { @Override public void init(Context context) { - Log.d(TAG, "init"); - mContext = context; NoticeSocketManager.getInstance().registerSocketMessageListener(context); } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java index 2a93ae3669..7503984c11 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -1,13 +1,14 @@ package com.mogo.eagle.core.function.notice; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NOTICE; + import android.content.Context; -import android.util.Log; import com.mogo.eagle.core.data.notice.NoticeNormalData; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.MogoApisHandler; import com.mogo.service.cloud.socket.IMogoOnMessageListener; @@ -31,27 +32,24 @@ class NoticeSocketManager { } public void registerSocketMessageListener(Context context) { - Log.d(TAG, "registerSocketMessage"); mContext = context; MogoApisHandler.getInstance().getApis().getSocketManagerApi(context). - registerOnMessageListener(301001, mtrafficNoticeListener); + registerOnMessageListener(301001, mTrafficNoticeListener); MogoApisHandler.getInstance().getApis().getSocketManagerApi(context). registerOnMessageListener(100, mNormalNoticeListener); } public void unRegisterSocketMessageListener() { - if (mtrafficNoticeListener != null) { - MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext). - unregisterOnMessageListener(301001, mtrafficNoticeListener); - MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext). - unregisterOnMessageListener(100, mNormalNoticeListener); - } + MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext). + unregisterOnMessageListener(301001, mTrafficNoticeListener); + MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext). + unregisterOnMessageListener(100, mNormalNoticeListener); } /** * 普通云公告 */ - private IMogoOnMessageListener mNormalNoticeListener = new IMogoOnMessageListener() { + private final IMogoOnMessageListener mNormalNoticeListener = new IMogoOnMessageListener() { @Override public Class target() { return NoticeNormalData.class; @@ -59,11 +57,10 @@ class NoticeSocketManager { @Override public void onMsgReceived(NoticeNormalData obj) { - Logger.i(TAG, "100-- 普通公告数据:" + GsonUtil.jsonFromObject(obj)); + CallerLogger.INSTANCE.d(M_NOTICE + TAG, "100-- 普通公告数据:" + GsonUtil.jsonFromObject(obj)); if (obj == null) { return; } - CallerHmiManager.INSTANCE.showNoticeNormalData(obj); } }; @@ -71,7 +68,7 @@ class NoticeSocketManager { /** * 交警类型公告弹窗 */ - private IMogoOnMessageListener mtrafficNoticeListener = new IMogoOnMessageListener() { + private final IMogoOnMessageListener mTrafficNoticeListener = new IMogoOnMessageListener() { @Override public Class target() { @@ -80,7 +77,7 @@ class NoticeSocketManager { @Override public void onMsgReceived(NoticeTrafficStylePushData obj) { - Logger.i(TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj)); + CallerLogger.INSTANCE.d(M_NOTICE + TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj)); CallerHmiManager.INSTANCE.showTrafficBanner(obj); } }; diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java index 16e0868f0d..c5639075b4 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.notice.network; import android.util.ArrayMap; -import android.util.Log; import com.mogo.cloud.network.NetConstants; import com.mogo.cloud.network.RetrofitFactory; @@ -12,7 +11,6 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo; import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import java.util.HashMap; import java.util.Map; @@ -31,7 +29,6 @@ import okhttp3.RequestBody; * @since: 10/28/21 */ public class NoticeNetWorkManager { - private String TAG = "AINotice"; private static volatile NoticeNetWorkManager requestNoticeManager; private final NoticeApiService mNoticeApiService; @@ -68,12 +65,10 @@ public class NoticeNetWorkManager { .subscribe(new Observer() { @Override public void onSubscribe(@NonNull Disposable d) { - Log.d(TAG, "onSubscribe"); } @Override public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) { - Log.d(TAG, "onNext:"+noticeTrafficStyleInfo); if (noticeTrafficStyleInfo.getResult().getAccidentInfo() != null) { callBack.callBackWithResult(noticeTrafficStyleInfo); } @@ -81,12 +76,10 @@ public class NoticeNetWorkManager { @Override public void onError(@NonNull Throwable e) { - Log.d(TAG, "requestAccidentInfo--error" + e.toString()); } @Override public void onComplete() { - Log.d(TAG, "onComplete"); } }); } @@ -150,18 +143,15 @@ public class NoticeNetWorkManager { @Override public void onNext(@NonNull NoticeNormalDetail noticeNormalDetail) { - Logger.d(TAG, "onNext ------ "); // CallerHmiManager.INSTANCE.showNormalBanner(noticeNormalDetail); } @Override public void onError(@NonNull Throwable e) { - Logger.e(TAG, " onError e = " + e); } @Override public void onComplete() { - Logger.d(TAG, "onComplete ------ "); } }); 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 index 7309604347..3c2a0a5fd4 100644 --- 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 @@ -3,15 +3,15 @@ package com.mogo.eagle.core.function.notice.repository import android.content.Context import android.os.Handler import android.os.Looper -import android.util.Log 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.eagle.core.utilcode.mogo.logger.Logger import com.mogo.service.statusmanager.IMogoStatusChangedListener import com.mogo.service.statusmanager.StatusDescriptor import java.util.* @@ -20,7 +20,9 @@ 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 @@ -33,8 +35,6 @@ class PushRepository(mContext: Context) { val pushRepository: PushRepository by lazy { PushRepository(appContext) } - - private const val TAG: String = "PushRepository.kt" } // 被中断的push消息仅再次展示一次 @@ -54,7 +54,7 @@ class PushRepository(mContext: Context) { private val statusChangedListener: IMogoStatusChangedListener = IMogoStatusChangedListener { sd, open -> - Log.d("PushRepository", "sd = $sd open = $open") + CallerLogger.d("$M_NOTICE$TAG", "sd = $sd , open = $open") } init { @@ -74,7 +74,7 @@ class PushRepository(mContext: Context) { } private fun startIterate() { - Log.d("PushRepository", "startIterate ${pushViewModel.pushBean}") + CallerLogger.d("$M_NOTICE$TAG", "startIterate : ${pushViewModel.pushBean}") if (!pushViewModel.isAddWindow()) { val bean = pushBeanQueue.peek() if (bean != null) { @@ -99,7 +99,7 @@ class PushRepository(mContext: Context) { if (singleRePushSet.contains(pushBean)) { return } - Logger.d(TAG, "保存待下一次开启") + CallerLogger.d("$M_NOTICE$TAG", "保存待下一次开启") singleRePushSet.add(pushBean) pushBeanQueue.offer(pushBean) } @@ -111,7 +111,10 @@ class PushRepository(mContext: Context) { private fun needDelay(bean: PushBean): Boolean { if (locationClient.lastKnowLocation != null) { if (bean.speedLimit > 0 && bean.speedLimit <= locationClient.lastKnowLocation.speed * 18 / 5) { - Log.d("PushRepository", "speedLimit" + locationClient.lastKnowLocation.speed) + CallerLogger.d( + "$M_NOTICE$TAG", + "speedLimit : " + locationClient.lastKnowLocation.speed + ) return true } } @@ -140,7 +143,7 @@ class PushRepository(mContext: Context) { } pushViewModel.pushBean = pushBeanQueue.poll() } catch (e: Exception) { - Logger.e(TAG, e, "") + CallerLogger.e("$M_NOTICE$TAG", "$e") } if (pushViewModel.pushBean != null) { statusManager.registerStatusChangedListener( diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt index d77c7e6422..b60eeb4f39 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt @@ -3,10 +3,8 @@ package com.mogo.eagle.core.function.notice.test import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.util.Log import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.utilcode.mogo.logger.Logger /** * @author Jing @@ -14,14 +12,12 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger * @since: 10/29/21 */ class TestNoticeBroadcastReceiver : BroadcastReceiver() { - private val TAG = "AINotice" private var mContext: Context? = null override fun onReceive(context: Context?, intent: Intent) { try { mContext = context val sceneType = intent.getIntExtra("sceneType", 0) - Logger.d(TAG, "textPanelOpenType:$sceneType") // 分发场景 dispatchSceneTest(sceneType) } catch (e: Exception) { @@ -30,7 +26,6 @@ class TestNoticeBroadcastReceiver : BroadcastReceiver() { } private fun dispatchSceneTest(sceneType: Int) { - Log.d(TAG, "dispatchSceneTest::" + sceneType.toString()); if (sceneType == 301001) { val pushData = NoticeTrafficStylePushData() pushData.msg = "交警任务公告" diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnimatorUtils.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnimatorUtils.kt index 0a34f27f7a..29fd0a1a31 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnimatorUtils.kt +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/AnimatorUtils.kt @@ -4,7 +4,6 @@ import android.view.View import android.view.ViewGroup import androidx.core.view.get import androidx.core.view.isNotEmpty -import com.mogo.eagle.core.utilcode.mogo.logger.Logger const val TAG: String = "AnimatorUtils.kt" @@ -19,7 +18,6 @@ fun startClearAnimator(root: ViewGroup, runnable: Runnable) { try { withEndAction(runnable) } catch (e: Exception) { - Logger.e(TAG, e, "startClearAnimator->withEndAction") } } duration = 200 diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/SchemaUtils.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/SchemaUtils.kt index 64abcbcbbe..f3625674d1 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/SchemaUtils.kt +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/utils/SchemaUtils.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.Intent import android.net.Uri import android.text.TextUtils -import android.util.Log private const val ACTION = "AUTONAVI_STANDARD_BROADCAST_RECV" private const val KEY_TYPE = "KEY_TYPE" @@ -110,7 +109,6 @@ private fun startMap(context: Context, uri: Uri): Boolean { context.sendBroadcast(intent) true } catch (e: NumberFormatException) { - Log.e("CustomMessageInfo", e.localizedMessage) false } } 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 index dccf8b8aa6..25fe5aa092 100644 --- 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 @@ -277,7 +277,6 @@ class FloatView constructor( // this.x, // -ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical) // ) { -// Logger.d(TAG, "here") // this.x = 0f // mWindowManager.removeViewImmediate(this) // } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/SwipeItemLayout.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/SwipeItemLayout.java index c605c482a7..58a61bc452 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/SwipeItemLayout.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/SwipeItemLayout.java @@ -384,7 +384,6 @@ public class SwipeItemLayout extends ViewGroup { void startScroll(int startX, int endX) { if (startX != endX) { -// Log.e("scroll - startX - endX", "" + startX + " " + endX); setTouchMode(Mode.FLING); mAbort = false; mScrollToLeft = endX < startX; @@ -394,8 +393,6 @@ public class SwipeItemLayout extends ViewGroup { } void startFling(int startX, int xVel) { -// Log.e("fling - startX", "" + startX); - if (xVel > mMinVelocity && startX != 0) { startScroll(startX, 0); return; @@ -426,12 +423,9 @@ public class SwipeItemLayout extends ViewGroup { @Override public void run() { -// Log.e("abort", Boolean.toString(mAbort)); if (!mAbort) { boolean more = mScroller.computeScrollOffset(); int curX = mScroller.getCurrX(); -// Log.e("curX", "" + curX); - boolean atEdge = trackMotionScroll(curX - mScrollOffset); if (more && !atEdge) { ViewCompat.postOnAnimation(SwipeItemLayout.this, this); diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedDrawable.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedDrawable.java index 6cf48344ae..4bfc781795 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedDrawable.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedDrawable.java @@ -32,7 +32,6 @@ import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; -import android.util.Log; import android.widget.ImageView.ScaleType; import androidx.annotation.ColorInt; @@ -139,7 +138,6 @@ public class RoundedDrawable extends Drawable { drawable.draw(canvas); } catch (Exception e) { e.printStackTrace(); - Log.w(TAG, "Failed to create bitmap from drawable!"); bitmap = null; } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedImageView.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedImageView.java index 014624e511..f93c9eaf02 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedImageView.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/view/roundimage/RoundedImageView.java @@ -1,18 +1,18 @@ /* -* Copyright (C) 2015 Vincent Mi -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2015 Vincent Mi + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.mogo.eagle.core.function.notice.view.roundimage; @@ -28,7 +28,6 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.net.Uri; import android.util.AttributeSet; -import android.util.Log; import android.widget.ImageView; import androidx.annotation.ColorInt; @@ -36,553 +35,572 @@ import androidx.annotation.DimenRes; import androidx.annotation.DrawableRes; import androidx.appcompat.widget.AppCompatImageView; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.notice.R; @SuppressWarnings("UnusedDeclaration") public class RoundedImageView extends AppCompatImageView { - // Constants for tile mode attributes - private static final int TILE_MODE_UNDEFINED = -2; - private static final int TILE_MODE_CLAMP = 0; - private static final int TILE_MODE_REPEAT = 1; - private static final int TILE_MODE_MIRROR = 2; + // Constants for tile mode attributes + private static final int TILE_MODE_UNDEFINED = -2; + private static final int TILE_MODE_CLAMP = 0; + private static final int TILE_MODE_REPEAT = 1; + private static final int TILE_MODE_MIRROR = 2; - public static final String TAG = "RoundedImageView"; - public static final float DEFAULT_RADIUS = 0f; - public static final float DEFAULT_BORDER_WIDTH = 0f; - public static final Shader.TileMode DEFAULT_TILE_MODE = Shader.TileMode.CLAMP; - private static final ImageView.ScaleType[] SCALE_TYPES = { - ImageView.ScaleType.MATRIX, - ImageView.ScaleType.FIT_XY, - ImageView.ScaleType.FIT_START, - ImageView.ScaleType.FIT_CENTER, - ImageView.ScaleType.FIT_END, - ImageView.ScaleType.CENTER, - ImageView.ScaleType.CENTER_CROP, - ImageView.ScaleType.CENTER_INSIDE - }; + public static final String TAG = "RoundedImageView"; + public static final float DEFAULT_RADIUS = 0f; + public static final float DEFAULT_BORDER_WIDTH = 0f; + public static final Shader.TileMode DEFAULT_TILE_MODE = Shader.TileMode.CLAMP; + private static final ImageView.ScaleType[] SCALE_TYPES = { + ImageView.ScaleType.MATRIX, + ImageView.ScaleType.FIT_XY, + ImageView.ScaleType.FIT_START, + ImageView.ScaleType.FIT_CENTER, + ImageView.ScaleType.FIT_END, + ImageView.ScaleType.CENTER, + ImageView.ScaleType.CENTER_CROP, + ImageView.ScaleType.CENTER_INSIDE + }; - private final float[] mCornerRadii = - new float[] { DEFAULT_RADIUS, DEFAULT_RADIUS, DEFAULT_RADIUS, DEFAULT_RADIUS }; + private final float[] mCornerRadii = + new float[]{DEFAULT_RADIUS, DEFAULT_RADIUS, DEFAULT_RADIUS, DEFAULT_RADIUS}; - private Drawable mBackgroundDrawable; - private ColorStateList mBorderColor = - ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); - private float mBorderWidth = DEFAULT_BORDER_WIDTH; - private ColorFilter mColorFilter = null; - private boolean mColorMod = false; - private Drawable mDrawable; - private boolean mHasColorFilter = false; - private boolean mIsOval = false; - private boolean mMutateBackground = false; - private int mResource; - private int mBackgroundResource; - private ImageView.ScaleType mScaleType; - private Shader.TileMode mTileModeX = DEFAULT_TILE_MODE; - private Shader.TileMode mTileModeY = DEFAULT_TILE_MODE; + private Drawable mBackgroundDrawable; + private ColorStateList mBorderColor = + ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); + private float mBorderWidth = DEFAULT_BORDER_WIDTH; + private ColorFilter mColorFilter = null; + private boolean mColorMod = false; + private Drawable mDrawable; + private boolean mHasColorFilter = false; + private boolean mIsOval = false; + private boolean mMutateBackground = false; + private int mResource; + private int mBackgroundResource; + private ImageView.ScaleType mScaleType; + private Shader.TileMode mTileModeX = DEFAULT_TILE_MODE; + private Shader.TileMode mTileModeY = DEFAULT_TILE_MODE; - public RoundedImageView(Context context) { - super(context); - } - - public RoundedImageView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public RoundedImageView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0); - - int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1); - if (index >= 0) { - setScaleType(SCALE_TYPES[index]); - } else { - // default scaletype to FIT_CENTER - setScaleType(ImageView.ScaleType.FIT_CENTER); + public RoundedImageView(Context context) { + super(context); } - float cornerRadiusOverride = - a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius, -1); - - mCornerRadii[Corner.TOP_LEFT] = - a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_top_left, -1); - mCornerRadii[Corner.TOP_RIGHT] = - a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_top_right, -1); - mCornerRadii[Corner.BOTTOM_RIGHT] = - a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_bottom_right, -1); - mCornerRadii[Corner.BOTTOM_LEFT] = - a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_bottom_left, -1); - - boolean any = false; - for (int i = 0, len = mCornerRadii.length; i < len; i++) { - if (mCornerRadii[i] < 0) { - mCornerRadii[i] = 0f; - } else { - any = true; - } + public RoundedImageView(Context context, AttributeSet attrs) { + this(context, attrs, 0); } - if (!any) { - if (cornerRadiusOverride < 0) { - cornerRadiusOverride = DEFAULT_RADIUS; - } - for (int i = 0, len = mCornerRadii.length; i < len; i++) { - mCornerRadii[i] = cornerRadiusOverride; - } + public RoundedImageView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0); + + int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1); + if (index >= 0) { + setScaleType(SCALE_TYPES[index]); + } else { + // default scaletype to FIT_CENTER + setScaleType(ImageView.ScaleType.FIT_CENTER); + } + + float cornerRadiusOverride = + a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius, -1); + + mCornerRadii[Corner.TOP_LEFT] = + a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_top_left, -1); + mCornerRadii[Corner.TOP_RIGHT] = + a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_top_right, -1); + mCornerRadii[Corner.BOTTOM_RIGHT] = + a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_bottom_right, -1); + mCornerRadii[Corner.BOTTOM_LEFT] = + a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius_bottom_left, -1); + + boolean any = false; + for (int i = 0, len = mCornerRadii.length; i < len; i++) { + if (mCornerRadii[i] < 0) { + mCornerRadii[i] = 0f; + } else { + any = true; + } + } + + if (!any) { + if (cornerRadiusOverride < 0) { + cornerRadiusOverride = DEFAULT_RADIUS; + } + for (int i = 0, len = mCornerRadii.length; i < len; i++) { + mCornerRadii[i] = cornerRadiusOverride; + } + } + + mBorderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_border_width, -1); + if (mBorderWidth < 0) { + mBorderWidth = DEFAULT_BORDER_WIDTH; + } + + mBorderColor = a.getColorStateList(R.styleable.RoundedImageView_riv_border_color); + if (mBorderColor == null) { + mBorderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); + } + + mMutateBackground = a.getBoolean(R.styleable.RoundedImageView_riv_mutate_background, false); + mIsOval = a.getBoolean(R.styleable.RoundedImageView_riv_oval, false); + + final int tileMode = a.getInt(R.styleable.RoundedImageView_riv_tile_Mode, TILE_MODE_UNDEFINED); + if (tileMode != TILE_MODE_UNDEFINED) { + setTileModeX(parseTileMode(tileMode)); + setTileModeY(parseTileMode(tileMode)); + } + + final int tileModeX = + a.getInt(R.styleable.RoundedImageView_riv_tile_Mode_x, TILE_MODE_UNDEFINED); + if (tileModeX != TILE_MODE_UNDEFINED) { + setTileModeX(parseTileMode(tileModeX)); + } + + final int tileModeY = + a.getInt(R.styleable.RoundedImageView_riv_tile_Mode_y, TILE_MODE_UNDEFINED); + if (tileModeY != TILE_MODE_UNDEFINED) { + setTileModeY(parseTileMode(tileModeY)); + } + + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(true); + + if (mMutateBackground) { + // when setBackground() is called by View constructor, mMutateBackground is not loaded from the attribute, + // so it's false by default, what doesn't allow to create the RoundedDrawable. At this point, after load + // mMutateBackground and updated BackgroundDrawable to RoundedDrawable, the View's background drawable needs to + // be changed to this new drawable. + //noinspection deprecation + super.setBackgroundDrawable(mBackgroundDrawable); + } + + a.recycle(); } - mBorderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_border_width, -1); - if (mBorderWidth < 0) { - mBorderWidth = DEFAULT_BORDER_WIDTH; + private static Shader.TileMode parseTileMode(int tileMode) { + switch (tileMode) { + case TILE_MODE_CLAMP: + return Shader.TileMode.CLAMP; + case TILE_MODE_REPEAT: + return Shader.TileMode.REPEAT; + case TILE_MODE_MIRROR: + return Shader.TileMode.MIRROR; + default: + return null; + } } - mBorderColor = a.getColorStateList(R.styleable.RoundedImageView_riv_border_color); - if (mBorderColor == null) { - mBorderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); + @Override + protected void drawableStateChanged() { + super.drawableStateChanged(); + invalidate(); } - mMutateBackground = a.getBoolean(R.styleable.RoundedImageView_riv_mutate_background, false); - mIsOval = a.getBoolean(R.styleable.RoundedImageView_riv_oval, false); - - final int tileMode = a.getInt(R.styleable.RoundedImageView_riv_tile_Mode, TILE_MODE_UNDEFINED); - if (tileMode != TILE_MODE_UNDEFINED) { - setTileModeX(parseTileMode(tileMode)); - setTileModeY(parseTileMode(tileMode)); + @Override + public ImageView.ScaleType getScaleType() { + return mScaleType; } - final int tileModeX = - a.getInt(R.styleable.RoundedImageView_riv_tile_Mode_x, TILE_MODE_UNDEFINED); - if (tileModeX != TILE_MODE_UNDEFINED) { - setTileModeX(parseTileMode(tileModeX)); + @Override + public void setScaleType(ImageView.ScaleType scaleType) { + assert scaleType != null; + + if (mScaleType != scaleType) { + mScaleType = scaleType; + + switch (scaleType) { + case CENTER: + case CENTER_CROP: + case CENTER_INSIDE: + case FIT_CENTER: + case FIT_START: + case FIT_END: + case FIT_XY: + super.setScaleType(ImageView.ScaleType.FIT_XY); + break; + default: + super.setScaleType(scaleType); + break; + } + + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } } - final int tileModeY = - a.getInt(R.styleable.RoundedImageView_riv_tile_Mode_y, TILE_MODE_UNDEFINED); - if (tileModeY != TILE_MODE_UNDEFINED) { - setTileModeY(parseTileMode(tileModeY)); - } - - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(true); - - if (mMutateBackground) { - // when setBackground() is called by View constructor, mMutateBackground is not loaded from the attribute, - // so it's false by default, what doesn't allow to create the RoundedDrawable. At this point, after load - // mMutateBackground and updated BackgroundDrawable to RoundedDrawable, the View's background drawable needs to - // be changed to this new drawable. - //noinspection deprecation - super.setBackgroundDrawable(mBackgroundDrawable); - } - - a.recycle(); - } - - private static Shader.TileMode parseTileMode(int tileMode) { - switch (tileMode) { - case TILE_MODE_CLAMP: - return Shader.TileMode.CLAMP; - case TILE_MODE_REPEAT: - return Shader.TileMode.REPEAT; - case TILE_MODE_MIRROR: - return Shader.TileMode.MIRROR; - default: - return null; - } - } - - @Override - protected void drawableStateChanged() { - super.drawableStateChanged(); - invalidate(); - } - - @Override - public ImageView.ScaleType getScaleType() { - return mScaleType; - } - - @Override - public void setScaleType(ImageView.ScaleType scaleType) { - assert scaleType != null; - - if (mScaleType != scaleType) { - mScaleType = scaleType; - - switch (scaleType) { - case CENTER: - case CENTER_CROP: - case CENTER_INSIDE: - case FIT_CENTER: - case FIT_START: - case FIT_END: - case FIT_XY: - super.setScaleType(ImageView.ScaleType.FIT_XY); - break; - default: - super.setScaleType(scaleType); - break; - } - - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } - } - - @Override - public void setImageDrawable(Drawable drawable) { - mResource = 0; - mDrawable = RoundedDrawable.fromDrawable(drawable); - updateDrawableAttrs(); - super.setImageDrawable(mDrawable); - } - - @Override - public void setImageBitmap(Bitmap bm) { - mResource = 0; - mDrawable = RoundedDrawable.fromBitmap(bm); - updateDrawableAttrs(); - super.setImageDrawable(mDrawable); - } - - @Override - public void setImageResource(@DrawableRes int resId) { - if (mResource != resId) { - mResource = resId; - mDrawable = resolveResource(); - updateDrawableAttrs(); - super.setImageDrawable(mDrawable); - } - } - - @Override public void setImageURI(Uri uri) { - super.setImageURI(uri); - setImageDrawable(getDrawable()); - } - - private Drawable resolveResource() { - Resources rsrc = getResources(); - if (rsrc == null) { return null; } - - Drawable d = null; - - if (mResource != 0) { - try { - d = rsrc.getDrawable(mResource); - } catch (Exception e) { - Log.w(TAG, "Unable to find resource: " + mResource, e); - // Don't try again. + @Override + public void setImageDrawable(Drawable drawable) { mResource = 0; - } - } - return RoundedDrawable.fromDrawable(d); - } - - @Override - public void setBackground(Drawable background) { - setBackgroundDrawable(background); - } - - @Override - public void setBackgroundResource(@DrawableRes int resId) { - if (mBackgroundResource != resId) { - mBackgroundResource = resId; - mBackgroundDrawable = resolveBackgroundResource(); - setBackgroundDrawable(mBackgroundDrawable); - } - } - - @Override - public void setBackgroundColor(int color) { - mBackgroundDrawable = new ColorDrawable(color); - setBackgroundDrawable(mBackgroundDrawable); - } - - private Drawable resolveBackgroundResource() { - Resources rsrc = getResources(); - if (rsrc == null) { return null; } - - Drawable d = null; - - if (mBackgroundResource != 0) { - try { - d = rsrc.getDrawable(mBackgroundResource); - } catch (Exception e) { - Log.w(TAG, "Unable to find resource: " + mBackgroundResource, e); - // Don't try again. - mBackgroundResource = 0; - } - } - return RoundedDrawable.fromDrawable(d); - } - - private void updateDrawableAttrs() { - updateAttrs(mDrawable, mScaleType); - } - - private void updateBackgroundDrawableAttrs(boolean convert) { - if (mMutateBackground) { - if (convert) { - mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable); - } - updateAttrs(mBackgroundDrawable, ImageView.ScaleType.FIT_XY); - } - } - - @Override public void setColorFilter(ColorFilter cf) { - if (mColorFilter != cf) { - mColorFilter = cf; - mHasColorFilter = true; - mColorMod = true; - applyColorMod(); - invalidate(); - } - } - - private void applyColorMod() { - // Only mutate and apply when modifications have occurred. This should - // not reset the mColorMod flag, since these filters need to be - // re-applied if the Drawable is changed. - if (mDrawable != null && mColorMod) { - mDrawable = mDrawable.mutate(); - if (mHasColorFilter) { - mDrawable.setColorFilter(mColorFilter); - } - //mDrawable.setXfermode(mXfermode); - //mDrawable.setAlpha(mAlpha * mViewAlphaScale >> 8); - } - } - - private void updateAttrs(Drawable drawable, ImageView.ScaleType scaleType) { - if (drawable == null) { return; } - - if (drawable instanceof RoundedDrawable) { - ((RoundedDrawable) drawable) - .setScaleType(scaleType) - .setBorderWidth(mBorderWidth) - .setBorderColor(mBorderColor) - .setOval(mIsOval) - .setTileModeX(mTileModeX) - .setTileModeY(mTileModeY); - - if (mCornerRadii != null) { - ((RoundedDrawable) drawable).setCornerRadius( - mCornerRadii[Corner.TOP_LEFT], - mCornerRadii[Corner.TOP_RIGHT], - mCornerRadii[Corner.BOTTOM_RIGHT], - mCornerRadii[Corner.BOTTOM_LEFT]); - } - - applyColorMod(); - } else if (drawable instanceof LayerDrawable) { - // loop through layers to and set drawable attrs - LayerDrawable ld = ((LayerDrawable) drawable); - for (int i = 0, layers = ld.getNumberOfLayers(); i < layers; i++) { - updateAttrs(ld.getDrawable(i), scaleType); - } - } - } - - @Override - @Deprecated - public void setBackgroundDrawable(Drawable background) { - mBackgroundDrawable = background; - updateBackgroundDrawableAttrs(true); - //noinspection deprecation - super.setBackgroundDrawable(mBackgroundDrawable); - } - - /** - * @return the largest corner radius. - */ - public float getCornerRadius() { - return getMaxCornerRadius(); - } - - /** - * @return the largest corner radius. - */ - public float getMaxCornerRadius() { - float maxRadius = 0; - for (float r : mCornerRadii) { - maxRadius = Math.max(r, maxRadius); - } - return maxRadius; - } - - /** - * Get the corner radius of a specified corner. - * - * @param corner the corner. - * @return the radius. - */ - public float getCornerRadius(@Corner int corner) { - return mCornerRadii[corner]; - } - - /** - * Set all the corner radii from a dimension resource id. - * - * @param resId dimension resource id of radii. - */ - public void setCornerRadiusDimen(@DimenRes int resId) { - float radius = getResources().getDimension(resId); - setCornerRadius(radius, radius, radius, radius); - } - - /** - * Set the corner radius of a specific corner from a dimension resource id. - * - * @param corner the corner to set. - * @param resId the dimension resource id of the corner radius. - */ - public void setCornerRadiusDimen(@Corner int corner, @DimenRes int resId) { - setCornerRadius(corner, getResources().getDimensionPixelSize(resId)); - } - - /** - * Set the corner radii of all corners in px. - * - * @param radius the radius to set. - */ - public void setCornerRadius(float radius) { - setCornerRadius(radius, radius, radius, radius); - } - - /** - * Set the corner radius of a specific corner in px. - * - * @param corner the corner to set. - * @param radius the corner radius to set in px. - */ - public void setCornerRadius(@Corner int corner, float radius) { - if (mCornerRadii[corner] == radius) { - return; - } - mCornerRadii[corner] = radius; - - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } - - /** - * Set the corner radii of each corner individually. Currently only one unique nonzero value is - * supported. - * - * @param topLeft radius of the top left corner in px. - * @param topRight radius of the top right corner in px. - * @param bottomRight radius of the bottom right corner in px. - * @param bottomLeft radius of the bottom left corner in px. - */ - public void setCornerRadius(float topLeft, float topRight, float bottomLeft, float bottomRight) { - if (mCornerRadii[Corner.TOP_LEFT] == topLeft - && mCornerRadii[Corner.TOP_RIGHT] == topRight - && mCornerRadii[Corner.BOTTOM_RIGHT] == bottomRight - && mCornerRadii[Corner.BOTTOM_LEFT] == bottomLeft) { - return; + mDrawable = RoundedDrawable.fromDrawable(drawable); + updateDrawableAttrs(); + super.setImageDrawable(mDrawable); } - mCornerRadii[Corner.TOP_LEFT] = topLeft; - mCornerRadii[Corner.TOP_RIGHT] = topRight; - mCornerRadii[Corner.BOTTOM_LEFT] = bottomLeft; - mCornerRadii[Corner.BOTTOM_RIGHT] = bottomRight; - - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } - - public float getBorderWidth() { - return mBorderWidth; - } - - public void setBorderWidth(@DimenRes int resId) { - setBorderWidth(getResources().getDimension(resId)); - } - - public void setBorderWidth(float width) { - if (mBorderWidth == width) { return; } - - mBorderWidth = width; - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } - - @ColorInt - public int getBorderColor() { - return mBorderColor.getDefaultColor(); - } - - public void setBorderColor(@ColorInt int color) { - setBorderColor(ColorStateList.valueOf(color)); - } - - public ColorStateList getBorderColors() { - return mBorderColor; - } - - public void setBorderColor(ColorStateList colors) { - if (mBorderColor.equals(colors)) { return; } - - mBorderColor = - (colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - if (mBorderWidth > 0) { - invalidate(); + @Override + public void setImageBitmap(Bitmap bm) { + mResource = 0; + mDrawable = RoundedDrawable.fromBitmap(bm); + updateDrawableAttrs(); + super.setImageDrawable(mDrawable); } - } - public boolean isOval() { - return mIsOval; - } + @Override + public void setImageResource(@DrawableRes int resId) { + if (mResource != resId) { + mResource = resId; + mDrawable = resolveResource(); + updateDrawableAttrs(); + super.setImageDrawable(mDrawable); + } + } - public void setOval(boolean oval) { - mIsOval = oval; - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } + @Override + public void setImageURI(Uri uri) { + super.setImageURI(uri); + setImageDrawable(getDrawable()); + } - public Shader.TileMode getTileModeX() { - return mTileModeX; - } + private Drawable resolveResource() { + Resources rsrc = getResources(); + if (rsrc == null) { + return null; + } - public void setTileModeX(Shader.TileMode tileModeX) { - if (this.mTileModeX == tileModeX) { return; } + Drawable d = null; - this.mTileModeX = tileModeX; - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } + if (mResource != 0) { + try { + d = rsrc.getDrawable(mResource); + } catch (Exception e) { + CallerLogger.INSTANCE.w(TAG, "Unable to find resource: " + mResource + " , exception : " + e); + // Don't try again. + mResource = 0; + } + } + return RoundedDrawable.fromDrawable(d); + } - public Shader.TileMode getTileModeY() { - return mTileModeY; - } + @Override + public void setBackground(Drawable background) { + setBackgroundDrawable(background); + } - public void setTileModeY(Shader.TileMode tileModeY) { - if (this.mTileModeY == tileModeY) { return; } + @Override + public void setBackgroundResource(@DrawableRes int resId) { + if (mBackgroundResource != resId) { + mBackgroundResource = resId; + mBackgroundDrawable = resolveBackgroundResource(); + setBackgroundDrawable(mBackgroundDrawable); + } + } - this.mTileModeY = tileModeY; - updateDrawableAttrs(); - updateBackgroundDrawableAttrs(false); - invalidate(); - } + @Override + public void setBackgroundColor(int color) { + mBackgroundDrawable = new ColorDrawable(color); + setBackgroundDrawable(mBackgroundDrawable); + } - public boolean mutatesBackground() { - return mMutateBackground; - } + private Drawable resolveBackgroundResource() { + Resources rsrc = getResources(); + if (rsrc == null) { + return null; + } - public void mutateBackground(boolean mutate) { - if (mMutateBackground == mutate) { return; } + Drawable d = null; - mMutateBackground = mutate; - updateBackgroundDrawableAttrs(true); - invalidate(); - } + if (mBackgroundResource != 0) { + try { + d = rsrc.getDrawable(mBackgroundResource); + } catch (Exception e) { + CallerLogger.INSTANCE.w(TAG, "Unable to find resource: " + mBackgroundResource + " , exception : " + e); + // Don't try again. + mBackgroundResource = 0; + } + } + return RoundedDrawable.fromDrawable(d); + } + + private void updateDrawableAttrs() { + updateAttrs(mDrawable, mScaleType); + } + + private void updateBackgroundDrawableAttrs(boolean convert) { + if (mMutateBackground) { + if (convert) { + mBackgroundDrawable = RoundedDrawable.fromDrawable(mBackgroundDrawable); + } + updateAttrs(mBackgroundDrawable, ImageView.ScaleType.FIT_XY); + } + } + + @Override + public void setColorFilter(ColorFilter cf) { + if (mColorFilter != cf) { + mColorFilter = cf; + mHasColorFilter = true; + mColorMod = true; + applyColorMod(); + invalidate(); + } + } + + private void applyColorMod() { + // Only mutate and apply when modifications have occurred. This should + // not reset the mColorMod flag, since these filters need to be + // re-applied if the Drawable is changed. + if (mDrawable != null && mColorMod) { + mDrawable = mDrawable.mutate(); + if (mHasColorFilter) { + mDrawable.setColorFilter(mColorFilter); + } + //mDrawable.setXfermode(mXfermode); + //mDrawable.setAlpha(mAlpha * mViewAlphaScale >> 8); + } + } + + private void updateAttrs(Drawable drawable, ImageView.ScaleType scaleType) { + if (drawable == null) { + return; + } + + if (drawable instanceof RoundedDrawable) { + ((RoundedDrawable) drawable) + .setScaleType(scaleType) + .setBorderWidth(mBorderWidth) + .setBorderColor(mBorderColor) + .setOval(mIsOval) + .setTileModeX(mTileModeX) + .setTileModeY(mTileModeY); + + if (mCornerRadii != null) { + ((RoundedDrawable) drawable).setCornerRadius( + mCornerRadii[Corner.TOP_LEFT], + mCornerRadii[Corner.TOP_RIGHT], + mCornerRadii[Corner.BOTTOM_RIGHT], + mCornerRadii[Corner.BOTTOM_LEFT]); + } + + applyColorMod(); + } else if (drawable instanceof LayerDrawable) { + // loop through layers to and set drawable attrs + LayerDrawable ld = ((LayerDrawable) drawable); + for (int i = 0, layers = ld.getNumberOfLayers(); i < layers; i++) { + updateAttrs(ld.getDrawable(i), scaleType); + } + } + } + + @Override + @Deprecated + public void setBackgroundDrawable(Drawable background) { + mBackgroundDrawable = background; + updateBackgroundDrawableAttrs(true); + //noinspection deprecation + super.setBackgroundDrawable(mBackgroundDrawable); + } + + /** + * @return the largest corner radius. + */ + public float getCornerRadius() { + return getMaxCornerRadius(); + } + + /** + * @return the largest corner radius. + */ + public float getMaxCornerRadius() { + float maxRadius = 0; + for (float r : mCornerRadii) { + maxRadius = Math.max(r, maxRadius); + } + return maxRadius; + } + + /** + * Get the corner radius of a specified corner. + * + * @param corner the corner. + * @return the radius. + */ + public float getCornerRadius(@Corner int corner) { + return mCornerRadii[corner]; + } + + /** + * Set all the corner radii from a dimension resource id. + * + * @param resId dimension resource id of radii. + */ + public void setCornerRadiusDimen(@DimenRes int resId) { + float radius = getResources().getDimension(resId); + setCornerRadius(radius, radius, radius, radius); + } + + /** + * Set the corner radius of a specific corner from a dimension resource id. + * + * @param corner the corner to set. + * @param resId the dimension resource id of the corner radius. + */ + public void setCornerRadiusDimen(@Corner int corner, @DimenRes int resId) { + setCornerRadius(corner, getResources().getDimensionPixelSize(resId)); + } + + /** + * Set the corner radii of all corners in px. + * + * @param radius the radius to set. + */ + public void setCornerRadius(float radius) { + setCornerRadius(radius, radius, radius, radius); + } + + /** + * Set the corner radius of a specific corner in px. + * + * @param corner the corner to set. + * @param radius the corner radius to set in px. + */ + public void setCornerRadius(@Corner int corner, float radius) { + if (mCornerRadii[corner] == radius) { + return; + } + mCornerRadii[corner] = radius; + + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } + + /** + * Set the corner radii of each corner individually. Currently only one unique nonzero value is + * supported. + * + * @param topLeft radius of the top left corner in px. + * @param topRight radius of the top right corner in px. + * @param bottomRight radius of the bottom right corner in px. + * @param bottomLeft radius of the bottom left corner in px. + */ + public void setCornerRadius(float topLeft, float topRight, float bottomLeft, float bottomRight) { + if (mCornerRadii[Corner.TOP_LEFT] == topLeft + && mCornerRadii[Corner.TOP_RIGHT] == topRight + && mCornerRadii[Corner.BOTTOM_RIGHT] == bottomRight + && mCornerRadii[Corner.BOTTOM_LEFT] == bottomLeft) { + return; + } + + mCornerRadii[Corner.TOP_LEFT] = topLeft; + mCornerRadii[Corner.TOP_RIGHT] = topRight; + mCornerRadii[Corner.BOTTOM_LEFT] = bottomLeft; + mCornerRadii[Corner.BOTTOM_RIGHT] = bottomRight; + + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } + + public float getBorderWidth() { + return mBorderWidth; + } + + public void setBorderWidth(@DimenRes int resId) { + setBorderWidth(getResources().getDimension(resId)); + } + + public void setBorderWidth(float width) { + if (mBorderWidth == width) { + return; + } + + mBorderWidth = width; + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } + + @ColorInt + public int getBorderColor() { + return mBorderColor.getDefaultColor(); + } + + public void setBorderColor(@ColorInt int color) { + setBorderColor(ColorStateList.valueOf(color)); + } + + public ColorStateList getBorderColors() { + return mBorderColor; + } + + public void setBorderColor(ColorStateList colors) { + if (mBorderColor.equals(colors)) { + return; + } + + mBorderColor = + (colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR); + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + if (mBorderWidth > 0) { + invalidate(); + } + } + + public boolean isOval() { + return mIsOval; + } + + public void setOval(boolean oval) { + mIsOval = oval; + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } + + public Shader.TileMode getTileModeX() { + return mTileModeX; + } + + public void setTileModeX(Shader.TileMode tileModeX) { + if (this.mTileModeX == tileModeX) { + return; + } + + this.mTileModeX = tileModeX; + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } + + public Shader.TileMode getTileModeY() { + return mTileModeY; + } + + public void setTileModeY(Shader.TileMode tileModeY) { + if (this.mTileModeY == tileModeY) { + return; + } + + this.mTileModeY = tileModeY; + updateDrawableAttrs(); + updateBackgroundDrawableAttrs(false); + invalidate(); + } + + public boolean mutatesBackground() { + return mMutateBackground; + } + + public void mutateBackground(boolean mutate) { + if (mMutateBackground == mutate) { + return; + } + + mMutateBackground = mutate; + updateBackgroundDrawableAttrs(true); + invalidate(); + } } 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 index b6565e7570..07d86714ea 100644 --- 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 @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.notice.viewmodel import android.content.Context import android.text.TextUtils -import android.util.Log import com.mogo.commons.voice.AIAssist import com.mogo.commons.voice.IMogoVoiceCmdCallBack import com.mogo.eagle.core.function.notice.Config @@ -117,7 +116,6 @@ class PushViewModel( return } field?.showTimeoutShadow = field?.showTimeout?:0 - Log.d("yilz", "pushbean = $value") if (value.imageUrl.isBlank()) { value.imageUrl = "" } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt index 0f7d8cfd77..6fb5911cc7 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt @@ -5,8 +5,9 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.eagle.core.utilcode.util.LogUtils /** * @author xiaoyuzhou @@ -27,7 +28,7 @@ class MoGoObuProvider : IMoGoObuProvider { override fun init(context: Context) { - LogUtils.dTag(TAG, "初始化蘑菇自研OBU……") + CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU……") mContext = context val ipAddress = SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199") 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 e58af90fe5..0094b65af8 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 @@ -4,12 +4,13 @@ import android.content.Context import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU 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.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.module.common.datacenter.SnapshotLocationDataCenter import com.mogo.module.common.drawer.TrafficMarkerDrawer @@ -42,9 +43,9 @@ class MogoPrivateObuManager private constructor() { private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo() fun init(context: Context, ipAddress: String) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "obuManager初始化--") mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS) - .navigation(context) as IMogoServiceApis + .navigation(context) as IMogoServiceApis mContext = context mIMogoMapService = mMogoServiceApis!!.mapServiceApi @@ -73,7 +74,7 @@ class MogoPrivateObuManager private constructor() { private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() { // OBU连接成功 override fun onConnected() { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnected ------> ") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnected ------> ") mObuStatusInfo.obuStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } @@ -81,7 +82,7 @@ class MogoPrivateObuManager private constructor() { // OBU连接失败 override fun onConnectFail(isNeedReconnect: Boolean) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnectFail ------> ") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnectFail ------> ") mObuStatusInfo.obuStatus = false mObuStatusInfo.obuHvStatus = false mObuStatusInfo.obuRvStatus = false @@ -93,7 +94,7 @@ class MogoPrivateObuManager private constructor() { // OBU断开连接 override fun onDisconnect() { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onDisconnect ------> ") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onDisconnect ------> ") mObuStatusInfo.obuStatus = false mObuStatusInfo.obuHvStatus = false mObuStatusInfo.obuRvStatus = false @@ -106,20 +107,20 @@ class MogoPrivateObuManager private constructor() { // 接收到的原始数据 override fun onReceiveOriginData(data: String) { super.onReceiveOriginData(data) - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onReceiveOriginData ------> data = $data") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onReceiveOriginData ------> data = $data") } // 发送的数据 override fun onSendData(bytes: ByteArray) { super.onSendData(bytes) - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onSendData ------> ") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onSendData ------> ") } // CV2X系统信息 override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) { super.onCvxAppInitIndInfo(info) - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxAppInitIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxAppInitIndInfo ------> $info") if (info != null) { if (!info.stack_info.isNullOrEmpty()) { mObuStatusInfo.stackInfo = info.stack_info @@ -141,7 +142,7 @@ class MogoPrivateObuManager private constructor() { mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", true) } mObuStatusInfo.obuHvStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvInfoIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxHvInfoIndInfo ------> $info") if (info != null && info.basic_info != null && info.basic_info.position != null) { val movingObjectInfo = info.basic_info val position = movingObjectInfo.position @@ -191,7 +192,7 @@ class MogoPrivateObuManager private constructor() { // (3) 远车信息:CVX_RV_INFO_IND override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRvInfoIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRvInfoIndInfo ------> $info") mObuStatusInfo.obuRvStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) } @@ -203,7 +204,7 @@ class MogoPrivateObuManager private constructor() { // (3) 道路事件预警信息:CVX_RTI_THREAT_IND override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRtiThreatIndInfo ------> $info") if (info != null && info.threat_info != null && info.ext_info != null) { var alertContent = "" @@ -212,11 +213,14 @@ class MogoPrivateObuManager private constructor() { val status = info.status val level = info.threat_info.threat_level val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1) - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}") - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} " + getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1) + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}" + ) + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} " ) when (appId) { // 道路危险情况预警 @@ -232,13 +236,13 @@ class MogoPrivateObuManager private constructor() { WarningDirectionEnum.ALERT_WARNING_TOP_LEFT, WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> { appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType + EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType } WarningDirectionEnum.ALERT_WARNING_RIGHT, WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT, WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> { appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType + EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType } } } @@ -253,7 +257,7 @@ class MogoPrivateObuManager private constructor() { //事故 0xC -> { appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType + EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType } //拥堵 0xD -> { @@ -262,7 +266,7 @@ class MogoPrivateObuManager private constructor() { //行人 0xF -> { appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType + EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType } //禁止停车 0x13 -> { @@ -271,7 +275,7 @@ class MogoPrivateObuManager private constructor() { //学校 0x14 -> { appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType + EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType } //桥梁 0x17 -> { @@ -284,7 +288,7 @@ class MogoPrivateObuManager private constructor() { //人行横道 0x19 -> { appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType + EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType } //减速慢行 0x1A -> { @@ -314,18 +318,24 @@ class MogoPrivateObuManager private constructor() { EventTypeEnum.TYPE_USECASE_ID_TJW.poiType -> { ttsContent = EventTypeEnum.getWarningTts(appId) if (info.threat_info != null) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} ") + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} " + ) if (info.threat_info.distance.toInt() != 0) { alertContent = String.format( - EventTypeEnum.getWarningContent(appId), - info.threat_info.distance.toInt() + EventTypeEnum.getWarningContent(appId), + info.threat_info.distance.toInt() ) } else { alertContent = "前方拥堵,减速慢行" } } - Logger.d(MogoObuConst.TAG_MOGO_OBU, "ttsContent = $ttsContent --alertContent = $alertContent") + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "ttsContent = $ttsContent --alertContent = $alertContent" + ) } } @@ -338,14 +348,19 @@ class MogoPrivateObuManager private constructor() { // CallerHmiManager.showWarning(direction) //显示弹框,语音提示 - CallerHmiManager.showWarningV2X(appId.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + CallerHmiManager.showWarningV2X(appId.toInt(), + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 object : IMoGoWarningStatusListener { override fun onDismiss() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) } - }, true, 5000L) + }, + true, + 5000L + ) // 更新数据 TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it) @@ -371,29 +386,29 @@ class MogoPrivateObuManager private constructor() { // (4) V2I预警信息:CVX_IVP_THREAT_IND,红绿灯 override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "CvxIvpThreatIndInfo ------> $info") if (info != null && info.ext_info != null - && info.threat_info != null - && info.ext_info.lights != null - && info.ext_info.lights.isNotEmpty() + && info.threat_info != null + && info.ext_info.lights != null + && info.ext_info.lights.isNotEmpty() ) { handlerTrafficLight( - info.threat_info.app_id, - info.status, - info.ext_info.lights, - info.ext_info.index + info.threat_info.app_id, + info.status, + info.ext_info.lights, + info.ext_info.index ) } } // (2) 弱势交通参与者预警信息:CVX_PTC_THREAT_IND override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxPtcInfoIndInfo ------> $info") // 交通参与者类型 0x0:未知 UNKNOWN | 0x1:非机动车 NON_MOTOR | 0x2:行人 PEDESTRIAN 0x3:RSU if (info != null && (info.ptc_type == 1 || info.ptc_type == 2)) { - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "onCvxPtcInfoIndInfo ---status---> ${info.status}" + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "onCvxPtcInfoIndInfo ---status---> ${info.status}" ) var v2xType = "" if (info.ptc_type == 1) { //摩托车 @@ -404,7 +419,7 @@ class MogoPrivateObuManager private constructor() { val ttsContent = EventTypeEnum.getWarningTts(v2xType) val alertContent = EventTypeEnum.getWarningContent(v2xType) val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) + getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) val level = if (info.threat_info != null) info.threat_info.threat_level else -1 when (info.status) { @@ -415,14 +430,19 @@ class MogoPrivateObuManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerHmiManager.showWarningV2X(v2xType.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + CallerHmiManager.showWarningV2X(v2xType.toInt(), + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 (v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 object : IMoGoWarningStatusListener { override fun onDismiss() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) } - }, true, 5000L) + }, + true, + 5000L + ) // } // 更新数据 TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let { @@ -450,7 +470,7 @@ class MogoPrivateObuManager private constructor() { // (5) 限速预警信息:CVX_SLW_THREAT_IND override fun onCvxSlwThreatIndInfo(info: CvxSlwThreatIndInfo?) { //todo 限速走高精地图 屏蔽OBU限速\ -// Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxSlwThreatIndInfo ------> $info") +// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxSlwThreatIndInfo ------> $info") // if (info != null) { // when (info.status) { // // 添加 @@ -459,8 +479,8 @@ class MogoPrivateObuManager private constructor() { // -> { // if (info.ext_info != null) { // // 计算为千米每小时 TODO 这里需要做一下向上取整数,40,60,80,120等 -// Logger.d( -// MogoObuConst.TAG_MOGO_OBU, +// CallerLogger.d( +// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", // "info.ext_info.speed_limit_max ------> ${info.ext_info.speed_limit_max}" // ) // CallerHmiManager.showLimitingVelocity((Math.round(((info.ext_info.speed_limit_max * 60 * 60) / 1000) / 10) * 10).toInt()) @@ -477,7 +497,7 @@ class MogoPrivateObuManager private constructor() { // (1) V2V预警信息:CVX_V2V_THREAT_IND override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxV2vThreatIndInfo ------> $info") info?.let { //预警信息,预警类型 threat_level 2、3 info.threat_info?.let { @@ -487,11 +507,11 @@ class MogoPrivateObuManager private constructor() { val appId = info.threat_info.app_id val level = info.threat_info.threat_level val status = info.status - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "onCvxV2vThreatIndInfo target_classification = ${ - getMessageDirection(info.ext_info.target_classification) - } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "onCvxV2vThreatIndInfo target_classification = ${ + getMessageDirection(info.ext_info.target_classification) + } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" ) handleSdkObu(appId, direction, status, level, info) } @@ -510,7 +530,7 @@ class MogoPrivateObuManager private constructor() { * 获取消息的方位 车辆相关 */ private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { - Logger.d(MogoObuConst.TAG_MOGO_OBU, "预警红边:预警方向->$targetClassification") + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") return when (targetClassification) { ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE, ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE, @@ -554,9 +574,9 @@ class MogoPrivateObuManager private constructor() { * 处理红绿灯 */ private fun handlerTrafficLight(appId: Int, status: Int, lights: List, index: Int) { - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights " + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights " ) when (status) { // 添加 @@ -582,18 +602,18 @@ class MogoPrivateObuManager private constructor() { */ @Synchronized private fun changeTrafficLightStatus( - appId: Int, - lights: List, - index: Int + appId: Int, + lights: List, + index: Int ) { var ttsContent = "" var alertContent = "" //这里需要根据真实数据确定 index 取值方式 if (index != -1 && lights.size >= index) { val currentLight = lights[index] - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId" + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId" ) // 闯红灯预警 when (currentLight.rlvw_violation_type) { @@ -605,8 +625,10 @@ class MogoPrivateObuManager private constructor() { 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) - CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L) + CallerHmiManager.showWarningV2X( + appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), null, true, 5000L + ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT } @@ -646,32 +668,39 @@ class MogoPrivateObuManager private constructor() { CallerHmiManager.changeCountdownRed(0) CallerHmiManager.changeCountdownYellow(0) // 拼接建议速度 - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}" + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}" ) val adviceSpeed = - "${currentLight.glosa_suggested_speed_min.toInt()} - ${currentLight.glosa_suggested_speed_max.toInt()}" + "${currentLight.glosa_suggested_speed_min.toInt()} - ${currentLight.glosa_suggested_speed_max.toInt()}" val adviceSpeedTts = - "${currentLight.glosa_suggested_speed_min.toInt()}到${currentLight.glosa_suggested_speed_max.toInt()}" + "${currentLight.glosa_suggested_speed_min.toInt()}到${currentLight.glosa_suggested_speed_max.toInt()}" ttsContent = - String.format( - EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeedTts - ) + String.format( + EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeedTts + ) alertContent = - String.format( - EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeed - ) + String.format( + EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeed + ) val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() if (maxSpeed > 0) { - CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L) + CallerHmiManager.showWarningV2X( + EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(), + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), + null, + true, + 5000L + ) } } // 黄灯 @@ -697,16 +726,16 @@ class MogoPrivateObuManager private constructor() { * @see com.mogo.module.common.enums.EventTypeEnum */ private fun handleSdkObu( - appId: Int, - direction: WarningDirectionEnum, - status: Int, - level: Int, - info: CvxV2vThreatIndInfo + appId: Int, + direction: WarningDirectionEnum, + status: Int, + level: Int, + info: CvxV2vThreatIndInfo ) { // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnum 提供的 - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" ) var alertContent: String var ttsContent: String @@ -716,16 +745,16 @@ class MogoPrivateObuManager private constructor() { alertContent = EventTypeEnum.getWarningContent(appId.toString()) ttsContent = EventTypeEnum.getWarningTts(appId.toString()) if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT ) { ttsContent = String.format(ttsContent, "左") alertContent = String.format(alertContent, "左") } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT ) { ttsContent = String.format(ttsContent, "右") alertContent = String.format(alertContent, "右") @@ -760,16 +789,16 @@ class MogoPrivateObuManager private constructor() { ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT ) { //左后 ttsContent = String.format(ttsContent, "左") alertContent = String.format(alertContent, "左") } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT ) { //右后 ttsContent = String.format(ttsContent, "右") alertContent = String.format(alertContent, "右") @@ -787,20 +816,25 @@ class MogoPrivateObuManager private constructor() { // 添加,更新 add的时候,可能级别是2, ObuConstants.STATUS.ADD, ObuConstants.STATUS.UPDATE -> { - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (level == 2 || level == 3) { //显示弹框,语音提示 - CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + CallerHmiManager.showWarningV2X(appId, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 object : IMoGoWarningStatusListener { override fun onDismiss() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) } - }, true, 5000L) + }, + true, + 5000L + ) //显示警告红边 CallerHmiManager.showWarning(direction) } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuRsuTestTriggerReceiver.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuRsuTestTriggerReceiver.kt index ea7df77545..aae4b90480 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuRsuTestTriggerReceiver.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuRsuTestTriggerReceiver.kt @@ -3,9 +3,10 @@ package com.mogo.eagle.core.function.obu.mogo.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.mogo.eagle.core.utilcode.util.LogUtils import com.mogo.eagle.core.function.obu.mogo.MogoObuConst import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.zhidao.support.obu.constants.ObuConstants import com.zhidao.support.obu.model.CvxIvpThreatIndInfo import com.zhidao.support.obu.model.CvxPtcThreatIndInfo @@ -13,7 +14,6 @@ import com.zhidao.support.obu.model.CvxRtiThreatIndInfo import com.zhidao.support.obu.model.CvxSlwThreatIndInfo import com.zhidao.support.obu.model.advance.* - /** * @author lixiaopeng * @date 2021/8/18 @@ -38,8 +38,8 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() { val pctType = intent.getIntExtra(MogoObuConst.BROADCAST_PTC_INFO_EXTRA_KEY, 0) val rtiType = intent.getIntExtra(MogoObuConst.BROADCAST_RTI_TYPE_EXTRA_KEY, 0) - LogUtils.dTag( - TAG, "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel" + CallerLogger.d( + "$M_OBU$TAG", "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel" ) when (obuType) { diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerReceiver.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerReceiver.kt index 921b04fec9..e7c0b2b3ef 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerReceiver.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerReceiver.kt @@ -3,9 +3,10 @@ package com.mogo.eagle.core.function.obu.mogo.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.mogo.eagle.core.utilcode.util.LogUtils import com.mogo.eagle.core.function.obu.mogo.MogoObuConst import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.zhidao.support.obu.constants.ObuConstants import com.zhidao.support.obu.model.CvxV2vThreatIndInfo import com.zhidao.support.obu.model.advance.MovingObjectInfo @@ -38,8 +39,8 @@ class ObuTestTriggerReceiver : BroadcastReceiver() { val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3) val obuDirection = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_EVENT_DIRECTION_EXTRA_KEY, 0x11) - LogUtils.dTag( - TAG, "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection" + CallerLogger.d( + "$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection" ) when (obuType) { diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerRecognizedReceiver.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerRecognizedReceiver.kt index b13b84b54d..6b5a29516c 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerRecognizedReceiver.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestTriggerRecognizedReceiver.kt @@ -3,9 +3,10 @@ package com.mogo.eagle.core.function.obu.mogo.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.mogo.eagle.core.utilcode.util.LogUtils import com.mogo.eagle.core.function.obu.mogo.MogoObuConst import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.zhidao.support.obu.model.CvxHvInfoIndInfo import com.zhidao.support.obu.model.advance.MovingObjectInfo import com.zhidao.support.obu.model.advance.Position @@ -33,7 +34,7 @@ class ObuTestTriggerRecognizedReceiver : BroadcastReceiver() { val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0) val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0) val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3) - LogUtils.dTag(TAG, "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel") + CallerLogger.d("$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel") val cvxHvInfoIndInfo = CvxHvInfoIndInfo(0, 1, 2) diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt index 24dd349656..8e94bc8bc6 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt @@ -1,8 +1,9 @@ package com.mogo.eagle.core.function.obu.mogo.utils -import com.mogo.eagle.core.utilcode.util.LogUtils import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.data.enums.TrafficTypeEnum +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.zhidao.support.obu.constants.ObuConstants import com.zhidao.support.obu.model.CvxPtcThreatIndInfo import com.zhidao.support.obu.model.CvxRtiThreatIndInfo @@ -21,7 +22,7 @@ object TrafficDataConvertUtils { */ fun cvxRvInfoIndInfo2TrafficData(info: CvxRvInfoIndInfo): TrafficData? { if (info.basic_info == null || info.basic_info.position == null) { - LogUtils.eTag(TAG, "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全") + CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全") return null } val trafficData = TrafficData() @@ -48,7 +49,7 @@ object TrafficDataConvertUtils { || info.zones_info.first().path_points.first() == null || info.threat_info == null ) { - LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全") + CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") return null } val trafficData = TrafficData() @@ -68,7 +69,7 @@ object TrafficDataConvertUtils { */ fun cvxV2vThreatIndInfo2TrafficData(info: CvxV2vThreatIndInfo): TrafficData? { if (info.basic_info == null || info.basic_info.position == null || info.threat_info == null) { - LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全") + CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") return null } val trafficData = TrafficData() @@ -94,7 +95,7 @@ object TrafficDataConvertUtils { */ fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? { if (info.ptc_pos == null || info.threat_info == null) { - LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全") + CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") return null } val trafficData = TrafficData() 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 b17c1d4dd2..ef208ac848 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 @@ -6,12 +6,12 @@ import android.content.IntentFilter import android.os.Handler import android.os.Looper import android.provider.Settings.System -import android.util.Log import androidx.localbroadcastmanager.content.LocalBroadcastManager import com.mogo.cloud.passport.IMoGoTokenCallback import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.network.ParamsUtil +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.data.map.MogoLocation @@ -19,6 +19,7 @@ import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener 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.v2x.events.alarm.V2XAlarmServer import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi @@ -56,7 +57,6 @@ import com.mogo.service.statusmanager.StatusDescriptor import com.mogo.service.statusmanager.StatusDescriptor.ACC_STATUS import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING import com.mogo.service.statusmanager.StatusDescriptor.TOP_CONTAINER_READY -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.v2x.V2XManager import com.mogo.v2x.callback.IV2XCallback @@ -176,12 +176,11 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb */ private fun isAccOn(): Boolean { val accState = System.getInt(context().contentResolver, "mcu_state", -0x02) - //Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState); + //CallerLogger.d("$M_V2X$TAG", "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState); return accState == 1 } private fun handleRoadConditionMarkerClick(marker: IMogoMarker?) { - Log.d(TAG, "onMarkerClicked2222") //点击的marker的具体数据 //点击的marker的具体数据 val exploreWay = extractFromMarker(marker) exploreWay?.let { @@ -238,7 +237,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) { - Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:$descriptor\nisTrue:$isTrue") // 记录状态更改 + CallerLogger.d("$M_V2X$TAG", "状态发生改变\ndescriptor:$descriptor\nisTrue:$isTrue") // 记录状态更改 // 记录状态更改 SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_$descriptor", isTrue) if (descriptor == ACC_STATUS) { @@ -280,13 +279,13 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb * 刷新自车求助状态 */ private fun initCarForHelpStatus() { - Logger.d(MODULE_NAME, "刷新自车求助状态……") //本地查询是否超时 + CallerLogger.d("$M_V2X$TAG", "刷新自车求助状态……") //本地查询是否超时 BridgeApi.refreshModel().getHelpSignal(object : V2XRefreshCallback { override fun onSuccess(result: V2XSeekHelpRes?) { if (result != null) { val resultBean = result.result if (resultBean != null) { - Logger.d(MODULE_NAME, "刷新自车求助状态 resultBean:$resultBean") + CallerLogger.d("$M_V2X$TAG", "刷新自车求助状态 resultBean:$resultBean") val vehicleType: Int = resultBean.vehicleType //故障车 if (vehicleType == 4) { refreshMeSeekHelp(true) @@ -304,9 +303,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } private fun refreshStrategyConfig() { - Logger.w(MODULE_NAME, "刷新V2X中的配置文件") + CallerLogger.w("$M_V2X$TAG", "刷新V2X中的配置文件") BridgeApi.refreshModel().getStrategyPush(object : V2XRefreshCallback { - override fun onSuccess(result: V2XStrategyPushRes?) { //Logger.w(MODULE_NAME, "V2X疲劳驾驶配置数据更新:" + GsonUtil.jsonFromObject(result)); + override fun onSuccess(result: V2XStrategyPushRes?) { //CallerLogger.w("$M_V2X$TAG", "V2X疲劳驾驶配置数据更新:" + GsonUtil.jsonFromObject(result)); val resultBean = result?.result if (resultBean != null) { // 更新本地的v2x提醒策略 SharedPrefsMgr.getInstance(Utils.getApp()).putString(V2X_STRATEGY_PUSH, GsonUtil.jsonFromObject(resultBean)) @@ -341,9 +340,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb pointsOdl[0] = MogoLatLng(location.latitude, location.longitude) v2xPolyline.points = pointsOdl - //Logger.d(V2XConst.MODULE_NAME, "当前地图的缩放比例为:" + zoomLevel); + //CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel); val zoomLevel: Float = BridgeApi.mapUiController()?.zoomLevel ?: 0.0f - //Logger.d(V2XConst.MODULE_NAME, "当前地图的缩放比例为:" + zoomLevel); + //CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel); if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图 val context: Context = context() MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context) @@ -354,7 +353,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb // // 只有自研车机才有疲劳驾驶检测 // if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) { // V2XAlarmServer.getFatigueDrivingShow(location) { drivingShowEntity -> -// Logger.i(V2XConst.MODULE_NAME, "疲劳驾驶POI查询结果为: " + GsonUtil.jsonFromObject(drivingShowEntity)) +// CallerLogger.i("$M_V2X$TAG", "疲劳驾驶POI查询结果为: " + GsonUtil.jsonFromObject(drivingShowEntity)) // val style = if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) "1" else "2" // com.mogo.module.v2x.listener.V2XLocationListener.trackWithType(ALERT_FATIGUE_DRIVING.poiType, drivingShowEntity.getLon(), drivingShowEntity.getLat(), style) // val v2XMessageEntity = V2XMessageEntity() @@ -370,12 +369,12 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb // 巡航处理 val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(BridgeApi.v2xMarker()?.v2XRoadEventEntityList, V2XStatusManager.getInstance().location) // 距离是否大于10米 && 消息是否不为空 // 距离是否大于10米 && 消息是否不为空 - if (v2XRoadEventEntity != null && v2XRoadEventEntity.distance >= 5) { // Logger.w(MODULE_NAME, + if (v2XRoadEventEntity != null && v2XRoadEventEntity.distance >= 5) { // CallerLogger.w("$M_V2X$TAG", // //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() + // //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount + // "\nV2X预警--当前预警事件:" + v2XRoadEventEntity // ); - // Logger.w(MODULE_NAME, "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance()); + // CallerLogger.w("$M_V2X$TAG", "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance()); // 触发展示操作 TrackUtils.trackV2xRoadProduceEvent(1) val v2XMessageEntity = V2XMessageEntity() @@ -401,7 +400,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode()) } catch (e: Exception) { e.printStackTrace() - Logger.e(TAG, e.message) + CallerLogger.e("$M_V2X$TAG", "$e") } } } @@ -416,12 +415,12 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb if (historyPath[1] != null && historyPath[0] != null) { val carAngle: Double = DrivingDirectionUtils.getCarAngle(historyPath[1]!!.latitude, historyPath[1]!!.longitude, historyPath[0]!!.latitude, historyPath[0]!!.longitude).toDouble() - //Logger.d(MODULE_NAME, + //CallerLogger.d("$M_V2X$TAG", // "\n车辆经纬度:" + Arrays.toString(historyPath) + // "\n车辆角度:" + carAngle); // 这里是真实的车辆角度 location.bearing = carAngle.toFloat() - } else { //Logger.e(MODULE_NAME, + } else { //CallerLogger.e("$M_V2X$TAG", // "\n首次获取经纬度,默认车头朝北:" + Arrays.toString(historyPath)); location.bearing = 0.0f } @@ -438,7 +437,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb * V2XEvent事件回调 */ override fun onAck(event: V2XEvent) { - Logger.d(TAG, "OK->:$event") + CallerLogger.d("$M_V2X$TAG", "OK->:$event") when (event) { is V2XEvent.ForwardsWarning -> { handleAdvanceWarningEvent(event) @@ -587,7 +586,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } override fun onFail(msg: String) { - Logger.e(TAG, "Error: $msg") + CallerLogger.e("$M_V2X$TAG", "Error: $msg") } override fun onError(code: Int, msg: String?) {} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java index f59972dee1..5a44566453 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java @@ -70,7 +70,7 @@ public class V2XAlarmServer { String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity); if (!TextUtils.isEmpty(lastTime)) { long timeSpan = Math.abs(TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN)); -// Logger.w(MODULE_NAME, +// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", // "V2X预警--事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + // "\n上一次预警时间:" + lastTime + // "\n距离当前时间:" + timeSpan); @@ -81,7 +81,7 @@ public class V2XAlarmServer { } // 进行提醒 if (!isAlreadyAlert) { -// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" + +// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆与事件信息:" + // "\n事件详情ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + // "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) + // "\n距离:" + v2XRoadEventEntity.getDistance() + "米" + @@ -99,7 +99,7 @@ public class V2XAlarmServer { } return null; } else { -// Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" + +// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--事件与车头角度夹角过大:" + // "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + // "\n当前车辆-经度:" + currentLocation.getLongitude() + // "\n当前车辆-经度:" + currentLocation.getLatitude() + @@ -111,7 +111,7 @@ public class V2XAlarmServer { // ); } } else { -// Logger.w(MODULE_NAME, +// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", // "V2X预警--车头方向与事件方向角度不一致:" + // "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + // "\n车头方向: " + carBearing + @@ -120,13 +120,13 @@ public class V2XAlarmServer { // ); } } else { -// Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了:" + +// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆距离事件距离大于500米了:" + // "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + // "\n距离:" + v2XRoadEventEntity.getDistance() + "米" // ); } } else { -// Logger.e(MODULE_NAME, +// CallerLogger.INSTANCE.e(M_V2X + "V2XAlarmServer", // "V2X预警--道路事件没有角度信息" + // "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() // ); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XEarlyWarningServer.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XEarlyWarningServer.java index 19bfe4d260..1489463295 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XEarlyWarningServer.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XEarlyWarningServer.java @@ -52,7 +52,7 @@ public class V2XEarlyWarningServer { // 封路、施工、拥堵、拥堵 才会有UGC提示 if (EventTypeEnum.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) { -// Logger.w(MODULE_NAME, +// CallerLogger.INSTANCE.d(M_V2X + TAG, // "V2X预警--UGC检测:" + // "\n事件详情:" + roadInfoId + // "\n事件详情:" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) + @@ -64,7 +64,7 @@ public class V2XEarlyWarningServer { if (!alertMessageId.contains(roadInfoId)) { // 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了 if (80 <= eventAngle) { -// Logger.w(MODULE_NAME + "_" + TAG, "V2X预警UGC--事件与车头角度夹角过大:" + +// CallerLogger.INSTANCE.d(M_V2X + TAG, "V2X预警UGC--事件与车头角度夹角过大:" + // "\n角度:" + eventAngle + " 度" + // "\n事件详情:" + roadInfoId + // "\n库存事件:" + V2XAlarmServer.mAlertRoadEventList.size() diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusManager.java index 3a959583f9..5faeb0b104 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusManager.java @@ -52,7 +52,6 @@ public class V2XStatusManager { if (mLocation == null) { mLocation = new MogoLocation(); } - //Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString()); return mLocation; } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoPersonWarnPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoPersonWarnPolylineManager.java index c986a1e3bf..a3777a8b5a 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoPersonWarnPolylineManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoPersonWarnPolylineManager.java @@ -1,10 +1,12 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.content.Context; -import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; 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; @@ -45,7 +47,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan colors.add(0x0DE32F46); // 线条粗细,渐变,渐变色值 - Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); + CallerLogger.INSTANCE.d(M_V2X + V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); options.width(info.getWidth()).useGradient(true).colorValues(colors); List locations = info.getLocations(); for (int i = 0; i < locations.size(); i++) { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoStopPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoStopPolylineManager.java index 9a45f4ffdf..24eab422f9 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoStopPolylineManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoStopPolylineManager.java @@ -1,10 +1,12 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.content.Context; -import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; 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; @@ -23,7 +25,6 @@ import java.util.List; public class MoGoStopPolylineManager implements IMoGoStopPolylineManager { private static IMogoPolyline mMogoPolyline; - @Override public void drawStopPolyline(Context context, DrawLineInfo info) { if (info == null) { @@ -43,7 +44,7 @@ public class MoGoStopPolylineManager implements IMoGoStopPolylineManager { colors.add(0xD9E32F46); colors.add(0x0DE32F46); - Log.d(V2XConst.LOG_NAME_WARN, "MoGoStopPolylineManager roadWidth = " + info.getWidth()); + CallerLogger.INSTANCE.d(M_V2X + V2XConst.LOG_NAME_WARN, "MoGoStopPolylineManager roadWidth = " + info.getWidth()); // 线条粗细,渐变,渐变色值 // 当前车辆位置 options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors); 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 4937169eab..f77a17417a 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 @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl; -import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_EVENT_ALARM_POI; import android.content.Context; @@ -9,6 +9,7 @@ import android.graphics.Bitmap; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; 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; @@ -19,7 +20,6 @@ import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; 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.Logger; import com.mogo.eagle.core.utilcode.util.ViewUtils; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; @@ -60,14 +60,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { private static final String TAG = "MoGoV2XMarkerManager"; // 记录所有的:新鲜事儿的道路事件点、探路事件 - private static CopyOnWriteArraySet mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>(); + private static final CopyOnWriteArraySet mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>(); // 上次的道路事件的预警Marker private static IMogoMarker mAlarmInfoMarker; private static IMogoMarker m3DMarker; @Override public void drawableLastAllPOI() { - //Logger.w(MODULE_NAME, "V2X---绘制上一次的POI,回调给Launcher底层逻辑让其进行绘制"); // 清除连接线 IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline(); if (polylineManager != null) { @@ -114,9 +113,8 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { } } //输出日志查看结果 -// Log.w(TAG, "V2X==============================="); // for (int i = 0; i < roadEventEntities.size(); i++) { -// Log.w(TAG, "V2X===" + +// CallerLogger.INSTANCE.w(M_V2X + TAG, "V2X===" + // "事件名称:" + roadEventEntities.get(i).getNoveltyInfo() + // "\t 事件距离:" + roadEventEntities.get(i).getDistance()); // } @@ -241,7 +239,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { if (v2xStatus != null) { v2xStatus.setRoadEventPOIShow(TAG, true); } - //Logger.i(MODULE_NAME, "绘制道路事件====drawableAlarmPOI:"); // 清除原来的大而全的新鲜事儿 clearALLPOI(); if (roadEventEntity.getLocation() != null) { @@ -296,7 +293,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { roadEventEntity.getLocation().getLon() ), context); } else { - Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!"); + CallerLogger.INSTANCE.e(M_V2X + TAG, "Location 必须进行初始化!!!!!"); } } 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/manager/impl/MoGoWarnPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoWarnPolylineManager.java index 60c289d85c..14a46f253f 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoWarnPolylineManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoWarnPolylineManager.java @@ -1,10 +1,12 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.content.Context; -import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; 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.entity.model.DrawLineInfo; @@ -12,6 +14,7 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager; import com.mogo.map.overlay.IMogoOverlayManager; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.map.overlay.MogoPolylineOptions; + import java.util.ArrayList; import java.util.List; @@ -21,7 +24,7 @@ import java.util.List; @Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER) public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { private static IMogoPolyline mMogoPolyline; - + private static final String TAG = "V2XWarningMarker"; @Override public void drawWarnPolyline(Context context, DrawLineInfo info) { @@ -39,7 +42,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { .setGps(true); List colors = new ArrayList<>(); - if (info.isHasStopLines() == true) { + if (info.isHasStopLines()) { colors.add(0x0D3036FF); colors.add(0xD93036FF); colors.add(0x0D3036FF); @@ -49,7 +52,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { colors.add(0x0DE32F46); } - Log.d("V2XWarningMarker", "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); + CallerLogger.INSTANCE.d(M_V2X + TAG, "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); // 线条粗细,渐变,渐变色值 options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors); List locations = info.getLocations(); @@ -76,7 +79,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { mMogoPolyline.remove(); mMogoPolyline = null; } else { - Log.d("V2XWarningMarker", "mMogoPolyline==null"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "mMogoPolyline==null"); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt index 5c257f0872..02cbd0cee3 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt @@ -46,7 +46,6 @@ class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) : * @see EventTypeEnum */ private fun updateIcon(alarmInfo: V2XRoadEventEntity) { - //Logger.d(MODULE_NAME, alarmInfo.toString()) // 道路施工、积水、路面结冰、浓雾、事故、拥堵 val iconResId = EventTypeEnum.getUpdateIconRes(alarmInfo.poiType) if (iconResId != 0) { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshModel.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshModel.java index 681142f9cb..bfe7be0a7c 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshModel.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshModel.java @@ -5,14 +5,12 @@ import android.text.TextUtils; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.commons.network.ParamsProvider; import com.mogo.eagle.core.data.BaseData; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XLiveCarRes; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSeekHelpRes; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XStrategyPushRes; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XUserInfoRes; import com.mogo.eagle.core.network.RequestOptions; import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import java.util.Map; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -57,7 +55,6 @@ public class V2XRefreshModel { * @param callback 回调 */ public void giveLikeLiveVideo(final V2XRefreshCallback callback, String snStr) { - Logger.d(V2XConst.MODULE_NAME, "点赞车机:" + snStr); final Map query = new ParamsProvider.Builder(mContext).build(); query.put("data", "{\"sn\":" + snStr + "}"); V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).giveLikeLiveVideo(query) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java index 0f1b290d48..ddfaf59c45 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java @@ -14,7 +14,6 @@ import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes; import com.mogo.eagle.core.function.v2x.events.utils.TestOnLineCarUtils; import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.V2XMessageEntity; @@ -38,7 +37,6 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver { try { this.mContext = context; int sceneType = intent.getIntExtra(V2XConst.BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0); - Logger.d(TAG, "textPanelOpenType:" + sceneType); // 分发场景 dispatchSceneTest(sceneType); @@ -54,7 +52,6 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver { * @param sceneType 场景类型 */ private void dispatchSceneTest(int sceneType) { - Logger.d(TAG, "sceneType=" + sceneType); if (sceneType == 0) {//打开用户信息 CallerChatManager.INSTANCE.call(Utils.getApp(), "X20202111230C01"); } else if (sceneType == 1) {// 触发道路事件 diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java index 2e0b285fb9..f13fae8a64 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java @@ -1,19 +1,10 @@ package com.mogo.eagle.core.function.v2x.events.scenario.impl; -import android.text.TextUtils; import androidx.annotation.Nullable; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.commons.voice.IMogoVoiceCmdCallBack; -import com.mogo.commons.voice.VoicePreemptType; import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenario; -import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButton; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; -import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; -import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; /** * author : donghongyu diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java index 19893f72e7..d25c08774a 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java @@ -1,18 +1,18 @@ package com.mogo.eagle.core.function.v2x.events.scenario.impl; -import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.content.Intent; + import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import com.mogo.eagle.core.data.enums.WarningDirectionEnum; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; 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.scenario.IV2XScenarioManager; import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadEventScenario; import com.mogo.eagle.core.function.v2x.events.scenario.scene.route.V2XOptimalRouteVREventScenario; import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.Utils; @@ -30,6 +30,7 @@ import com.mogo.service.statusmanager.IMogoStatusManager; */ public class V2XScenarioManager implements IV2XScenarioManager { private static V2XScenarioManager mV2XScenarioManager; + private static final String TAG = "V2XScenarioManager"; private AbsV2XScenario mV2XScenario = null; private V2XScenarioManager() { @@ -49,7 +50,7 @@ public class V2XScenarioManager implements IV2XScenarioManager { @Override public void handlerMessage(V2XMessageEntity v2XMessageEntity) { - Logger.d(MODULE_NAME, "处理V2X场景:" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); + CallerLogger.INSTANCE.d(M_V2X + TAG, "处理V2X场景:" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); try { synchronized (V2XScenarioManager.class) { // 展示 @@ -83,7 +84,7 @@ public class V2XScenarioManager implements IV2XScenarioManager { break; default: mV2XScenario = null; - Logger.e(MODULE_NAME, "当前V2X消息类型未定义。"); + CallerLogger.INSTANCE.e(M_V2X + TAG, "当前V2X消息类型未定义。"); TipToast.tip("当前V2X消息类型未定义"); return; } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/V2XBasWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/V2XBasWindow.java index 9141641c45..7170107f08 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/V2XBasWindow.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/V2XBasWindow.java @@ -1,9 +1,12 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.content.Context; import android.util.AttributeSet; import android.widget.RelativeLayout; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; /** * @author donghongyu @@ -27,13 +30,13 @@ public class V2XBasWindow extends RelativeLayout { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - Logger.w(TAG, "onAttachedToWindow……"); + CallerLogger.INSTANCE.w(M_V2X + TAG, "onAttachedToWindow……"); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - Logger.w(TAG, "onDetachedFromWindow……"); + CallerLogger.INSTANCE.w(M_V2X + TAG, "onDetachedFromWindow……"); release(); } @@ -41,6 +44,6 @@ public class V2XBasWindow extends RelativeLayout { * 这里释放资源 */ protected void release() { - Logger.w(TAG, "release……"); + CallerLogger.INSTANCE.w(M_V2X + TAG, "release……"); } } 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 f4b6700dc7..6ee3249755 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 @@ -1,8 +1,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.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.utilcode.mogo.logger.CallerLogger; 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; @@ -12,7 +15,6 @@ import com.mogo.eagle.core.network.utils.GsonUtil; import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -34,7 +36,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp @Override public void init(V2XMessageEntity v2XMessageEntity) { try { - Logger.d(V2XConst.MODULE_NAME, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); + CallerLogger.INSTANCE.d(M_V2X + TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent(); if (v2XRoadEventEntity != null) { if (v2XMessageEntity.isShowState()) { @@ -115,7 +117,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp @Override public void onShow() { - Logger.d(V2XConst.MODULE_NAME, "弹窗展示"); CallerHmiManager.INSTANCE.showWarning(WarningDirectionEnum.ALERT_WARNING_TOP, TimeUnit.HOURS.toMillis(1)); V2XMessageEntity entity = getV2XMessageEntity(); if (entity != null && entity.isNeedAddLine()) { @@ -125,7 +126,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp @Override public void onDismiss() { - Logger.d(V2XConst.MODULE_NAME, "弹窗消失"); CallerHmiManager.INSTANCE.dismissWarning(WarningDirectionEnum.ALERT_WARNING_TOP); clearPOI(); release(); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventMarker.java index 722e721642..b945baeda5 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventMarker.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventMarker.java @@ -1,13 +1,14 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.route; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; 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.entity.net.V2XOptimalRouteDataRes; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; /** * author : donghongyu @@ -21,7 +22,7 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker v2XMessageEntity) { - Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity)); + CallerLogger.INSTANCE.w(M_V2X + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity)); if (!isSameScenario(v2XMessageEntity)) { setV2XMessageEntity(v2XMessageEntity); show(); } else { setV2XMessageEntity(v2XMessageEntity); show(); - Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "要处理的场景已经存在,丢弃这次初始化"); + CallerLogger.INSTANCE.w(M_V2X + TAG, "要处理的场景已经存在,丢弃这次初始化"); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index 96e66026a8..ffd35821fe 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -1,10 +1,12 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.graphics.Color; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; -import android.util.Log; + import androidx.annotation.Nullable; import com.mogo.eagle.core.data.enums.WarningDirectionEnum; @@ -12,6 +14,7 @@ import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; import com.mogo.module.common.entity.V2XMessageEntity; @@ -26,10 +29,10 @@ import java.util.concurrent.TimeUnit; * @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警 * @since: 2021/3/24 */ -public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapLocationListener, IMoGoWarningStatusListener { +public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapLocationListener, IMoGoWarningStatusListener { private static final String TAG = "V2XWarningMarker"; + private static final V2XWarningMarker sV2XWarningMarker = new V2XWarningMarker(); private V2XWarningEntity mMarkerEntity; - static private V2XWarningMarker sV2XWarningMarker = new V2XWarningMarker(); private WarningDirectionEnum mDirection; @@ -39,7 +42,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL @Override public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - Log.d(TAG, "----- init -----:\n" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); + CallerLogger.INSTANCE.d(M_V2X + TAG, "----- init -----:\n" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); try { setV2XMessageEntity(v2XMessageEntity); if (v2XMessageEntity != null && v2XMessageEntity.getContent() instanceof V2XWarningEntity) { @@ -53,9 +56,9 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL @Override public void show() { - Log.d(TAG, "----- show --- 1 --:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); + CallerLogger.INSTANCE.d(M_V2X + TAG, "----- show --- 1 --:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); if (mMarkerEntity != null) { - Log.d(TAG, "----- show --- 2 --:\n" + mMarkerEntity); + CallerLogger.INSTANCE.d(M_V2X + TAG, "----- show --- 2 --:\n" + mMarkerEntity); int v2xType = getV2XTypeForFrontWarning(mMarkerEntity); V2XMessageEntity entity = getV2XMessageEntity(); if (v2xType != 0) { @@ -93,13 +96,13 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL IV2XMarker marker = getV2XMarker(); if (marker != null && mMarkerEntity != null) { marker.drawPOI(mMarkerEntity); - Log.d(TAG, "drawPOI"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "drawPOI"); } } @Override public void clearPOI() { - Log.d(TAG, "----- clearPOI -----"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "----- clearPOI -----"); } @Override diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java index b7285e9540..2fe734cd8d 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java @@ -1,15 +1,14 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_FRONT_WARNING_MARKER; import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA; import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA; -import android.util.Log; import com.mogo.cloud.commons.utils.CoordinateUtils; -import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineManager; @@ -24,6 +23,7 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.V2XWarnDataDrawer; import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.common.utils.Trigonometric; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -35,10 +35,10 @@ import java.util.List; */ public class V2XWarningMarker implements IV2XMarker { private static final String TAG = "V2XWarningMarker"; - private static String WARNING_ARROWS = "WARNING_ARROWS"; + private static final String WARNING_ARROWS = "WARNING_ARROWS"; private V2XWarningEntity mCloundWarningInfo; private boolean isSelfLineClear = true;//绘制线是否已被清除 - private List fillPoints = new ArrayList();//停止线经纬度合集 + private final List fillPoints = new ArrayList();//停止线经纬度合集 private boolean isFirstLocation = false; private MogoLatLng carLocation = new MogoLatLng( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), @@ -56,12 +56,12 @@ public class V2XWarningMarker implements IV2XMarker { @Override public void drawPOI(Object entity) { try { - Log.d(TAG, "===drawPOI"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "===drawPOI"); mCloundWarningInfo = (V2XWarningEntity) entity; drawLineWithEntity(); } catch (Exception e) { - Log.d(TAG, e.toString()); + CallerLogger.INSTANCE.d(M_V2X + TAG, e.toString()); } } @@ -112,14 +112,14 @@ public class V2XWarningMarker implements IV2XMarker { //衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 //handleStopLine(); }, 0); - Log.d(TAG, "显示时间为++" + String.valueOf(showTime) + "识别物类型:" + + CallerLogger.INSTANCE.d(M_V2X + TAG, "显示时间为++" + showTime + "识别物类型:" + String.valueOf(mCloundWarningInfo.getType())); } else { //无停止线 - Log.d(TAG, "无停止线"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "无停止线"); WorkThreadHandler.getInstance().postDelayed(() -> { /* 衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 - Log.d(TAG, "无停止线" + mCloundWarningInfo.toString()); + CallerLogger.INSTANCE.d(M_V2X + TAG, "无停止线" + mCloundWarningInfo.toString()); //绘制识别物与交汇点连线,并且更新连线数据 drawOtherObjectLine(mCloundWarningInfo); //二轮车和行人的渲染和移动 @@ -127,7 +127,7 @@ public class V2XWarningMarker implements IV2XMarker { if (carLocation.lat != 0 && carLocation.lon != 0) { drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); } else { - Log.d(TAG, "数据为空carLocation == null"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "数据为空carLocation == null"); } */ V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo); @@ -145,7 +145,7 @@ public class V2XWarningMarker implements IV2XMarker { MogoLatLng startLatLng = new MogoLatLng(carLocation.lat, carLocation.lon); MogoLatLng endLatLng = new MogoLatLng(middleLocationInStopLine.lat, middleLocationInStopLine.lon); double angle = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); - Log.d(TAG, "angle==" + String.valueOf(angle)); + CallerLogger.INSTANCE.d(M_V2X + TAG, "angle==" + String.valueOf(angle)); return angle; } @@ -158,14 +158,14 @@ public class V2XWarningMarker implements IV2XMarker { startLatLng, MogoLatLng mogoLatLng) { if (info != null) { double angle = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, mogoLatLng.lon, mogoLatLng.lat); - Log.d(TAG, "angle==drawRedWarningLineFrontOfStopLine:" + String.valueOf(angle)); + CallerLogger.INSTANCE.d(M_V2X + TAG, "angle==drawRedWarningLineFrontOfStopLine:" + String.valueOf(angle)); IMoGoStopPolylineManager stopPolyLineMnager = BridgeApi.INSTANCE.v2xStopPolyline(); if (stopPolyLineMnager != null) { IMogoPolyline polyLine = stopPolyLineMnager.getMogoStopPolyline(); MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon); MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, 25, angle); if (polyLine != null) { - Log.d(TAG, "drawStopLine polyLine != null"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "drawStopLine polyLine != null"); polyLine.setPoints(Arrays.asList(startLatLng, addMiddleLoc, endLatlng)); polyLine.setTransparency(0.5f); } else { @@ -176,11 +176,11 @@ public class V2XWarningMarker implements IV2XMarker { locations.add(endLatlng); lineInfo.setLocations(locations); lineInfo.setHeading(info.heading); - Log.d(TAG, "drawStopLine width = " + info.getRoadwidth()); + CallerLogger.INSTANCE.d(M_V2X + TAG, "drawStopLine width = " + info.getRoadwidth()); lineInfo.setWidth(info.getRoadwidth() * 14 + 5); stopPolyLineMnager.drawStopPolyline(BridgeApi.INSTANCE.context(), lineInfo); } - Log.d(TAG, "停止线前方50m区域的三个坐标点是:" + startLatLng.lon + "," + startLatLng.lat + + CallerLogger.INSTANCE.d(M_V2X + TAG, "停止线前方50m区域的三个坐标点是:" + startLatLng.lon + "," + startLatLng.lat + "中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点" + endLatlng.lon + "," + endLatlng.lat); } @@ -191,7 +191,7 @@ public class V2XWarningMarker implements IV2XMarker { public void clearAllLine() { UiThreadHandler.postDelayed(() -> { - Log.d(TAG, "清除所有预警线的时间是:" + String.valueOf(showTime)); + CallerLogger.INSTANCE.d(M_V2X + TAG, "清除所有预警线的时间是:" + String.valueOf(showTime)); //清除识别物到碰撞点预警线 IMoGoPersonWarnPolylineManager personStopPolyLineManager = BridgeApi.INSTANCE.v2xPersonWarnPolyline(); if (personStopPolyLineManager != null) { @@ -243,10 +243,10 @@ public class V2XWarningMarker implements IV2XMarker { } fillPoints.add(y); } else { - Log.d(TAG, "停止线数据不存在"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "停止线数据不存在"); } } catch (Exception e) { - Log.d(TAG, "Exception"); + CallerLogger.INSTANCE.e(M_V2X + TAG, "exception : " + e); e.printStackTrace(); } } @@ -286,7 +286,7 @@ public class V2XWarningMarker implements IV2XMarker { * */ private MogoLatLng getMiddleLocationInStopLine() { if (carLocation.lat == 0 || carLocation.lon == 0) { - Log.d(TAG, "获取不到车的位置"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "获取不到车的位置"); } MogoLatLng newLocation = new MogoLatLng(0, 0); if (mCloundWarningInfo != null && mCloundWarningInfo.getStopLines() != null && mCloundWarningInfo.getStopLines().size() > 1) { @@ -296,7 +296,7 @@ public class V2XWarningMarker implements IV2XMarker { double angle = Trigonometric.getAngle(x.lon, x.lat, y.lon, y.lat); newLocation = Trigonometric.getNewLocation(x, distance * 0.5, angle); } else { - Log.d(TAG, "停止线返回坐标点数量不正确" + String.valueOf(mCloundWarningInfo.getStopLines().size())); + CallerLogger.INSTANCE.d(M_V2X + TAG, "停止线返回坐标点数量不正确" + mCloundWarningInfo.getStopLines().size()); } return newLocation; } @@ -308,7 +308,7 @@ public class V2XWarningMarker implements IV2XMarker { * lat 自车纬度 */ public void drawSelfCarLine(double lon, double lat, float bearing) { - Log.d(TAG, "drawSelfCarLine"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "drawSelfCarLine"); if (!isSelfLineClear) { if (mCloundWarningInfo != null) { IMoGoWarnPolylineManager warnPolyLineManager = BridgeApi.INSTANCE.v2xWarnPolyline(); @@ -334,7 +334,7 @@ public class V2XWarningMarker implements IV2XMarker { //扩展点为了渐变色添加 addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat)); - Log.d(TAG, "angle==扩展点为了渐变色添加:" + + CallerLogger.INSTANCE.d(M_V2X + TAG, "angle==扩展点为了渐变色添加:" + String.valueOf(Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat))); if (mogoPolyline != null) { mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); @@ -352,9 +352,9 @@ public class V2XWarningMarker implements IV2XMarker { info.setHasStopLines(mCloundWarningInfo.getStopLines().size() > 0); } warnPolyLineManager.drawWarnPolyline(BridgeApi.INSTANCE.context(), info); - Log.d(TAG, "自车前方第一条线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); + CallerLogger.INSTANCE.d(M_V2X + TAG, "自车前方第一条线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); } - Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat + + CallerLogger.INSTANCE.d(M_V2X + TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat + "中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat); } else { clearAllLine(); @@ -367,7 +367,7 @@ public class V2XWarningMarker implements IV2XMarker { */ private void drawOtherObjectLine(V2XWarningEntity info) { if (info != null) { - Log.d(TAG, "info != null"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "info != null"); IMoGoPersonWarnPolylineManager personWarnPolylineManager = BridgeApi.INSTANCE.v2xPersonWarnPolyline(); if (personWarnPolylineManager == null) { return; @@ -379,7 +379,7 @@ public class V2XWarningMarker implements IV2XMarker { MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));//补点 if (polyLine != null) { - Log.d(TAG, "目标物与碰撞点连线 != null"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "目标物与碰撞点连线 != null"); polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); polyLine.setTransparency(0.5f); } else { @@ -394,10 +394,10 @@ public class V2XWarningMarker implements IV2XMarker { lineInfo.setHeading(info.heading); lineInfo.setWidth(info.getRoadwidth() * 14 + 5); personWarnPolylineManager.drawPersonWarnPolyline(BridgeApi.INSTANCE.context(), lineInfo); - Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); + CallerLogger.INSTANCE.d(M_V2X + TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); } } else { - Log.e(TAG, "info == null"); + CallerLogger.INSTANCE.e(M_V2X + TAG, "info == null"); clearAllLine(); } } @@ -407,14 +407,14 @@ public class V2XWarningMarker implements IV2XMarker { float distance = CoordinateUtils.calculateLineDistance( startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); double rotate = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); - Log.d(TAG, "添加小箭头--目标物与预碰撞点之间的距离是" + String.valueOf(distance)); + CallerLogger.INSTANCE.d(M_V2X + TAG, "添加小箭头--目标物与预碰撞点之间的距离是" + String.valueOf(distance)); if (distance > 5) { int count = (int) (distance / 5); for (int i = 0; i < count; i++) { MogoLatLng newLo = Trigonometric.getNewLocation( startLatLng, 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat)); V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue()); - Log.d(TAG, "小箭头位置" + newLo); + CallerLogger.INSTANCE.d(M_V2X + TAG, "小箭头位置" + newLo); } } @@ -430,7 +430,7 @@ public class V2XWarningMarker implements IV2XMarker { //衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 //drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing()); } - Log.d(TAG, "车辆行驶轨迹" + String.valueOf(latLng.getLongitude()) + "," + String.valueOf(latLng.getLatitude())); + CallerLogger.INSTANCE.d(M_V2X + TAG, "车辆行驶轨迹" + String.valueOf(latLng.getLongitude()) + "," + String.valueOf(latLng.getLatitude())); } @Override diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ADASUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ADASUtils.java index 0b5a854af8..981deadb3d 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ADASUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ADASUtils.java @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.v2x.events.utils; -import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import android.content.Context; import android.content.Intent; @@ -11,12 +11,11 @@ import androidx.annotation.Nullable; import com.mogo.commons.voice.AIAssist; import com.mogo.commons.voice.IMogoVoiceCmdCallBack; import com.mogo.commons.voice.VoicePreemptType; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.AppUtils; import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.module.common.entity.V2XPushMessageEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; /** * author : donghongyu @@ -54,7 +53,7 @@ public class ADASUtils { try { Intent intent = new Intent("com.mogo.launcher.v2x"); intent.putExtra("v2x_warning_type", alarmMessage.getSceneId()); - intent.putExtra("v2x_warining_timeout", alarmMessage.getExpireTime()); + intent.putExtra("v2x_warning_timeout", alarmMessage.getExpireTime()); intent.putExtra("v2x_warning_tts", alarmMessage.getTts()); intent.putExtra("v2x_warning_info", alarmMessage.getAlarmContent()); context.sendBroadcast(intent); @@ -64,7 +63,7 @@ public class ADASUtils { speakTTSVoice(alarmMessage.getTts(), null); } - Logger.i(MODULE_NAME, "向ADAS分发服务器下发的事件," + alarmMessage.toString()); + CallerLogger.INSTANCE.i(M_V2X + "ADASUtils", "向ADAS分发服务器下发的事件," + alarmMessage.toString()); } catch (Exception e) { e.printStackTrace(); } @@ -72,7 +71,7 @@ public class ADASUtils { public static void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) { if (!TextUtils.isEmpty(msg)) { - Logger.w(V2XConst.MODULE_NAME, "调用TTS播放语音:" + msg); + CallerLogger.INSTANCE.w(M_V2X + "ADASUtils", "调用TTS播放语音:" + msg); AIAssist.getInstance(Utils.getApp()).speakTTSVoice(msg, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/DrivingDirectionUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/DrivingDirectionUtils.java index 008c6a0d64..c8d2bb61fe 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/DrivingDirectionUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/DrivingDirectionUtils.java @@ -25,7 +25,6 @@ public class DrivingDirectionUtils { int poiAngle = 0; // 以子午线作为y轴 计算两点的余切 再将余切值转化为角度 double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI); - //Log.w(MODULE_NAME, "getDegreeOfCar2Poi_计算车辆行驶方向 与 poi点到车辆的连线 间的夹角_angle===" + _angle); if (poiLon > carLon) { // poi 在 车辆位置的第1象限 if (poiLat > carLat) { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java index 5e7652688d..69ccb966d1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java @@ -1,7 +1,10 @@ package com.mogo.eagle.core.function.v2x.events.utils; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.text.TextUtils; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XStrategyPushRes; import com.mogo.eagle.core.network.utils.GsonUtil; @@ -9,7 +12,6 @@ import com.mogo.eagle.core.utilcode.constant.TimeConstants; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.TimeUtils; import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; /** * author : donghongyu @@ -46,7 +48,7 @@ public class FatigueDrivingUtils { // 获取 ACC ON 时间 String localAccONTime = SharedPrefsMgr.getInstance(Utils.getApp()) .getString(V2XConst.V2X_ACC_ON_TIME_STR); - Logger.d(V2XConst.MODULE_NAME, "ACC ON时间:" + localAccONTime); + CallerLogger.INSTANCE.d(M_V2X + "FatigueDrivingUtils", "ACC ON时间:" + localAccONTime); // 如果本地没有记录时间则记录 if (!TextUtils.isEmpty(localAccONTime)) { @@ -63,7 +65,7 @@ public class FatigueDrivingUtils { if (!TextUtils.isEmpty(accOFFTime)) { // 比较开关机时间,如果acc of 比 acc on 时间还要靠近说明acc on 时间记录有问题,需要更新同步 long timeSpan = TimeUtils.getTimeSpan(accOnTime, accOFFTime, TimeConstants.MIN); - Logger.d(V2XConst.MODULE_NAME, "开关机时间间隔:" + timeSpan); + CallerLogger.INSTANCE.d(M_V2X + "FatigueDrivingUtils", "开关机时间间隔:" + timeSpan); if (timeSpan >= strategyPushEntity.getRestIgnoreMinutes()) { // 记录开机时间 SharedPrefsMgr.getInstance(Utils.getApp()) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/LocationUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/LocationUtils.java index c4ec1421f9..35f0d28dfc 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/LocationUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/LocationUtils.java @@ -1,9 +1,10 @@ package com.mogo.eagle.core.function.v2x.events.utils; -import android.util.Log; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.map.location.IMogoLocationClient; import com.mogo.map.uicontroller.IMogoMapUIController; @@ -61,10 +62,10 @@ public class LocationUtils { carLon, carLat, poiLon, poiLat, (int) carAngle); if (diffAngle <= 90) { - Log.i(TAG, "目标点在车辆--前方"); + CallerLogger.INSTANCE.i(M_V2X + TAG, "目标点在车辆--前方"); return true; } else { - Log.i(TAG, "目标点在车辆--后方"); + CallerLogger.INSTANCE.i(M_V2X + TAG, "目标点在车辆--后方"); return false; } } 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 15c3630c06..42100238a4 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 @@ -19,7 +19,6 @@ class MapUtils { if (latLng == null) { return } - //Logger.d(V2XConst.MODULE_NAME, "重新调整地图缩放比:" + latLng); val mBoundRect = Rect() val paddingTop: Int val paddingBottom: Int @@ -46,9 +45,7 @@ class MapUtils { MogoApisHandler.getInstance().apis.adasControllerApi.lastLon ) // 调整自适应的地图镜头 - carLocation?.let { - BridgeApi.mapUiController()?.showBounds("MapUtils", it, listOf(latLng), mBoundRect, true) - } + BridgeApi.mapUiController()?.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/TestOnLineCarUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TestOnLineCarUtils.java index 9d0fe8e5de..8267396b79 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TestOnLineCarUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TestOnLineCarUtils.java @@ -1,7 +1,5 @@ package com.mogo.eagle.core.function.v2x.events.utils; -import android.util.Log; - import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.function.v2x.R; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes; @@ -190,7 +188,6 @@ public class TestOnLineCarUtils { // 加载数据源 V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class); - Log.d("XXX", GsonUtil.jsonFromObject(warningEntity)); V2XMessageEntity messageEntity = new V2XMessageEntity(); messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS); messageEntity.setContent(warningEntity); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XSQLiteUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XSQLiteUtils.java index 608b70cad3..ffcd3ce0d4 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XSQLiteUtils.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XSQLiteUtils.java @@ -1,8 +1,9 @@ package com.mogo.eagle.core.function.v2x.events.utils; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.sqlite.SQLIDao; import com.mogo.eagle.core.utilcode.util.TimeUtils; import com.mogo.eagle.core.utilcode.util.Utils; @@ -93,7 +94,6 @@ public class V2XSQLiteUtils { public static void updateScenarioHistoryData(V2XHistoryScenarioData oldScenarioData, V2XHistoryScenarioData newScenarioData) { try { int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData); - Logger.d(V2XConst.MODULE_NAME, "修改数据成功:" + result); //V2XEventPanelFragment.Companion.getInstance().changeEventCount(); } catch (Exception e) { e.printStackTrace(); @@ -133,7 +133,7 @@ public class V2XSQLiteUtils { if (!TimeUtils.isToday(triggerTime)) { int result = getScenarioHistoryDao().delete(historyScenarioDatum); if (result > 0) { - Logger.d(V2XConst.MODULE_NAME, "删除过期数据成功"); + CallerLogger.INSTANCE.d(M_V2X + "V2XSQLiteUtils", "删除过期数据成功"); } } } @@ -150,7 +150,7 @@ public class V2XSQLiteUtils { public static void saveLocalStory(int scenarioType, Object markerExploreWay, int hashCode) { try { - Logger.d(V2XConst.MODULE_NAME, "saveLocalStory:" + markerExploreWay); + CallerLogger.INSTANCE.d(M_V2X + "V2XSQLiteUtils", "saveLocalStory:" + markerExploreWay); // 进行数据库存储 V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/CarZegoLiveVideoView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/CarZegoLiveVideoView.java index 6d5ea3e021..07230d6be6 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/CarZegoLiveVideoView.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/CarZegoLiveVideoView.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.v2x.events.view; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; + import android.content.Context; import android.content.Intent; import android.graphics.PorterDuff; @@ -16,6 +18,7 @@ import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.voice.AIAssist; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.R; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; @@ -24,7 +27,6 @@ import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager; import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.eagle.core.widget.RoundLayout; import com.mogo.map.location.IMogoLocationClient; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; /** * @author liujing @@ -82,13 +84,12 @@ public class CarZegoLiveVideoView extends RoundLayout { AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live)); playLiveVideo(); mClLoadError.setVisibility(GONE); - Logger.d(TAG, "startLive"); - + CallerLogger.INSTANCE.d(M_V2X + TAG, "startLive"); } else { AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live_error)); mLoading.setVisibility(GONE); mClLoadError.setVisibility(VISIBLE); - Logger.d(TAG, "没有找到可直播车机"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "没有找到可直播车机"); } } @@ -107,7 +108,7 @@ public class CarZegoLiveVideoView extends RoundLayout { MoGoAiCloudTrafficLive.viewFrontVehicleLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), mSurfaceView, new ITrafficCarLiveCallBack() { @Override public void onLive(String liveSn) { - Logger.d(TAG, "onLive"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "onLive"); if (!TextUtils.isEmpty(liveSn)) { CarZegoLiveVideoView.this.liveSn = liveSn; } @@ -118,7 +119,7 @@ public class CarZegoLiveVideoView extends RoundLayout { @Override public void onDisConnect() { - Logger.d(TAG, "失去连接onDisConnect"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "失去连接onDisConnect"); } @Override @@ -142,11 +143,11 @@ public class CarZegoLiveVideoView extends RoundLayout { public void stopLive() { try { - Logger.w(TAG, "心跳:关闭直播..."); + CallerLogger.INSTANCE.d(M_V2X + TAG, "心跳:关闭直播..."); if (!TextUtils.isEmpty(liveSn)) { MoGoAiCloudTrafficLive.stopCarLive(liveSn); } else { - Logger.e(TAG, "直播 liveSn is null"); + CallerLogger.INSTANCE.e(M_V2X + TAG, "直播 liveSn is null"); } } 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/view/SimpleCoverVideoPlayer.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/SimpleCoverVideoPlayer.kt index d337887b5e..dc1f0c92fd 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/SimpleCoverVideoPlayer.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/SimpleCoverVideoPlayer.kt @@ -1,8 +1,7 @@ -package com.mogo.module.v2x.view +package com.mogo.eagle.core.function.v2x.events.view import android.content.Context import android.util.AttributeSet -import android.util.Log import android.view.Surface import android.view.View import android.widget.ImageView @@ -10,7 +9,6 @@ import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions import com.mogo.eagle.core.function.v2x.R import com.mogo.module.common.glide.SkinAbleBitmapTarget -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.utils.GSYVideoType import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer @@ -162,14 +160,12 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer { @Suppress("DEPRECATION") mAudioManager.abandonAudioFocus(onAudioFocusChangeListener) } catch (e: Exception) { - Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus") } } } override fun onClick(v: View?) { super.onClick(v) - Log.d("kl", "onClick160" + mCurrentState) if (mCurrentState == CURRENT_STATE_PAUSE) { onVideoResume() } else if (mCurrentState == CURRENT_STATE_PLAYING) { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XCrossRoadVideoView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XCrossRoadVideoView.java index 07f32a2eef..ad4e521e4a 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XCrossRoadVideoView.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XCrossRoadVideoView.java @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.v2x.events.view; -import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import static com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN; import static com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING; import android.content.Context; @@ -19,6 +19,7 @@ import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack; import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; import com.mogo.commons.voice.AIAssist; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.R; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; @@ -29,7 +30,6 @@ import com.mogo.eagle.core.widget.RoundLayout; import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer; import com.mogo.map.location.IMogoLocationClient; import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.shuyu.gsyvideoplayer.GSYVideoManager; import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; import com.shuyu.gsyvideoplayer.cache.CacheFactory; @@ -84,7 +84,7 @@ public class V2XCrossRoadVideoView extends RoundLayout { public V2XCrossRoadVideoView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - Logger.d(TAG, "constructor invoke initView"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "constructor invoke initView"); initView(context); } @@ -92,7 +92,7 @@ public class V2XCrossRoadVideoView extends RoundLayout { if (init) { return; } - Logger.d("V2XCrossRoadVideoView", "V2X===初始化语音呼叫路口直播视图"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "V2X===初始化语音呼叫路口直播视图"); LayoutInflater.from(context) .inflate(R.layout.view_video_layout_see_crossroad, this); //mPlayerView 即 step1 中添加的界面 view @@ -178,13 +178,13 @@ public class V2XCrossRoadVideoView extends RoundLayout { setCarLiveInfo(carLiveInfo); playLiveVideo(carLiveInfo); } else { - Logger.d(MODULE_NAME, "startLive 路口实况直播地址为空"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "startLive 路口实况直播地址为空"); } } @Override public void onError(String errorMsg) { - Logger.d(MODULE_NAME, "获取路口实况失败"); + CallerLogger.INSTANCE.d(M_V2X + TAG, "获取路口实况失败"); } }); } @@ -198,7 +198,7 @@ public class V2XCrossRoadVideoView extends RoundLayout { private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) { if (mTxcVideoView != null) { mTxcVideoView.setPlayListener(event -> { - Logger.w(MODULE_NAME, "播放器:onPlayEvent==" + event); + CallerLogger.INSTANCE.d(M_V2X + TAG, "播放器:onPlayEvent==" + event); if (event == PLAY_EVT_PLAY_LOADING) { mLoading.setVisibility(VISIBLE); mClLoadError.setVisibility(GONE); @@ -226,7 +226,7 @@ public class V2XCrossRoadVideoView extends RoundLayout { public void stopLive() { try { - Logger.w(MODULE_NAME, "关闭直播..."); + CallerLogger.INSTANCE.d(M_V2X + TAG, "关闭直播..."); GSYVideoManager.releaseAllVideos(); } 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/view/V2XLiveGSYVideoView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XLiveGSYVideoView.java index 56c11bb432..61d23bb126 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XLiveGSYVideoView.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XLiveGSYVideoView.java @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.v2x.events.view; -import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import android.content.Context; import android.content.Intent; @@ -16,6 +16,7 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import com.mogo.commons.voice.AIAssist; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.R; import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; @@ -24,7 +25,6 @@ import com.mogo.eagle.core.network.utils.GsonUtil; import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.eagle.core.widget.RoundLayout; import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.tencent.rtmp.ITXLivePlayListener; import com.tencent.rtmp.TXLiveConstants; import com.tencent.rtmp.TXLivePlayConfig; @@ -139,7 +139,7 @@ public class V2XLiveGSYVideoView extends RoundLayout { mLivePlayer.setPlayListener(new ITXLivePlayListener() { @Override public void onPlayEvent(int event, Bundle bundle) { - // Logger.i(MODULE_NAME, + // CallerLogger.INSTANCE.i(M_V2X + TAG, // "直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) + // "\n播放器:onPlayEvent==" + event + // "\nbundle===" + bundle); @@ -165,7 +165,7 @@ public class V2XLiveGSYVideoView extends RoundLayout { @Override public void onNetStatus(Bundle bundle) { - // Logger.i(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle); + // CallerLogger.INSTANCE.i(M_V2X + TAG, "播放器:onNetStatus===bundle===" + bundle); } }); } @@ -173,13 +173,13 @@ public class V2XLiveGSYVideoView extends RoundLayout { e.printStackTrace(); mLoading.setVisibility(GONE); mClLoadError.setVisibility(VISIBLE); - Logger.e(MODULE_NAME, "直播发生异常:carLiveInfo= " + GsonUtil.jsonFromObject(carLiveInfo)); + CallerLogger.INSTANCE.e(M_V2X + TAG, "直播发生异常:carLiveInfo= " + GsonUtil.jsonFromObject(carLiveInfo)); } } public void stopLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { try { - //Logger.i(MODULE_NAME, "心跳:关闭直播..."); + //CallerLogger.INSTANCE.i(M_V2X + TAG, "心跳:关闭直播..."); // 暂停 mLivePlayer.pause(); // true 代表清除最后一帧画面 @@ -196,12 +196,12 @@ public class V2XLiveGSYVideoView extends RoundLayout { // .livePush(new V2XRefreshCallback() { // @Override // public void onSuccess(V2XLivePushVoRes result) { - // Logger.d(MODULE_NAME, "播放器:" + result); + // CallerLogger.INSTANCE.d(M_V2X + TAG, "播放器:" + result); // } // // @Override // public void onFail(String msg) { - // Logger.e(MODULE_NAME, "播放器:" + msg); + // CallerLogger.INSTANCE.e(M_V2X + TAG, "播放器:" + msg); // } // }, carLiveInfo.getVideoSn(), 1); } catch (Exception e) { 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 1dddaf599a..d065055f7c 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 @@ -6,9 +6,7 @@ import android.text.TextUtils 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.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME import com.mogo.service.intent.IMogoIntentListener -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import java.lang.ref.WeakReference import java.util.concurrent.ConcurrentHashMap @@ -118,12 +116,10 @@ object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoIntentListener { } override fun onIntentReceived(command: String?, intent: Intent?) { - Logger.d(MODULE_NAME, "v2x voice command= $command") voiceCallbackMap[command]?.onCallback(command, intent) } override fun onCmdSelected(cmd: String?) { - Logger.d(MODULE_NAME, "v2x voice command== onCmdSelected $cmd") voiceCallbackMap[cmd]?.onCallback(cmd, null) } 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 32e291577c..b2d827348a 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 @@ -1,16 +1,17 @@ package com.mogo.eagle.core.function.v2x.redlightwarning import android.location.Location +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.trafficlight.* import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight 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.trafficlight.CallTrafficLightListenerManager import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager import com.mogo.eagle.core.function.v2x.vip.VipCarManager -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.map.navi.IMogoCarLocationChangedListener2 import com.mogo.module.common.MogoApisHandler @@ -44,9 +45,9 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { // 到路口100m时回调 - Logger.d(TAG, "处理路口交通数据:是否是第一次处理:${isFirst}是否进入路口:${isEnter}") + CallerLogger.d("$M_V2X$TAG", "处理路口交通数据:是否是第一次处理:${isFirst}是否进入路口:${isEnter}") if (trafficLightResult.currentRoadIsRight()) { - Logger.d(TAG,"当前道路右转,不处理") + CallerLogger.d("$M_V2X$TAG","当前道路右转,不处理") return } if (isFirst && !isEnter) { @@ -58,7 +59,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, } override fun onEnterCrossRoad(enter: Boolean) { - Logger.d(TAG, "回调是否进入路口:$enter") + CallerLogger.d("$M_V2X$TAG", "回调是否进入路口:$enter") isEnter = enter if (enter) { isFirst = true @@ -85,7 +86,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, ) { // 如果是Vip则不处理 if (vip) { - Logger.w(TAG, "Vip用户不处理闯红灯、绿灯通行预警逻辑!") + CallerLogger.w("$M_V2X$TAG", "Vip用户不处理闯红灯、绿灯通行预警逻辑!") return } // 路口100m闯红灯预警 @@ -93,7 +94,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, // 单位m/s val speed = it.speed // 车停止或者速度非常慢,可能返回负数或者很小的值,需要过滤 - Logger.d(TAG, "speed is:$speed") + CallerLogger.d("$M_V2X$TAG", "speed is:$speed") if (speed <= 2.5f) return// 小于等于9km/h不处理 // 由于到路口100m时回调不准,手动计算直线距离 val distance = MogoApisHandler.getInstance().apis.mapServiceApi @@ -101,20 +102,20 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, MogoLatLng(it.latitude, it.longitude), MogoLatLng(trafficLightResult.lat, trafficLightResult.lon) ) - Logger.d( - TAG, + CallerLogger.d( + "$M_V2X$TAG", "路口经度为:${trafficLightResult.lon},纬度为:${trafficLightResult.lat};车的经度为:${it.longitude},纬度为:${it.latitude};两点距离为:${distance}" ) val remainTime = trafficLightStatus.remain val arriveTime = distance / speed - Logger.d( - TAG, + CallerLogger.d( + "$M_V2X$TAG", "speed is:$speed,remainTime is:$remainTime,arriveTime is:$arriveTime,yellowTime is:${trafficLightResult.flashYellow}" ) when { trafficLightStatus.isRed() -> { - Logger.d(TAG, "=====当前为红灯=====") + CallerLogger.d("$M_V2X$TAG", "=====当前为红灯=====") // 到达路口时红灯还没走完(由于多个数据有偏差,红灯预警延长1s,绿灯提示条件延长1.5s,多报出错不如少报且准) if (arriveTime <= remainTime + 1) { redLightWarning() @@ -129,7 +130,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, } } trafficLightStatus.isYellow() -> { - Logger.d(TAG, "=====当前为黄灯=====") + CallerLogger.d("$M_V2X$TAG", "=====当前为黄灯=====") // 到达路口时黄灯还没走完(由于多个数据有偏差,红灯预警延长1s,绿灯提示延长1.5s,多报出错不如少报且准) if (arriveTime <= remainTime + 1) { redLightWarning() @@ -143,7 +144,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, } } trafficLightStatus.isGreen() -> { - Logger.d(TAG, "=====当前为绿灯=====") + CallerLogger.d("$M_V2X$TAG", "=====当前为绿灯=====") // 到达路口时绿灯已经走完(由于多个数据有偏差,多报出错不如少报且准,绿灯时间减少一点) if (arriveTime >= remainTime - 1) { redLightWarning() @@ -158,7 +159,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, } } } ?: run { - Logger.e(TAG, "CurrentLocation is null!") + CallerLogger.e("$M_V2X$TAG", "CurrentLocation is null!") } } @@ -166,7 +167,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, * 闯红灯预警 */ private fun redLightWarning() { - Logger.d(TAG, "=====闯红灯预警=====") + CallerLogger.d("$M_V2X$TAG", "=====闯红灯预警=====") ThreadUtils.runOnUiThread { CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt(), EventTypeEnum.TYPE_USECASE_ID_IVP.content, EventTypeEnum.TYPE_USECASE_ID_IVP.tts, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, 5000L) } @@ -176,7 +177,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, * 绿灯通行提示 */ private fun greenLightWarning(speed: String = "50") { - Logger.d(TAG, "=====绿灯通行预警=====") + CallerLogger.d("$M_V2X$TAG", "=====绿灯通行预警=====") ThreadUtils.runOnUiThread { val content = String.format( EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt index a18327a169..41e7ef1f29 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt @@ -4,10 +4,12 @@ import android.content.Context import android.location.Location import android.os.Handler import android.os.Looper +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.data.trafficlight.RoadIDResult import com.mogo.eagle.core.data.trafficlight.TrafficLightDetail import com.mogo.eagle.core.data.trafficlight.TrafficLightResult import com.mogo.eagle.core.data.trafficlight.isInRange +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD @@ -15,7 +17,6 @@ import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHand import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT import com.mogo.eagle.core.function.v2x.trafficlight.network.TrafficLightNetWorkModel -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.map.navi.IMogoCarLocationChangedListener2 import com.mogo.module.common.MogoApisHandler @@ -61,7 +62,7 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 { roadIDResult = it }, { - //Logger.w(TAG, "request road id error : $it") + //CallerLogger.w(M_V2X + TAG, "request road id error : $it") }) } }, { @@ -82,7 +83,7 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 { }, { errorMsg -> //如果没有获取到正确的红绿灯数据,则取消读灯,继续读路口,防止出现一直读灯的情况 - Logger.e(TAG, "request Traffic Light error : $errorMsg") + CallerLogger.e(M_V2X + TAG, "request Traffic Light error : $errorMsg") //stop loop traffic light trafficLightNetWorkModel.cancelRequestTrafficLight() //未查到红绿灯,加入2秒延时请求路口ID @@ -120,12 +121,12 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 { // 检测是否开过路口,开过路口则停止读灯。并重置 trafficLightResult 值为 null if (trafficLightResult != null && it.isInRange(loc.latitude, loc.longitude)) { inRange = true -// Logger.d(TAG, "进入路口") +// CallerLogger.d(M_V2X + TAG, "进入路口") CallTrafficLightListenerManager.invokeEnterCrossRoad(true) return } if (inRange) { -// Logger.d(TAG, "离开路口") +// CallerLogger.d(M_V2X + TAG, "离开路口") CallTrafficLightListenerManager.invokeEnterCrossRoad(false) inRange = false trafficLightResult = null diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index f7b8a35100..e143629724 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -6,16 +6,17 @@ import android.os.Handler import android.os.Looper import android.os.Message import com.mogo.cloud.commons.utils.CoordinateUtils +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.data.trafficlight.* import com.mogo.eagle.core.data.v2x.VipMessage import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener 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.trafficlight.CallTrafficLightListenerManager import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager import com.mogo.eagle.core.function.v2x.vip.network.VipNetWorkModel -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.enums.EventTypeEnum @@ -78,15 +79,15 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe } override fun onMsgReceived(vipMessage: VipMessage?) { - Logger.d(TAG, "onMsgReceived vipMessage : ${vipMessage.toString()}") + CallerLogger.d("$M_V2X$TAG", "onMsgReceived vipMessage : ${vipMessage.toString()}") vipMessage?.let { when (it.vipType) { 0 -> { //取消VIP cancelVip() } 1 -> { //设置VIP - Logger.d( - TAG, + CallerLogger.d( + "$M_V2X$TAG", "设置handler超时时间 " + ", time : ${System.currentTimeMillis() - vipMessage.timeOut}" ) setVip(vipMessage.timeOut) @@ -101,15 +102,15 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe } if (exit) { - Logger.d(TAG, "驶离路口,返回 , then resetConditions") + CallerLogger.d("$M_V2X$TAG", "驶离路口,返回 , then resetConditions") resetConditions() exit = false return } if (trafficLightResult.currentRoadTrafficLight() == null) { - Logger.d( - TAG, + CallerLogger.d( + "$M_V2X$TAG", "vip 获取到灯态,但没找到对应车道数据 result : $trafficLightResult , then resetConditions" ) resetConditions() @@ -118,8 +119,8 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe val currentResult = trafficLightResult.currentRoadTrafficLight() lastResult = result?.currentRoadTrafficLight() - Logger.d( - TAG, + CallerLogger.d( + "$M_V2X$TAG", "检查是否变灯 last.remain : ${lastResult?.remain} , color : ${lastResult?.color} , current.remain : ${currentResult?.remain} , color : ${currentResult?.color}, turnLightFirst : $turnLightFirst" ) @@ -128,12 +129,12 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe lastResult?.let { //如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗 if (abs(currentResult!!.remain - it.remain) > 5 && currentResult.isGreen()) { - Logger.d(TAG, "调用showWarningV2X to show") + CallerLogger.d("$M_V2X$TAG", "调用showWarningV2X to show") CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(), EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, object : IMoGoWarningStatusListener { override fun onShow() {} override fun onDismiss() { - Logger.d( - TAG, + CallerLogger.d( + "$M_V2X$TAG", "showWarningV2X vip dismiss , resetConditions" ) resetConditions() @@ -147,7 +148,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe // 首次判断,变灯 turnLightFirst = true val controlTime = if (currentResult!!.isGreen()) 45 - currentResult.remain else 45 - Logger.d(TAG, "触发变灯 , controlTime : $controlTime") + CallerLogger.d("$M_V2X$TAG", "触发变灯 , controlTime : $controlTime") turnLight(controlTime) } @@ -220,7 +221,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe cancelVip() } }, { - Logger.e(TAG, "获取VIP信息失败, 准备间隔5秒重新获取") + CallerLogger.e("$M_V2X$TAG", "获取VIP信息失败, 准备间隔5秒重新获取") handler.sendEmptyMessageDelayed(MSG_WHAT_VIP_SEARCH, 5_000L) }) } @@ -236,14 +237,14 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe result?.let { val bearing = MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).lastKnowLocation.bearing.toDouble() - Logger.d(TAG, "turnLight -- bearing : $bearing") + CallerLogger.d("$M_V2X$TAG", "turnLight -- bearing : $bearing") MogoTrafficLightManager.INSTANCE.turnLightToGreen( it.lightId, it.crossId, bearing, controlTime, { - Logger.d(TAG, "变灯请求成功") + CallerLogger.d("$M_V2X$TAG", "变灯请求成功") }, { errorMsg -> - Logger.e(TAG, "变灯请求失败 msg : $errorMsg") + CallerLogger.e("$M_V2X$TAG", "变灯请求失败 msg : $errorMsg") }) } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chain/ChainConstant.kt similarity index 96% rename from core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chain/ChainConstant.kt index 5d53fc6b56..1bfcd9ef23 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chain/ChainConstant.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.data.deva.chain +package com.mogo.eagle.core.data.chain class ChainConstant { diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainLogParam.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chain/ChainLogParam.kt similarity index 81% rename from core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainLogParam.kt rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chain/ChainLogParam.kt index 701665532f..a840e24497 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainLogParam.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chain/ChainLogParam.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.data.deva.chain +package com.mogo.eagle.core.data.chain class ChainLogParam { diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt index 9a36db68ea..3b11267a92 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt @@ -15,7 +15,7 @@ interface IMoGoAutopilotIdentifyListener { * * @param trafficData 交通元素信息列表 */ - fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) {} + fun onAutopilotIdentifyDataUpdate(trafficData: List?) {} /** * 报警信息 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt index 8f9792dcfa..2ebc65e4cf 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt @@ -1,7 +1,7 @@ package com.mogo.eagle.core.function.api.devatools import android.view.View -import com.mogo.eagle.core.data.deva.chain.ChainLogParam +import com.mogo.eagle.core.data.chain.ChainLogParam import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider import record_cache.RecordPanelOuterClass diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index e5ddcfb609..d8f787a070 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -5,7 +5,6 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.GsonUtils -import com.mogo.eagle.core.utilcode.util.LogUtils import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg import java.util.concurrent.ConcurrentHashMap @@ -16,7 +15,6 @@ import java.util.concurrent.ConcurrentHashMap * 域控制器相关的回调监听 */ object CallerAutoPilotStatusListenerManager : CallerBase() { - private val TAG = "CallerAutoPilotStatusListenerManager" // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo() @@ -49,7 +47,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { @Nullable listener: IMoGoAutopilotStatusListener ) { if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_AUTOPILOT_STATUS_LISTENERS[tag] = listener @@ -62,7 +59,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_AUTOPILOT_STATUS_LISTENERS.remove(tag) @@ -94,12 +90,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeAutoPilotStatus(autopilotStatusInfo: AutopilotStatusInfo) { - //LogUtils.dTag(TAG, "$autopilotStatusInfo") mAutopilotStatusInfo = autopilotStatusInfo M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onAutopilotStatusResponse(mAutopilotStatusInfo) } } @@ -122,11 +116,9 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotSNRequest() { - //LogUtils.dTag(TAG, "") M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onAutopilotSNRequest() } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt index e7c71fe95b..3cd9fa116d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt @@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap @@ -11,7 +10,6 @@ import java.util.concurrent.ConcurrentHashMap * 车辆地盘数据 回调监听 */ object CallerAutopilotCarConfigListenerManager : CallerBase() { - private val TAG = "CallerAutopilotCarConfigListenerManager" // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_CAR_CONFIG_LISTENERS: ConcurrentHashMap = @@ -27,7 +25,6 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() { @Nullable listener: IMoGoAutopilotCarConfigListener ) { if (M_AUTOPILOT_CAR_CONFIG_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_AUTOPILOT_CAR_CONFIG_LISTENERS[tag] = listener @@ -39,7 +36,6 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!M_AUTOPILOT_CAR_CONFIG_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_AUTOPILOT_CAR_CONFIG_LISTENERS.remove(tag) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt index f43cfc0424..cceb3e912d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt @@ -1,10 +1,8 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable -import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap @@ -14,7 +12,6 @@ import java.util.concurrent.ConcurrentHashMap * 车辆状态&定位 数据 数据 回调监听 */ object CallerAutopilotCarStatusListenerManager : CallerBase() { - private val TAG = "CallerAutopilotCarStatusListenerManager" // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap = @@ -31,7 +28,6 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { @Nullable listener: IMoGoAutopilotCarStateListener ) { if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_AUTOPILOT_STATUS_LISTENERS[tag] = listener @@ -43,7 +39,6 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_AUTOPILOT_STATUS_LISTENERS.remove(tag) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt index 5869a87000..b773018826 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt @@ -1,10 +1,8 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable -import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import mogo.telematics.pad.MessagePad import record_cache.RecordPanelOuterClass import java.util.concurrent.ConcurrentHashMap @@ -15,7 +13,6 @@ import java.util.concurrent.ConcurrentHashMap * 域控制器感知数据 */ object CallerAutopilotIdentifyListenerManager : CallerBase() { - private val TAG = "CallerAutopilotIdentifyListenerManager" // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_IDENTIFY_LISTENERS: ConcurrentHashMap = @@ -31,7 +28,6 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { @Nullable listener: IMoGoAutopilotIdentifyListener ) { if (M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_AUTOPILOT_IDENTIFY_LISTENERS[tag] = listener @@ -43,7 +39,6 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_AUTOPILOT_IDENTIFY_LISTENERS.remove(tag) @@ -65,7 +60,7 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { * 识别交通元素数据发生更新 回调 */ @Synchronized - fun invokeAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { + fun invokeAutopilotIdentifyDataUpdate(trafficData: List?) { M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { val tag = it.key val listener = it.value @@ -92,7 +87,6 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { val tag = it.key val listener = it.value - LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onAutopilotRecordResult(recordPanel) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt index d57aad7ad1..ed74c7659b 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt @@ -4,7 +4,6 @@ import androidx.annotation.Nullable import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap @@ -14,7 +13,6 @@ import java.util.concurrent.ConcurrentHashMap * 规划路径相关回调 */ object CallerAutopilotPlanningListenerManager : CallerBase() { - private val TAG = "CallerAutopilotPlanningListenerManager" // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_PLANNING_LISTENER: ConcurrentHashMap = @@ -31,7 +29,6 @@ object CallerAutopilotPlanningListenerManager : CallerBase() { @Nullable listener: IMoGoAutopilotPlanningListener ) { if (M_AUTOPILOT_PLANNING_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_AUTOPILOT_PLANNING_LISTENER[tag] = listener @@ -43,7 +40,6 @@ object CallerAutopilotPlanningListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!M_AUTOPILOT_PLANNING_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_AUTOPILOT_PLANNING_LISTENER.remove(tag) @@ -67,11 +63,9 @@ object CallerAutopilotPlanningListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotTrajectory(trajectoryInfo: ArrayList) { - //LogUtils.dTag(TAG, "$trajectoryInfo") M_AUTOPILOT_PLANNING_LISTENER.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onAutopilotTrajectory(trajectoryInfo) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt index 1266dec504..07d0f97a18 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -4,14 +4,12 @@ import androidx.annotation.Nullable import chassis.Chassis import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap /** * 车辆地盘数据 回调监听 */ object CallerAutopilotVehicleStateListenerManager : CallerBase() { - private val TAG = "CallerAutopilotVehicleStateListenerManager" // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_VEHICLE_LISTENERS: ConcurrentHashMap = @@ -27,7 +25,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { @Nullable listener: IMoGoAutopilotVehicleStateListener ) { if (M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_AUTOPILOT_VEHICLE_LISTENERS[tag] = listener @@ -39,7 +36,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_AUTOPILOT_VEHICLE_LISTENERS.remove(tag) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.java b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.java index 053fdb3334..fb22f18b63 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.java +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.java @@ -3,7 +3,7 @@ package com.mogo.eagle.core.function.call.base; import com.alibaba.android.arouter.facade.template.IProvider; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.eagle.core.function.call.CallerBusManager; -import com.mogo.eagle.core.utilcode.util.LogUtils; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; /** * @author xiaoyuzhou @@ -23,7 +23,7 @@ public class CallerBase { T newInst = (T) ARouter.getInstance().build(path).navigation(); try { CallerBusManager.registerApi(clazz, newInst); - LogUtils.dTag(TAG, "keep IProvider instance to SingletonHolder: path = %s", path); + CallerLogger.INSTANCE.d(TAG, "keep IProvider instance to SingletonHolder: path :" + path); } catch (Exception e) { e.printStackTrace(); } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt index 4f028a8cc5..545f21ecda 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt @@ -2,13 +2,10 @@ package com.mogo.eagle.core.function.call.devatools import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap object CallerDevaToolsListenerManager { - private const val TAG = "CallDevaToolsListenerManager" - private val M_DEVA_TOOLS_LISTENER: ConcurrentHashMap = ConcurrentHashMap() @@ -22,7 +19,6 @@ object CallerDevaToolsListenerManager { @Nullable listener: IMoGoDevaToolsListener ) { if (M_DEVA_TOOLS_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_DEVA_TOOLS_LISTENER[tag] = listener @@ -34,7 +30,6 @@ object CallerDevaToolsListenerManager { */ fun unRegisterDevaToolsLogCatchListener(@Nullable tag: String) { if (!M_DEVA_TOOLS_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_DEVA_TOOLS_LISTENER.remove(tag) @@ -46,7 +41,6 @@ object CallerDevaToolsListenerManager { */ fun unRegisterDevaToolsLogCatchListener(@Nullable listener: IMoGoDevaToolsListener) { if (!M_DEVA_TOOLS_LISTENER.containsValue(listener)) { - LogUtils.eTag(TAG, "listener:$listener not exists") return } M_DEVA_TOOLS_LISTENER.forEach { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt index cad6ced1ef..f1bb6c6c5b 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt @@ -1,9 +1,8 @@ package com.mogo.eagle.core.function.call.devatools import android.view.View -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.data.deva.chain.ChainLogParam +import com.mogo.eagle.core.data.chain.ChainLogParam import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider import com.mogo.eagle.core.function.call.base.CallerBase import record_cache.RecordPanelOuterClass diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt index fd9832a15f..5f081b9726 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt @@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.call.hmi import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap /** @@ -13,8 +12,6 @@ import java.util.concurrent.ConcurrentHashMap */ object CallerHmiListenerManager : CallerBase() { - private val TAG = "CallerHmiListenerManager" - // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 private var mIsChecked: Boolean = false @@ -33,7 +30,6 @@ object CallerHmiListenerManager : CallerBase() { @Nullable listener: IMoGoCheckAutoPilotBtnListener ) { if (mAutoPilotBtnListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } mAutoPilotBtnListeners[tag] = listener @@ -46,7 +42,6 @@ object CallerHmiListenerManager : CallerBase() { */ fun removeCheckAutoPilotBtnListener(@Nullable tag: String) { if (!mAutoPilotBtnListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } mAutoPilotBtnListeners.remove(tag) @@ -57,12 +52,10 @@ object CallerHmiListenerManager : CallerBase() { * @param isChecked 选中状态 */ fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) { - //LogUtils.dTag(TAG, "isChecked:$isChecked") mIsChecked = isChecked mAutoPilotBtnListeners.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onCheck(mIsChecked) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/logger/CallerLogger.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/logger/CallerLogger.kt deleted file mode 100644 index ab9ad07236..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/logger/CallerLogger.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.mogo.eagle.core.function.call.logger - -import com.mogo.eagle.core.function.call.devatools.scene.Scene.Companion.scene -import com.mogo.eagle.core.utilcode.mogo.logger.Logger - -object CallerLogger { - - fun i(tag: String, message: String, any: Any? = null) { - if (scene.check(tag)) { - Logger.i(tag, message, any) - } - } - - fun d(tag: String, message: String, any: Any? = null) { - if (scene.check(tag)) { - Logger.d(tag, message, any) - } - } - - fun w(tag: String, message: String, any: Any? = null) { - if (scene.check(tag)) { - Logger.w(tag, message, any) - } - } - - fun e(tag: String, message: String, any: Any? = null) { - if (scene.check(tag)) { - Logger.e(tag, message, any) - } - } - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt index e3e06bd62a..d459ef05ee 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt @@ -1,11 +1,9 @@ package com.mogo.eagle.core.function.call.map -import android.util.Log import androidx.annotation.Nullable import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap /** @@ -14,7 +12,6 @@ import java.util.concurrent.ConcurrentHashMap * 地图 位置改变 监听管理 */ object CallerMapLocationListenerManager : CallerBase() { - private val TAG = "CallerMapLocationListenerManager" // 记录地图最后一次位置 private var mLocation: MogoLocation? = null @@ -40,7 +37,6 @@ object CallerMapLocationListenerManager : CallerBase() { @Nullable listener: IMoGoMapLocationListener ) { if (mMapStyleChangeListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } mMapStyleChangeListeners[tag] = listener @@ -53,7 +49,6 @@ object CallerMapLocationListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!mMapStyleChangeListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } mMapStyleChangeListeners.remove(tag) @@ -65,7 +60,6 @@ object CallerMapLocationListenerManager : CallerBase() { */ fun removeListener(@Nullable listener: IMoGoMapLocationListener) { if (!mMapStyleChangeListeners.containsValue(listener)) { - LogUtils.eTag(TAG, "Tag:$listener not exists") return } mMapStyleChangeListeners.forEach { @@ -87,18 +81,10 @@ object CallerMapLocationListenerManager : CallerBase() { * @param location 选中状态 */ fun invokeMapLocationChangeListener(location: MogoLocation?) { - //LogUtils.dTag(TAG, "mapStyleMode:$location") -// val longitude = "${location?.longitude}" -// if (longitude.length>12){ -// Log.e("DHY-location", "${location?.longitude},${location?.latitude} CallerMapLocationListenerManager-invokeMapLocationChangeListener") -// }else{ -// Log.w("DHY-location", "${location?.longitude},${location?.latitude} CallerMapLocationListenerManager-invokeMapLocationChangeListener") -// } mLocation = location mMapStyleChangeListeners.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onLocationChanged(location) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt index 3927d91b77..96379f9b36 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt @@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.call.map import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.map.listener.IMoGoMapStyleChangeListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap /** @@ -12,7 +11,6 @@ import java.util.concurrent.ConcurrentHashMap * 地图 样式改变 监听管理 */ object CallerMapStyleListenerManager : CallerBase() { - private val TAG = "CallerMapStyleListenerManager" // 记录地图样式 private var mMapStyleMode = 0 @@ -38,7 +36,6 @@ object CallerMapStyleListenerManager : CallerBase() { @Nullable listener: IMoGoMapStyleChangeListener ) { if (mMapStyleChangeListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } mMapStyleChangeListeners[tag] = listener @@ -51,7 +48,6 @@ object CallerMapStyleListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!mMapStyleChangeListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } mMapStyleChangeListeners.remove(tag) @@ -63,7 +59,6 @@ object CallerMapStyleListenerManager : CallerBase() { */ fun removeListener(@Nullable listener: IMoGoMapStyleChangeListener) { if (!mMapStyleChangeListeners.containsValue(listener)) { - LogUtils.eTag(TAG, "Tag:$listener not exists") return } mMapStyleChangeListeners.forEach { @@ -85,12 +80,10 @@ object CallerMapStyleListenerManager : CallerBase() { * @param mapStyleMode 选中状态 */ fun invokeMapStyleChange(mapStyleMode: Int) { - //LogUtils.dTag(TAG, "mapStyleMode:$mapStyleMode") mMapStyleMode = mapStyleMode mMapStyleChangeListeners.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onMapStyleModeChange(mMapStyleMode) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt index 0b53cdcc5a..d86e742390 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt @@ -5,7 +5,6 @@ import com.mogo.eagle.core.data.obu.ObuStatusInfo import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.GsonUtils -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap /** @@ -14,7 +13,6 @@ import java.util.concurrent.ConcurrentHashMap * OBU 监听管理 */ object CallerObuListenerManager : CallerBase() { - private val TAG = "CallerObuListenerManager" // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() @@ -47,7 +45,6 @@ object CallerObuListenerManager : CallerBase() { @Nullable listener: IMoGoObuStatusListener ) { if (mObuStatusListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } mObuStatusListeners[tag] = listener @@ -60,7 +57,6 @@ object CallerObuListenerManager : CallerBase() { */ fun removeListener(@Nullable tag: String) { if (!mObuStatusListeners.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } mObuStatusListeners.remove(tag) @@ -72,7 +68,6 @@ object CallerObuListenerManager : CallerBase() { */ fun removeListener(@Nullable listener: IMoGoObuStatusListener) { if (!mObuStatusListeners.containsValue(listener)) { - LogUtils.eTag(TAG, "Tag:$listener not exists") return } mObuStatusListeners.forEach { @@ -94,12 +89,10 @@ object CallerObuListenerManager : CallerBase() { * @param obuStatusInfo 选中状态 */ fun invokeListener(obuStatusInfo: ObuStatusInfo) { - //LogUtils.dTag(TAG, "obuStatusInfo:$obuStatusInfo") mObuStatusInfo = obuStatusInfo mObuStatusListeners.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onObuStatusResponse(mObuStatusInfo) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt index c4e3d7e795..dc3cf89bc8 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt @@ -3,13 +3,10 @@ package com.mogo.eagle.core.function.call.trafficlight import androidx.annotation.Nullable import com.mogo.eagle.core.data.trafficlight.TrafficLightResult import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap object CallTrafficLightListenerManager { - private const val TAG = "CallTrafficLightListenerManager" - private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = ConcurrentHashMap() @@ -25,7 +22,6 @@ object CallTrafficLightListenerManager { @Nullable listener: IMoGoTrafficLightListener ) { if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } trafficLightResult?.let { @@ -40,7 +36,6 @@ object CallTrafficLightListenerManager { */ fun unRegisterTrafficLightListener(@Nullable tag: String) { if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_TRAFFIC_LIGHT_LISTENER.remove(tag) @@ -52,7 +47,6 @@ object CallTrafficLightListenerManager { */ fun unRegisterTrafficLightListener(@Nullable listener: IMoGoTrafficLightListener) { if (!M_TRAFFIC_LIGHT_LISTENER.containsValue(listener)) { - LogUtils.eTag(TAG, "listener:$listener not exists") return } M_TRAFFIC_LIGHT_LISTENER.forEach { @@ -72,7 +66,6 @@ object CallTrafficLightListenerManager { @Nullable listener: IMoGoTrafficLightListener ) { if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } M_TRAFFIC_LIGHT_LISTENER[tag] = listener @@ -84,7 +77,6 @@ object CallTrafficLightListenerManager { */ fun unRegisterEnterCrossRoadListener(@Nullable tag: String) { if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_TRAFFIC_LIGHT_LISTENER.remove(tag) @@ -96,7 +88,6 @@ object CallTrafficLightListenerManager { */ fun unRegisterEnterCrossRoadListener(@Nullable listener: IMoGoTrafficLightListener) { if (!M_TRAFFIC_LIGHT_LISTENER.containsValue(listener)) { - LogUtils.eTag(TAG, "listener:$listener not exists") return } M_TRAFFIC_LIGHT_LISTENER.forEach { @@ -110,7 +101,6 @@ object CallTrafficLightListenerManager { this.trafficLightResult = trafficLightResult M_TRAFFIC_LIGHT_LISTENER.forEach { val tag = it.key - //LogUtils.dTag(TAG, "invokeTrafficLightStatus tag is : $tag") val listener = it.value listener.onTrafficLightStatus(trafficLightResult) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt index e3632f3ec6..290738c337 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt @@ -2,13 +2,10 @@ package com.mogo.eagle.core.function.call.vip import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener -import com.mogo.eagle.core.utilcode.util.LogUtils import java.util.concurrent.ConcurrentHashMap object CallVipSetListenerManager { - private const val TAG = "CallVipSetListenerManager" - private val M_VIP_SET_LISTENER: ConcurrentHashMap = ConcurrentHashMap() @@ -24,7 +21,6 @@ object CallVipSetListenerManager { @Nullable listener: IMoGoVipSetListener ) { if (M_VIP_SET_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") return } listener.onVipSet(vipSet) @@ -37,7 +33,6 @@ object CallVipSetListenerManager { */ fun unRegisterVipSetListener(@Nullable tag: String) { if (!M_VIP_SET_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") return } M_VIP_SET_LISTENER.remove(tag) @@ -49,7 +44,6 @@ object CallVipSetListenerManager { */ fun unRegisterVipSetListener(@Nullable listener: IMoGoVipSetListener) { if (!M_VIP_SET_LISTENER.containsValue(listener)) { - LogUtils.eTag(TAG, "listener:$listener not exists") return } M_VIP_SET_LISTENER.forEach { diff --git a/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/BaseParams.java b/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/BaseParams.java index 7e938918fc..0955947248 100644 --- a/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/BaseParams.java +++ b/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/BaseParams.java @@ -1,8 +1,10 @@ package com.mogo.eagle.core.network; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NETWORK; + import android.text.TextUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import java.util.Iterator; import java.util.LinkedList; @@ -15,136 +17,136 @@ public abstract class BaseParams { private static final String TAG = "BaseParams"; - protected ConcurrentHashMap< String, Object > urlParams; + protected ConcurrentHashMap urlParams; protected BaseParams() { this.init(); } - public Object get( String key ) { - return this.urlParams != null && key != null ? this.urlParams.get( key ) : ""; + public Object get(String key) { + return this.urlParams != null && key != null ? this.urlParams.get(key) : ""; } - protected BaseParams( Map< String, Object > source ) { + protected BaseParams(Map source) { this.init(); Iterator iterator = source.entrySet().iterator(); - while ( iterator.hasNext() ) { - Map.Entry entry = ( Map.Entry ) iterator.next(); - this.put( ( String ) entry.getKey(), entry.getValue() ); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + this.put((String) entry.getKey(), entry.getValue()); } } - protected BaseParams( String key, Object value ) { + protected BaseParams(String key, Object value) { this.init(); - this.put( key, value ); + this.put(key, value); } - protected BaseParams( Object... keysAndValues ) { + protected BaseParams(Object... keysAndValues) { this.init(); int len = keysAndValues.length; - if ( len % 2 != 0 ) { - throw new IllegalArgumentException( "Supplied arguments must be even" ); + if (len % 2 != 0) { + throw new IllegalArgumentException("Supplied arguments must be even"); } else { - for ( int i = 0; i < len; i += 2 ) { - String key = String.valueOf( keysAndValues[i] ); + for (int i = 0; i < len; i += 2) { + String key = String.valueOf(keysAndValues[i]); Object value = keysAndValues[i + 1]; - this.put( key, value ); + this.put(key, value); } } } - private boolean checkValue( final Object value ) { - if ( value instanceof CharSequence ) { - return !TextUtils.isEmpty( ( CharSequence ) value ); + private boolean checkValue(final Object value) { + if (value instanceof CharSequence) { + return !TextUtils.isEmpty((CharSequence) value); } - if ( value == null || value.getClass() == null ) { + if (value == null || value.getClass() == null) { return false; } - final Class< ? > clazz = value.getClass(); + final Class clazz = value.getClass(); return clazz.isPrimitive() || - clazz.isAssignableFrom( Boolean.class ) || - clazz.isAssignableFrom( Character.class ) || - clazz.isAssignableFrom( Byte.class ) || - clazz.isAssignableFrom( Short.class ) || - clazz.isAssignableFrom( Integer.class ) || - clazz.isAssignableFrom( Long.class ) || - clazz.isAssignableFrom( Float.class ) || - clazz.isAssignableFrom( Double.class ); + clazz.isAssignableFrom(Boolean.class) || + clazz.isAssignableFrom(Character.class) || + clazz.isAssignableFrom(Byte.class) || + clazz.isAssignableFrom(Short.class) || + clazz.isAssignableFrom(Integer.class) || + clazz.isAssignableFrom(Long.class) || + clazz.isAssignableFrom(Float.class) || + clazz.isAssignableFrom(Double.class); } - private boolean checkKey( String key ) { - return !TextUtils.isEmpty( key ); + private boolean checkKey(String key) { + return !TextUtils.isEmpty(key); } - public BaseParams put( String key, Object value ) { - if ( checkKey( key ) && checkValue( value ) ) { - urlParams.put( key, value ); + public BaseParams put(String key, Object value) { + if (checkKey(key) && checkValue(value)) { + urlParams.put(key, value); } else { - Logger.e( TAG, "parameter key is illegal or parameter value is illegal" ); + CallerLogger.INSTANCE.e(M_NETWORK + TAG, "parameter key is illegal or parameter value is illegal"); } return this; } - public Object remove( String key ) { - return this.urlParams.remove( key ); + public Object remove(String key) { + return this.urlParams.remove(key); } public String toString() { StringBuilder result = new StringBuilder(); - Iterator< Map.Entry< String, Object > > iterator = this.urlParams.entrySet().iterator(); - while ( iterator.hasNext() ) { - Map.Entry< String, Object > entry = iterator.next(); - if ( result.length() > 0 ) { - result.append( "&" ); + Iterator> iterator = this.urlParams.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + if (result.length() > 0) { + result.append("&"); } - result.append( entry.getKey() ); - result.append( "=" ); - result.append( entry.getValue() ); + result.append(entry.getKey()); + result.append("="); + result.append(entry.getValue()); } return result.toString(); } private void init() { - this.urlParams = new ConcurrentHashMap< String, Object >(); + this.urlParams = new ConcurrentHashMap(); } - public List< BasicNameValuePair > getParamsList() { - LinkedList< BasicNameValuePair > pairs = new LinkedList< BasicNameValuePair >(); - Iterator< Map.Entry< String, Object > > iterator = this.urlParams.entrySet().iterator(); + public List getParamsList() { + LinkedList pairs = new LinkedList(); + Iterator> iterator = this.urlParams.entrySet().iterator(); - while ( iterator.hasNext() ) { - Map.Entry< String, Object > entry = iterator.next(); - pairs.add( new BasicNameValuePair( entry.getKey(), entry.getValue() ) ); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + pairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } return pairs; } - public Map< String, Object > getOriginMap() { + public Map getOriginMap() { return urlParams; } public String getParamString() { StringBuilder result = new StringBuilder(); - Iterator< BasicNameValuePair > iterator = getParamsList().iterator(); + Iterator iterator = getParamsList().iterator(); - while ( iterator.hasNext() ) { + while (iterator.hasNext()) { BasicNameValuePair parameter = iterator.next(); String key = parameter.getName(); Object value = parameter.getValue(); - if ( result.length() > 0 ) { - result.append( "&" ); + if (result.length() > 0) { + result.append("&"); } - result.append( key ); - result.append( "=" ); - result.append( value ); + result.append(key); + result.append("="); + result.append(value); } return result.toString(); @@ -154,7 +156,7 @@ public abstract class BaseParams { private String name; private Object value; - public BasicNameValuePair( String name, Object value ) { + public BasicNameValuePair(String name, Object value) { this.name = name; this.value = value; } @@ -163,7 +165,7 @@ public abstract class BaseParams { return name; } - public void setName( String name ) { + public void setName(String name) { this.name = name; } @@ -171,7 +173,7 @@ public abstract class BaseParams { return value; } - public void setValue( Object value ) { + public void setValue(Object value) { this.value = value; } } diff --git a/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/HttpParamsEx.java b/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/HttpParamsEx.java index b66bde1869..8cc29d18ce 100644 --- a/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/HttpParamsEx.java +++ b/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/HttpParamsEx.java @@ -1,8 +1,11 @@ package com.mogo.eagle.core.network; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NETWORK; + import android.text.TextUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; + /** * Created by congtaowang on 2018/10/21. @@ -12,13 +15,13 @@ public class HttpParamsEx extends HttpParams { private static final String TAG = "HttpParamsEx"; @Override - public BaseParams put( String key, Object value ) { + public BaseParams put(String key, Object value) { - if ( !TextUtils.isEmpty( key ) ) { - if ( value == null ) { - Logger.e( TAG, "%s with illegal value", key ); + if (!TextUtils.isEmpty(key)) { + if (value == null) { + CallerLogger.INSTANCE.e(M_NETWORK + TAG, key + " with illegal value"); } } - return super.put( key, value ); + return super.put(key, value); } } diff --git a/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/SubscribeImpl.java b/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/SubscribeImpl.java index c78cdd256f..3c5a354a61 100644 --- a/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/SubscribeImpl.java +++ b/core/mogo-core-network/src/main/java/com/mogo/eagle/core/network/SubscribeImpl.java @@ -1,8 +1,10 @@ package com.mogo.eagle.core.network; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NETWORK; + import com.mogo.eagle.core.data.BaseData; import com.mogo.eagle.core.network.utils.Util; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; @@ -11,49 +13,46 @@ import io.reactivex.disposables.Disposable; /** * Created by congtaowang on 2018/10/14. */ -public abstract class SubscribeImpl< T extends BaseData> implements Observer< T > { +public abstract class SubscribeImpl implements Observer { protected final RequestOptions mRequestOptions; private static final String TAG = "SubscribeImpl"; - private boolean mAutoTipMsg = true; - public SubscribeImpl(RequestOptions requestOptions ) { + public SubscribeImpl(RequestOptions requestOptions) { mRequestOptions = requestOptions; } - public SubscribeImpl(RequestOptions requestOptions, boolean autoTipMsg ) { - this( requestOptions ); - mAutoTipMsg = autoTipMsg; + public SubscribeImpl(RequestOptions requestOptions, boolean autoTipMsg) { + this(requestOptions); } private void onFinish() { - if ( !Util.checkAlive( mRequestOptions.getCaller() ) ) { + if (!Util.checkAlive(mRequestOptions.getCaller())) { } } @Override - public void onError( Throwable e ) { + public void onError(Throwable e) { onFinish(); - Logger.e( TAG, e, "occur when net request." ); + CallerLogger.INSTANCE.e(M_NETWORK + TAG, "occur when net request , exception : " + e); } @Override - public void onNext( T o ) { - if ( o != null ) { - if ( o.code != 0 && o.code!= 200 ) { - onError( o.msg, o.code ); + public void onNext(T o) { + if (o != null) { + if (o.code != 0 && o.code != 200) { + onError(o.msg, o.code); } else { - onSuccess( o ); + onSuccess(o); } } else { - onError( "", -1 ); + onError("", -1); } } - @Override - public void onSubscribe( Disposable d ) { + public void onSubscribe(Disposable d) { } @@ -62,16 +61,11 @@ public abstract class SubscribeImpl< T extends BaseData> implements Observer< T onFinish(); } - public void onSuccess( T o ) { + public void onSuccess(T o) { } - public void onError( String message, int code ) { - Logger.e( TAG, "%d - %s", code, message ); + public void onError(String message, int code) { + CallerLogger.INSTANCE.e(M_NETWORK + TAG, "onError code : " + code + " , message : " + message); } - private static boolean isTicketUpdated = false; - - private void onUpdateTicket() { - - } } diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/GestureTopCloseLayout.java b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/GestureTopCloseLayout.java index 7bd1eb7d26..a705ab0fc5 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/GestureTopCloseLayout.java +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/GestureTopCloseLayout.java @@ -9,7 +9,7 @@ import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.customview.widget.ViewDragHelper; -import com.mogo.eagle.core.utilcode.util.LogUtils; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import org.jetbrains.annotations.NotNull; @@ -24,7 +24,7 @@ public class GestureTopCloseLayout extends ConstraintLayout { private String TAG = "GestureTopCloseLayout"; - private ViewDragHelper mViewDragHelper; + private final ViewDragHelper mViewDragHelper; private ViewCloseListener mViewCloseListener; @@ -79,7 +79,7 @@ public class GestureTopCloseLayout extends ConstraintLayout { @Override public void onViewPositionChanged(@NonNull View changedView, int left, int top, int dx, int dy) { super.onViewPositionChanged(changedView, left, top, dx, dy); - LogUtils.wTag(TAG, "onViewPositionChanged==top=" + top + + CallerLogger.INSTANCE.i(TAG, "onViewPositionChanged==top=" + top + " changedView.getHeight()==" + changedView.getHeight()); if (top < 0) { mTop = top; @@ -96,7 +96,7 @@ public class GestureTopCloseLayout extends ConstraintLayout { //手指释放的时候回调 @Override public void onViewReleased(View releasedChild, float xvel, float yvel) { - LogUtils.wTag(TAG, "onViewReleased==mTop=" + mTop + " getHeight=" + getHeight()); + CallerLogger.INSTANCE.i(TAG, "onViewReleased==mTop=" + mTop + " getHeight=" + getHeight()); if (mTop < 0) { mViewDragHelper.settleCapturedViewAt(0, -getHeight()); invalidate(); diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java index a1737215ed..86a513a8a5 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/RoundConstraintLayout.java @@ -9,7 +9,6 @@ import android.util.AttributeSet; import androidx.constraintlayout.widget.ConstraintLayout; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; /** diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/TextureVideoView.java b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/TextureVideoView.java index b3568658fa..04390aa20e 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/TextureVideoView.java +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/TextureVideoView.java @@ -34,7 +34,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.widget.MediaController.MediaPlayerControl; -import com.mogo.eagle.core.utilcode.util.LogUtils; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import java.io.IOException; import java.util.Map; @@ -139,9 +139,9 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl public void setVideoURI(Uri uri, Map headers) { if (uri == null) { - LogUtils.iTag(TAG, "setVideoURI--- uri = null"); + CallerLogger.INSTANCE.i(TAG, "setVideoURI--- uri = null"); } else { - LogUtils.iTag(TAG, "setVideoURI--- uri = " + uri.getPath()); + CallerLogger.INSTANCE.i(TAG, "setVideoURI--- uri = " + uri.getPath()); } mUri = uri; mHeaders = headers; @@ -163,15 +163,15 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl @SuppressLint("NewApi") private void openVideo() { - LogUtils.iTag(TAG, "openVideo"); + CallerLogger.INSTANCE.i(TAG, "openVideo"); if (mUri == null) { - LogUtils.iTag(TAG, "mUri == null "); + CallerLogger.INSTANCE.i(TAG, "mUri == null "); } if (mSurface == null) { - LogUtils.iTag(TAG, "mSurface == null "); + CallerLogger.INSTANCE.i(TAG, "mSurface == null "); } if (mUri == null || mSurface == null || isSuspendFromActivity) { - LogUtils.iTag(TAG, "isSuspendFromActivity = " + isSuspendFromActivity); + CallerLogger.INSTANCE.i(TAG, "isSuspendFromActivity = " + isSuspendFromActivity); return; } release(false); @@ -219,20 +219,20 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl mVideoWidth = mp.getVideoWidth(); mVideoHeight = mp.getVideoHeight(); if (mVideoWidth != 0 && mVideoHeight != 0) { - LogUtils.dTag(TAG, "OnVideoSizeChangedListener mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight); + CallerLogger.INSTANCE.i(TAG, "OnVideoSizeChangedListener mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight); } } }; MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() { public void onPrepared(MediaPlayer mp) { - LogUtils.iTag(TAG, "MediaPlayer.OnPreparedListener"); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.OnPreparedListener"); mPrepareState = mCurrentState = STATE_PREPARED; mVideoWidth = mp.getVideoWidth(); mVideoHeight = mp.getVideoHeight(); int seekToPosition = mSeekWhenPrepared; -// LogUtils.iTag(TAG, "seekToPosition = " + seekToPosition); +// CallerLogger.INSTANCE.i(TAG, "seekToPosition = " + seekToPosition); if (seekToPosition != 0) { seekTo(seekToPosition); } @@ -250,9 +250,9 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } }; - private OnCompletionListener mCompletionListener = new OnCompletionListener() { + private final OnCompletionListener mCompletionListener = new OnCompletionListener() { public void onCompletion(MediaPlayer mp) { - LogUtils.iTag(TAG, "MediaPlayer.OnCompletionListener"); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.OnCompletionListener"); mTargetState = mCurrentState = STATE_PLAYBACK_COMPLETED; if (mOnCompletionListener != null) { mOnCompletionListener.onCompletion(mMediaPlayer); @@ -260,8 +260,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } }; - private OnSeekCompleteListener mSeekCompleteListener = mp -> { - LogUtils.iTag(TAG, "MediaPlayer.OnSeekCompleteListener"); + private final OnSeekCompleteListener mSeekCompleteListener = mp -> { + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.OnSeekCompleteListener"); try { mCurrentState = mMediaPlayer.isPlaying() ? STATE_PLAYING : STATE_PAUSED; } catch (Exception e) { @@ -270,9 +270,9 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } }; - private OnErrorListener mErrorListener = new OnErrorListener() { + private final OnErrorListener mErrorListener = new OnErrorListener() { public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { - LogUtils.iTag(TAG, "MediaPlayer.onError"); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.onError"); mTargetState = mPrepareState = mCurrentState = STATE_ERROR; if (mOnErrorListener != null) { mOnErrorListener.onError(mMediaPlayer, framework_err, @@ -283,11 +283,11 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } }; - private MediaPlayer.OnInfoListener mInfoListener = new MediaPlayer.OnInfoListener() { + private final MediaPlayer.OnInfoListener mInfoListener = new MediaPlayer.OnInfoListener() { @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { - LogUtils.iTag(TAG, "MediaPlayer.OnInfoListener---what = " + what + ";extra = " + extra); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.OnInfoListener---what = " + what + ";extra = " + extra); int messageId = 0; if (what == MEDIA_INFO_VIDEO_NOT_SUPPORTED) { messageId = R.string.VideoView_info_text_video_not_supported; @@ -304,9 +304,9 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } }; - private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener = new MediaPlayer.OnBufferingUpdateListener() { + private final MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener = new MediaPlayer.OnBufferingUpdateListener() { public void onBufferingUpdate(MediaPlayer mp, int percent) { - LogUtils.iTag(TAG, "MediaPlayer.OnBufferingUpdateListener"); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.OnBufferingUpdateListener"); mCurrentBufferPercentage = percent; } }; @@ -349,14 +349,14 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl SurfaceTextureListener mSurfaceTextureListener = new SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { - LogUtils.iTag(TAG, "onSurfaceTextureAvailable"); + CallerLogger.INSTANCE.i(TAG, "onSurfaceTextureAvailable"); mSurface = new Surface(surface); openVideo(); } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { - LogUtils.dTag(TAG, "onSurfaceTextureSizeChanged mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight); + CallerLogger.INSTANCE.i(TAG, "onSurfaceTextureSizeChanged mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight); boolean isValidState = (mTargetState == STATE_PLAYING); boolean hasValidSize = (mVideoWidth == width && mVideoHeight == height); if (mMediaPlayer != null && isValidState && hasValidSize) { @@ -374,7 +374,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { - LogUtils.iTag(TAG, "onSurfaceTextureDestroyed"); + CallerLogger.INSTANCE.i(TAG, "onSurfaceTextureDestroyed"); mSurface = null; release(false); return false; @@ -390,7 +390,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl * release the media player in any state */ private void release(boolean cleartargetstate) { - LogUtils.iTag(TAG, "release ---cleartargetstate=" + cleartargetstate); + CallerLogger.INSTANCE.i(TAG, "release ---cleartargetstate=" + cleartargetstate); mCurrentState = STATE_IDLE; if (cleartargetstate) { @@ -442,14 +442,14 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } public void start() { - LogUtils.iTag(TAG, "TextureVideoView---start"); + CallerLogger.INSTANCE.i(TAG, "TextureVideoView---start"); if (isFocusLoss) { mTagetStateBackup = STATE_PLAYING; return; } - //LogUtils.iTag(TAG, "mCurrentState = " + mCurrentState); + //CallerLogger.INSTANCE.i(TAG, "mCurrentState = " + mCurrentState); if (isInPlaybackState()) { - LogUtils.iTag(TAG, "MediaPlayer.start"); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.start"); mMediaPlayer.start(); mCurrentState = STATE_PLAYING; } @@ -457,11 +457,11 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } public void pause() { - LogUtils.iTag(TAG, "TextureVideoView---pause"); - LogUtils.iTag(TAG, "mCurrentState = " + mCurrentState); + CallerLogger.INSTANCE.i(TAG, "TextureVideoView---pause"); + CallerLogger.INSTANCE.i(TAG, "mCurrentState = " + mCurrentState); if (isInPlaybackState()) { if (mMediaPlayer.isPlaying()) { - LogUtils.iTag(TAG, " MediaPlayer.pause"); + CallerLogger.INSTANCE.i(TAG, " MediaPlayer.pause"); mMediaPlayer.pause(); mCurrentState = STATE_PAUSED; } @@ -470,7 +470,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } public void suspend() { - LogUtils.iTag(TAG, "TextureVideoView---suspend"); + CallerLogger.INSTANCE.i(TAG, "TextureVideoView---suspend"); if (!isSuspendFromActivity) { isSuspendFromActivity = true; if (mMediaPlayer != null) { @@ -483,15 +483,15 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } public void resume() { - LogUtils.iTag(TAG, "TextureVideoView---resume"); + CallerLogger.INSTANCE.i(TAG, "TextureVideoView---resume"); isSuspendFromActivity = false; openVideo(); seekTo(progressWhileSuspend); if (mTagetStateBackup == STATE_IDLE) mTagetStateBackup = mTargetState; - LogUtils.iTag(TAG, "isFocusLoss = " + isFocusLoss); - LogUtils.iTag(TAG, "isInPlaybackState() = " + isInPlaybackState()); + CallerLogger.INSTANCE.i(TAG, "isFocusLoss = " + isFocusLoss); + CallerLogger.INSTANCE.i(TAG, "isInPlaybackState() = " + isInPlaybackState()); if (isFocusLoss) { if (isInPlaybackState()) { if (mMediaPlayer.isPlaying()) { @@ -523,12 +523,12 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } public void seekTo(int msec) { - LogUtils.iTag(TAG, "TextureVideoView---seekTo---msec = " + msec); + CallerLogger.INSTANCE.i(TAG, "TextureVideoView---seekTo---msec = " + msec); if (isInPlaybackState() && mCurrentState != STATE_SEEKING && msec > 0 && msec < getDuration()) { mCurrentState = STATE_SEEKING; - LogUtils.iTag(TAG, "MediaPlayer.seekTo(msec) = " + msec); + CallerLogger.INSTANCE.i(TAG, "MediaPlayer.seekTo(msec) = " + msec); mMediaPlayer.seekTo(msec); mSeekWhenPrepared = 0; } else { @@ -592,7 +592,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl } public int getCurrentState() { - LogUtils.iTag(TAG, "mCurrentState == " + mCurrentState); + CallerLogger.INSTANCE.i(TAG, "mCurrentState == " + mCurrentState); return mCurrentState; } } diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt index 73fa7c5957..a21d99d459 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleSmallVideoPlayer.kt @@ -3,12 +3,10 @@ package com.mogo.eagle.core.widget.media.video import android.content.Context import android.os.Build import android.util.AttributeSet -import android.util.Log import android.view.Surface import android.view.View import android.widget.ImageView import android.widget.TextView -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.TimeTransformUtils import com.mogo.eagle.core.widget.R import com.shuyu.gsyvideoplayer.GSYVideoManager @@ -37,7 +35,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { private lateinit var fullscreen: ImageView private lateinit var currentTimeTextView: TextView private lateinit var totalTimeTextView: TextView - private var TAG: String = "NoticeSimpleSmallVideoPlayer" interface PlayListener { fun onPlayEvent(event: Int) @@ -73,7 +70,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { } override fun updateStartImage() { - Log.d(TAG, "updateStartImage"); when (mCurrentState) { GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.notice_video_pause) @@ -91,14 +87,13 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { forceChange: Boolean ) { super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange) - Log.d(TAG, "setProgressAndTime"); mBottomContainer?.visibility = View.VISIBLE mProgressBar?.visibility = View.VISIBLE - start?.visibility = View.VISIBLE - fullscreen?.visibility = View.GONE + start.visibility = View.VISIBLE + fullscreen.visibility = View.GONE //时间显示 - currentTimeTextView?.text = TimeTransformUtils.stringForTime(currentTime) - totalTimeTextView?.text = TimeTransformUtils.stringForTime(totalTime) + currentTimeTextView.text = TimeTransformUtils.stringForTime(currentTime) + totalTimeTextView.text = TimeTransformUtils.stringForTime(totalTime) if (progress != 0) { mProgressBar?.progress = progress @@ -115,7 +110,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun hideAllWidget() { super.hideAllWidget() - Log.d(TAG, "hideAllWidget"); mBottomContainer?.visibility = View.VISIBLE mProgressBar?.visibility = View.VISIBLE start?.visibility = View.VISIBLE @@ -124,14 +118,12 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun changeUiToPrepareingClear() { super.changeUiToPrepareingClear() - Log.d(TAG, "changeUiToPrepareingClear"); mBottomContainer?.visibility = View.INVISIBLE mProgressBar?.visibility = View.GONE } override fun changeUiToPlayingBufferingClear() { super.changeUiToPlayingBufferingClear() - Log.d(TAG, "changeUiToPlayingBufferingClear"); mBottomContainer?.visibility = View.INVISIBLE mProgressBar?.visibility = View.GONE @@ -143,7 +135,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun changeUiToCompleteClear() { super.changeUiToCompleteClear() - Log.d(TAG, "changeUiToCompleteClear"); mBottomContainer?.visibility = View.INVISIBLE mProgressBar?.visibility = View.GONE @@ -160,7 +151,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun onDetachedFromWindow() { super.onDetachedFromWindow() - Log.d(TAG, "onDetachedFromWindow"); mProgressBar?.progress = 0 mFullPauseBitmap = null @@ -171,10 +161,9 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { } override fun onCompletion() { - Logger.d(TAG, "onCompletion") mBottomContainer?.visibility = View.VISIBLE mProgressBar?.visibility = View.VISIBLE - start?.visibility = View.VISIBLE + start.visibility = View.VISIBLE start.setImageResource(R.drawable.notice_video_after_pause) isPostBufferUpdate = false @@ -182,7 +171,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun onSurfaceUpdated(surface: Surface) { super.onSurfaceUpdated(surface) - Logger.d(TAG, "onSurfaceUpdated") if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) { mThumbImageViewLayout.visibility = View.INVISIBLE } @@ -198,7 +186,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun onBufferingUpdate(percent: Int) { super.onBufferingUpdate(percent) - Logger.d(TAG, "onBufferingUpdate") if (!isPostBufferUpdate && percent == 0) { isPostBufferUpdate = true playListener?.onPlayEvent(PLAY_EVT_PLAY_BEGIN) @@ -220,7 +207,6 @@ class NoticeSimpleSmallVideoPlayer : StandardGSYVideoPlayer { override fun onSurfaceAvailable(surface: Surface) { super.onSurfaceAvailable(surface) - Logger.d(TAG, "onSurfaceAvailable") mProgressBar?.visibility = View.GONE if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) { if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) { diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt index 25f96c07ba..626c981f03 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt @@ -3,13 +3,10 @@ package com.mogo.eagle.core.widget.media.video import android.content.Context import android.os.Build import android.util.AttributeSet -import android.util.Log import android.view.Surface import android.view.View import android.widget.ImageView import android.widget.TextView -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.util.SharedPrefs import com.mogo.eagle.core.utilcode.util.TimeTransformUtils import com.mogo.eagle.core.widget.R import com.shuyu.gsyvideoplayer.GSYVideoManager diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt index 8c89792bba..352cf34acd 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt @@ -5,7 +5,6 @@ import android.util.AttributeSet import android.view.Surface import android.view.View import android.widget.ImageView -import androidx.core.view.postDelayed import com.mogo.eagle.core.widget.R import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.utils.GSYVideoType diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/TelephoneUtil.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/TelephoneUtil.java index 16fa392d83..246934e6bd 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/TelephoneUtil.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/TelephoneUtil.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.utilcode.mogo; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + import android.content.Context; import android.net.ConnectivityManager; import android.os.Build; @@ -7,7 +9,7 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -79,7 +81,7 @@ public class TelephoneUtil { if (getMobileDataEnabledMethod != null) { getMobileDataEnabledMethod.setAccessible(true); boolean result = (Boolean) getMobileDataEnabledMethod.invoke(iConMgr); - Logger.d("TelephoneUtil", "getMobileDataEnabled = " + result); + CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "getMobileDataEnabled = " + result); return result; } } catch (Exception e) { @@ -92,7 +94,7 @@ public class TelephoneUtil { Method getDataEnabled = telephonyService.getClass().getDeclaredMethod("getDataEnabled"); if (null != getDataEnabled) { boolean result = (Boolean) getDataEnabled.invoke(telephonyService); - Logger.d("TelephoneUtil", "getDataEnabled = " + result); + CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "getDataEnabled = " + result); return result; } } catch (Exception e) { @@ -119,7 +121,7 @@ public class TelephoneUtil { if (setMobileDataEnabledMethod != null) { setMobileDataEnabledMethod.setAccessible(true); setMobileDataEnabledMethod.invoke(iConMgr, enable); - Logger.d("TelephoneUtil", "setMobileDataEnabled = " + enable); + CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "setMobileDataEnabled = " + enable); } } catch (Exception e) { e.printStackTrace(); @@ -131,7 +133,7 @@ public class TelephoneUtil { Method setDataEnabledMethod = telephonyService.getClass().getDeclaredMethod("setDataEnabled", boolean.class); if (null != setDataEnabledMethod) { setDataEnabledMethod.invoke(telephonyService, enable); - Logger.d("TelephoneUtil", "setDataEnabled = " + enable); + CallerLogger.INSTANCE.d(M_UTIL + "TelephoneUtil", "setDataEnabled = " + enable); } } catch (Exception e) { e.printStackTrace(); 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/GlideBlurTransformation.java index ed4fb8253c..6458b189c9 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/GlideBlurTransformation.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.utilcode.mogo.glide; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + import android.content.Context; import android.graphics.Bitmap; import android.renderscript.Allocation; @@ -7,16 +9,17 @@ import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicBlur; +import androidx.annotation.NonNull; + import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.bitmap.CenterCrop; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; - -import androidx.annotation.NonNull; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; /** * 使用Glide加载图片时,使该图片进行高斯模糊 * 基本用法:Glide.with(this).load(userInfo.headImgurl).apply(RequestOptions.bitmapTransform(GlideBlurTransformation(this))).into(ivCardBg) - * 如果想用多个Transform可以使用{@link com.bumptech.glide.load.MultiTransformation} 进行Transform的融合 + * 如果想用多个Transform可以使用{@link com.bumptech.glide.load.MultiTransformation} 进行Transform的融合 + * * @author tongchenfei */ public class GlideBlurTransformation extends CenterCrop { @@ -26,6 +29,7 @@ public class GlideBlurTransformation extends CenterCrop { private Context context; private float blurRadius; private float outScale; + public GlideBlurTransformation(Context context) { this(context, DEFAULT_BLUR_RADIUS); } @@ -44,7 +48,7 @@ public class GlideBlurTransformation extends CenterCrop { protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { Bitmap bitmap = super.transform(pool, toTransform, outWidth, outHeight); - Logger.d("GlideBlurTransformation", "transform=== blurRadius: " + blurRadius + " " + + CallerLogger.INSTANCE.d(M_UTIL + "GlideBlurTransformation", "transform=== blurRadius: " + blurRadius + " " + "outScale: " + outScale); return blurBitmap(bitmap, blurRadius, (int) (outWidth * outScale), (int) (outHeight * outScale)); } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/CallerLogger.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/CallerLogger.kt new file mode 100644 index 0000000000..4ff1f03247 --- /dev/null +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/CallerLogger.kt @@ -0,0 +1,31 @@ +package com.mogo.eagle.core.utilcode.mogo.logger + +import com.mogo.eagle.core.utilcode.mogo.logger.scene.Scene.Companion.scene + +object CallerLogger { + + fun i(tag: String, message: String) { + if (scene.check(tag)) { + Logger.i(tag, message, null) + } + } + + fun d(tag: String, message: String) { + if (scene.check(tag)) { + Logger.d(tag, message, null) + } + } + + fun w(tag: String, message: String) { + if (scene.check(tag)) { + Logger.w(tag, message, null) + } + } + + fun e(tag: String, message: String) { + if (scene.check(tag)) { + Logger.e(tag, message, null) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/scene/Scene.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/Scene.kt similarity index 79% rename from core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/scene/Scene.kt rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/Scene.kt index 3364e35736..328c75b916 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/scene/Scene.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/Scene.kt @@ -1,12 +1,11 @@ -package com.mogo.eagle.core.function.call.devatools.scene +package com.mogo.eagle.core.utilcode.mogo.logger.scene import android.util.ArrayMap -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_ADAS -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_DEVA -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_NETWORK -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_OTHER -import com.mogo.eagle.core.data.deva.scene.SceneConstant.Companion.M_ROUTE -import com.mogo.eagle.core.data.deva.scene.SceneLogCache +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_NETWORK +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OTHER +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OLD_ROUTE import java.util.* class Scene { @@ -28,7 +27,7 @@ class Scene { //初始化ADAS val adasMap = SceneLogCache(mutableMapOf(), true) - sceneCache[M_ADAS] = adasMap + sceneCache[M_ADAS_IMPL] = adasMap //初始化deva val devaMap = SceneLogCache(mutableMapOf(), true) @@ -36,7 +35,7 @@ class Scene { //初始化路径规划 val routeMap = SceneLogCache(mutableMapOf(), true) - sceneCache[M_ROUTE] = routeMap + sceneCache[M_OLD_ROUTE] = routeMap //初始化其他模块,方便定位索引 val otherMap = SceneLogCache(mutableMapOf(), true) diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/scene/SceneConstant.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt similarity index 54% rename from core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/scene/SceneConstant.kt rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt index b8cef5423a..bd4366734f 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/scene/SceneConstant.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt @@ -1,25 +1,30 @@ -package com.mogo.eagle.core.data.deva.scene +package com.mogo.eagle.core.utilcode.mogo.logger.scene class SceneConstant { companion object { - //lib包 - const val M_ADAS = "LIB-ADAS_" //核心module const val M_NETWORK = "CORE-NETWORK_" + const val M_UTIL = "CORE-UTIL_" //core业务module const val M_ADAS_IMPL = "CORE-ADAS_" + const val M_CORDER = "CORE-CORDER_" const val M_CHAT = "CORE-CHAT_" const val M_DEVA = "CORE-DEVA_" const val M_DISPATCH = "CORE-DISPATCH_" const val M_HMI = "CORE-HMI_" + const val M_MAIN = "CORE-MAIN_" + const val M_MAP = "CORE-MAP_" + const val M_MONITOR = "CORE-MONITOR_" + const val M_NOTICE = "CORE-NOTICE_" const val M_OBU = "CORE-OBU_" const val M_V2X = "CORE-V2X_" //旧module - const val M_ROUTE = "OLD-MODULE-SERVICE_" + const val M_OLD_ROUTE = "OLD-ROUTE-SERVICE_" + const val M_OLD_OTHER = "OLD-OTHER-SERVICE_" const val M_OTHER = "ALL-MODULES_" } } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/scene/SceneLogCache.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneLogCache.kt similarity index 81% rename from core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/scene/SceneLogCache.kt rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneLogCache.kt index 818f7c3bcc..d524e9283f 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/scene/SceneLogCache.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneLogCache.kt @@ -1,4 +1,4 @@ -package com.mogo.eagle.core.data.deva.scene +package com.mogo.eagle.core.utilcode.mogo.logger.scene class SceneLogCache { diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/SQLBaseDao.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/SQLBaseDao.java index b20c512084..e33af50d4f 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/SQLBaseDao.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/SQLBaseDao.java @@ -1,10 +1,12 @@ package com.mogo.eagle.core.utilcode.mogo.sqlite; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.utils.sqlite.annotation.DbField; import com.mogo.utils.sqlite.annotation.DbTable; @@ -55,7 +57,7 @@ public class SQLBaseDao implements SQLIDao { //执行Sql进行自动建表 String createTableSql = getCreateTableSql(); - Logger.d(TAG, "执行SQL:" + createTableSql); + CallerLogger.INSTANCE.d(M_UTIL + TAG, "执行SQL:" + createTableSql); sqLiteDatabase.execSQL(createTableSql); //初始化缓存空间 @@ -391,7 +393,7 @@ public class SQLBaseDao implements SQLIDao { e.printStackTrace(); } } - Logger.d(TAG, "contentValues:" + contentValues); + CallerLogger.INSTANCE.d(M_UTIL + TAG, "contentValues:" + contentValues); return contentValues; } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/proxy/BaseDaoProxyLog.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/proxy/BaseDaoProxyLog.kt index ce22e3f982..c792b7460f 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/proxy/BaseDaoProxyLog.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/sqlite/proxy/BaseDaoProxyLog.kt @@ -1,6 +1,7 @@ package com.mogo.utils.sqlite.proxy -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_UTIL import java.lang.reflect.InvocationHandler import java.lang.reflect.Method import java.lang.reflect.Proxy @@ -12,6 +13,10 @@ import java.lang.reflect.Proxy class BaseDaoProxyLog : InvocationHandler { + companion object { + private const val TAG = "BaseDaoProxyLog" + } + private var target: Any? = null /** @@ -24,8 +29,8 @@ class BaseDaoProxyLog : InvocationHandler { this.target = target //取得代理对象 return Proxy.newProxyInstance( - target.javaClass.classLoader, - target.javaClass.interfaces, this + target.javaClass.classLoader, + target.javaClass.interfaces, this ) } @@ -39,11 +44,11 @@ class BaseDaoProxyLog : InvocationHandler { @Throws(Throwable::class) override fun invoke(proxy: Any, method: Method, args: Array): Any? { //反射方法前调用 - Logger.i("SQL数据库管理", "当前执行>>${method.name}>>") + CallerLogger.i("$M_UTIL$TAG", "SQL数据库管理 当前执行>>${method.name}>>") //反射执行方法 相当于调用target.sayHelllo; val result: Any? = method.invoke(target, *args) //反射方法后调用. - Logger.i("SQL数据库管理", "执行结果>>$result") + CallerLogger.i("$M_UTIL$TAG", "SQL数据库管理 执行结果>>$result") return result } } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/toast/TipToast.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/toast/TipToast.java index 997abed4ae..4974612e11 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/toast/TipToast.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/toast/TipToast.java @@ -10,6 +10,8 @@ package com.mogo.eagle.core.utilcode.mogo.toast; * @Version 1.1 */ +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + import android.content.Context; import android.os.Handler; import android.text.TextUtils; @@ -17,14 +19,13 @@ import android.view.Gravity; import android.view.View; import android.widget.Toast; -import androidx.annotation.NonNull; import androidx.core.view.ViewCompat; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleEventObserver; import androidx.lifecycle.LifecycleOwner; import com.mogo.eagle.core.utilcode.kotlin.ExtensionsKt; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; /** @@ -40,111 +41,111 @@ public final class TipToast { private static Context sContext; private static ToastViewGenerator sGenerator; - public static void init( Context context, ToastViewGenerator generator ) { + public static void init(Context context, ToastViewGenerator generator) { TipToast.sContext = context.getApplicationContext(); - sHandler = new Handler( context.getMainLooper() ); + sHandler = new Handler(context.getMainLooper()); sGenerator = generator; } public static void recycle() { sContext = null; sHandler = null; - if ( sToast != null ) { + if (sToast != null) { sToast.cancel(); sToast = null; } sGenerator = null; } - private static void tip( final String message, int duration ,TipDrawable tipDrawable) { - if ( !checkParams() ) { + private static void tip(final String message, int duration, TipDrawable tipDrawable) { + if (!checkParams()) { return; } - if ( TextUtils.isEmpty( message ) ) { + if (TextUtils.isEmpty(message)) { return; } new ToastThread(new StringToastRunnable(sContext, message, duration, tipDrawable)).start(); } - private static void tip( final int msgId, int duration,TipDrawable tipDrawable ) { - if ( !checkParams() ) { + private static void tip(final int msgId, int duration, TipDrawable tipDrawable) { + if (!checkParams()) { return; } try { - if ( TextUtils.isEmpty( ResourcesHelper.getString( sContext, msgId ) ) ) { + if (TextUtils.isEmpty(ResourcesHelper.getString(sContext, msgId))) { return; } - } catch ( Exception e ) { + } catch (Exception e) { return; } - tip( ResourcesHelper.getString( sContext, msgId ), duration ,tipDrawable); + tip(ResourcesHelper.getString(sContext, msgId), duration, tipDrawable); } private static boolean checkParams() { - if ( sContext == null ) { - Logger.e( TAG, "context can't be null." ); + if (sContext == null) { + CallerLogger.INSTANCE.e(M_UTIL + TAG, "context can't be null."); return false; } - if ( sHandler == null ) { - Logger.e( TAG, "sHandler can't be null." ); + if (sHandler == null) { + CallerLogger.INSTANCE.e(M_UTIL + TAG, "sHandler can't be null."); return false; } return true; } - public static void tip( final String message ) { - tip( message, Toast.LENGTH_SHORT,null ); + public static void tip(final String message) { + tip(message, Toast.LENGTH_SHORT, null); } - public static void tip( final int msgId ) { - tip( msgId, Toast.LENGTH_SHORT ,null); + public static void tip(final int msgId) { + tip(msgId, Toast.LENGTH_SHORT, null); } - public static void longTip( String message ) { - tip( message, Toast.LENGTH_LONG ,null); + public static void longTip(String message) { + tip(message, Toast.LENGTH_LONG, null); } - public static void longTip( int msgId ) { - tip( msgId, Toast.LENGTH_LONG ,null); + public static void longTip(int msgId) { + tip(msgId, Toast.LENGTH_LONG, null); } - public static void shortTip( String message ) { - tip( message, Toast.LENGTH_SHORT ,null); + public static void shortTip(String message) { + tip(message, Toast.LENGTH_SHORT, null); } - public static void shortTip( int msgId ) { - tip( msgId, Toast.LENGTH_SHORT ,null); + public static void shortTip(int msgId) { + tip(msgId, Toast.LENGTH_SHORT, null); } // -===带图片的方法===- - public static void tip( final String message,TipDrawable tipDrawable ) { - tip( message, Toast.LENGTH_SHORT,tipDrawable ); + public static void tip(final String message, TipDrawable tipDrawable) { + tip(message, Toast.LENGTH_SHORT, tipDrawable); } - public static void tip( final int msgId,TipDrawable tipDrawable ) { - tip( msgId, Toast.LENGTH_SHORT ,tipDrawable); + public static void tip(final int msgId, TipDrawable tipDrawable) { + tip(msgId, Toast.LENGTH_SHORT, tipDrawable); } - public static void longTip( String message,TipDrawable tipDrawable ) { - tip( message, Toast.LENGTH_LONG ,tipDrawable); + public static void longTip(String message, TipDrawable tipDrawable) { + tip(message, Toast.LENGTH_LONG, tipDrawable); } - public static void longTip( int msgId ,TipDrawable tipDrawable) { - tip( msgId, Toast.LENGTH_LONG ,tipDrawable); + public static void longTip(int msgId, TipDrawable tipDrawable) { + tip(msgId, Toast.LENGTH_LONG, tipDrawable); } - public static void shortTip( String message,TipDrawable tipDrawable ) { - tip( message, Toast.LENGTH_SHORT ,tipDrawable); + public static void shortTip(String message, TipDrawable tipDrawable) { + tip(message, Toast.LENGTH_SHORT, tipDrawable); } - public static void shortTip( int msgId,TipDrawable tipDrawable ) { - tip( msgId, Toast.LENGTH_SHORT ,tipDrawable); + public static void shortTip(int msgId, TipDrawable tipDrawable) { + tip(msgId, Toast.LENGTH_SHORT, tipDrawable); } static class ToastThread extends Thread { - public ToastThread( Runnable runnable ) { - super( runnable ); + public ToastThread(Runnable runnable) { + super(runnable); } } @@ -156,7 +157,7 @@ public final class TipToast { int duration; TipDrawable tipDrawable; - public StringToastRunnable( Context context, String msg, int duration,TipDrawable tipDrawable ) { + public StringToastRunnable(Context context, String msg, int duration, TipDrawable tipDrawable) { this.context = context; this.msg = msg; this.duration = duration; @@ -166,33 +167,33 @@ public final class TipToast { @Override public void run() { - if ( sHandler == null ) { + if (sHandler == null) { return; } sHandler.post(() -> { - synchronized ( sSyncObject ) { - if ( context == null ) { + synchronized (sSyncObject) { + if (context == null) { return; } - if ( sToast != null) { + if (sToast != null) { View view = sToast.getView(); if (view != null && ViewCompat.isAttachedToWindow(view)) { sToast.cancel(); } } - if ( sGenerator == null ) { - sToast = Toast.makeText( context, msg, duration ); + if (sGenerator == null) { + sToast = Toast.makeText(context, msg, duration); } else { - sToast = new Toast( context ); - final View view = sGenerator.make( context, msg, tipDrawable ); + sToast = new Toast(context); + final View view = sGenerator.make(context, msg, tipDrawable); - if ( view != null ) { - sToast.setView( view ); - sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() ); - sToast.setDuration( duration ); + if (view != null) { + sToast.setView(view); + sToast.setGravity(sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset()); + sToast.setDuration(duration); } else { - sToast = Toast.makeText( context, msg, duration ); + sToast = Toast.makeText(context, msg, duration); } } View view = sToast.getView(); @@ -204,7 +205,7 @@ public final class TipToast { } }); } - if ( sToast != null ) { + if (sToast != null) { sToast.show(); } } @@ -213,7 +214,7 @@ public final class TipToast { } public interface ToastViewGenerator { - View make( Context context, String message,TipDrawable tipDrawable ); + View make(Context context, String message, TipDrawable tipDrawable); default int gravity() { return Gravity.CENTER; diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/AppUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/AppUtils.java index c4133b9577..003aabf9b0 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/AppUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/AppUtils.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.utilcode.util; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + import android.app.Activity; import android.app.ActivityManager; import android.content.ComponentName; @@ -15,7 +17,6 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; -import android.util.Log; import java.io.File; import java.util.ArrayList; @@ -24,6 +25,8 @@ import java.util.List; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; + /** *
  *     author: Blankj
@@ -40,16 +43,16 @@ public final class AppUtils {
         throw new UnsupportedOperationException("u can't instantiate me...");
     }
 
-    public static String getCustomMapSDKVersion(Context context){
-        return   getApplicationMetaValue(context,MOGO_MAP_SDK_VERSION);
+    public static String getCustomMapSDKVersion(Context context) {
+        return getApplicationMetaValue(context, MOGO_MAP_SDK_VERSION);
     }
 
-    private static String getApplicationMetaValue(Context context,String metaName){
+    private static String getApplicationMetaValue(Context context, String metaName) {
         try {
-            ApplicationInfo  applicationInfo =  context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA);
+            ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
             Bundle bundle = applicationInfo.metaData;
-            if (bundle != null){
-                return  bundle.getString(metaName);
+            if (bundle != null) {
+                return bundle.getString(metaName);
             }
         } catch (PackageManager.NameNotFoundException e) {
             e.printStackTrace();
@@ -57,23 +60,23 @@ public final class AppUtils {
         return "";
     }
 
-    public static String getApplicationLabel( Context context, String pkgName ) {
+    public static String getApplicationLabel(Context context, String pkgName) {
         try {
             PackageManager pm = context.getPackageManager();
-            ApplicationInfo appInfo = pm.getApplicationInfo( pkgName, PackageManager.GET_META_DATA );
-            return pm.getApplicationLabel( appInfo ).toString();
-        } catch ( Exception e ) {
+            ApplicationInfo appInfo = pm.getApplicationInfo(pkgName, PackageManager.GET_META_DATA);
+            return pm.getApplicationLabel(appInfo).toString();
+        } catch (Exception e) {
             return null;
         }
     }
 
-    public static boolean isAppForeground( Context context ) {
-        if ( context != null ) {
-            ActivityManager activityManager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
-            List< ActivityManager.RunningAppProcessInfo > processes = activityManager.getRunningAppProcesses();
-            for ( ActivityManager.RunningAppProcessInfo processInfo : processes ) {
-                if ( processInfo.processName.equals( context.getPackageName() ) ) {
-                    if ( processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND ) {
+    public static boolean isAppForeground(Context context) {
+        if (context != null) {
+            ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+            List processes = activityManager.getRunningAppProcesses();
+            for (ActivityManager.RunningAppProcessInfo processInfo : processes) {
+                if (processInfo.processName.equals(context.getPackageName())) {
+                    if (processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
                         return true;
                     }
                 }
@@ -82,13 +85,13 @@ public final class AppUtils {
         return false;
     }
 
-    public static boolean isAppForeground( Context context, String pkg ) {
-        if ( context != null ) {
-            ActivityManager activityManager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
-            List< ActivityManager.RunningAppProcessInfo > processes = activityManager.getRunningAppProcesses();
-            for ( ActivityManager.RunningAppProcessInfo processInfo : processes ) {
-                if ( processInfo.processName.equals( pkg ) ) {
-                    if ( processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND ) {
+    public static boolean isAppForeground(Context context, String pkg) {
+        if (context != null) {
+            ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+            List processes = activityManager.getRunningAppProcesses();
+            for (ActivityManager.RunningAppProcessInfo processInfo : processes) {
+                if (processInfo.processName.equals(pkg)) {
+                    if (processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
                         return true;
                     }
                 }
@@ -98,13 +101,13 @@ public final class AppUtils {
     }
 
     //获取已安装应用的 uid,-1 表示未安装此应用或程序异常
-    public static int getPackageUid( Context context, String packageName ) {
+    public static int getPackageUid(Context context, String packageName) {
         try {
-            ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo( packageName, 0 );
-            if ( applicationInfo != null ) {
+            ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(packageName, 0);
+            if (applicationInfo != null) {
                 return applicationInfo.uid;
             }
-        } catch ( Exception e ) {
+        } catch (Exception e) {
             return -1;
         }
         return -1;
@@ -118,15 +121,15 @@ public final class AppUtils {
      * @param uid     已安装应用的 uid
      * @return true 表示正在运行,false 表示没有运行
      */
-    public static boolean isProcessRunning( Context context, int uid ) {
-        if ( context == null ) {
+    public static boolean isProcessRunning(Context context, int uid) {
+        if (context == null) {
             return false;
         }
-        ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
-        List< ActivityManager.RunningServiceInfo > runningServiceInfos = am.getRunningServices( 200 );
-        if ( runningServiceInfos.size() > 0 ) {
-            for ( ActivityManager.RunningServiceInfo appProcess : runningServiceInfos ) {
-                if ( uid == appProcess.uid ) {
+        ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+        List runningServiceInfos = am.getRunningServices(200);
+        if (runningServiceInfos.size() > 0) {
+            for (ActivityManager.RunningServiceInfo appProcess : runningServiceInfos) {
+                if (uid == appProcess.uid) {
                     return true;
                 }
             }
@@ -343,7 +346,7 @@ public final class AppUtils {
         if (UtilsBridge.isSpace(packageName)) return;
         Intent launchAppIntent = UtilsBridge.getLaunchAppIntent(packageName);
         if (launchAppIntent == null) {
-            Log.e("AppUtils", "Didn't exist launcher activity.");
+            CallerLogger.INSTANCE.e(M_UTIL + "AppUtils", "Didn't exist launcher activity.");
             return;
         }
         Utils.getApp().startActivity(launchAppIntent);
@@ -364,7 +367,7 @@ public final class AppUtils {
     public static void relaunchApp(final boolean isKillProcess) {
         Intent intent = UtilsBridge.getLaunchAppIntent(Utils.getApp().getPackageName());
         if (intent == null) {
-            Log.e("AppUtils", "Didn't exist launcher activity.");
+            CallerLogger.INSTANCE.e(M_UTIL + "AppUtils", "Didn't exist launcher activity.");
             return;
         }
         intent.addFlags(
@@ -779,30 +782,30 @@ public final class AppUtils {
         return result;
     }
 
-    public static boolean isApplicationBroughtToBackground( final Context context ) {
-        ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
-        List< ActivityManager.RunningTaskInfo > tasks = am.getRunningTasks( 1 );
-        if ( !tasks.isEmpty() ) {
-            ComponentName topActivity = tasks.get( 0 ).topActivity;
-            if ( !topActivity.getPackageName().equals( context.getPackageName() ) ) {
+    public static boolean isApplicationBroughtToBackground(final Context context) {
+        ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+        List tasks = am.getRunningTasks(1);
+        if (!tasks.isEmpty()) {
+            ComponentName topActivity = tasks.get(0).topActivity;
+            if (!topActivity.getPackageName().equals(context.getPackageName())) {
                 return true;
             }
         }
         return false;
     }
 
-    public static boolean isAppInstalled( Context context, String pkg ) {
+    public static boolean isAppInstalled(Context context, String pkg) {
         PackageInfo packageInfo;
-        if ( TextUtils.isEmpty( pkg ) ) {
+        if (TextUtils.isEmpty(pkg)) {
             return false;
         }
         try {
-            packageInfo = context.getPackageManager().getPackageInfo( pkg, 0 );
-        } catch ( PackageManager.NameNotFoundException e ) {
+            packageInfo = context.getPackageManager().getPackageInfo(pkg, 0);
+        } catch (PackageManager.NameNotFoundException e) {
             packageInfo = null;
             e.printStackTrace();
         }
-        if ( packageInfo == null ) {
+        if (packageInfo == null) {
             return false;
         } else {
             return true;
@@ -810,7 +813,6 @@ public final class AppUtils {
     }
 
 
-
     /**
      * Return the application's information.
      * 
    @@ -926,13 +928,13 @@ public final class AppUtils { */ public static class AppInfo { - private String packageName; - private String name; + private String packageName; + private String name; private Drawable icon; - private String packagePath; - private String versionName; - private int versionCode; - private boolean isSystem; + private String packagePath; + private String versionName; + private int versionCode; + private boolean isSystem; public Drawable getIcon() { return icon; diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BitmapHelper.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BitmapHelper.java index d71d639458..73c14c65c9 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BitmapHelper.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BitmapHelper.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.utilcode.util; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + import android.annotation.SuppressLint; import android.content.ContentUris; import android.content.Context; @@ -22,9 +24,9 @@ import android.provider.DocumentsContract; import android.provider.MediaStore; import android.text.TextUtils; import android.util.Base64; -import android.util.Log; import com.elegant.utils.IOUtils; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import java.io.ByteArrayOutputStream; import java.io.File; @@ -121,14 +123,14 @@ public class BitmapHelper { if ( quality == 100 ) { fullSize = bos.size(); } - Log.i( TAG, "quality<---->size, " + quality + "<---->" + bos.size() / 1024 ); + CallerLogger.INSTANCE.i( M_UTIL + TAG, "quality<---->size, " + quality + "<---->" + bos.size() / 1024 ); } while ( bos.size() > maxSizeOfBytes && ( quality -= ( fullSize > ONE_MB ) ? 10 : 5 ) >= 0 ); result = bos.toByteArray(); final long end = System.currentTimeMillis(); - Log.i( TAG, + CallerLogger.INSTANCE.i( M_UTIL + TAG, "bitmap to bytes costs " + ( end - start ) + "ms, \n" + "bitmap full size is " + ( fullSize / 1024 ) + "kb, \n" + "bitmap final size is " + ( bos.size() / 1024 ) + "kb, \n" + @@ -295,7 +297,7 @@ public class BitmapHelper { sampleSize = sampleSize << 1; } - Log.i( TAG, "sample size is " + sampleSize ); + CallerLogger.INSTANCE.i( M_UTIL + TAG, "sample size is " + sampleSize ); return sampleSize; } @@ -336,7 +338,7 @@ public class BitmapHelper { } catch ( Exception e ) { e.printStackTrace(); } - Log.i( TAG, "ExifInterface, degree is " + degree ); + CallerLogger.INSTANCE.i( M_UTIL + TAG, "ExifInterface, degree is " + degree ); return degree; } @@ -414,7 +416,7 @@ public class BitmapHelper { final long start = System.currentTimeMillis(); if ( bitmap == null || file == null ) { - Log.i( TAG, "保存失败, bitmap or file is null." ); + CallerLogger.INSTANCE.i( M_UTIL + TAG, "保存失败, bitmap or file is null." ); return; } if ( file.getParentFile() != null && !file.getParentFile().exists() ) { @@ -428,13 +430,13 @@ public class BitmapHelper { fos.close(); if ( file.exists() ) { - Log.i( TAG, "保存成功" ); + CallerLogger.INSTANCE.i(M_UTIL + TAG, "保存成功" ); } } catch ( Exception e ) { e.printStackTrace(); } - Log.i( TAG, "saving picture costs " + ( System.currentTimeMillis() - start ) + "ms" ); + CallerLogger.INSTANCE.i( M_UTIL + TAG, "saving picture costs " + ( System.currentTimeMillis() - start ) + "ms" ); } /** diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BusUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BusUtils.java index 1c90569332..56e0b3afcd 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BusUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/BusUtils.java @@ -1,6 +1,7 @@ package com.mogo.eagle.core.utilcode.util; -import android.util.Log; + +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -19,6 +20,8 @@ import java.util.concurrent.CopyOnWriteArraySet; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; + /** *
      *     author: Blankj
    @@ -118,7 +121,7 @@ public final class BusUtils {
                     isNeedRecordTags = true;
                 }
                 if (buses.contains(bus)) {
    -                Log.w(TAG, "The bus of <" + bus + "> already registered.");
    +                CallerLogger.INSTANCE.w(M_UTIL + TAG, "The bus of <" + bus + "> already registered.");
                     return;
                 } else {
                     buses.add(bus);
    @@ -168,7 +171,7 @@ public final class BusUtils {
         private void consumeSticky(final Object bus, final String tag, final Object arg) {
             List busInfoList = mTag_BusInfoListMap.get(tag);
             if (busInfoList == null) {
    -            Log.e(TAG, "The bus of tag <" + tag + "> is not exists.");
    +            CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
                 return;
             }
             for (BusInfo busInfo : busInfoList) {
    @@ -195,7 +198,7 @@ public final class BusUtils {
             synchronized (mClassName_BusesMap) {
                 Set buses = mClassName_BusesMap.get(className);
                 if (buses == null || !buses.contains(bus)) {
    -                Log.e(TAG, "The bus of <" + bus + "> was not registered before.");
    +                CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of <" + bus + "> was not registered before.");
                     return;
                 }
                 buses.remove(bus);
    @@ -209,9 +212,9 @@ public final class BusUtils {
         private void postInner(final String tag, final Object arg, final boolean sticky) {
             List busInfoList = mTag_BusInfoListMap.get(tag);
             if (busInfoList == null) {
    -            Log.e(TAG, "The bus of tag <" + tag + "> is not exists.");
    +            CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
                 if (mTag_BusInfoListMap.isEmpty()) {
    -                Log.e(TAG, "Please check whether the bus plugin is applied.");
    +                CallerLogger.INSTANCE.e(M_UTIL + TAG, "Please check whether the bus plugin is applied.");
                 }
                 return;
             }
    @@ -316,7 +319,7 @@ public final class BusUtils {
                 }
                 if (buses.size() == 0) {
                     if (!sticky) {
    -                    Log.e(TAG, "The " + busInfo + " was not registered before.");
    +                    CallerLogger.INSTANCE.e(M_UTIL + TAG, "The " + busInfo + " was not registered before.");
                     }
                     return;
                 }
    @@ -347,7 +350,7 @@ public final class BusUtils {
         private void postStickyInner(final String tag, final Object arg) {
             List busInfoList = mTag_BusInfoListMap.get(tag);
             if (busInfoList == null) {
    -            Log.e(TAG, "The bus of tag <" + tag + "> is not exists.");
    +            CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
                 return;
             }
             // 获取多对象,然后消费各个 busInfoList
    @@ -371,7 +374,7 @@ public final class BusUtils {
         private void removeStickyInner(final String tag) {
             List busInfoList = mTag_BusInfoListMap.get(tag);
             if (busInfoList == null) {
    -            Log.e(TAG, "The bus of tag <" + tag + "> is not exists.");
    +            CallerLogger.INSTANCE.e(M_UTIL + TAG, "The bus of tag <" + tag + "> is not exists.");
                 return;
             }
             for (BusInfo busInfo : busInfoList) {
    diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java
    index e82067d439..a0c2d559fa 100644
    --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java
    +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java
    @@ -1,5 +1,7 @@
     package com.mogo.eagle.core.utilcode.util;
     
    +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL;
    +
     import android.content.res.Resources;
     import android.graphics.Bitmap;
     import android.graphics.Canvas;
    @@ -14,7 +16,6 @@ import android.graphics.drawable.Drawable;
     import android.graphics.drawable.StateListDrawable;
     import android.os.Build;
     import android.os.SystemClock;
    -import android.util.Log;
     import android.util.StateSet;
     import android.view.MotionEvent;
     import android.view.TouchDelegate;
    @@ -24,6 +25,8 @@ import androidx.annotation.IntRange;
     import androidx.annotation.NonNull;
     import androidx.core.view.ViewCompat;
     
    +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
    +
     /**
      * 
      *     author: Blankj
    @@ -358,7 +361,7 @@ public class ClickUtils {
                                            final int expandSizeBottom) {
             final View parentView = (View) view.getParent();
             if (parentView == null) {
    -            Log.e("ClickUtils", "expandClickArea must have parent view.");
    +            CallerLogger.INSTANCE.e(M_UTIL + "ClickUtils", "expandClickArea must have parent view.");
                 return;
             }
             parentView.post(new Runnable() {
    diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/DialogUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/DialogUtils.java
    deleted file mode 100644
    index 1e8e2d55e4..0000000000
    --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/DialogUtils.java
    +++ /dev/null
    @@ -1,130 +0,0 @@
    -package com.mogo.eagle.core.utilcode.util;//package com.blankj.utilcode.util;
    -//
    -//import android.app.Activity;
    -//import android.app.Dialog;
    -//import android.content.Context;
    -//import android.content.ContextWrapper;
    -//import android.graphics.drawable.ColorDrawable;
    -//import android.os.Build;
    -//import android.support.annotation.LayoutRes;
    -//import android.support.annotation.NonNull;
    -//import android.util.Log;
    -//import android.view.LayoutInflater;
    -//import android.view.View;
    -//import android.view.Window;
    -//
    -//import java.util.HashMap;
    -//import java.util.TreeSet;
    -//
    -///**
    -// * 
    -// *     author: blankj
    -// *     blog  : http://blankj.com
    -// *     time  : 2019/08/26
    -// *     desc  : utils about dialog
    -// * 
    -// */ -//public class DialogUtils { -// -// private DialogUtils() { -// throw new UnsupportedOperationException("u can't instantiate me..."); -// } -// -// public static void show(final Dialog dialog) { -// if (dialog == null) return; -// Utils.runOnUiThread(new Runnable() { -// @Override -// public void run() { -// Activity activity = getActivityByContext(dialog.getContext()); -// if (!isActivityAlive(activity)) return; -// dialog.show(); -// } -// }); -// } -// -// public static void dismiss(final Dialog dialog) { -// if (dialog == null) return; -// Utils.runOnUiThread(new Runnable() { -// @Override -// public void run() { -// dialog.dismiss(); -// } -// }); -// } -// -// public static void show(final Utils.TransActivityDelegate delegate) { -// Utils.TransActivity.start(null, delegate); -// } -// -// public static Dialog create(Activity activity, @LayoutRes int layoutId) { -// Dialog dialog = new Dialog(activity); -// View dialogContent = LayoutInflater.from(activity).inflate(layoutId, null); -// -// dialog.setContentView(dialogContent); -// Window window = dialog.getWindow(); -// if (window != null) { -// window.setBackgroundDrawable(new ColorDrawable(0)); -// } -// -// return dialog; -// } -// -// private static boolean isActivityAlive(final Activity activity) { -// return activity != null && !activity.isFinishing() -// && (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !activity.isDestroyed()); -// } -// -// private static Activity getActivityByContext(Context context) { -// if (context instanceof Activity) return (Activity) context; -// while (context instanceof ContextWrapper) { -// if (context instanceof Activity) { -// return (Activity) context; -// } -// context = ((ContextWrapper) context).getBaseContext(); -// } -// return null; -// } -// -// public static final class UtilsDialog extends Dialog { -// -// private int mPriority = 5; -// -// public UtilsDialog(@NonNull Context context) { -// this(context, 0); -// } -// -// public UtilsDialog(@NonNull Context context, int themeResId) { -// super(context, themeResId); -// } -// -// @Override -// public void show() { -// Utils.runOnUiThread(new Runnable() { -// @Override -// public void run() { -// Activity activity = getActivityByContext(getContext()); -// if (!isActivityAlive(activity)) { -// Log.w("DialogUtils", "Activity is not alive."); -// return; -// } -// UtilsDialog.super.show(); -// } -// }); -// } -// -// @Override -// public void dismiss() { -// Utils.runOnUiThread(new Runnable() { -// @Override -// public void run() { -// UtilsDialog.super.dismiss(); -// } -// }); -// } -// -// public void show(int priority) { -// mPriority = priority; -// show(); -// } -// } -//} diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/FileIOUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/FileIOUtils.java index 2bbe5bcdff..5812274aea 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/FileIOUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/FileIOUtils.java @@ -1,6 +1,9 @@ package com.mogo.eagle.core.utilcode.util; -import android.util.Log; + +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_UTIL; + +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -157,7 +160,7 @@ public final class FileIOUtils { final boolean append, final OnProgressUpdateListener listener) { if (is == null || !UtilsBridge.createOrExistsFile(file)) { - Log.e("FileIOUtils", "create file <" + file + "> failed."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed."); return false; } OutputStream os = null; @@ -377,18 +380,18 @@ public final class FileIOUtils { final boolean append, final boolean isForce) { if (bytes == null) { - Log.e("FileIOUtils", "bytes is null."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "bytes is null."); return false; } if (!UtilsBridge.createOrExistsFile(file)) { - Log.e("FileIOUtils", "create file <" + file + "> failed."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed."); return false; } FileChannel fc = null; try { fc = new FileOutputStream(file, append).getChannel(); if (fc == null) { - Log.e("FileIOUtils", "fc is null."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null."); return false; } fc.position(fc.size()); @@ -467,14 +470,14 @@ public final class FileIOUtils { final boolean append, final boolean isForce) { if (bytes == null || !UtilsBridge.createOrExistsFile(file)) { - Log.e("FileIOUtils", "create file <" + file + "> failed."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed."); return false; } FileChannel fc = null; try { fc = new FileOutputStream(file, append).getChannel(); if (fc == null) { - Log.e("FileIOUtils", "fc is null."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null."); return false; } MappedByteBuffer mbb = fc.map(FileChannel.MapMode.READ_WRITE, fc.size(), bytes.length); @@ -544,7 +547,7 @@ public final class FileIOUtils { final boolean append) { if (file == null || content == null) return false; if (!UtilsBridge.createOrExistsFile(file)) { - Log.e("FileIOUtils", "create file <" + file + "> failed."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "create file <" + file + "> failed."); return false; } BufferedWriter bw = null; @@ -869,7 +872,7 @@ public final class FileIOUtils { try { fc = new RandomAccessFile(file, "r").getChannel(); if (fc == null) { - Log.e("FileIOUtils", "fc is null."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null."); return new byte[0]; } ByteBuffer byteBuffer = ByteBuffer.allocate((int) fc.size()); @@ -913,7 +916,7 @@ public final class FileIOUtils { try { fc = new RandomAccessFile(file, "r").getChannel(); if (fc == null) { - Log.e("FileIOUtils", "fc is null."); + CallerLogger.INSTANCE.e(M_UTIL + "FileIOUtils", "fc is null."); return new byte[0]; } int size = (int) fc.size(); diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/httpdns/MogoHttpDns.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/httpdns/MogoHttpDns.java index b0c7e16e38..d8f1845293 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/httpdns/MogoHttpDns.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/httpdns/MogoHttpDns.java @@ -7,7 +7,6 @@ import androidx.annotation.Keep; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.cloud.httpdns.MogoHttpDnsClient; import com.mogo.cloud.httpdns.listener.OnAddressChangedListener; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; @Keep @Route(path = HttpDnsConst.PATH) @@ -21,7 +20,6 @@ public class MogoHttpDns implements IMogoHttpDns { @Override public String syncGetHttpDns(String host, int type, boolean useCache) { - Logger.d(TAG, "getHttpDnsIp host: " + host + " type: " + type); return MogoHttpDnsClient.INSTANCE.syncGetHttpDns(host, type, useCache); } @@ -32,7 +30,6 @@ public class MogoHttpDns implements IMogoHttpDns { @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { - Logger.d(TAG, "getHttpDnsIp host: " + host + " type: " + type); if (useCache) { String address = MogoHttpDnsClient.INSTANCE.getHttpDnsCachedAddress(type, host); if (address != null) { diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/locationinfo/MogoLocationInfoServices.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/locationinfo/MogoLocationInfoServices.java index 303cad6b9d..69f954ccda 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/locationinfo/MogoLocationInfoServices.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/locationinfo/MogoLocationInfoServices.java @@ -6,7 +6,7 @@ import androidx.annotation.Keep; import com.mogo.cloud.location.LocationManager; import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.service.cloud.location.IMogoLocationInfoService; @Keep @@ -39,7 +39,7 @@ public class MogoLocationInfoServices implements IMogoLocationInfoService { @Override public void provideLocation(MogoLocation location) { mLocation = location; - // Logger.d(TAG, "sdk - provideLocation"); + // CallerLogger.INSTANCE.d(TAG, "sdk - provideLocation"); } public MogoLocation getLocation() { @@ -49,18 +49,18 @@ public class MogoLocationInfoServices implements IMogoLocationInfoService { @Override public void start() { LocationManager.getInstance().start(); - Logger.d(TAG, "sdk - start"); + CallerLogger.INSTANCE.d(TAG, "sdk - start"); } @Override public void stop() { LocationManager.getInstance().stop(); - Logger.d(TAG, "sdk - stop"); + CallerLogger.INSTANCE.d(TAG, "sdk - stop"); } @Override public void init(Context context) { LocationManager.getInstance().init(context); - Logger.d(TAG, "sdk - init"); + CallerLogger.INSTANCE.d(TAG, "sdk - init"); } } diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java index 12aabde734..9ba6cd1ca1 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java @@ -9,7 +9,7 @@ import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener; import com.mogo.cloud.socket.SocketManager; import com.mogo.cloud.socket.entity.MsgBody; import com.mogo.cloud.socket.third.core.ConnectionLifecycleListener; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.service.cloud.socket.IMogoLifecycleListener; import com.mogo.service.cloud.socket.IMogoMsgAckListener; import com.mogo.service.cloud.socket.IMogoOnMessageListener; @@ -79,7 +79,7 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem @Override public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) { if (mListeners.containsKey(msgType)) { - Logger.w(TAG, "msgType %d is exist.", msgType); + CallerLogger.INSTANCE.w(TAG, "msgType is exist : " + msgType); return; } if (!mListeners.containsKey(msgType)) { @@ -129,7 +129,7 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem @Override public void sendMsg(MsgBody body, IMogoMsgAckListener listener) { - Logger.d(TAG, "sendMsg."); + CallerLogger.INSTANCE.d(TAG, "sendMsg."); mAckListeners.put(body.getMsgId(), listener); MsgBody msgBody = new MsgBody(); msgBody.msgType(body.getMsgType()); @@ -168,15 +168,15 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem @Override public void onMsgReceived(int msgType, Object obj) { if (obj == null) { - Logger.e(TAG,"Failed to parse the received message!"); + CallerLogger.INSTANCE.e(TAG, "Failed to parse the received message!"); return; } - Logger.d(TAG,"onMsgReceived obj className : " + obj.getClass().getName()); + CallerLogger.INSTANCE.d(TAG, "onMsgReceived obj className : " + obj.getClass().getName()); List listeners = mListeners.get(msgType); if (listeners != null && !listeners.isEmpty()) { for (IMogoOnMessageListener listener : listeners) { if (listener != null) { - Logger.d(TAG, "received msgId = %s, content = %s", mAckListeners.get(msgType), obj.toString()); + CallerLogger.INSTANCE.d(TAG, "received msgId = " + mAckListeners.get(msgType) + " content = " + obj.toString()); listener.onMsgReceived(obj); } } @@ -186,9 +186,9 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem @Override public void onConnectSuccess() { - if (mLifeCycleListeners.size() > 0){ - for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){ - if (lifecycleListener != null){ + if (mLifeCycleListeners.size() > 0) { + for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()) { + if (lifecycleListener != null) { lifecycleListener.onConnectSuccess(); } } @@ -197,9 +197,9 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem @Override public void onConnectFailure() { - if (mLifeCycleListeners.size() > 0){ - for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){ - if (lifecycleListener != null){ + if (mLifeCycleListeners.size() > 0) { + for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()) { + if (lifecycleListener != null) { lifecycleListener.onConnectFailure(); } } @@ -208,9 +208,9 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem @Override public void onConnectLost(boolean reconnect) { - if (mLifeCycleListeners.size() > 0){ - for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){ - if (lifecycleListener != null){ + if (mLifeCycleListeners.size() > 0) { + for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()) { + if (lifecycleListener != null) { lifecycleListener.onConnectLost(); } } 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 afe552723b..7fb679dd8f 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 @@ -20,7 +20,7 @@ import com.mogo.commons.crash.FinalizeCrashFixer; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.device.Devices; import com.mogo.commons.network.NetConfigUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.toast.TipDrawable; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; import com.mogo.eagle.core.utilcode.util.AppStateManager; @@ -29,7 +29,6 @@ import com.mogo.eagle.core.utilcode.util.CleanUtils; import com.mogo.eagle.core.utilcode.util.ThreadPoolService; import com.mogo.eagle.core.utilcode.util.Utils; -import io.reactivex.functions.Consumer; import io.reactivex.plugins.RxJavaPlugins; /** @@ -66,7 +65,7 @@ public abstract class AbsMogoApplication extends Application { private void initRxJavaErrorHandler() { RxJavaPlugins.setErrorHandler(throwable -> { - Logger.e("RxJava", throwable, null); + CallerLogger.INSTANCE.e("RxJava", "" + throwable); }); } @@ -184,7 +183,7 @@ public abstract class AbsMogoApplication extends Application { return; } if (!dnsCacheIp.equals(cacheIp)) { - Logger.d("TEST-SOCKET", "获取缓存Dns IP : " + dnsCacheIp + " , 原缓存 IP : " + cacheIp); + CallerLogger.INSTANCE.d("TEST-SOCKET", "获取缓存Dns IP : " + dnsCacheIp + " , 原缓存 IP : " + cacheIp); socketTTL(); this.cacheIp = dnsCacheIp; } diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/crash/FinalizeCrashFixer.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/crash/FinalizeCrashFixer.java index fcde90869f..63ea19249f 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/crash/FinalizeCrashFixer.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/crash/FinalizeCrashFixer.java @@ -1,12 +1,8 @@ package com.mogo.commons.crash; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.AppStateManager; -import com.mogo.eagle.core.utilcode.util.IAppStateListener; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleEventObserver; -import androidx.lifecycle.ProcessLifecycleOwner; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -40,10 +36,10 @@ public class FinalizeCrashFixer { AppStateManager.INSTANCE.registerAppStateListener(isForeground -> { if (isForeground) { //前后台则重新反射关闭一遍,避免线程被再次开启 - Logger.d("FinalizeCrashFixer", "--- 切换到前台 ---"); - } else { + CallerLogger.INSTANCE.d("FinalizeCrashFixer", "--- 切换到前台 ---"); + } else { //前后台则重新反射关闭一遍,避免线程被再次开启 - Logger.d("FinalizeCrashFixer", "--- 切换到后台 ---"); + CallerLogger.INSTANCE.d("FinalizeCrashFixer", "--- 切换到后台 ---"); } realFix(); }); diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java index a4d5ef62b7..ba9dd04351 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/device/Devices.java @@ -7,7 +7,6 @@ import android.database.Cursor; import android.net.Uri; import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.ThreadPoolService; public @@ -35,7 +34,6 @@ class Devices { super.onChange( selfChange ); ThreadPoolService.execute( () -> { checkBindState(); - Logger.d( TAG, "lock status changed. the last val = " + sIsBind ); } ); } } ); diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/network/ParamsUtil.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/network/ParamsUtil.java index 1fedba756f..38c0ce82b2 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/network/ParamsUtil.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/network/ParamsUtil.java @@ -3,6 +3,9 @@ package com.mogo.commons.network; import android.os.Build; import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.collection.ArrayMap; + import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; @@ -11,7 +14,7 @@ import com.mogo.eagle.core.network.Constants; import com.mogo.eagle.core.network.LocationHelper; import com.mogo.eagle.core.network.ServerParam; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.CommonUtils; import com.mogo.eagle.core.utilcode.util.DeviceIdUtils; import com.mogo.eagle.core.utilcode.util.WindowUtils; @@ -21,70 +24,67 @@ import java.net.URLEncoder; import java.util.Map; import java.util.Set; -import androidx.annotation.NonNull; -import androidx.collection.ArrayMap; import okhttp3.RequestBody; public class ParamsUtil { private static final String TAG = "ParamsUtil"; - public static Map< String, Object > getDynamicParams() { - Map< String, Object > params = new ArrayMap(); + public static Map getDynamicParams() { + Map params = new ArrayMap(); - final Map< String, Object > location = LocationHelper.getInstance().getLocationProperties(); - if ( location != null ) { - params.putAll( location ); + final Map location = LocationHelper.getInstance().getLocationProperties(); + if (location != null) { + params.putAll(location); } - params.put( ServerParam.NET_TYPE, CommonUtils.getNetworkType( AbsMogoApplication.getApp() ) ); - params.put( ServerParam.CELL_ID, Utils.getCellId( AbsMogoApplication.getApp() ) ); + params.put(ServerParam.NET_TYPE, CommonUtils.getNetworkType(AbsMogoApplication.getApp())); + params.put(ServerParam.CELL_ID, Utils.getCellId(AbsMogoApplication.getApp())); // params.put( ServerParam.DISPLAY_ID, DeviceUtil.getSystemVersion() ); - params.put( ServerParam.SN, MoGoAiCloudClientConfig.getInstance().getSn()); - params.put( ServerParam.TICKET, SpStorage.getTicket() ); + params.put(ServerParam.SN, MoGoAiCloudClientConfig.getInstance().getSn()); + params.put(ServerParam.TICKET, SpStorage.getTicket()); return params; } - private static final Map< String, Object > STATIC_PARAMS = new ArrayMap<>(); + private static final Map STATIC_PARAMS = new ArrayMap<>(); static { - STATIC_PARAMS.put( ServerParam.BRAND, Build.BRAND ); - STATIC_PARAMS.put( ServerParam.MANUFACTURER, Build.MANUFACTURER ); - STATIC_PARAMS.put( ServerParam.MODEL, Build.MODEL ); - STATIC_PARAMS.put( ServerParam.PRODUCT, Build.PRODUCT ); - STATIC_PARAMS.put( ServerParam.OS, Constants.OS ); - STATIC_PARAMS.put( ServerParam.OS_VERSION, Build.VERSION.RELEASE ); - STATIC_PARAMS.put( ServerParam.MOBILE_MODEL, CommonUtils.getModel() ); - STATIC_PARAMS.put( ServerParam.VERSION_CODE, CommonUtils.getVersionCode( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.VERSION_NAME, CommonUtils.getVersionName( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.SCREEN_PIXELS, WindowUtils.getScreenPixels( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.ANDROID_ID, CommonUtils.getAndroidID( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.DEVICE_ID, DeviceIdUtils.getDeviceId( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.IMEI, CommonUtils.getIMEI( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.IMSI, CommonUtils.getIMSI( AbsMogoApplication.getApp() ) ); - STATIC_PARAMS.put( ServerParam.FOTA_VERSION, Utils.getFotaVersion() ); - STATIC_PARAMS.put( ServerParam.END_POINT, ServerParam.END_POINT_CAR ); + STATIC_PARAMS.put(ServerParam.BRAND, Build.BRAND); + STATIC_PARAMS.put(ServerParam.MANUFACTURER, Build.MANUFACTURER); + STATIC_PARAMS.put(ServerParam.MODEL, Build.MODEL); + STATIC_PARAMS.put(ServerParam.PRODUCT, Build.PRODUCT); + STATIC_PARAMS.put(ServerParam.OS, Constants.OS); + STATIC_PARAMS.put(ServerParam.OS_VERSION, Build.VERSION.RELEASE); + STATIC_PARAMS.put(ServerParam.MOBILE_MODEL, CommonUtils.getModel()); + STATIC_PARAMS.put(ServerParam.VERSION_CODE, CommonUtils.getVersionCode(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.VERSION_NAME, CommonUtils.getVersionName(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.SCREEN_PIXELS, WindowUtils.getScreenPixels(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.ANDROID_ID, CommonUtils.getAndroidID(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.DEVICE_ID, DeviceIdUtils.getDeviceId(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.IMEI, CommonUtils.getIMEI(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.IMSI, CommonUtils.getIMSI(AbsMogoApplication.getApp())); + STATIC_PARAMS.put(ServerParam.FOTA_VERSION, Utils.getFotaVersion()); + STATIC_PARAMS.put(ServerParam.END_POINT, ServerParam.END_POINT_CAR); } - public static Map< String, Object > getStaticParams() { + public static Map getStaticParams() { return STATIC_PARAMS; } - public static Map< String, Object > getAnalyticsCustomParams() { - Map< String, Object > map = new ArrayMap<>(); - map.put( "debug", DebugConfig.isDebug() ? 1 : 0 ); + public static Map getAnalyticsCustomParams() { + Map map = new ArrayMap<>(); + map.put("debug", DebugConfig.isDebug() ? 1 : 0); String fota = Utils.getFotaVersion(); - map.put( "systemversion", TextUtils.isEmpty( fota ) ? DebugConfig.getProductFlavor() : fota ); - map.put( "sn", MoGoAiCloudClientConfig.getInstance().getSn() ); + map.put("systemversion", TextUtils.isEmpty(fota) ? DebugConfig.getProductFlavor() : fota); + map.put("sn", MoGoAiCloudClientConfig.getInstance().getSn()); return map; } - public static RequestBody convert( Map< String, Object > map ) { - String json = GsonUtil.getGson().toJson( map ); - Logger.d( TAG, "request params: %s", json ); - RequestBody requestBody = RequestBody.create( okhttp3.MediaType.parse( "application/json; charset=utf-8" ), json ); - return requestBody; + public static RequestBody convert(Map map) { + String json = GsonUtil.getGson().toJson(map); + CallerLogger.INSTANCE.d(TAG, "request params : " + json); + return RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json); } /** @@ -95,43 +95,43 @@ public class ParamsUtil { * @param businessParams query 串中不需要保留的参数,一般为业务参数 * @return */ - public static String toQueryUrl( @NonNull String url, Map< String, Object > params, Map< String, Object > businessParams ) { + public static String toQueryUrl(@NonNull String url, Map params, Map businessParams) { - if ( TextUtils.isEmpty( url ) ) { + if (TextUtils.isEmpty(url)) { return url; } - params = diff( params, businessParams ); - if ( params == null || params.isEmpty() ) { + params = diff(params, businessParams); + if (params == null || params.isEmpty()) { return url; } - final Set< String > keys = params.keySet(); + final Set keys = params.keySet(); StringBuilder builder = new StringBuilder(); - for ( String key : keys ) { - if ( TextUtils.isEmpty( key ) ) { - Logger.w( TAG, "key is illegal" ); + for (String key : keys) { + if (TextUtils.isEmpty(key)) { + CallerLogger.INSTANCE.w(TAG, "key is illegal"); continue; } - final Object value = params.get( key ); - if ( value == null ) { - Logger.w( TAG, "%s - value is illegal", key ); + final Object value = params.get(key); + if (value == null) { + CallerLogger.INSTANCE.w(TAG, key + " value is illegal"); continue; } String targetValue = value.toString(); try { - targetValue = URLEncoder.encode( targetValue, "utf-8" ); - } catch ( UnsupportedEncodingException e ) { + targetValue = URLEncoder.encode(targetValue, "utf-8"); + } catch (UnsupportedEncodingException e) { targetValue = value.toString(); } - builder.append( key ).append( "=" ).append( targetValue ).append( "&" ); + builder.append(key).append("=").append(targetValue).append("&"); } String queryString = builder.toString(); - if ( queryString.endsWith( "&" ) ) { - queryString = queryString.substring( 0, queryString.length() - 1 ); + if (queryString.endsWith("&")) { + queryString = queryString.substring(0, queryString.length() - 1); } - if ( !url.endsWith( "?" ) ) { + if (!url.endsWith("?")) { url += "?"; } return url + queryString; @@ -142,15 +142,15 @@ public class ParamsUtil { * @param child 业务参数 * @return */ - public static Map< String, Object > diff( Map< String, Object > parent, Map< String, Object > child ) { - if ( parent == null || parent.isEmpty() || child == null || child.isEmpty() ) { + public static Map diff(Map parent, Map child) { + if (parent == null || parent.isEmpty() || child == null || child.isEmpty()) { return parent; } - for ( String key : child.keySet() ) { - if ( TextUtils.isEmpty( key ) || TextUtils.equals( "extra_id", key ) ) { + for (String key : child.keySet()) { + if (TextUtils.isEmpty(key) || TextUtils.equals("extra_id", key)) { continue; } - parent.remove( key ); + parent.remove(key); } return parent; } diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java index fbd8980400..d719a47846 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java @@ -3,7 +3,7 @@ package com.mogo.commons.voice; import android.content.Context; import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.tts.base.IMogoTTS; import com.mogo.tts.base.MogoTTSConstants; @@ -23,11 +23,11 @@ public class AIAssist { private IMogoTTS mTTS; - public static AIAssist getInstance( Context context ) { - if ( sInstance == null ) { - synchronized ( AIAssist.class ) { - if ( sInstance == null ) { - sInstance = new AIAssist( context ); + public static AIAssist getInstance(Context context) { + if (sInstance == null) { + synchronized (AIAssist.class) { + if (sInstance == null) { + sInstance = new AIAssist(context); } } } @@ -35,20 +35,20 @@ public class AIAssist { } public synchronized void release() { - if ( mTTS != null ) { + if (mTTS != null) { try { mTTS.release(); - } catch ( Exception e ) { - Logger.e( TAG, e, "release" ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "release has exception : " + e); } } sInstance = null; } - private AIAssist( Context context ) { + private AIAssist(Context context) { try { - mTTS = ( IMogoTTS ) ARouter.getInstance().build( MogoTTSConstants.API_PATH ).navigation( context.getApplicationContext() ); + mTTS = (IMogoTTS) ARouter.getInstance().build(MogoTTSConstants.API_PATH).navigation(context.getApplicationContext()); } catch (Exception e) { e.printStackTrace(); ToastUtils.showShort("TTS 模块初始化异常"); @@ -61,7 +61,7 @@ public class AIAssist { * @return */ public boolean hasFlush() { - if ( mTTS != null ) { + if (mTTS != null) { return mTTS.hasFlush(); } return false; @@ -72,9 +72,9 @@ public class AIAssist { * * @param text */ - public void speakTTSVoice( String text, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { - mTTS.speakTTSVoice( text, callBack ); + public void speakTTSVoice(String text, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { + mTTS.speakTTSVoice(text, callBack); } } @@ -83,9 +83,9 @@ public class AIAssist { * * @param text */ - public void speakTTSVoice( String text ) { - if ( mTTS != null ) { - mTTS.speakTTSVoice( text ); + public void speakTTSVoice(String text) { + if (mTTS != null) { + mTTS.speakTTSVoice(text); } } @@ -95,11 +95,11 @@ public class AIAssist { * @param text 播报内容 * @param type 播报策略 */ - public void speakTTSVoice( String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { + public void speakTTSVoice(String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { PreemptType preemptType = PreemptType.PREEMPT_TYPE_NONE; - if ( type != null ) { - switch ( type ) { + if (type != null) { + switch (type) { case PREEMPT_TYPE_FLUSH: preemptType = PreemptType.PREEMPT_TYPE_FLUSH; break; @@ -114,18 +114,18 @@ public class AIAssist { break; } } - mTTS.speakTTSVoice( text, preemptType, callBack ); + mTTS.speakTTSVoice(text, preemptType, callBack); } } public void stopSpeakTts(String tts) { - if ( mTTS != null ) { + if (mTTS != null) { mTTS.stopSpeakTts(tts); } } public void stopTts() { - if ( mTTS != null ) { + if (mTTS != null) { mTTS.stopTts(); } } @@ -135,9 +135,9 @@ public class AIAssist { * * @param tts 播报内容 */ - public void speakQAndACmd( String tts, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { - mTTS.speakQAndACmd( tts, callBack ); + public void speakQAndACmd(String tts, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { + mTTS.speakQAndACmd(tts, callBack); } } @@ -148,9 +148,9 @@ public class AIAssist { * @param okCmds 确认命令唤醒词 * @param cancelCmds 取消命令唤醒词 */ - public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { - mTTS.speakQAndACmd( tts, okCmds, cancelCmds, callBack ); + public void speakQAndACmd(String tts, String[] okCmds, String[] cancelCmds, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { + mTTS.speakQAndACmd(tts, okCmds, cancelCmds, callBack); } } @@ -161,9 +161,9 @@ public class AIAssist { * @param cmdWords * @param callBack */ - public void registerUnWakeupCommand( String cmd, String[] cmdWords, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { - mTTS.registerUnWakeupCommand( cmd, cmdWords, callBack ); + public void registerUnWakeupCommand(String cmd, String[] cmdWords, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { + mTTS.registerUnWakeupCommand(cmd, cmdWords, callBack); } } @@ -172,9 +172,9 @@ public class AIAssist { * * @param cmd */ - public synchronized void unregisterUnWakeupCommand( String cmd ) { - if ( mTTS != null ) { - mTTS.unregisterUnWakeupCommand( cmd ); + public synchronized void unregisterUnWakeupCommand(String cmd) { + if (mTTS != null) { + mTTS.unregisterUnWakeupCommand(cmd); } } @@ -183,47 +183,47 @@ public class AIAssist { * * @param cmd */ - public synchronized void unregisterUnWakeupCommand( String cmd, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { - mTTS.unregisterUnWakeupCommand( cmd, callBack ); + public synchronized void unregisterUnWakeupCommand(String cmd, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { + mTTS.unregisterUnWakeupCommand(cmd, callBack); } } - public void startAssistant( Context context ) { - startAssistant( context, 1 ); + public void startAssistant(Context context) { + startAssistant(context, 1); } /** * @param context * @param status window_start_cancel 0 - 结束, 1 - 显示, 2 - 未激活调试进入 */ - public void startAssistant( Context context, int status ) { - if ( mTTS != null ) { - mTTS.startAIAssist( context, status ); + public void startAssistant(Context context, int status) { + if (mTTS != null) { + mTTS.startAIAssist(context, status); } } public synchronized void flush() { - if ( mTTS != null ) { + if (mTTS != null) { mTTS.flush(); } } - public void speakTTSAndDuck( String text ) { - if ( mTTS != null ) { - mTTS.speakTTSAndDuck( text ); + public void speakTTSAndDuck(String text) { + if (mTTS != null) { + mTTS.speakTTSAndDuck(text); } } - public void speakTTSAndDuck( String text, IMogoVoiceCmdCallBack callBack ) { - if ( mTTS != null ) { - mTTS.speakTTSAndDuck( text, callBack ); + public void speakTTSAndDuck(String text, IMogoVoiceCmdCallBack callBack) { + if (mTTS != null) { + mTTS.speakTTSAndDuck(text, callBack); } } - public void shutUp( String ttsId, String text ) { - if ( mTTS != null ) { - mTTS.shutUp( ttsId, text ); + public void shutUp(String ttsId, String text) { + if (mTTS != null) { + mTTS.shutUp(ttsId, text); } } @@ -232,14 +232,14 @@ public class AIAssist { * 语音SDK生效版本从1.0.8.4版本起 */ public void breakOffSpeak() { - if ( mTTS != null ) { + if (mTTS != null) { mTTS.breakOffSpeak(); } } - public void clearTTSCallback( String text ) { - if ( mTTS != null ) { - mTTS.clearTTSCallback( text ); + public void clearTTSCallback(String text) { + if (mTTS != null) { + mTTS.clearTTSCallback(text); } } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapMarkerClickHandler.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapMarkerClickHandler.java index 90a7c36970..e81481c168 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapMarkerClickHandler.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapMarkerClickHandler.java @@ -1,6 +1,8 @@ package com.mogo.map.impl.custom; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import static com.mogo.map.marker.MarkerType.MAP_STATIC; + +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.impl.custom.marker.AMapMarkerWrapper; import com.mogo.map.impl.custom.marker.MarkerWrapperClickHelper; import com.mogo.map.marker.IMogoMarker; @@ -11,8 +13,6 @@ import com.zhidaoauto.map.sdk.open.marker.Marker; import java.util.Map; -import static com.mogo.map.marker.MarkerType.MAP_STATIC; - /** * @author congtaowang * @since 2019-12-24 @@ -51,10 +51,10 @@ public class AMapMarkerClickHandler { return false; } //地图道路上静态数,暂时只过滤traffic类型下发点击事件 - if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())){ - IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker,new MogoMarkerOptions()); + if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())) { + IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker, new MogoMarkerOptions()); iMogoMarker.setOwner(MAP_STATIC); //TODO 后续可能由于类型比较多,需要owner匹配机制,以及控制owner细粒度 - Logger.d("AMapMarkerWrapper", "traffic marker 点击回调"); + CallerLogger.INSTANCE.d("AMapMarkerWrapper", "traffic marker 点击回调"); return MogoMarkersHandler.getInstance().onStaticMarkerClicked(iMogoMarker); } @@ -62,7 +62,7 @@ public class AMapMarkerClickHandler { if (mogoMarkerMap.containsKey(marker.getId())) { IMogoMarker mogoMarker = mogoMarkerMap.get(marker.getId()); final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener(); - Logger.d("AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker); + CallerLogger.INSTANCE.d("AMapMarkerWrapper", "marker 点击回调 mogoMarker : " + mogoMarker + ", marker :" + marker); if (listener != null) { boolean result = listener.onMarkerClicked(mogoMarker); if (result) { diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 35c0c9734b..afecd26a56 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -19,7 +19,6 @@ import android.view.View; import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.config.HdMapBuildConfig; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; @@ -27,7 +26,7 @@ import com.mogo.eagle.core.function.call.map.CallerLocationUpdaterManager; import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; import com.mogo.eagle.core.utilcode.util.GsonUtils; @@ -117,7 +116,7 @@ public class AMapViewWrapper implements IMogoMapView, public AMapViewWrapper(MapAutoView mMapView) { startTime = System.currentTimeMillis(); - Logger.i(TAG, "autoop--AMapViewWrapper: init"); + CallerLogger.INSTANCE.i(TAG, "autoop--AMapViewWrapper: init"); this.mMapView = mMapView; initViews(); initListeners(); @@ -160,7 +159,7 @@ public class AMapViewWrapper implements IMogoMapView, mMapView.setOnCameraChangeListener(this); mMapView.setOnMapStyleListener(this); mMapView.setOnMapViewVisualAngleChangeListener(this); - Logger.d(TAG, "styleop - initListeners - setOnMapStyleListener - view %s", mMapView); + CallerLogger.INSTANCE.d(TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView); } private Context getContext() { @@ -181,7 +180,7 @@ public class AMapViewWrapper implements IMogoMapView, public void onCreate(Bundle bundle) { if (mMapView != null) { mMapView.onCreate(bundle); - Logger.d(TAG, "map onCreate"); + CallerLogger.INSTANCE.d(TAG, "map onCreate"); } } @@ -189,7 +188,7 @@ public class AMapViewWrapper implements IMogoMapView, public void onResume() { if (mMapView != null) { mMapView.onResume(); - Logger.d(TAG, "map onResume"); + CallerLogger.INSTANCE.d(TAG, "map onResume"); } } @@ -197,7 +196,7 @@ public class AMapViewWrapper implements IMogoMapView, public void onPause() { if (mMapView != null) { mMapView.onPause(); - Logger.d(TAG, "map onPause"); + CallerLogger.INSTANCE.d(TAG, "map onPause"); } } @@ -211,7 +210,7 @@ public class AMapViewWrapper implements IMogoMapView, mMapView.setOnMapClickListener(null); mMapView.getLocationClient().unRegisterListener(this); mMapView.setOnCameraChangeListener(null); - Logger.d(TAG, "map onDestroy"); + CallerLogger.INSTANCE.d(TAG, "map onDestroy"); } } @@ -219,7 +218,7 @@ public class AMapViewWrapper implements IMogoMapView, public void onSaveInstanceState(Bundle outState) { if (mMapView != null) { mMapView.onSaveInstanceState(outState); - Logger.d(TAG, "map onSaveInstanceState"); + CallerLogger.INSTANCE.d(TAG, "map onSaveInstanceState"); } } @@ -270,9 +269,9 @@ public class AMapViewWrapper implements IMogoMapView, if (mCurrentUI == EnumMapUI.Type_VR) { return MapControlResult.ERROR; } - Logger.d(TAG, "changeZoom %s", zoom); + CallerLogger.INSTANCE.d(TAG, "changeZoom : " + zoom); if (DebugConfig.isDebug()) { - Logger.d(TAG, Log.getStackTraceString(new Throwable())); + CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable())); } getMap().changeZoom(zoom); return MapControlResult.SUCCESS; @@ -284,7 +283,7 @@ public class AMapViewWrapper implements IMogoMapView, return; } - Logger.d(TAG, "设置的样式 = %s", ui); + CallerLogger.INSTANCE.d(TAG, "设置的样式 :" + ui); if (checkAMapView()) { mMapView.getMapAutoViewHelper().setScaleVRMode(true); mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR); @@ -321,11 +320,11 @@ public class AMapViewWrapper implements IMogoMapView, public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) { MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper(); if (mapAutoViewHelper != null) { - Logger.d(TAG, " 用户更改视距 currentThread : " + Thread.currentThread().getName()); + CallerLogger.INSTANCE.d(TAG, " 用户更改视距 currentThread : " + Thread.currentThread().getName()); mVisualAngleMode = angelMode; if (angelMode == MODE_CLOSE_SIGHT) { if (mogoLatLng == null) { - Logger.e(TAG, "切换地图近景需要传入要移动的经纬度数据"); + CallerLogger.INSTANCE.e(TAG, "切换地图近景需要传入要移动的经纬度数据"); return; } // 近景传入经纬度为点击地图上静态marker经纬度数据,为GPS坐标点。 @@ -348,7 +347,7 @@ public class AMapViewWrapper implements IMogoMapView, private boolean checkAMapView() { if (mMapView == null || mMapView.getMapAutoViewHelper() == null) { - Logger.e(TAG, "自研mapView实例为空,请检查"); + CallerLogger.INSTANCE.e(TAG, "自研mapView实例为空,请检查"); return false; } return true; @@ -356,13 +355,13 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void moveToCenter(MogoLatLng latLng, boolean animate) { - Logger.d(TAG, "move to center %s", latLng); + CallerLogger.INSTANCE.d(TAG, "move to center " + latLng); if (latLng == null || latLng.lat == 0.0d || latLng.lon == 0.0d) { - Logger.e(TAG, "latlng = null or is illegal"); + CallerLogger.INSTANCE.e(TAG, "latlng = null or is illegal"); return; } if (DebugConfig.isDebug()) { - Logger.d(TAG, Log.getStackTraceString(new Throwable())); + CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable())); } loseLockMode(); mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat)); @@ -370,7 +369,7 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void showMyLocation(boolean visible) { - Logger.d(TAG, "showMyLocation1 %s", visible); + CallerLogger.INSTANCE.d(TAG, "showMyLocation1 " + visible); // 如果是VR模式 if (mCurrentUI == EnumMapUI.Type_VR) { return; @@ -388,9 +387,8 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void showMyLocation(View view) { - Logger.d(TAG, "showMyLocation %s", "view"); if (DebugConfig.isDebug()) { - Logger.d(TAG, Log.getStackTraceString(new Throwable())); + CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable())); } if (checkAMapView()) { MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle(); @@ -419,7 +417,7 @@ public class AMapViewWrapper implements IMogoMapView, if (mCurrentUI == EnumMapUI.Type_VR) { return; } - Logger.d(TAG, "锁车"); + CallerLogger.INSTANCE.d(TAG, "锁车"); mMapView.getMapAutoViewHelper().setLockMode(true); mIsCarLocked = true; } @@ -430,7 +428,7 @@ public class AMapViewWrapper implements IMogoMapView, if (mCurrentUI == EnumMapUI.Type_VR) { return; } - Logger.d(TAG, "解锁锁车"); + CallerLogger.INSTANCE.d(TAG, "解锁锁车"); mMapView.getMapAutoViewHelper().setLockMode(false); mIsCarLocked = false; } @@ -491,7 +489,7 @@ public class AMapViewWrapper implements IMogoMapView, if (mCurrentUI == EnumMapUI.Type_VR) { return; } - Logger.d(TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY); + CallerLogger.INSTANCE.d(TAG, "setPointToCenter x : " + mapCenterX + " y : " + mapCenterY); mMapView.getMapAutoViewHelper().setPointToCenter((float) mapCenterX, (float) mapCenterY); } } @@ -528,7 +526,7 @@ public class AMapViewWrapper implements IMogoMapView, if (checkAMapView()) { if (mMapView.getMapAutoViewHelper() != null) { mMapView.getMapAutoViewHelper().setRenderFps(fps); - Logger.d(TAG, "设置刷新帧率 fps = %s", fps); + CallerLogger.INSTANCE.d(TAG, "设置刷新帧率 fps = " + fps); } } } @@ -539,10 +537,10 @@ public class AMapViewWrapper implements IMogoMapView, return; } if (mCurrentUI == EnumMapUI.Type_VR) { - Logger.w(TAG, "vr 模式下忽略该设置"); + CallerLogger.INSTANCE.w(TAG, "vr 模式下忽略该设置"); return; } - Logger.i(TAG, "showBounds:%s -%s-%s- %b ", tag, carPosition.toString(), bound.toShortString(), lockCarPosition); + CallerLogger.INSTANCE.i(TAG, "showBounds : " + tag + " , " + carPosition.toString() + " , " + bound.toShortString() + " , " + lockCarPosition); try { LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds(carPosition, lonLats, lockCarPosition); if (!lockCarPosition) { @@ -551,7 +549,7 @@ public class AMapViewWrapper implements IMogoMapView, mMapView.getMapAutoViewHelper().setCenter(ObjectUtils.fromMogo(carPosition)); mMapView.getMapAutoViewHelper().moveCamera(CameraUpdateFactory.INSTANCE.newLatLngBounds(latLngBounds, bound.left, bound.right, bound.top, bound.bottom)); } catch (Exception e) { - Logger.e(TAG, e, "%s error.", tag); + CallerLogger.INSTANCE.e(TAG, "tag : " + tag + " error : " + e); } } @@ -695,14 +693,14 @@ public class AMapViewWrapper implements IMogoMapView, if (!mIsDelayed) { mIsDelayed = true; UiThreadHandler.postDelayed(() -> { - //Logger.d(TAG, "倒计时结束"); + //CallerLogger.INSTANCE.d(TAG, "倒计时结束"); mIsFirstLocated = false; }, 5_000L); } } else { mIsFirstLocated = true; mIsDelayed = false; - Logger.d(TAG, "同步定位:" + GsonUtils.toJson(location)); + CallerLogger.INSTANCE.d(TAG, "同步定位:" + GsonUtils.toJson(location)); MapStyleController.getInstance().onLocationChanged(location, this); } } @@ -716,13 +714,13 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onMapInit() { - Logger.i(TAG, "autoop--onMapInit: "); + CallerLogger.INSTANCE.i(TAG, "autoop--onMapInit: "); MogoMapListenerHandler.getInstance().onMapLoaded(); } @Override public void onMapLoaded() { - Logger.i(TAG, "autoop--onMapLoaded: "); + CallerLogger.INSTANCE.i(TAG, "autoop--onMapLoaded: "); mMapLoaded = true; CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition(); Trace.beginSection("timer.onCameraChangeFinish"); @@ -748,18 +746,18 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onRoadLoaded(@Nullable String s) { - Logger.i(TAG, "autoop--onMapLoaded: "); + CallerLogger.INSTANCE.i(TAG, "autoop--onMapLoaded: "); } @Override public void onMapStatusChanged(int type, int value) { - //Logger.i(TAG, "mapop--onMapStatusChanged-: " + type + "," + value); + //CallerLogger.INSTANCE.i(TAG, "mapop--onMapStatusChanged-: " + type + "," + value); } @Override public void onMapViewVisualAngleChange(int i) { - Logger.d(TAG, " 地图自动更改视距 currentThread : " + Thread.currentThread().getName()); + CallerLogger.INSTANCE.d(TAG, " 地图自动更改视距 currentThread : " + Thread.currentThread().getName()); mVisualAngleMode = getVisualAngleMode(i); MogoMapListenerHandler.getInstance().onMapVisualAngleChanged(mVisualAngleMode); } @@ -785,12 +783,12 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onCameraChange(int type, int value) { - //Logger.i(TAG, "mapop--onCameraChange-: " + type + "," + value); + //CallerLogger.INSTANCE.i(TAG, "mapop--onCameraChange-: " + type + "," + value); } @Override public void onCameraChangeFinish(@Nullable CameraPosition cameraPosition) { - // Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) ); + // CallerLogger.INSTANCE.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) ); if (cameraPosition != null) { Trace.beginSection("timer.onCameraChangeFinish"); MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()), @@ -810,7 +808,7 @@ public class AMapViewWrapper implements IMogoMapView, public void onChangeMapStyle(int styleId) { EnumMapUI last = mCurrentUI; - Logger.d(TAG, "currentMapStyle = %s", styleId); + CallerLogger.INSTANCE.d(TAG, "currentMapStyle = " + styleId); if (styleId == MapAutoApi.MAP_STYLE_DAY || styleId == MapAutoApi.MAP_STYLE_DAY_NAV) { @@ -825,7 +823,7 @@ public class AMapViewWrapper implements IMogoMapView, } if (last == mCurrentUI) { - Logger.d(TAG, "currentUI is same as last = %s", mCurrentUI); + CallerLogger.INSTANCE.d(TAG, "currentUI is same as last = " + mCurrentUI); return; } @@ -836,11 +834,11 @@ public class AMapViewWrapper implements IMogoMapView, return; } } - Logger.d(TAG, Log.getStackTraceString(new Throwable())); + CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable())); if (mCurrentUI != null) { UiThreadHandler.post(() -> { try { - Logger.d(TAG, "currentUI = %s", mCurrentUI); + CallerLogger.INSTANCE.d(TAG, "currentUI = " + mCurrentUI); MogoMapListenerHandler.getInstance().onMapModeChanged(mCurrentUI); CallerMapStyleListenerManager.INSTANCE.invokeMapStyleChange(styleId); } catch (Exception e) { @@ -862,12 +860,12 @@ public class AMapViewWrapper implements IMogoMapView, public void onStyleAutoChanged(boolean isVrMode) { if (isVrMode) { if (mCurrentUI != EnumMapUI.Type_VR) { - Logger.d(TAG, "自动切换为vr模式"); + CallerLogger.INSTANCE.d(TAG, "自动切换为vr模式"); changeMapMode(EnumMapUI.Type_VR); } } else { if (mCurrentUI == EnumMapUI.Type_VR) { - Logger.d(TAG, "自动切换为2D模式"); + CallerLogger.INSTANCE.d(TAG, "自动切换为2D模式"); if (mIsLightStyle) { changeMapMode(EnumMapUI.Type_Light); } else { @@ -886,7 +884,7 @@ public class AMapViewWrapper implements IMogoMapView, TipToast.shortTip(mRtkEnable ? "已开启rtk道路匹配" : "已开启gps道路匹配"); mMapView.getLocationClient().rtkEnable(mRtkEnable); } catch (Exception e) { - Logger.e(TAG, e, "rtkEnable"); + CallerLogger.INSTANCE.e(TAG, "rtkEnable has exception : " + e); } } @@ -896,7 +894,7 @@ public class AMapViewWrapper implements IMogoMapView, return; } if (data == null) { - Logger.d(TAG, "停止使用rtk定位数据"); + CallerLogger.INSTANCE.d(TAG, "停止使用rtk定位数据"); return; } double lon = data.optDouble("lon", -1); @@ -1006,13 +1004,11 @@ public class AMapViewWrapper implements IMogoMapView, if (roadCache == null || roadCache == noCache) { SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(((float) wgs[0]), ((float) wgs[1]), ((float) angle), isGpsLocation, isRTK); if (singlePointRoadInfo != null && singlePointRoadInfo.getCoords() != null && !singlePointRoadInfo.getCoords().isEmpty()) { - // Log.i("timer-matchRoad-4", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + singlePointRoadInfo.getRoadId()); roadCache = new RoadCacheWrapper(singlePointRoadInfo.getCoords()); roadCache.setLaneWidth(singlePointRoadInfo.getLaneWidth()); } } - // Log.i("timer-matchRoad-1", "cost " + (System.currentTimeMillis() - start) + "ms"); if (roadCache != null && roadCache.getRoad() != null && !roadCache.getRoad().isEmpty()) { @@ -1024,16 +1020,16 @@ public class AMapViewWrapper implements IMogoMapView, if (matchThreshold > 0 && matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) { // 目标车在阈值范围内 roadCacheMap.put(id, roadCache); - // Logger.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms"); + // CallerLogger.INSTANCE.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms"); return matchedPoint; - // Logger.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: "+roadCache.getLastLat()); + // CallerLogger.INSTANCE.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: "+roadCache.getLastLat()); } else if (matchedPoint[2] > matchThreshold && matchedPoint[2] < 1.5) { // 目标车在阈值范围外,也就是说距离道路中心线太远了,就不吸附了 return null; } else { // 目标车到道路中心线的映射点不在道路上,也就是已经使出了缓存的那条道路,需要重新获取一条道路,用useCache这个参数来避免重复递归 roadCacheMap.put(id, noCache); - // Logger.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat()); + // CallerLogger.INSTANCE.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat()); if (usdCache) { return matchRoad(id, lon, lat, angle, isGpsLocation, isRTK, false); } else { diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java index 4ca798535d..b404ab89d9 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java @@ -3,8 +3,7 @@ package com.mogo.map.impl.custom; import android.content.Context; import android.graphics.Point; -import com.mogo.eagle.core.data.traffic.TrafficData; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoUiSettings; import com.mogo.map.impl.custom.marker.AMapInfoWindowAdapter; @@ -55,7 +54,7 @@ public class AMapWrapper implements IMogoMap { private IMogoUiSettings mUiSettings; public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) { - Logger.i(TAG, "autoop--AMapWrapper: init" + this); + CallerLogger.INSTANCE.i(TAG, "autoop--AMapWrapper: init" + this); this.mAMap = map; sAMap = map; this.mMapView = mapView; @@ -87,13 +86,13 @@ public class AMapWrapper implements IMogoMap { @Override public IMogoMarker addMarker(String tag, MogoMarkerOptions options) { - //Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this); + //CallerLogger.INSTANCE.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this); if (!checkAMap()) { return null; } MarkerOptions markerOptions = ObjectUtils.fromMogo(options); if (markerOptions == null) { - Logger.e(TAG, "marker参数为空"); + CallerLogger.INSTANCE.e(TAG, "marker参数为空"); return null; } final IMogoMarker mogoMarker = new AMapMarkerWrapper(mAMap.addMarker(markerOptions), options); @@ -112,19 +111,19 @@ public class AMapWrapper implements IMogoMap { for (MessagePad.TrackedObject mogoMarkerOptions : optionsArrayList) { MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(mogoMarkerOptions); if (markerOptions == null) { - Logger.e(TAG, "marker参数为空"); + CallerLogger.INSTANCE.e(TAG, "marker参数为空"); break; } markerOptionsArrayList.add(markerOptions); } - MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList,false,8.0f,0,100); + MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList, false, 8.0f, 0, 100); } @Override public String addPreVehicleModel(int type, int modelRes) { try { - return MarkerHelper.INSTANCE.addPreVehicleModel(type, modelRes); + return MarkerHelper.INSTANCE.addPreVehicleModel(type, modelRes); } catch (Exception e) { e.printStackTrace(); } @@ -261,7 +260,7 @@ public class AMapWrapper implements IMogoMap { @Override public void changeZoom(float zoom) { - Logger.d(TAG, "changeZoom %s", zoom); + CallerLogger.INSTANCE.d(TAG, "changeZoom : " + zoom); if (checkAMap()) { mAMap.setZoom((int) zoom); } @@ -285,7 +284,7 @@ public class AMapWrapper implements IMogoMap { public IMogoPolyline addPolyline(MogoPolylineOptions options) { if (checkAMap()) { PolylineOptions polylineOptions = ObjectUtils.fromMogo(options); - Logger.d(TAG, "addPolyline %s", polylineOptions.toString()); + CallerLogger.INSTANCE.d(TAG, "addPolyline :" + polylineOptions.toString()); if (polylineOptions == null) { return null; } @@ -309,7 +308,7 @@ public class AMapWrapper implements IMogoMap { mAMap = mMapView.getMapAutoViewHelper(); sAMap = mAMap; if (mAMap == null) { - Logger.e(TAG, "自研map实例为空,请检查"); + CallerLogger.INSTANCE.e(TAG, "自研map实例为空,请检查"); return false; } return true; diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java index fa2fb11402..c8425658fe 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java @@ -1,10 +1,9 @@ package com.mogo.map.impl.custom; import android.content.Context; -import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.IMogoMapApiBuilder; import com.mogo.map.IMogoMapView; import com.mogo.map.MapApiPath; @@ -56,7 +55,7 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder { @Override public IMogoMapView getMapView(Context context) { - Log.d(TAG, "setDebugMode==true"); + CallerLogger.INSTANCE.d(TAG, "setDebugMode==true"); MapParams mapParams = MapParams.Companion.init(); mapParams.setDebugMode(false) //todo 1-使用本地地图数据,0-使用在线地图数据 @@ -71,7 +70,7 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder { MapAutoApi.INSTANCE.init(context, mapParams); MapAutoView mapAutoView = new MapAutoView(context); - //mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l)); + //mapAutoView.registerRenderListener(l -> CallerLogger.INSTANCE.i(TAG, "renderTime: " + l)); IMogoMapView mapView = new AMapViewWrapper(mapAutoView); return mapView; } @@ -88,6 +87,6 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder { @Override public void init(Context context) { - Logger.d(TAG, "init"); + CallerLogger.INSTANCE.d(TAG, "init"); } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java index 3116a76d74..7018234339 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java @@ -2,10 +2,9 @@ package com.mogo.map.impl.custom.location; import android.content.Context; import android.os.Trace; -import android.util.Log; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.map.impl.custom.utils.ObjectUtils; import com.mogo.map.location.IMogoLocationClient; @@ -108,7 +107,6 @@ public class ALocationClient implements IMogoLocationClient { @Override public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) { - //Log.w("DHY-location", location.getLon() + "," + location.getLat() + " ALocationClient-onLocationChanged:location"); if ( mIsDestroyed ) { destroyWarming(); return; @@ -120,7 +118,6 @@ public class ALocationClient implements IMogoLocationClient { } Trace.beginSection( "timer.onLocationChanged" ); mLastLocation = ObjectUtils.fromLocation( location ); - //Log.w("DHY-location", mLastLocation.getLongitude() + "," + mLastLocation.getLatitude() + " ALocationClient-onLocationChanged:mLastLocation"); UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation)); Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners(); @@ -135,7 +132,7 @@ public class ALocationClient implements IMogoLocationClient { } private void destroyWarming() { - Logger.w( TAG, "location client has destroyed." ); + CallerLogger.INSTANCE.w( TAG, "location client has destroyed." ); } @Override diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapMarkerWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapMarkerWrapper.java index f624d31ed3..4ca54a5bdb 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapMarkerWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapMarkerWrapper.java @@ -7,7 +7,7 @@ import android.view.View; import android.view.animation.Interpolator; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.impl.custom.utils.ObjectUtils; import com.mogo.map.marker.IMogoInfoWindowAdapter; import com.mogo.map.marker.IMogoMarker; @@ -53,39 +53,39 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { private MogoMarkerOptions mMogoMarkerOptions; private String mOwner; - public AMapMarkerWrapper( Marker marker, MogoMarkerOptions mogoMarkerOptions ) { + public AMapMarkerWrapper(Marker marker, MogoMarkerOptions mogoMarkerOptions) { this.mMarker = marker; - if ( marker != null ) { + if (marker != null) { // 设置自研 marker 的object对象为 IMogoMarker 实例。!!!! - marker.setMObject( this ); - if ( !TextUtils.isEmpty( mogoMarkerOptions.getAnchorColor() ) ) { - marker.setAnchorColor( mogoMarkerOptions.getAnchorColor() ); + marker.setMObject(this); + if (!TextUtils.isEmpty(mogoMarkerOptions.getAnchorColor())) { + marker.setAnchorColor(mogoMarkerOptions.getAnchorColor()); } - MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this ); + MarkerWrapperClickHelper.getInstance().setMogoMarkerMap(marker.getId(), this); } - setObject( mogoMarkerOptions.getObject() ); + setObject(mogoMarkerOptions.getObject()); this.mMogoMarkerOptions = mogoMarkerOptions; - mMogoMarkerOptions.addObserver( this ); + mMogoMarkerOptions.addObserver(this); } @Override - public void update( Observable o, Object arg ) { - if ( isDestroyed() ) { + public void update(Observable o, Object arg) { + if (isDestroyed()) { return; } - setMarkerOptions( mMogoMarkerOptions ); + setMarkerOptions(mMogoMarkerOptions); } @Override public void destroy() { - if ( mMogoMarkerOptions != null ) { + if (mMogoMarkerOptions != null) { mMogoMarkerOptions.deleteObservers(); mMogoMarkerOptions = null; } - if ( mMarker != null ) { + if (mMarker != null) { mMarker.remove(); - mMarker.setMObject( null ); - mMarker.setOnInfoWindowClickListener( null ); + mMarker.setMObject(null); + mMarker.setOnInfoWindowClickListener(null); mMarker = null; } mMogoInfoWindowAdapter = null; @@ -101,66 +101,66 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { @Override public void hideInfoWindow() { - if ( mMarker != null ) { + if (mMarker != null) { mMarker.hideInfoWindow(); } } @Override - public void setAlpha( float alpha ) { - if ( mMarker != null ) { - mMarker.setAlpha( alpha ); + public void setAlpha(float alpha) { + if (mMarker != null) { + mMarker.setAlpha(alpha); } } @Override - public void setAnchor( float anchorU, float anchorV ) { - if ( mMarker != null ) { - mMarker.setAnchor( anchorU, anchorV ); + public void setAnchor(float anchorU, float anchorV) { + if (mMarker != null) { + mMarker.setAnchor(anchorU, anchorV); } } @Override - public void setDraggable( boolean paramBoolean ) { - if ( mMarker != null ) { - mMarker.setDraggable( paramBoolean ); + public void setDraggable(boolean paramBoolean) { + if (mMarker != null) { + mMarker.setDraggable(paramBoolean); } } @Override - public void setIcon( Bitmap icon ) { - if ( icon == null || icon.isRecycled() ) { + public void setIcon(Bitmap icon) { + if (icon == null || icon.isRecycled()) { return; } - if ( mMarker != null ) { - mMarker.setIcon( icon ); + if (mMarker != null) { + mMarker.setIcon(icon); } } @Override - public void setIcons( ArrayList< Bitmap > icons ) { - if ( icons == null || icons.isEmpty() ) { + public void setIcons(ArrayList icons) { + if (icons == null || icons.isEmpty()) { return; } - ArrayList< BitmapDescriptor > descriptors = new ArrayList<>(); - for ( Bitmap icon : icons ) { - if ( icon == null || icon.isRecycled() ) { + ArrayList descriptors = new ArrayList<>(); + for (Bitmap icon : icons) { + if (icon == null || icon.isRecycled()) { continue; } - descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ) ); + descriptors.add(BitmapDescriptorFactory.INSTANCE.fromBitmap(icon)); } - if ( descriptors.isEmpty() ) { + if (descriptors.isEmpty()) { return; } - if ( mMarker != null ) { - mMarker.setIcons( descriptors ); + if (mMarker != null) { + mMarker.setIcons(descriptors); } } @Override - public void setInfoWindowEnable( boolean enabled ) { - if ( mMarker != null ) { - if ( enabled ) { + public void setInfoWindowEnable(boolean enabled) { + if (mMarker != null) { + if (enabled) { mMarker.showInfoWindow(); } else { mMarker.hideInfoWindow(); @@ -169,20 +169,20 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void setMarkerOptions( MogoMarkerOptions opt ) { + public void setMarkerOptions(MogoMarkerOptions opt) { - final MarkerOptions options = ObjectUtils.fromMogo( opt ); - if ( options == null ) { + final MarkerOptions options = ObjectUtils.fromMogo(opt); + if (options == null) { return; } - if ( mMarker != null ) { - mMarker.setMarkerOptions( options ); - setObject( opt.getObject() ); + if (mMarker != null) { + mMarker.setMarkerOptions(options); + setObject(opt.getObject()); } } @Override - public void setObject( Object object ) { + public void setObject(Object object) { mObject = object; } @@ -192,87 +192,87 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void setPeriod( int period ) { - if ( mMarker != null ) { - mMarker.setPeriod( period ); + public void setPeriod(int period) { + if (mMarker != null) { + mMarker.setPeriod(period); } } @Override - public void setPosition( double lat, double lng ) { - if ( mMarker != null ) { - mMarker.setPosition( new LonLatPoint( lng, lat ) ); + public void setPosition(double lat, double lng) { + if (mMarker != null) { + mMarker.setPosition(new LonLatPoint(lng, lat)); } } @Override public MogoLatLng getPosition() { - if ( mMarker != null ) { + if (mMarker != null) { final LonLatPoint latLng = mMarker.getPosition(); - return ObjectUtils.fromAMap( latLng ); + return ObjectUtils.fromAMap(latLng); } return null; } @Override - public void setRotateAngle( float rotate ) { - if ( mMarker != null ) { - mMarker.setRotateAngle( rotate ); + public void setRotateAngle(float rotate) { + if (mMarker != null) { + mMarker.setRotateAngle(rotate); } } @Override - public void setSnippet( String snippet ) { - if ( mMarker != null ) { - mMarker.setSnippet( snippet ); + public void setSnippet(String snippet) { + if (mMarker != null) { + mMarker.setSnippet(snippet); } } @Override - public void setTitle( String title ) { - if ( mMarker != null ) { - mMarker.setTitle( title ); + public void setTitle(String title) { + if (mMarker != null) { + mMarker.setTitle(title); } } @Override public void setToTop() { - if ( mMarker != null ) { + if (mMarker != null) { mMarker.setToTop(); } } @Override - public void setVisible( boolean visible ) { - if ( mMarker != null ) { - mMarker.setVisible( visible ); + public void setVisible(boolean visible) { + if (mMarker != null) { + mMarker.setVisible(visible); } } @Override - public void setZIndex( int zIndex ) { - if ( mMarker != null ) { - mMarker.setZIndex( zIndex ); + public void setZIndex(int zIndex) { + if (mMarker != null) { + mMarker.setZIndex(zIndex); } } @Override public void showInfoWindow() { - if ( mMarker != null ) { + if (mMarker != null) { mMarker.showInfoWindow(); } } @Override public String getMarkerAssInfo() { - if ( mMarker != null ) { + if (mMarker != null) { return mMarker.getMarkeOptions().getAssInfo(); } return null; } @Override - public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) { + public void setOnMarkerClickListener(IMogoMarkerClickListener listener) { mMogoMarkerClickListener = listener; } @@ -282,7 +282,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter ) { + public void setInfoWindowAdapter(IMogoInfoWindowAdapter adapter) { mMogoInfoWindowAdapter = adapter; } @@ -292,11 +292,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void setMarkerIconView( IMogoMarkerIconViewCreator creator ) { - if ( creator != null ) { - View iconView = creator.createView( this ); - if ( iconView != null ) { - mMarker.setIcon( iconView ); + public void setMarkerIconView(IMogoMarkerIconViewCreator creator) { + if (creator != null) { + View iconView = creator.createView(this); + if (iconView != null) { + mMarker.setIcon(iconView); } } } @@ -307,25 +307,25 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void setOwner( String mOwner ) { + public void setOwner(String mOwner) { this.mOwner = mOwner; } @Override public String getOwner() { - if ( mOwner != null ) { + if (mOwner != null) { return mOwner; } - if ( mMogoMarkerOptions != null ) { + if (mMogoMarkerOptions != null) { return mMogoMarkerOptions.getOwner(); } return null; } @Override - public void setPositionByPixels( Point position ) { - if ( mMarker != null ) { - mMarker.setPosition( MapTools.INSTANCE.fromScreenLocation( position ) ); + public void setPositionByPixels(Point position) { + if (mMarker != null) { + mMarker.setPosition(MapTools.INSTANCE.fromScreenLocation(position)); } } @@ -339,146 +339,146 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator ) { - if ( isDestroyed() ) { + public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator) { + if (isDestroyed()) { return; } - startScaleAnimation( fromX, toX, fromY, toY, duration, interpolator, null ); + startScaleAnimation(fromX, toX, fromY, toY, duration, interpolator, null); } @Override - public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) { - if ( isDestroyed() ) { + public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener) { + if (isDestroyed()) { return; } - MarkerScaleAnimation animationScale = new MarkerScaleAnimation( fromX, toX ); - animationScale.setDuration( duration ); + MarkerScaleAnimation animationScale = new MarkerScaleAnimation(fromX, toX); + animationScale.setDuration(duration); // animationScale.setFillMode(Animation.FILL_MODE_FORWARDS); // animationScale.setInterpolator(interpolator); - animationScale.setAnimationListener( new MarkerAnimationListener() { + animationScale.setAnimationListener(new MarkerAnimationListener() { @Override - public void onAnimationEnd( @NotNull Animation animation ) { - if ( isDestroyed() ) { + public void onAnimationEnd(@NotNull Animation animation) { + if (isDestroyed()) { return; } - if ( listener != null ) { + if (listener != null) { listener.onAnimEnd(); } } @Override - public void onAnimationRepeat( @NotNull Animation animation ) { + public void onAnimationRepeat(@NotNull Animation animation) { } @Override - public void onAnimationStart( @NotNull Animation animation ) { - if ( isDestroyed() ) { + public void onAnimationStart(@NotNull Animation animation) { + if (isDestroyed()) { return; } - if ( listener != null ) { + if (listener != null) { listener.onAnimStart(); } } - } ); + }); - mMarker.setMarkerScaleAnimation( animationScale ); + mMarker.setMarkerScaleAnimation(animationScale); mMarker.startAnimation(); } @Override - public void startJumpAnimation( float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener ) { - if ( isDestroyed() || high <= 0.0f || interpolator == null || duration < 0 ) { + public void startJumpAnimation(float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener) { + if (isDestroyed() || high <= 0.0f || interpolator == null || duration < 0) { return; } try { - final LonLatPoint latLng = ObjectUtils.fromMogo( getPosition() ); + final LonLatPoint latLng = ObjectUtils.fromMogo(getPosition()); // Point point = AMapWrapper.getAMap().getProjection().toScreenLocation(latLng); // point.y -= WindowUtils.dip2px(AbsMogoApplication.getApp(), high); // LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation(point); //使用TranslateAnimation,填写一个需要移动的目标点 - MarkerTranslateAnimation animation = new MarkerTranslateAnimation( latLng ); + MarkerTranslateAnimation animation = new MarkerTranslateAnimation(latLng); // animation.setInterpolator(interpolator); - animation.setAnimationListener( new MarkerAnimationListener() { + animation.setAnimationListener(new MarkerAnimationListener() { @Override - public void onAnimationEnd( @NotNull Animation animation ) { - if ( isDestroyed() ) { + public void onAnimationEnd(@NotNull Animation animation) { + if (isDestroyed()) { return; } - if ( listener != null ) { + if (listener != null) { listener.onAnimEnd(); } } @Override - public void onAnimationRepeat( @NotNull Animation animation ) { + public void onAnimationRepeat(@NotNull Animation animation) { } @Override - public void onAnimationStart( @NotNull Animation animation ) { - if ( isDestroyed() ) { + public void onAnimationStart(@NotNull Animation animation) { + if (isDestroyed()) { return; } - if ( listener != null ) { + if (listener != null) { listener.onAnimStart(); } } - } ); + }); //整个移动所需要的时间 - animation.setDuration( duration * 1000 ); + animation.setDuration(duration * 1000); //设置动画 - mMarker.setTranslateAnimation( animation ); + mMarker.setTranslateAnimation(animation); mMarker.startAnimation(); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "error : " + e); } } @Override - public void setClickable( boolean clickable ) { - if ( mMarker != null ) { - mMarker.setClickable( clickable ); + public void setClickable(boolean clickable) { + if (mMarker != null) { + mMarker.setClickable(clickable); } } @Override - public void startSmooth( List< MogoLatLng > points, int duration ) { - startSmoothInMs( points, duration * 1000 ); + public void startSmooth(List points, int duration) { + startSmoothInMs(points, duration * 1000L); } @Override - public void startSmoothInMs( List< MogoLatLng > points, long duration ) { - if ( isDestroyed() ) { + public void startSmoothInMs(List points, long duration) { + if (isDestroyed()) { return; } - if ( mMarker == null ) { + if (mMarker == null) { return; } - if ( points == null || points.isEmpty() ) { + if (points == null || points.isEmpty()) { return; } - ArrayList< LonLatPoint > newPoints = new ArrayList<>(); - for ( int i = 0; i < points.size(); i++ ) { - LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) ); - if ( point == null ) { + ArrayList newPoints = new ArrayList<>(); + for (int i = 0; i < points.size(); i++) { + LonLatPoint point = ObjectUtils.fromMogo(points.get(i)); + if (point == null) { continue; } - newPoints.add( point ); + newPoints.add(point); } - if ( newPoints.isEmpty() ) { + if (newPoints.isEmpty()) { return; } - mMarker.startSmooth( newPoints, ( int ) duration ); + mMarker.startSmooth(newPoints, (int) duration); } @Override - public void startScaleAnimationWithAlpha( float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) { + public void startScaleAnimationWithAlpha(float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener) { } @@ -488,98 +488,98 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { } @Override - public void setGps( boolean isGps ) { - if ( mMarker != null ) { - mMarker.setGps( isGps ); + public void setGps(boolean isGps) { + if (mMarker != null) { + mMarker.setGps(isGps); } } @Override - public String use3DResource( int model3D ) { + public String use3DResource(int model3D) { try { - mMarker.marker3DIcon( model3D ); + mMarker.marker3DIcon(model3D); return mMarker.getMarkeOptions().getMarkerIconName(); - } catch ( Exception e ) { - Logger.e( TAG, e, "use3DResource" ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "use3DResource has exception : " + e); } return null; } @Override - public void use3DResource( String resName ) { + public void use3DResource(String resName) { try { - mMarker.getMarkeOptions().setVrIcon( true ); - mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) ); - } catch ( Exception e ) { - Logger.e( TAG, e, "use3DResource" ); + mMarker.getMarkeOptions().setVrIcon(true); + mMarker.setMarkerOptions(mMarker.getMarkeOptions().setMarkerIconName(resName)); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG,"use3DResource has exception : " + e); } } @Override - public void use2DResource( String resName ) { + public void use2DResource(String resName) { try { - mMarker.getMarkeOptions().setVrIcon( false ); - mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) ); - } catch ( Exception e ) { - Logger.e( TAG, e, "use3DResource" ); + mMarker.getMarkeOptions().setVrIcon(false); + mMarker.setMarkerOptions(mMarker.getMarkeOptions().setMarkerIconName(resName)); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "use3DResource has exception : " + e); } } private String mLastAnchorColor = ""; @Override - public void setAnchorColor( String anchorColor ) { - if ( TextUtils.equals( mLastAnchorColor, anchorColor ) ) { + public void setAnchorColor(String anchorColor) { + if (TextUtils.equals(mLastAnchorColor, anchorColor)) { return; } if (mMogoMarkerOptions != null) { - mMogoMarkerOptions.anchorColor( anchorColor ); + mMogoMarkerOptions.anchorColor(anchorColor); } if (mMarker != null) { - mMarker.setAnchorColor( anchorColor ); + mMarker.setAnchorColor(anchorColor); } mLastAnchorColor = anchorColor; } @Override - public void updateInfoWindowView( View view ) { + public void updateInfoWindowView(View view) { try { - mMarker.setInfoWindowView( view ); - } catch ( Exception e ) { + mMarker.setInfoWindowView(view); + } catch (Exception e) { e.printStackTrace(); } } @Override - public void updateInfoWindowView( String viewResName ) { + public void updateInfoWindowView(String viewResName) { try { - mMarker.setMarkerInfoName( viewResName ); - } catch ( Exception e ) { + mMarker.setMarkerInfoName(viewResName); + } catch (Exception e) { e.printStackTrace(); } } @Override - public void setInfoWindowOffset( int offsetX, int offsetY ) { + public void setInfoWindowOffset(int offsetX, int offsetY) { try { - mMarker.setInfoWindowOffset( offsetX, offsetY ); - } catch ( Exception e ) { + mMarker.setInfoWindowOffset(offsetX, offsetY); + } catch (Exception e) { e.printStackTrace(); } } @Override - public void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) { - mMarker.addDynamicAnchorPostion( new LonLatPoint( latLng.lon, latLng.lat, angle ), System.currentTimeMillis(), ( int ) duration); + public void addDynamicAnchorPosition(MogoLatLng latLng, float angle, long duration) { + mMarker.addDynamicAnchorPostion(new LonLatPoint(latLng.lon, latLng.lat, angle), System.currentTimeMillis(), (int) duration); } @Override public String getMarkerResName() { - if ( mMarker != null ) { + if (mMarker != null) { try { return mMarker.getMarkeOptions().getMarkerIconName(); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } @@ -588,10 +588,10 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer { @Override public String getMarkerInfoResName() { - if ( mMarker != null ) { + if (mMarker != null) { try { return mMarker.getMarkeOptions().getMarkerInfoName(); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/InputtipsSearch.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/InputtipsSearch.java index fda22d658c..05818603c1 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/InputtipsSearch.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/InputtipsSearch.java @@ -2,7 +2,7 @@ package com.mogo.map.impl.custom.search; import android.content.Context; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.impl.custom.utils.ObjectUtils; import com.mogo.map.search.inputtips.IMogoInputtipsListener; import com.mogo.map.search.inputtips.IMogoInputtipsSearch; @@ -60,7 +60,7 @@ public class InputtipsSearch implements IMogoInputtipsSearch, InputtipsListener mListener.onGetInputtips(getResult(list)); } } else { - Logger.e(TAG, "errorcode = " + i); + CallerLogger.INSTANCE.e(TAG, "errorcode = " + i); } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/PoiSearchClient.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/PoiSearchClient.java index 15487a39c8..9a04cb0536 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/PoiSearchClient.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/search/PoiSearchClient.java @@ -2,7 +2,7 @@ package com.mogo.map.impl.custom.search; import android.content.Context; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.exception.MogoMapException; import com.mogo.map.impl.custom.utils.ObjectUtils; import com.mogo.map.search.geo.MogoPoiItem; @@ -15,7 +15,6 @@ import com.zhidaoauto.map.sdk.open.query.OnPoiSearchListener; import com.zhidaoauto.map.sdk.open.query.PoiItem; import com.zhidaoauto.map.sdk.open.query.PoiSearch; import com.zhidaoauto.map.sdk.open.query.PoiSearchResult; -import com.zhidaoauto.map.sdk.open.query.PoiCategory; import org.jetbrains.annotations.Nullable; @@ -38,94 +37,94 @@ public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener { private IMogoPoiSearchListener mListener; private MogoSearchBound mBound; - public PoiSearchClient( Context context, MogoPoiSearchQuery query ) { + public PoiSearchClient(Context context, MogoPoiSearchQuery query) { try { mQuery = query; - mClient = new PoiSearch( context, ObjectUtils.fromMogo( mQuery ) ); - mClient.setOnPoiSearchListener( this ); + mClient = new PoiSearch(context, ObjectUtils.fromMogo(mQuery)); + mClient.setOnPoiSearchListener(this); } catch (Exception e) { e.printStackTrace(); } } @Override - public void setPoiSearchListener( IMogoPoiSearchListener listener ) { + public void setPoiSearchListener(IMogoPoiSearchListener listener) { mListener = listener; } @Override public void searchPOIAsyn() { - if ( mClient != null ) { + if (mClient != null) { mClient.searchPOIAsyn(); } } @Override public MogoPoiResult searchPOI() throws MogoMapException { - if ( mClient != null ) { + if (mClient != null) { try { PoiSearchResult search = mClient.searchPOI(); - return ObjectUtils.fromAMap( search ); - } catch ( Exception e ) { - throw new MogoMapException( e ); + return ObjectUtils.fromAMap(search); + } catch (Exception e) { + throw new MogoMapException(e); } } return null; } @Override - public void setQuery( MogoPoiSearchQuery query ) { + public void setQuery(MogoPoiSearchQuery query) { mQuery = query; - if ( mClient != null ) { - mClient.setQuery( ObjectUtils.fromMogo( mQuery ) ); + if (mClient != null) { + mClient.setQuery(ObjectUtils.fromMogo(mQuery)); } } @Override - public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException { - if ( mClient != null ) { + public MogoPoiItem searchPOIId(String poiId) throws MogoMapException { + if (mClient != null) { try { - PoiItem poiItem = mClient.searchPOIId( poiId ); - return ObjectUtils.fromAMap( poiItem ); - } catch ( Exception e ) { - throw new MogoMapException( e ); + PoiItem poiItem = mClient.searchPOIId(poiId); + return ObjectUtils.fromAMap(poiItem); + } catch (Exception e) { + throw new MogoMapException(e); } } return null; } @Override - public void searchPOIIdAsyn( String poiId ) { - if ( mClient != null ) { - mClient.searchPOIIdAsyn( poiId ); + public void searchPOIIdAsyn(String poiId) { + if (mClient != null) { + mClient.searchPOIIdAsyn(poiId); } } @Override - public void setBound( MogoSearchBound bound ) { + public void setBound(MogoSearchBound bound) { mBound = bound; - if ( mClient != null ) { - mClient.setBound( ObjectUtils.fromMogo( mBound ) ); + if (mClient != null) { + mClient.setBound(ObjectUtils.fromMogo(mBound)); } } @Override - public void onPoiSearched( PoiSearchResult poiResult, int errorCode ) { - if ( errorCode != 0 ) { - Logger.e( TAG, "errorcode is %d", errorCode ); + public void onPoiSearched(PoiSearchResult poiResult, int errorCode) { + if (errorCode != 0) { + CallerLogger.INSTANCE.e(TAG, "errorCode is " + errorCode); } - if ( mListener != null ) { - mListener.onPoiSearched( ObjectUtils.fromAMap( poiResult ), errorCode ); + if (mListener != null) { + mListener.onPoiSearched(ObjectUtils.fromAMap(poiResult), errorCode); } } @Override - public void onPoiItemSearched( PoiItem poiItem, int errorCode ) { - if ( errorCode != 0 ) { - Logger.e( TAG, "errorcode is %d", errorCode ); + public void onPoiItemSearched(PoiItem poiItem, int errorCode) { + if (errorCode != 0) { + CallerLogger.INSTANCE.e(TAG, "errorCode is " + errorCode); } - if ( mListener != null ) { - mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode ); + if (mListener != null) { + mListener.onPoiItemSearched(ObjectUtils.fromAMap(poiItem), errorCode); } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/PointInterpolatorUtil.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/PointInterpolatorUtil.java index 1fe28e9166..2edc2954c0 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/PointInterpolatorUtil.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/PointInterpolatorUtil.java @@ -2,7 +2,7 @@ package com.mogo.map.impl.custom.utils; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.zhidaoauto.map.sdk.open.query.LonLatPoint; import java.util.List; @@ -38,13 +38,13 @@ public class PointInterpolatorUtil { MogoLatLng current = points.get(i); MogoLatLng next = points.get(i + 1); float distance = CoordinateUtils.calculateLineDistance(current.lon, current.lat, next.lon, next.lat); - Logger.d(TAG, i + ": " + distance); + CallerLogger.INSTANCE.d(TAG, i + ": " + distance); if (distance > DISTANCE_THRESHOLD) { int inter = (int) (distance / DISTANCE_THRESHOLD) + 1; for (int j = 1; j < inter; j++) { double newLat = current.lat + (next.lat - current.lat) * j / inter; double newLon = current.lon + (next.lon - current.lon) * j / inter; - Logger.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon); + CallerLogger.INSTANCE.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon); points.add(i + 1, new MogoLatLng(newLat, newLon)); current = points.get(++i); } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.java index 93279c6e93..7be9459918 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.java @@ -2,8 +2,6 @@ package com.mogo.map; import android.content.Context; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; - /** * @author congtaowang * @since 2019-12-20 @@ -34,7 +32,6 @@ public class MogoMap { } public void init( Context context, IMogoMap map ) { - Logger.d( TAG, "init mogomap" ); this.mContext = context; this.mMap = map; } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index 93d357af93..ff51e7363b 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -6,7 +6,7 @@ import android.location.Location; import android.view.View; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.uicontroller.CarCursorOption; import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.map.uicontroller.IMogoMapUIController; @@ -87,7 +87,7 @@ public class MogoMapUIController implements IMogoMapUIController { public void changeMapMode(EnumMapUI mode) { initDelegate(); if (mDelegate != null) { - Logger.d(TAG, "set type: %s", mode.name()); + CallerLogger.INSTANCE.d(TAG, "set type: " + mode.name()); mDelegate.changeMapMode(mode); } } @@ -96,7 +96,7 @@ public class MogoMapUIController implements IMogoMapUIController { public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) { initDelegate(); if (mDelegate != null) { - Logger.d(TAG, "set VisualAngle: %s", angelMode.name()); + CallerLogger.INSTANCE.d(TAG, "set VisualAngle: " + angelMode.name()); mDelegate.changeMapVisualAngle(angelMode, mogoLatLng); } } @@ -366,7 +366,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public int getSpeedLimmit(double lon, double lat, float angle) { if (mDelegate != null) { - return mDelegate.getSpeedLimmit(lon,lat,angle); + return mDelegate.getSpeedLimmit(lon, lat, angle); } return 0; } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java index 25194f8a3d..a990e856e7 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.java @@ -7,10 +7,10 @@ import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; - import androidx.annotation.Nullable; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; + /** * @author congtaowang * @since 2019-12-18 @@ -21,32 +21,32 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle { private static final String TAG = "MogoMapView"; - public MogoMapView( Context context ) { - super( context ); + public MogoMapView(Context context) { + super(context); } - public MogoMapView( Context context, @Nullable AttributeSet attrs ) { - super( context, attrs ); + public MogoMapView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); } - public MogoMapView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { - super( context, attrs, defStyleAttr ); + public MogoMapView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); } private boolean mIsVrMode = false; @Override - protected void addMapView( Context context ) { - mMapView = MogoMapDelegateFactory.getMapView( context ); - if ( mMapView != null ) { + protected void addMapView(Context context) { + mMapView = MogoMapDelegateFactory.getMapView(context); + if (mMapView != null) { final View mapView = mMapView.getMapView(); - if ( mapView != null ) { - addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) ); + if (mapView != null) { + addView(mapView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); } else { - Logger.e( TAG, "create MapView instance failed." ); + CallerLogger.INSTANCE.e(TAG, "create MapView instance failed."); } } else { - Logger.e( TAG, "create IMogoMapView instance failed." ); + CallerLogger.INSTANCE.e(TAG, "create IMogoMapView instance failed."); } } @@ -55,32 +55,32 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle { } @Override - public void onCreate( Bundle bundle ) { - super.onCreate( bundle ); - Logger.d( TAG, "onCreate" ); + public void onCreate(Bundle bundle) { + super.onCreate(bundle); + CallerLogger.INSTANCE.d(TAG, "onCreate"); } @Override public void onResume() { super.onResume(); - Logger.d( TAG, "onResume" ); + CallerLogger.INSTANCE.d(TAG, "onResume"); } @Override public void onPause() { super.onPause(); - Logger.d( TAG, "onPause" ); + CallerLogger.INSTANCE.d(TAG, "onPause"); } @Override public void onDestroy() { super.onDestroy(); - Logger.d( TAG, "onDestroy" ); + CallerLogger.INSTANCE.d(TAG, "onDestroy"); } @Override - public void onSaveInstanceState( Bundle outState ) { - super.onSaveInstanceState( outState ); + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); } @Override diff --git a/modules/mogo-module-carchatting/.gitignore b/modules/mogo-module-carchatting/.gitignore deleted file mode 100644 index 796b96d1c4..0000000000 --- a/modules/mogo-module-carchatting/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/modules/mogo-module-carchatting/build.gradle b/modules/mogo-module-carchatting/build.gradle deleted file mode 100644 index 665003d96b..0000000000 --- a/modules/mogo-module-carchatting/build.gradle +++ /dev/null @@ -1,97 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-android-extensions' - id 'kotlin-kapt' - id 'com.alibaba.arouter' -} - -android { - compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion - defaultConfig { - minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion - versionCode Integer.valueOf(VERSION_CODE) - versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'consumer-rules.pro' - //ARouter apt 参数 - kapt { - useBuildCache = false - arguments { - arg("AROUTER_MODULE_NAME", project.getName()) - } - } - } - - buildTypes { - release { - minifyEnabled false - zipAlignEnabled false - consumerProguardFiles 'consumer-rules.pro' - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - sourceSets { - main { - java.srcDirs = ['src/main/java', 'src/main/aidl'] - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - compileOnly rootProject.ext.dependencies.kotlinstdlibjdk7 - compileOnly rootProject.ext.dependencies.androidxccorektx - implementation rootProject.ext.dependencies.androidxrecyclerview - compileOnly rootProject.ext.dependencies.coroutinescore - compileOnly rootProject.ext.dependencies.coroutinesandroid - compileOnly rootProject.ext.dependencies.androidxappcompat - compileOnly rootProject.ext.dependencies.androidxconstraintlayout - compileOnly rootProject.ext.dependencies.gson - - implementation rootProject.ext.dependencies.arouter - kapt rootProject.ext.dependencies.aroutercompiler - - implementation rootProject.ext.dependencies.circleimageview - implementation rootProject.ext.dependencies.mogowebsocket - - if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { - compileOnly rootProject.ext.dependencies.callchatprovider - compileOnly rootProject.ext.dependencies.mogomap - compileOnly rootProject.ext.dependencies.mogo_core_utils - compileOnly rootProject.ext.dependencies.mogocommons - compileOnly rootProject.ext.dependencies.mogoserviceapi - compileOnly rootProject.ext.dependencies.modulecommon - - implementation rootProject.ext.dependencies.chat - - implementation rootProject.ext.dependencies.mogo_core_utils - implementation rootProject.ext.dependencies.mogo_core_data - - } else { - //compileOnly project(':modules:mogo-module-carchattingprovider') - - api project(":libraries:mogo-map") - api project(':core:mogo-core-utils') - api project(":foudations:mogo-commons") - api project(':services:mogo-service-api') - implementation project(':modules:mogo-module-common') - - implementation project(':modules:mogo-module-chat') - - implementation project(':core:mogo-core-utils') - implementation project(':core:mogo-core-data') - - } -} -apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/modules/mogo-module-carchatting/consumer-rules.pro b/modules/mogo-module-carchatting/consumer-rules.pro deleted file mode 100644 index 256ab340f9..0000000000 --- a/modules/mogo-module-carchatting/consumer-rules.pro +++ /dev/null @@ -1,33 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile - --keep class com.mogo.module.carchatting.bean.*{*;} --keep class com.mogo.module.carchatting.card.CallChatProvider.*{*;} --keep class com.mogo.module.carchatting.card.CallChatConstant.*{*;} --keep class com.mogo.module.carchatting.biz.IBizCallChat.*{*;} --keep class com.mogo.module.carchatting.invoke.CarsChattingProvider.*{*;} --keep class com.mogo.module.carchatting.net.HttpApi.*{*;} --keep class com.mogo.module.carchatting.net.HttpConstant.*{*;} --keep class com.mogo.module.carchatting.util.AnalyticsUtil.*{*;} --keep class com.mogo.module.carchatting.util.DateUtilKt.*{*;} --keep class com.mogo.module.carchatting.view.*{*;} --keep class com.mogo.module.carchatting.voice.*{*;} diff --git a/modules/mogo-module-carchatting/gradle.properties b/modules/mogo-module-carchatting/gradle.properties deleted file mode 100644 index 8b9b21f7b6..0000000000 --- a/modules/mogo-module-carchatting/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=com.mogo.module.carchatim -POM_ARTIFACT_ID=module-carchatting -VERSION_CODE=1 \ No newline at end of file diff --git a/modules/mogo-module-carchatting/proguard-rules.pro b/modules/mogo-module-carchatting/proguard-rules.pro deleted file mode 100644 index 73cc6045c4..0000000000 --- a/modules/mogo-module-carchatting/proguard-rules.pro +++ /dev/null @@ -1,58 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile - -#kotlin --dontwarn kotlin.* --dontwarn kotlin.** --keep class kotlin.* { *; } --keepclassmembernames class kotlinx.*{ - volatile ; -} --keepclassmembernames class kotlin.*{ - volatile ; -} --keep class kotlin.Metadata { *; } --keepclassmembers class **$WhenMappings { - ; -} --keepclassmembers class kotlin.Metadata { - public ; -} --keepclassmembers class kotlin.Metadata { *; } --keep @kotlin.Metadata class * --keepclasseswithmembers @kotlin.Metadata class * { *; } - -#-----CallChating----- -#AIDL --keep class com.zhidao.imdemo.* --keep class com.zhidao.imdemo.IMCallBack.*{*;} --keep class com.zhidao.imdemo.IMCallRequest.*{*;} --keep class com.mogo.module.carchatting.biz.IMCallManager.*{*;} - -#Bean --keep class com.mogo.module.carchatting.bean.* --keep class com.mogo.module.carchatting.bean.ResponseInfo.*{*;} --keep class com.mogo.module.carchatting.bean.UserInfo{*;} --keep class com.mogo.module.carchatting.card.* --keep class com.mogo.module.carchatting.card.CallChatConstant.MODULE_NAME.* --keep class com.mogo.module.carchatting.card.CallChatConstant.PROVIDER.* --keep class com.mogo.module.carchatting.card.CallChatConstant.PATH.* \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/AndroidManifest.xml b/modules/mogo-module-carchatting/src/main/AndroidManifest.xml deleted file mode 100644 index b7799dd97e..0000000000 --- a/modules/mogo-module-carchatting/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/adapter/VehicleTeamAdapter.java b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/adapter/VehicleTeamAdapter.java deleted file mode 100644 index f640639760..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/adapter/VehicleTeamAdapter.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.mogo.module.carchatting.adapter; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.bumptech.glide.request.RequestOptions; -import com.mogo.chat.model.bean.TeammateInfo; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp; -import com.mogo.module.carchatting.R; -import com.mogo.module.common.glide.SkinAbleBitmapTarget; - - -import java.util.List; - -import de.hdodenhof.circleimageview.CircleImageView; - -/** - * created by wujifei on 2020/11/16 16:30 - * describe:车队人员适配器 - */ -public class VehicleTeamAdapter extends RecyclerView.Adapter { - private Context mContext; - private List teammates; - - public VehicleTeamAdapter(Context mContext, List teammates) { - this.mContext = mContext; - this.teammates = teammates; - } - - public void setTeammates(List teammates) { - this.teammates = teammates; - } - - @NonNull - @Override - public VehicleTeamViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new VehicleTeamViewHolder(LayoutInflater.from(mContext).inflate(R.layout.module_car_chatting_launcher_teammate_item, parent, false)); - } - - @Override - public void onBindViewHolder(@NonNull VehicleTeamViewHolder holder, int position) { - TeammateInfo teammateInfo = teammates.get(position); - RequestOptions requestOptions = new RequestOptions().circleCrop() - .placeholder(R.mipmap.module_carchatting_default_head_img) - .error(R.mipmap.module_carchatting_default_head_img); - GlideApp.with(AbsMogoApplication.getApp().getApplicationContext()).asBitmap() - .load(teammateInfo.getHeadImgUrl()) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(new SkinAbleBitmapTarget(holder.moduleCarchattingCivHead, requestOptions)); - holder.moduleCarchattingTvNickname.setText(teammateInfo.getNickName() == null ? "蘑菇车主" : teammateInfo.getNickName()); - if (teammateInfo.getVehicleTeamLeader()) { - holder.moduleCarchattingTvIdentity.setText("队长"); - holder.moduleCarchattingTvIdentity.setBackgroundResource(R.drawable.module_carchatting_team_teammate_leader_bg); - holder.moduleCarchattingTvIdentity.setTextColor(mContext.getResources().getColor(R.color.module_carchatting_team_leader)); - } else { - holder.moduleCarchattingTvIdentity.setText("队员"); - holder.moduleCarchattingTvIdentity.setBackgroundResource(R.drawable.module_carchatting_team_teammate_follower_bg); - } - - holder.itemView.setOnClickListener(view -> { - if (mClickListener != null) { - mClickListener.onItemClickListener(position, teammateInfo); - } - }); - - } - - @Override - public int getItemCount() { - return teammates == null ? 0 : teammates.size(); - } - - - static class VehicleTeamViewHolder extends RecyclerView.ViewHolder { - private TextView moduleCarchattingTvIdentity; - private CircleImageView moduleCarchattingCivHead; - private TextView moduleCarchattingTvNickname; - - - public VehicleTeamViewHolder(@NonNull View itemView) { - super(itemView); - moduleCarchattingTvIdentity = (TextView) itemView.findViewById(R.id.module_carchatting_tv_identity); - moduleCarchattingCivHead = (CircleImageView) itemView.findViewById(R.id.module_carchatting_civ_head); - moduleCarchattingTvNickname = (TextView) itemView.findViewById(R.id.module_carchatting_tv_nickname); - } - } - - private VehicleTeamItemClickListener mClickListener; - - public void setItemClickListener(VehicleTeamItemClickListener clickListener) { - this.mClickListener = clickListener; - } - - public interface VehicleTeamItemClickListener { - void onItemClickListener(int position, TeammateInfo teammateInfo); - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/Anim.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/Anim.kt deleted file mode 100644 index c6082347f8..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/Anim.kt +++ /dev/null @@ -1,82 +0,0 @@ -package com.mogo.module.carchatting.anim_dsl - -import android.animation.Animator -import android.animation.AnimatorSet -import android.animation.ValueAnimator -import android.view.animation.Interpolator -import android.view.animation.LinearInterpolator - -/** - * an Animation just like [ValueAnimator], but it could reverse itself without the limitation of API level - * [ValueAnimator.reverse] is only available to the API level over 26. - * so this class comes to help. - */ -abstract class Anim { - /** - * the real Animator which is about to run - */ - abstract var animator: Animator - var builder: AnimatorSet.Builder? = null - /** - * the duration of Animator - */ - var duration - get() = 300L - set(value) { - animator.duration = value - } - /** - * the interpolator of Animator - */ - var interpolator - get() = LinearInterpolator() as Interpolator - set(value) { - animator.interpolator = value - } - /** - * start delay of Animator - */ - var delay - get() = 0L - set(value) { - animator.startDelay = value - } - - /** - * the callbacks describe the status of animation - */ - var onRepeat: ((Animator) -> Unit)? = null - var onEnd: ((Animator) -> Unit)? = null - var onCancel: ((Animator) -> Unit)? = null - var onStart: ((Animator) -> Unit)? = null - - /** - * reverse the value of [ValueAnimator] - */ - abstract fun reverse() - - /** - * to the beginning of animation - */ - abstract fun toBeginning() - - internal fun addListener() { - animator.addListener(object : Animator.AnimatorListener { - override fun onAnimationRepeat(animation: Animator?) { - animation?.let { onRepeat?.invoke(it) } - } - - override fun onAnimationEnd(animation: Animator?) { - animation?.let { onEnd?.invoke(it) } - } - - override fun onAnimationCancel(animation: Animator?) { - animation?.let { onCancel?.invoke(it) } - } - - override fun onAnimationStart(animation: Animator?) { - animation?.let { onStart?.invoke(it) } - } - }) - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/AnimSet.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/AnimSet.kt deleted file mode 100644 index f2c8aea74f..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/AnimSet.kt +++ /dev/null @@ -1,155 +0,0 @@ -package com.mogo.module.carchatting.anim_dsl - -import android.animation.Animator -import android.animation.AnimatorSet - -/** - * a Container for [Anim] just like [AnimatorSet], but it could reverse itself without API level limitation. - * In addition, it is easy to build mush shorter and readable animation code like the following: - * - * animSet { - * anim { - * values = floatArrayOf(1.0f, 1.4f) - * action = { value -> tv.scaleX = (value as Float) } - * } with anim { - * values = floatArrayOf(0f, -200f) - * action = { value -> tv.translationY = (value as Float) } - * } - * duration = 200L - * } - * - * if you want to run animation with several properties on one Object, - * using [ObjectAnim] is more efficient than [ValueAnim], like the following: - * - * animSet { - * objectAnim { - * target = tvTitle - * translationX = floatArrayOf(0f, 200f) - * alpha = floatArrayOf(1.0f, 0.3f) - * scaleX = floatArrayOf(1.0f, 1.3f) - * } - * duration = 100L - * } - * - */ -class AnimSet : Anim() { - override var animator: Animator = AnimatorSet() - private val animatorSet - get() = animator as AnimatorSet - - private val anims by lazy { mutableListOf() } - - /** - * whether animation is at start point - */ - private var isAtStartPoint: Boolean = true - /** - * whether animation value has reversed - */ - private var hasReverse: Boolean = false - - /** - * it creates a single [ValueAnim] - * [with] and [before] is available to combine several [anim] to one complex animation set by chain-invocation style. - */ - fun anim(animCreation: ValueAnim.() -> Unit): Anim = ValueAnim().apply(animCreation).also { it.addListener() }.also { anims.add(it) } - - /** - * build an [ObjectAnim] with a much shorter and readable code by DSL - */ - fun objectAnim(action: ObjectAnim.() -> Unit): Anim = - ObjectAnim().apply(action).also { it.setPropertyValueHolder() }.also { it.addListener() }.also { anims.add(it) } - - /** - * start the [AnimSet] - */ - fun start() { - if (animatorSet.isRunning) return - anims.takeIf { hasReverse }?.forEach { anim -> anim.reverse() }.also { hasReverse = false } - if (anims.size == 1) animatorSet.play(anims.first().animator) - if (isAtStartPoint) { - animatorSet.start() - isAtStartPoint = false - } - } - - /** - * reverse the animation - */ - override fun reverse() { - if (animatorSet.isRunning) return - anims.takeIf { !hasReverse }?.forEach { anim -> anim.reverse() }.also { hasReverse = true } - if (!isAtStartPoint) { - animatorSet.start() - isAtStartPoint = true - } - - } - - override fun toBeginning() { - anims.forEach { it.toBeginning() } - } - - /** - * get the animation in the [AnimSet] by [index] - */ - fun getAnim(index: Int) = anims.takeIf { index in 0 until anims.size }?.let { it[index] } - - /** - * cancel the [AnimatorSet] - */ - fun cancel() { - animatorSet.cancel() - } - - /** - * if you want to play animations one after another, use [before] to link several [Anim], - * like the following: - * - * animSet { - * anim { - * value = floatArrayOf(1.0f, 1.4f) - * action = { value -> tv.scaleX = (value as Float) } - * } before anim { - * values = floatArrayOf(0f, -200f) - * action = { value -> btn.translationY = (value as Float) } - * } - * duration = 200L - * } - * - */ - infix fun Anim.before(anim: Anim): Anim { - animatorSet.play(animator).before(anim.animator).let { this.builder = it } - return anim - } - - /** - * if you want to play animations at the same time, use [with] to link several [Anim], - * like the following: - * - * animSet { - * play { - * value = floatArrayOf(1.0f, 1.4f) - * action = { value -> tv.scaleX = (value as Float) } - * } with anim { - * values = floatArrayOf(0f, -200f) - * action = { value -> btn.translationY = (value as Float) } - * } - * duration = 200L - * } - * - * if there are both [with] and [before] in one invocation chain, [with] has higher priority, - * for example: `a before b with c` means b and c will play at the same time and a plays before them - * - */ - infix fun Anim.with(anim: Anim): Anim { - if (builder == null) builder = animatorSet.play(animator).with(anim.animator) - else builder?.with(anim.animator) - return anim - } -} - -/** - * build a set of animation with a much shorter and readable code by DSL - */ -fun animSet(creation: AnimSet.() -> Unit) = AnimSet().apply { creation() }.also { it.addListener() } diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/ObjectAnim.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/ObjectAnim.kt deleted file mode 100644 index b33c4b9423..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/ObjectAnim.kt +++ /dev/null @@ -1,219 +0,0 @@ -package com.mogo.module.carchatting.anim_dsl - -import android.animation.Animator -import android.animation.ObjectAnimator -import android.animation.PropertyValuesHolder -import android.animation.ValueAnimator -import android.view.View - -/** - * An Animator just like [ObjectAnimator], but it could reverse itself without the limitation of API level. - * In addition, combing with [AnimSet], it is easy to build much more readable animation code. See at [AnimSet] - */ -class ObjectAnim : Anim() { - companion object { - private const val TRANSLATION_X = "translationX" - private const val TRANSLATION_Y = "translationY" - private const val SCALE_X = "scaleX" - private const val SCALE_Y = "scaleY" - private const val ALPHA = "alpha" - private const val ROTATION = "rotation" - private const val ROTATION_X = "rotationX" - private const val ROTATION_Y = "rotationY" - } - - /** - * the [ObjectAnim] is about to run - */ - override var animator: Animator = ObjectAnimator() - private val objectAnimator - get() = animator as ObjectAnimator - - /** - * predefine properties for [android.view.View] - * add a set() for each property inorder to change it dynamically - */ - var translationX: FloatArray? = null - set(value) { - field = value - translationX?.let { PropertyValuesHolder.ofFloat(TRANSLATION_X, *it) }?.let { property -> - valuesHolder[TRANSLATION_X] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var translationY: FloatArray? = null - set(value) { - field = value - translationY?.let { PropertyValuesHolder.ofFloat(TRANSLATION_Y, *it) }?.let { property -> - valuesHolder[TRANSLATION_Y] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var scaleX: FloatArray? = null - set(value) { - field = value - scaleX?.let { PropertyValuesHolder.ofFloat(SCALE_X, *it) }?.let { property -> - valuesHolder[SCALE_X] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var scaleY: FloatArray? = null - set(value) { - field = value - scaleY?.let { PropertyValuesHolder.ofFloat(SCALE_Y, *it) }?.let { property -> - valuesHolder[SCALE_Y] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var alpha: FloatArray? = null - set(value) { - field = value - alpha?.let { PropertyValuesHolder.ofFloat(ALPHA, *it) }?.let { property -> - valuesHolder[ALPHA] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var rotation: FloatArray? = null - set(value) { - field = value - rotation?.let { PropertyValuesHolder.ofFloat(ROTATION, *it) }?.let { property -> - valuesHolder[ROTATION] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var rotationX: FloatArray? = null - set(value) { - field = value - rotationX?.let { PropertyValuesHolder.ofFloat(ROTATION_X, *it) }?.let { property -> - valuesHolder[ROTATION_X] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - var rotationY: FloatArray? = null - set(value) { - field = value - rotationY?.let { PropertyValuesHolder.ofFloat(ROTATION_Y, *it) }?.let { property -> - valuesHolder[ROTATION_Y] = property - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } - } - /** - * the object to be animated which is needed for [ObjectAnimator] - */ - var target: Any? = null - set(value) { - field = value - (animator as ObjectAnimator).target = value - } - /** - * the repeat times of [ObjectAnim] - * [ValueAnimator.INFINITE] means repeat forever - */ - var repeatCount - get() = 0 - set(value) { - objectAnimator.repeatCount = value - } - - /** - * the repeat mode of [ObjectAnim] - * the available value is [ValueAnimator.RESTART] or [ValueAnimator.REVERSE] - */ - var repeatMode - get() = ValueAnimator.RESTART - set(value) { - objectAnimator.repeatMode = value - } - /** - * a map of [PropertyValuesHolder] to describe what kind of animations to run - */ - private val valuesHolder = mutableMapOf() - - /** - * reverse the value of [ObjectAnimator] - */ - override fun reverse() { - valuesHolder.forEach { valuesHolder -> - when (valuesHolder.key) { - TRANSLATION_X -> translationX?.let { - it.reverse() - this.valuesHolder[TRANSLATION_X]?.setFloatValues(*it) - } - TRANSLATION_Y -> translationY?.let { - it.reverse() - this.valuesHolder[TRANSLATION_Y]?.setFloatValues(*it) - } - SCALE_X -> scaleX?.let { - it.reverse() - this.valuesHolder[SCALE_X]?.setFloatValues(*it) - } - SCALE_Y -> scaleY?.let { - it.reverse() - this.valuesHolder[SCALE_Y]?.setFloatValues(*it) - } - ALPHA -> alpha?.let { - it.reverse() - this.valuesHolder[ALPHA]?.setFloatValues(*it) - } - ROTATION -> rotation?.let { - it.reverse() - this.valuesHolder[ROTATION]?.setFloatValues(*it) - } - ROTATION_X -> rotationX?.let { - it.reverse() - this.valuesHolder[ROTATION_X]?.setFloatValues(*it) - } - ROTATION_Y -> rotationY?.let { - it.reverse() - this.valuesHolder[ROTATION_Y]?.setFloatValues(*it) - } - } - } - } - - override fun toBeginning() { - valuesHolder.forEach { valuesHolder -> - when (valuesHolder.key) { - TRANSLATION_X -> translationX?.let { - (target as? View)?.translationX = it.first() - } - TRANSLATION_Y -> translationY?.let { - (target as? View)?.translationY = it.first() - } - SCALE_X -> scaleX?.let { - (target as? View)?.scaleX = it.first() - } - SCALE_Y -> scaleY?.let { - (target as? View)?.scaleY = it.first() - } - ALPHA -> alpha?.let { - (target as? View)?.alpha = it.first() - } - ROTATION -> rotation?.let { - (target as? View)?.rotation = it.first() - } - ROTATION_X -> rotationX?.let { - (target as? View)?.rotationX = it.first() - } - ROTATION_Y -> rotationY?.let { - (target as? View)?.rotationY = it.first() - } - } - } - } - - /** - * add available [PropertyValuesHolder] to the list - */ - fun setPropertyValueHolder() { - translationX?.let { PropertyValuesHolder.ofFloat(TRANSLATION_X, *it) }?.let { valuesHolder[TRANSLATION_X] = it } - translationY?.let { PropertyValuesHolder.ofFloat(TRANSLATION_Y, *it) }?.let { valuesHolder[TRANSLATION_Y] = it } - scaleX?.let { PropertyValuesHolder.ofFloat(SCALE_X, *it) }?.let { valuesHolder[SCALE_X] = it } - scaleY?.let { PropertyValuesHolder.ofFloat(SCALE_Y, *it) }?.let { valuesHolder[SCALE_Y] = it } - alpha?.let { PropertyValuesHolder.ofFloat(ALPHA, *it) }?.let { valuesHolder[ALPHA] = it } - rotation?.let { PropertyValuesHolder.ofFloat(ROTATION, *it) }?.let { valuesHolder[ROTATION] = it } - rotationX?.let { PropertyValuesHolder.ofFloat(ROTATION_X, *it) }?.let { valuesHolder[ROTATION_X] = it } - rotationY?.let { PropertyValuesHolder.ofFloat(ROTATION_Y, *it) }?.let { valuesHolder[ROTATION_Y] = it } - objectAnimator.setValues(*valuesHolder.values.toTypedArray()) - } -} diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/ValueAnim.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/ValueAnim.kt deleted file mode 100644 index bdcb7345fb..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/anim_dsl/ValueAnim.kt +++ /dev/null @@ -1,84 +0,0 @@ -package com.mogo.module.carchatting.anim_dsl - -import android.animation.Animator -import android.animation.ValueAnimator - -/** - * An Animator just like [ValueAnimator], but it could reverse itself without the limitation of API level. - * In addition, combing with [AnimSet], it is easy to build much more readable animation code. See at [AnimSet] - */ -class ValueAnim : Anim() { - /** - * the [ValueAnimator] is about to run - */ - override var animator: Animator = ValueAnimator() - private val valueAnimator - get() = animator as ValueAnimator - - /** - * the animation value - */ - var values: Any? = null - set(value) { - field = value - value?.let { - when (it) { - is FloatArray -> valueAnimator.setFloatValues(*it) - is IntArray -> valueAnimator.setIntValues(*it) - else -> throw IllegalArgumentException("unsupported value type") - } - } - } - - /** - * [action] describe what to animate - */ - var action: ((Any) -> Unit)? = null - set(value) { - field = value - valueAnimator.addUpdateListener { valueAnimator -> - valueAnimator.animatedValue.let { value?.invoke(it) } - } - } - /** - * the repeat times of [ValueAnim] - * [ValueAnimator.INFINITE] means repeat forever - */ - var repeatCount - get() = 0 - set(value) { - valueAnimator.repeatCount = value - } - - /** - * the repeat mode of [ValueAnim] - * the available value is [ValueAnimator.RESTART] or [ValueAnimator.REVERSE] - */ - var repeatMode - get() = ValueAnimator.RESTART - set(value) { - valueAnimator.repeatMode = value - } - - /** - * reverse the value of [ValueAnimator] - */ - override fun reverse() { - values?.let { - when (it) { - is FloatArray -> { - it.reverse() - valueAnimator.setFloatValues(*it) - } - is IntArray -> { - it.reverse() - valueAnimator.setIntValues(*it) - } - else -> throw IllegalArgumentException("unsupported type of value") - } - } - } - - override fun toBeginning() { - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/EnthusiasmIndex.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/EnthusiasmIndex.kt deleted file mode 100644 index 6d02178e4b..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/EnthusiasmIndex.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.mogo.module.carchatting.bean - -class EnthusiasmIndex( - val id: Int = 0, val sn: String? = null, - val score: Int = 0, val shareNum: Int = 0, - val likeNum: Int = 0, val notLikeNum: Int = 0, - val enthusiasmIndex: Double = 10.0, - val createTime: String? = null, val updateTime: String? = null -) \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/ErrorInfo.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/ErrorInfo.kt deleted file mode 100644 index 857b3552de..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/ErrorInfo.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.module.carchatting.bean - -data class ErrorInfo(var errorCode: Int, var errorMsg: String) \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/ResponseInfo.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/ResponseInfo.kt deleted file mode 100644 index bd04247747..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/ResponseInfo.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.module.carchatting.bean - -data class ResponseInfo(var code: Int, var msg: String) \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/Result.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/Result.kt deleted file mode 100644 index 183b834903..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/Result.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.module.carchatting.bean - -class Result(val enthusiasmIndex: EnthusiasmIndex) \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/UserInfo.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/UserInfo.kt deleted file mode 100644 index 21656397b3..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/UserInfo.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.mogo.module.carchatting.bean - -import android.text.TextUtils -import com.mogo.chat.model.bean.Sns - -fun toUserInfo(sns: Sns): UserInfo { - return UserInfo(sns.sn, - sns.userId.toLong(), - sns.nickName ?: "", - sns.headImgUrl ?: "", - sns.cardIdSex ?: "", - sns.cardIdAge ?: "", - sns.carInfo ?: "", - sns.cityName ?: "", - sns.lat.toString(), - sns.lon.toString()) -} - -class UserInfo( - val sn: String, - val userId: Long, - userName: String? = "小蘑菇", - val userHead: String?, - val gender: String?, - val age: String?, - val carTypeName: String?, - val location: String?, - val lat: String, - val lon: String -) { - var userName: String? = "小蘑菇" - set(value) { - field = if (TextUtils.isEmpty(value)) { - "小蘑菇" - } else { - value - } - } - - init { - if (TextUtils.isEmpty(userName)) { - this.userName = "小蘑菇" - } else { - this.userName = userName - } - } - - override fun toString(): String { - return "UserInfo(sn='$sn', userId=$userId, userHead='$userHead', gender='$gender', age='$age', carTypeName='$carTypeName', location='$location', userName='$userName', lat='$lat', lon='$lon')" - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/VoiceWake.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/VoiceWake.kt deleted file mode 100644 index b30a936749..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/bean/VoiceWake.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.module.carchatting.bean - -import com.google.gson.annotations.SerializedName - -fun VoiceWake.check():Boolean{ - return obj.equals("车聊聊") && operation.equals("打开") -} - -class VoiceWake { - - @SerializedName("object") - var obj:String? = null - - var operation:String? = null -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt deleted file mode 100644 index f354c2e6b0..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt +++ /dev/null @@ -1,747 +0,0 @@ -package com.mogo.module.carchatting.biz - -import android.content.Context -import androidx.fragment.app.FragmentActivity -import com.alibaba.android.arouter.launcher.ARouter -import com.google.gson.Gson -import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.chat.service.IMService -import com.mogo.chat.util.UserInfoHelper -import com.mogo.chat.util.UserInfoHelper.currentCallType -import com.mogo.chat.util.log -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast -import com.mogo.module.carchatting.R -import com.mogo.module.carchatting.bean.UserInfo -import com.mogo.module.carchatting.card.CallChatConstant.Companion.MODULE_NAME -import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG -import com.mogo.module.carchatting.util.* -import com.mogo.module.carchatting.view.CallingWindowManager.Companion.callingWindowManager -import com.mogo.module.carchatting.view.MapViewManager.Companion.mapViewManager -import com.mogo.module.carchatting.view.TeamInvitationWindowManager.Companion.teamInvitationWindowManager -import com.mogo.module.carchatting.view.UserWindowManager.Companion.userWindowManager -import com.mogo.module.carchatting.view.VehicleTeamFragment -import com.mogo.module.carchatting.voice.IVoiceCommandListener -import com.mogo.module.carchatting.voice.IVoiceIntentListener -import com.mogo.module.carchatting.voice.VoiceUtil -import com.mogo.service.IMogoServiceApis -import com.mogo.service.statusmanager.IMogoStatusChangedListener -import com.mogo.service.statusmanager.StatusDescriptor -import com.zhidao.carchattingprovider.MogoDriverInfo - -class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCommandListener, - IVoiceIntentListener { - - companion object { - - val callChatCenter by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - CallChatCenter() - } - } - - private var showCallWindowFromDefault = false - private var currentUserInfo: UserInfo? = null - private var teamMember: List? = null - - private var serviceApi: IMogoServiceApis? = null - private var context: Context? = null - private val callChatManager: CallChatManager = CallChatManager(this) - - private var callWindowStatusListener: ((Boolean) -> Unit)? = null - private var userWindowStatusListener: ((Boolean) -> Unit)? = null - - private var flag: String? = null - private var containerId: Int? = null - private var activity: FragmentActivity? = null - - fun init(mContext: Context) { - Logger.i(TAG, "init") - this.context = mContext - initServiceApi() - teamInvitationWindowManager.init(mContext) - callingWindowManager.init(mContext, serviceApi!!, { - match(MATCH_TYPE_MANUAL, 2) - }, { - cancelMatch(false) - }, { - showVehicleTeamFragment() - }, { - hangUp() - }, { -// Logger.i(TAG, "click head to move caller position , currentUserInfo : $currentUserInfo") -// MogoApisHandler.getInstance().apis.mapServiceApi.mapUIController -// .moveToCenter(MogoLatLng(currentUserInfo?.lat?.toDouble() -// ?: 0.0, currentUserInfo?.lon?.toDouble() ?: 0.0)) //todo 需要产品理出需求,兼容他车 - }) - VoiceUtil.registerAll(context!!, this, this) - syncInitStatus() - } - - private fun initServiceApi() { - Logger.i(TAG, "initServiceApi Launch IMService") - IMService.launchService(context!!) - Logger.i(TAG, "initServiceApi IMogoServiceApis") - val mogoService = ARouter.getInstance().build(PATH_SERVICE_APIS).navigation() - if (mogoService is IMogoServiceApis) { - this.serviceApi = mogoService - } - serviceApi?.statusManagerApi?.registerStatusChangedListener( - MODULE_NAME, - StatusDescriptor.MAIN_PAGE_RESUME, - statusChangedListener - ) - serviceApi?.statusManagerApi?.registerStatusChangedListener( - MODULE_NAME, - StatusDescriptor.VR_MODE, - statusChangedListener - ) - } - - private val statusChangedListener = IMogoStatusChangedListener { descriptor, status -> - Logger.i(TAG, "IMogoStatusChangedListener status : $status descriptor : $descriptor") - when (descriptor) { - StatusDescriptor.MAIN_PAGE_RESUME -> { - if (status) { - VoiceUtil.registerAll(context!!, this, this) - syncInitStatus() - Logger.i( - TAG, - "MAIN_PAGE_RESUME callType: $currentCallType , status : ${callChatManager.isCalling()}" - ) - if (currentCallType == CALL_TYPE_VEHICLE_TEAM && callChatManager.isCalling()) { - callWindowShowCallBack() - callingWindowManager.showVehicleTeamView() - callingWindowManager.updateVehicleTeamHeadView(teamMember) - mapViewManager.updateTeamMarker(context!!, teamMember) - } else if (callChatManager.isInit()) { - callingWindowManager.showInitView() - } else { - syncCallViewStatus() - } - } else { - VoiceUtil.unregisterAll(context!!, this) - onPause() - } - } - StatusDescriptor.VR_MODE -> { - Logger.i( - TAG, - "VR_MODE callType: $currentCallType , status : ${callChatManager.isCalling()}" - ) - updateCallingWindowInVRMode() - } - else -> { - //do nothing for now - } - } - } - - //更新VRMode模式下打电话界面 - private fun updateCallingWindowInVRMode() { - callingWindowManager.resetVRModeView() - if (!callingWindowManager.isCallingWindowShow()) { - return - } - if (currentCallType == CALL_TYPE_VEHICLE_TEAM && callChatManager.isCalling()) { - callWindowHideCallBack() - callingWindowManager.hideVehicleTeamView() - callWindowShowCallBack() - callingWindowManager.showVehicleTeamView() - callingWindowManager.updateVehicleTeamHeadView(teamMember) - mapViewManager.updateTeamMarker(context!!, teamMember) - } else { - callingWindowManager.hideCallingView() - callWindowHideCallBack() - syncCallViewStatus() - } - } - - fun invokeCall(userData: String) { - Logger.d(TAG, "其他模块来请求打电话给某人: $userData") - if (showCallWindowFromDefault) { - toast(R.string.module_car_chat_can_not_call) - return - } - showCallWindowFromDefault = true - handleCallInvokeData(userData) - } - - fun registerCallWindowStatusListener(callWindowStatusListener: ((Boolean) -> Unit)) { - this.callWindowStatusListener = callWindowStatusListener - } - - fun unRegisterCallWindowStatusListener() { - this.callWindowStatusListener = null - } - - fun registerUserWindowStatusListener(userWindowStatusListener: ((Boolean) -> Unit)) { - this.userWindowStatusListener = userWindowStatusListener - } - - fun unRegisterUserWindowStatusListener() { - this.userWindowStatusListener = null - } - - fun showUserWindow(mogoDriverInfo: MogoDriverInfo) { - userWindowManager.showUserView(mogoDriverInfo) { - userWindowStatusListener?.invoke(it) - } - } - - fun hideUserWindow(onError: ((String) -> Unit)? = null, onFinish: (() -> Unit)? = null) { - if (userWindowManager.isCallingWindowShow()) { - userWindowManager.hideUserView() - } else { - onError?.invoke("user window already hide, please don't repeat call") - } - onFinish?.invoke() - } - - fun updateUserCallStatus(status: ((Boolean) -> Unit)) { - val callStatus = callChatManager.canCall() && !showCallWindowFromDefault - status.invoke(callStatus) - } - - fun getUserEnthusiasmIndex(sn: String) { - callChatManager.getEnthusiasmIndex(sn, { enthusiasmIndex -> - userWindowManager.updateUserEnthusiasmIndex(enthusiasmIndex) - }, { errorMsg -> - Logger.i(TAG, "获取用户热心指数失败 msg : $errorMsg") - }) - } - - fun getUserInfo(sn: String) { - callChatManager.getUserInfo(sn, { - val userInfoMap = Gson().fromJson>(it, Map::class.java) - userWindowManager.updateUserInfo(convertMapToDriverInfo(userInfoMap)) - }, { - Logger.i(TAG, it) - }) - } - - private fun match(matchType: Int, from: Int = 1) { - LogUtil.i(TAG, "startMatch") - AnalyticsUtil.track( - INVOKE_TRACK_MATCH_SHOW, - mutableMapOf("matchatype" to matchType, "source" to 2, "from" to from) - ) - callChatManager.match() - } - - private fun cancelMatch(isTTS: Boolean = true) { - LogUtil.i(TAG, "cancelMatch cardStatus : ${callChatManager.getStatusName()}") - if (callChatManager.isMatching()) { - LogUtil.i(TAG, "CARD_MATCHING cancelMatch") - callChatManager.cancelMatch() - cancelMatchToDefault(isTTS) - } - if (callChatManager.isMatchFailed()) { - LogUtil.i(TAG, "CARD_MATCH_FAILED matchFailed") - val type = if (isTTS) 1 else 2 - AnalyticsUtil.track( - INVOKE_TRACK_MATCH_FAIL_CLOSE_CLICK, - hashMapOf("type" to type) - ) - cancelMatchToDefault(isTTS) - } - } - - private fun showVehicleTeamFragment() { - LogUtil.i(TAG, "showVehicleTeamFragment") - activity?.supportFragmentManager - ?.beginTransaction() - ?.replace( - containerId!!, - VehicleTeamFragment.newInstance(), - VehicleTeamFragment::class.simpleName - ) - ?.commitNowAllowingStateLoss() - } - - fun closeVehicleTeamFragment() { - activity?.let { - it.supportFragmentManager.let { fragmentManager -> - fragmentManager.findFragmentByTag(VehicleTeamFragment::class.simpleName) - ?.let { fragment -> - fragmentManager.beginTransaction() - .remove(fragment) - .commitNowAllowingStateLoss() - } - } - } - } - - private fun cancelMatchToDefault(isTTS: Boolean) { - LogUtil.i(TAG, "cancelMatchToDefault ---> cardStatus : ${callChatManager.getStatusName()}") - if (isTTS) { - speakContent(context!!.getString(R.string.module_car_chat_already_cancel)) - } - refreshViewByType() - } - - override fun onVoiceStartMatch() { - match(MATCH_TYPE_VOICE) - } - - override fun onVoiceCancelCall() { - Logger.d(TAG, "语音 收到取消打电话指令====callStatus: ${callChatManager.getStatusName()}") - if (callChatManager.isReadyCalling()) { - refuseCall() - speakContent(context!!.resources.getString(R.string.module_car_chat_already_cancel)) - } - } - - override fun onVoiceCancelMatch(isTTS: Boolean) { - cancelMatch() - } - - private fun speakContent(content: String) { - VoiceUtil.speak(content, context!!, this) - } - - private fun handleCallInvokeData(userData: String) { - Logger.d(TAG, "handleCallInvokeData Thread: ${Thread.currentThread()}") - if (callChatManager.isInit()) { - callChatManager.invokeCallData(userData) - } else { - toast(R.string.module_car_chat_can_not_call) - } - } - - private fun syncCallViewStatus() { - Logger.d(TAG, "syncCallingStatus callStatus : ${callChatManager.getStatusName()}") - if (callChatManager.isCalling() || callChatManager.isReadyCalling() || callChatManager.isMatching()) { - showLauncherCallingView() - } - } - - private fun syncInitStatus() { - if (currentCallType != CALL_TYPE_VEHICLE_TEAM) { - callChatManager.getUserInfoForCall() - } - callChatManager.syncCallTimer { timeStr -> - taskMainLaunch { - Logger.d(TAG, "syncCallTimer ---> $timeStr") - callingWindowManager.updateTimer(parseTime(timeStr)) - } - } - } - - override fun showUserInfo(userInfo: String?) { - userInfo?.let { - val userInfoMap = Gson().fromJson>(userInfo, Map::class.java) - currentUserInfo = convertMapToUserInfo(userInfoMap) - if (currentCallType == CALL_TYPE_VEHICLE_TEAM) { - return - } - syncCallViewStatus() - } - } - - override fun toastMsg(msgId: Int) { - toast(msgId) - } - - /** - * 展示Launcher浮窗 - */ - private fun showReadyToCallView() { - Logger.d(TAG, "showCallingView callStatus : ${callChatManager.getStatusName()}") - if (!callChatManager.isCalling()) { - showLauncherCallingView() - } - } - - @Synchronized - private fun showLauncherCallingView() { - Logger.d(TAG, "showLauncherCallingView : onlineCarPanelApi hidePanel") - if (!showCallWindowFromDefault) { - Logger.d(TAG, "showLauncherCallingView : 接听电话,隐藏用户信息窗口") - hideUserWindow() - } - callWindowShowCallBack() - if (callChatManager.isMatching()) { - callingWindowManager.showMatchingView() - } else { - callingWindowManager.showCallingView(currentUserInfo) { - if (callChatManager.isCalling()) { - toast(R.string.module_car_chat_call_hangup) - hangUp() - } - if (callChatManager.isReadyCalling() || callChatManager.isInit()) { - refuseCall() - } - } - } - } - - @Synchronized - private fun hideLauncherCallingView() { - callWindowHideCallBack() - callingWindowManager.hideCallingView() - callingWindowManager.hideIncomingView() - } - - private fun callWindowShowCallBack() { - if (!callingWindowManager.isCallingWindowShow()) { - Logger.d(TAG, "callWindowStatusListener invoke true") - callWindowStatusListener?.invoke(true) - } - } - - private fun callWindowHideCallBack() { - if (callingWindowManager.isCallingWindowShow()) { - Logger.d(TAG, "callWindowStatusListener invoke false") - callWindowStatusListener?.invoke(false) - } - } - - override fun callTypeInit() { - refreshViewByType() - } - - override fun answerCall() { - Logger.d(TAG, "answerCall") - taskMainLaunch { - callingWindowManager.hideIncomingView() - showLauncherCallingView() - } - } - - override fun answerCallError(errorMsg: String) { - Logger.d(TAG, "answerCallError") - taskMainLaunch { - TipToast.shortTip(errorMsg) - } - } - - override fun call(userInfo: UserInfo?) { - Logger.d(TAG, "call===userInfo: $userInfo") - if (userInfo != null) { - currentUserInfo = userInfo - } - Logger.d(TAG, "call===currentUserInfo: $currentUserInfo") - connectSuccess() - } - - override fun invokeCallData(userInfo: UserInfo?) { - if (userInfo != null) { - Logger.d(TAG, "invokeCallData===$userInfo") - currentUserInfo = userInfo - currentUserInfo?.let { - if (it.sn == null) { - toast(R.string.module_car_chat_error_call_test) - resetCallingView() - return - } - if (it.sn == MoGoAiCloudClientConfig.getInstance().sn) { - toast(R.string.module_car_chat_self_error) - resetCallingView() - return - } - } - } - Logger.d(TAG, "currentUserInfo: $currentUserInfo") - AnalyticsUtil.track(INVOKE_TRACK_REQUEST_CALL_SHOW) - startCall() - showReadyToCallView() - syncCallViewStatus() - } - - private fun startCall() { - AnalyticsUtil.track(INVOKE_TRACK_REQUEST_CALL, mutableMapOf("type" to 1, "source" to 2)) - if (currentUserInfo != null) { - callChatManager.callToSomeone(currentUserInfo!!.sn) - } else { - toast(R.string.module_car_chat_user_info_null) - } - } - - private fun refreshViewByType() { - Logger.d(TAG, "refreshViewByType===${callChatManager.getStatusName()}") - when { - callChatManager.isReadyCalling() -> { - showReadyToCallView() - } - callChatManager.isCalling() || callChatManager.isMatching() -> { - syncCallViewStatus() - } - callChatManager.isInit() -> { - resetCallingView() - } - } - } - - private fun resetCallingView() { - showCallWindowFromDefault = false - hideLauncherCallingView() - mapViewManager.resetMarkerStatus(serviceApi) - } - - override fun callInvokeError(msg: String) { - TipToast.shortTip(msg) - resetCallingView() - } - - /** - * 收到来电消息 - * 1.如果当前已经打来电话,再次接收到,则拒绝 - * 2.如果当前正在打电话中,则拒绝 - */ - override fun showIncomingCall(userInfo: UserInfo) { - Logger.d(TAG, "showIncomingCall===userInfo: $userInfo") - currentUserInfo = userInfo - if (callChatManager.isCalling() || callingWindowManager.isIncomingWindowShow()) { - log(TAG, "已在通话进程中,准备拒绝他 ---> ") - refuseCall(userInfo.sn) - } else { - log(TAG, "有人打来电话,准备显示 房间号---> ${UserInfoHelper.currentRoomId} , 用户---> ${currentUserInfo!!.sn}") - callingWindowManager.showIncomingView({ - callChatManager.answerInvoke(currentUserInfo!!.sn) - }, { - refuseCall(currentUserInfo!!.sn) - }) - } - } - - override fun match(userInfo: UserInfo) { - Logger.d(TAG, "match===userInfo: $userInfo") - currentUserInfo = userInfo - connectSuccess() - } - - override fun matchInvokeResult(invokeResult: Boolean, userInfo: UserInfo?, errorMsg: String) { - Logger.d( - TAG, - "matchInvokeResult===$invokeResult, msg: $errorMsg, callStatus: ${callChatManager.getStatusName()}" - ) - if (invokeResult) { - // 开始匹配成功 - currentUserInfo = userInfo - } else { - //匹配失败或匹配超时 - TipToast.shortTip(errorMsg) - } - refreshViewByType() - } - - /** - * 发起车队邀请 接口回调 - */ - override fun vehicleTeamInviteResult(invite: Boolean) { - Logger.d(TAG, "vehicleTeamInviteResult===$invite") - if (invite) { - toast(R.string.module_car_chat_team_invited) - } else { - toast(R.string.module_car_chat_in_the_team) - speakContent(context!!.getString(R.string.module_car_chat_in_the_team)) - } - } - - /** - * 接收到车队邀请 - */ - override fun receiverVehicleTeamInvitation(userInfo: UserInfo) { - Logger.d(TAG, "receiverVehicleTeamInvitation:$userInfo") - teamInvitationWindowManager.showTeamInvitationView(userInfo) - } - - /** - * 加入车队成功,进房,开始聊天 - */ - override fun vehicleTeamEnterRoom() { - Logger.d(TAG, "vehicleTeamEnterRoom") - speakContent(context!!.getString(R.string.module_car_chat_joined_team)) - callWindowShowCallBack() - callingWindowManager.showVehicleTeamView() - } - - /** - * 同意加入车队 接口回调 调用成功,等待消息下发 - */ - override fun joinVehicleTeamInvokeSuccess() { - Logger.d(TAG, " joinVehicleTeamInvokeSuccess") - } - - /** - * 同意加入车队 接口回调 调用失败,处理 是否重新申请还是toast - */ - override fun joinVehicleTeamInvokeError(msg: String) { - Logger.d(TAG, " joinVehicleTeamInvokeError:$msg") - } - - /** - * 车队成员变化 - */ - override fun vehicleTeamMemberChange(teamMember: List?) { - try { - Logger.d( - TAG, - "vehicleTeamMemberChange:" + teamMember?.size + ":" + teamMember.toString() - ) - this.teamMember = teamMember - callingWindowManager.updateVehicleTeamHeadView(teamMember) - mapViewManager.updateTeamMarker(context!!, teamMember) - } catch (e: Exception) { - Logger.d(TAG, "vehicleTeamMemberChangeException:$e") - } - } - - /** - * 挂断电话回调 - */ - override fun callHangUp(hangUp: Boolean) { - Logger.d(TAG, "hangUp===$hangUp") - if (hangUp) { - resetCallingView() - } else { - toast(R.string.module_car_chat_hangup_fail) - } - } - - /** - * 退出车队回调 - */ - override fun vehicleTeamHangUp(hangUp: Boolean) { - Logger.d(TAG, "vehicleTeamHangUp===$hangUp") - if (hangUp) { - callWindowHideCallBack() - callingWindowManager.hideVehicleTeamView() - closeVehicleTeamFragment() - resetCallingView() - } else { - //接口调用退出车队 失败 - } - } - - /** - * 拒接电话回调 - */ - override fun callRefuse(refuse: Boolean) { - Logger.d(TAG, "callRefuse===$refuse") - if (refuse) { - resetCallingView() - } - } - - /** - * 拒绝加入车队回调 - */ - override fun vehicleTeamRefuse(refuse: Boolean) { - Logger.d(TAG, "vehicleTeamRefuse===$refuse") - } - - private fun hangUp() { - AnalyticsUtil.track(INVOKE_TRACK_REFUSE) - // resetCallingView() - callChatManager.hangUp(MoGoAiCloudClientConfig.getInstance().sn) - } - - private fun refuseCall() { - AnalyticsUtil.track(INVOKE_TRACK_REFUSE) - toast(R.string.module_car_chat_call_hangup) - resetCallingView() - callChatManager.refuseCall(currentUserInfo?.sn ?: MoGoAiCloudClientConfig.getInstance().sn) - } - - override fun showError(errInfo: String) { - resetCallingView() - } - - private fun connectSuccess() { - teamInvitationWindowManager.hideTeamInvitationView() - AnalyticsUtil.track(INVOKE_TRACK_CHATTING) - mapViewManager.showLocationOnMap( - context!!, - serviceApi, - currentUserInfo?.lat?.toDouble(), - currentUserInfo?.lon?.toDouble(), - currentUserInfo?.userHead - ) - refreshViewByType() - } - - private fun toast(msgId: Int) { - context?.let { - TipToast.shortTip(it.resources.getString(msgId)) - } - } - - fun initVehicleTeamContainer(flag: String, containerId: Int, activity: FragmentActivity) { - this.flag = flag - this.containerId = containerId - this.activity = activity - } - - /** - * 邀请加入车队 - */ - fun inviteJoinVehicleTeam(sn: String) { - Logger.i( - TAG, - "isCalling():" + callChatManager.isCalling() + ",currentCallType:" + currentCallType - ) - if (callChatManager.isCalling() && currentCallType != CALL_TYPE_VEHICLE_TEAM) { - toast(R.string.module_car_chat_in_call) - return - } - callChatManager.inviteJoinVehicleTeam(sn) - } - - /** - * 加入车队 - */ - fun joinVehicleTeam(snSender: String) { - if (callChatManager.isReadyCalling()) { - refuseCall() - } - if (callChatManager.isMatching()) { - cancelMatch(false) - } - callChatManager.joinVehicleTeam(snSender) - } - - /** - * 拒绝 来电消息/车队邀请 - */ - fun refuseCall(snSender: String) { - callChatManager.refuseCall(snSender) - } - - private fun onPause() { - Logger.i( - TAG, - "onPause currentCallType : $currentCallType , status: ${callChatManager.isCalling()}" - ) - userWindowManager.hideUserView() - callWindowHideCallBack() - if (currentCallType == CALL_TYPE_VEHICLE_TEAM && callChatManager.isCalling()) { - closeVehicleTeamFragment() - callingWindowManager.hideVehicleTeamView() - } else { - callingWindowManager.hideCallingView() - } - callingWindowManager.resetStatus() - } - - fun onDestroy() { - serviceApi?.statusManagerApi?.unregisterStatusChangedListener( - MODULE_NAME, - StatusDescriptor.MAIN_PAGE_RESUME, - statusChangedListener - ) - serviceApi?.statusManagerApi?.unregisterStatusChangedListener( - MODULE_NAME, - StatusDescriptor.VR_MODE, - statusChangedListener - ) - teamInvitationWindowManager.onDestroy() - flag = null - containerId = null - activity = null - context = null - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt deleted file mode 100644 index b05bdbb29b..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt +++ /dev/null @@ -1,356 +0,0 @@ -package com.mogo.module.carchatting.biz - -import com.google.gson.Gson -import com.mogo.chat.callcenter.* -import com.mogo.chat.callcenter.CallController.Companion.callController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.constant.CALL_TYPE_MATCHING -import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM -import com.mogo.chat.constant.CALL_TYPE_VOICE -import com.mogo.chat.model.bean.Message -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.chat.model.bean.toSns -import com.mogo.chat.util.CallTimer.Companion.callTimer -import com.mogo.chat.util.UserInfoHelper.currentCallType -import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo -import com.mogo.chat.util.log -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.carchatting.R -import com.mogo.module.carchatting.bean.EnthusiasmIndex -import com.mogo.module.carchatting.bean.Result -import com.mogo.module.carchatting.bean.UserInfo -import com.mogo.module.carchatting.bean.toUserInfo -import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG -import com.mogo.module.carchatting.net.Repository -import com.mogo.module.carchatting.net.request -import com.zhidao.carchattingprovider.ICallResponse - -class CallChatManager(iBizCallChat: IBizCallChat.IBizCallBack) : ICallResponse { - - companion object { - - const val METHOD_FLAG = "CAR_CALL_TO_DEFAULT" - } - - private val repository: Repository = Repository() - private var iBizCallBack: IBizCallChat.IBizCallBack? = iBizCallChat - - init { - callController.addCallBack(TAG, object : ICallMessage { - - override fun initStatus() { - super.initStatus() - iBizCallBack?.callTypeInit() - } - - override fun callSuccess() { - super.callSuccess() - iBizCallBack?.invokeCallData(toUserInfo(tmpSenderInfo)) - } - - override fun receiverCalling(message: Message) { - super.receiverCalling(message) - iBizCallBack?.showIncomingCall(toUserInfo(message.toSns())) - } - - override fun refuseMatchToShowCalling(message: Message) { - super.refuseMatchToShowCalling(message) - iBizCallBack?.showIncomingCall(toUserInfo(message.toSns())) - } - - override fun receiverCallingAgree() { - super.receiverCallingAgree() - iBizCallBack?.call(toUserInfo(tmpSenderInfo)) - } - - override fun matchSuccess() { - super.matchSuccess() - iBizCallBack?.match(toUserInfo(tmpSenderInfo)) - } - - override fun receiverVehicleTeamInvitation() { - super.receiverVehicleTeamInvitation() - iBizCallBack?.receiverVehicleTeamInvitation(toUserInfo(tmpSenderInfo)) - } - - override fun vehicleTeamEnterRoom() { - super.vehicleTeamEnterRoom() - iBizCallBack?.vehicleTeamEnterRoom() - } - - //接收到被动挂断电话/车队消息 - override fun receiverHangUpInfo() { - super.receiverHangUpInfo() - when (currentCallType) { - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> { - iBizCallBack?.toastMsg(R.string.module_car_chat_call_hangup) - iBizCallBack?.callHangUp(true) - } - CALL_TYPE_VEHICLE_TEAM -> { - iBizCallBack?.toastMsg(R.string.module_car_chat_vehicle_dismiss) - iBizCallBack?.vehicleTeamHangUp(true) - } - } - } - - override fun vehicleTeamMemberChange(teamMember: List?) { - super.vehicleTeamMemberChange(teamMember) - iBizCallBack?.vehicleTeamMemberChange(teamMember) - } - - override fun receiverCallRefuse() { - super.receiverCallRefuse() - iBizCallBack?.toastMsg(R.string.module_car_chat_call_refuse) - } - - override fun receiverVehicleTeamInviteRefuse() { - super.receiverVehicleTeamInviteRefuse() - //车队暂时没有设计 邀请拒绝的文案说明 - } - - override fun receiverSomeoneExitVehicleTeam() { - super.receiverSomeoneExitVehicleTeam() - //收到某人退出车队通知 - } - }) - } - - /******************************************** Invoke **********************************************/ - - fun isInit(): Boolean { - return callTypeManager.callStatus.isInit() - } - - fun canCall(): Boolean { - return callTypeManager.callStatus.isInit() && SocketClientFactory.socketClient.isOpen - } - - fun isReadyCalling(): Boolean { - return callTypeManager.callStatus.isReadyCalling() - } - - fun isCalling(): Boolean { - return callTypeManager.callStatus.isCalling() - } - - fun isMatching(): Boolean { - return callTypeManager.callStatus.isMatching() - } - - fun isMatchFailed(): Boolean { - return callTypeManager.callStatus.isMatchFailed() - } - - fun getStatusName(): String { - return callTypeManager.callStatus.name - } - - fun syncCallTimer(timer: (Long) -> Unit) { - return callTimer.registerTimerRate({ - timer.invoke(it) - }, { - log(TAG, "syncCallTimer timer is stop") - }) - } - - fun answerInvoke(sn: String) { - Logger.i(TAG, "answerInvoke sn : $sn") - IMCallManager.answer(sn, this) - } - - fun callToSomeone(sn: String) { - Logger.i(TAG, "callToSomeone") - IMCallManager.call(METHOD_FLAG, sn, this) - } - - fun match() { - Logger.i(TAG, "match") - IMCallManager.match(METHOD_FLAG, this) - } - - fun cancelMatch() { - Logger.i(TAG, "cancelMatch") - IMCallManager.cancelMatch(METHOD_FLAG, this) - } - - /** - * 邀请加入车队 - */ - fun inviteJoinVehicleTeam(sn: String) { - Logger.i(TAG, "inviteJoinVehicleTeam") - IMCallManager.inviteJoinVehicleTeam(METHOD_FLAG, sn, this) - } - - /** - * 加入车队 - */ - fun joinVehicleTeam(snSender: String) { - Logger.i(TAG, "joinVehicleTeam") - IMCallManager.joinVehicleTeam(METHOD_FLAG, snSender, this) - } - - /** - * 挂断电话/车队聊天 - */ - fun hangUp(sn: String?) { - Logger.i(TAG, "hangUp sn : $sn") - IMCallManager.hangUp(METHOD_FLAG, sn ?: "", this) - } - - /** - * 拒绝电话/拒绝加入车队/未接通时挂断电话 - */ - fun refuseCall(snSender: String) { - Logger.i(TAG, "refuse") - IMCallManager.refuseCall(METHOD_FLAG, snSender, this) - } - - fun muteVoice(mute: Boolean) { - Logger.i(TAG, "muteVoice") - IMCallManager.mute(METHOD_FLAG, mute, this) - } - - fun getUserInfoForCall() { - Logger.i(TAG, "getUserInfo") - IMCallManager.getUserInfoForCall(METHOD_FLAG, null, this) - } - - fun getUserInfo(sn: String, onSuccess: (String) -> Unit, onError: (String) -> Unit) { - IMCallManager.getUserInfo(sn, onSuccess, onError) - } - - fun getEnthusiasmIndex( - sn: String, - onSuccess: (EnthusiasmIndex) -> Unit, - onError: (String) -> Unit - ) { - request> { - loader { - getEnthIndex(sn) - } - onSuccess { - it.result.let { result -> - onSuccess.invoke(result.enthusiasmIndex) - } - } - onError { - it.message?.let { msg -> - onError.invoke(msg) - } - } - } - } - - private suspend fun getEnthIndex(sn: String): BaseResponse { - val tmpMap = mapOf("sn" to sn) - val map = mapOf("data" to Gson().toJson(tmpMap)) - Logger.d(TAG, "getEnthIndex : $map") - return repository.apiCall { - repository.getNetWorkApi().queryEnthusiasmIndex(map) - } - } - - /******************************************** CallBack **********************************************/ - - override fun invokeCallData(invokeData: String) { - super.invokeCallData(invokeData) - if (invokeData.isNotBlank()) { - val userInfo = Gson().fromJson(invokeData, UserInfo::class.java) - iBizCallBack?.invokeCallData(userInfo) - } else { - iBizCallBack?.invokeCallData(null) - } - } - - override fun answer() { - super.answer() - Logger.i(TAG, "answer") - iBizCallBack?.answerCall() - } - - override fun answerCallError(errorMsg: String) { - super.answerCallError(errorMsg) - Logger.i(TAG, "answerCallError errorMsg : $errorMsg") - iBizCallBack?.answerCallError(errorMsg) - } - - override fun call(data: String) { - super.call(data) - Logger.i(TAG, "call data: $data") - if (data.isNotBlank()) { - val userInfo = Gson().fromJson(data, UserInfo::class.java) - iBizCallBack?.call(userInfo) - } else { - iBizCallBack?.call(null) - } - } - - override fun callInvokeError(msg: String) { - super.callInvokeError(msg) - Logger.i(TAG, "callInvokeError : $msg") - iBizCallBack?.callInvokeError(msg) - } - - override fun match(data: String) { - super.match(data) - iBizCallBack?.match(Gson().fromJson(data, UserInfo::class.java)) - } - - override fun matchInvokeResult(invokeResult: Boolean, msg: String) { - super.matchInvokeResult(invokeResult, msg) - if (invokeResult) { - iBizCallBack?.matchInvokeResult( - invokeResult, - Gson().fromJson(msg, UserInfo::class.java), - msg - ) - } else { - iBizCallBack?.matchInvokeResult(invokeResult, null, msg) - } - } - - override fun hangUp(hangUp: Boolean, type: Int) { - super.hangUp(hangUp, type) - when (type) { - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> iBizCallBack?.callHangUp(hangUp) - CALL_TYPE_VEHICLE_TEAM -> iBizCallBack?.vehicleTeamHangUp(hangUp) - } - } - - override fun refuse(refuse: Boolean, type: Int) { - super.refuse(refuse, type) - when (type) { - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> iBizCallBack?.callRefuse(refuse) - CALL_TYPE_VEHICLE_TEAM -> iBizCallBack?.vehicleTeamRefuse(refuse) - } - } - - override fun inviteJoinVehicleTeam(status: Boolean) { - super.inviteJoinVehicleTeam(status) - iBizCallBack?.vehicleTeamInviteResult(status) - } - - override fun joinVehicleTeamInvokeSuccess() { - super.joinVehicleTeamInvokeSuccess() - iBizCallBack?.joinVehicleTeamInvokeSuccess() - } - - override fun joinVehicleTeamInvokeError(msg: String) { - super.joinVehicleTeamInvokeError(msg) - iBizCallBack?.joinVehicleTeamInvokeError(msg) - } - - override fun error(errInfo: String) { - super.error(errInfo) - Logger.i(TAG, "errInfo --- $errInfo") - iBizCallBack?.showError(errInfo) - } - - override fun userInfoCallBack(userInfo: String?, errorMsg: String?) { - super.userInfoCallBack(userInfo, errorMsg) - Logger.i(TAG, "userInfoCallBack : $userInfo") - iBizCallBack?.showUserInfo(userInfo) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/IBizCallChat.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/IBizCallChat.kt deleted file mode 100644 index fa63f750f8..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/IBizCallChat.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.mogo.module.carchatting.biz - -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.module.carchatting.bean.UserInfo - -interface IBizCallChat { - - interface IBizCallBack { - - fun callTypeInit() - - fun answerCall() - - fun answerCallError(errorMsg: String) - - fun call(userInfo: UserInfo?) - - fun invokeCallData(userInfo: UserInfo?) - - fun callInvokeError(msg: String) - - fun showIncomingCall(userInfo: UserInfo) - - fun match(userInfo: UserInfo) - - fun matchInvokeResult(invokeResult: Boolean, userInfo: UserInfo?, errorMsg: String) - - fun vehicleTeamInviteResult(invite: Boolean) - - fun receiverVehicleTeamInvitation(userInfo: UserInfo) - - fun vehicleTeamEnterRoom() - - fun joinVehicleTeamInvokeSuccess() - - fun joinVehicleTeamInvokeError(msg: String) - - fun vehicleTeamMemberChange(teamMember: List?) - - fun callHangUp(hangUp: Boolean) - - fun vehicleTeamHangUp(hangUp: Boolean) - - fun callRefuse(refuse: Boolean) - - fun vehicleTeamRefuse(refuse: Boolean) - - fun showError(errInfo: String) - - fun showUserInfo(userInfo: String?) - - fun toastMsg(msgId:Int) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/IMCallManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/IMCallManager.kt deleted file mode 100644 index cee5f56e03..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/IMCallManager.kt +++ /dev/null @@ -1,246 +0,0 @@ -package com.mogo.module.carchatting.biz - -import com.google.gson.Gson -import com.mogo.chat.callcenter.CallController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.IMType -import com.mogo.chat.callcenter.SocketClientFactory -import com.mogo.chat.callcenter.isInit -import com.mogo.chat.common.gme.GMEApi -import com.mogo.chat.constant.OFFLINE_STATUS -import com.mogo.chat.constant.ONLINE_STATUS -import com.mogo.chat.model.control.ChatController -import com.mogo.chat.service.ChatServiceHandler -import com.mogo.chat.service.InvokeDataProxy -import com.mogo.chat.util.UserInfoHelper -import com.mogo.chat.util.UserInfoHelper.currentCallType -import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo -import com.mogo.chat.util.log -import com.mogo.module.carchatting.card.CallChatConstant.Companion.PARAM_SN -import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG -import com.zhidao.carchattingprovider.ICallProviderResponse -import com.zhidao.carchattingprovider.ICallResponse -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch - -class IMCallManager private constructor() { - - companion object { - - fun canCall(flag: String, response: ICallProviderResponse) { - log(TAG, "是否能拨打电话 flag --->: $flag") - response.canCall(callTypeManager.callStatus.isInit() && SocketClientFactory.socketClient.isOpen) - } - - fun answer(sn: String, response: ICallResponse) { - ChatServiceHandler.answer(sn, UserInfoHelper.currentRoomId, { - log(TAG, "接听电话成功 ---> ") - response.answer() - ChatController.enterRoom(UserInfoHelper.currentRoomId) - CallController.callController.callingReceiver() - }, { - val errorMsg = - if (it.message != null) it.message else "answer call is error ,please try again" - response.answerCallError(errorMsg!!) - log(TAG, " answer call is error ,please try again") - }) - } - - fun call( - flag: String, - snReceiver: String, - response: ICallResponse - ) { - log(TAG, "拨打电话 sn --->: $snReceiver , flag: $flag") - if (callTypeManager.callStatus.isInit() && SocketClientFactory.socketClient.isOpen) { - log(TAG, "flag:$flag 拨打电话 sn : $snReceiver") - ChatServiceHandler.call(snReceiver, { - log(TAG, "call somebody success,wait for answer") - }, { exception -> - response.callInvokeError(exception.message!!) - }) - } else { - log( - TAG, "拨打电话出现异常 能否拨打 :${callTypeManager.callStatus.isInit()} " + - "长连状态:${SocketClientFactory.socketClient.isOpen}" - ) - response.error("call: 正在通话中,请稍后再试") - } - } - - fun match( - flag: String, - response: ICallResponse - ) { - log(TAG, "开始匹配 ---> flag: $flag ") - ChatServiceHandler.startMatch(flag, { - if (callTypeManager.callStatus != IMType.CALLING_MATCH) { - callTypeManager.callStatus = IMType.MATCHING - } - val userInfo = InvokeDataProxy.convertSnsToInvokeMap(UserInfoHelper.userInfo) - response.matchInvokeResult(true, Gson().toJson(userInfo).toString()) - }, { exception -> - callTypeManager.callStatus = IMType.INIT_CALL - log(TAG, "startMatch exception : ${exception.message}") - response.matchInvokeResult(false, "匹配失败") - }, { - callTypeManager.callStatus = IMType.INIT_CALL - response.matchInvokeResult(false, "匹配超时") - }) - } - - fun cancelMatch(flag: String, response: ICallResponse) { - log(TAG, "取消匹配 ---> flag: $flag ") - ChatServiceHandler.cancelMatch { - response.cancelMatch(true) - } - callTypeManager.callStatus = IMType.INIT_CALL - } - - fun inviteJoinVehicleTeam(flag: String, inviteSn: String, response: ICallResponse) { - log(TAG, "邀请加入车队 --->flag: $flag , inviteSn: $inviteSn") - ChatServiceHandler.inviteJoinVehicleTeam(inviteSn, { - response.inviteJoinVehicleTeam(true) - }, { exception -> - log(TAG, "inviteJoinVehicleTeam error : ${exception.message}") - response.inviteJoinVehicleTeam(false) - }) - } - - fun joinVehicleTeam(flag: String, snSender: String, response: ICallResponse) { - log(TAG, "同意加入车队 flag: $flag") - ChatServiceHandler.answer(snSender, 0, { - response.joinVehicleTeamInvokeSuccess() - }, { exception -> - log(TAG, "inviteJoinVehicleTeam error : ${exception.message}") - response.joinVehicleTeamInvokeError(exception.message ?: "joinVehicleTeam error") - }) - } - - fun hangUp( - flag: String, - snReceiver: String, - response: ICallResponse - ) { - log(TAG, "挂断电话 ---> flag: $flag , snReceiver : $snReceiver") - ChatServiceHandler.hangUp(snReceiver, { - response.hangUp(true, currentCallType) - }, { exception -> - log(TAG, "hangUp error : ${exception.message}") - response.hangUp(false, currentCallType) - }) - } - - fun refuseCall( - flag: String, - snSender: String, - response: ICallResponse - ) { - log(TAG, "拒绝电话 / 取消打电话 ---> flag: $flag") - ChatServiceHandler.refuseCall(snSender, { - response.refuse(true, currentCallType) - }, { exception -> - log(TAG, "refuseCall error : ${exception.message}") - response.refuse(false, currentCallType) - }) - } - - fun mute(flag: String, mute: Boolean, response: ICallResponse) { - log(TAG, "静音 ---> flag: $flag , mute: $mute") - try { - GlobalScope.launch(Dispatchers.Main) { - if (mute) { - GMEApi.muteMic() - } else { - GMEApi.reMuteMic() - } - } - response.mute(true) - } catch (e: Exception) { - e.printStackTrace() - response.error("mute : ${e.message!!}") - } - } - - fun addFriend(flag: String, sn: String, response: ICallResponse) { - log(TAG, "添加好友 ---> flag: $flag") - val params = hashMapOf(PARAM_SN to sn) - ChatServiceHandler.addFriend(params["PARAM_SN"].toString(), { - response.addFriend(true) - }, { exception -> - response.error("addFriend: ${exception.message!!}") - }) - } - - fun isFriend(flag: String, sn: String, response: ICallResponse) { - log(TAG, "是否是好友 ---> flag: $flag , sn: $sn") - val params = hashMapOf(PARAM_SN to sn) - ChatServiceHandler.isFriend(params["PARAM_SN"].toString(), { isFriend: Boolean -> - response.isFriend(isFriend) - }, { exception -> - response.error("isFriend: ${exception.message!!}") - }) - } - - fun invisibleUser( - flag: String, - visible: Boolean, - response: ICallResponse - ) { - log(TAG, "用户隐身 ---> flag: $flag , visible : $visible") - val status: Int = if (visible) { - ONLINE_STATUS - } else { - OFFLINE_STATUS - } - ChatServiceHandler.invisibleUser(status, { - response.invisibleUser(true) - }, { exception -> - response.error("invisibleUser: ${exception.message}") - }) - } - - fun isOnLine( - flag: String, - sn: String, - response: ICallResponse - ) { - log(TAG, "车机是否在线 ---> flag: $flag , sn : $sn") - ChatServiceHandler.isOnLine(sn, { onLine: Boolean -> - response.isOnLine(onLine) - }, { exception -> - response.error("isOnLine: ${exception.message}") - }) - } - - fun getUserInfoForCall( - flag: String, - sn: String?, - response: ICallResponse - ) { - val tmpSn = sn ?: "" - log(TAG, "获取用户信息 ---> flag: $flag , sn : $sn") - if (tmpSn.isBlank()) { - val userInfo = InvokeDataProxy.convertSnsToInvokeMap(tmpSenderInfo) - response.userInfoCallBack(Gson().toJson(userInfo)) - return - } - ChatServiceHandler.queryUserInfo(tmpSn, { userInfo -> - response.userInfoCallBack(userInfo) - }, { exception -> - response.error("getUserInfo: ${exception.message}") - }) - } - - fun getUserInfo(sn: String, onSuccess: (String) -> Unit, onError: (String) -> Unit) { - ChatServiceHandler.queryUserInfo(sn, { userInfo -> - onSuccess.invoke(userInfo) - }, { exception -> - onError.invoke(exception.message ?: "查询用户信息失败") - }) - } - - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/card/CallChatConstant.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/card/CallChatConstant.kt deleted file mode 100644 index a8d2d935f0..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/card/CallChatConstant.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.mogo.module.carchatting.card - -class CallChatConstant { - - companion object { - const val PATH = "/carchatting/ui" - const val PROVIDER = "/callchat/ui" - const val MODULE_NAME = "CARD_TYPE_CARS_CHATTING" - - const val ACTION_ERROR = 0 - const val ACTION_CALL = 1 - const val ACTION_MATCH = 2 - const val ACTION_HANG_UP = 3 - const val ACTION_MUTE = 4 - const val ACTION_CAN_CALL = 5 - const val ACTION_ADD_FRIEND = 6 - const val ACTION_IS_FRIEND = 7 - const val ACTION_CALL_STATUS = 8 - const val ACTION_INVISIBLE_USER = 9 - const val ACTION_ENTER_PERSONAL_CENTER = 10 - const val ACTION_CANCEL_MATCH = 11 - const val ACTION_IS_ONLINE = 12 - const val ACTION_GET_USER_INFO = 13 - - const val PARAM_SN = "PARAM_SN" - const val PARAM_MUTE = "PARAM_MUTE" - const val PARAM_VISIBLE = "PARAM_VISIBLE" - const val PARAM_END_TYPE = "PARAM_END_TYPE" - - const val TAG = "CALL_CHATTING" - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/card/CallChatProvider.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/card/CallChatProvider.kt deleted file mode 100644 index a1ccfa4c47..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/card/CallChatProvider.kt +++ /dev/null @@ -1,71 +0,0 @@ -package com.mogo.module.carchatting.card - -import android.content.Context -import android.os.Bundle -import android.view.View -import androidx.fragment.app.Fragment -import com.alibaba.android.arouter.facade.annotation.Route -import com.mogo.map.listener.IMogoMapListener -import com.mogo.map.location.IMogoLocationListener -import com.mogo.map.marker.IMogoMarkerClickListener -import com.mogo.map.navi.IMogoNaviListener -import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter -import com.mogo.module.common.ModuleType -import com.mogo.service.module.IMogoModuleLifecycle -import com.mogo.service.module.IMogoModuleProvider - -@Route(path = CallChatConstant.PROVIDER) -class CallChatProvider : IMogoModuleProvider { - - override fun createFragment(context: Context?, data: Bundle?): Fragment? { - return null - } - - override fun createView(context: Context?): View? { - return null - } - - override fun getNaviListener(): IMogoNaviListener? { - return null - } - - override fun getLocationListener(): IMogoLocationListener? { - return null - } - - override fun getMarkerClickListener(): IMogoMarkerClickListener? { - return null - } - - override fun getModuleName(): String { - return CallChatConstant.MODULE_NAME - } - - override fun getType(): Int { - return ModuleType.TYPE_SERVICE - } - - override fun init(context: Context) { - callChatCenter.init(context) - } - - override fun getCardLifecycle(): IMogoModuleLifecycle? { - return null - } - - override fun getMapListener(): IMogoMapListener? { - return null - } - - override fun getAppPackage(): String? { - return null - } - - override fun getAppName(): String? { - return null - } - - override fun onDestroy() { - callChatCenter.onDestroy() - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/invoke/CarsChattingProvider.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/invoke/CarsChattingProvider.kt deleted file mode 100644 index 1d6ff513c1..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/invoke/CarsChattingProvider.kt +++ /dev/null @@ -1,107 +0,0 @@ -package com.mogo.module.carchatting.invoke - -import android.content.Context -import androidx.fragment.app.FragmentActivity -import com.alibaba.android.arouter.facade.annotation.Route -import com.zhidao.carchattingprovider.CallChattingProviderConstant.Companion.CAR_CALL_PROVIDER -import com.zhidao.carchattingprovider.ICallProviderResponse -import com.zhidao.carchattingprovider.ICarsChattingProvider -import com.zhidao.carchattingprovider.MogoDriverInfo - -@Route(path = CAR_CALL_PROVIDER) -class CarsChattingProvider : ICarsChattingProvider { - - override fun addFriend( - flag: String, - context: Context, - friendSn: String, - response: ICallProviderResponse - ) { - CarsChattingProviderImpl.addFriend( - flag, - context, - friendSn, - response - ) - } - - override fun call(params: Map) { - CarsChattingProviderImpl.call(params) - } - - override fun canCall(flag: String, context: Context, response: ICallProviderResponse) { - CarsChattingProviderImpl.canCall(flag, context, response) - } - - override fun getUserInfo( - flag: String, - context: Context, - sn: String, - response: ICallProviderResponse - ) { - CarsChattingProviderImpl.getUserInfo(flag, context, sn, response) - } - - override fun isOnLine( - flag: String, - context: Context, - sn: String, - response: ICallProviderResponse - ) { - CarsChattingProviderImpl.isOnLine(flag, context, sn, response) - } - - override fun init(context: Context?) { - } - - override fun initVehicleTeamContainer(flag: String, containerId: Int, activity: FragmentActivity) { - CarsChattingProviderImpl.initVehicleTeamContainer(flag, containerId, activity) - } - - override fun isFriend( - flag: String, - context: Context, - friendSn: String, - response: ICallProviderResponse - ) { - CarsChattingProviderImpl.isFriend( - flag, - context, - friendSn, - response - ) - } - - override fun registerCallWindowStatusListener(flag: String, context: Context, response: ICallProviderResponse) { - CarsChattingProviderImpl.registerCallWindowStatusListener(flag, context, response) - } - - override fun unRegisterCallWindowStatusListener(flag: String, context: Context) { - CarsChattingProviderImpl.unRegisterCallWindowStatusListener(flag, context) - } - - override fun registerUserWindowStatusListener(flag: String, context: Context, response: ICallProviderResponse) { - CarsChattingProviderImpl.registerUserWindowStatusListener(flag, context, response) - } - - override fun unRegisterUserWindowStatusListener(flag: String, context: Context) { - CarsChattingProviderImpl.unRegisterUserWindowStatusListener(flag, context) - } - - override fun showUserWindow(flag: String, mogoDriverInfo: MogoDriverInfo, context: Context) { - CarsChattingProviderImpl.showUserWindow(flag, mogoDriverInfo, context) - } - - override fun hideUserWindow(flag: String, context: Context, response: ICallProviderResponse?) { - CarsChattingProviderImpl.hideUserWindow(flag, context, response) - } - - override fun invisibleUser(flag: String, context: Context, response: ICallProviderResponse) { - CarsChattingProviderImpl.invisibleUser( - flag, - context, - response - ) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/invoke/CarsChattingProviderImpl.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/invoke/CarsChattingProviderImpl.kt deleted file mode 100644 index 15ba1fba6a..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/invoke/CarsChattingProviderImpl.kt +++ /dev/null @@ -1,131 +0,0 @@ -package com.mogo.module.carchatting.invoke - -import android.content.Context -import androidx.fragment.app.FragmentActivity -import com.google.gson.Gson -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter -import com.mogo.module.carchatting.biz.IMCallManager -import com.zhidao.carchattingprovider.ICallProviderResponse -import com.zhidao.carchattingprovider.ICarsChattingProvider -import com.zhidao.carchattingprovider.MogoDriverInfo - -object CarsChattingProviderImpl : ICarsChattingProvider { - - const val TAG = "CarsChattingProviderImpl" - private var callWindowStatusResponse: ICallProviderResponse? = null - private var userWindowStatusResponse: ICallProviderResponse? = null - private var hideUserWindowStatusResponse: ICallProviderResponse? = null - - - override fun init(context: Context?) { - } - - override fun initVehicleTeamContainer(flag: String, containerId: Int, activity: FragmentActivity) { - callChatCenter.initVehicleTeamContainer(flag, containerId, activity) - } - - override fun addFriend( - flag: String, - context: Context, - friendSn: String, - response: ICallProviderResponse - ) { - IMCallManager.addFriend( - flag, - friendSn, - response - ) - } - - override fun isFriend( - flag: String, - context: Context, - friendSn: String, - response: ICallProviderResponse - ) { - IMCallManager.isFriend( - flag, - friendSn, - response - ) - } - - override fun canCall(flag: String, context: Context, response: ICallProviderResponse) { - IMCallManager.canCall(flag, response) - } - - override fun getUserInfo( - flag: String, - context: Context, - sn: String, - response: ICallProviderResponse - ) { - IMCallManager.getUserInfoForCall(flag, sn, response) - } - - override fun isOnLine( - flag: String, - context: Context, - sn: String, - response: ICallProviderResponse - ) { - IMCallManager.isOnLine(flag, sn, response) - } - - override fun call(params: Map) { - callChatCenter.invokeCall(Gson().toJson(params)) - } - - override fun invisibleUser(flag: String, context: Context, response: ICallProviderResponse) { - IMCallManager.invisibleUser( - flag, - true, - response - ) - } - - override fun registerCallWindowStatusListener(flag: String, context: Context, response: ICallProviderResponse) { - Logger.d(TAG, "registerCallWindowStatusListener flag: $flag") - callWindowStatusResponse = response - callChatCenter.registerCallWindowStatusListener { - callWindowStatusResponse?.callWindowStatus(it) - } - } - - override fun unRegisterCallWindowStatusListener(flag: String, context: Context) { - Logger.d(TAG, "unRegisterCallWindowStatusListener flag: $flag") - callWindowStatusResponse = null - callChatCenter.unRegisterCallWindowStatusListener() - } - - override fun registerUserWindowStatusListener(flag: String, context: Context, response: ICallProviderResponse) { - Logger.d(TAG, "registerUserWindowStatusListener flag: $flag") - userWindowStatusResponse = response - callChatCenter.registerUserWindowStatusListener { - userWindowStatusResponse?.userWindowStatus(it) - } - } - - override fun unRegisterUserWindowStatusListener(flag: String, context: Context) { - Logger.d(TAG, "unRegisterUserWindowStatusListener flag: $flag") - userWindowStatusResponse = null - callChatCenter.unRegisterUserWindowStatusListener() - } - - override fun showUserWindow(flag: String, mogoDriverInfo: MogoDriverInfo, context: Context) { - Logger.d(TAG, "showUserWindow flag: $flag , mogoDriverInfo : $mogoDriverInfo") - callChatCenter.showUserWindow(mogoDriverInfo) - } - - override fun hideUserWindow(flag: String, context: Context, response: ICallProviderResponse?) { - Logger.d(TAG, "hideUserWindow flag: $flag") - hideUserWindowStatusResponse = response - callChatCenter.hideUserWindow({ errorMsg -> - hideUserWindowStatusResponse?.hideUserWindowError(errorMsg) - }, { - hideUserWindowStatusResponse = null - }) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt deleted file mode 100644 index 063f1c81f5..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt +++ /dev/null @@ -1,92 +0,0 @@ -package com.mogo.module.carchatting.net - -import androidx.lifecycle.LifecycleOwner -import com.mogo.chat.exception.CallApiException -import com.mogo.chat.exception.CommonException.Companion.NETWORK_EXCEPTION -import com.mogo.chat.exception.CommonException.Companion.NULL_EXCEPTION -import com.mogo.chat.exception.CommonException.Companion.NULL_REQUEST_DATA_API_EXCEPTION -import com.mogo.eagle.core.data.BaseResponse -import kotlinx.coroutines.* -import java.net.SocketTimeoutException -import java.net.UnknownHostException -import java.util.concurrent.TimeoutException - -class Request { - private lateinit var loader: suspend () -> T - - private var start: (() -> Unit)? = null - - private var onSuccess: ((T) -> Unit)? = null - - private var onError: ((java.lang.Exception) -> Unit)? = null - - private var onComplete: (() -> Unit)? = null - - private var addLifecycle: LifecycleOwner? = null - - - infix fun loader(loader: suspend () -> T) { - this.loader = loader - } - - infix fun start(start: (() -> Unit)?) { - this.start = start - } - - infix fun onSuccess(onSuccess: ((T) -> Unit)?) { - this.onSuccess = onSuccess - } - - infix fun onError(onError: ((java.lang.Exception) -> Unit)?) { - this.onError = onError - } - - infix fun onComplete(onComplete: (() -> Unit)?) { - this.onComplete = onComplete - } - - infix fun addLifecycle(addLifecycle: LifecycleOwner?) { - this.addLifecycle = addLifecycle - } - - fun request() { - - GlobalScope.launch(context = Dispatchers.Main) { - - start?.invoke() - try { - val deferred = GlobalScope.async(Dispatchers.IO, start = CoroutineStart.LAZY) { - loader() - } - val result = deferred.await() - if (result != null && result is BaseResponse<*>) { - if (result.code == 0) { - onSuccess?.invoke(result) - } else { - throw CallApiException(result.code, result.msg) - } - } else { - throw NULL_REQUEST_DATA_API_EXCEPTION - } - } catch (e: Exception) { - e.printStackTrace() - //数据打点 - if (e == null) { - onError?.invoke(NULL_EXCEPTION) - } - when (e) { - is UnknownHostException -> onError?.invoke(NETWORK_EXCEPTION) - is TimeoutException -> onError?.invoke(NETWORK_EXCEPTION) - is SocketTimeoutException -> onError?.invoke(NETWORK_EXCEPTION) - else -> onError?.invoke(java.lang.Exception(e.message)) - } - } finally { - onComplete?.invoke() - } - } - } -} - -inline fun request(buildRequest: Request.() -> Unit) { - Request().apply(buildRequest).request() -} diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt deleted file mode 100644 index eb5fae79af..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.module.carchatting.net - -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.module.carchatting.bean.Result -import retrofit2.http.FieldMap -import retrofit2.http.FormUrlEncoded -import retrofit2.http.POST - -interface HttpApi { - - //获取热心指数 - @FormUrlEncoded - @POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1") - suspend fun queryEnthusiasmIndex(@FieldMap status: Map): BaseResponse - - //查询车队成员 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chat/no/queryTeamDate/v1") - suspend fun queryTeamDate(@FieldMap date: Map): BaseResponse> -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpConstant.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpConstant.kt deleted file mode 100644 index f2f5ed8ea6..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpConstant.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.mogo.module.carchatting.net - -import com.mogo.commons.debug.DebugConfig - -class HttpConstant { - - companion object { - const val HOST_DEV = "http://dzt-test.zhidaohulian.com" - const val HOST_TEST = "http://dzt-test.zhidaohulian.com" - const val HOST_DEMO = "http://dzt-show.zhidaohulian.com" - const val HOST_PRODUCT = "https://dzt.zhidaohulian.com" - - fun getNetHost(): String { - return when (DebugConfig.getNetMode()) { - DebugConfig.NET_MODE_DEV -> HOST_DEV - DebugConfig.NET_MODE_QA -> HOST_TEST - DebugConfig.NET_MODE_DEMO -> HOST_DEMO - else -> HOST_PRODUCT - } - } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt deleted file mode 100644 index 44ef42d7d2..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.module.carchatting.net - -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.IMogoServiceApis - -open class Repository { - - suspend fun apiCall(call: suspend () -> BaseResponse): BaseResponse { - return call.invoke() - } - - fun getNetWorkApi(): HttpApi { - var serviceApi: IMogoServiceApis? = null - val mogoService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() - if (mogoService is IMogoServiceApis) { - serviceApi = mogoService - } - return serviceApi!!.networkApi.createNoCallAdapter(HttpApi::class.java, HttpConstant.getNetHost()) - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/AnalyticsUtil.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/AnalyticsUtil.kt deleted file mode 100644 index 95c5f04859..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/AnalyticsUtil.kt +++ /dev/null @@ -1,33 +0,0 @@ -package com.mogo.module.carchatting.util - -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.IMogoServiceApis -import com.mogo.service.analytics.IMogoAnalytics - -const val INVOKE_TRACK_REQUEST_CALL_SHOW = "carchat_requestcall_card_show" -const val INVOKE_TRACK_REQUEST_CALL = "carchat_cardetail_click" -const val INVOKE_TRACK_REFUSE = "carchat_refuse_card_show" -const val INVOKE_TRACK_CHATTING = "carchat_phoneing_card_show" -const val INVOKE_TRACK_MATCH_SHOW = "carchat_carphonecall_match_show" -const val INVOKE_TRACK_MATCH_FAIL_CLOSE_CLICK = "carchat_match_fail_close_click" - -const val MATCH_TYPE_MANUAL = 1 -const val MATCH_TYPE_VOICE = 2 - -object AnalyticsUtil { - - private var trackRouter: IMogoAnalytics? = null - - fun track(eventType: String, data: MutableMap? = hashMapOf()) { - if (trackRouter == null) { - val aRouter = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() - if (aRouter is IMogoServiceApis) { - trackRouter = aRouter.analyticsApi - } - } - trackRouter!!.track(eventType, data) - } - -} - diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/DoubleClickUtil.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/DoubleClickUtil.kt deleted file mode 100644 index 9ba6fd080b..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/DoubleClickUtil.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.module.carchatting.util - -const val SPACE_TIME = 1500 -var lastViewClickTime = 0L -var viewId: Int = 0 - -fun isDoubleClick(view: Int): Boolean { - val time = System.currentTimeMillis() - val timeD = time - lastViewClickTime - if (timeD < SPACE_TIME && viewId == view) { - return true - } - lastViewClickTime = time - viewId = view - return false -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/LogUtil.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/LogUtil.kt deleted file mode 100644 index f29d24a6c3..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/LogUtil.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.module.carchatting.util - -import com.mogo.chat.util.log - -class LogUtil { - - companion object { - fun i(tag: String, msg: String) { - log(tag, msg) - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/TaskCoroutines.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/TaskCoroutines.kt deleted file mode 100644 index e58f86ad84..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/TaskCoroutines.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.mogo.module.carchatting.util - -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch - -fun taskMainLaunch(job: () -> T) = GlobalScope.launch(Dispatchers.Main) { - job() -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/dateUtil.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/dateUtil.kt deleted file mode 100644 index b99efd4f48..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/util/dateUtil.kt +++ /dev/null @@ -1,57 +0,0 @@ -package com.mogo.module.carchatting.util - -import com.mogo.module.carchatting.bean.UserInfo -import com.zhidao.carchattingprovider.MogoDriverInfo -import java.text.SimpleDateFormat -import java.util.* - -fun parseTime(time: Long): String { - val date = Date(time) - val formatter = SimpleDateFormat("HH:mm:ss", Locale.CHINA) - formatter.timeZone = TimeZone.getTimeZone("GMT+00:00") - return formatter.format(date) -} - -fun convertMapToUserInfo(map: Map): UserInfo { - val sn = map["sn"].toString() - val nickName = map["userName"] ?: "" - val headImgUrl = map["userHead"] ?: "" - val carInfo = map["carTypeName"] ?: "" - val cardIdSex = map["gender"] ?: "" - val cityName = map["location"] ?: "" - val cardIdAge = map["age"] ?: "" - val lat = map["lat"].toString() - val lon = map["lon"].toString() - return UserInfo(sn, 0, nickName, headImgUrl, cardIdSex, cardIdAge, carInfo, cityName, lat, lon) -} - -fun convertMapToDriverInfo(map: Map): MogoDriverInfo { - val mogoDriverInfo = MogoDriverInfo() - val age = map["age"] - if (!age.isNullOrBlank()) { - mogoDriverInfo.age = age.toInt() - } - val sn = map["sn"] - if (!sn.isNullOrBlank() && "null" != sn) { - mogoDriverInfo.sn = sn - } - mogoDriverInfo.carTypeName = map["carTypeName"] ?: "" - mogoDriverInfo.gender = map["gender"] ?: "" - mogoDriverInfo.locationInfo = map["location"] ?: "" - mogoDriverInfo.userHead = map["userHead"] ?: "" - val userName = map["userName"] - if (!userName.isNullOrBlank()) { - mogoDriverInfo.userName = userName - } else { - mogoDriverInfo.userName = "蘑菇用户" - } - val lat = map["lat"] - lat?.let { - mogoDriverInfo.lat = it.toDouble() - } - val lon = map["lon"] - lon?.let { - mogoDriverInfo.lon = it.toDouble() - } - return mogoDriverInfo -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt deleted file mode 100644 index 8e012c576d..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt +++ /dev/null @@ -1,581 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.annotation.SuppressLint -import android.content.Context -import android.media.AudioManager -import android.os.Handler -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.ImageView -import android.widget.LinearLayout -import android.widget.TextView -import androidx.constraintlayout.widget.ConstraintLayout -import com.bumptech.glide.request.RequestOptions -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.chat.util.MediaController -import com.mogo.chat.util.log -import com.mogo.chat.voice.IMVoiceClient -import com.mogo.chat.voice.IVoiceIntentListener -import com.mogo.commons.debug.DebugConfig -import com.mogo.commons.debug.DebugConfig.CAR_MACHINE_TYPE_BYD -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.logger.Logger -import com.mogo.module.carchatting.R -import com.mogo.module.carchatting.bean.UserInfo -import com.mogo.module.carchatting.view.VrModeHelper.Companion.vrModeHelper -import com.mogo.module.common.MogoApisHandler -import com.mogo.module.common.glide.SkinAbleBitmapTarget -import com.mogo.service.IMogoServiceApis -import de.hdodenhof.circleimageview.CircleImageView - -class CallingWindowManager private constructor() : IVoiceIntentListener { - - companion object { - - const val MSG_DIALING_TIME_OUT = 1001 - const val DEFAULT_MAX_DIALING_TIME = 30 * 1000L - - val callingWindowManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - CallingWindowManager() - } - } - - private var serviceApi: IMogoServiceApis? = null - - @Volatile - private var isLauncherCallingViewShown = false - - @Volatile - private var isLauncherIncomingViewShown = false - - private var launcherIncomingView: View? = null - private var launcherCallingView: View? = null - - private var matchView: ConstraintLayout? = null - private var matchingView: ConstraintLayout? = null - private var callingView: ConstraintLayout? = null - - private var callIncomingAnswer: ImageView? = null - private var callIncomingRefuse: ImageView? = null - - private var cancelMatch: TextView? = null - private var callingHead: ImageView? = null - private var callingNickName: TextView? = null - private var callingTimer: TextView? = null - private var callingHangup: ImageView? = null - private var mContext: Context? = null - - private var moduleCarchattingTeamLlHead: LinearLayout? = null - private var moduleCarchattingTeamNum: TextView? = null - private var moduleCarchattingCivHead0: CircleImageView? = null - private var moduleCarchattingCivHead1: CircleImageView? = null - private var moduleCarchattingCivHead2: CircleImageView? = null - private var moduleCarchattingCivHead3: CircleImageView? = null - private var moduleCarchattingCivHead4: CircleImageView? = null - private var moduleCarchattingTeamRlView: ConstraintLayout? = null - private var moduleCarchattingTeamTvInfo: TextView? = null - private var moduleCarchattingTeamIvQuit: ImageView? = null - - private var match: (() -> Unit)? = null - private var canceledMatch: (() -> Unit)? = null - private var showVehicleTeamView: (() -> Unit)? = null - private var quitVehicleTeam: (() -> Unit)? = null - private var moveToCenter: (() -> Unit)? = null - private var agreeIncomingBack: (() -> Unit)? = null - private var hangUpIncomingBack: (() -> Unit)? = null - - private var handler: Handler? = null - - @SuppressLint("InflateParams") - fun init( - context: Context, serviceApi: IMogoServiceApis, - match: () -> Unit, - cancelMatch: () -> Unit, - showVehicleTeamView: () -> Unit, - quitVehicleTeam: () -> Unit, - moveToCenter: () -> Unit - ) { - Logger.d(TAG, "CallingWindowManager init --->") - this.mContext = context - this.serviceApi = serviceApi - this.match = match - this.canceledMatch = cancelMatch - this.showVehicleTeamView = showVehicleTeamView - this.quitVehicleTeam = quitVehicleTeam - this.moveToCenter = moveToCenter - handler = Handler(context.mainLooper) { - log(TAG, "times up ,ready to refuse call ") - when (it.what) { - MSG_DIALING_TIME_OUT -> { - releaseAudioAndVoice() - hangUpIncomingBack?.invoke() - } - } - true - } - hideIncomingView() - } - - private fun initView() { - Logger.d(TAG, "CallingWindowManager initView --->") - launcherCallingView = vrModeHelper.getCallingWindowLayoutView(mContext!!) - launcherCallingView?.setOnClickListener { } - launcherCallingView?.let { view -> - matchView = view.findViewById(R.id.module_carchatting_rl_match_init_view) - matchingView = view.findViewById(R.id.module_carchatting_rl_matching_view) - callingView = view.findViewById(R.id.module_carchatting_rl_call_view) - cancelMatch = view.findViewById(R.id.module_carchatting_tv_cancel_match) - callingHead = view.findViewById(R.id.module_carchatting_call_head) - callingHangup = view.findViewById(R.id.module_carchatting_call_hangUp) - callingNickName = view.findViewById(R.id.module_carchatting_call_nickname) - callingTimer = view.findViewById(R.id.module_carchatting_call_time) - moduleCarchattingTeamLlHead = view.findViewById(R.id.module_carchatting_team_ll_head) - moduleCarchattingTeamNum = view.findViewById(R.id.module_carchatting_team_num); - moduleCarchattingCivHead0 = view.findViewById(R.id.module_carchatting_civ_head0) - moduleCarchattingCivHead1 = view.findViewById(R.id.module_carchatting_civ_head1) - moduleCarchattingCivHead2 = view.findViewById(R.id.module_carchatting_civ_head2) - moduleCarchattingCivHead3 = view.findViewById(R.id.module_carchatting_civ_head3) - moduleCarchattingCivHead4 = view.findViewById(R.id.module_carchatting_civ_head4) - moduleCarchattingTeamRlView = view.findViewById(R.id.module_carchatting_team_rl_view) - moduleCarchattingTeamTvInfo = view.findViewById(R.id.module_carchatting_team_tv_info) - moduleCarchattingTeamIvQuit = view.findViewById(R.id.module_carchatting_iv_team_quit) - - if (DebugConfig.getCarMachineType() == CAR_MACHINE_TYPE_BYD) { - matchView?.visibility = View.VISIBLE - } - - matchView?.setOnClickListener { - match?.invoke() - matchView?.visibility = View.GONE - matchingView?.visibility = View.VISIBLE - } - cancelMatch?.setOnClickListener { - canceledMatch?.invoke() - matchingView?.visibility = View.GONE - matchView?.visibility = View.VISIBLE - } - moduleCarchattingTeamRlView?.setOnClickListener { - showVehicleTeamView?.invoke() - } - moduleCarchattingTeamIvQuit?.setOnClickListener { - quitVehicleTeam?.invoke() - } - callingHead?.setOnClickListener { - moveToCenter?.invoke() - } - } - } - - private fun showCallingWindow() { - if (isLauncherCallingViewShown) { - return - } - serviceApi?.windowManagerApi?.addView( - launcherCallingView, - vrModeHelper.getCallingWindowLayoutPosition(mContext!!), - true - ) - } - - fun isIncomingWindowShow(): Boolean { - return isLauncherIncomingViewShown - } - - fun isCallingWindowShow(): Boolean { - return isLauncherCallingViewShown - } - - fun showInitView() { - if (DebugConfig.getCarMachineType() != CAR_MACHINE_TYPE_BYD) { - Logger.d(TAG, "showInitView Mogo车机不执行") - return - } - if (launcherCallingView == null) { - Logger.d(TAG, "展示Launcher浮窗 showInitView") - initView() - showCallingWindow() - Logger.d(TAG, "添加浮窗成功 showInitView") - } - } - - fun showMatchingView() { - if (launcherCallingView == null) { - Logger.d(TAG, "展示Launcher浮窗 showMatchingView") - initView() - matchView?.visibility = View.GONE - moduleCarchattingTeamRlView?.visibility = View.GONE - callingView?.visibility = View.GONE - matchingView?.visibility = View.VISIBLE - showCallingWindow() - Logger.d(TAG, "添加浮窗成功 showMatchingView") - } - } - - fun showIncomingView( - agreeIncomingBack: () -> Unit, - hangUpIncomingBack: () -> Unit - ) { - Logger.d( - TAG, - "展示Launcher来电浮窗 showIncomingView===$isLauncherCallingViewShown" - ) - this.agreeIncomingBack = agreeIncomingBack - this.hangUpIncomingBack = hangUpIncomingBack - if (!isLauncherCallingViewShown) { - handler?.sendEmptyMessageDelayed(MSG_DIALING_TIME_OUT, DEFAULT_MAX_DIALING_TIME) - IMVoiceClient.speakAndRegisterCall({ _ -> - if (isLauncherCallingViewShown) { - log(TAG, "speakAndRegisterCall") - releaseAudioAndVoice() - } - }, { - log(TAG, "playFinish") - playAudioCall() - registerIntentInComingCall() - }) - if (launcherIncomingView == null) { - launcherIncomingView = LayoutInflater.from(mContext) - .inflate(R.layout.module_car_chatting_launcher_incoming_hawk_eye_view, null) - launcherIncomingView?.setOnClickListener { } - launcherIncomingView?.let { view -> - callIncomingAnswer = view.findViewById(R.id.module_carchatting_incoming_answer) - callIncomingRefuse = view.findViewById(R.id.module_carchatting_incoming_hangUp) - callIncomingAnswer?.setOnClickListener { - releaseAudioAndVoice() - agreeIncomingBack.invoke() - } - callIncomingRefuse?.setOnClickListener { - releaseAudioAndVoice() - hangUpIncomingBack.invoke() - } - } - } - if (isLauncherIncomingViewShown) { - return - } - val params = FrameLayout.LayoutParams( - mContext!!.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_width) - .toInt(), - mContext!!.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_height) - .toInt() - ) - val x = - mContext!!.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_x) - val y = - mContext!!.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_y) - params.leftMargin = x.toInt() - params.topMargin = y.toInt() - serviceApi?.windowManagerApi?.addView(launcherIncomingView, params, true) - isLauncherIncomingViewShown = true - Logger.d(TAG, "添加浮窗成功 addIncomingView===$isLauncherCallingViewShown") - } - } - - fun showCallingView( - currentUserInfo: UserInfo?, - hangUpCallBack: () -> Unit - ) { - Logger.d(TAG, "展示Launcher浮窗 showCallingView===$isLauncherCallingViewShown") - if (!isLauncherCallingViewShown) { - addCallWindowView(hangUpCallBack) { - refreshCallWindowData(currentUserInfo) - } - } else { - Logger.d( - TAG, - "刷新Launcher浮窗数据 showCallingView===currentUserInfo :$currentUserInfo" - ) - refreshCallWindowData(currentUserInfo) - } - } - - @SuppressLint("InflateParams") - private inline fun addCallWindowView( - crossinline hangUpCallBack: () -> Unit, - refreshData: (() -> Unit) - ) { - if (launcherCallingView == null) { - initView() - } - matchView?.visibility = View.GONE - matchingView?.visibility = View.GONE - moduleCarchattingTeamRlView?.visibility = View.GONE - callingView?.visibility = View.VISIBLE - callingTimer?.text = mContext?.resources?.getString(R.string.module_car_chat_matching_wait) - callingHangup?.setOnClickListener { - hangUpCallBack.invoke() - } - showCallingWindow() - refreshData.invoke() - isLauncherCallingViewShown = true - Logger.d(TAG, "添加浮窗成功 addCallWindowView===$isLauncherCallingViewShown") - } - - private fun refreshCallWindowData(currentUserInfo: UserInfo?) { - mContext?.let { - if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) { - GlideApp.with(it).load(currentUserInfo?.userHead) - .apply( - RequestOptions.bitmapTransform( - GlideRoundedCornersTransform( - 20f, - GlideRoundedCornersTransform.CornerType.LEFT - ) - ) - ) - .placeholder(R.mipmap.module_carchatting_hawk_eye_default_head_img) - .into(callingHead!!) - } else { - val options: RequestOptions = - RequestOptions() - .placeholder(R.mipmap.module_carchatting_default_head_img) - .error(R.mipmap.module_carchatting_default_head_img) - GlideApp.with(it).asBitmap().load(currentUserInfo?.userHead) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(SkinAbleBitmapTarget(callingHead, options)) - } - } -// callingNickName?.text = currentUserInfo?.userName ?: "蘑菇车主" - callingNickName?.text = "云平台" //todo 需要产品后面更改逻辑,避免写死造成困扰 - } - - fun hideIncomingView() { - if (!isLauncherIncomingViewShown) { - return - } - Logger.d(TAG, "隐藏Launcher来电浮窗===$isLauncherCallingViewShown") - handler?.removeMessages(MSG_DIALING_TIME_OUT) - releaseAudioAndVoice() - if (isLauncherIncomingViewShown) { - isLauncherIncomingViewShown = false - } - launcherIncomingView?.let { - serviceApi?.windowManagerApi?.removeView(it) - } - } - - fun hideCallingView() { - Logger.d(TAG, "隐藏Launcher浮窗===$isLauncherCallingViewShown") - if (isLauncherCallingViewShown) { - callingTimer?.text = null - callingNickName?.text = null - isLauncherCallingViewShown = false - } - callingTimer?.text = mContext?.resources?.getString(R.string.module_car_chat_matching_wait) - callingView?.visibility = View.GONE - matchingView?.visibility = View.GONE - if (DebugConfig.getCarMachineType() == CAR_MACHINE_TYPE_BYD) { - matchView?.visibility = View.VISIBLE - } - removeView() - } - - private fun removeView() { - serviceApi?.windowManagerApi?.removeView(launcherCallingView) - } - - fun updateTimer(timeStr: String) { - Logger.d(TAG, "CallingWindowManager updateView===$timeStr") - callingTimer?.text = timeStr - } - - fun showVehicleTeamView() { - Logger.d( - TAG, - "showVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown" - ) - if (!isLauncherCallingViewShown) { - if (launcherCallingView == null) { - initView() - } - callingView?.visibility = View.GONE - matchingView?.visibility = View.GONE - if (DebugConfig.getCarMachineType() == CAR_MACHINE_TYPE_BYD) { - matchView?.visibility = View.GONE - } - moduleCarchattingTeamRlView?.visibility = View.VISIBLE - showCallingWindow() - isLauncherCallingViewShown = true - } - } - - fun hideVehicleTeamView() { - Logger.d( - TAG, - "hideVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown" - ) - callingView?.visibility = View.GONE - matchingView?.visibility = View.GONE - moduleCarchattingTeamRlView?.visibility = View.GONE - if (DebugConfig.getCarMachineType() == CAR_MACHINE_TYPE_BYD) { - matchView?.visibility = View.VISIBLE - } - if (isLauncherCallingViewShown) { - isLauncherCallingViewShown = false - } - removeView() - } - - fun updateVehicleTeamHeadView(teamMember: List?) { - val vrMode = MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode - if (vrMode) { - teamMember?.let { - if (it.size > 1) { - moduleCarchattingTeamLlHead?.visibility = View.VISIBLE - moduleCarchattingTeamNum?.visibility = View.VISIBLE - moduleCarchattingTeamNum?.text = "${teamMember?.size}人" - } else { - moduleCarchattingTeamLlHead?.visibility = View.INVISIBLE - } - } - return - } - teamMember?.let { - if (it.size > 1) { - moduleCarchattingTeamLlHead?.visibility = View.VISIBLE - when (it.size) { - 2 -> { - moduleCarchattingCivHead0?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[0].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead0!!) - moduleCarchattingCivHead1?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[1].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead1!!) - moduleCarchattingCivHead2?.visibility = View.GONE - moduleCarchattingCivHead3?.visibility = View.GONE - moduleCarchattingCivHead4?.visibility = View.GONE - val layoutParams: ConstraintLayout.LayoutParams = - moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams - layoutParams.bottomMargin = 0 - moduleCarchattingTeamLlHead?.layoutParams = layoutParams - } - 3 -> { - moduleCarchattingCivHead0?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[0].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead0!!) - moduleCarchattingCivHead1?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[1].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead1!!) - moduleCarchattingCivHead2?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[2].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead2!!) - moduleCarchattingCivHead3?.visibility = View.GONE - moduleCarchattingCivHead4?.visibility = View.GONE - val layoutParams: ConstraintLayout.LayoutParams = - moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams - layoutParams.bottomMargin = 0 - moduleCarchattingTeamLlHead?.layoutParams = layoutParams - } - 4 -> { - moduleCarchattingCivHead0?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[0].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead0!!) - moduleCarchattingCivHead1?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[1].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead1!!) - moduleCarchattingCivHead2?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[2].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead2!!) - moduleCarchattingCivHead3?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[3].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead3!!) - moduleCarchattingCivHead4?.visibility = View.INVISIBLE - val layoutParams: ConstraintLayout.LayoutParams = - moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams - val margin = - mContext!!.resources.getDimension(R.dimen.module_call_chat_team_head_view_top_margin) - layoutParams.bottomMargin = margin.toInt() - moduleCarchattingTeamLlHead?.layoutParams = layoutParams - } - else -> { - moduleCarchattingCivHead0?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[0].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead0!!) - moduleCarchattingCivHead1?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[1].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead1!!) - moduleCarchattingCivHead2?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[2].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead2!!) - moduleCarchattingCivHead3?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[3].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead3!!) - moduleCarchattingCivHead4?.visibility = View.VISIBLE - GlideApp.with(mContext!!).load(teamMember[4].headImgUrl) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(moduleCarchattingCivHead4!!) - val layoutParams: ConstraintLayout.LayoutParams = - moduleCarchattingTeamLlHead?.layoutParams as ConstraintLayout.LayoutParams - val margin = - mContext!!.resources.getDimension(R.dimen.module_call_chat_team_head_view_top_margin) - layoutParams.bottomMargin = margin.toInt() - moduleCarchattingTeamLlHead?.layoutParams = layoutParams - } - } - } else { - moduleCarchattingTeamLlHead?.visibility = View.INVISIBLE - } - } - } - - fun resetStatus() { - isLauncherCallingViewShown = false - launcherCallingView = null - } - - fun resetVRModeView() { - launcherCallingView?.let { - removeView() - } - launcherCallingView = null - } - - private fun releaseAudioAndVoice() { - stopAudioCall() - unRegisterVoice() - } - - private fun playAudioCall() { - MediaController.startPlay(mContext!!, R.raw.call, true, AudioManager.STREAM_RING) - } - - private fun stopAudioCall() { - log(TAG, "停止播放来电铃声======") - MediaController.release() - } - - private fun registerIntentInComingCall() { - IMVoiceClient.registerIntentInComingCall(this) - } - - private fun unRegisterVoice() { - IMVoiceClient.releaseSpeakAndRegisterCallback() - IMVoiceClient.unRegisterIntentInComingCall(this) - } - - override fun onVoiceAnswerCall() { - releaseAudioAndVoice() - agreeIncomingBack?.invoke() - } - - override fun onVoiceRefuseCall() { - releaseAudioAndVoice() - hangUpIncomingBack?.invoke() - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/DrawableTextView.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/DrawableTextView.kt deleted file mode 100644 index bc76e78c47..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/DrawableTextView.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.content.Context -import android.graphics.Canvas -import android.util.AttributeSet - -class DrawableTextView : androidx.appcompat.widget.AppCompatTextView { - - constructor(context: Context) : super(context) - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( - context, - attrs, - defStyleAttr - ) - - override fun onDraw(canvas: Canvas) { - val drawable = compoundDrawables - val leftDrawable = drawable[0] - if (leftDrawable != null) { - val leftDrawableWidth = leftDrawable.intrinsicWidth - val drawablePadding = compoundDrawablePadding - val textWidth = paint.measureText(text.toString().trim()) - val bodyWidth = leftDrawableWidth + drawablePadding + textWidth - canvas.save() - canvas.translate((width - bodyWidth) / 2, 0f) - } - super.onDraw(canvas) - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/IMogoCallChatWindowModeChange.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/IMogoCallChatWindowModeChange.kt deleted file mode 100644 index a6777a792e..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/IMogoCallChatWindowModeChange.kt +++ /dev/null @@ -1,33 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import android.widget.FrameLayout - -/** - * IM通讯能力 Window 正常模式和鹰眼模式 页面切换接口 - */ -interface IMogoCallChatWindowModeChange { - - /** - * 获取将要更新的聊天窗口 parentView - */ - fun getCallingWindowLayoutView(context: Context): View - - /** - * 获取将要更新聊天窗口View的大小,位置参数 - */ - fun getCallingWindowLayoutPosition(context: Context): FrameLayout.LayoutParams - - /** - * 获取将要更新车队邀请的 parentView - */ - fun getTeamInvitationWindowLayoutView(context: Context): View - - /** - * 获取将要更新车队邀请View的大小,位置参数 - */ - fun getTeamInvitationWindowLayoutPosition(context: Context): ViewGroup.MarginLayoutParams - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/MapViewManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/MapViewManager.kt deleted file mode 100644 index b68a9cdc97..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/MapViewManager.kt +++ /dev/null @@ -1,142 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.content.Context -import android.graphics.Rect -import android.graphics.drawable.BitmapDrawable -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.data.map.MogoLatLng -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.map.marker.MogoMarkerOptions -import com.mogo.module.carchatting.R -import com.mogo.module.common.ModuleNames -import com.mogo.module.common.entity.MarkerLocation -import com.mogo.module.common.entity.MarkerShowEntity -import com.mogo.service.IMogoServiceApis -import com.zhidao.carchattingprovider.CallChattingProviderConstant - -class MapViewManager private constructor() { - - companion object { - - // 正在组队通话的marker标识 - const val CALLING = "CallingUser" - - const val TAG = "MapViewManager" - - val mapViewManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - MapViewManager() - } - } - - private var hasMarked = false //是否已经在地图上标记 - - fun updateTeamMarker(context: Context, teamMember: List?) { - //延时一分钟后获取大而全数据 -// MogoApisHandler.getInstance().apis.statusManagerApi?.setUserInteractionStatus( -// CallChattingProviderConstant.CAR_CALL_PROVIDER, true, true) -//// val bitmaps = CallUserView.inflateCallingBitmap(context) -// ServiceApi.mapService()?.getMarkerManager(context)?.removeMarkers(CALLING) -// val imageView = ImageView(context) -// imageView.setImageDrawable(context.resources.getDrawable(R.mipmap.module_carchatting_caller)) -// teamMember?.forEach { -// //打点传入type为在线车辆 -// val options = MogoMarkerOptions().icon(imageView).latitude(it.lat).longitude(it.lon) -// ServiceApi.mapService()?.getMarkerManager(context)?.addMarker(CALLING, options)?.setClickable(false) -// -// } - } - - fun showLocationOnMap( - context: Context, - serviceApi: IMogoServiceApis?, - lat: Double?, - lon: Double?, - userHead: String? - ) { - if (!hasMarked) { - hasMarked = true - showLocation(context, serviceApi, lat, lon, userHead) - } - } - - - private fun showLocation( - context: Context, - serviceApi: IMogoServiceApis?, - lat: Double?, - lon: Double?, - userHead: String? - ) { - //延时一分钟后获取大而全数据 - serviceApi?.statusManagerApi?.setUserInteractionStatus( - CallChattingProviderConstant.CAR_CALL_PROVIDER, - true, - true - ) - //清除地图上所有Marker - serviceApi?.mapServiceApi?.getMarkerManager(context)?.removeMarkers() - //获取需要打点的经纬度 - val userLoc = - serviceApi?.mapServiceApi?.getSingletonLocationClient(context)?.lastKnowLocation - val latlonList = mutableListOf() - var currentLatLng: MogoLatLng? = null - userLoc?.let { - currentLatLng = MogoLatLng(it.latitude, it.longitude) - } - latlonList.add(MogoLatLng(lat ?: 0.0, lon ?: 0.0)) - //打点传入type为在线车辆 并缩小地图区域 - getMarkerEntity(context, lat, lon, userHead) { _: String, options: MogoMarkerOptions -> - val mapMarker = - serviceApi?.mapServiceApi?.getMarkerManager(context)?.addMarker(CALLING, options) - mapMarker?.setClickable(false) - } - val mapUIController = serviceApi?.mapServiceApi?.mapUIController - mapUIController?.showBounds( - CallChattingProviderConstant.CAR_CALL_PROVIDER, - currentLatLng, - latlonList, - Rect( - context.resources.getDimension(R.dimen.dp_736).toInt(), - context.resources.getDimension(R.dimen.dp_198).toInt(), - context.resources.getDimension(R.dimen.dp_59).toInt(), - context.resources.getDimension(R.dimen.dp_59).toInt() - ), - true - ) - } - - @Suppress("DEPRECATION") - private fun getMarkerEntity( - context: Context, - lat: Double?, - lon: Double?, - userHead: String?, - callBack: (markerType: String, options: MogoMarkerOptions) -> Unit - ) { - val markerEntity = MarkerShowEntity() - val markerLoc = MarkerLocation() - markerLoc.lat = lat ?: 0.0 - markerLoc.lon = lon ?: 0.0 - with(markerEntity) { - isHighlighted = true - isChecked = false - markerType = ModuleNames.CARD_TYPE_USER_DATA - iconUrl = userHead - markerLocation = markerLoc - } - val options = MogoMarkerOptions() - .data(markerEntity) - .icon((context.resources.getDrawable(R.mipmap.module_carchatting_caller) as BitmapDrawable).bitmap) - .latitude(markerEntity.markerLocation.lat) - .longitude(markerEntity.markerLocation.lon) - callBack.invoke(markerEntity.markerType, options) - } - - fun resetMarkerStatus(serviceApi: IMogoServiceApis?) { - Logger.d(TAG, "resetMarkerStatus") - hasMarked = false - serviceApi?.mapServiceApi?.getMarkerManager(AbsMogoApplication.getApp().applicationContext) - ?.removeMarkers(CALLING) - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt deleted file mode 100644 index a6feb835df..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt +++ /dev/null @@ -1,140 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.annotation.SuppressLint -import android.content.Context -import android.view.View -import android.widget.ImageView -import android.widget.TextView -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.carchatting.R -import com.mogo.module.carchatting.bean.UserInfo -import com.mogo.module.carchatting.biz.CallChatCenter -import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter -import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG -import com.mogo.module.carchatting.view.VrModeHelper.Companion.vrModeHelper -import com.mogo.module.carchatting.voice.IVoiceCommandListener -import com.mogo.module.carchatting.voice.VoiceUtil -import com.mogo.module.common.MogoApisHandler -import com.mogo.service.IMogoServiceApis -import com.mogo.service.windowview.IMogoTopViewStatusListener -import kotlinx.coroutines.* - -/** - * created by wujifei on 2020/11/17 20:18 - * describe:邀请加入车队窗口管理 - */ -class TeamInvitationWindowManager private constructor() { - private var mApis: IMogoServiceApis? = null - private var mContext: Context? = null - private var teamInvitationView: View? = null - private var moduleCarchattingTvContent: TextView? = null - private var moduleCarchattingIvJoin: ImageView? = null - private var moduleCarchattingIvRefuse: ImageView? = null - private var userInfo: UserInfo? = null - - companion object { - val teamInvitationWindowManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - TeamInvitationWindowManager() - } - } - - @SuppressLint("InflateParams") - fun init(context: Context) { - mApis = MogoApisHandler.getInstance().apis - this.mContext = context - } - - private fun initView() { - teamInvitationView = vrModeHelper.getTeamInvitationWindowLayoutView(mContext!!) - teamInvitationView?.let { view -> - moduleCarchattingTvContent = view.findViewById(R.id.module_carchatting_tv_content) - moduleCarchattingIvJoin = view.findViewById(R.id.module_carchatting_iv_join) - moduleCarchattingIvRefuse = view.findViewById(R.id.module_carchatting_iv_refuse) - moduleCarchattingIvJoin?.setOnClickListener { - userInfo?.let { - callChatCenter.joinVehicleTeam(it.sn) - } - hideTeamInvitationView() - } - moduleCarchattingIvRefuse?.setOnClickListener { - userInfo?.let { - callChatCenter.refuseCall(it.sn) - } - hideTeamInvitationView() - } - } - } - - fun showTeamInvitationView(userInfo: UserInfo?) { - this.userInfo = userInfo - // if (teamInvitationView == null) { - initView() - // } - userInfo?.let { - moduleCarchattingTvContent?.text = String.format(mContext!!.getString(R.string.module_car_chat_invitation_window), it.userName) - } - mContext?.let { - mApis?.topViewManager?.addView(teamInvitationView, vrModeHelper.getTeamInvitationWindowLayoutPosition(it), topViewStatusListener) - } - } - - fun hideTeamInvitationView() { - mApis?.topViewManager?.removeView(teamInvitationView) - } - - private var topViewStatusListener = object : IMogoTopViewStatusListener { - private var job: Job? = null - - override fun onViewAdded(view: View?) { - VoiceUtil.speak(mContext!!.getString(R.string.module_car_chat_team_invited_prompt), mContext!!, mVoiceCommandListener) - try { - job = GlobalScope.launch(Dispatchers.Main) { - delay(1000 * 20) - Logger.d(TAG, "refuseCall()--->executed") - callChatCenter.refuseCall(userInfo!!.sn) - hideTeamInvitationView() - } - } catch (e: Exception) { - e.printStackTrace() - } - } - - override fun onViewRemoved(view: View?) { - job?.cancel() - VoiceUtil.unregisterJoinTeam(mContext!!) - } - - override fun beforeViewRemoveAnim(view: View?) { - } - - override fun beforeViewAddAnim(view: View?) { - } - } - - - private var mVoiceCommandListener = object : IVoiceCommandListener { - override fun onVoiceJoinTeam() { - super.onVoiceJoinTeam() - callChatCenter.joinVehicleTeam(userInfo!!.sn) - hideTeamInvitationView() - } - - override fun onVoiceRefuseJoinTeam() { - super.onVoiceRefuseJoinTeam() - callChatCenter.refuseCall(userInfo!!.sn) - hideTeamInvitationView() - } - - override fun onSpeakEnd(speakText: String?) { - super.onSpeakEnd(speakText) - VoiceUtil.registerJoinTeam(mContext!!, this) - } - } - - fun onDestroy() { - teamInvitationView = null - userInfo = null - mApis = null - mContext = null - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TextViewExtend.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TextViewExtend.kt deleted file mode 100644 index 3c2551e140..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TextViewExtend.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.widget.TextView - -fun TextView.setLeftDrawable(resId: Int) { - if(resId!=0) { - val drawable = resources.getDrawable(resId) - drawable.setBounds(0, 0, drawable.minimumWidth, drawable.minimumHeight) - setCompoundDrawables( - drawable, - null, - null, - null - ) - }else{ - setCompoundDrawables(null, null, null, null) - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt deleted file mode 100644 index a670c56870..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt +++ /dev/null @@ -1,153 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.content.Context -import android.view.View -import android.widget.ImageView -import android.widget.TextView -import com.bumptech.glide.request.RequestOptions -import com.google.gson.Gson -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform -import com.mogo.module.carchatting.R -import com.mogo.module.carchatting.bean.EnthusiasmIndex -import com.mogo.module.carchatting.bean.UserInfo -import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter -import com.mogo.module.carchatting.voice.IVoiceCommandListener -import com.mogo.module.carchatting.voice.VoiceUtil -import com.mogo.module.common.dialog.BaseFloatDialog -import com.mogo.module.common.glide.SkinAbleBitmapTarget -import com.mogo.module.common.view.CustomRatingBar -import com.zhidao.carchattingprovider.MogoDriverInfo - -fun toUserInfo(driverInfo: MogoDriverInfo): UserInfo { - return UserInfo( - driverInfo.sn, - 0, - driverInfo.userName, - driverInfo.userHead, - driverInfo.gender, - driverInfo.age.toString(), - driverInfo.carTypeName, - driverInfo.locationInfo, - driverInfo.lat.toString(), - driverInfo.lon.toString() - ) -} - -class UserDialog : BaseFloatDialog { - - private var moduleCallChatBg: ImageView? = null - private var moduleCallChatUserClose: ImageView? = null - private var moduleCallChatUserHead: ImageView? = null - private var moduleCallChatUserNickName: TextView? = null - private var moduleCallChatRatingBar: CustomRatingBar? = null - private var moduleCallChatUserCaller: TextView? = null - private var moduleCallChatUserJoinTeam: DrawableTextView? = null - - private var driverInfo: MogoDriverInfo? = null - - constructor(mogoDriverInfo: MogoDriverInfo, context: Context) : super(context) { - driverInfo = mogoDriverInfo - initView() - } - - private fun initView() { - val lp = window!!.attributes - lp.width = context.resources.getDimension(R.dimen.module_call_chat_user_state_x).toInt() - lp.height = context.resources.getDimension(R.dimen.module_call_chat_user_state_y).toInt() - window!!.attributes = lp - setContentView(R.layout.module_car_chatting_launcher_user_view) - moduleCallChatBg = findViewById(R.id.moduleCallChatBg) - moduleCallChatUserClose = findViewById(R.id.moduleCallChatUserClose) - moduleCallChatUserHead = findViewById(R.id.moduleCallChatUserHead) - moduleCallChatUserNickName = findViewById(R.id.moduleCallChatUserNickName) - moduleCallChatUserCaller = findViewById(R.id.moduleCallChatUserCaller) - moduleCallChatUserJoinTeam = findViewById(R.id.moduleCallChatUserJoinTeam) - moduleCallChatRatingBar = findViewById(R.id.moduleCallChatRatingBar) - moduleCallChatUserClose?.setOnClickListener { - dismiss() - } - moduleCallChatUserCaller?.setOnClickListener { - callChatCenter.invokeCall(Gson().toJson(toUserInfo(driverInfo!!))) - dismiss() - } - moduleCallChatUserJoinTeam?.setOnClickListener { - callChatCenter.inviteJoinVehicleTeam(driverInfo!!.sn) - dismiss() - } - if (moduleCallChatRatingBar!!.visibility == View.VISIBLE) { - moduleCallChatRatingBar!!.visibility = View.GONE - } - val sn = driverInfo?.sn - sn?.let { - if (it != MoGoAiCloudClientConfig.getInstance().sn) { - callChatCenter.updateUserCallStatus { status -> - if (status) { - moduleCallChatUserCaller?.visibility = View.VISIBLE - } - } - callChatCenter.getUserEnthusiasmIndex(it) - callChatCenter.getUserInfo(it) - } - } - refreshUserWindowData() - } - - private fun refreshUserWindowData() { - val options: RequestOptions = - RequestOptions().circleCrop() - .placeholder(R.mipmap.module_carchatting_default_head_img) - .error(R.mipmap.module_carchatting_default_head_img) - GlideApp.with(AbsMogoApplication.getApp().applicationContext).asBitmap().load(driverInfo?.userHead) - .placeholder(R.mipmap.module_carchatting_default_head_img).circleCrop() - .into(SkinAbleBitmapTarget(moduleCallChatUserHead, options)) - moduleCallChatUserNickName?.text = driverInfo?.userName ?: "蘑菇车主" - val transform = GlideRoundedCornersTransform( - context.resources.getDimension(R.dimen.dp_45), - GlideRoundedCornersTransform.CornerType.ALL - ) - GlideApp.with(AbsMogoApplication.getApp().applicationContext).load(driverInfo?.userHead).apply( - RequestOptions.bitmapTransform(transform) - ).into(moduleCallChatBg!!) - } - - fun updateUserEnthusiasmIndex(enthusiasmIndex: EnthusiasmIndex) { - moduleCallChatRatingBar?.visibility = View.VISIBLE - val enthIndex = enthusiasmIndex.enthusiasmIndex - moduleCallChatRatingBar?.setRating(enthIndex.toFloat()) - } - - fun updateUserInfo(mogoDriverInfo: MogoDriverInfo?) { - mogoDriverInfo?.let { - driverInfo?.let { driverInfo -> - if (driverInfo.userHead.isNullOrBlank()) { - driverInfo.userHead = it.userHead - } - if (driverInfo.userName.isNullOrBlank()) { - driverInfo.userName = it.userName - } - } - } - refreshUserWindowData() - } - - override fun show() { - super.show() - VoiceUtil.registerInviteJoinTeam(context, mVoiceCommandListener) - } - - override fun dismiss() { - super.dismiss() - VoiceUtil.unregisterInviteJoinTeam(context) - } - - private var mVoiceCommandListener = object : IVoiceCommandListener { - override fun onVoiceInviteJoinTeam() { - super.onVoiceInviteJoinTeam() - callChatCenter.inviteJoinVehicleTeam(driverInfo!!.sn) - dismiss() - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt deleted file mode 100644 index 8bfb9fd7b9..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.mogo.module.carchatting.view - -import com.mogo.commons.context.ContextHolderUtil -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.carchatting.bean.EnthusiasmIndex -import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG -import com.zhidao.carchattingprovider.MogoDriverInfo - -class UserWindowManager private constructor() { - - companion object { - - val userWindowManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - UserWindowManager() - } - } - - private var userDialog: UserDialog? = null - private var userWindowListener: ((Boolean) -> Unit)? = null - - fun isCallingWindowShow(): Boolean { - return userDialog != null && userDialog!!.isShowing - } - - fun showUserView( - mogoDriverInfo: MogoDriverInfo, - userWindowListener: ((Boolean) -> Unit) - ) { - Logger.d(TAG, "展示用户信息浮窗===mogoDriverInfo : $mogoDriverInfo") - this.userWindowListener = userWindowListener - val context = ContextHolderUtil.getContext() - context?.let { - if (userDialog == null) { - userDialog = UserDialog(mogoDriverInfo, it) - userDialog!!.show() - userDialog!!.setOnDismissListener { - Logger.d(TAG, "主动隐藏用户信息浮窗===") - userDialog = null - this.userWindowListener?.invoke(false) - this.userWindowListener = null - } - this.userWindowListener?.invoke(true) - Logger.d(TAG, "添加用户信息浮窗成功===") - } else { - Logger.d(TAG, "刷新用户信息浮窗数据===mogoDriverInfo :$mogoDriverInfo") - updateUserInfo(mogoDriverInfo) - } - } - } - - fun updateUserEnthusiasmIndex(enthusiasmIndex: EnthusiasmIndex) { - Logger.d(TAG, "刷新用户热心指数=== $enthusiasmIndex") - userDialog?.let { - if(it.isShowing){ - userDialog?.updateUserEnthusiasmIndex(enthusiasmIndex) - } - } - } - - fun updateUserInfo(mogoDriverInfo: MogoDriverInfo) { - Logger.d(TAG, "刷新用户信息=== $mogoDriverInfo") - userDialog?.let { - if(it.isShowing){ - userDialog?.updateUserInfo(mogoDriverInfo) - } - } - } - - fun hideUserView() { - Logger.d(TAG, "隐藏用户信息浮窗===") - userDialog?.dismiss() - userWindowListener?.invoke(false) - userWindowListener = null - userDialog = null - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamFragment.java b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamFragment.java deleted file mode 100644 index bdb99b09f1..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamFragment.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.mogo.module.carchatting.view; - -import android.os.Bundle; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.chat.model.bean.TeammateInfo; -import com.mogo.commons.mvp.MvpFragment; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.module.carchatting.R; -import com.mogo.module.carchatting.adapter.VehicleTeamAdapter; -import com.mogo.module.carchatting.biz.CallChatCenter; -import com.mogo.module.common.MogoApisHandler; - -import java.util.List; - -/** - * created by wujifei on 2020/11/16 19:43 - * describe:车队信息 - */ -public class VehicleTeamFragment extends MvpFragment implements VehicleTeamView { - private static final String TAG = "VehicleTeamFragment"; - - private TextView tvNum; - private ImageView ivClose; - private RecyclerView rvTeammates; - private VehicleTeamAdapter vehicleTeamAdapter; - - public static VehicleTeamFragment newInstance() { - Bundle args = new Bundle(); - VehicleTeamFragment fragment = new VehicleTeamFragment(); - fragment.setArguments(args); - return fragment; - } - - @Override - protected int getLayoutId() { - return R.layout.module_car_chatting_fragment_team_view; - } - - @Override - public String getTagName() { - return TAG; - } - - @Override - protected void initViews() { - tvNum = findViewById(R.id.tv_num); - ivClose = findViewById(R.id.iv_close); - ivClose.setOnClickListener(view -> CallChatCenter.Companion.getCallChatCenter().closeVehicleTeamFragment()); - rvTeammates = findViewById(R.id.rv_teammates); - rvTeammates.setLayoutManager(new LinearLayoutManager(getContext())); - } - - @NonNull - @Override - protected VehicleTeamPresenter createPresenter() { - return new VehicleTeamPresenter(this); - } - - @Override - public void getTeammates(int roomId) { - mPresenter.getTeammates(roomId); - } - - @Override - public void showTeammates(List teammates) { - if (teammates == null) { - return; - } - tvNum.setText("车队人数:" + teammates.size() + "人"); - if (vehicleTeamAdapter == null) { - vehicleTeamAdapter = new VehicleTeamAdapter(getContext(), teammates); - vehicleTeamAdapter.setItemClickListener((position, teammateInfo) -> { - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() - .moveToCenter(new MogoLatLng(teammateInfo.getLat(), teammateInfo.getLon())); - CallChatCenter.Companion.getCallChatCenter().closeVehicleTeamFragment(); - }); - rvTeammates.setAdapter(vehicleTeamAdapter); - } else { - vehicleTeamAdapter.setTeammates(teammates); - vehicleTeamAdapter.notifyDataSetChanged(); - } - } - - @Override - public void getTeammatesFailed(String msg) { - - } -} diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt deleted file mode 100644 index 91aa1ea0fd..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt +++ /dev/null @@ -1,47 +0,0 @@ -package com.mogo.module.carchatting.view - -import com.google.gson.Gson -import com.mogo.chat.model.bean.TeammateInfo -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.module.carchatting.net.Repository -import com.mogo.module.carchatting.net.request - -/** - * created by wujifei on 2020/11/17 11:20 - * describe: - */ -class VehicleTeamModel { - - private val repository: Repository = Repository() - - - fun getTeammates( - roomId: Int, - onSuccess: (List) -> Unit, - onError: (String) -> Unit - ) { - request>> { - loader { - queryTeamDate(roomId) - } - onSuccess { - it.result.let { result -> - onSuccess.invoke(result) - } - } - onError { - it.message?.let { msg -> - onError.invoke(msg) - } - } - } - } - - private suspend fun queryTeamDate(roomId: Int): BaseResponse> { - val tmpMap = mapOf("roomId" to roomId) - val map = mapOf("data" to Gson().toJson(tmpMap)) - return repository.apiCall { - repository.getNetWorkApi().queryTeamDate(map) - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamPresenter.java b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamPresenter.java deleted file mode 100644 index 87ce29bbe3..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamPresenter.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mogo.module.carchatting.view; - -import com.mogo.chat.util.sp.SharedPreferenceUtil; -import com.mogo.commons.mvp.Presenter; - -/** - * created by wujifei on 2020/11/16 19:40 - * describe: - */ -public class VehicleTeamPresenter extends Presenter { - - - private final VehicleTeamModel vehicleTeamModel; - - public VehicleTeamPresenter(VehicleTeamView view) { - super(view); - vehicleTeamModel = new VehicleTeamModel(); - getTeammates(SharedPreferenceUtil.getRoomId()); - } - - - public void getTeammates(int roomId) { - vehicleTeamModel.getTeammates(roomId, teammateInfos -> { - mView.showTeammates(teammateInfos); - return null; - }, s -> { - mView.getTeammatesFailed(s); - return null; - }); - } - - -} diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamView.java b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamView.java deleted file mode 100644 index c9387ee782..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamView.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.module.carchatting.view; - -import com.mogo.chat.model.bean.TeammateInfo; -import com.mogo.commons.mvp.IView; -import java.util.List; - -/** - * created by wujifei on 2020/11/16 19:41 - * describe: - */ -public interface VehicleTeamView extends IView { - - - void getTeammates(int roomId); - - void showTeammates(List teammateInfos); - - void getTeammatesFailed(String msg); - -} diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VrModeHelper.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VrModeHelper.kt deleted file mode 100644 index acc6b32a45..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VrModeHelper.kt +++ /dev/null @@ -1,79 +0,0 @@ -package com.mogo.module.carchatting.view - -import android.annotation.SuppressLint -import android.content.Context -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.FrameLayout -import com.mogo.chat.constant.TAG -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.carchatting.R -import com.mogo.module.common.MogoApisHandler - -class VrModeHelper : IMogoCallChatWindowModeChange { - - companion object { - val vrModeHelper by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - VrModeHelper() - } - } - - @SuppressLint("InflateParams") - override fun getCallingWindowLayoutView(context: Context): View { - val vrMode = MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode - Logger.i(TAG,"vrMode : $vrMode") - return if (vrMode) { - LayoutInflater.from(context) - .inflate(R.layout.module_car_chatting_launcher_calling_hawk_eye_view, null) - } else { - LayoutInflater.from(context) - .inflate(R.layout.module_car_chatting_launcher_calling_view, null) - } - } - - override fun getCallingWindowLayoutPosition(context: Context): FrameLayout.LayoutParams { - val params: FrameLayout.LayoutParams - val x: Float - val y: Float - if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) { - x = context.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_x) - y = context.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_y) - params = FrameLayout.LayoutParams( - context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_width).toInt(), - context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_height).toInt() - ) - } else { - x = context.resources.getDimension(R.dimen.module_call_chat_state_location_x) - y = context.resources.getDimension(R.dimen.module_call_chat_state_location_y) - params = FrameLayout.LayoutParams( - context.resources.getDimension(R.dimen.module_call_chat_state_width).toInt(), - context.resources.getDimension(R.dimen.module_call_chat_state_height).toInt() - ) - } - params.leftMargin = x.toInt() - params.topMargin = y.toInt() - return params - } - - @SuppressLint("InflateParams") - override fun getTeamInvitationWindowLayoutView(context: Context): View { - return if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) { - LayoutInflater.from(context) - .inflate(R.layout.module_car_chatting_launcher_team_invitation_hawk_eye_view, null) - } else { - LayoutInflater.from(context) - .inflate(R.layout.module_car_chatting_launcher_team_invitation_view, null) - } - } - - override fun getTeamInvitationWindowLayoutPosition(context: Context): ViewGroup.MarginLayoutParams { - val height: Float = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) { - context.resources.getDimension(R.dimen.module_call_chat_team_invitation_hawk_eye_height) - } else { - context.resources.getDimension(R.dimen.module_call_chat_team_invitation_layout_height) - } - return ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams.MATCH_PARENT, height.toInt()) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceBusinessListener.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceBusinessListener.kt deleted file mode 100644 index 7ce5b4a725..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceBusinessListener.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.module.carchatting.voice - -interface IVoiceBusinessListener { - - fun onVoiceStartMatch() {} - - fun onVoiceCancelCall() {} - - fun onVoiceCancelMatch(isTTS: Boolean) {} - - fun onVoiceContinueCall(isTTS: Boolean) { - - } - - fun onVoiceReMatch() { - - } - - fun onVoiceInviteJoinTeam() {} - fun onVoiceJoinTeam() {} - fun onVoiceRefuseJoinTeam() {} -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceCommandListener.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceCommandListener.kt deleted file mode 100644 index a00573a7b9..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceCommandListener.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.mogo.module.carchatting.voice - -import com.mogo.commons.voice.IMogoVoiceCmdCallBack -import com.mogo.module.carchatting.util.LogUtil - -private const val IVoiceCommandTAG = "IVoiceCommandTAG" - -interface IVoiceCommandListener : IMogoVoiceCmdCallBack, IVoiceBusinessListener { - - override fun onCmdSelected(cmd: String?) { - LogUtil.i( - IVoiceCommandTAG, "onCmdSelected cmd:${cmd ?: "cmd is null"}" - ) - cmd?.let { - VoiceManager.handleOnCmdSelected(cmd, this) - } - } - - override fun onCmdAction(speakText: String?) { - - } - - override fun onCmdCancel(speakText: String?) { - - } - - override fun onSpeakSelectTimeOut(speakText: String?) { - - } - - override fun onSpeakEnd(speakText: String?) { - LogUtil.i(IVoiceCommandTAG, "onSpeakEnd --- speakText : $speakText") - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceIntentListener.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceIntentListener.kt deleted file mode 100644 index ae5452cdc5..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceIntentListener.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.mogo.module.carchatting.voice - -import android.content.Intent -import com.mogo.module.carchatting.util.LogUtil -import com.mogo.service.intent.IMogoIntentListener - -private const val IVoiceIntentTAG = "IVoiceIntentListener" - -interface IVoiceIntentListener : IMogoIntentListener ,IVoiceBusinessListener{ - - override fun onIntentReceived(cmd: String?, intent: Intent?) { - LogUtil.i(IVoiceIntentTAG, "cmd -> $cmd") - if (intent != null && cmd != null) { - VoiceManager.handleOnIntentCmd(cmd, intent, this) - } - } - - //打开车聊聊 切换卡片至车聊聊 - fun onSwitchCardToChat(){ - - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceQCommandListener.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceQCommandListener.kt deleted file mode 100644 index 46b67f7558..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/IVoiceQCommandListener.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.module.carchatting.voice - -import com.mogo.commons.voice.IMogoVoiceCmdCallBack - -interface IVoiceQCommandListener : IMogoVoiceCmdCallBack { - - override fun onCmdSelected(cmd: String?) { - - } - - override fun onSpeakEnd(speakText: String?) { - - } - - override fun onSpeakSelectTimeOut(speakText: String?) { - - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/VoiceManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/VoiceManager.kt deleted file mode 100644 index 19c6cbfab3..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/VoiceManager.kt +++ /dev/null @@ -1,98 +0,0 @@ -package com.mogo.module.carchatting.voice - -import android.content.Intent -import com.google.gson.Gson -import com.mogo.module.carchatting.bean.VoiceWake -import com.mogo.module.carchatting.bean.check -import com.mogo.module.carchatting.util.LogUtil -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_CANCEL_CALL_COMMAND -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_CANCEL_MATCH_COMMAND -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_CHAT_COMMAND -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_CONTINUE_CALL_COMMAND -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_REFUSE_CALL -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_REMATCH_COMMAND -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_INTENT_START_COMMAND -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_CANCEL_CALL -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_CANCEL_MATCH -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_CONTINUE_CALL -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_INVITE_JOIN_TEAM -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_JOIN_TEAM -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_MATCH -import com.mogo.module.carchatting.voice.VoiceUtil.VOICE_REGISTER_REFUSE_JOIN_TEAM - -object VoiceManager { - - private const val TAG = "VoiceManager" - - fun handleOnCmdSelected(cmd: String, listener: IVoiceCommandListener) { - LogUtil.i(TAG, "handleOnCmdSelected: cmd ---> $cmd") - when (cmd) { - VOICE_REGISTER_MATCH -> { - LogUtil.i(TAG, "语音免唤醒 开始匹配") - listener.onVoiceStartMatch() - } - VOICE_REGISTER_CANCEL_MATCH -> { - LogUtil.i(TAG, "语音免唤醒 取消匹配") - listener.onVoiceCancelMatch(true) - } - VOICE_REGISTER_CANCEL_CALL -> { - LogUtil.i(TAG, "语音免唤醒 取消打电话") - listener.onVoiceCancelCall() - } - VOICE_REGISTER_CONTINUE_CALL -> { - LogUtil.i(TAG, "语音免唤醒 继续呼叫") - listener.onVoiceContinueCall(true) - } - VOICE_REGISTER_INVITE_JOIN_TEAM -> { - LogUtil.i(TAG, "语音免唤醒 邀請加入车队") - listener.onVoiceInviteJoinTeam() - } - VOICE_REGISTER_JOIN_TEAM -> { - LogUtil.i(TAG, "语音免唤醒 加入车队") - listener.onVoiceJoinTeam() - } - VOICE_REGISTER_REFUSE_JOIN_TEAM -> { - LogUtil.i(TAG, "语音免唤醒 拒绝加入车队") - listener.onVoiceRefuseJoinTeam() - } - } - } - - fun handleOnIntentCmd(cmd: String, intent: Intent, listener: IVoiceIntentListener) { - LogUtil.i(TAG, "handleOnIntentCmd: cmd -> $cmd") - when (cmd) { - VOICE_INTENT_START_COMMAND -> { - val data = intent.getStringExtra("data") - LogUtil.i(TAG, "intent data -> $data") - data?.let { - val voiceWake = Gson().fromJson(it, VoiceWake::class.java) - if (voiceWake.check()) { - listener.onSwitchCardToChat() - } else { - LogUtil.i(TAG, "voiceWake check failed data:$it") - } - } - } - VOICE_INTENT_CHAT_COMMAND -> { - LogUtil.i(TAG, "语音唤醒 开始匹配") - listener.onVoiceStartMatch() - } - VOICE_INTENT_CANCEL_MATCH_COMMAND -> { - LogUtil.i(TAG, "语音唤醒 取消匹配") - listener.onVoiceCancelMatch(false) - } - VOICE_INTENT_CANCEL_CALL_COMMAND, VOICE_INTENT_REFUSE_CALL -> { - LogUtil.i(TAG, "语音唤醒 取消打电话") - listener.onVoiceCancelCall() - } - VOICE_INTENT_CONTINUE_CALL_COMMAND -> { - LogUtil.i(TAG, "语音唤醒 继续呼叫") - listener.onVoiceContinueCall(false) - } - VOICE_INTENT_REMATCH_COMMAND -> { - LogUtil.i(TAG, "语音唤醒 重新匹配") - listener.onVoiceReMatch() - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/VoiceUtil.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/VoiceUtil.kt deleted file mode 100644 index bc9f105b53..0000000000 --- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/voice/VoiceUtil.kt +++ /dev/null @@ -1,209 +0,0 @@ -package com.mogo.module.carchatting.voice - -import android.content.Context -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.commons.debug.DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE -import com.mogo.commons.debug.DebugConfig.getCarMachineType -import com.mogo.commons.voice.AIAssist -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.carchatting.util.LogUtil -import com.mogo.service.IMogoServiceApis -import com.mogo.service.intent.IMogoIntentManager - -object VoiceUtil { - private const val TAG = "VoiceUtil" - private var intentRegister: IMogoIntentManager? = null - - init { - LogUtil.i(TAG, "init") - val register = - ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() - if (register is IMogoServiceApis) { - intentRegister = register.intentManagerApi - } - } - - //WakeUp Command (Intent) - const val VOICE_INTENT_START_COMMAND = "system.application.operation" //打开车聊聊 卡片切换 - const val VOICE_INTENT_CHAT_COMMAND = "com.zhidao.imdemo.chat" //开始匹配 - const val VOICE_INTENT_CANCEL_MATCH_COMMAND = "com.zhidao.commin.cancel" //取消匹配 - const val VOICE_INTENT_REMATCH_COMMAND = "com.zhidao.imdemo.chat.rematch" //重新匹配 - const val VOICE_INTENT_CANCEL_CALL_COMMAND = "com.zhidao.commin.cancel" //取消呼叫,取消通话 - const val VOICE_INTENT_REFUSE_CALL = "com.ileja.phone.incoming.reject" //挂断 - const val VOICE_INTENT_CONTINUE_CALL_COMMAND = "com.zhidao.imdemo.chat.continue.call" //继续呼叫 - - //unWakeUp Command - const val VOICE_REGISTER_INVITE_JOIN_TEAM = "CMD_CAR_CHAT_INVITE_JOIN_TEAM" - private val customInviteJoinTeamArray: Array = arrayOf("邀请加入车队") - const val VOICE_REGISTER_JOIN_TEAM = "CMD_CAR_CHAT_JOIN_TEAM" - private val customJoinTeamArray: Array = arrayOf("加入", "加入车队") - const val VOICE_REGISTER_REFUSE_JOIN_TEAM = "CMD_CAR_CHAT_REFUSE_JOIN_TEAM" - private val customRefuseJoinTeamArray: Array = arrayOf("拒绝", "拒绝加入车队") - const val VOICE_REGISTER_MATCH = "CMD_CAR_CHAT_MATCH" - private val customMatchArray: Array = arrayOf("语音匹配", "开始匹配", "匹配好友", "聊一聊", "我要聊天") - const val VOICE_REGISTER_CANCEL_MATCH = "CMD_CAR_CHAT_CANCEL_MATCH" - private val customCancelMatchArray: Array = arrayOf("取消匹配") - const val VOICE_REGISTER_CANCEL_CALL = "CMD_CAR_CHAT_CANCEL_CALL" - private val customCancelCallArray: Array = arrayOf("取消通话", "取消呼叫", "挂断") - const val VOICE_REGISTER_CONTINUE_CALL = "CMD_CAR_CHAT_CONTINUE_CALL" - private val customContinueCallArray: Array = arrayOf("继续呼叫") - - //Question and TTS - private const val REQUEST_MATCH_FAIL = "匹配失败,说“重新匹配”继续寻找缘分车友。" - private val requestMatchFailYArray: Array = arrayOf("重新匹配") - private val requestMatchFailNArray: Array = arrayOf("取消", "取消匹配") - - fun speak(content: String, context: Context, listener: IVoiceCommandListener) { - AIAssist.getInstance(context).speakTTSVoice(content, listener) - } - - private var hasRegister = false - - fun registerAll( - context: Context, - voiceCommand: IVoiceCommandListener, - intentCommand: IVoiceIntentListener - ) { - if (!hasRegister) { - hasRegister = true -// registerReMatch(intentCommand) - if (getCarMachineType() != CAR_MACHINE_TYPE_SELF_INNOVATE) { - registerMatch(context, voiceCommand, intentCommand) - registerCancelMatch(context, voiceCommand, intentCommand) - } - registerCancelCall(context, voiceCommand, intentCommand) -// registerContinueCall(context, voiceCommand, intentCommand) -// registerIntentVoiceCommand(intentCommand) - } - } - - fun registerInviteJoinTeam(context: Context, voiceCommand: IVoiceCommandListener) { - LogUtil.i(TAG, "registerInviteJoinTeam") - AIAssist.getInstance(context) - .registerUnWakeupCommand(VOICE_REGISTER_INVITE_JOIN_TEAM, customInviteJoinTeamArray, voiceCommand) - } - - fun registerJoinTeam(context: Context, voiceCommand: IVoiceCommandListener) { - LogUtil.i(TAG, "registerJoinTeam") - AIAssist.getInstance(context) - .registerUnWakeupCommand(VOICE_REGISTER_JOIN_TEAM, customJoinTeamArray, voiceCommand) - AIAssist.getInstance(context) - .registerUnWakeupCommand(VOICE_REGISTER_REFUSE_JOIN_TEAM, customRefuseJoinTeamArray, voiceCommand) - } - - private fun registerMatch( - context: Context, - voiceCommand: IVoiceCommandListener, - intentCommand: IVoiceIntentListener - ) { - LogUtil.i(TAG, "registerMatch") - AIAssist.getInstance(context) - .registerUnWakeupCommand( - VOICE_REGISTER_MATCH, - customMatchArray, voiceCommand - ) - intentRegister?.registerIntentListener(VOICE_INTENT_CHAT_COMMAND, intentCommand) - } - - private fun registerReMatch(intentCommand: IVoiceIntentListener) { - LogUtil.i(TAG, "registerReMatch") - intentRegister?.registerIntentListener(VOICE_INTENT_REMATCH_COMMAND, intentCommand) - } - - private fun registerCancelMatch( - context: Context, - voiceCommand: IVoiceCommandListener, - intentCommand: IVoiceIntentListener - ) { - LogUtil.i(TAG, "registerCancelMatch") - AIAssist.getInstance(context) - .registerUnWakeupCommand( - VOICE_REGISTER_CANCEL_MATCH, - customCancelMatchArray, voiceCommand - ) - intentRegister?.registerIntentListener(VOICE_INTENT_CANCEL_MATCH_COMMAND, intentCommand) - } - - private fun registerCancelCall( - context: Context, - voiceCommand: IVoiceCommandListener, - intentCommand: IVoiceIntentListener - ) { - LogUtil.i(TAG, "registerCancelCall") - AIAssist.getInstance(context).registerUnWakeupCommand( - VOICE_REGISTER_CANCEL_CALL, - customCancelCallArray, - voiceCommand - ) - intentRegister?.registerIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, intentCommand) - intentRegister?.registerIntentListener(VOICE_INTENT_REFUSE_CALL, intentCommand) - } - - private fun registerContinueCall( - context: Context, - voiceCommand: IVoiceCommandListener, - intentCommand: IVoiceIntentListener - ) { - LogUtil.i(TAG, "registerContinueCall") - AIAssist.getInstance(context).registerUnWakeupCommand( - VOICE_REGISTER_CONTINUE_CALL, - customContinueCallArray, - voiceCommand - ) - intentRegister?.registerIntentListener( - VOICE_INTENT_CONTINUE_CALL_COMMAND, - intentCommand - ) - } - - fun unregisterAll(context: Context, listener: IVoiceIntentListener) { - LogUtil.i(TAG, "unregister All") - if (getCarMachineType() != CAR_MACHINE_TYPE_SELF_INNOVATE) { - AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_MATCH) - AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_CANCEL_MATCH) - } - AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL) -// AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_CONTINUE_CALL) - hasRegister = false - - LogUtil.i(TAG, "unregister IntentVoiceCommand --- intentRegister:$intentRegister") - intentRegister?.let { -// it.unregisterIntentListener(VOICE_INTENT_START_COMMAND, listener) - if (getCarMachineType() != CAR_MACHINE_TYPE_SELF_INNOVATE) { - it.unregisterIntentListener(VOICE_INTENT_CHAT_COMMAND, listener) - it.unregisterIntentListener(VOICE_INTENT_CANCEL_MATCH_COMMAND, listener) - } - it.unregisterIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, listener) - it.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, listener) -// it.unregisterIntentListener(VOICE_INTENT_CONTINUE_CALL_COMMAND, listener) - } - } - - - fun unregisterInviteJoinTeam(context: Context) { - LogUtil.i(TAG, "unregisterInviteJoinTeam") - AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_INVITE_JOIN_TEAM) - } - - fun unregisterJoinTeam(context: Context) { - LogUtil.i(TAG, "unregisterJoinTeam") - AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_JOIN_TEAM) - AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_REFUSE_JOIN_TEAM) - } - - private fun registerIntentVoiceCommand(listener: IVoiceIntentListener) { - LogUtil.i(TAG, "registerIntentVoiceCommand --- intentRegister:$intentRegister") - intentRegister?.registerIntentListener(VOICE_INTENT_START_COMMAND, listener) - } - - fun weatherReMatch(context: Context, callback: IVoiceQCommandListener) { - Logger.d(TAG, "weatherReMatch") - AIAssist.getInstance(context).speakQAndACmd( - REQUEST_MATCH_FAIL, - requestMatchFailYArray, - requestMatchFailNArray, callback - ) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_launcher_calling_bg.9.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_launcher_calling_bg.9.png deleted file mode 100644 index 96ddb81326..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_launcher_calling_bg.9.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment.png deleted file mode 100644 index 950d184e38..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_normal.png deleted file mode 100644 index 12ae03bfed..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_pressed.png deleted file mode 100644 index f81ff730e4..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_x.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_x.png deleted file mode 100644 index f7530c5024..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_fragment_x.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_head_default.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_head_default.png deleted file mode 100644 index eacbf33bf8..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_head_default.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png deleted file mode 100644 index 6f301e97ab..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png deleted file mode 100644 index 6f5411a704..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png deleted file mode 100644 index ee7fbb5dfe..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png deleted file mode 100644 index 0b1873ee8f..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_head_default.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_head_default.png deleted file mode 100644 index 4a891e57e5..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_head_default.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_normal.png deleted file mode 100644 index acf19225e1..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_pressed.png deleted file mode 100644 index d13ff23373..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_normal.png deleted file mode 100644 index f7530c5024..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_pressed.png deleted file mode 100644 index 950d184e38..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_quit_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_quit_normal.png deleted file mode 100644 index 0bd4b588e1..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_quit_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_quit_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_quit_pressed.png deleted file mode 100644 index 8954c0a15e..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-hdpi/module_carchatting_team_quit_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_launcher_calling_bg.9.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_launcher_calling_bg.9.png deleted file mode 100644 index fa35eccafd..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_launcher_calling_bg.9.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment.png deleted file mode 100644 index b04650a030..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_normal.png deleted file mode 100644 index 12ae03bfed..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_pressed.png deleted file mode 100644 index f81ff730e4..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_x.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_x.png deleted file mode 100644 index f274a5fa76..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_fragment_x.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_head_default.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_head_default.png deleted file mode 100644 index 53051d4e9e..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_head_default.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_normal.png deleted file mode 100644 index cf3e4aa222..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_pressed.png deleted file mode 100644 index b5a28f5583..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_normal.png deleted file mode 100644 index f274a5fa76..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_pressed.png deleted file mode 100644 index b04650a030..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_quit_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_quit_normal.png deleted file mode 100644 index f22c026f58..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_quit_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_quit_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_quit_pressed.png deleted file mode 100644 index a1f1234504..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-mdpi/module_carchatting_team_quit_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_launcher_calling_bg.9.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_launcher_calling_bg.9.png deleted file mode 100644 index 96ddb81326..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_launcher_calling_bg.9.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_launcher_hawk_eye_calling_bg.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_launcher_hawk_eye_calling_bg.png deleted file mode 100644 index 2357cb985b..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_launcher_hawk_eye_calling_bg.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_bg.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_bg.png deleted file mode 100644 index c2c244c134..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_bg.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_head_default.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_head_default.png deleted file mode 100644 index eacbf33bf8..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_head_default.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png deleted file mode 100644 index 6f301e97ab..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png deleted file mode 100644 index 6f5411a704..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png deleted file mode 100644 index ee7fbb5dfe..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png b/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png deleted file mode 100644 index 0b1873ee8f..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue.xml deleted file mode 100644 index be1941fa09..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue_normal.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue_normal.xml deleted file mode 100644 index e8d86c9442..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue_normal.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue_pressed.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue_pressed.xml deleted file mode 100644 index c55995839e..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_shape_gradient_blue_pressed.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg.xml deleted file mode 100644 index 83ee0bdebb..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg_normal.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg_normal.xml deleted file mode 100644 index b9765da6bb..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg_normal.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg_pressed.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg_pressed.xml deleted file mode 100644 index 21bf8c6e8e..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_callchatting_user_pop_call_bg_pressed.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_aicloud_incoming.png b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_aicloud_incoming.png deleted file mode 100644 index a6aef500e9..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_aicloud_incoming.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_fragment_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_fragment_bg.xml deleted file mode 100644 index 1965671b5d..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_fragment_bg.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_fragment_close.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_fragment_close.xml deleted file mode 100644 index b369d3a308..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_fragment_close.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_bg.xml deleted file mode 100644 index 28a3d7870b..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_bg.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_header_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_header_bg.xml deleted file mode 100644 index ef8a4f7ea6..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_header_bg.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_join.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_join.xml deleted file mode 100644 index a38fdde074..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_join.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_refuse.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_refuse.xml deleted file mode 100644 index f934359daf..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_refuse.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_join.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_join.xml deleted file mode 100644 index 12f805d13f..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_join.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_refuse.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_refuse.xml deleted file mode 100644 index 2981370f58..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_refuse.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_title_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_title_bg.xml deleted file mode 100644 index 0bd680b478..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_invitation_title_bg.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_quit.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_quit.xml deleted file mode 100644 index 286dfde9e6..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_quit.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_bg.xml deleted file mode 100644 index c1e6217fbe..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_bg.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_follower_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_follower_bg.xml deleted file mode 100644 index e1f1abd61e..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_follower_bg.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_leader_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_leader_bg.xml deleted file mode 100644 index 72421b5d37..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_team_teammate_leader_bg.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml deleted file mode 100644 index 2b00cf2b11..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_team_num_bg.xml b/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_team_num_bg.xml deleted file mode 100644 index ca94787528..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_team_num_bg.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_fragment_team_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_fragment_team_view.xml deleted file mode 100644 index 6dff11c8fb..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_fragment_team_view.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml deleted file mode 100644 index e252081659..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_view.xml deleted file mode 100644 index 61858e7909..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_calling_view.xml +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml deleted file mode 100644 index 799bc5faec..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml deleted file mode 100644 index 3e68b3ab98..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml deleted file mode 100644 index 48c915f342..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml deleted file mode 100644 index f58bf9d3d5..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_user_view.xml b/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_user_view.xml deleted file mode 100644 index 1de23819e8..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/layout/module_car_chatting_launcher_user_view.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_match.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_match.png deleted file mode 100644 index 08bcfd78a0..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_match.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_caller.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_caller.png deleted file mode 100644 index cd5fb91de2..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_caller.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_close.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_close.png deleted file mode 100644 index aa5d44c24d..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_close.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_join_team.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_join_team.png deleted file mode 100644 index fc4b862902..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_callchatting_user_join_team.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_caller.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_caller.png deleted file mode 100644 index 0f16300e2e..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_caller.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_default_head_img.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_default_head_img.png deleted file mode 100644 index 97e9ddda74..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_default_head_img.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_launcher_calling_hangup.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_launcher_calling_hangup.png deleted file mode 100644 index 41e7375716..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_launcher_calling_hangup.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_user_cover_bg.png b/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_user_cover_bg.png deleted file mode 100644 index 89153623c3..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-hdpi/module_carchatting_user_cover_bg.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_match.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_match.png deleted file mode 100644 index 08bcfd78a0..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_match.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_caller.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_caller.png deleted file mode 100644 index a15e56ada7..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_caller.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_close.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_close.png deleted file mode 100644 index a74b6c7341..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_close.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_join_team.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_join_team.png deleted file mode 100644 index b49d9f707f..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_callchatting_user_join_team.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_caller.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_caller.png deleted file mode 100644 index c3cb5f4aaa..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_caller.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_default_head_img.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_default_head_img.png deleted file mode 100644 index 88cd08b75a..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_default_head_img.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_launcher_calling_hangup.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_launcher_calling_hangup.png deleted file mode 100644 index 0fe0ca3fd5..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_launcher_calling_hangup.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_user_cover_bg.png b/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_user_cover_bg.png deleted file mode 100644 index ab7640f350..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-ldpi/module_carchatting_user_cover_bg.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-mdpi-1920x720/module_callchatting_match.png b/modules/mogo-module-carchatting/src/main/res/mipmap-mdpi-1920x720/module_callchatting_match.png deleted file mode 100644 index 08bcfd78a0..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-mdpi-1920x720/module_callchatting_match.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_answer.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_answer.png deleted file mode 100644 index ab8a1f46ef..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_answer.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_hangup.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_hangup.png deleted file mode 100644 index 3bc95a36d5..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_hangup.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_caller.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_caller.png deleted file mode 100644 index cd5fb91de2..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_caller.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_close.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_close.png deleted file mode 100644 index aa5d44c24d..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_close.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_join_team.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_join_team.png deleted file mode 100644 index fc4b862902..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_callchatting_user_join_team.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_caller.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_caller.png deleted file mode 100644 index 0f16300e2e..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_caller.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_default_head_img.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_default_head_img.png deleted file mode 100644 index 97e9ddda74..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_default_head_img.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_hawk_eye_default_head_img.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_hawk_eye_default_head_img.png deleted file mode 100644 index c86d55182a..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_hawk_eye_default_head_img.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_launcher_calling_hangup.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_launcher_calling_hangup.png deleted file mode 100644 index 41e7375716..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_launcher_calling_hangup.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_user_cover_bg.png b/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_user_cover_bg.png deleted file mode 100644 index 89153623c3..0000000000 Binary files a/modules/mogo-module-carchatting/src/main/res/mipmap-xhdpi/module_carchatting_user_cover_bg.png and /dev/null differ diff --git a/modules/mogo-module-carchatting/src/main/res/values-hdpi/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values-hdpi/dimens.xml deleted file mode 100644 index 295f403713..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values-hdpi/dimens.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - 872px - 1067px - 776px - 22px - 600px - 140px - 300px - 100px - - 1370px - 30px - 740px - 854px - - 290px - - 355px - 37px - 32px - 39px - 25px - 80px - 72px - 38px - 30px - 30px - 37px - 27px - 26px - 18px - 18px - 10px - 23px - 6px - 82px - 100px - - 82.5px - 150px - 30px - 159px - 8px - 16px - 40px - 15px - 90px - 50px - 70px - 10px - 56px - 30px - - - 48px - 48px - -12px - -122px - 36px - 22px - 22px - 32px - 26px - 22px - 22px - 79.8px - 79.8px - 28.4px - 25px - - - 27.5px - 50px - 36px - 80.8px - 80.8px - 24px - - 14px - 32px - 164px - 98px - 98px - 30px - 34px - 98px - 46px - 26px - - - 230px - 30px - 61px - 18px - 210px - 20px - 822px - 182px - 148px - 148px - 120px - 46px - 30px - 60px - 25px - 30px - 60px - 32px - 98px - 63px - 98px - 36px - 42px - - diff --git a/modules/mogo-module-carchatting/src/main/res/values-ldpi/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values-ldpi/dimens.xml deleted file mode 100644 index 8c085f2cba..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values-ldpi/dimens.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - 478px - 560px - 338px - 82px - 1543px - 0px - 411px - 474px - 161px - - 338px - 260px - 82px - 27px - 23px - 27px - 25px - 60px - 54px - 28px - 22px - 22px - 18px - 14px - 6px - 18px - 44px - - 45.8px - 83.3px - 16.6px - 88.3px - 5px - 10px - 22px - 10px - 56px - 30px - 39px - 30px - 13px - 17px - - - 26.4px - 26.4px - -6.6px - -66px - 19.8px - 13px - 14.6px - 18px - 14px - 11px - 14.6px - 43.4px - 43.4px - 16.5px - 25px - - - 10px - 28px - 20px - 44px - 44px - 14px - - 8px - 14px - 86px - 56px - 56px - 12.4px - 18px - 54px - 26px - 15px - - - 138px - 21px - 18px - 122px - 82px - 82px - 66px - 26px - 12px - 30px - 14px - 12px - 30px - 18px - 54px - 54px - 20px - diff --git a/modules/mogo-module-carchatting/src/main/res/values-mdpi-1920x720/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values-mdpi-1920x720/dimens.xml deleted file mode 100644 index 54f7a54824..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values-mdpi-1920x720/dimens.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - 467px - 573px - 338px - 82px - 1543px - 0px - 347px - 374px - 310px - - 422px - 260px - 87px - 27px - 23px - 27px - 25px - 60px - 54px - 28px - 22px - 22px - 24px - 17px - 15px - 23px - 58px - - 55px - 97px - 13px - 75px - 9px - 9px - 23px - 10px - 60px - 20px - 45px - 13px - 17px - - - 48px - 48px - -12px - -120px - 19.8px - 13px - 16px - 18px - 14px - 13px - 16px - 43.4px - 43.4px - 16px - - - 10px - 28px - 20px - 44px - 44px - 14px - - 8px - 14px - 86px - 56px - 56px - 12.4px - 18px - 54px - 26px - 15px - - - 21px - 18px - 122px - 82px - 82px - 66px - 26px - 12px - 9px - 14px - 12px - 9px - 18px - 54px - 54px - 20px - diff --git a/modules/mogo-module-carchatting/src/main/res/values-mdpi/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values-mdpi/dimens.xml deleted file mode 100644 index b757d39120..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values-mdpi/dimens.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - 467px - 573px - 338px - 82px - 1543px - 0px - 411px - 474px - 161px - - 338px - 260px - 82px - 27px - 23px - 27px - 25px - 60px - 54px - 28px - 22px - 22px - 18px - 14px - 6px - 18px - 44px - - 45.8px - 83.3px - 16.6px - 88.3px - 5px - 10px - 22px - 10px - 56px - 30px - 39px - 30px - 13px - 17px - - - 26.4px - 26.4px - -6.6px - -66px - 19.8px - 13px - 14.6px - 18px - 14px - 11px - 14.6px - 43.4px - 43.4px - 16.5px - 25px - - - 10px - 28px - 20px - 44px - 44px - 14px - - 8px - 14px - 86px - 56px - 56px - 12.4px - 18px - 54px - 26px - 15px - - - 138px - 21px - 18px - 122px - 82px - 82px - 66px - 26px - 12px - 30px - 14px - 12px - 30px - 18px - 54px - 54px - 20px - diff --git a/modules/mogo-module-carchatting/src/main/res/values-xhdpi-2560x1440/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values-xhdpi-2560x1440/dimens.xml deleted file mode 100644 index e264311f06..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 40px - 1160px - 460px - 144px - 560px - 142px - 20px - 30px - 30px - 28px - 24px - 144px - 88px - 86px - 20px - 26px - 24px - 40px - 144px - 106px - 40px - 27px - 24px - 27px - 34px - 139px - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values-xhdpi/dimens.xml deleted file mode 100644 index 56261617d8..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values-xhdpi/dimens.xml +++ /dev/null @@ -1,1105 +0,0 @@ - - - 20px - 18px - 100px - 80px - 30px - 20px - 20px - 20px - 22px - - - -60px - -30px - -20px - -12px - -10px - -8px - -5px - -2px - -1px - 0px - 0.1px - 0.5px - 1px - 1.5px - 2px - 2.5px - 3px - 3.5px - 4px - 4.5px - 5px - 6px - 7px - 7.5px - 8px - 9px - 10px - 11px - 12px - 13px - 14px - 15px - 16px - 17px - 18px - 19px - 20px - 21px - 22px - 23px - 24px - 25px - 26px - 27px - 28px - 29px - 30px - 31px - 32px - 33px - 34px - 35px - 36px - 37px - 38px - 39px - 40px - 41px - 42px - 43px - 44px - 45px - 46px - 47px - 48px - 49px - 50px - 51px - 52px - 53px - 54px - 55px - 56px - 57px - 58px - 59px - 60px - 61px - 62px - 63px - 64px - 65px - 66px - 67px - 68px - 69px - 70px - 71px - 72px - 73px - 74px - 75px - 76px - 77px - 78px - 79px - 80px - 81px - 82px - 83px - 84px - 85px - 86px - 87px - 88px - 89px - 90px - 91px - 92px - 93px - 94px - 95px - 96px - 97px - 98px - 99px - 100px - 101px - 102px - 103px - 104px - 104.5px - 105px - 106px - 107px - 108px - 109px - 110px - 111px - 112px - 113px - 114px - 115px - 116px - 117px - 118px - 119px - 120px - 121px - 122px - 123px - 124px - 125px - 126px - 127px - 128px - 129px - 130px - 131px - 132px - 133px - 134px - 134.5px - 135px - 136px - 137px - 138px - 139px - 140px - 141px - 142px - 143px - 144px - 145px - 146px - 147px - 148px - 149px - 150px - 151px - 152px - 153px - 154px - 155px - 156px - 157px - 158px - 159px - 160px - 161px - 162px - 163px - 164px - 165px - 166px - 167px - 168px - 169px - 170px - 171px - 172px - 173px - 174px - 175px - 176px - 177px - 178px - 179px - 180px - 181px - 182px - 183px - 184px - 185px - 186px - 187px - 188px - 189px - 190px - 191px - 191.25px - 192px - 193px - 194px - 195px - 196px - 197px - 198px - 199px - 200px - 201px - 202px - 203px - 204px - 205px - 206px - 207px - 208px - 209px - 210px - 211px - 212px - 213px - 214px - 215px - 216px - 217px - 218px - 219px - 220px - 221px - 222px - 223px - 224px - 225px - 226px - 227px - 228px - 229px - 230px - 231px - 232px - 233px - 234px - 235px - 236px - 237px - 238px - 239px - 240px - 241px - 242px - 243px - 244px - 245px - 246px - 247px - 248px - 249px - 250px - 251px - 252px - 253px - 254px - 255px - 256px - 257px - 258px - 259px - 260px - 261px - 262px - 263px - 264px - 265px - 266px - 267px - 268px - 269px - 270px - 271px - 272px - 273px - 274px - 275px - 276px - 277px - 278px - 279px - 280px - 281px - 282px - 283px - 284px - 285px - 286px - 287px - 288px - 289px - 290px - 291px - 292px - 293px - 294px - 295px - 296px - 297px - 298px - 299px - 300px - 301px - 302px - 303px - 304px - 305px - 306px - 307px - 308px - 309px - 310px - 311px - 312px - 313px - 314px - 315px - 316px - 317px - 318px - 319px - 320px - 321px - 322px - 323px - 324px - 325px - 326px - 327px - 328px - 329px - 330px - 331px - 332px - 333px - 334px - 335px - 336px - 337px - 338px - 339px - 340px - 341px - 342px - 343px - 344px - 345px - 346px - 347px - 348px - 349px - 350px - 351px - 352px - 353px - 354px - 355px - 356px - 357px - 358px - 359px - 366px - 367px - 368px - 369px - 370px - 371px - 372px - 373px - 374px - 375px - 376px - 377px - 378px - 379px - 380px - 381px - 382px - 383px - 384px - 385px - 386px - 387px - 388px - 389px - 390px - 391px - 392px - 393px - 394px - 395px - 396px - 397px - 398px - 399px - 400px - 401px - 402px - 403px - 404px - 405px - 406px - 407px - 408px - 409px - 410px - 411px - 412px - 413px - 414px - 415px - 416px - 417px - 418px - 419px - 420px - 421px - 422px - 423px - 424px - 425px - 426px - 427px - 428px - 429px - 430px - 431px - 432px - 433px - 434px - 435px - 436px - 437px - 438px - 439px - 440px - 441px - 442px - 443px - 444px - 445px - 446px - 447px - 448px - 449px - 450px - 451px - 452px - 453px - 454px - 455px - 456px - 457px - 458px - 459px - 460px - 461px - 462px - 463px - 464px - 465px - 466px - 467px - 468px - 469px - 470px - 471px - 472px - 473px - 474px - 475px - 476px - 477px - 478px - 479px - 480px - 481px - 482px - 483px - 484px - 485px - 486px - 487px - 488px - 489px - 490px - 491px - 492px - 493px - 494px - 495px - 496px - 497px - 498px - 499px - 500px - 501px - 502px - 503px - 504px - 505px - 506px - 507px - 508px - 509px - 510px - 511px - 512px - 513px - 514px - 515px - 516px - 517px - 518px - 519px - 520px - 521px - 522px - 523px - 524px - 525px - 526px - 527px - 528px - 529px - 530px - 531px - 532px - 533px - 534px - 535px - 536px - 537px - 538px - 539px - 540px - 541px - 542px - 543px - 544px - 545px - 546px - 547px - 548px - 549px - 550px - 551px - 552px - 553px - 554px - 555px - 556px - 557px - 558px - 559px - 560px - 561px - 562px - 563px - 564px - 565px - 566px - 567px - 568px - 569px - 570px - 571px - 572px - 573px - 574px - 575px - 576px - 577px - 578px - 579px - 580px - 581px - 582px - 583px - 584px - 585px - 586px - 587px - 588px - 589px - 590px - 591px - 592px - 593px - 594px - 595px - 596px - 597px - 598px - 599px - 600px - 601px - 602px - 603px - 604px - 605px - 606px - 607px - 608px - 609px - 610px - 611px - 612px - 613px - 614px - 615px - 616px - 617px - 618px - 619px - 620px - 621px - 622px - 623px - 624px - 625px - 626px - 627px - 628px - 629px - 630px - 631px - 632px - 633px - 634px - 635px - 636px - 637px - 638px - 639px - 640px - 641px - 642px - 643px - 644px - 645px - 646px - 647px - 648px - 649px - 650px - 651px - 652px - 653px - 654px - 655px - 656px - 657px - 658px - 659px - 660px - 661px - 662px - 663px - 664px - 665px - 666px - 667px - 668px - 669px - 670px - 671px - 672px - 673px - 674px - 675px - 676px - 677px - 678px - 679px - 680px - 681px - 682px - 683px - 684px - 685px - 686px - 687px - 688px - 689px - 690px - 691px - 692px - 693px - 694px - 695px - 696px - 697px - 698px - 699px - 700px - 701px - 702px - 703px - 704px - 705px - 706px - 707px - 708px - 709px - 710px - 711px - 712px - 713px - 714px - 715px - 716px - 717px - 718px - 719px - 720px - 721px - 722px - 723px - 724px - 725px - 726px - 727px - 728px - 729px - 730px - 731px - 732px - 733px - 734px - 735px - 736px - 737px - 738px - 739px - 740px - 741px - 742px - 743px - 744px - 745px - 746px - 747px - 748px - 749px - 750px - 751px - 752px - 753px - 754px - 755px - 756px - 757px - 758px - 759px - 760px - 761px - 762px - 763px - 764px - 765px - 766px - 767px - 768px - 769px - 770px - 771px - 772px - 773px - 774px - 775px - 776px - 777px - 778px - 779px - 780px - 781px - 782px - 783px - 784px - 785px - 786px - 787px - 788px - 789px - 790px - 791px - 792px - 793px - 794px - 795px - 796px - 797px - 798px - 799px - 800px - 801px - 802px - 803px - 804px - 805px - 806px - 807px - 808px - 809px - 810px - 811px - 812px - 813px - 814px - 815px - 816px - 817px - 818px - 819px - 820px - 821px - 822px - 823px - 824px - 825px - 826px - 827px - 828px - 829px - 830px - 831px - 832px - 833px - 834px - 835px - 836px - 837px - 838px - 839px - 840px - 841px - 842px - 843px - 844px - 845px - 846px - 847px - 848px - 849px - 850px - 851px - 852px - 853px - 854px - 855px - 856px - 857px - 858px - 859px - 860px - 861px - 862px - 863px - 864px - 865px - 866px - 867px - 868px - 869px - 870px - 871px - 872px - 873px - 874px - 875px - 876px - 877px - 878px - 879px - 880px - 881px - 882px - 883px - 884px - 885px - 886px - 887px - 888px - 889px - 890px - 891px - 892px - 893px - 894px - 895px - 896px - 897px - 898px - 899px - 900px - 901px - 902px - 903px - 904px - 905px - 906px - 907px - 908px - 909px - 910px - 911px - 912px - 913px - 914px - 915px - 916px - 917px - 918px - 919px - 920px - 921px - 922px - 923px - 924px - 925px - 926px - 927px - 928px - 929px - 930px - 931px - 932px - 933px - 934px - 935px - 936px - 937px - 938px - 939px - 940px - 941px - 942px - 943px - 944px - 945px - 946px - 947px - 948px - 949px - 950px - 951px - 952px - 953px - 954px - 955px - 956px - 957px - 958px - 959px - 960px - 961px - 962px - 963px - 964px - 965px - 966px - 967px - 968px - 969px - 970px - 971px - 972px - 973px - 974px - 975px - 976px - 977px - 978px - 979px - 980px - 981px - 982px - 983px - 984px - 985px - 986px - 987px - 988px - 989px - 990px - 991px - 992px - 993px - 994px - 995px - 996px - 997px - 998px - 999px - 1300px - 872px - 1067px - 776px - 30px - 600px - 140px - 300px - 100px - - 1380px - 20px - 740px - 854px - - 290px - - 30px - 61px - 26px - 18px - 37px - 27px - 18px - 16px - 23px - 9px - 82px - 100px - 42px - 66px - 822px - 182px - 82.5px - 150px - 30px - 159px - 8px - 16px - 40px - 15px - 90px - 50px - 70px - 10px - 56px - 30px - - 6px - 7px - 8px - 9px - 10px - 11px - 12px - 13px - 14px - 15px - 16px - 17px - 18px - 19px - 20px - 21px - 22px - 23px - 24px - 25px - 28px - 30px - 32px - 34px - 36px - 38px - 40px - 42px - 48px - - diff --git a/modules/mogo-module-carchatting/src/main/res/values/colors.xml b/modules/mogo-module-carchatting/src/main/res/values/colors.xml deleted file mode 100644 index d5046a7da3..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values/colors.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - #FFFFFF - #FFFFFF - #EE433E - #7FFFFFFF - #B5B5B5 - #66D8D8D8 - #66D8D8D8 - - #FFFFFF - - #FFFFFF - \ No newline at end of file diff --git a/modules/mogo-module-carchatting/src/main/res/values/dimens.xml b/modules/mogo-module-carchatting/src/main/res/values/dimens.xml deleted file mode 100644 index 98243747e2..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values/dimens.xml +++ /dev/null @@ -1,1155 +0,0 @@ - - - - - 560px - 142px - 139px - 20px - 30px - 86px - - 467px - 573px - 338px - 82px - - 746px - 2px - 411px - 474px - - 240px - - 338px - 260px - 82px - 27px - 23px - 27px - 25px - 60px - 54px - 28px - 22px - 22px - 24px - 17px - 8px - 23px - 58px - - 45px - 74px - 11px - 63px - 5px - 9px - 20px - 8px - 50px - 17px - 40px - 30px - 5px - 17px - - - 48px - 48px - -12px - -120px - 19.8px - 22px - 22px - 24px - 17px - 22px - 22px - 79.8px - 79.8px - 28.4px - 25px - - - 27.5px - 50px - 36px - 80.8px - 80.8px - 24px - - 14px - 32px - 164px - 98px - 198px - 30px - 34px - 98px - 46px - 26px - - - 30px - 18px - 210px - 148px - 148px - 120px - 46px - 30px - 30px - 25px - 30px - 30px - 32px - 98px - 98px - 36px - - -32.8125px - -16.4062px - -10.9375px - -6.5625px - -5.4688px - -4.3750px - -2.7344px - -1.0938px - -0.5469px - 0.0000px - 0.0547px - 0.2734px - 0.5469px - 0.8203px - 1.0938px - 1.3672px - 1.6406px - 1.9141px - 2.1875px - 2.4609px - 2.7344px - 3.2812px - 3.8281px - 4.1016px - 4.3750px - 4.9219px - 5.4688px - 6.0156px - 6.5625px - 7.1094px - 7.6562px - 8.2031px - 8.7500px - 9.2969px - 9.8438px - 10.3906px - 10.9375px - 11.4844px - 12.0312px - 12.5781px - 13.1250px - 13.6719px - 14.2188px - 14.7656px - 15.3125px - 15.8594px - 16.4062px - 16.9531px - 17.5000px - 18.0469px - 18.5938px - 19.1406px - 19.6875px - 20.2344px - 20.7812px - 21.3281px - 21.8750px - 22.4219px - 22.9688px - 23.5156px - 24.0625px - 24.6094px - 25.1562px - 25.7031px - 26.2500px - 26.7969px - 27.3438px - 27.8906px - 28.4375px - 28.9844px - 29.5312px - 30.0781px - 30.6250px - 31.1719px - 31.7188px - 32.2656px - 32.8125px - 33.3594px - 33.9062px - 34.4531px - 35.0000px - 35.5469px - 36.0938px - 36.6406px - 37.1875px - 37.7344px - 38.2812px - 38.8281px - 39.3750px - 39.9219px - 40.4688px - 41.0156px - 41.5625px - 42.1094px - 42.6562px - 43.2031px - 43.7500px - 44.2969px - 44.8438px - 45.3906px - 45.9375px - 46.4844px - 47.0312px - 47.5781px - 48.1250px - 48.6719px - 49.2188px - 49.7656px - 50.3125px - 50.8594px - 51.4062px - 51.9531px - 52.5000px - 53.0469px - 53.5938px - 54.1406px - 54.6875px - 55.2344px - 55.7812px - 56.3281px - 56.8750px - 57.1484px - 57.4219px - 57.9688px - 58.5156px - 59.0625px - 59.6094px - 60.1562px - 60.7031px - 61.2500px - 61.7969px - 62.3438px - 62.8906px - 63.4375px - 63.9844px - 64.5312px - 65.0781px - 65.6250px - 66.1719px - 66.7188px - 67.2656px - 67.8125px - 68.3594px - 68.9062px - 69.4531px - 70.0000px - 70.5469px - 71.0938px - 71.6406px - 72.1875px - 72.7344px - 73.2812px - 73.5547px - 73.8281px - 74.3750px - 74.9219px - 75.4688px - 76.0156px - 76.5625px - 77.1094px - 77.6562px - 78.2031px - 78.7500px - 79.2969px - 79.8438px - 80.3906px - 80.9375px - 81.4844px - 82.0312px - 82.5781px - 83.1250px - 83.6719px - 84.2188px - 84.7656px - 85.3125px - 85.8594px - 86.4062px - 86.9531px - 87.5000px - 88.0469px - 88.5938px - 89.1406px - 89.6875px - 90.2344px - 90.7812px - 91.3281px - 91.8750px - 92.4219px - 92.9688px - 93.5156px - 94.0625px - 94.6094px - 95.1562px - 95.7031px - 96.2500px - 96.7969px - 97.3438px - 97.8906px - 98.4375px - 98.9844px - 99.5312px - 100.0781px - 100.6250px - 101.1719px - 101.7188px - 102.2656px - 102.8125px - 103.3594px - 103.9062px - 104.4531px - 104.5898px - 105.0000px - 105.5469px - 106.0938px - 106.6406px - 107.1875px - 107.7344px - 108.2812px - 108.8281px - 109.3750px - 109.9219px - 110.4688px - 111.0156px - 111.5625px - 112.1094px - 112.6562px - 113.2031px - 113.7500px - 114.2969px - 114.8438px - 115.3906px - 115.9375px - 116.4844px - 117.0312px - 117.5781px - 118.1250px - 118.6719px - 119.2188px - 119.7656px - 120.3125px - 120.8594px - 121.4062px - 121.9531px - 122.5000px - 123.0469px - 123.5938px - 124.1406px - 124.6875px - 125.2344px - 125.7812px - 126.3281px - 126.8750px - 127.4219px - 127.9688px - 128.5156px - 129.0625px - 129.6094px - 130.1562px - 130.7031px - 131.2500px - 131.7969px - 132.3438px - 132.8906px - 133.4375px - 133.9844px - 134.5312px - 135.0781px - 135.6250px - 136.1719px - 136.7188px - 137.2656px - 137.8125px - 138.3594px - 138.9062px - 139.4531px - 140.0000px - 140.5469px - 141.0938px - 141.6406px - 142.1875px - 142.7344px - 143.2812px - 143.8281px - 144.3750px - 144.9219px - 145.4688px - 146.0156px - 146.5625px - 147.1094px - 147.6562px - 148.2031px - 148.7500px - 149.2969px - 149.8438px - 150.3906px - 150.9375px - 151.4844px - 152.0312px - 152.5781px - 153.1250px - 153.6719px - 154.2188px - 154.7656px - 155.3125px - 155.8594px - 156.4062px - 156.9531px - 157.5000px - 158.0469px - 158.5938px - 159.1406px - 159.6875px - 160.2344px - 160.7812px - 161.3281px - 161.8750px - 162.4219px - 162.9688px - 163.5156px - 164.0625px - 164.6094px - 165.1562px - 165.7031px - 166.2500px - 166.7969px - 167.3438px - 167.8906px - 168.4375px - 168.9844px - 169.5312px - 170.0781px - 170.6250px - 171.1719px - 171.7188px - 172.2656px - 172.8125px - 173.3594px - 173.9062px - 174.4531px - 175.0000px - 175.5469px - 176.0938px - 176.6406px - 177.1875px - 177.7344px - 178.2812px - 178.8281px - 179.3750px - 179.9219px - 180.4688px - 181.0156px - 181.5625px - 182.1094px - 182.6562px - 183.2031px - 183.7500px - 184.2969px - 184.8438px - 185.3906px - 185.9375px - 186.4844px - 187.0312px - 187.5781px - 188.1250px - 188.6719px - 189.2188px - 189.7656px - 190.3125px - 190.8594px - 191.4062px - 191.9531px - 192.5000px - 193.0469px - 193.5938px - 194.1406px - 194.6875px - 195.2344px - 195.7812px - 196.3281px - 200.1562px - 200.7031px - 201.2500px - 201.7969px - 202.3438px - 202.8906px - 203.4375px - 203.9844px - 204.5312px - 205.0781px - 205.6250px - 206.1719px - 206.7188px - 207.2656px - 207.8125px - 208.3594px - 208.9062px - 209.4531px - 210.0000px - 210.5469px - 211.0938px - 211.6406px - 212.1875px - 212.7344px - 213.2812px - 213.8281px - 214.3750px - 214.9219px - 215.4688px - 216.0156px - 216.5625px - 217.1094px - 217.6562px - 218.2031px - 218.7500px - 219.2969px - 219.8438px - 220.3906px - 220.9375px - 221.4844px - 222.0312px - 222.5781px - 223.1250px - 223.6719px - 224.2188px - 224.7656px - 225.3125px - 225.8594px - 226.4062px - 226.9531px - 227.5000px - 228.0469px - 228.5938px - 229.1406px - 229.6875px - 230.2344px - 230.7812px - 231.3281px - 231.8750px - 232.4219px - 232.9688px - 233.5156px - 234.0625px - 234.6094px - 235.1562px - 235.7031px - 236.2500px - 236.7969px - 237.3438px - 237.8906px - 238.4375px - 238.9844px - 239.5312px - 240.0781px - 240.6250px - 241.1719px - 241.7188px - 242.2656px - 242.8125px - 243.3594px - 243.9062px - 244.4531px - 245.0000px - 245.5469px - 246.0938px - 246.6406px - 247.1875px - 247.7344px - 248.2812px - 248.8281px - 249.3750px - 249.9219px - 250.4688px - 251.0156px - 251.5625px - 252.1094px - 252.6562px - 253.2031px - 253.7500px - 254.2969px - 254.8438px - 255.3906px - 255.9375px - 256.4844px - 257.0312px - 257.5781px - 258.1250px - 258.6719px - 259.2188px - 259.7656px - 260.3125px - 260.8594px - 261.4062px - 261.9531px - 262.5000px - 263.0469px - 263.5938px - 264.1406px - 264.6875px - 265.2344px - 265.7812px - 266.3281px - 266.8750px - 267.4219px - 267.9688px - 268.5156px - 269.0625px - 269.6094px - 270.1562px - 270.7031px - 271.2500px - 271.7969px - 272.3438px - 272.8906px - 273.4375px - 273.9844px - 274.5312px - 275.0781px - 275.6250px - 276.1719px - 276.7188px - 277.2656px - 277.8125px - 278.3594px - 278.9062px - 279.4531px - 280.0000px - 280.5469px - 281.0938px - 281.6406px - 282.1875px - 282.7344px - 283.2812px - 283.8281px - 284.3750px - 284.9219px - 285.4688px - 286.0156px - 286.5625px - 287.1094px - 287.6562px - 288.2031px - 288.7500px - 289.2969px - 289.8438px - 290.3906px - 290.9375px - 291.4844px - 292.0312px - 292.5781px - 293.1250px - 293.6719px - 294.2188px - 294.7656px - 295.3125px - 295.8594px - 296.4062px - 296.9531px - 297.5000px - 298.0469px - 298.5938px - 299.1406px - 299.6875px - 300.2344px - 300.7812px - 301.3281px - 301.8750px - 302.4219px - 302.9688px - 303.5156px - 304.0625px - 304.6094px - 305.1562px - 305.7031px - 306.2500px - 306.7969px - 307.3438px - 307.8906px - 308.4375px - 308.9844px - 309.5312px - 310.0781px - 310.6250px - 311.1719px - 311.7188px - 312.2656px - 312.8125px - 313.3594px - 313.9062px - 314.4531px - 315.0000px - 315.5469px - 316.0938px - 316.6406px - 317.1875px - 317.7344px - 318.2812px - 318.8281px - 319.3750px - 319.9219px - 320.4688px - 321.0156px - 321.5625px - 322.1094px - 322.6562px - 323.2031px - 323.7500px - 324.2969px - 324.8438px - 325.3906px - 325.9375px - 326.4844px - 327.0312px - 327.5781px - 328.1250px - 328.6719px - 329.2188px - 329.7656px - 330.3125px - 330.8594px - 331.4062px - 331.9531px - 332.5000px - 333.0469px - 333.5938px - 334.1406px - 334.6875px - 335.2344px - 335.7812px - 336.3281px - 336.8750px - 337.4219px - 337.9688px - 338.5156px - 339.0625px - 339.6094px - 340.1562px - 340.7031px - 341.2500px - 341.7969px - 342.3438px - 342.8906px - 343.4375px - 343.9844px - 344.5312px - 345.0781px - 345.6250px - 346.1719px - 346.7188px - 347.2656px - 347.8125px - 348.3594px - 348.9062px - 349.4531px - 350.0000px - 350.5469px - 351.0938px - 351.6406px - 352.1875px - 352.7344px - 353.2812px - 353.8281px - 354.3750px - 354.9219px - 355.4688px - 356.0156px - 356.5625px - 357.1094px - 357.6562px - 358.2031px - 358.7500px - 359.2969px - 359.8438px - 360.3906px - 360.9375px - 361.4844px - 362.0312px - 362.5781px - 363.1250px - 363.6719px - 364.2188px - 364.7656px - 365.3125px - 365.8594px - 366.4062px - 366.9531px - 367.5000px - 368.0469px - 368.5938px - 369.1406px - 369.6875px - 370.2344px - 370.7812px - 371.3281px - 371.8750px - 372.4219px - 372.9688px - 373.5156px - 374.0625px - 374.6094px - 375.1562px - 375.7031px - 376.2500px - 376.7969px - 377.3438px - 377.8906px - 378.4375px - 378.9844px - 379.5312px - 380.0781px - 380.6250px - 381.1719px - 381.7188px - 382.2656px - 382.8125px - 383.3594px - 383.9062px - 384.4531px - 385.0000px - 385.5469px - 386.0938px - 386.6406px - 387.1875px - 387.7344px - 388.2812px - 388.8281px - 389.3750px - 389.9219px - 390.4688px - 391.0156px - 391.5625px - 392.1094px - 392.6562px - 393.2031px - 393.7500px - 394.2969px - 394.8438px - 395.3906px - 395.9375px - 396.4844px - 397.0312px - 397.5781px - 398.1250px - 398.6719px - 399.2188px - 399.7656px - 400.3125px - 400.8594px - 401.4062px - 401.9531px - 402.5000px - 403.0469px - 403.5938px - 404.1406px - 404.6875px - 405.2344px - 405.7812px - 406.3281px - 406.8750px - 407.4219px - 407.9688px - 408.5156px - 409.0625px - 409.6094px - 410.1562px - 410.7031px - 411.2500px - 411.7969px - 412.3438px - 412.8906px - 413.4375px - 413.9844px - 414.5312px - 415.0781px - 415.6250px - 416.1719px - 416.7188px - 417.2656px - 417.8125px - 418.3594px - 418.9062px - 419.4531px - 420.0000px - 420.5469px - 421.0938px - 421.6406px - 422.1875px - 422.7344px - 423.2812px - 423.8281px - 424.3750px - 424.9219px - 425.4688px - 426.0156px - 426.5625px - 427.1094px - 427.6562px - 428.2031px - 428.7500px - 429.2969px - 429.8438px - 430.3906px - 430.9375px - 431.4844px - 432.0312px - 432.5781px - 433.1250px - 433.6719px - 434.2188px - 434.7656px - 435.3125px - 435.8594px - 436.4062px - 436.9531px - 437.5000px - 438.0469px - 438.5938px - 439.1406px - 439.6875px - 440.2344px - 440.7812px - 441.3281px - 441.8750px - 442.4219px - 442.9688px - 443.5156px - 444.0625px - 444.6094px - 445.1562px - 445.7031px - 446.2500px - 446.7969px - 447.3438px - 447.8906px - 448.4375px - 448.9844px - 449.5312px - 450.0781px - 450.6250px - 451.1719px - 451.7188px - 452.2656px - 452.8125px - 453.3594px - 453.9062px - 454.4531px - 455.0000px - 455.5469px - 456.0938px - 456.6406px - 457.1875px - 457.7344px - 458.2812px - 458.8281px - 459.3750px - 459.9219px - 460.4688px - 461.0156px - 461.5625px - 462.1094px - 462.6562px - 463.2031px - 463.7500px - 464.2969px - 464.8438px - 465.3906px - 465.9375px - 466.4844px - 467.0312px - 467.5781px - 468.1250px - 468.6719px - 469.2188px - 469.7656px - 470.3125px - 470.8594px - 471.4062px - 471.9531px - 472.5000px - 473.0469px - 473.5938px - 474.1406px - 474.6875px - 475.2344px - 475.7812px - 476.3281px - 476.8750px - 477.4219px - 477.9688px - 478.5156px - 479.0625px - 479.6094px - 480.1562px - 480.7031px - 481.2500px - 481.7969px - 482.3438px - 482.8906px - 483.4375px - 483.9844px - 484.5312px - 485.0781px - 485.6250px - 486.1719px - 486.7188px - 487.2656px - 487.8125px - 488.3594px - 488.9062px - 489.4531px - 490.0000px - 490.5469px - 491.0938px - 491.6406px - 492.1875px - 492.7344px - 493.2812px - 493.8281px - 494.3750px - 494.9219px - 495.4688px - 496.0156px - 496.5625px - 497.1094px - 497.6562px - 498.2031px - 498.7500px - 499.2969px - 499.8438px - 500.3906px - 500.9375px - 501.4844px - 502.0312px - 502.5781px - 503.1250px - 503.6719px - 504.2188px - 504.7656px - 505.3125px - 505.8594px - 506.4062px - 506.9531px - 507.5000px - 508.0469px - 508.5938px - 509.1406px - 509.6875px - 510.2344px - 510.7812px - 511.3281px - 511.8750px - 512.4219px - 512.9688px - 513.5156px - 514.0625px - 514.6094px - 515.1562px - 515.7031px - 516.2500px - 516.7969px - 517.3438px - 517.8906px - 518.4375px - 518.9844px - 519.5312px - 520.0781px - 520.6250px - 521.1719px - 521.7188px - 522.2656px - 522.8125px - 523.3594px - 523.9062px - 524.4531px - 525.0000px - 525.5469px - 526.0938px - 526.6406px - 527.1875px - 527.7344px - 528.2812px - 528.8281px - 529.3750px - 529.9219px - 530.4688px - 531.0156px - 531.5625px - 532.1094px - 532.6562px - 533.2031px - 533.7500px - 534.2969px - 534.8438px - 535.3906px - 535.9375px - 536.4844px - 537.0312px - 537.5781px - 538.1250px - 538.6719px - 539.2188px - 539.7656px - 540.3125px - 540.8594px - 541.4062px - 541.9531px - 542.5000px - 543.0469px - 543.5938px - 544.1406px - 544.6875px - 545.2344px - 545.7812px - 546.3281px - 710.9375px - - 3.2812px - 3.8281px - 4.3750px - 4.9219px - 5.4688px - 6.0156px - 6.5625px - 7.1094px - 7.6562px - 8.2031px - 8.7500px - 9.2969px - 9.8438px - 10.3906px - 10.9375px - 11.4844px - 12.0312px - 12.5781px - 13.1250px - 13.6719px - 15.3125px - 16.4062px - 17.5000px - 18.5938px - 19.6875px - 20.7812px - 21.8750px - 22.9688px - 26.2500px - diff --git a/modules/mogo-module-carchatting/src/main/res/values/strings.xml b/modules/mogo-module-carchatting/src/main/res/values/strings.xml deleted file mode 100644 index d85fb26674..0000000000 --- a/modules/mogo-module-carchatting/src/main/res/values/strings.xml +++ /dev/null @@ -1,33 +0,0 @@ - - CarChatting - 已取消 - 好的 - %1$sm - %1$skm - 用户信息缺失,请稍后再试 - 拨打电话失败,不能打点话给自己 - 已挂断 - 对方无应答 - 正在通话中,请稍后再试 - 当前匹配人数较少,请稍后重试 - 打电话 - 加入车队 - 匹配车友聊天 - 正在为您匹配车友... - 取消 - 等待接听 - 车队通话中... - 点击查看信息 - 退出车队 - 请检查网络状态 - 车友%1$s邀请你加入车队! - - 已邀请 - 对方已有车队 - 有车友邀请你加入车队,你可以对我说,加入或拒绝 - SN 不能为 null - 已加入车队,你可以直接跟队友通话 - 车队已解散 - 当前正在通话中 - 挂断失败 - diff --git a/modules/mogo-module-carchattingprovider/.gitignore b/modules/mogo-module-carchattingprovider/.gitignore deleted file mode 100644 index 796b96d1c4..0000000000 --- a/modules/mogo-module-carchattingprovider/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/modules/mogo-module-carchattingprovider/build.gradle b/modules/mogo-module-carchattingprovider/build.gradle deleted file mode 100644 index 4e113a5d65..0000000000 --- a/modules/mogo-module-carchattingprovider/build.gradle +++ /dev/null @@ -1,51 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-android-extensions' - id 'kotlin-kapt' - id 'com.alibaba.arouter' -} - -android { - compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion - defaultConfig { - minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion - versionCode Integer.valueOf(VERSION_CODE) - versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'consumer-rules.pro' - - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - sourceSets{ - main{ - java.srcDirs = ['src/main/java','src/main/aidl'] - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - compileOnly rootProject.ext.dependencies.kotlinstdlibjdk7 - - compileOnly rootProject.ext.dependencies.arouter - compileOnly rootProject.ext.dependencies.androidxappcompat -} -apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() - diff --git a/modules/mogo-module-carchattingprovider/consumer-rules.pro b/modules/mogo-module-carchattingprovider/consumer-rules.pro deleted file mode 100644 index 6d3930d2e4..0000000000 --- a/modules/mogo-module-carchattingprovider/consumer-rules.pro +++ /dev/null @@ -1 +0,0 @@ --keep class com.zhidao.carchattingprovider.*{*;} \ No newline at end of file diff --git a/modules/mogo-module-carchattingprovider/gradle.properties b/modules/mogo-module-carchattingprovider/gradle.properties deleted file mode 100644 index 55040c1e66..0000000000 --- a/modules/mogo-module-carchattingprovider/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=com.mogo.module.carchatim -POM_ARTIFACT_ID=module-carchatting-provider -VERSION_CODE=1 \ No newline at end of file diff --git a/modules/mogo-module-carchattingprovider/proguard-rules.pro b/modules/mogo-module-carchattingprovider/proguard-rules.pro deleted file mode 100644 index f1b424510d..0000000000 --- a/modules/mogo-module-carchattingprovider/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/modules/mogo-module-carchattingprovider/src/main/AndroidManifest.xml b/modules/mogo-module-carchattingprovider/src/main/AndroidManifest.xml deleted file mode 100644 index a560998df2..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/CallChattingProviderConstant.kt b/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/CallChattingProviderConstant.kt deleted file mode 100644 index 0acc918f74..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/CallChattingProviderConstant.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.zhidao.carchattingprovider - -class CallChattingProviderConstant { - - companion object{ - const val CCPROVIDER_NICK_NAME = "userName" - const val CCPROVIDER_USER_IMG = "userHead" - const val CCPROVIDER_USER_SEX = "gender" - const val CCPROVIDER_USER_AGE = "age" - const val CCPROVIDER_ADDRESS = "location" - const val CCPROVIDER_CAR_TYPE = "carTypeName" - const val CCPROVIDER_SN = "sn" - const val CCPROVIDER_LAT = "lat" - const val CCPROVIDER_LON = "lon" - const val CAR_CALL_PROVIDER = "/callchat/provider" - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallChatResponse.java b/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallChatResponse.java deleted file mode 100644 index 3317a38bf8..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallChatResponse.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.zhidao.carchattingprovider; - -import androidx.annotation.NonNull; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public interface ICallChatResponse extends ICallProviderResponse { - - @Override - default void answer() { - - } - - @Override - default void answerCallError(@NonNull String errorMsg) { - - } - - @Override - default void canCall(boolean canCall) { - - } - - @Override - default void callInvokeError(@NotNull String msg) { - - } - - @Override - default void isFriend(boolean friend) { - - } - - @Override - default void addFriend(boolean addFriend) { - - } - - @Override - default void invisibleUser(boolean visible) { - - } - - @Override - default void isOnLine(boolean onLine, @Nullable String errorMsg) { - - } - - @Override - default void userInfoCallBack(@Nullable String userInfo, @Nullable String errorMsg) { - - } - - @Override - default void hangUp(boolean hangUp, int type) { - - } - - @Override - default void refuse(boolean refuse, int type) { - - } - - @Override - default void mute(boolean mute) { - - } - - @Override - default void error(@NotNull String errInfo) { - - } - - @Override - default void call(@NotNull String data) { - - } - - @Override - default void match(@NotNull String data) { - - } - - @Override - default void matchInvokeResult(boolean invokeResult, @NotNull String msg) { - - } - - @Override - default void cancelMatch(boolean cancelStatus) { - - } - - @Override - default void invokeCallData(@NotNull String invokeData) { - - } - - @Override - default void joinVehicleTeamInvokeSuccess() { - - } - - @Override - default void joinVehicleTeamInvokeError(String msg) { - - } - - @Override - default void callWindowStatus(boolean status) { - - } - - @Override - default void hideUserWindowError(@NotNull String errorMsg) { - - } - - @Override - default void userWindowStatus(boolean status) { - - } - - @Override - default void inviteJoinVehicleTeam(boolean status) { - - } -} diff --git a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallProviderResponse.kt b/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallProviderResponse.kt deleted file mode 100644 index 14cfa583bc..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallProviderResponse.kt +++ /dev/null @@ -1,73 +0,0 @@ -package com.zhidao.carchattingprovider - - -interface ICallProviderResponse : ICallResponse { - - override fun answer() { - super.answer() - } - - override fun answerCallError(errorMsg: String) { - super.answerCallError(errorMsg) - } - - override fun hangUp(hangUp: Boolean, type: Int) { - super.hangUp(hangUp, type) - } - - override fun refuse(refuse: Boolean, type: Int) { - super.refuse(refuse, type) - } - - override fun canCall(canCall: Boolean) { - super.canCall(canCall) - } - - override fun callInvokeError(msg: String) { - super.callInvokeError(msg) - } - - override fun isFriend(friend: Boolean) { - super.isFriend(friend) - } - - override fun addFriend(addFriend: Boolean) { - super.addFriend(addFriend) - } - - override fun invisibleUser(visible: Boolean) { - super.invisibleUser(visible) - } - - override fun isOnLine(onLine: Boolean, errorMsg: String?) { - super.isOnLine(onLine, errorMsg) - } - - override fun userInfoCallBack(userInfo: String?, errorMsg: String?) { - super.userInfoCallBack(userInfo, errorMsg) - } - - override fun callWindowStatus(status: Boolean) { - super.callWindowStatus(status) - } - - override fun userWindowStatus(status: Boolean) { - super.userWindowStatus(status) - } - - override fun hideUserWindowError(errorMsg: String) { - super.hideUserWindowError(errorMsg) - } - - override fun inviteJoinVehicleTeam(status: Boolean) { - super.inviteJoinVehicleTeam(status) - } - - override fun joinVehicleTeamInvokeSuccess() { - super.joinVehicleTeamInvokeSuccess() - } - - override fun joinVehicleTeamInvokeError(msg:String) { - super.joinVehicleTeamInvokeError(msg) - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallResponse.kt b/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallResponse.kt deleted file mode 100644 index 263d195258..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICallResponse.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.zhidao.carchattingprovider - -interface ICallResponse { - - fun answer(){ - } - - fun answerCallError(errorMsg: String){ - } - - fun hangUp(hangUp: Boolean, type: Int) { - } - - fun refuse(refuse: Boolean, type: Int){ - } - - fun mute(mute: Boolean) { - } - - fun addFriend(addFriend: Boolean) { - } - - fun invisibleUser(visible: Boolean) { - } - - fun error(errInfo: String) { - } - - fun call(data: String) { - } - - fun callInvokeError(msg: String) { - } - - fun match(data: String) { - } - - fun matchInvokeResult(invokeResult: Boolean, msg: String) { - } - - fun cancelMatch(cancelStatus: Boolean) { - } - - fun invokeCallData(invokeData: String) { - } - - fun joinVehicleTeamInvokeSuccess(){ - } - - fun joinVehicleTeamInvokeError(msg:String){ - } - - fun canCall(canCall: Boolean) { - } - - fun isFriend(friend: Boolean) { - } - - fun isOnLine(onLine: Boolean, errorMsg: String? = null) { - } - - fun userInfoCallBack(userInfo: String? = null, errorMsg: String? = null) { - } - - fun callWindowStatus(status: Boolean) { - } - - fun userWindowStatus(status: Boolean) { - } - - fun hideUserWindowError(errorMsg: String) { - } - - fun inviteJoinVehicleTeam(status: Boolean) { - } -} \ No newline at end of file diff --git a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICarsChattingProvider.kt b/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICarsChattingProvider.kt deleted file mode 100644 index 81548240b9..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/ICarsChattingProvider.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.zhidao.carchattingprovider - -import android.content.Context -import androidx.fragment.app.FragmentActivity -import com.alibaba.android.arouter.facade.template.IProvider - -interface ICarsChattingProvider : IProvider { - - fun addFriend(flag: String, context: Context, friendSn: String, response: ICallProviderResponse) - - fun isFriend(flag: String, context: Context, friendSn: String, response: ICallProviderResponse) - - fun canCall(flag: String, context: Context, response: ICallProviderResponse) - - fun isOnLine(flag: String, context: Context, sn: String, response: ICallProviderResponse) - - fun getUserInfo(flag: String, context: Context, sn: String, response: ICallProviderResponse) - - fun call(params: Map) - - fun invisibleUser(flag: String, context: Context, response: ICallProviderResponse) - - fun registerCallWindowStatusListener( - flag: String, - context: Context, - response: ICallProviderResponse - ) - - fun unRegisterCallWindowStatusListener(flag: String, context: Context) - - fun showUserWindow(flag: String, mogoDriverInfo: MogoDriverInfo, context: Context) - - fun hideUserWindow(flag: String, context: Context, response: ICallProviderResponse? = null) - - fun registerUserWindowStatusListener( - flag: String, - context: Context, - response: ICallProviderResponse - ) - - fun unRegisterUserWindowStatusListener(flag: String, context: Context) - - fun initVehicleTeamContainer(flag: String, containerId: Int, activity: FragmentActivity) -} \ No newline at end of file diff --git a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/MogoDriverInfo.java b/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/MogoDriverInfo.java deleted file mode 100644 index f563680527..0000000000 --- a/modules/mogo-module-carchattingprovider/src/main/java/com/zhidao/carchattingprovider/MogoDriverInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.zhidao.carchattingprovider; - -public class MogoDriverInfo { - - private static final int GENDER_MALE = 0; - private static final int GENDER_FEMALE = 1; - - private String userName; - private String userHead; - private String gender; - private int age; - private String locationInfo; - private String carTypeName; - private String sn; - private double lat = 0.0f; - private double lon = 0.0f; - - public MogoDriverInfo() { - } - - public static int getGenderMale() { - return GENDER_MALE; - } - - public static int getGenderFemale() { - return GENDER_FEMALE; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserHead() { - return userHead; - } - - public void setUserHead(String userHead) { - this.userHead = userHead; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getLocationInfo() { - return locationInfo; - } - - public void setLocationInfo(String locationInfo) { - this.locationInfo = locationInfo; - } - - public String getCarTypeName() { - return carTypeName; - } - - public void setCarTypeName(String carTypeName) { - this.carTypeName = carTypeName; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - if(sn == null || sn.isEmpty()){ - return; - } - this.sn = sn; - } - - public double getLat() { - return lat; - } - - public void setLat(double lat) { - if (lat == 0.0) { - return; - } - this.lat = lat; - } - - public double getLon() { - return lon; - } - - public void setLon(double lon) { - if (lon == 0.0) { - return; - } - this.lon = lon; - } - - @Override - public String toString() { - return "MogoDriverInfo{" + - "userName='" + userName + '\'' + - ", userHead='" + userHead + '\'' + - ", gender='" + gender + '\'' + - ", age=" + age + - ", locationInfo='" + locationInfo + '\'' + - ", carTypeName='" + carTypeName + '\'' + - ", sn='" + sn + '\'' + - ", lat=" + lat + - ", lon=" + lon + - '}'; - } -} diff --git a/modules/mogo-module-chat/.gitignore b/modules/mogo-module-chat/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/modules/mogo-module-chat/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/modules/mogo-module-chat/build.gradle b/modules/mogo-module-chat/build.gradle deleted file mode 100644 index 4c229f7c72..0000000000 --- a/modules/mogo-module-chat/build.gradle +++ /dev/null @@ -1,99 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-android-extensions' - id 'kotlin-kapt' - id 'com.alibaba.arouter' -} - -android { - compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion - defaultConfig { - minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion - versionCode Integer.valueOf(VERSION_CODE) - versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'consumer-rules.pro' - //ARouter apt 参数 - kapt { - useBuildCache = false - arguments { - arg("AROUTER_MODULE_NAME", project.getName()) - } - } - - ndk { - abiFilters "armeabi-v7a", "arm64-v8a" - } - } - - sourceSets { - main { - jniLibs.srcDirs = ['libs'] - } - } - - buildTypes { - release { - minifyEnabled false - zipAlignEnabled false - consumerProguardFiles 'consumer-rules.pro' - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - debug { - minifyEnabled false - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - lintOptions { - abortOnError false - } - -} - -dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - compileOnly rootProject.ext.dependencies.kotlinstdlibjdk7 - compileOnly rootProject.ext.dependencies.coroutinescore - compileOnly rootProject.ext.dependencies.coroutinesandroid - compileOnly rootProject.ext.dependencies.androidxccorektx - implementation rootProject.ext.dependencies.arouter - kapt rootProject.ext.dependencies.aroutercompiler - - compileOnly rootProject.ext.dependencies.aspectj - - implementation rootProject.ext.dependencies.strategy - implementation rootProject.ext.dependencies.mogowebsocket - - if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { - compileOnly rootProject.ext.dependencies.mogomap - compileOnly rootProject.ext.dependencies.mogo_core_utils - compileOnly rootProject.ext.dependencies.mogoserviceapi - compileOnly rootProject.ext.dependencies.modulecommon - implementation rootProject.ext.dependencies.mogo_core_utils - implementation rootProject.ext.dependencies.mogo_core_data - - } else { - api project(":libraries:mogo-map") - api project(':core:mogo-core-utils') - api project(':services:mogo-service-api') - implementation project(':modules:mogo-module-common') - implementation project(':core:mogo-core-utils') - implementation project(':core:mogo-core-data') - } - -} - -apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/modules/mogo-module-chat/consumer-rules.pro b/modules/mogo-module-chat/consumer-rules.pro deleted file mode 100644 index 9399a921c5..0000000000 --- a/modules/mogo-module-chat/consumer-rules.pro +++ /dev/null @@ -1,23 +0,0 @@ --keep class com.mogo.chat.aspect.*{*;} --keep class com.mogo.chat.callcenter.*{*;} --keep class com.mogo.chat.common.gme.*{*;} --keep class com.mogo.chat.constant.*{*;} --keep class com.mogo.chat.exception.*{*;} --keep class com.mogo.chat.model.*{*;} --keep class com.mogo.chat.net.*{*;} --keep class com.mogo.chat.service.InvokeDataProxy{*;} --keep class com.mogo.eagle.core.function.chat.utils.IAudioFocus{*;} --keep class com.mogo.chat.util.sp.SharedPreferenceUtil{*;} --keep class com.mogo.chat.util.AnalyticsUtilKt{*;} --keep class com.mogo.chat.util.LogUtil{*;} --keep class com.mogo.chat.voice.*{*;} - -#公司SDK --keep class com.zhidao.auto.micstrategy.*{*;} --keep class com.zhidao.auto.nav.*{*;} - -#三方SDK --keep class de.hdodenhof.circleimageview.CircleImageView{*;} --keep class org.aspectj.*{*;} --keep class okhttp3.logging.*{*;} - diff --git a/modules/mogo-module-chat/gradle.properties b/modules/mogo-module-chat/gradle.properties deleted file mode 100644 index c6be04e1c4..0000000000 --- a/modules/mogo-module-chat/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=com.mogo.module.carchatim -POM_ARTIFACT_ID=module-chat -VERSION_CODE=1 \ No newline at end of file diff --git a/modules/mogo-module-chat/libs/arm64-v8a/libgmecodec.so b/modules/mogo-module-chat/libs/arm64-v8a/libgmecodec.so deleted file mode 100644 index 791ccb9925..0000000000 Binary files a/modules/mogo-module-chat/libs/arm64-v8a/libgmecodec.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/arm64-v8a/libgmesdk.so b/modules/mogo-module-chat/libs/arm64-v8a/libgmesdk.so deleted file mode 100644 index 5a712e9e71..0000000000 Binary files a/modules/mogo-module-chat/libs/arm64-v8a/libgmesdk.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/arm64-v8a/libsilk.so b/modules/mogo-module-chat/libs/arm64-v8a/libsilk.so deleted file mode 100644 index 52ad9cca11..0000000000 Binary files a/modules/mogo-module-chat/libs/arm64-v8a/libsilk.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/arm64-v8a/libtraeimp.so b/modules/mogo-module-chat/libs/arm64-v8a/libtraeimp.so deleted file mode 100644 index fbb98e9765..0000000000 Binary files a/modules/mogo-module-chat/libs/arm64-v8a/libtraeimp.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/armeabi-v7a/libgmecodec.so b/modules/mogo-module-chat/libs/armeabi-v7a/libgmecodec.so deleted file mode 100644 index ef0012b4fd..0000000000 Binary files a/modules/mogo-module-chat/libs/armeabi-v7a/libgmecodec.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/armeabi-v7a/libgmesdk.so b/modules/mogo-module-chat/libs/armeabi-v7a/libgmesdk.so deleted file mode 100644 index a5c81e6957..0000000000 Binary files a/modules/mogo-module-chat/libs/armeabi-v7a/libgmesdk.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/armeabi-v7a/libsilk.so b/modules/mogo-module-chat/libs/armeabi-v7a/libsilk.so deleted file mode 100644 index 44af9f8ea9..0000000000 Binary files a/modules/mogo-module-chat/libs/armeabi-v7a/libsilk.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/armeabi-v7a/libtraeimp.so b/modules/mogo-module-chat/libs/armeabi-v7a/libtraeimp.so deleted file mode 100644 index d4c222fa1b..0000000000 Binary files a/modules/mogo-module-chat/libs/armeabi-v7a/libtraeimp.so and /dev/null differ diff --git a/modules/mogo-module-chat/libs/gmesdk.jar b/modules/mogo-module-chat/libs/gmesdk.jar deleted file mode 100644 index 830ad4449b..0000000000 Binary files a/modules/mogo-module-chat/libs/gmesdk.jar and /dev/null differ diff --git a/modules/mogo-module-chat/libs/micropolicy.jar b/modules/mogo-module-chat/libs/micropolicy.jar deleted file mode 100644 index 755492dbb9..0000000000 Binary files a/modules/mogo-module-chat/libs/micropolicy.jar and /dev/null differ diff --git a/modules/mogo-module-chat/libs/mobilepb.jar b/modules/mogo-module-chat/libs/mobilepb.jar deleted file mode 100644 index 4658bc6a71..0000000000 Binary files a/modules/mogo-module-chat/libs/mobilepb.jar and /dev/null differ diff --git a/modules/mogo-module-chat/proguard-rules.pro b/modules/mogo-module-chat/proguard-rules.pro deleted file mode 100644 index 481bb43481..0000000000 --- a/modules/mogo-module-chat/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/AndroidManifest.xml b/modules/mogo-module-chat/src/main/AndroidManifest.xml deleted file mode 100644 index d0623afbbd..0000000000 --- a/modules/mogo-module-chat/src/main/AndroidManifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/BaseAspectj.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/BaseAspectj.kt deleted file mode 100644 index fae222d1a6..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/BaseAspectj.kt +++ /dev/null @@ -1,74 +0,0 @@ -package com.mogo.chat.aspect - -import android.os.Looper -import android.os.Trace -import android.util.Log -import com.mogo.commons.debug.DebugConfig -import org.aspectj.lang.ProceedingJoinPoint -import org.aspectj.lang.reflect.CodeSignature -import org.aspectj.lang.reflect.MethodSignature - -open class BaseAspectj { - - companion object { - @Volatile - private var enable: Boolean = DebugConfig.isDebug() - } - - fun enterMethod(joinPoint: ProceedingJoinPoint) { - if (!enable) return - - val signature = joinPoint.signature as CodeSignature - val cls = signature.declaringType - val methodName = signature.name - val parameterNames = signature.parameterNames - val parameterValues = joinPoint.args - - val builder = StringBuilder("\u21E2 ") - builder.append(methodName).append('(') - parameterValues.forEachIndexed { index, _ -> - if (index > 0) { - builder.append(",") - } - builder.append(parameterNames[index]).append('=') - builder.append(parameterValues[index]) - } - builder.append(')') - - if (Looper.myLooper() != Looper.getMainLooper()) { - builder.append("[Thread:\"").append(Thread.currentThread().name).append("\"]") - } - Log.i(asTag(cls), builder.toString()) - } - - fun exitMethod(joinPoint: ProceedingJoinPoint, result: Any?, lengthMill: Long) { - if (!enable) return - - val signature = joinPoint.signature - val cls = signature.declaringType - val methodName = signature.name - val hasReturnType = signature is MethodSignature - && signature.returnType != Void.TYPE - - val builder = StringBuilder("\u21E0 ") - .append(methodName) - .append("[") - .append(lengthMill) - .append("ms]") - - if (hasReturnType) { - builder.append(" = ") - builder.append(result.let { - result.toString() - }) - } - Log.i(asTag(cls), builder.toString()) - } - - private fun asTag(cls: Class<*>): String { - if (cls.isAnonymousClass) { - return asTag(cls.enclosingClass!!) - } - return cls.simpleName - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/DebugLog.java b/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/DebugLog.java deleted file mode 100644 index 15af40c7cf..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/DebugLog.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.chat.aspect; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.CONSTRUCTOR; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Target({TYPE, METHOD, CONSTRUCTOR}) -@Retention(RUNTIME) -public @interface DebugLog { -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/LogAspectj.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/LogAspectj.kt deleted file mode 100644 index f1d79e5ac5..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/aspect/LogAspectj.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.mogo.chat.aspect - -import org.aspectj.lang.ProceedingJoinPoint -import org.aspectj.lang.annotation.Around -import org.aspectj.lang.annotation.Aspect -import org.aspectj.lang.annotation.Pointcut -import java.util.concurrent.TimeUnit - -@Aspect -class LogAspectj : BaseAspectj() { - - - @Pointcut("within(@com.mogo.chat.aspect.DebugLog *)") - fun withinAnnotatedClass() { - } - - @Pointcut("execution(!synthetic * *(..))&& withinAnnotatedClass()") - fun methodInsideAnnotatedType() { - } - - @Pointcut("execution(!synthetic *.new(..))&& withinAnnotatedClass()") - fun constructorInsideAnnotatedType() { - } - - @Pointcut("execution(@com.mogo.chat.aspect.DebugLog * *(..))|| methodInsideAnnotatedType()") - fun method() { - } - - @Pointcut("execution(@com.mogo.chat.aspect.DebugLog *.new(..))|| constructorInsideAnnotatedType()") - fun constructor() { - } - - @Around("method() || constructor()") - fun logExecute(joinPoint: ProceedingJoinPoint) { - - enterMethod(joinPoint) - - val startNanos = System.nanoTime() - val result = joinPoint.proceed() - val stopNanos = System.nanoTime() - val lengthMill = TimeUnit.NANOSECONDS.toMillis(stopNanos - startNanos) - - exitMethod(joinPoint, result, lengthMill) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt deleted file mode 100644 index 57d1313363..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt +++ /dev/null @@ -1,54 +0,0 @@ -package com.mogo.chat.base - -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.ChatServiceModel -import com.mogo.chat.model.bean.AllUnit -import com.mogo.chat.model.bean.LocationCarsWithRadius -import com.mogo.chat.model.bean.toSns -import com.mogo.chat.util.UserInfoHelper -import com.mogo.chat.util.log -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.network.request - -open class BaseController { - - val chatServiceModel: ChatServiceModel = ChatServiceModel() - - fun getUserInfo(onSuccess: (() -> Unit)? = null, onError: ((Exception) -> Unit)? = null) { - if (UserInfoHelper.userInfo.sn.isNotBlank()) { - log(TAG, "userInfo getSn : ${UserInfoHelper.userInfo}") - onSuccess?.invoke() - return - } - log(TAG, "requestUserInfo") - requestUserInfo(onSuccess, onError) - } - - private fun requestUserInfo(onSuccess: (() -> Unit)? = null, onError: ((Exception) -> Unit)? = null) { - request> { - loader { - val list = mutableListOf() - list.add(0.0) - list.add(0.0) - val locCarsWithRadius = - LocationCarsWithRadius(list, 0, "circle") - chatServiceModel.requestLiveCars(locCarsWithRadius) - } - onSuccess { - handleUserData(it.result) - onSuccess?.invoke() - } - onError { e -> - log(TAG, "onError : ${e.message ?: "$TAG -> error"}") - onError?.invoke(e) - } - } - } - - private fun handleUserData(allUnit: AllUnit) { - log(TAG, "handleUserData:allUnit $allUnit") - val sns = allUnit.toSns() - log(TAG, "handleUserData:sns $sns") - UserInfoHelper.userInfo = sns - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt deleted file mode 100644 index fcd41ef1db..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt +++ /dev/null @@ -1,160 +0,0 @@ -package com.mogo.chat.base - -import com.alibaba.android.arouter.launcher.ARouter -import com.google.gson.Gson -import com.mogo.chat.constant.CALL_TYPE_VOICE -import com.mogo.chat.constant.HttpConstants -import com.mogo.chat.constant.PUSH_MSG_AGREE_ENTER -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.* -import com.mogo.chat.net.HttpApi -import com.mogo.chat.provider.ServiceApi -import com.mogo.chat.util.UserInfoHelper.userInfo -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.getRoomId -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.IMogoServiceApis - - -open class BaseRepository { - - protected fun getNetWorkApi(baseUrl: String = HttpConstants.getBaseUrl()): HttpApi { - var serviceApi: IMogoServiceApis? = null - val mogoService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() - if (mogoService is IMogoServiceApis) { - serviceApi = mogoService - } - return serviceApi!!.networkApi.createNoCallAdapter(HttpApi::class.java, baseUrl) - } - - suspend fun requestLiveCars(locCarsWithRadius: LocationCarsWithRadius): BaseResponse { - val map = hashMapOf() - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn - map["data"] = Gson().toJson(locCarsWithRadius) - return apiCall { - getNetWorkApi().requestLiveCars(map) - } - } - - suspend fun requestConnectStatus(requestType: Int, snReceiver: String = "", roomID: Int, status: Int, callType: Int): BaseResponse { - val map = hashMapOf() - val sn = MoGoAiCloudClientConfig.getInstance().sn - var r = roomID - if (r == 0) { - r = getRoomId() - } - val location = ServiceApi.locationClient()?.lastKnowLocation - val connectStatusParam = ConnectStatusParam(sn, snReceiver, r, status, callType) - if (status == PUSH_MSG_AGREE_ENTER) { - log(TAG, "被动匹配 agree enter===$userInfo") - connectStatusParam.nickName = userInfo.nickName - connectStatusParam.headImgUrl = userInfo.headImgUrl - connectStatusParam.carInfo = userInfo.carInfo - connectStatusParam.cardIdAge = userInfo.cardIdAge - connectStatusParam.cardIdSex = userInfo.cardIdSex - connectStatusParam.cityName = userInfo.cityName - connectStatusParam.lat = location?.latitude - connectStatusParam.lon = location?.longitude - } - log(TAG, "connectStatusParam:$connectStatusParam") - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn - map["data"] = Gson().toJson(connectStatusParam) - return if (requestType == CALL_TYPE_VOICE) { - apiCall { - getNetWorkApi().requestConnectStatus(sn, map) - } - } else { - apiCall { - getNetWorkApi().requestVehicleTeamConnectStatus(map) - } - } - } - - suspend fun startMatch(param: MatchRequestParam): BaseResponse { - val map = hashMapOf() - log(TAG, "startMatch paras: $param") - map["data"] = Gson().toJson(param) - return apiCall { - getNetWorkApi().startMatch(MoGoAiCloudClientConfig.getInstance().sn, map) - } - } - - suspend fun cancelMatch(): BaseResponse { - val map = hashMapOf() - return apiCall { - getNetWorkApi().cancelMatch(MoGoAiCloudClientConfig.getInstance().sn, map) - } - } - - suspend fun inviteJoinVehicleTeam(param: CallRequestParam): BaseResponse { - val map = hashMapOf() - log(TAG, "inviteJoinVehicleTeam paras: $param") - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn - map["data"] = Gson().toJson(param) - return apiCall { - getNetWorkApi().inviteJoinVehicleTeam(map) - } - } - - suspend fun requestRoomInfo(snReceiver: String, callType: Int): BaseResponse { - val map = hashMapOf() - val location = ServiceApi.locationClient()?.lastKnowLocation - log(TAG, "requestRoomInfo===$userInfo") - val roomParam = CallRequestParam( - MoGoAiCloudClientConfig.getInstance().sn, - snReceiver, - userInfo.nickName!!, - userInfo.headImgUrl!!, - userInfo.carInfo ?: "", - location?.latitude, - location?.longitude, - callType - ) - log(TAG, "roomParam:$roomParam") - map["data"] = Gson().toJson(roomParam) - return apiCall { - getNetWorkApi().requestRoomInfo(map) - } - } - - /** - * 添加关注(后面可能增加取消关注,到时候再增加参数吧) - */ - suspend fun dealFocus(sn: String): BaseResponse { - val map = hashMapOf() - map["data"] = "{\"focusSn\":$sn}" - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn - return apiCall { - getNetWorkApi().dealFocus(map) - } - } - - /** - * 获取关注状态 - * - * 1 表示已关注,0 表示未关注 - */ - suspend fun requestFocusStatus(sn: String): BaseResponse { - val map = hashMapOf() - map["data"] = "{\"focusSn\":$sn}" - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn - return apiCall { - getNetWorkApi().requestFocusStatus(map) - } - } - - suspend fun switchCarStatus(status: Int): BaseResponse { - val map = hashMapOf() - map["data"] = Gson().toJson(CarSwitchStatus(MoGoAiCloudClientConfig.getInstance().sn, status)) - return apiCall { - getNetWorkApi().switchCarStatus(map) - } - } - - suspend fun apiCall(call: suspend () -> BaseResponse): BaseResponse { - return call.invoke() - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallController.kt deleted file mode 100644 index 4b628e6682..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallController.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log - -class CallController private constructor(){ - - companion object{ - val callController by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){ - log(TAG,"getCallController") - getCallControllerProxy() - } - - private fun getCallControllerProxy(): ICallControl { - return CallControllerHandler().newProxyInstance() - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallControllerHandler.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallControllerHandler.kt deleted file mode 100644 index cbbd89c3ef..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallControllerHandler.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log -import java.lang.reflect.InvocationHandler -import java.lang.reflect.Method -import java.lang.reflect.Proxy - -class CallControllerHandler : InvocationHandler { - - private var obj: Any? = null - private val interceptor = CallInterceptor() - - constructor() - - constructor(target: ICallControl) { - this.obj = target - } - - fun newProxyInstance(): ICallControl { - log(TAG, "newProxyInstance") - return Proxy.newProxyInstance( - CallProxy::class.java.classLoader, - arrayOf(ICallControl::class.java), - CallControllerHandler(CallProxy()) - ) as ICallControl - } - - override fun invoke(proxy: Any?, method: Method, args: Array?): Any? { - log(TAG, "invoke method===${method.name}") - val intercept = interceptor.process(method) - log(TAG, "invoke method==$method,intercept=$intercept") - return if (intercept) { - method.invoke(obj, *args.orEmpty()) - } else { - if (proxy is ICallControl) { - //执行挂断或其他操作 - interceptor.handler(proxy, method, args) - } else { - return null - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallInterceptor.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallInterceptor.kt deleted file mode 100644 index d6d0d28c19..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallInterceptor.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.ConvertFactory.Companion.factory -import com.mogo.chat.common.gme.GMEApi -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.Message -import com.mogo.chat.util.log -import java.lang.reflect.Method - -class CallInterceptor { - - /** - * 对实现[ICallControl]的接口对象在调用时进行拦截 - */ - fun process(method: Method): Boolean { - var process = true - getIMType(method) { - process = when (it) { - IMType.INIT_CALL -> true - //主动拨打电话,请求roomId成功 更改通话状态 - IMType.READY_TO_CALL_SENDER, - //用户来电 - IMType.READY_TO_CALL_RECEIVER, - //被动匹配用户来电 - IMType.READY_TO_MATCH_RECEIVER -> callTypeManager.callStatus.isInit() || !GMEApi.isRoomEntered() - IMType.CALLING_SENDER, IMType.CALLING_RECEIVER -> callTypeManager.callStatus.isInit() || callTypeManager.callStatus.canStartCalling() || callTypeManager.callStatus.isCalling() - IMType.CALLING_MATCH -> callTypeManager.callStatus.canMatched() - IMType.CALLING_REFUSE -> true //任何时候都可以接收 车队邀请拒绝消息 - IMType.NULL -> true - else -> { - log(TAG, "CallInterceptor IMType : $it has been interceptor, check func") - true - } - } - } - return process - } - - /** - * 对拦截的方法进行处理 - */ - fun handler(proxy: ICallControl, method: Method, args: Array?) { - getIMType(method) { - log(TAG, "CallInterceptor IMType : $it has been handler") - if (it.isReadyCalling() || it.isMatching()) { - // 当前状态是准备打电话,并且即将转变的状态为将要接电话,需要根据类型拒绝 - args?.get(0)?.let { data -> - if (data is Message) { - proxy.refuseCall(data) - } - } - } - } - } - - private inline fun getIMType(method: Method, convert: (IMType) -> Unit) { - val imType = factory.parseAnnotationToIMType(method) - log(TAG, "CallInterceptor thread ${Thread.currentThread().name}") - log(TAG, "CallInterceptor coming IMType===$imType, current IMType=${callTypeManager.callStatus}") - convert.invoke(imType) - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallProxy.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallProxy.kt deleted file mode 100644 index 971a8d315e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallProxy.kt +++ /dev/null @@ -1,149 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.aspect.DebugLog -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.ConvertFactory.Companion.factory -import com.mogo.chat.constant.CALL_TYPE_VOICE -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.AddFriendMessage -import com.mogo.chat.model.bean.Message -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.hasFocus -import com.mogo.chat.util.sp.newFocus - -/** - * 主要处理消息下发,以及消息状态改变 - */ -class CallProxy : ICallControl { - - private var isInitiativeMatch: Boolean = false - private var callBacks = mutableMapOf() - private var messageCallBack: MessageCallBack = MessageCallBackImpl() - private var message: Message? = null - - @DebugLog - override fun addCallBack(clzName: String, callBack: ICallMessage) { - log(TAG,"addCallBack clzName : $clzName") - callBacks[clzName] = callBack - } - - override fun removeCallBack(clzName: String) { - callBacks.remove(clzName) - } - - override fun getMsgCallBack(): MutableMap { - return callBacks - } - - override fun refreshMessage(message: Message) { - factory.parseMessageToCallProxy(message) - } - - override fun newFocusAdd() { - if (!hasFocus()) { //没有新的关注,需要添加 - newFocus(true) - } - dispatchNotice() - } - - private fun dispatchNotice() { - - } - - override fun initCall() { - callTypeManager.callStatus = IMType.INIT_CALL - isInitiativeMatch = false - dispatchMsg(null, MSG_INIT_CALL) - } - - override fun readyToCallSender() { - callTypeManager.callStatus = IMType.READY_TO_CALL_SENDER - } - - override fun refuseCall(message: Message) { - dispatchMsg(message, MSG_REFUSE_CALL) - } - - override fun readyToCallReceiver(message: Message) { - log(TAG, "readyToCallReceiver") - if (message.type == CALL_TYPE_VOICE) { - callTypeManager.callStatus = IMType.READY_TO_CALL_RECEIVER - } - dispatchMsg(message, MSG_READY_TO_CALL_RECEIVER) - } - - override fun callingSender(message: Message) { - callTypeManager.callStatus = IMType.CALLING_SENDER - dispatchMsg(message, MSG_CALL_SENDER) - } - - override fun callingSenderWithoutMessage() { - callTypeManager.callStatus = IMType.CALLING_SENDER - dispatchMsg(null, MSG_CALL_SENDER_WITHOUT_MSG) - } - - override fun callingReceiver() { - if (callTypeManager.callStatus == IMType.READY_TO_MATCH_RECEIVER) { - callTypeManager.callStatus = IMType.CALLING_MATCH - } else { - callTypeManager.callStatus = IMType.CALLING_RECEIVER - } - dispatchMsg(message, MSG_CALL_RECEIVER) - } - - private fun dispatchMsg(message: Message?, @DispatchMsg dispatchMethod: String) { - log(TAG, "dispatchMsg===${callBacks.size}") - this.message = message - dispatch(messageCallBack, message, dispatchMethod) - } - - @DebugLog - private fun dispatch( - callBack: MessageCallBack, - message: Message?, @DispatchMsg dispatchMethod: String - ) { - when (dispatchMethod) { - MSG_INIT_CALL -> callBack.initCall() - MSG_CALL_RECEIVER -> callBack.msgCallingReceiver(message!!) - MSG_CALL_MATCH -> callBack.msgCallMatch(message!!) - MSG_READY_TO_CALL_RECEIVER -> callBack.msgReadyToCallReceiver(message!!) - MSG_CALL_SENDER -> callBack.msgCallingSender(message!!) - MSG_REFUSE_CALL -> callBack.msgRefuseCall(message!!) - MSG_CALL_SENDER_WITHOUT_MSG -> callBack.msgCallingSenderWithoutMessage() - MSG_CALL_READY_TO_MATCH_RECEIVER -> callBack.msgReadyToCallReceiver(message!!) - MSG_EXIT_ROOM -> callBack.updateExitRoomStatus(message) - MSG_CALL_RECEIVER_REFUSE -> callBack.callingReceiverRefuse(message!!) - } - } - - override fun matching() { - callTypeManager.callStatus = IMType.MATCHING - } - - override fun callingMatch(message: Message) { - callTypeManager.callStatus = IMType.CALLING_MATCH - isInitiativeMatch = true - dispatchMsg(message, MSG_CALL_MATCH) - } - - override fun readyToMatchReceiver(message: Message) { - callTypeManager.callStatus = IMType.READY_TO_MATCH_RECEIVER - dispatchMsg(message, MSG_CALL_READY_TO_MATCH_RECEIVER) - } - - override fun matchFailed() { - callTypeManager.callStatus = IMType.MATCHING_FAILED - } - - override fun updateExitRoomStatus(message: Message?) { - dispatchMsg(message, MSG_EXIT_ROOM) - } - - override fun callingReceiverRefuse(message: Message) { - dispatchMsg(message, MSG_CALL_RECEIVER_REFUSE) - } - - override fun addFriend(addFriendMsg: AddFriendMessage) { - - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallStatus.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallStatus.kt deleted file mode 100644 index 2916eecae3..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallStatus.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.chat.callcenter - -import java.lang.annotation.Retention - -import java.lang.annotation.RetentionPolicy.RUNTIME - -@Target( - AnnotationTarget.CLASS, - AnnotationTarget.FUNCTION, - AnnotationTarget.PROPERTY_GETTER, - AnnotationTarget.PROPERTY_SETTER, - AnnotationTarget.CONSTRUCTOR -) -@Retention(RUNTIME) -annotation class CallStatus(val status: IMType) diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallTypeManager.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallTypeManager.kt deleted file mode 100644 index 52343c94f7..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/CallTypeManager.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log - -/** - * 管理IMType,或者叫callType,即管理各种状态值 - */ -class CallTypeManager private constructor() { - - companion object { - val callTypeManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - CallTypeManager() - } - } - - private val typeChangeListenerList: ArrayList = ArrayList() - - var callStatus: IMType = IMType.INIT_CALL - set(value) { - log(TAG,"setCallType===$value") - field = value - typeChangedListener?.invoke(value) - typeChangeListenerList.forEach { - it.onCallTypeChanged(value) - } - } - - private var typeChangedListener:((type: IMType)->Unit)? = null - - fun setCallTypeChangedListener(listener: (type: IMType) -> Unit) { - this.typeChangedListener = listener - } - - fun addCallTypeChangedListener(listener: ICallTypeChangedListener) { - log(TAG,"添加状态改变回调===$listener") - if(!typeChangeListenerList.contains(listener)) { - typeChangeListenerList.add(listener) - } - } - - fun removeCallTypeChangedListener(listener: ICallTypeChangedListener) { - typeChangeListenerList.remove(listener) - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ConvertFactory.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ConvertFactory.kt deleted file mode 100644 index acd8dfe93b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ConvertFactory.kt +++ /dev/null @@ -1,172 +0,0 @@ -package com.mogo.chat.callcenter - -import com.google.gson.Gson -import com.mogo.chat.callcenter.CallController.Companion.callController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.common.gme.GMEApi -import com.mogo.chat.constant.* -import com.mogo.chat.model.bean.AddFriendMessage -import com.mogo.chat.model.bean.Message -import com.mogo.chat.model.control.ChatController -import com.mogo.chat.service.ChatServiceHandler -import com.mogo.chat.util.UserInfoHelper.currentCallType -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.getRoomId -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import java.lang.reflect.Method - -/** - * 解析WebSocket返回的数据 - */ -class ConvertFactory private constructor() { - - companion object { - val factory by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { - ConvertFactory() - } - } - - fun parseAnnotationToIMType(method: Method): IMType { - if (method.isAnnotationPresent(CallStatus::class.java)) { - val callStatus = method.getAnnotation(CallStatus::class.java) - return callStatus.status - } - return IMType.NULL - } - - fun parseLongConnMsgOnError(ex: Exception) { - log(TAG, "${ex.message}") - } - - fun parseLongConnMsgToCallProxy(message: String) { - log(TAG, "handleMessage -> $message") - val map = Gson().fromJson>(message, Map::class.java) - val msgType = map["msgType"] - if (msgType != null && msgType is Double) { - when (msgType.toInt()) { - 0 -> { // 建立连接,发送的消息 - val localUserId = map["localUserId"] as Double - log(TAG, "handleMessage --- localUserId:${localUserId.toInt()}") - //初始化房间 - GMEApi.init("" + localUserId.toInt()) - } - 2 -> { // 添加好友提示 - log(TAG, "添加好友提示====") - // parseMapToCallProxy(map) - } - 3 -> { //新增粉丝提示 - log(TAG, "新增粉丝提示====") - callController.newFocusAdd() - } - } - } else { - val messageObj = Gson().fromJson(message, Message::class.java) - parseMessageToCallProxy(messageObj) - } - } - - @Deprecated("临时注释掉,os2.0暂时不提示添加好友了 ") - private fun parseMapToCallProxy(map: Map) { - log(TAG, "准备刷新好友提示==") - val addFriendMsg = AddFriendMessage( - sn = map["sn"] as String, - nickName = map["nickName"] as String, - headImgUrl = map["headImgUrl"] as String, - message = map["message"] as String, - alertType = (map["alertType"] as Double).toInt() - ) - callController.addFriend(addFriendMsg) - } - - /** - * 解析服务端发来的Message消息,并对具体类型做消息下发 - */ - fun parseMessageToCallProxy(message: Message) { - //message type如果是语音电话或者是匹配聊天时,接收到服务端发来的数据都是snReceiver,如果为本机设备,则过滤 - if (message.type == CALL_TYPE_VOICE || message.type == CALL_TYPE_MATCHING) { - if (message.snSender == MoGoAiCloudClientConfig.getInstance().sn) { - return - } - } - log(TAG, "parseMessageToCallProxy====$message") - when (message.status) { - PUSH_MSG_AGREE_ENTER -> { - if (!GMEApi.isRoomEntered()) { - SocketClientFactory.socketClient.startHeartBeat() - } - when (message.type) { - CALL_TYPE_VOICE -> { - if (GMEApi.isRoomEntered() && currentCallType == CALL_TYPE_VEHICLE_TEAM) { - log(TAG, "收到来电进房消息,此时正在车队通话。需要挂断电话") - ChatController.requestConnectStatus(message.snSender, PUSH_MSG_HANG_UP, {}, {}, message.roomId) - return - } - if (callTypeManager.callStatus.isMatching()) { - log(TAG, "收到语音通话消息,此时正在匹配,需要取消匹配") - ChatServiceHandler.cancelMatch { } - } - callController.callingSender(message) - } - CALL_TYPE_MATCHING -> { - if (GMEApi.isRoomEntered() && currentCallType == CALL_TYPE_VEHICLE_TEAM) { - log(TAG, "收到匹配成功消息,此时正在车队通话,需要挂断电话") - ChatController.requestConnectStatus(message.snSender, PUSH_MSG_HANG_UP, {}, {}, message.roomId) - return - } - callController.callingMatch(message) - } - CALL_TYPE_VEHICLE_TEAM -> { - if (callTypeManager.callStatus.isReadyCalling()) { - log(TAG, "收到车队通话消息,此时正在打电话,需要拒绝通话") - ChatServiceHandler.refuseCall(message.snSender, {}, {}) - } - if (callTypeManager.callStatus.isMatching()) { - log(TAG, "收到车队通话消息,此时正在匹配,需要取消匹配") - ChatServiceHandler.cancelMatch { } - } - callController.callingSender(message) - } - } - } - PUSH_MSG_DENY_ENTER -> { - when (message.type) { - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> { - if (GMEApi.isRoomEntered() && currentCallType == CALL_TYPE_VEHICLE_TEAM) { - log(TAG, "已经进房,收到被拒绝消息,则不处理(为兼容车队需求),否则会引发退房操作") - return - } - //此处 callingReceiverRefuse 未做整合,放到此类型最上面执行,因为后续可能在回调页面上有不同的执行操作 - callController.callingReceiverRefuse(message) - SocketClientFactory.socketClient.stopHeartBeat() - callController.updateExitRoomStatus() - } - CALL_TYPE_VEHICLE_TEAM -> { - callController.callingReceiverRefuse(message) - } - } - } - PUSH_MSG_HANG_UP -> { - callController.updateExitRoomStatus(message) - } - PUSH_MSG_CANCEL_MATCH -> { - if(callTypeManager.callStatus.isMatching()){ - callController.initCall() - } - } - PUSH_MSG_CREATE_ROOM -> { - when (message.type) { - CALL_TYPE_VOICE -> { - if (callTypeManager.callStatus.isReadyCalling() || callTypeManager.callStatus.isCalling()) { - log(TAG, "收到来电,此时正在打电话或者通话中,需要拒绝通话") - ChatController.requestConnectStatus(message.snSender, PUSH_MSG_DENY_ENTER, {}, {}, getRoomId()) - } - callController.readyToCallReceiver(message) - } - CALL_TYPE_VEHICLE_TEAM -> callController.readyToCallReceiver(message) - CALL_TYPE_MATCHING -> callController.readyToMatchReceiver(message) - } - } - } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/DispatchMsg.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/DispatchMsg.kt deleted file mode 100644 index f04cbd9fc6..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/DispatchMsg.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.chat.callcenter - -import androidx.annotation.StringDef -import java.lang.annotation.Retention -import java.lang.annotation.RetentionPolicy.SOURCE - -const val MSG_INIT_CALL = "initCall" -const val MSG_CALL_RECEIVER = "callingReceiver" -const val MSG_CALL_SENDER = "callingSender" -const val MSG_CALL_SENDER_WITHOUT_MSG = "callingSenderWithoutMessage" -const val MSG_CALL_MATCH = "callingMatch" -const val MSG_CALL_READY_TO_MATCH_RECEIVER = "readyToMatchReceiver" -const val MSG_READY_TO_CALL_RECEIVER = "readyToCallReceiver" -const val MSG_REFUSE_CALL = "refuseCall" -const val MSG_EXIT_ROOM = "exitRoom" -const val MSG_CALL_RECEIVER_REFUSE = "callingReceiverRefuse" - -@StringDef(MSG_INIT_CALL, MSG_CALL_RECEIVER, MSG_CALL_SENDER, MSG_CALL_SENDER_WITHOUT_MSG, - MSG_CALL_MATCH, MSG_CALL_READY_TO_MATCH_RECEIVER, MSG_READY_TO_CALL_RECEIVER, MSG_REFUSE_CALL, MSG_EXIT_ROOM,MSG_CALL_RECEIVER_REFUSE) -@Retention(SOURCE) -annotation class DispatchMsg \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallControl.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallControl.kt deleted file mode 100644 index 93005fc45f..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallControl.kt +++ /dev/null @@ -1,60 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.model.bean.AddFriendMessage -import com.mogo.chat.model.bean.Message - - -interface ICallControl { - - fun addCallBack(clzName: String, callBack: ICallMessage) - - fun removeCallBack(clzName: String) - - fun getMsgCallBack(): MutableMap - - fun refreshMessage(message: Message) - - fun refuseCall(message: Message) - - fun newFocusAdd() - - @CallStatus(status = IMType.INIT_CALL) - fun initCall() - - @CallStatus(status = IMType.READY_TO_CALL_SENDER) - fun readyToCallSender() - - @CallStatus(status = IMType.READY_TO_CALL_RECEIVER) - fun readyToCallReceiver(message: Message) - - @CallStatus(status = IMType.CALLING_SENDER) - fun callingSender(message: Message) - - @CallStatus(status = IMType.CALLING_SENDER) - fun callingSenderWithoutMessage() - - @CallStatus(status = IMType.CALLING_RECEIVER) - fun callingReceiver() - - @CallStatus(status = IMType.MATCHING) - fun matching() - - @CallStatus(status = IMType.CALLING_MATCH) - fun callingMatch(message: Message) - - @CallStatus(status = IMType.READY_TO_MATCH_RECEIVER) - fun readyToMatchReceiver(message: Message) - - @CallStatus(status = IMType.MATCHING_FAILED) - fun matchFailed() - - @CallStatus(status = IMType.INIT_CALL) - fun updateExitRoomStatus(message: Message? = null) - - @CallStatus(status = IMType.CALLING_REFUSE) - fun callingReceiverRefuse(message: Message) - - @CallStatus(status = IMType.CALLING_ADD_FRIEND) - fun addFriend(addFriendMsg: AddFriendMessage) - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallMessage.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallMessage.kt deleted file mode 100644 index f23d4f6f9a..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallMessage.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.model.bean.Message -import com.mogo.chat.model.bean.TeammateInfo - -/** - * 对WebSocket消息进行下发处理 - */ -interface ICallMessage { - - fun initStatus() { - } - - fun addNewFocus() { - } - - fun receiverCalling(message: Message) { - } - - fun receiverCallingAgree() { - } - - fun refuseMatchToShowCalling(message: Message) { - } - - fun callSuccess() { - } - - fun vehicleTeamEnterRoom() { - } - - fun receiverVehicleTeamInvitation() { - } - - fun vehicleTeamMemberChange(teamMember: List?) { - } - - fun matchSuccess() { - } - - fun receiverCallRefuse() { - } - - fun receiverVehicleTeamInviteRefuse(){ - } - - fun receiverSomeoneExitVehicleTeam() { - } - - fun receiverHangUpInfo() { - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallTypeChangedListener.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallTypeChangedListener.kt deleted file mode 100644 index 9348e1c48a..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/ICallTypeChangedListener.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.mogo.chat.callcenter - -interface ICallTypeChangedListener { - fun onCallTypeChanged(callType: IMType) -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/IMType.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/IMType.kt deleted file mode 100644 index 7ce0c7b5a4..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/IMType.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.constant.CALL_TYPE_MATCHING -import com.mogo.chat.constant.CALL_TYPE_VOICE - -fun IMType.isMatching(): Boolean { - return this == IMType.MATCHING -} - -fun IMType.isMatchFailed():Boolean{ - return this == IMType.MATCHING_FAILED -} - -fun IMType.isInit():Boolean{ - return this == IMType.INIT_CALL -} - -fun IMType.canMatched(): Boolean { - return this == IMType.MATCHING || this == IMType.MATCHING_FAILED -} - -fun IMType.isCalling(): Boolean { - return this in IMType.CALLING_SENDER..IMType.CALLING_RECEIVER || this == IMType.CALLING_MATCH -} - -fun IMType.isReadyCalling(): Boolean { - return this in IMType.READY_TO_CALL_SENDER..IMType.READY_TO_CALL_RECEIVER -} - -/** - * 判断是否可以开始通话 - */ -fun IMType.canStartCalling(): Boolean { - return this in IMType.READY_TO_CALL_SENDER..IMType.READY_TO_CALL_RECEIVER || this == IMType.READY_TO_MATCH_RECEIVER -} - -/** - * 用于判断是否可以向上通知匹配超时,如果本次匹配已经被外来直聊通话打断,则不能向上反馈匹配超时 - */ -fun IMType.canMatchTimeout(): Boolean { - return this !in IMType.READY_TO_CALL_SENDER..IMType.CALLING_RECEIVER -} - -/** - * 未在通话中,在初始化或拨号中 - */ -fun IMType.notInCall(): Boolean { - return this in IMType.INIT_CALL..IMType.READY_TO_CALL_RECEIVER -} - -/** - * 将IMType转换成接口调用时传递的callType参数 - */ -fun IMType.exchangeToCallType(): Int { - return when (this) { - IMType.CALLING_MATCH, IMType.READY_TO_MATCH_RECEIVER -> CALL_TYPE_MATCHING - else -> CALL_TYPE_VOICE - } -} - -/** - * 在通话状态,指的是在通话状态中,包括拨号中和通话中 - */ -fun IMType.isInCallStatus(): Boolean { - return isCalling() || isReadyCalling() -} - -enum class IMType(val imType: Int) { - NULL(0), - INIT_CALL(1000), - READY_TO_CALL_SENDER(1001), - READY_TO_CALL_RECEIVER(1002), - CALLING_SENDER(1003), - CALLING_RECEIVER(1004), - MATCHING(1005), - CALLING_MATCH(1006), - READY_TO_MATCH_RECEIVER(1007), - MATCHING_FAILED(1008), - CALLING_ADD_FRIEND(1009), - CALLING_REFUSE(1010); -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/MessageCallBack.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/MessageCallBack.kt deleted file mode 100644 index 183d1998be..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/MessageCallBack.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.Message -import com.mogo.chat.util.log - - -/** - * Activity或者Service实现接口,实现方法注意切换为UI线程 - */ -interface MessageCallBack { - - fun initCall() - - fun addNewFocus() - - fun msgCallingReceiver(message: Message) - - fun msgCallingSender(message: Message) - - fun msgCallingSenderWithoutMessage() { - log(TAG, "msgCallingSenderWithoutMessage ---> GME返回信息,有人进房") - } - - fun msgRefuseCall(message: Message) - - fun msgCallMatch(message: Message) - - fun msgReadyToCallReceiver(message: Message) - - fun updateExitRoomStatus(message: Message? = null) - - fun callingReceiverRefuse(message: Message) - - fun msgError(socketException: Exception) { - //do nothing - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/MessageCallBackImpl.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/MessageCallBackImpl.kt deleted file mode 100644 index 5524558036..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/MessageCallBackImpl.kt +++ /dev/null @@ -1,217 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.chat.common.gme.GMEApi -import com.mogo.chat.constant.* -import com.mogo.chat.model.bean.Message -import com.mogo.chat.model.bean.isCall -import com.mogo.chat.model.bean.isMatch -import com.mogo.chat.model.bean.toSns -import com.mogo.chat.model.control.ChatController -import com.mogo.chat.model.control.MatchController -import com.mogo.chat.model.control.VehicleTeamController -import com.mogo.chat.service.ChatServiceHandler -import com.mogo.chat.util.UserInfoHelper -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.getRoomId -import com.mogo.chat.util.sp.saveRoomId - - -class MessageCallBackImpl : MessageCallBack { - - /** - * 重置初始化状态 - */ - override fun initCall() { - log(TAG, "initCall --->") - // 后台返回匹配超时会走此回调,所以在此调用了MatchController的matchTimeOutFromNet的方法,在方法里面判断了此时是否正在进行匹配,以及后续操作 - MatchController.matchTimeOutFromNet() - UserInfoHelper.currentRoomId = 0 - saveRoomId(0) - UserInfoHelper.currentCallType = CALL_TYPE_DEFAULT - log(TAG, "初始化") - CallController.callController.getMsgCallBack().forEach { - it.value.initStatus() - } - } - - override fun addNewFocus() { - - } - - /** - * 来电同意接听 - */ - override fun msgCallingReceiver(message: Message) { - UserInfoHelper.tmpSenderInfo = message.toSns() - UserInfoHelper.currentCallType = message.type - when (UserInfoHelper.currentCallType) { - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> { - log(TAG, "来电同意接听") - CallController.callController.getMsgCallBack().forEach { - it.value.receiverCallingAgree() - } - } - } - } - - override fun msgCallingSender(message: Message) { - log(TAG, "msgCallingSender message : $message") - if (message.type == CALL_TYPE_VEHICLE_TEAM && GMEApi.isRoomEntered()) { - log(TAG, "msgCallingSender 收到成员进房通知,本人已经进房 : ${getRoomId()}") - CallController.callController.getMsgCallBack().forEach { - log(TAG,"vehicleTeamMemberChange key : ${it.key}") - it.value.vehicleTeamMemberChange(message.teamMember) - } - return - } - if (message.roomId > 0) { - if (message.isCall() || message.isMatch()) { - UserInfoHelper.tmpSenderInfo = message.toSns() - } - UserInfoHelper.currentRoomId = message.roomId - UserInfoHelper.currentCallType = message.type - ChatController.enterRoom(message.roomId) - when (UserInfoHelper.currentCallType) { - CALL_TYPE_VOICE -> { - log(TAG, "打/接电话成功回调") - CallController.callController.getMsgCallBack().forEach { - it.value.callSuccess() - } - } - CALL_TYPE_VEHICLE_TEAM -> { - log(TAG, "车队邀请同意回调") - CallController.callController.getMsgCallBack().forEach { - log(TAG,"vehicleTeamEnterRoom key : ${it.key}") - it.value.vehicleTeamEnterRoom() - } - } - } - //首次邀请加入车队成功,会返回邀请人和被邀请人列表 - if (message.teamMember != null && message.teamMember.isNotEmpty()) { - CallController.callController.getMsgCallBack().forEach { - log(TAG,"vehicleTeamMemberChange key : ${it.key}") - it.value.vehicleTeamMemberChange(message.teamMember) - } - } - } - } - - override fun msgRefuseCall(message: Message) { - log(TAG, "已在通话进程中,根据类型拒接或挂断 ---> $message") - if (message.isCall() || message.isMatch()) { - UserInfoHelper.tmpSenderInfo = message.toSns() - } - UserInfoHelper.currentCallType = message.type - when (UserInfoHelper.currentCallType) { - CALL_TYPE_VOICE -> { - log(TAG, "正在拨打电话时来电,挂断来电") - ChatServiceHandler.refuseCall(message.snSender, {}, {}, message.roomId) - } - CALL_TYPE_MATCHING -> { - log(TAG, "正在匹配时来电,取消匹配") - MatchController.cancelMatch { - CallTypeManager.callTypeManager.callStatus = IMType.INIT_CALL - log(TAG, "取消匹配成功,给IMService回调,展示来电界面") - CallController.callController.getMsgCallBack().forEach { - it.value.refuseMatchToShowCalling(message) - } - } - } - CALL_TYPE_VEHICLE_TEAM -> { - if (CallTypeManager.callTypeManager.callStatus.isReadyCalling()) { - log(TAG, "正在拨打电话时来电,通知进入车队,挂断拨打电话") - ChatController.requestConnectStatus(UserInfoHelper.userInfo.sn, PUSH_MSG_DENY_ENTER) - } else if (GMEApi.isRoomEntered() || CallTypeManager.callTypeManager.callStatus.isCalling()) { - log(TAG, "已经进房或者通话过程中(无论是车队通话还是打电话、匹配),收到通知进入车队邀请,拒绝加入车队") - VehicleTeamController.requestVehicleTeamConnectStatus(message.snSender, PUSH_MSG_DENY_ENTER, CALL_TYPE_VEHICLE_TEAM) - } else { - log(TAG, "仍有条件没有考虑到,find bug") - } - } - } - } - - override fun msgCallMatch(message: Message) { - log(TAG, "msgCallMatch ---> $message") - if (message.roomId > 0) { - if (message.isCall() || message.isMatch()) { - UserInfoHelper.tmpSenderInfo = message.toSns() - } - UserInfoHelper.currentRoomId = message.roomId - UserInfoHelper.currentCallType = message.type - ChatController.enterRoom(message.roomId) - MatchController.resetMatchStatus() - log(TAG, "匹配成功回调") - CallController.callController.getMsgCallBack().forEach { - it.value.matchSuccess() - } - } - } - - override fun msgReadyToCallReceiver(message: Message) { - log(TAG, "msgReadyToCallReceiver ---> $message") - UserInfoHelper.tmpSenderInfo = message.toSns() - UserInfoHelper.currentRoomId = message.roomId - UserInfoHelper.currentCallType = message.type - when (UserInfoHelper.currentCallType) { - CALL_TYPE_VEHICLE_TEAM -> { - log(TAG, "收到车队邀请") - CallController.callController.getMsgCallBack().forEach { - it.value.receiverVehicleTeamInvitation() - } - } - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> { - log(TAG, "收到来电") - CallController.callController.getMsgCallBack().forEach { - it.value.receiverCalling(message) - } - } - } - } - - override fun updateExitRoomStatus(message: Message?) { - if (message != null) { - log(TAG, "updateExitRoomStatus message : $message") - if (message.teamMember != null && message.teamMember.isNotEmpty()) { - log(TAG, "收到某人退出车队通知") - CallController.callController.getMsgCallBack().forEach { - it.value.receiverSomeoneExitVehicleTeam() - it.value.vehicleTeamMemberChange(message.teamMember) - } - } else { - SocketClientFactory.socketClient.stopHeartBeat() - log(TAG, "接收到被动挂断电话、车队消息") - CallController.callController.getMsgCallBack().forEach { - it.value.receiverHangUpInfo() - } - log(TAG, "exitRoom") - ChatController.updateExitRoomStatus() - } - } else { - SocketClientFactory.socketClient.stopHeartBeat() - log(TAG, "接收到被动挂断电话、车队消息") - CallController.callController.getMsgCallBack().forEach { - it.value.receiverHangUpInfo() - } - log(TAG, "exitRoom") - ChatController.updateExitRoomStatus() - } - } - - override fun callingReceiverRefuse(message: Message) { - log(TAG, "收到被邀请人拒绝通知") - when(message.type){ - CALL_TYPE_VOICE, CALL_TYPE_MATCHING -> { - CallController.callController.getMsgCallBack().forEach { - it.value.receiverCallRefuse() - } - } - CALL_TYPE_VEHICLE_TEAM -> { - CallController.callController.getMsgCallBack().forEach { - it.value.receiverVehicleTeamInviteRefuse() - } - } - } - - } -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/SocketClientFactory.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/SocketClientFactory.kt deleted file mode 100644 index 51d974a93b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/callcenter/SocketClientFactory.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.chat.callcenter - -import com.mogo.websocket.SocketClient - -open class SocketClientFactory { - - companion object{ - - val socketClient by lazy(LazyThreadSafetyMode.SYNCHRONIZED){ - SocketClient() - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/EnginePollHelper.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/EnginePollHelper.kt deleted file mode 100644 index feae3d8d4f..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/EnginePollHelper.kt +++ /dev/null @@ -1,59 +0,0 @@ -package com.mogo.chat.common.gme - -import android.os.Handler - -class EnginePollHelper private constructor() { - - companion object { - private var s_enginePollHelper: EnginePollHelper? = null - private var s_pollEnabled = true - - - fun createEnginePollHelper() { - if (s_enginePollHelper == null) { - s_enginePollHelper = EnginePollHelper() - s_enginePollHelper!!.startTimer() - } - } - - fun destroyEnginePollHelper() { - if (s_enginePollHelper != null) { - s_enginePollHelper!!.stopTimer() - s_enginePollHelper = null - } - } - - fun pauseEnginePollHelper() { - s_pollEnabled = false - } - - fun resumeEnginePollHelper() { - s_pollEnabled = true - } - - } - - private val mHandler = Handler() - private val mRunnable = object : Runnable { - override fun run() { - if (s_pollEnabled) { - if (GMEHelper.getInstance().getTmgContext() != null) { - try { - GMEHelper.getInstance().getTmgContext()?.Poll() - } catch (e: Exception) { - e.printStackTrace() - } - } - } - mHandler.postDelayed(this, 15) - } - } - - private fun startTimer() { - mHandler.postDelayed(mRunnable, 15) - } - - private fun stopTimer() { - mHandler.removeCallbacks(mRunnable) - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/GMEApi.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/GMEApi.kt deleted file mode 100644 index 9460e97e5f..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/GMEApi.kt +++ /dev/null @@ -1,244 +0,0 @@ -package com.mogo.chat.common.gme - -import android.content.Intent -import com.mogo.chat.callcenter.CallController.Companion.callController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.SocketClientFactory -import com.mogo.chat.callcenter.isCalling -import com.mogo.chat.callcenter.isReadyCalling -import com.mogo.chat.constant.* -import com.mogo.chat.util.UserInfoHelper.currentCallType -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.getVoiceType -import com.mogo.commons.AbsMogoApplication -import com.tencent.TMG.ITMGContext -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch - - -object GMEApi : IGMEEvent { - private var openID: String = "" - private var startSay: Boolean = false - - fun init(openID: String): Boolean { - GMEApi.openID = openID - return GMEHelper.getInstance().init(AbsMogoApplication.getApp().applicationContext, SDKID, SDKKEY, openID) - } - - private fun getTmgContext(): ITMGContext? { - return GMEHelper.getInstance().getTmgContext() - } - - fun setVoiceType(voiceType: Int) { - getTmgContext()?.GetAudioEffectCtrl()?.SetVoiceType(voiceType) - } - - //播放音效 - fun setPlayEffect(soundId: Int, filePath: String, loop: Boolean) { - getTmgContext()?.GetAudioEffectCtrl()?.PlayEffect(soundId, filePath, loop) - } - - //暂停播放音效 - fun pausePlayEffect(soundId: Int) { - getTmgContext()?.GetAudioEffectCtrl()?.PauseEffect(soundId) - } - - private fun enableAudio() { - startSay = true - enableMic(true) - enableSpeaker(true) - val audioControl = getTmgContext()!!.GetAudioCtrl() - audioControl.TrackingVolume(0.75.toFloat()) - audioControl.EnableAudioCaptureDevice(true) - audioControl.EnableAudioSend(true) - audioControl.EnableAudioPlayDevice(true) - audioControl.EnableAudioRecv(true) - reMuteMic() - setVoiceType(getVoiceType()) - - } - - fun enterRoom(roomId: String) { - getTmgContext()?.SetRecvMixStreamCount(6) - getTmgContext()?.SetAdvanceParams("SetSpeakerStreamType", "0") - val auth = auth(roomId) - log(TAG, "auth:$auth") - auth?.let { - realEnterRoom(roomId, ROOM_TYPE, it) - } - } - - private fun auth(roomID: String): ByteArray? { - return GMEHelper.getInstance().auth(roomID) - } - - private fun realEnterRoom(roomID: String, roomType: Int, authBuffer: ByteArray) { - GMEHelper.getInstance().enterRoom(roomID, roomType, authBuffer) - } - - private fun enableMic(isEnable: Boolean) { - GMEHelper.getInstance().enableMic(isEnable) - } - - private fun enableSpeaker(isEnable: Boolean) { - GMEHelper.getInstance().enableSpeaker(isEnable) - } - - private fun exitRoom() { - startSay = false - GMEHelper.getInstance().exitRoom() - } - - fun unInit() { - GMEHelper.getInstance().unInit() - } - - fun pause() { - GMEHelper.getInstance().pause() - } - - fun resume() { - GMEHelper.getInstance().resume() - } - - private var igmCallBackList: MutableSet = mutableSetOf() - - fun addEnterRoomEventCall(igmCallBack: IGMEEventCallBack) { - igmCallBackList.add(igmCallBack) - GMEHelper.getInstance().addEventCall(this) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ENTER_ROOM, this) - } - - private fun addEventCall(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, call: IGMEEvent) { - GMEHelper.getInstance().addEventCall(type, call) - } - - fun removeEventCall(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, call: IGMEEvent) { - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ACCOMPANY_FINISH.name - GMEHelper.getInstance().removeEventCall(type, call) - } - - private fun removeEventCall(call: IGMEEvent) { - GMEHelper.getInstance().removeEventCall(call) - } - - fun isRoomEntered(): Boolean { - return GMEHelper.getInstance().isRoomEntered() - } - - fun getMicState(): Int { - return GMEHelper.getInstance().getMicState() - } - - fun getRoomType(): Int { - return GMEHelper.getInstance().getRoomType() - } - - fun muteMic() { - GMEHelper.getInstance().muteMic() - } - - fun reMuteMic(micVolume: Int = 100) { - GMEHelper.getInstance().reMuteMic(micVolume) - } - - fun isMicMute(): Boolean { - return GMEHelper.getInstance().isMicMute() - } - - override fun onEventExitRoom() { - //退房成功,停止Volume刷新 - log(TAG, "exitRoom") - updateExitRoomStatus() - } - - override fun onEventUserUpdate(eventId: Int, intent: Intent) { - val userList = TMGCallbackHelper.parseUserList(intent) - onSubEvent(eventId, userList) - } - - private fun onSubEvent(eventId: Int, userList: Array) { - log(TAG, "==Event==onSubEvent: $eventId") - when (eventId) { - ITMGContext.ITMG_EVENT_ID_USER_ENTER -> { - if (userList.isNotEmpty()) { - val filterList = userList.filter { - log(TAG, "成员进房====$it===ownId:$openID") - it.toInt() > 99999 - } - log(TAG, "成员进房==去掉99999====$filterList") - if (filterList.isNotEmpty()) { - // 去掉了99999以下的管理员用户,还剩下两个人,那就开始通话 - log(TAG, "GMEApi 成员进房==去掉了99999以下的管理员用户,还有人,那就开始通话") - if(!startSay){ - startSay() - } - // 如果进房的不是自己,且自身状态并未及时改变,计划在此处增加一个容错判断 - if (!filterList.contains(openID) && (callTypeManager.callStatus.isReadyCalling() || callTypeManager.callStatus.isCalling())) { - callController.callingSenderWithoutMessage() - } - } else { - log(TAG, "成员进房==去掉了99999以下的管理员用户,没有别人了,啥也不干") - } - } else { - log(TAG, "成员进房==进房成员列表为空,啥也不干") - } - } - ITMGContext.ITMG_EVENT_ID_USER_EXIT -> { - //退房成功,停止Volume刷新 - if (userList.isNotEmpty()) { - val filterList = userList.filter { - log(TAG, "成员退房====$it") - it.toInt() > 99999 - } - log(TAG, "成员退房==去掉99999====$filterList") - if (filterList.isEmpty()) { - log(TAG, "成员退房==去掉了99999以下的管理员用户,没有人了,啥也不干") - } else { - log(TAG, "成员退房==去掉了99999以下的管理员用户,还有别人, type为语音电话或者匹配则可退房 currentCallType : $currentCallType") - if(currentCallType != CALL_TYPE_VEHICLE_TEAM){ - dealHangUpAfter() - } - } - } else { - log(TAG, "成员退房==人都走干净了,准备退房") - dealHangUpAfter() - } - } - ITMGContext.ITMG_EVENT_ID_USER_HAS_AUDIO -> { - log(TAG, "user_update--user send audio") - } - } - } - - private fun dealHangUpAfter() { - igmCallBackList.forEach { - it.gmeHangUp() - } - SocketClientFactory.socketClient.stopHeartBeat() - } - - private fun startSay() { - log(TAG, "开始讲话================") - GlobalScope.launch(Dispatchers.Main) { - if (isRoomEntered()) { - enableAudio() - log(TAG, "============enableAudio() : ${getMicState()}") - } else { - log(TAG, "============还未进入房间") - } - } - } - - fun updateExitRoomStatus(igmCallBack: IGMEEventCallBack? = null) { - SocketClientFactory.socketClient.stopHeartBeat() - exitRoom() - getTmgContext()?.GetAudioCtrl()?.StopTrackingVolume() - igmCallBack?.let { - igmCallBackList.remove(it) - } - removeEventCall(this) - callController.initCall() - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/GMEHelper.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/GMEHelper.kt deleted file mode 100644 index e3bda43c94..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/GMEHelper.kt +++ /dev/null @@ -1,224 +0,0 @@ -package com.mogo.chat.common.gme - -import android.content.Context -import android.text.TextUtils -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log -import com.mogo.commons.AbsMogoApplication -import com.mogo.commons.debug.DebugConfig -import com.tencent.TMG.ITMGContext -import com.tencent.av.sig.AuthBuffer - -class GMEHelper { - - private constructor() { - } - - companion object { - - @Volatile - private var instance: GMEHelper? = null - - fun getInstance(): GMEHelper { - if (instance == null) { - synchronized(GMEHelper::class) { - if (instance == null) { - instance = GMEHelper() - } - } - } - return instance!! - } - } - - - private var tmgContext: ITMGContext? = null - private var mSdkAppID: String? = null - private var mSdkKey: String? = null - private var mUserID: String? = null - private var initFinish: Boolean = false - - - fun init(context: Context, sdkAppId: String, sdkKey: String, openID: String): Boolean { - tmgContext = ITMGContext.GetInstance(context) - mSdkAppID = sdkAppId - mSdkKey = sdkKey - mUserID = openID - tmgContext?.let { - // 初始化SDK,使用SDK必须先调用此接口 - it.Init(sdkAppId, openID) - if (DebugConfig.isDebug()) { - // debug模式打印全日志,线上环境使用默认设置 - it.SetLogLevel(ITMGContext.ITMG_LOG_LEVEL_INFO, ITMGContext.ITMG_LOG_LEVEL_VERBOSE) - } - // 设置Poll,请周期性的调用Poll接口以保证接口正常使用。 - EnginePollHelper.createEnginePollHelper() - // 设置委托 - it.SetTMGDelegate(TMGCallbackDispatcher.getInstance().itmgDelegate) - auth("0") - initFinish = true - return true - } - return false - } - - fun initFinish(): Boolean { - return initFinish - } - - fun getTmgContext(): ITMGContext? { - return tmgContext ?: ITMGContext.GetInstance(AbsMogoApplication.getApp().applicationContext) - } - - fun auth(roomID: String): ByteArray? { - // 离线语音房间号参数必须填 null - val authBuffer = AuthBuffer.getInstance() - .genAuthBuffer(Integer.parseInt(mSdkAppID!!), roomID, mUserID, mSdkKey) - if (TextUtils.equals("0", roomID)) { - tmgContext!!.GetPTT().ApplyPTTAuthbuffer(authBuffer) - } - return authBuffer - } - - fun enterRoom(roomID: String, roomType: Int, authBuffer: ByteArray) { - val result = tmgContext?.EnterRoom(roomID, roomType, authBuffer) - log(TAG, "enterRoom-result:${result}") - } - - /** - * 麦克风静音 - */ - fun muteMic() { - tmgContext?.GetAudioCtrl()?.SetMicVolume(0) - } - - /** - * 解除麦克风静音 - */ - fun reMuteMic(micVolume: Int = 150) { - tmgContext?.GetAudioCtrl()?.SetMicVolume(micVolume) - } - - /** - * 麦克风是否静音,之所以判断101是因为文档中写,如果获取音量值返回值为101则代表没有调用过设置音量接口,说明从未静音 - * @return true- 处于静音状态 false-处于非静音状态 - */ - fun isMicMute(): Boolean { - return tmgContext?.GetAudioCtrl()?.GetMicVolume() != 101 && tmgContext?.GetAudioCtrl()?.GetMicVolume() == 0 - } - - fun isRoomEntered(): Boolean { - return if (initFinish) { - tmgContext!!.IsRoomEntered() - } else { - false - } - } - - fun getMicState(): Int { - return if (initFinish) { - tmgContext!!.GetAudioCtrl().GetMicState() - } else { - 0 - } - } - - fun getRoomType(): Int { - return if (initFinish) { - tmgContext!!.GetRoom().GetRoomType() - } else { - 0 - } - } - - fun enableMic(isEnable: Boolean) { - tmgContext?.GetAudioCtrl()?.SetSpeakerVolume(200) - tmgContext?.GetAudioCtrl()?.EnableMic(isEnable) - } - - /** - * 开启扬声器 - * 扬声器状态 - * 0:关闭 - * 1:打开 - * 2:扬声器正在操作 - */ - fun enableSpeaker(isEnable: Boolean) { - tmgContext?.GetAudioCtrl()?.EnableSpeaker(isEnable) - val speakerStatus = tmgContext?.GetAudioCtrl()?.GetSpeakerState() - log(TAG, "speakerStatus: $speakerStatus") - } - - fun exitRoom() { - tmgContext?.ExitRoom() - } - - fun unInit() { - tmgContext?.Uninit() - } - - fun pause() { - tmgContext?.Pause() - } - - fun resume() { - tmgContext?.Resume() - } - - fun addEventCall(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, call: IGMEEvent) { - TMGCallbackDispatcher.getInstance().addDelegate(type, call) - } - - fun removeEventCall(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, call: IGMEEvent) { - TMGCallbackDispatcher.getInstance().removeDelegate(type, call) - } - - fun addEventCall(call: IGMEEvent) { - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_UPDATE, call) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_EXIT_ROOM, call) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ROOM_DISCONNECT, call) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_VOLUMES, call) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ACCOMPANY_FINISH, call) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_CHANGE_ROOM_TYPE, call) - addEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_AUDIO_DATA_EMPTY, call) - addEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_NUMBER_OF_USERS_UPDATE, - call - ) - addEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_NUMBER_OF_AUDIOSTREAMS_UPDATE, - call - ) - } - - fun removeEventCall(call: IGMEEvent) { - removeEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_UPDATE, call) - removeEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_EXIT_ROOM, call) - removeEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ROOM_DISCONNECT, call) - removeEventCall(ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_VOLUMES, call) - removeEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ACCOMPANY_FINISH, - call - ) - removeEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_CHANGE_ROOM_TYPE, - call - ) - removeEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_AUDIO_DATA_EMPTY, - call - ) - removeEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_NUMBER_OF_USERS_UPDATE, - call - ) - removeEventCall( - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_NUMBER_OF_AUDIOSTREAMS_UPDATE, - call - ) - } - - fun getUserId(): String? { - return mUserID - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/IGMEEvent.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/IGMEEvent.kt deleted file mode 100644 index 45d06636b2..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/IGMEEvent.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.mogo.chat.common.gme - - -import android.content.Intent -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log -import com.tencent.TMG.ITMGContext - - -interface IGMEEvent { - - fun onEvent(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, data: Intent) { - log(TAG,"IGMEEvent 接收到gme消息 onEvent --$type") - when (type) { - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ENTER_ROOM -> { - parseErrorInfo(data) { code, msg -> - onEventEnterRoom(code, msg) - } - } - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_EXIT_ROOM -> { - onEventExitRoom() - } - ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_UPDATE -> { - parseSubEvent(data) { subEvent -> - onEventUserUpdate(subEvent,data) - } - } - else -> return - } - } - - fun onEventEnterRoom(errorCode: Int, msg: String){ - - } - - fun onEventExitRoom() - - fun onEventUserUpdate(eventId: Int,intent:Intent) - - private fun parseErrorInfo(data: Intent, parse: (code: Int, msg: String) -> Unit){ - val nErrCode = TMGCallbackHelper.parseIntentParams2(data).nErrCode - val strMsg = TMGCallbackHelper.parseIntentParams2(data).strErrMsg - return parse.invoke(nErrCode, strMsg) - } - - private fun parseSubEvent(data: Intent, parse: (subEvent: Int) -> Unit) { - val subEvent = TMGCallbackHelper.parseSubEvent(data).toInt() - return parse.invoke(subEvent) - } -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/IGMEEventCallBack.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/IGMEEventCallBack.kt deleted file mode 100644 index 95e6ac365f..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/IGMEEventCallBack.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.mogo.chat.common.gme - -interface IGMEEventCallBack { - fun gmeHangUp() -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/TMGCallbackDispatcher.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/TMGCallbackDispatcher.kt deleted file mode 100644 index 1b1ff9bd82..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/TMGCallbackDispatcher.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.mogo.chat.common.gme - -import android.content.Intent -import com.tencent.TMG.ITMGContext - -import java.util.ArrayList -import java.util.HashMap - -class TMGCallbackDispatcher private constructor() { - - private val mapCallbacks = HashMap>() - var itmgDelegate: ITMGContext.ITMGDelegate? = null - - - companion object { - private var s_dispatcher: TMGCallbackDispatcher? = null - - fun getInstance(): TMGCallbackDispatcher { - if (s_dispatcher == null) { - s_dispatcher = TMGCallbackDispatcher() - } - return s_dispatcher!! - } - } - - init { - itmgDelegate = object : ITMGContext.ITMGDelegate() { - override fun OnEvent(type: ITMGContext.ITMG_MAIN_EVENT_TYPE?, data: Intent?) { - if (mapCallbacks.containsKey(type)) { - val lst = mapCallbacks[type] - for (i in lst!!.indices) { - lst[i].onEvent(type!!, data!!) - } - } - super.OnEvent(type, data) - } - } - } - - fun addDelegate(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, dispatcher: IGMEEvent) { - if (mapCallbacks.containsKey(type)) { - val lstDispatcher = mapCallbacks[type] - if (!lstDispatcher!!.contains(dispatcher)) { - lstDispatcher.add(dispatcher) - } - return - } else { - val lstCallbacks = ArrayList() - lstCallbacks.add(dispatcher) - mapCallbacks[type] = lstCallbacks - } - } - - fun removeDelegate(type: ITMGContext.ITMG_MAIN_EVENT_TYPE, dispatcher: IGMEEvent) { - if (mapCallbacks.containsKey(type)) { - val lstDispatcher = mapCallbacks[type] - if (lstDispatcher!!.contains(dispatcher)) { - lstDispatcher.remove(dispatcher) - } - return - } - } - -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/TMGCallbackHelper.java b/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/TMGCallbackHelper.java deleted file mode 100644 index a7009e2341..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/common/gme/TMGCallbackHelper.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.mogo.chat.common.gme; - -import android.content.Intent; - - -public class TMGCallbackHelper { - - private TMGCallbackHelper(){ - - } - - public static Integer parseSubEvent(Intent intent){ - return intent.getIntExtra("event_id", 0); - } - - public static String[] parseUserList(Intent intent){ - String[] userList = intent.getStringArrayExtra("user_list"); - if (userList == null) { - userList = new String[0]; - } - return userList; - } - - public static class Params2 { - public int nErrCode; - public String strErrMsg; - } - - private static final Params2 params2 = new Params2(); - - public static Params2 parseIntentParams2(Intent intent) { - params2.nErrCode = intent.getIntExtra("result", -1); - params2.strErrMsg = intent.getStringExtra("error_info"); - return params2; - } - - public static class ParamsUerInfo { - public int nEventID; - public String[] identifierList; - } - - private static final ParamsUerInfo paramsUerInfo = new ParamsUerInfo(); - - public static ParamsUerInfo parseUserInfoUpdateInfoIntent(Intent intent) { - paramsUerInfo.nEventID = intent.getIntExtra("event_id", 0); - paramsUerInfo.identifierList = intent.getStringArrayExtra("user_list"); - return paramsUerInfo; - } - - public static class ParamsAudioDeviceInfo { - public boolean bState; - public int nErrCode; - } - - private static final ParamsAudioDeviceInfo paramsAudioDeviceInfo = new ParamsAudioDeviceInfo(); - - static ParamsAudioDeviceInfo parseAudioDeviceInfoIntent(Intent intent) { - paramsAudioDeviceInfo.bState = intent.getBooleanExtra("audio_state", false); - paramsAudioDeviceInfo.nErrCode = intent.getIntExtra("audio_errcode", 0); - return paramsAudioDeviceInfo; - } -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/constant/Const.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/constant/Const.kt deleted file mode 100644 index 63d807f034..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/constant/Const.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.mogo.chat.constant - - -const val TAG = "CALL_CHAT" //全局TAG - -// 与相关接口复用 -/** - * 服务端下发消息状态为0存在三种场景: - * 1.语音聊天创建房间成功,给拨打方发送创建房间消息。 - * 2.有匹配过的车机,表示愿意聊天,如果有人匹配不到,会给有愿意聊天的用户发来打电话邀请 - * 3.接收车队邀请消息 - */ -const val PUSH_MSG_CREATE_ROOM = 0 - -/** - * 服务端下发消息状态为1存在三种场景: - * 1.语音聊天对方同意,下发同意消息 - * 2.匹配成功消息 - * 3.车队邀请对方同意,下发同意消息 - */ -const val PUSH_MSG_AGREE_ENTER = 1 - -/** - * 服务端下发消息状态为2存在三种场景: - * 1.语音邀请被拒绝 - * 2.被动匹配接收到来电邀请,被拒绝 - * 3.车队邀请被拒绝 - */ -const val PUSH_MSG_DENY_ENTER = 2 - -/** - * 服务端下发消息状态为3存在两种场景: - * 1.语音和匹配接收到消息下发,挂断电话 - * 2.车队接收到消息下发,如果消息中有队员,则接收到队员退房消息,若无队员,则挂断车队电话 - */ -const val PUSH_MSG_HANG_UP = 3 - -/** - * 表示超时取消匹配 - */ -const val PUSH_MSG_CANCEL_MATCH = 4 -const val PUSH_MSG_ADD_FRIEND = 5 // 提示添加好友 - -//GME相关信息 -const val ROOM_TYPE = 1 -const val SDKID = "1400280276" -const val SDKKEY = "I0USylN9YQq0CAiq" - -// 通话类型 -const val CALL_TYPE_DEFAULT = -1 -const val CALL_TYPE_VOICE = 0 -const val CALL_TYPE_MATCHING = 1 -const val CALL_TYPE_VIDEO = 2 -const val CALL_TYPE_VEHICLE_TEAM = 3 - -//WebSocket发送数据相关 -const val SOCKET_HAND_SHAKE = 0 -const val SOCKET_HEART_BEAT = 1 - -// 关注状态 -const val NOT_FOCUS = 0 -const val HAS_FOCUS = 1 -const val NO_FOCUS_STATUS = -1 - -// 在线状态 -const val ONLINE_STATUS = 0 -const val OFFLINE_STATUS = 1 -const val NO_LINE_STATUS = -1 - -// 提示加好友 -const val ADD_FRIEND_MESSAGE = "ADD_FRIEND_MESSAGE" - diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/constant/HttpConstants.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/constant/HttpConstants.kt deleted file mode 100644 index 231743cfa1..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/constant/HttpConstants.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.mogo.chat.constant - -import com.mogo.commons.debug.DebugConfig.* - -class HttpConstants { - - companion object { - - private const val DEV_BASE_URL_OWNER = "http://dzt-show.zhidaohulian.com/" - private const val DEV_CONFIG_URL = "http://dzt-test.zhidaohulian.com/" - private const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/" - - private const val SOCKET_SERVER = "ws://62.234.196.121:4001/ws" - private const val DEV_SOCKET_SERVER = "ws://dzt-test.zhidaohulian.com/ws" - - fun getBaseUrl(): String { - return when (getNetMode()) { - NET_MODE_DEV, NET_MODE_QA, NET_MODE_DEMO -> DEV_BASE_URL_OWNER - NET_MODE_RELEASE -> RELEASE_BASE_URL_OWNER - else -> RELEASE_BASE_URL_OWNER - } - } - - fun getSocketServer(): String { - return when (getNetMode()) { - NET_MODE_DEV, NET_MODE_QA, NET_MODE_DEMO -> DEV_SOCKET_SERVER - NET_MODE_RELEASE -> SOCKET_SERVER - else -> SOCKET_SERVER - } - } - - fun getConfig(): String { - return when (getNetMode()) { - NET_MODE_DEV, NET_MODE_QA, NET_MODE_DEMO -> DEV_CONFIG_URL - NET_MODE_RELEASE -> RELEASE_BASE_URL_OWNER - else -> RELEASE_BASE_URL_OWNER - } - } - - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CallApiException.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CallApiException.kt deleted file mode 100644 index 5a0fd605be..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CallApiException.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.chat.exception - -class CallApiException : CommonException { - - companion object { - - val ENTER_ROOM_API_EXCEPTION = CallApiException(3, "roomId is null or already enter room") - } - - constructor(code: Int, msg: String) : super(code, msg) - - fun getErrorMsg():String{ - return msg - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt deleted file mode 100644 index 3204b5f03e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.mogo.chat.exception - -open class CommonException :Exception{ - - companion object{ - val NETWORK_EXCEPTION = CommonException(1, "network is error") - val NULL_EXCEPTION = CommonException(1, "exception is null") - val NULL_REQUEST_DATA_API_EXCEPTION = CommonException(1, "request data is null") - } - - protected var code: Int = 0 - protected var msg: String = "" - - constructor(code: Int, msg: String) : super(msg) { - this.code = code - this.msg = msg - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt deleted file mode 100644 index 6b903d7c90..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.mogo.chat.model - -import com.mogo.chat.base.BaseRepository -import com.mogo.chat.constant.HttpConstants.Companion.getConfig -import com.mogo.chat.model.bean.OnLineStatus -import com.mogo.chat.model.bean.UserInfoBySns -import com.mogo.chat.model.bean.UserInfoBySnsRequest -import com.mogo.eagle.core.data.BaseResponse - - -class ChatServiceModel : BaseRepository() { - - //传入对方SN,需要注意以后扩展时传参的改变 - suspend fun isOnLine(sn: String): BaseResponse { - val map = hashMapOf() - map["sn"] = sn - return apiCall { - getNetWorkApi().isOnLine(map) - } - } - - suspend fun queryUserInfo(sn: String): BaseResponse { - val sns = arrayListOf(sn) - val requestData = UserInfoBySnsRequest(sns) - return apiCall { - getNetWorkApi(getConfig()).queryUserInfoBySnS(requestData) - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt deleted file mode 100644 index 5d81253d7a..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt +++ /dev/null @@ -1,33 +0,0 @@ -package com.mogo.chat.model - -import com.google.gson.Gson -import com.mogo.chat.base.BaseRepository -import com.mogo.chat.model.bean.FocusBlackListRequest -import com.mogo.chat.model.bean.FocusData -import com.mogo.chat.model.bean.FriendRequest -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.BaseResponse - -class FocusModel : BaseRepository() { - - companion object { - const val TAG = "FocusModel" - } - - suspend fun getFocusPage(pageIndex: Int): BaseResponse { - val friendRequest = Gson().toJson(FriendRequest(pageIndex, 10)) - val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to friendRequest) - return apiCall { getNetWorkApi().getFocusPage(map) } - } - - /** - * targetSn:要操作的目标SN - * operate: 2:拉黑 3:取消拉黑 - */ - suspend fun dealBlackList(targetSn: String, operate: Int): BaseResponse { - val focusBlackListRequest = Gson().toJson(FocusBlackListRequest(targetSn, operate)) - val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to focusBlackListRequest) - return apiCall { getNetWorkApi().dealBlackList(map) } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt deleted file mode 100644 index 77e4c8e7f0..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.mogo.chat.model - -import com.google.gson.Gson -import com.mogo.chat.base.BaseRepository -import com.mogo.chat.model.bean.FriendData -import com.mogo.chat.model.bean.FriendOrSelfOnLine -import com.mogo.chat.model.bean.FriendRequest -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.BaseResponse - -class FriendModel : BaseRepository() { - - companion object { - const val TAG = "FriendModel" - } - - suspend fun getFriendPage(pageIndex: Int): BaseResponse { - val friendRequest = Gson().toJson(FriendRequest(pageIndex, 10)) - val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to friendRequest) - return apiCall { getNetWorkApi().getFriendPage(map) } - } - - suspend fun canCallToFocus(snReceiver: String): BaseResponse { - val canCallStatus = Gson().toJson(FriendOrSelfOnLine(MoGoAiCloudClientConfig.getInstance().sn, snReceiver)) - val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to canCallStatus) - return apiCall { getNetWorkApi().getChatStatus(map) } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/AddFriendMessage.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/AddFriendMessage.kt deleted file mode 100644 index 0b2c7c4f40..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/AddFriendMessage.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.mogo.chat.model.bean - -/** - * 添加好友的push消息内容 - */ -data class AddFriendMessage(val sn:String,val nickName: String, val headImgUrl: String, val message: String,val alertType: Int) diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/AllUnit.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/AllUnit.kt deleted file mode 100644 index 7941f3d39c..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/AllUnit.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.mogo.chat.model.bean - -import com.mogo.cloud.passport.MoGoAiCloudClientConfig - - -fun AllUnit.toSns(): Sns { - return Sns(MoGoAiCloudClientConfig.getInstance().sn, - localNickName, - localHeadImgUrl, - localCarInfo, - cardIdSex, - cityName, - cardIdAge - ) -} - -data class AllUnit( - var localUserId: Int, - var localNickName: String, - var localHeadImgUrl: String, - var localCarInfo: String, - var sns: List, - var cardIdAge: String, - var cityName: String, - var cardIdSex: String -) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CallRequestParam.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CallRequestParam.kt deleted file mode 100644 index 03f319bb7c..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CallRequestParam.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.chat.model.bean - -import com.mogo.chat.constant.CALL_TYPE_VOICE - -class CallRequestParam(var snSender: String, var snReceiver: String, var nickName:String, var headImgUrl:String, var carInfo:String, var lat: Double?, var lon:Double?, callType: Int = CALL_TYPE_VOICE) { - - var type: Int = callType - - override fun toString(): String { - return "RoomParam(snSender='$snSender', snReceiver='$snReceiver', nickName='$nickName', headImgUrl='$headImgUrl', carInfo='$carInfo', lat=$lat, lon=$lon, type=$type)" - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CarMessage.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CarMessage.kt deleted file mode 100644 index ffb6e1e1cd..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CarMessage.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.mogo.chat.model.bean - -data class CarMessage( - val `receiver`: Int, - val message: Message, - val msgType: Int, - val pkgName: String, - val title: String -) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CarSwitchStatus.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CarSwitchStatus.kt deleted file mode 100644 index 5b2dcb624b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/CarSwitchStatus.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.chat.model.bean - -class CarSwitchStatus { - - var sn:String - var status:Int - - constructor(sn: String, status: Int) { - this.sn = sn - this.status = status - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/ConnectStatusParam.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/ConnectStatusParam.kt deleted file mode 100644 index 52057bc5fc..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/ConnectStatusParam.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.chat.model.bean - -class ConnectStatusParam { - - var snSender:String - var snReceiver:String - var roomId:Int - var status:Int - var type:Int - - var lat: Double? = null//发送方的纬度 - - var lon: Double? = null//发送方的经度 - - var nickName: String? = null//发送方的昵称 - - var headImgUrl: String? = null//发送方的用户头像 - - var carInfo: String? = null//发送方的车辆信息 - - var cardIdAge: String? = null//年龄 - - var cardIdSex: String? = null//性别 - - var cityName: String? = null//城市 - - constructor(snSender: String, snReceiver: String, roomId: Int, status: Int,type:Int) { - this.snSender = snSender - this.snReceiver = snReceiver - this.roomId = roomId - this.status = status - this.type = type - } - - override fun toString(): String { - return "ConnectStatusParam(snSender='$snSender', snReceiver='$snReceiver', roomId=$roomId, status=$status, type=$type, lat=$lat, lon=$lon, nickName=$nickName, headImgUrl=$headImgUrl, carInfo=$carInfo, cardIdAge=$cardIdAge, cardIdSex=$cardIdSex, cityName=$cityName)" - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/FocusStatus.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/FocusStatus.kt deleted file mode 100644 index eb1af31eaa..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/FocusStatus.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.chat.model.bean - -data class FocusStatus(val isFocus: Int) diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/FriendData.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/FriendData.kt deleted file mode 100644 index dcb4188e8b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/FriendData.kt +++ /dev/null @@ -1,87 +0,0 @@ -package com.mogo.chat.model.bean - -data class FriendData( - val pageIndex: Int, - val pageSize: Int, - val totalPages: Int, - val totalElements: Int, - val friendList: List -) - -data class FocusData( - val pageIndex: Int, - val pageSize: Int, - val totalPages: Int, - val totalElements: Int, - val friendList: List -) - -/** - * carStatus == 1 可拨打 - * carStatus == 0 不可拨打 - */ -fun FriendList.canCall(): Boolean { - return carStatus == 1 -} - -fun FriendList.toSns(): Sns { - return Sns(sn, nickName, headImgUrl, carInfo, cardIdSex, cityName, cardIdAge) -} - -data class FriendList( - val sn: String, - val nickName: String?, - val headImgUrl: String, - val carStatus: Int, - val cardIdSex: String, - val cityName: String, - val cardIdAge: String, - val carInfo: String -) - -fun FocusList.isInBlackList(): Boolean { - return blackFlag == 1 -} - -data class FocusList( - val sn: String, - val nickName: String, - val headImgUrl: String, - var carStatus: Int, //车机是否在线 0是不在线 1是在线 - val cardIdSex: String, - val cityName: String, - val cardIdAge: String, - val carInfo: String, - var eachFocusFlag: Boolean,//是否互粉 - var blackFlag: Int //是否加入黑名单 0是未加入 1是加入 -) - -class FriendOrSelfOnLine { - var snSender: String - var snReceiver: String - - constructor(snSender: String, snReceiver: String) { - this.snSender = snSender - this.snReceiver = snReceiver - } -} - -class FriendRequest { - var pageIndex: Int - var pageSize: Int - - constructor(pageIndex: Int, pageSize: Int) { - this.pageIndex = pageIndex - this.pageSize = pageSize - } -} - -class FocusBlackListRequest { - var focusSn: String - var operate: Int - - constructor(focusSn: String, operate: Int) { - this.focusSn = focusSn - this.operate = operate - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Header.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Header.kt deleted file mode 100644 index e331ee4142..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Header.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.mogo.chat.model.bean - -data class Header( - val delayTime: Int, - val maxSpeed: Int, - val stayTime: Int, - val type: Int -) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/InflectionBean.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/InflectionBean.kt deleted file mode 100644 index 4250c09a4e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/InflectionBean.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.chat.model.bean - -data class InflectionBean(val inflectionId:Int,val inflectionName:String,val normalRes:Int,val checkedRes:Int,val exampleVoiceRaw:Int) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/InitMessage.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/InitMessage.kt deleted file mode 100644 index fd05d2359f..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/InitMessage.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.mogo.chat.model.bean - -/** - * 长连接初步建立时的初始化信息封装 - */ -data class InitMessage(val nickName:String,val headImg:String,val localUserId:Int) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LiveBroadcast.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LiveBroadcast.kt deleted file mode 100644 index e13cfd767d..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LiveBroadcast.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.chat.model.bean - -class LiveBroadcast { - - var eventId: String? = null - var sn: String - var type: Int = 0 - var videoChannel: String - - constructor(sn: String, videoChannel: String) { - this.sn = sn - this.videoChannel = videoChannel - } - - constructor(eventId: String, sn: String, type: Int, videoChannel: String) { - this.eventId = eventId - this.sn = sn - this.type = type - this.videoChannel = videoChannel - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LiveBroadcastResult.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LiveBroadcastResult.kt deleted file mode 100644 index a4b5454c89..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LiveBroadcastResult.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.chat.model.bean - -class LiveBroadcastResult { - - var videoChannel: String - var livePlayUrl: String - var playUrl: PlayUrl - - constructor(videoChannel: String, livePlayUrl: String, playUrl: PlayUrl) { - this.videoChannel = videoChannel - this.livePlayUrl = livePlayUrl - this.playUrl = playUrl - } - -} - diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LocationCarsWithRadius.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LocationCarsWithRadius.kt deleted file mode 100644 index 01b0a5793e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/LocationCarsWithRadius.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.chat.model.bean - -class LocationCarsWithRadius { - var coordinates: List - var radius: Int - var type: String - var keyWord: String? = null - - constructor(coordinates: List, radius: Int, type: String) { - this.coordinates = coordinates - this.radius = radius - this.type = type - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/MatchRequestParam.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/MatchRequestParam.kt deleted file mode 100644 index 9514bf61a5..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/MatchRequestParam.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.chat.model.bean - -data class MatchRequestParam( - var nickName: String, - var headImgUrl: String, - var carInfo: String, - var lat: Double, - var lon: Double, - var age: Int, - var cardIdSex: String? = null, - var cityName: String? = null, -) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Message.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Message.kt deleted file mode 100644 index cc5f439d10..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Message.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.mogo.chat.model.bean - -import com.mogo.chat.constant.CALL_TYPE_MATCHING -import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM -import com.mogo.chat.constant.CALL_TYPE_VOICE -import java.io.Serializable - - -fun Message.isMatch(): Boolean { - return type == CALL_TYPE_MATCHING -} - -fun Message.isCall(): Boolean { - return type == CALL_TYPE_VOICE -} - -fun Message.isVehicleTeam(): Boolean { - return type == CALL_TYPE_VEHICLE_TEAM -} - -//Message返回数据结构根据匹配传入信息 返回具体字段,服务端做转发, -//在Launcher2.0中,传入数据不存在经纬度信息的,而在车聊聊单独App中,是存在经纬度,但是不存在性别、城市、车型信息 -//因此后期如若需要在车聊聊中添加缺少信息 需要做数据合并 -fun Message.toSns(): Sns { - return Sns( - snSender, - roomId, - nickName, - headImgUrl, - carInfo, - cardIdSex, - cityName, - cardIdAge, - lat, - lon - ) -} - -data class Message( - val roomId: Int, - val snReceiver: String, - val snSender: String, - val status: Int, - val type: Int, //0:语音通话 1:匹配模式 2:直播 3;车队 - val nickName: String?, - val headImgUrl: String?, - val carInfo: String?, - val lat: Double, - val lon: Double, - val cardIdSex: String?, - val cityName: String?, - val cardIdAge: String?, - val teamMember: List? - -) : Serializable \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt deleted file mode 100644 index e8ece98a32..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.mogo.chat.model.bean - - -/** - * carOnLine:ACC ON状态 1:在线 2:不在线 - * onLine:是否隐身 1:在线 2:隐身 - */ -data class OnLineStatus(val carOnLine: Int, val onLine: Int) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/PlayUrl.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/PlayUrl.kt deleted file mode 100644 index f5e3bb1e6e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/PlayUrl.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.chat.model.bean - -class PlayUrl { - - var rtmp: String - var flv: String - var hls: String - - constructor(rtmp: String, flv: String, hls: String) { - this.rtmp = rtmp - this.flv = flv - this.hls = hls - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Results.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Results.kt deleted file mode 100644 index e81fef9900..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Results.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.mogo.chat.model.bean - -class Results(val t :T) { - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/RoomInfo.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/RoomInfo.kt deleted file mode 100644 index c5da37f774..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/RoomInfo.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.mogo.chat.model.bean - -class RoomInfo { - - var roomId:Int - - constructor(roomId: Int) { - this.roomId = roomId - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Sns.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Sns.kt deleted file mode 100644 index 2ace867aa9..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/Sns.kt +++ /dev/null @@ -1,107 +0,0 @@ -package com.mogo.chat.model.bean - -import android.text.TextUtils -import java.io.Serializable - - -class Sns : Serializable { - - var sn: String = "" - var lat: Double = 0.0 - var lon: Double = 0.0 - var direction: Int = 0 - var canLive: Int = 0//1:可直播 0:不可直播 - var canVoice: Int = 1 //1:可语音 0:不可语音 - var nickName: String? = null - set(value) { - field = if (TextUtils.isEmpty(value)) { - "小蘑菇" - } else { - value - } - } - var userId: Int = 0 //用户ID 进入语音通话间唯一识别号、 - var headImgUrl: String? = null - var carInfo: String? = null - var cardIdSex: String? = null - var cityName: String? = null - var cardIdAge: String? = null - - constructor(sn: String, nickName: String?, headImgUrl: String?) { - this.canVoice = 1 - this.sn = sn - this.nickName = nickName - this.headImgUrl = headImgUrl - } - - constructor( - sn: String, - userId: Int, - nickName: String?, - carInfo: String?, - headImgUrl: String?, - lat: Double, - lon: Double - ) { - this.sn = sn - this.lat = lat - this.lon = lon - this.direction = 0 - this.canLive = 1 - this.canVoice = 1 - this.userId = userId - this.nickName = nickName - this.headImgUrl = headImgUrl - this.carInfo = carInfo - } - - /** - * 可能会创建空sns,在ChatService的onReceive里面的有此需求 - */ - constructor( - sn: String = "", - nickName: String? = "", - headImgUrl: String? = "", - carInfo: String? = "", - gender: String? = "", - cityName: String? = "", - userAge: String? = "" - ) { - this.sn = sn - this.nickName = nickName - this.headImgUrl = headImgUrl - this.carInfo = carInfo - this.cardIdSex = gender - this.cityName = cityName - this.cardIdAge = userAge - } - - constructor( - sn: String = "", - roomId: Int, - nickName: String? = "", - headImgUrl: String? = "", - carInfo: String? = "", - cardIdSex: String? = "", - cityName: String? = "", - cardIdAge: String? = "", - lat: Double, - lon: Double - ){ - this.sn = sn - this.userId = roomId - this.nickName = nickName - this.headImgUrl = headImgUrl - this.carInfo = carInfo - this.cardIdSex = cardIdSex - this.cityName = cityName - this.cardIdAge = cardIdAge - this.lat = lat - this.lon = lon - } - - override fun toString(): String { - return "Sns(sn='$sn', lat=$lat, lon=$lon, direction=$direction, canLive=$canLive, canVoice=$canVoice, nickName=$nickName, userId=$userId, headImgUrl=$headImgUrl, carInfo=$carInfo, cardIdSex=$cardIdSex, cityName=$cityName, cardIdAge=$cardIdAge)" - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SocketMsg.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SocketMsg.kt deleted file mode 100644 index a346779f87..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SocketMsg.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.chat.model.bean - -class SocketMsg { - - var msgType:Int = 0 - var sn:String? = null - var roomId:Int = 0 - - constructor(msgType: Int, sn: String?) { - this.msgType = msgType - this.sn = sn - } - - constructor(msgType: Int, sn: String, roomId: Int) { - this.msgType = msgType - this.sn = sn - this.roomId = roomId - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SplashConfig.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SplashConfig.kt deleted file mode 100644 index 31a6fe24df..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SplashConfig.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.chat.model.bean - -/** - * image: String //图片地址 - * displayTime: Int //Splash页面图片显示时间 - * effectiveFlag: Long //授权配置 - * content: String //语音内容 - */ -data class SplashConfig( - val image: String, - val displayTime: Int, - val effectiveFlag: Long, - val content: String -) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SplashConfigRequest.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SplashConfigRequest.kt deleted file mode 100644 index 314cd01d3e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/SplashConfigRequest.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.mogo.chat.model.bean - -data class SplashConfigRequest( - val dataSource: String, - val serverType: String -) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/TeammateInfo.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/TeammateInfo.kt deleted file mode 100644 index 8f4a9cbdeb..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/TeammateInfo.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.chat.model.bean - -/** - * created by wujifei on 2020/11/17 11:43 - * describe:队员信息 - */ -data class TeammateInfo( - var sn: String, - var nickName: String, - var headImgUrl: String, - var cardIdAge: Int, - var cardIdSex: String, - var cityName: String, - var lat: Double, - var lon: Double, - var carInfo: String, - var vehicleTeamLeader: Boolean) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/TopicGuide.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/TopicGuide.kt deleted file mode 100644 index 2745157611..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/TopicGuide.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.mogo.chat.model.bean - - -data class TopicRequest(var topicGuide: TopicGuide) -data class TopicGuide(var topicContent:ArrayList) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/UserInfoBySns.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/UserInfoBySns.kt deleted file mode 100644 index e5d2d31725..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/UserInfoBySns.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.mogo.chat.model.bean - -class UserInfoBySnsRequest { - var sns: List? = null - - constructor(sns: List?) { - this.sns = sns - } -} - -data class UserInfoBySns(val info: List) - -data class Info( - val carAndUserInfoRedisVo: CarAndUserInfoRedisVo, - val realTimeLocationVo: RealTimeLocationVo -) - -data class CarAndUserInfoRedisVo( - val sn:String?, - val userNickName: String?, - val headImgUrl: String?, - val cardIdSex: String?, - val cardIdAge: String?, - val lastBrandName: String?, - val lastActiveCity: String? -) - -data class RealTimeLocationVo(val lon: Double, val lat: Double) \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt deleted file mode 100644 index f042d52245..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt +++ /dev/null @@ -1,177 +0,0 @@ -package com.mogo.chat.model.control - -import com.mogo.chat.R -import com.mogo.chat.base.BaseController -import com.mogo.chat.callcenter.CallController.Companion.callController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.exchangeToCallType -import com.mogo.chat.common.gme.GMEApi -import com.mogo.chat.common.gme.IGMEEventCallBack -import com.mogo.chat.constant.CALL_TYPE_VOICE -import com.mogo.chat.constant.PUSH_MSG_DENY_ENTER -import com.mogo.chat.constant.PUSH_MSG_HANG_UP -import com.mogo.chat.constant.TAG -import com.mogo.chat.exception.CallApiException.Companion.ENTER_ROOM_API_EXCEPTION -import com.mogo.chat.model.bean.RoomInfo -import com.mogo.chat.util.CallTimer.Companion.callTimer -import com.mogo.chat.util.MediaController -import com.mogo.chat.util.UserInfoHelper -import com.mogo.chat.util.audio.AudioFocusUtil -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.saveRoomId -import com.mogo.chat.util.trackCall -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.network.request - - -object ChatController : BaseController(), IGMEEventCallBack { - - private var roomId = 0 - - fun call( - snReceiver: String, - mRoomID: Int, - onSuccess: ((roomId: Int) -> Unit), - onError: (Exception) -> Unit - ) { - log(TAG, "ChatController call ----- snReceiver: $snReceiver") - roomId = mRoomID - if (roomId == 0) { - requestRoomInfo(snReceiver, onSuccess, onError) - } else { - enterRoom(roomId) - callController.callingReceiver() - } - } - - private fun requestRoomInfo( - snReceiver: String, - onSuccess: ((roomId: Int) -> Unit), - onError: (Exception) -> Unit - ) { - request> { - start { - playCallingAudio() - } - loader { - chatServiceModel.requestRoomInfo( - snReceiver, - callTypeManager.callStatus.exchangeToCallType() - ) - } - onSuccess { - roomId = it.result.roomId - log(TAG, "ChatController 获取房间信息成功:$roomId") - //创建房间 - if (roomId == 0 || GMEApi.isRoomEntered()) { - log(TAG, "ChatController 已经进入房间 ---> ${GMEApi.isRoomEntered()}") - onError.invoke(ENTER_ROOM_API_EXCEPTION) - return@onSuccess - } - callController.readyToCallSender() - onSuccess.invoke(roomId) - } - onError { - log(TAG, "ChatController 获取房间信息失败") - stopCallingAudio() - onError.invoke(it) - } - } - } - - private var isPlayingCallingAudio = false - - private fun playCallingAudio() { - if (!isPlayingCallingAudio) { - isPlayingCallingAudio = true - MediaController.startPlay( - AbsMogoApplication.getApp().applicationContext, - R.raw.call, - true - ) - } - } - - private fun stopCallingAudio() { - if (isPlayingCallingAudio) { - MediaController.release() - isPlayingCallingAudio = false - } - } - - fun enterRoom(mRoomId: Int) { - log(TAG, "ChatController enterRoom ---> roomID:$mRoomId") - roomId = mRoomId - stopCallingAudio() - requestAudioFocus() - GMEApi.addEnterRoomEventCall(this@ChatController) - GMEApi.enterRoom(mRoomId.toString()) - saveRoomId(mRoomId) - callTimer.start() - } - - private fun requestAudioFocus() { - val isCan = AudioFocusUtil.getInstance().findMicFocus(AbsMogoApplication.getApp().applicationContext) - if (!isCan) { - AudioFocusUtil.getInstance().sendGetFocusIntent(AbsMogoApplication.getApp().applicationContext) - } - } - - override fun gmeHangUp() { - requestConnectStatus( - UserInfoHelper.tmpSenderInfo.sn, - PUSH_MSG_HANG_UP - ) - } - - fun requestConnectStatus( - snReceiver: String, - status: Int, - onSuccess: (() -> Unit)? = null, - onError: ((Exception) -> Unit)? = null, - _roomId: Int = 0 - ) { - if (status != PUSH_MSG_HANG_UP) { - trackCall(callTypeManager.callStatus.exchangeToCallType(), status) - } - if (_roomId != 0) { - roomId = _roomId - } - request> { - loader { - chatServiceModel.requestConnectStatus(CALL_TYPE_VOICE, - snReceiver, roomId, status, - callTypeManager.callStatus.exchangeToCallType() - ) - } - onSuccess { - log(TAG, "ChatController 同步房间信息成功") - onSuccess?.invoke() - when (status) { - PUSH_MSG_HANG_UP, PUSH_MSG_DENY_ENTER -> { - updateExitRoomStatus() - } - } - } - onError { - log(TAG, "ChatController 同步房间信息失败:$it") - if (status == PUSH_MSG_HANG_UP) { - onSuccess?.invoke() - updateExitRoomStatus() - return@onError - } - onError?.invoke(it) - } - } - } - - fun updateExitRoomStatus() { - log(TAG, "ChatController exitRoom") - roomId = 0 - callTimer.stop() - stopCallingAudio() - AudioFocusUtil.getInstance().sendReleaseFocusIntent(AbsMogoApplication.getApp().applicationContext) - GMEApi.updateExitRoomStatus(this) - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt deleted file mode 100644 index 272f93a694..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt +++ /dev/null @@ -1,206 +0,0 @@ -package com.mogo.chat.model.control - -import com.mogo.chat.R -import com.mogo.chat.aspect.DebugLog -import com.mogo.chat.base.BaseController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.IMType -import com.mogo.chat.callcenter.canMatchTimeout -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.MatchRequestParam -import com.mogo.chat.net.taskDelayAsync -import com.mogo.chat.provider.ServiceApi -import com.mogo.chat.util.* -import com.mogo.chat.util.audio.AudioFocusUtil -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.network.request -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.Job -import kotlinx.coroutines.withContext - -object MatchController : BaseController() { - - private const val MAX_AMOUNT_OF_CANCEL_MATCHING = 5 - - private var cancelMatchCount = 0 - private var timeOutJob: Job? = null - private var retryJob: Job? = null - private const val DEFAULT_MATCH_TIME_OUT_TIME = 30 * 1000L // 30 * 1000L - private var arrayOfVoiceSources = intArrayOf(R.raw.match1, R.raw.match2, R.raw.match3) - - private var isMatching = false - - private var timeOut: (() -> Unit)? = null - - private var startMatchTime: Long = 0L - - fun resetMatchStatus() { - isMatching = false - stopTimeOutRecord() - log(TAG, "matchCallBack====$startMatchTime") - val time: Long = (System.currentTimeMillis() - startMatchTime) - startMatchTime = 0L - trackNormalEvent(TRACK_MATCH_SUCCESS, mutableMapOf("matchtime" to time)) - } - - fun startMatch( - invokeFlag: String?, - onSuccess: () -> Unit, - onError: (Exception) -> Unit, - timeOut: () -> Unit - ) { - MatchController.timeOut = timeOut - request> { - loader { - val location = ServiceApi.locationClient()?.lastKnowLocation - val param = MatchRequestParam( - UserInfoHelper.userInfo.nickName!!, - UserInfoHelper.userInfo.headImgUrl!!, - UserInfoHelper.userInfo.carInfo ?: "", - location?.latitude ?: 0.0, - location?.longitude ?: 0.0, - (UserInfoHelper.userInfo.cardIdAge ?: "0").toInt(), - UserInfoHelper.userInfo.cardIdSex, - UserInfoHelper.userInfo.cityName - ) - if (!invokeFlag.isNullOrEmpty()) { - param.cardIdSex = UserInfoHelper.userInfo.cardIdSex - param.cityName = UserInfoHelper.userInfo.cityName - } - chatServiceModel.startMatch(param) - } - onSuccess { - log(TAG, "开始匹配成功") - onSuccess.invoke() - startTimeOutRecord() - // 开始播放匹配音乐 - playMatchingAudio() - startMatchTime = System.currentTimeMillis() - callTypeManager.callStatus = IMType.MATCHING - isMatching = true - } - onError { - log(TAG, "开始匹配失败--${it.message}") - isMatching = false - onError.invoke(it) - } - } - } - - private var isRecordingTimeOut = false - private fun startTimeOutRecord() { - if (!isRecordingTimeOut) { - isRecordingTimeOut = true - log(TAG, "开始本地超时计时===") - timeOutJob = taskDelayAsync(DEFAULT_MATCH_TIME_OUT_TIME) { - log(TAG, "本地计时匹配超时===") - withContext(Dispatchers.Main) { - // 本地计时匹配超时 - if (startMatchTime != 0L) { - val time: Long = (System.currentTimeMillis() - startMatchTime) - startMatchTime = 0L - trackNormalEvent(TRACK_MATCH_FAIL, mutableMapOf("matchtime" to time)) - } - stopMatchingAudio() - if (callTypeManager.callStatus.canMatchTimeout()) { - timeOut?.invoke() - } - isMatching = false - isRecordingTimeOut = false - } - } - } - } - - private var isPlayingMatchingAudio = false - - private fun playMatchingAudio() { - if (!isPlayingMatchingAudio) { - isPlayingMatchingAudio = true - AudioFocusUtil.getInstance().requireDuck() - MediaController.startPlay( - AbsMogoApplication.getApp().applicationContext, - arrayOfVoiceSources.random(), - true - ) - } - } - - private fun stopMatchingAudio() { - if (isPlayingMatchingAudio) { - MediaController.release() - isPlayingMatchingAudio = false - AudioFocusUtil.getInstance().releaseDuck() - } - } - - @DebugLog - fun stopTimeOutRecord() { - if (isRecordingTimeOut) { - log(TAG, "结束本地超时计时=====") - stopMatchingAudio() - timeOutJob?.cancel() - isRecordingTimeOut = false - } - } - - /** - * 服务端返回匹配超时 - */ - fun matchTimeOutFromNet() { - log(TAG, "服务端返回匹配超时===$isMatching") - if (isMatching) { - if (startMatchTime != 0L) { - val time: Long = (System.currentTimeMillis() - startMatchTime) - startMatchTime = 0L - trackNormalEvent(TRACK_MATCH_FAIL, mutableMapOf("matchtime" to time)) - } - timeOutJob?.cancel() - stopMatchingAudio() - if (callTypeManager.callStatus.canMatchTimeout()) { - timeOut?.invoke() - } - timeOut = null - isMatching = false - } - } - - fun cancelMatch(onSuccess: (() -> Unit)? = null) { - callTypeManager.callStatus = IMType.INIT_CALL - stopTimeOutRecord() - if (startMatchTime != 0L) { - val time = (System.currentTimeMillis() - startMatchTime) - trackNormalEvent(TRACK_MATCH_CANCEL, mutableMapOf("matchtime" to time)) - startMatchTime = 0L - } - request> { - loader { - chatServiceModel.cancelMatch() - } - onSuccess { - log(TAG, "取消匹配成功") - cancelMatchCount = 0 - onSuccess?.invoke() - isMatching = false - } - onError { - log(TAG, "取消匹配失败--$cancelMatchCount--${it.message}") - isMatching = false - if (cancelMatchCount < MAX_AMOUNT_OF_CANCEL_MATCHING) { - retryJob = taskDelayAsync(1000) { - withContext(Dispatchers.Main) { - cancelMatchCount++ - cancelMatch() - } - } - } else { - retryJob?.cancel() - retryJob = null - cancelMatchCount = 0 - onSuccess?.invoke() - } - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt deleted file mode 100644 index 8ab605bd64..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt +++ /dev/null @@ -1,83 +0,0 @@ -package com.mogo.chat.model.control - -import com.mogo.chat.base.BaseController -import com.mogo.chat.common.gme.IGMEEventCallBack -import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM -import com.mogo.chat.constant.PUSH_MSG_DENY_ENTER -import com.mogo.chat.constant.PUSH_MSG_HANG_UP -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.CallRequestParam -import com.mogo.chat.provider.ServiceApi -import com.mogo.chat.util.UserInfoHelper -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.getRoomId -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.network.request - - -object VehicleTeamController : BaseController(), IGMEEventCallBack { - - fun inviteJoinVehicleTeam( invitedSn: String, onSuccess: () -> Unit, onError: (Exception) -> Unit) { - getUserInfo({ - request> { - loader { - val location = ServiceApi.locationClient()?.lastKnowLocation - val param = CallRequestParam( - MoGoAiCloudClientConfig.getInstance().sn, invitedSn, - UserInfoHelper.userInfo.nickName!!, - UserInfoHelper.userInfo.headImgUrl!!, - UserInfoHelper.userInfo.carInfo ?: "", - location?.latitude ?: 0.0, - location?.longitude ?: 0.0, - CALL_TYPE_VEHICLE_TEAM) - chatServiceModel.inviteJoinVehicleTeam(param) - } - onSuccess { - onSuccess.invoke() - } - onError { - onError.invoke(it) - } - } - },{ - log(TAG,"获取用户信息失败,请稍后重试") - onError.invoke(Exception("获取用户信息失败,请稍后重试")) - }) - } - - override fun gmeHangUp() { - requestVehicleTeamConnectStatus(UserInfoHelper.userInfo.sn, PUSH_MSG_HANG_UP,CALL_TYPE_VEHICLE_TEAM) - } - - fun requestVehicleTeamConnectStatus( - snReceiver: String = "", - status: Int, - type:Int, - onSuccess: (() -> Unit)? = null, - onError: ((Exception) -> Unit)? = null) { - request> { - loader { - chatServiceModel.requestConnectStatus(CALL_TYPE_VEHICLE_TEAM, snReceiver, getRoomId(), status,type) - } - onSuccess { - log(TAG, "同步房间信息成功") - onSuccess?.invoke() - when (status) { - PUSH_MSG_HANG_UP, PUSH_MSG_DENY_ENTER -> { - ChatController.updateExitRoomStatus() - } - } - } - onError { - log(TAG, "同步房间信息失败:$it") - if (status == PUSH_MSG_HANG_UP) { - onSuccess?.invoke() - ChatController.updateExitRoomStatus() - return@onError - } - onError?.invoke(it) - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt deleted file mode 100644 index cd17ba6d4a..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt +++ /dev/null @@ -1,108 +0,0 @@ -package com.mogo.chat.net - -import com.mogo.chat.model.bean.* -import com.mogo.eagle.core.data.BaseResponse -import retrofit2.http.* - -interface HttpApi { - - //更改车机显示状态 - @FormUrlEncoded - @POST("yycp-chat-service/car/circle/no/snStatus/v1") - suspend fun switchCarStatus(@FieldMap status: Map): BaseResponse - - //获取半径周边范围内的活跃车机 - @FormUrlEncoded - @POST("yycp-chat-service/car/circle/no/getSn/v1") - suspend fun requestLiveCars(@FieldMap sns: Map): BaseResponse - - //获取某台车机的视频直播流 - @FormUrlEncoded - @POST("appDataService/integratedServices/app/push/no/livePush/v1") - suspend fun requestLive(@FieldMap liveBroadcast: Map): BaseResponse - - //直播心跳 - @FormUrlEncoded - @POST("appDataService/integratedServices/app/push/no/heartbeat/v1") - suspend fun heartBeat(@FieldMap heartBeat: Map): BaseResponse - - //语音房间信息,原路径dataService - @FormUrlEncoded - @POST("/yycp-chat-service/car/sender/no/createRoom/v1") - suspend fun requestRoomInfo(@FieldMap roomInfo: Map): BaseResponse - - //语音状态同步,原路径dataService - @FormUrlEncoded - @POST("/yycp-chat-service/car/voiceRoom/no/operate/v1") - suspend fun requestConnectStatus(@Query("sn") sn: String, @FieldMap connectStatus: Map): BaseResponse - - // 开始匹配 - @FormUrlEncoded - @POST("/yycp-chat-service/car/voiceRoom/no/findMatch/v1") - suspend fun startMatch(@Query("sn") sn: String, @FieldMap match: Map): BaseResponse - - // 取消匹配 - @FormUrlEncoded - @POST("/yycp-chat-service/car/voiceRoom/no/cancleMatch/v1") - suspend fun cancelMatch(@Query("sn") sn: String, @FieldMap cancelMatch: Map): BaseResponse - - //邀请加入车队 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chat/no/inviteJoinTeam/v1") - suspend fun inviteJoinVehicleTeam(@FieldMap inviteVehicleTeam: Map): BaseResponse - - //车队状态同步 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chat/no/operateTeamRoom/v1") - suspend fun requestVehicleTeamConnectStatus(@FieldMap connectStatus: Map): BaseResponse - - //获取配置的加载图片 - @FormUrlEncoded - @POST("deva/voiceGuideConfig/findVoiceGuideConfigBySn/v1") - suspend fun getSplashConfig(@FieldMap config: Map): BaseResponse - - //获取配置的引导话题 - @FormUrlEncoded - @POST("/yycp-chat-service/car/topic/no/getNowTopic/v1") - suspend fun getTopicGuideContent(@FieldMap topGuideContent: Map): BaseResponse - - // 获取关注状态 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chatFoucs/no/checkFocus/v1") - suspend fun requestFocusStatus(@FieldMap focusSn: Map): BaseResponse - - //黑名单操作 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chatFoucs/no/operate/v1") - suspend fun dealBlackList(@FieldMap blackList: Map): BaseResponse - - // 添加关注 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chatFoucs/no/addFocus/v1") - suspend fun dealFocus(@FieldMap focusSn: Map): BaseResponse - - //查询好友列表 - @JvmSuppressWildcards - @FormUrlEncoded - @POST("/yycp-chat-service/car/chatFoucs/no/getFocusPage/v1") - suspend fun getFriendPage(@FieldMap focusSn: Map): BaseResponse - - //查询粉丝列表 - @JvmSuppressWildcards - @FormUrlEncoded - @POST("/yycp-chat-service/car/chatFoucs/no/getByFocusPage/v1") - suspend fun getFocusPage(@FieldMap focusSn: Map): BaseResponse - - // 获取通话状态 - @FormUrlEncoded - @POST("/yycp-chat-service/car/chat/no/chatStatus/v1") - suspend fun getChatStatus(@FieldMap chatStatus: Map): BaseResponse - - //查询用户是否在线 - @FormUrlEncoded - @POST("/yycp-chat-service/car/queryOnLineBySn/v1") - suspend fun isOnLine(@FieldMap onLine: Map): BaseResponse - - @POST("/yycp-realtimeLocations/realTimeLocationServer/queryRsAncCarAndUserInfoBySns") - suspend fun queryUserInfoBySnS(@Body userInfoBySnsRequest: UserInfoBySnsRequest): BaseResponse -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/TaskCoroutines.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/TaskCoroutines.kt deleted file mode 100644 index af1fb3af63..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/TaskCoroutines.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.mogo.chat.net - -import kotlinx.coroutines.* - -@PublishedApi -internal var ThreadPool = - newFixedThreadPoolContext(Runtime.getRuntime().availableProcessors() * 2, "ThreadPool") - - -fun taskBlockOnMainThread(delayTime: Long = 0, job: suspend () -> Unit) = GlobalScope.launch(Dispatchers.Main) { - delay(delayTime) - job() -} - -/** - * 并发执行,常用于最外层,延时操作 - * 特点带返回值 - */ -fun taskDelayAsync(delayTime: Long = 0, job: suspend () -> T) = GlobalScope.async(ThreadPool) { - delay(delayTime) - job() -} - -/** - * 并发执行 - */ -fun taskAsync(job:suspend () -> T) = GlobalScope.async { - job() -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/provider/ServiceApi.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/provider/ServiceApi.kt deleted file mode 100644 index 4ffb041223..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/provider/ServiceApi.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.chat.provider - -import com.mogo.commons.AbsMogoApplication -import com.mogo.map.location.IMogoLocationClient -import com.mogo.module.common.MogoApisHandler - -class ServiceApi { - - companion object { - - fun locationClient(): IMogoLocationClient? { - return MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(AbsMogoApplication.getApp().applicationContext) - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt deleted file mode 100644 index a6170e308b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt +++ /dev/null @@ -1,292 +0,0 @@ -package com.mogo.chat.service - -import com.google.gson.Gson -import com.mogo.chat.base.BaseController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.exchangeToCallType -import com.mogo.chat.callcenter.isCalling -import com.mogo.chat.callcenter.isReadyCalling -import com.mogo.chat.common.gme.GMEApi -import com.mogo.chat.constant.* -import com.mogo.chat.model.bean.FocusStatus -import com.mogo.chat.model.bean.OnLineStatus -import com.mogo.chat.model.bean.UserInfoBySns -import com.mogo.chat.model.control.ChatController -import com.mogo.chat.model.control.MatchController -import com.mogo.chat.model.control.VehicleTeamController -import com.mogo.chat.service.InvokeDataProxy.Companion.covertMapToSns -import com.mogo.chat.util.UserInfoHelper.currentCallType -import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.setCarOnLineStatus -import com.mogo.chat.util.trackHangUp -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.BaseResponse -import com.mogo.eagle.core.network.request - - -object ChatServiceHandler : BaseController() { - - fun call( - snReceiver: String, - onSuccess: (() -> Unit), - onError: ((Exception) -> Unit) - ) { - queryUserInfo(snReceiver, { - val map = Gson().fromJson>(it, Map::class.java) - val sns = covertMapToSns(map) - tmpSenderInfo = sns - }, { - log(TAG, "queryUserInfo is null ,reason : ${it.message}") - }) - getUserInfo({ - realCall(snReceiver, onSuccess, onError) - }, { exception -> - onError.invoke(exception) - }) - } - - private fun realCall( - snReceiver: String, - onSuccess: (() -> Unit), - onError: ((Exception) -> Unit) - ) { - ChatController.call(snReceiver, 0, { - onSuccess.invoke() - }, { exception -> - onError.invoke(exception) - }) - } - - fun hangUp(sn: String?, onSuccess: () -> Unit, onError: (Exception) -> Unit, roomId: Int = -1) { - log(TAG, "hangUp sn : $sn , tmpSenderInfo : ${tmpSenderInfo.sn}") - realHangUp(onSuccess, onError, roomId) - } - - fun refuseCall( - sn: String?, - onSuccess: () -> Unit, - onError: (Exception) -> Unit, - roomId: Int = -1 - ) { - var hangUpSn: String? = sn - if (hangUpSn.isNullOrBlank()) { - if (tmpSenderInfo.sn.isBlank()) { - return - } - hangUpSn = tmpSenderInfo.sn - } - realRefuse(hangUpSn, onSuccess, onError, roomId) - } - - private fun realHangUp(onSuccess: () -> Unit, onError: (Exception) -> Unit, roomId: Int = -1) { - log(TAG, "realHangUp currentCallType : $currentCallType ") - when { - currentCallType == CALL_TYPE_VEHICLE_TEAM -> { - trackHangUp(CALL_TYPE_VEHICLE_TEAM, "2") - log(TAG, "hangUp VehicleTeam") - VehicleTeamController.requestVehicleTeamConnectStatus( - MoGoAiCloudClientConfig.getInstance().sn, - PUSH_MSG_HANG_UP, - CALL_TYPE_VEHICLE_TEAM, - onSuccess, - onError - ) - } - GMEApi.isRoomEntered() || callTypeManager.callStatus.isCalling() -> { - trackHangUp(callTypeManager.callStatus.exchangeToCallType(), "2") - log(TAG, "hangUp Call") - ChatController.requestConnectStatus( - tmpSenderInfo.sn, - PUSH_MSG_HANG_UP, - onSuccess, - onError, - roomId - ) - } - else -> { - log( - TAG, "realHangUp " + - "currentCallStatus : ${callTypeManager.callStatus} + " + - "currentCallType : $currentCallType" - ) - } - } - } - - private fun realRefuse( - sn: String, - onSuccess: () -> Unit, - onError: (Exception) -> Unit, - roomId: Int = -1 - ) { - log(TAG, "realRefuse currentCallType : $currentCallType ") - when { - currentCallType == CALL_TYPE_VEHICLE_TEAM -> { - log(TAG, "refuse VehicleTeam") - VehicleTeamController.requestVehicleTeamConnectStatus( - sn, - PUSH_MSG_DENY_ENTER, - CALL_TYPE_VEHICLE_TEAM, - onSuccess, - onError - ) - } - callTypeManager.callStatus.isReadyCalling() -> { - log(TAG, "refuse call") - ChatController.requestConnectStatus( - sn, - PUSH_MSG_DENY_ENTER, - onSuccess, - onError, - roomId - ) - } - else -> { - log( - TAG, "realRefuse " + - "currentCallStatus : ${callTypeManager.callStatus} + " + - "currentCallType : $currentCallType" - ) - } - } - } - - fun answer( - sn: String, - roomId: Int, - onSuccess: (() -> Unit)? = null, - onError: ((Exception) -> Unit)? = null - ) { - log(TAG, "answer currentCallType ==== $currentCallType") - getUserInfo({ - when (currentCallType) { - CALL_TYPE_VEHICLE_TEAM -> { - VehicleTeamController.requestVehicleTeamConnectStatus( - sn, - PUSH_MSG_AGREE_ENTER, - CALL_TYPE_VEHICLE_TEAM, - { - onSuccess?.invoke() - }, - onError - ) - } - else -> { - ChatController.requestConnectStatus(sn, PUSH_MSG_AGREE_ENTER, { - ChatController.enterRoom(roomId) - onSuccess?.invoke() - }, onError, roomId) - } - } - }, { - onError?.invoke(it) - }) - } - - fun startMatch( - flag: String, - onSuccess: () -> Unit, - onError: (Exception) -> Unit, - timeOut: () -> Unit - ) { - getUserInfo({ - MatchController.startMatch(flag, onSuccess, onError, timeOut) - }, { exception -> - onError.invoke(exception) - }) - } - - fun cancelMatch(onSuccess: () -> Unit) { - MatchController.cancelMatch(onSuccess) - } - - fun inviteJoinVehicleTeam( - invitedSn: String, - onSuccess: () -> Unit, - onError: (Exception) -> Unit - ) { - VehicleTeamController.inviteJoinVehicleTeam(invitedSn, onSuccess, onError) - } - - fun isFriend(snReceiver: String, onSuccess: (Boolean) -> Unit, onError: (Exception) -> Unit) { - request> { - loader { - chatServiceModel.requestFocusStatus(snReceiver) - } - onSuccess { - onSuccess.invoke(it.result.isFocus == HAS_FOCUS) - } - onError { - onError.invoke(it) - } - } - } - - fun addFriend(snReceiver: String, onSuccess: () -> Unit, onError: (Exception) -> Unit) { - request> { - loader { - chatServiceModel.dealFocus(snReceiver) - } - onSuccess { - onSuccess.invoke() - } - onError { - onError.invoke(it) - } - } - } - - fun invisibleUser(status: Int, onSuccess: () -> Unit, onError: (Exception) -> Unit) { - request> { - loader { - chatServiceModel.switchCarStatus(status) - } - onSuccess { - setCarOnLineStatus(status == ONLINE_STATUS) - onSuccess.invoke() - } - onError { - onError.invoke(it) - } - } - } - - fun isOnLine(sn: String, onSuccess: (Boolean) -> Unit, onError: (Exception) -> Unit) { - request> { - loader { - chatServiceModel.isOnLine(sn) - } - onSuccess { - val onLineStatus = it.result - log(TAG, "onLineStatus : $onLineStatus") - onSuccess.invoke(onLineStatus.carOnLine == 1 && onLineStatus.onLine == 1) - } - onError { - onError.invoke(it) - } - } - } - - fun queryUserInfo( - sn: String, - onSuccess: (userInfo: String) -> Unit, - onError: (Exception) -> Unit - ) { - request> { - loader { - chatServiceModel.queryUserInfo(sn) - } - onSuccess { - val userInfoBySns = it.result - val info = userInfoBySns.info[0] - val map = InvokeDataProxy.convertUserInfoToInvokeMap(info) - val userData = Gson().toJson(map) - onSuccess.invoke(userData) - } - onError { - onError.invoke(it) - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/IMService.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/IMService.kt deleted file mode 100644 index 2dc33919fe..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/IMService.kt +++ /dev/null @@ -1,140 +0,0 @@ -package com.mogo.chat.service - -import android.app.Service -import android.content.Context -import android.content.Intent -import android.os.IBinder -import com.google.gson.Gson -import com.mogo.chat.callcenter.CallController.Companion.callController -import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager -import com.mogo.chat.callcenter.ConvertFactory.Companion.factory -import com.mogo.chat.callcenter.ICallMessage -import com.mogo.chat.callcenter.ICallTypeChangedListener -import com.mogo.chat.callcenter.IMType -import com.mogo.chat.callcenter.SocketClientFactory -import com.mogo.chat.constant.HttpConstants -import com.mogo.chat.constant.SOCKET_HAND_SHAKE -import com.mogo.chat.constant.SOCKET_HEART_BEAT -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.SocketMsg -import com.mogo.chat.model.control.ChatController -import com.mogo.chat.util.audio.AudioFocusUtil -import com.mogo.chat.util.log -import com.mogo.chat.util.sp.getRoomId -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.websocket.ISocketMsgCallBack -import com.mogo.websocket.ISocketMsgSetting -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch - - -class IMService : Service(), ICallMessage { - - companion object { - - fun launchService(context: Context) { - context.startService(Intent(context, IMService::class.java)) - } - } - - override fun onBind(intent: Intent): IBinder? { - return null - } - - override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - return START_STICKY - } - - override fun onCreate() { - super.onCreate() - log(TAG, "onCreate ---> ") - init() - } - - private fun init() { - AudioFocusUtil.getInstance().init(this) - //开启长连服务 - SocketClientFactory.socketClient.initSocketServer(HttpConstants.getSocketServer()) - SocketClientFactory.socketClient.getMessageSettings(socketMsgSetting) - SocketClientFactory.socketClient.addISocketMsgCallBack(socketMsgCallBack) - SocketClientFactory.socketClient.startConnect() - //更新用户信息 - ChatController.getUserInfo() - - callController.addCallBack(this.javaClass.simpleName, this) - // 注册状态回调,用来处理音频焦点 - callTypeManager.addCallTypeChangedListener(object : ICallTypeChangedListener { - override fun onCallTypeChanged(callType: IMType) { - log(TAG, "收到状态变化,处理音频焦点") - when (callType) { - IMType.INIT_CALL -> { - log(TAG, "回归初始化状态尝试释放焦点") - AudioFocusUtil.getInstance().releaseDuck() - } - IMType.READY_TO_CALL_RECEIVER, IMType.READY_TO_CALL_SENDER, IMType.READY_TO_MATCH_RECEIVER, IMType.MATCHING -> { - log(TAG, "准备接打电话,开始匹配需要抢占焦点") - AudioFocusUtil.getInstance().requireDuck() - } - else -> log(TAG, "不需要处理音频焦点") - } - } - }) - } - - private val socketMsgSetting: ISocketMsgSetting = object : ISocketMsgSetting { - override fun getHandShakeMsg(): String { - log(TAG, "getHandShakeMsg") - val socketMsg = SocketMsg(SOCKET_HAND_SHAKE, MoGoAiCloudClientConfig.getInstance().sn) - return Gson().toJson(socketMsg) - } - - override fun getHeartBeatMsg(): String { - log(TAG, "getHeartBeatMsg") - val socketMsg = - SocketMsg(SOCKET_HEART_BEAT, MoGoAiCloudClientConfig.getInstance().sn, getRoomId()) - return Gson().toJson(socketMsg) - } - } - - private val socketMsgCallBack: ISocketMsgCallBack = object : ISocketMsgCallBack { - override fun onConnectOpen() { - log(TAG, "onConnectOpen ---> ") - } - - override fun handleError(e: Exception) { - log(TAG, "handleError ---> msg: ${e.message}") - SocketClientFactory.socketClient.stopHeartBeat() - } - - override fun onConnectClose() { - log(TAG, "onConnectClose ---> stop web socket thread ,and ready to reconnect") - SocketClientFactory.socketClient.stop() - log(TAG, "onConnectClose ---> stop Heart Beat") - SocketClientFactory.socketClient.stopHeartBeat() - log(TAG, "ready to reconnect") - SocketClientFactory.socketClient.reConnect() - } - - override fun handleMessage(message: String) { - GlobalScope.launch(Dispatchers.Main) { - log(TAG, "handleMessage ---> $message") - factory.parseLongConnMsgToCallProxy(message) - } - } - } - - override fun onTrimMemory(level: Int) { - super.onTrimMemory(level) - log(TAG, "onTrimMemory ---> ") - } - - override fun onDestroy() { - super.onDestroy() - log(TAG, "onDestroy ---> ") - ChatController.updateExitRoomStatus() - SocketClientFactory.socketClient.disConnect() - AudioFocusUtil.getInstance().unInit(applicationContext) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/InvokeDataProxy.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/InvokeDataProxy.kt deleted file mode 100644 index 25a7ca8eb6..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/InvokeDataProxy.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.mogo.chat.service - -import com.mogo.chat.model.bean.Info -import com.mogo.chat.model.bean.Sns - - -class InvokeDataProxy { - - companion object { - - fun convertSnsToInvokeMap(sns: Sns): Map { - val map = hashMapOf() - map["sn"] = sns.sn - map["userName"] = sns.nickName ?: "" - map["userHead"] = sns.headImgUrl ?: "" - map["carTypeName"] = sns.carInfo ?: "" - map["gender"] = sns.cardIdSex ?: "" - map["location"] = sns.cityName ?: "" - map["age"] = sns.cardIdAge ?: "" - map["lat"] = sns.lat.toString() - map["lon"] = sns.lon.toString() - return map - } - - fun covertMapToSns(map: Map): Sns { - val sns = Sns() - sns.sn = map["sn"].toString() - sns.nickName = map["userName"] ?: "" - sns.headImgUrl = map["userHead"] ?: "" - sns.carInfo = map["carTypeName"] ?: "" - sns.cardIdSex = map["gender"] ?: "" - sns.cityName = map["location"] ?: "" - sns.cardIdAge = map["age"] ?: "" - sns.lat = map["lat"]?.toDouble() ?: 0.0 - sns.lon = map["lon"]?.toDouble() ?: 0.0 - return sns - } - - fun convertUserInfoToInvokeMap(info: Info): Map { - val map = hashMapOf() - map["sn"] = info.carAndUserInfoRedisVo.sn ?: "" - map["userName"] = info.carAndUserInfoRedisVo.userNickName ?: "" - map["userHead"] = info.carAndUserInfoRedisVo.headImgUrl ?: "" - map["carTypeName"] = info.carAndUserInfoRedisVo.lastBrandName ?: "" - map["gender"] = info.carAndUserInfoRedisVo.cardIdSex ?: "" - map["location"] = info.carAndUserInfoRedisVo.lastActiveCity ?: "" - map["age"] = info.carAndUserInfoRedisVo.cardIdAge ?: "" - map["lat"] = info.realTimeLocationVo.lat.toString() - map["lon"] = info.realTimeLocationVo.lon.toString() - return map - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/AnalyticsUtil.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/AnalyticsUtil.kt deleted file mode 100644 index 061946314e..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/AnalyticsUtil.kt +++ /dev/null @@ -1,101 +0,0 @@ -package com.mogo.chat.util - -import android.content.Context -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.chat.R -import com.mogo.chat.aspect.DebugLog -import com.mogo.chat.constant.CALL_TYPE_MATCHING -import com.mogo.chat.constant.CALL_TYPE_VIDEO -import com.mogo.chat.constant.CALL_TYPE_VOICE -import com.mogo.chat.util.sp.getRoomId -import com.mogo.chat.util.sp.getTalkTime -import com.mogo.chat.util.sp.recordCallTime -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.IMogoServiceApis -import com.mogo.service.analytics.IMogoAnalytics - -const val TRACK_APP_ENTER = "appenterfront" -const val TRACK_PHONE_CALL_CLICK = "carchat_carphone_call_click" -const val TRACK_VIDEO_CALL_CLICK = "carchat_carphone_video_click" -const val TRACK_CANCEL_CALL_CLICK = "carchat_cancel_call_click" -const val TRACK_MATCH_SUCCESS = "carchat_carphonecall_match_success" -const val TRACK_MATCH_FAIL = "carchat_carphonecall_match_fail" -const val TRACK_MATCH_CANCEL = "carchat_carphonecall_match_cancel_click" - -private var trackRouter: IMogoAnalytics? = null - -//自定义埋点 -@DebugLog -fun trackNormalEvent( - event: String, - data: MutableMap?) { - track(event,data) -} - -private fun track(eventType: String, data: MutableMap? = hashMapOf()) { - if (trackRouter == null) { - val aRouter = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() - if (aRouter is IMogoServiceApis) { - trackRouter = aRouter.analyticsApi - } - } - trackRouter!!.track(eventType, data) -} - - -@DebugLog -fun trackCall(callType: Int, type: Int) { - //记录开始语音、直播时间 - recordCallTime() - when (callType) { - CALL_TYPE_VOICE -> { - trackNormalEvent( - TRACK_PHONE_CALL_CLICK, - mutableMapOf("type" to type, "type_of_call" to "direct") - ) - } - CALL_TYPE_MATCHING -> { - trackNormalEvent( - TRACK_PHONE_CALL_CLICK, - mutableMapOf("type" to type, "type_of_call" to "match") - ) - } - CALL_TYPE_VIDEO -> { - trackNormalEvent(TRACK_VIDEO_CALL_CLICK, mutableMapOf("type" to type)) - } - else -> { - trackNormalEvent(TRACK_PHONE_CALL_CLICK, mutableMapOf("type" to type)) - } - } -} - -//todo -@DebugLog -fun trackHangUp(callType: Int, source: String = "1") { - when (callType) { - CALL_TYPE_VOICE -> { - trackNormalEvent( - TRACK_CANCEL_CALL_CLICK, - mutableMapOf( - "roomId" to getRoomId(), - "carphone_call_duration" to getTalkTime(), - "type_of_call" to "direct", - "source" to source - ) - ) - } - CALL_TYPE_MATCHING -> { - trackNormalEvent( - TRACK_CANCEL_CALL_CLICK, - mutableMapOf( - "roomId" to getRoomId(), - "carphone_call_duration" to getTalkTime(), - "type_of_call" to "match", - "source" to source - ) - ) - } - } - -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/CallTimer.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/CallTimer.kt deleted file mode 100644 index a352f1e4eb..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/CallTimer.kt +++ /dev/null @@ -1,61 +0,0 @@ -package com.mogo.chat.util - -import com.mogo.chat.constant.TAG -import kotlinx.coroutines.* -import java.util.* -import kotlin.concurrent.timerTask - - -class CallTimer private constructor() { - - companion object { - private const val TIMER_RATE = 1000.toLong()//每隔1秒刷新一次时间 - - val callTimer by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - CallTimer() - } - } - - private var mStartTime: Long = 0 - private var start: Boolean = false - private var timer: Timer? = null - private var job: Job? = null - - private var timerRate: ((Long) -> Unit)? = null //暂时仅有一处使用时间记录,后续如果有多处再使用集合 - private var onStop: (() -> Unit)? = null //暂时仅有一处使用时间记录,后续如果有多处再使用集合 - - fun registerTimerRate(timerRate: ((Long) -> Unit), onStop:() -> Unit) { - this.timerRate = timerRate - this.onStop = onStop - } - - fun start() { - if (start) { - log(TAG, "start : $start") - return - } - start = true - job = GlobalScope.async(Dispatchers.Default) { - if (timer == null) { - timer = Timer() - } - mStartTime = System.currentTimeMillis() - timer?.schedule(timerTask { - val timeLong = System.currentTimeMillis() - mStartTime - log(TAG, "times : $timeLong") - timerRate?.invoke(timeLong) - }, 0, TIMER_RATE) - } - } - - fun stop() { - if (start) { - onStop?.invoke() - job?.cancel() - timer?.cancel() - timer = null - mStartTime = 0 - start = false - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/DoubleCheckUtil.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/DoubleCheckUtil.kt deleted file mode 100644 index 34d750508b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/DoubleCheckUtil.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.mogo.chat.util - -const val SPACE_TIME = 1500 -var lastClickTime = 0L -var lastViewClickTime = 0L -var viewId: Int = 0 - -fun isDoubleClick(view: Int): Boolean { - val time = System.currentTimeMillis() - val timeD = time - lastViewClickTime - if (timeD < SPACE_TIME && viewId == view) { - return true - } - lastViewClickTime = time - viewId = view - return false -} - -fun isDoubleClick(): Boolean { - if (System.currentTimeMillis() - lastClickTime < SPACE_TIME) { - return true - } - lastClickTime = System.currentTimeMillis() - return false -} - -fun isDoubleClickTime(view: Int, spaceTime: Int): Boolean { - val time = System.currentTimeMillis() - val timeD = time - lastClickTime - if (timeD < spaceTime && viewId == view) { - return true - } - lastClickTime = time - viewId = view - return false -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/LogUtil.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/LogUtil.kt deleted file mode 100644 index 9b25199935..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/LogUtil.kt +++ /dev/null @@ -1,10 +0,0 @@ -@file:JvmName("LogUtil") - -package com.mogo.chat.util - -import com.mogo.chat.aspect.DebugLog - -@DebugLog -fun log(tag: String, msg: String) { - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/MediaController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/MediaController.kt deleted file mode 100644 index d1f7b9e7cf..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/MediaController.kt +++ /dev/null @@ -1,57 +0,0 @@ -package com.mogo.chat.util - -import android.content.Context -import android.media.AudioAttributes -import android.media.AudioManager -import android.media.MediaPlayer -import android.os.Build -import com.mogo.chat.constant.TAG - -object MediaController { - private var mp: MediaPlayer? = null - - fun startPlay(context: Context, audioSources: Int, isLoop: Boolean = false, channel:Int = AudioManager.STREAM_MUSIC) { - if (mp == null) { - mp = MediaPlayer() - } - resetStatus() - val file = context.resources.openRawResourceFd(audioSources) - mp?.apply { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - setAudioStreamType(channel) - } else { - setAudioAttributes(AudioAttributes.Builder().setLegacyStreamType(channel).build()) - } - setDataSource(file.fileDescriptor, file.startOffset, file.length) - file.close() - isLooping = isLoop - prepareAsync() - setOnPreparedListener { player -> - log(TAG,"real play 准备播放音频====") - player.start() - } - setOnCompletionListener { player -> - log(TAG,"播放完成====") - player.reset() - } - } - } - - fun release() { - log(TAG,"release 释放音频播放====") - if (mp != null) { - resetStatus() - mp!!.release() - mp = null - } - } - - private fun resetStatus() { - mp?.apply { - if (isPlaying) { - stop() - } - reset() - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/UserInfoHelper.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/UserInfoHelper.kt deleted file mode 100644 index 65dd81ab6c..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/UserInfoHelper.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.mogo.chat.util - -import com.mogo.chat.constant.CALL_TYPE_DEFAULT -import com.mogo.chat.constant.TAG -import com.mogo.chat.model.bean.Sns - - -object UserInfoHelper { - - var userInfo: Sns = Sns() - set(value) { - log(TAG, "个人信息更新:$value") - field = value - } - - - /** - * 是否是主动匹配 - */ - var isInitiativeMatch = false - - /** - * 仅为首次进入车聊聊,同步对方信息而创建的临时对象 - */ - var tmpSenderInfo: Sns = Sns() - set(value) { - log(TAG, "UserInfoHelper Sender Info update ---> $value") - field = value - } - - var currentRoomId = 0 - set(value) { - log(TAG, "UserInfoHelper setRoomId ---> $value") - field = value - } - - var currentCallType : Int = CALL_TYPE_DEFAULT - set(value) { - log(TAG, "UserInfoHelper setCallType ---> $value") - field = value - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/AudioFocusImpl.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/AudioFocusImpl.kt deleted file mode 100644 index ab98d0ba28..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/AudioFocusImpl.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.chat.util.audio - -import com.mogo.chat.util.audio.ChangAnAudioFocusImpl.Companion.changAnAudioFocusImpl -import com.mogo.chat.util.audio.MogoAudioFocusImpl.Companion.mogoAudioFocusImpl -import com.mogo.commons.debug.DebugConfig.* - -class AudioFocusImpl { - - companion object { - - fun getInstance(): IAudioFocus { - return if (getCarMachineType() == CAR_MACHINE_TYPE_SELF_INNOVATE - || getCarMachineType() == CAR_MACHINE_TYPE_BYD) { - mogoAudioFocusImpl - } else { - changAnAudioFocusImpl - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/AudioFocusUtil.java b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/AudioFocusUtil.java deleted file mode 100644 index 9088b2cc95..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/AudioFocusUtil.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.mogo.chat.util.audio; - - -import android.content.Context; -import android.media.AudioManager; - -import com.mogo.chat.callcenter.CallTypeManager; -import com.mogo.chat.callcenter.IMType; - -import static com.mogo.chat.util.LogUtil.log; - -public class AudioFocusUtil { - private static final String TAG = "AudioFocusUtil"; - private MyAudioFocusChangeListener audioListener; - private AudioManager audioManager; - - private AudioFocusUtil() { - - } - - public static class Holder { - - private Holder() { - - } - - private static final AudioFocusUtil instance = new AudioFocusUtil(); - } - - public static AudioFocusUtil getInstance() { - return Holder.instance; - } - - public void init(Context context) { - audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - audioListener = new MyAudioFocusChangeListener(); - AudioFocusImpl.Companion.getInstance().init(context); - } - - public boolean sendGetFocusIntent(Context context) { - return AudioFocusImpl.Companion.getInstance().sendGetFocusIntent(context); - } - - public void sendReleaseFocusIntent(Context context) { - AudioFocusImpl.Companion.getInstance().sendReleaseFocusIntent(context); - } - - public boolean findMicFocus(Context context) { - return AudioFocusImpl.Companion.getInstance().findMicFocus(context); - } - - private int getCurrentPriority(Context context) { - return AudioFocusImpl.Companion.getInstance().getCurrentPriority(context); - } - - public void unInit(Context context) { - AudioFocusImpl.Companion.getInstance().unInit(context); - } - - private volatile Boolean hasAudioFocus = false; - - public void requireDuck() { - log(TAG, "requireDuck===" + hasAudioFocus); - if (!hasAudioFocus) { - hasAudioFocus = true; - try { - audioManager.requestAudioFocus(audioListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void releaseDuck() { - log(TAG, "releaseDuck===" + hasAudioFocus); - if (hasAudioFocus) { - hasAudioFocus = false; - try { - audioManager.abandonAudioFocus(audioListener); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - private class MyAudioFocusChangeListener implements AudioManager.OnAudioFocusChangeListener { - - @Override - public void onAudioFocusChange(int focusChange) { - log(TAG, "onAudioFocusChange: " + focusChange); - switch (focusChange) { - case AudioManager.AUDIOFOCUS_GAIN: - hasAudioFocus = true; - if (CallTypeManager.Companion.getCallTypeManager().getCallStatus() == IMType.INIT_CALL) { - AudioFocusUtil.getInstance().releaseDuck(); - } - break; - case AudioManager.AUDIOFOCUS_LOSS: - case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: - case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: - hasAudioFocus = false; - break; - } - } - } -} diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/ChangAnAudioFocusImpl.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/ChangAnAudioFocusImpl.kt deleted file mode 100644 index 0bcc33a90d..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/ChangAnAudioFocusImpl.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.mogo.chat.util.audio - -import android.content.Context -import com.fce.micro.MicManager -import com.fce.micro.callback.MicroDef -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log - -class ChangAnAudioFocusImpl private constructor() : IAudioFocus { - - companion object { - - val changAnAudioFocusImpl by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - ChangAnAudioFocusImpl() - } - } - - override fun init(context:Context) { - MicManager.getInstance().initMicParam(context, MicroDef.MIC_DEBUNK) - MicManager.getInstance().setMicReleaseBack { - //收到该回调,表示有更高优先级应用使用mic,停止录音,释放mic - sendReleaseFocusIntent(context) - } - MicManager.getInstance().setMicObtainBack { - //APP收到此回调时开始录音 - log(TAG,"ChangAnAudioFocusImpl MicObtainBack : 可以开始录音了") - } - } - - override fun sendGetFocusIntent(context: Context) :Boolean{ - return MicManager.getInstance().requestMicSrc() - } - - override fun sendReleaseFocusIntent(context: Context) { - MicManager.getInstance().releaseMicSrc() - } - - override fun unInit(context: Context) { - MicManager.getInstance().releaseMicSrc() - } -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/IAudioFocus.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/IAudioFocus.kt deleted file mode 100644 index 39bf0835ef..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/IAudioFocus.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.mogo.chat.util.audio - -import android.content.Context - -interface IAudioFocus { - - fun init(context: Context) - - /** - * 查询麦克风焦点 - * 麦克风优先级 - * true,代表当前麦克风焦点在你这 - */ - fun findMicFocus(context: Context): Boolean { - return false - } - - /** - * 查询当前的麦克风使用的优先级 - * - * @return 麦克风优先级 - */ - fun getCurrentPriority(context: Context): Int { - return 0 - } - - /** - * 申请麦克风焦点 - */ - fun sendGetFocusIntent(context: Context):Boolean - - fun sendReleaseFocusIntent(context: Context) - - fun unInit(context: Context) -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/MogoAudioFocusImpl.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/MogoAudioFocusImpl.kt deleted file mode 100644 index c910f646b5..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/audio/MogoAudioFocusImpl.kt +++ /dev/null @@ -1,93 +0,0 @@ -package com.mogo.chat.util.audio - -import android.content.Context -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log -import com.zhidao.auto.micstrategy.MicStrategyManager -import com.zhidao.auto.micstrategy.MicStrategyManager.MicFocusListener -import com.zhidao.auto.micstrategy.MicStrategyManagerImpl - -class MogoAudioFocusImpl private constructor() : IAudioFocus { - - private var listener: MyMicFocusListener? = null - - companion object { - - val mogoAudioFocusImpl by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - MogoAudioFocusImpl() - } - } - - override fun init(context: Context) { - listener = MyMicFocusListener() - try { - if (listener == null) listener = MyMicFocusListener() - MicStrategyManagerImpl.getInstance(context).addMicFocusListener(listener) - } catch (e: Exception) { - e.printStackTrace() - } - } - - override fun findMicFocus(context: Context): Boolean { - super.findMicFocus(context) - var can = false - try { - can = MicStrategyManagerImpl.getInstance(context).findMicFocus(MicStrategyManager.VOIP_PRIORITY) - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - return can - } - - override fun getCurrentPriority(context: Context): Int { - return try { - MicStrategyManagerImpl.getInstance(context).currentPriority - } catch (e: java.lang.Exception) { - e.printStackTrace() - 0 - } - } - - override fun sendGetFocusIntent(context: Context):Boolean { - return try { - if (listener == null) listener = MyMicFocusListener() - MicStrategyManagerImpl.getInstance(context).requestMicFocus(MicStrategyManager.VOIP_PRIORITY, listener) - log(TAG, "sendGetFocusIntent: ") - true - } catch (e: java.lang.Exception) { - e.printStackTrace() - false - } - } - - override fun sendReleaseFocusIntent(context: Context) { - try { - if (listener == null) listener = MyMicFocusListener() - MicStrategyManagerImpl.getInstance(context).abandonMicFocus() - log(TAG, "sendReleaseFocusIntent: ") - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - - override fun unInit(context: Context) { - try { - if (listener != null) MicStrategyManagerImpl.getInstance(context).removeMicFocusListener(listener) - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - - class MyMicFocusListener : MicFocusListener { - /** - * 麦克风焦点状态 - * - * @param i - */ - override fun onMicFocuschanged(i: Int) { - //do nothing - } - } - - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/sp/BaseSP.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/sp/BaseSP.kt deleted file mode 100644 index 4acdb23ddb..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/sp/BaseSP.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.mogo.chat.util.sp - -import android.content.Context -import android.content.SharedPreferences -import androidx.core.content.edit -import com.mogo.commons.AbsMogoApplication - - -fun getSP(fileName: String): SharedPreferences { - return AbsMogoApplication.getApp().applicationContext.getSharedPreferences(fileName, Context.MODE_PRIVATE) -} - -inline fun getCommitSP(fileName: String, action: SharedPreferences.Editor.() -> Unit) { - getSP(fileName).edit(commit = true, action = action) -} - -inline fun getApplySp(fileName: String, action: SharedPreferences.Editor.() -> Unit) { - getSP(fileName).edit(commit = false, action = action) -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/sp/SharedPreferenceUtil.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/sp/SharedPreferenceUtil.kt deleted file mode 100644 index 6707cfce6b..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/util/sp/SharedPreferenceUtil.kt +++ /dev/null @@ -1,88 +0,0 @@ -@file:JvmName("SharedPreferenceUtil") - -package com.mogo.chat.util.sp - -const val TEMPORARY_FILE_NAME = "temporary_im_data" -const val FILE_NAME = "settings_im_data" - -const val PARAM_ROOM_ID = "PARAM_ROOM_ID" -const val PARAM_FRIEND_LIST_CALL = "PARAM_FRIEND_LIST_CALL" -const val PARAM_NEW_FOCUS = "PARAM_NEW_FOCUS" - -const val PARAM_VOICE_TYPE = "PARAM_VOICE_TYPE" -const val PARAM_CALL_TIME = "PARAM_CALL_TIME" -const val PARAM_CAR_ONLINE_STATUS = "PARAM_CAR_ONLINE_STATUS" - -fun saveRoomId(roomId: Int) { - getCommitSP(TEMPORARY_FILE_NAME) { - putInt(PARAM_ROOM_ID, roomId) - } -} - -fun hasRoomId(): Boolean { - return getSP(TEMPORARY_FILE_NAME).getInt(PARAM_ROOM_ID, 0) != 0 -} - -fun getRoomId(): Int { - return getSP(TEMPORARY_FILE_NAME).getInt(PARAM_ROOM_ID, 0) -} - -fun setCallFromFriendList(call: Boolean) { - getCommitSP(TEMPORARY_FILE_NAME) { - putBoolean(PARAM_FRIEND_LIST_CALL, call) - } -} - -fun hasCallFromFriendList(): Boolean { - return getSP(TEMPORARY_FILE_NAME).getBoolean(PARAM_FRIEND_LIST_CALL, false) -} - -fun hasFocus(): Boolean { - return getSP(TEMPORARY_FILE_NAME).getBoolean(PARAM_NEW_FOCUS, false) -} - -fun newFocus(focus: Boolean) { - getApplySp(TEMPORARY_FILE_NAME) { - putBoolean(PARAM_NEW_FOCUS, focus) - } -} - -fun setVoiceType(voiceType: Int) { - getApplySp(FILE_NAME) { - putInt(PARAM_VOICE_TYPE, voiceType) - } -} - -fun getVoiceType(): Int { - return getSP(FILE_NAME).getInt(PARAM_VOICE_TYPE, 0) -} - -fun setCarOnLineStatus(onLine: Boolean) { - getApplySp(FILE_NAME) { - putBoolean(PARAM_CAR_ONLINE_STATUS, onLine) - } -} - -/** - * 本地缓存的在线隐身状态 - */ -fun getCarOnLineStatus(): Boolean { - return getSP(FILE_NAME).getBoolean(PARAM_CAR_ONLINE_STATUS, true) -} - - -fun recordCallTime() { - getApplySp(FILE_NAME) { - putLong(PARAM_CALL_TIME, System.currentTimeMillis()) - } -} - -fun getTalkTime(): Long { - val startCallTime = getSP(FILE_NAME).getLong(PARAM_CALL_TIME, 0) - return if (startCallTime.toString() == "0") { - 0 - } else { - System.currentTimeMillis() - startCallTime - } -} - diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/voice/IMVoiceClient.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/voice/IMVoiceClient.kt deleted file mode 100644 index 79d1ee0d6c..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/voice/IMVoiceClient.kt +++ /dev/null @@ -1,79 +0,0 @@ -package com.mogo.chat.voice - -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log -import com.mogo.commons.AbsMogoApplication -import com.mogo.commons.voice.AIAssist -import com.mogo.commons.voice.IMogoVoiceCmdCallBack -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.IMogoServiceApis -import com.mogo.service.intent.IMogoIntentManager - - -object IMVoiceClient { - - private var intentRegister: IMogoIntentManager? = null - - private const val REQUEST_VOICE_CALL = "主人,有新的小伙伴找你聊天啦,你要接听吗?你可以说“接听”开启通话。或者说“挂断”结束通话" - private const val REQUEST_CLOUD_VOICE_CALL = "云平台请求跟你进行语音通话" - private val requestCallYArray: Array = arrayOf("接听") - private val requestCallNArray: Array = arrayOf("挂断") - - const val VOICE_INTENT_ANSWER_CALL = "com.ileja.phone.incoming.accept" //接听 - const val VOICE_INTENT_REFUSE_CALL = "com.ileja.phone.incoming.reject" //挂断(包括拨出时挂断和来电挂断) - - init { - log(TAG, "init") - val register = - ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() - if (register is IMogoServiceApis) { - intentRegister = register.intentManagerApi - } - } - - private var onCmdAgree: ((Boolean) -> Unit)? = null - - private var onSpeedFinish: (() -> Unit)? = null - - fun registerIntentInComingCall(listener: IVoiceIntentListener) { - intentRegister?.registerIntentListener(VOICE_INTENT_ANSWER_CALL, listener) - intentRegister?.registerIntentListener(VOICE_INTENT_REFUSE_CALL, listener) - } - - fun unRegisterIntentInComingCall(listener: IVoiceIntentListener) { - intentRegister?.unregisterIntentListener(VOICE_INTENT_ANSWER_CALL, listener) - intentRegister?.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, listener) - } - - fun speakAndRegisterCall(onCmdAgree: ((Boolean) -> Unit), onSpeedFinish: (() -> Unit)) { - IMVoiceClient.onCmdAgree = onCmdAgree - IMVoiceClient.onSpeedFinish = onSpeedFinish - AIAssist.getInstance(AbsMogoApplication.getApp().applicationContext).speakQAndACmd(REQUEST_CLOUD_VOICE_CALL, - requestCallYArray, requestCallNArray, object : IMogoVoiceCmdCallBack { - override fun onCmdAction(speakText: String?) { - super.onCmdAction(speakText) - log(TAG, "onCmdAction ---> ") - IMVoiceClient.onCmdAgree?.invoke(true) - } - - override fun onCmdCancel(speakText: String?) { - super.onCmdCancel(speakText) - log(TAG, "onCmdCancel ---> ") - IMVoiceClient.onCmdAgree?.invoke(false) - } - - override fun onSpeakEnd(speakText: String?) { - super.onSpeakEnd(speakText) - log(TAG, "onSpeakEnd ---> ") - IMVoiceClient.onSpeedFinish?.invoke() - } - }) - } - - fun releaseSpeakAndRegisterCallback() { - onCmdAgree = null - onSpeedFinish = null - } - -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/voice/IVoiceIntentListener.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/voice/IVoiceIntentListener.kt deleted file mode 100644 index f159453543..0000000000 --- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/voice/IVoiceIntentListener.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.mogo.chat.voice - -import android.content.Intent -import com.mogo.chat.constant.TAG -import com.mogo.chat.util.log -import com.mogo.chat.voice.IMVoiceClient.VOICE_INTENT_ANSWER_CALL -import com.mogo.chat.voice.IMVoiceClient.VOICE_INTENT_REFUSE_CALL -import com.mogo.service.intent.IMogoIntentListener - - -interface IVoiceIntentListener :IMogoIntentListener{ - - override fun onIntentReceived(intentStr: String?, intent: Intent?) { - log(TAG, "onIntentCommand intentStr:$intentStr") - when (intentStr) { - VOICE_INTENT_ANSWER_CALL -> { - onVoiceAnswerCall() - } - VOICE_INTENT_REFUSE_CALL -> { - onVoiceRefuseCall() - } - } - } - - fun onVoiceAnswerCall() - - fun onVoiceRefuseCall() -} \ No newline at end of file diff --git a/modules/mogo-module-chat/src/main/res/raw/call.mp3 b/modules/mogo-module-chat/src/main/res/raw/call.mp3 deleted file mode 100644 index b98f3bdc4b..0000000000 Binary files a/modules/mogo-module-chat/src/main/res/raw/call.mp3 and /dev/null differ diff --git a/modules/mogo-module-chat/src/main/res/raw/match1.mp3 b/modules/mogo-module-chat/src/main/res/raw/match1.mp3 deleted file mode 100644 index b5c4201b3c..0000000000 Binary files a/modules/mogo-module-chat/src/main/res/raw/match1.mp3 and /dev/null differ diff --git a/modules/mogo-module-chat/src/main/res/raw/match2.mp3 b/modules/mogo-module-chat/src/main/res/raw/match2.mp3 deleted file mode 100644 index 4f1d12ac7f..0000000000 Binary files a/modules/mogo-module-chat/src/main/res/raw/match2.mp3 and /dev/null differ diff --git a/modules/mogo-module-chat/src/main/res/raw/match3.mp3 b/modules/mogo-module-chat/src/main/res/raw/match3.mp3 deleted file mode 100644 index 7584d60f10..0000000000 Binary files a/modules/mogo-module-chat/src/main/res/raw/match3.mp3 and /dev/null differ diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java deleted file mode 100644 index 2e3b93492d..0000000000 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.mogo.module.common.animation; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; -import android.animation.ValueAnimator; -import android.content.Context; -import android.graphics.PointF; -import android.graphics.drawable.Drawable; -import android.os.Handler; -import android.util.AttributeSet; -import android.util.Log; -import android.view.View; -import android.view.ViewGroup; -import android.view.animation.LinearInterpolator; -import android.widget.ImageView; -import android.widget.RelativeLayout; - -import androidx.core.content.ContextCompat; - -import com.mogo.module.common.R; - -import java.util.Random; - -public class BezierAnimationView extends RelativeLayout implements View.OnClickListener { - private String TAG = "BezierAnimationView"; - private Context context; - private int[] animation_drawable = { - R.drawable.icon_common_heart_animation_vr00, - R.drawable.icon_map_marker_pondingl2, - R.drawable.icon_map_marker_living}; - private Random random = new Random(); - private int width = 180, height = 140; - private int drawableWidth, drawableHeight; - private int resource = 0; - private Handler handler = new Handler(); - private Runnable runnable; - - public BezierAnimationView(Context context) { - this(context, null); - } - - public BezierAnimationView(Context context, AttributeSet attributes) { - this(context, attributes, 0); - } - - public BezierAnimationView(Context context, AttributeSet attributes, int defStyleAttr) { - super(context, attributes, defStyleAttr); - this.context = context; - //3、设置点击事件 - setOnClickListener(this); - //4、获取点赞图片的宽高 - Drawable drawable = ContextCompat.getDrawable(context, R.drawable.icon_common_heart_animation_vr02); - drawableWidth = drawable.getIntrinsicWidth(); - drawableHeight = drawable.getIntrinsicHeight(); - } - - @Override - public void onClick(View view) { - runnable = new Runnable() { - @Override - public void run() { - try { - Log.d("点赞--", ""); - bezierAnimation(resource); - handler.postDelayed(this, 500); - } catch (Exception e) { - e.printStackTrace(); - } - } - }; - runnable.run(); - } - - public void bezierAnimationStart(){ - runnable = new Runnable() { - @Override - public void run() { - try { - Log.d("点赞--", ""); - bezierAnimation(resource); - handler.postDelayed(this, 500); - } catch (Exception e) { - e.printStackTrace(); - } - } - }; - runnable.run(); - } - - private void bezierAnimation(int resource) { - final ImageView imageView = new ImageView(context); - imageView.setBackgroundResource(animation_drawable[resource]); - RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); -// params.addRule(ALIGN_BOTTOM); - params.addRule(CENTER_HORIZONTAL); - imageView.setLayoutParams(params); - addView(imageView); - - /* - * 开始执行点赞效果 - * */ - AnimatorSet animatorSet = getAnimatorSet(imageView); - animatorSet.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - //3、动画执行后移除View - removeView(imageView); - } - }); - animatorSet.start(); - Log.d(TAG, "动画执行到--" + String.valueOf(resource)); - } - - private AnimatorSet getAnimatorSet(ImageView imageView) { - AnimatorSet enter = new AnimatorSet(); - - //1、缩放动画 - AnimatorSet scaleAnimator = new AnimatorSet(); - ObjectAnimator alpha = ObjectAnimator.ofFloat(imageView, "alpha", 0.3f, 1f); - ObjectAnimator scaleX = ObjectAnimator.ofFloat(imageView, "scaleX", 0.3f, 1f); - ObjectAnimator scaleY = ObjectAnimator.ofFloat(imageView, "scaleY", 0.3f, 1f); - scaleAnimator.setDuration(1000); - scaleAnimator.playTogether(alpha, scaleX, scaleY); - - //2、贝塞尔动画 - ValueAnimator bezierAnimator = getBezierAnimator(imageView); - - //3、两个动画按顺序播放 - enter.playSequentially(scaleAnimator, bezierAnimator); - return enter; - } - - /** - * 贝塞尔动画 - * - * @return - */ - private ValueAnimator getBezierAnimator(final ImageView imageView) { - - //1、构建贝塞尔曲线的四个点 - PointF point0 = new PointF((width - drawableWidth) / 2, height - drawableHeight); - PointF point1 = new PointF(random.nextInt(width), random.nextInt(height / 2)); - PointF point2 = new PointF(random.nextInt(width), random.nextInt(height / 2) + height / 2); - PointF point3 = new PointF(random.nextInt(width - drawableWidth), 0); - - //2、创建贝塞尔属性动画 - BezierEvaluator evaluator = new BezierEvaluator(point0, point1); - final ValueAnimator valueAnimator = ObjectAnimator.ofObject(evaluator, point2, point3); - valueAnimator.setInterpolator(new LinearInterpolator()); - valueAnimator.setDuration(1000); - //3、监听贝塞尔曲线估值器返回值 - valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - //4、获取BezierEvaluator中evaluate()返回的运行轨迹坐标点,设置点赞图片路线 - PointF pointF = (PointF) animation.getAnimatedValue(); - imageView.setX(pointF.x); - imageView.setY(pointF.y); - //6、获取BezierEvaluator中evaluate()返回的参数t,设置消失动画 - float t = animation.getAnimatedFraction(); - imageView.setAlpha(1 - t + 0.2f); - } - }); - if (resource >= 3) { - handler.removeCallbacks(runnable); - return null; - } else { - resource += 1; - } - return valueAnimator; - } - -} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java index 979189bf3e..a5bb265f81 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java @@ -43,7 +43,6 @@ class CallChatApi { public void showUserWindow( Context context, MarkerOnlineCar onlineCar ) throws Exception { // if ( mApiProvider == null ) { -// Logger.e( TAG, "no call chat api instance." ); // return; // } // MogoDriverInfo driverInfo = new MogoDriverInfo(); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/receiver/SnapShotMockTestPanelBroadCastReceiver.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/receiver/SnapShotMockTestPanelBroadCastReceiver.java index e109eac050..635efc8586 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/receiver/SnapShotMockTestPanelBroadCastReceiver.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/receiver/SnapShotMockTestPanelBroadCastReceiver.java @@ -4,7 +4,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.datacenter.RealTimeData; import com.mogo.module.common.datacenter.SnapshotLocationDataCenter; @@ -17,14 +16,10 @@ public class SnapShotMockTestPanelBroadCastReceiver extends BroadcastReceiver { */ public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType"; - private Context mContext; - @Override public void onReceive(Context context, Intent intent) { try { - this.mContext = context; int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0); - Logger.d(TAG, "textPanelOpenType:" + sceneType); // 分发场景 dispatchSceneTest(sceneType); } catch (Exception e) { @@ -39,7 +34,6 @@ public class SnapShotMockTestPanelBroadCastReceiver extends BroadcastReceiver { * @param sceneType 场景类型 */ private void dispatchSceneTest(int sceneType) { - Logger.d(TAG, "sceneType=" + sceneType); if (sceneType == 1) { //模拟顺义固定位置 RealTimeData.getInstance().setLat(39.968309); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java index 5915d510c6..4c047561dc 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/dialog/BaseFloatDialog.java @@ -2,14 +2,12 @@ package com.mogo.module.common.dialog; import android.app.Dialog; import android.content.Context; -import android.os.Build; import android.view.WindowManager; import androidx.annotation.NonNull; import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.MogoApisHandler; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.module.common.R; /** @@ -46,13 +44,13 @@ public class BaseFloatDialog extends Dialog { @Override public void show() { - Logger.d(TAG, "onShow===="); + CallerLogger.INSTANCE.d(TAG, "onShow===="); super.show(); } @Override public void dismiss() { - Logger.d(TAG, "onDismiss===="); + CallerLogger.INSTANCE.d( TAG, "onDismiss===="); super.dismiss(); } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java deleted file mode 100644 index 57d5e2d4ab..0000000000 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java +++ /dev/null @@ -1,347 +0,0 @@ -package com.mogo.module.common.drawer; - -import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS; - -import android.os.Build; -import android.text.TextUtils; -import android.util.Log; - -import com.mogo.cloud.commons.utils.CoordinateUtils; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.traffic.TrafficData; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.constants.DataTypes; -import com.mogo.module.common.utils.Trigonometric; - -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.TimeUnit; - -/** - * @author congtaowang - * @since 2020/10/28 - *

    - * 绘制adas近景识别到的车辆 - */ -public class AdasRecognizedResultDrawer extends BaseDrawer { - - private static final String TAG = "AdasRecognizedResultDrawer"; - - private static volatile AdasRecognizedResultDrawer sInstance; - - /** - * 上一帧数据的缓存 - */ - private static Map mMarkersCaches = new ConcurrentHashMap<>(); - - public AdasRecognizedResultDrawer() { - super(); - } - - private final Map mLastPositions = new ConcurrentHashMap<>(); - - public static AdasRecognizedResultDrawer getInstance() { - if (sInstance == null) { - synchronized (AdasRecognizedResultDrawer.class) { - if (sInstance == null) { - sInstance = new AdasRecognizedResultDrawer(); - } - } - } - return sInstance; - } - - public synchronized void release() { - sInstance = null; - } - - private Object readResolve() { - // 阻止反序列化,必须实现 Serializable 接口 - return sInstance; - } - - public boolean hasCached(String uniqueKey) { - return mMarkersCaches.containsKey(uniqueKey); - } - - /** - * 渲染 adas 识别的数据 - * - * @param resultList adas感知融合数据 - */ - public void renderAdasRecognizedResult(List resultList) { - - final long start = System.nanoTime(); - if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) { - clearOldMarker(); - Log.w("ADAS数据延时绘制", "resultList==>" + resultList + " DebugConfig.isUseAdasRecognize()==>" + DebugConfig.isUseAdasRecognize()); - return; - } - - if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - clearOldMarker(); - Log.w("ADAS数据延时绘制", "当前不是VR模式"); - return; - } - -// List allDatumsList = new ArrayList<>(); -// prepareData(resultList, allDatumsList); - - Map newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>(); - List newDiffSet = new ArrayList<>(); - for (TrafficData recognizedListResult : resultList) { - - if (isUselessValue(recognizedListResult)) { - continue; - } - // 复用之前存在的 marker - String uniqueKey = recognizedListResult.getUuid(); - IMogoMarker marker = mMarkersCaches.remove(uniqueKey); - if (marker != null && !marker.isDestroyed()) { -// Log.d(TAG, "发现缓存marker id : " + uniqueKey); - updateCacheMarkerRes(marker, recognizedListResult); - renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches); - } else { - // 新增添加进差集 - newDiffSet.add(recognizedListResult); - } - } - removeUselessMarker(mMarkersCaches); - removeUselessLastRecord(); - int newDiffSetSize = newDiffSet.size(); -// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize); - // 复用过期 marker - if (newDiffSetSize > 0) { - for (int i = 0; i < newDiffSetSize; i++) { - TrafficData recognizedListResult = newDiffSet.get(i); - String uniqueKey = recognizedListResult.getUuid(); - IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult); - if (marker == null) { - continue; - } -// Log.d(TAG, "新增marker id : " + uniqueKey); - renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches); - } - } - sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches); - mMarkersCaches.clear(); - mMarkersCaches = newAdasRecognizedMarkersCaches; - Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms"); - } - - /** - * 对数据补点 - * - * @param in - * @param out - */ - private void prepareData(List in, List out) { -// foreCastPoint(in); - out.addAll(in); - } - - private final static String FORECAST = "adasForecast"; - - /** - * 基于工控机识别的数据点速度预测当前位置和距离自车距离 - * - * @param in 数据源 - */ - private void foreCastPoint(List in) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - for (TrafficData adasResult : in) { - Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.getUuid()); - long internal = getCurSatelliteTime() - adasResult.getSatelliteTime(); - if (internal <= 0) { - Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.getUuid()); - continue; - } - long startTime = System.currentTimeMillis(); - // 预测点 - Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.getSpeed()); - double foreCastDistance = adasResult.getSpeed() * internal / 1000; - Log.d(FORECAST, "foreCastDistance : " + foreCastDistance); - MogoLatLng mogoLatLng = new MogoLatLng(adasResult.getLat(), adasResult.getLon()); - MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.getHeading()); - - // 计算与自车距离 - float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1] - , foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat()); - - long foreCastInternal = System.currentTimeMillis() - startTime; - Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成 - - adasResult.setLat(foreCastMogoLatLon.getLat()); - adasResult.setLon(foreCastMogoLatLon.getLon()); - adasResult.setSatelliteTime((getCurSatelliteTime() - foreCastInternal)); - adasResult.setDistance(distanceFromSelf); - } - } - } - - /** - * todo 后面涉及到此类变化的数据均改动 - * - * @param marker - * @param recognizedListResult - */ - private void updateCacheMarkerRes(IMogoMarker marker, TrafficData recognizedListResult) { - String resIdVal; - int resId = getModelRes(recognizedListResult.getType().getType()); - resIdVal = resId + ""; - String resName = mMarkerCachesResMd5Values.get(resIdVal); - if (!TextUtils.isEmpty(resName)) { - if (!TextUtils.equals(resName, marker.getMarkerResName())) { - marker.use3DResource(resName); - } - } else { - resName = marker.use3DResource(resId); - mMarkerCachesResMd5Values.put(resIdVal, resName); - } - } - - private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期 - if (mLastPositions.isEmpty()) { - return; - } - Iterator iterator = mLastPositions.values().iterator(); - while (iterator.hasNext()) { - TrafficData result = iterator.next(); - long internal = result.getSatelliteTime() - getCurSatelliteTime(); - if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象 - iterator.remove(); - } - } - } - - /** - * 过滤无用数据 - * - * @param recognizedListResult {@link TrafficData} - * @return useless - */ - private boolean isUselessValue(TrafficData recognizedListResult) { - if (recognizedListResult == null) { - return true; - } - if (nonRenderType(recognizedListResult.getType().getType())) { - return true; - } - String uniqueKey = recognizedListResult.getUuid(); - return TextUtils.isEmpty(uniqueKey); - } - - /** - * 绘制某个物体的一个数据 - * - * @param recognizedListResult {@link TrafficData} - * @param newAdasRecognizedMarkersCaches 缓存集合 - */ - private void renderAdasOneFrame(IMogoMarker marker, - String uniqueKey, - TrafficData recognizedListResult, - Map newAdasRecognizedMarkersCaches) { - final long start = System.nanoTime(); -// Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading); - TrafficData lastPosition = mLastPositions.remove(uniqueKey); - // 道路吸附 -// double lastLon = -1; -// double lastLat = -1; -// if (lastPosition != null) { -// lastLon = lastPosition.lon; -// lastLat = lastPosition.lat; -// } -// double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat); -// -// recognizedListResult.lon = matchLonLat[0]; -// recognizedListResult.lat = matchLonLat[1]; -// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start ); - - mLastPositions.put(uniqueKey, recognizedListResult); -// Log.d(TAG, "使用缓存 id : " + uniqueKey); - long interval = 45; - if (lastPosition != null) { - interval = computeAnimDuration(lastPosition.getSatelliteTime(), recognizedListResult.getSatelliteTime()); - } - final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon()); - long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); - //Log.d("ADAS动画数据", "cost : " + cost); - final long intervalRef = interval - cost; - //Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.getUuid()); - marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.getHeading(), intervalRef); - String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel()); - marker.setAnchorColor(carColor); - - newAdasRecognizedMarkersCaches.put(uniqueKey, marker); - -// if (shouldShowSpeed(recognizedListResult.type)) { -// Message msg = mRenderThreadHandler.obtainMessage(); -// msg.obj = new SpeedData(marker -// , recognizedListResult.speed -// , recognizedListResult.uuid -// , recognizedListResult.type -// , recognizedListResult.heading -// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()); -// msg.what = MSG_DISPLAY_SPEED; -// msg.sendToTarget(); -// } - Log.d("ADAS数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); - } - - /** - * 绘制 marker - * - * @param recognizedListResult {@link TrafficData} - * @return {@link IMogoMarker} - */ - private IMogoMarker drawAdasRecognizedDataMarker(TrafficData recognizedListResult) { - long start = System.nanoTime(); - if (recognizedListResult == null) { - return null; - } - - int resId = getModelRes(recognizedListResult.getType().getType()); - String resIdVal = resId + ""; - - String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel()); - MogoMarkerOptions options = new MogoMarkerOptions() - .owner(DataTypes.TYPE_MARKER_ADAS) - .anchor(0.5f, 0.5f) - .set3DMode(true) - .gps(true) - .anchorColor(carColor) - .controlAngle(true) - .resName(mMarkerCachesResMd5Values.get(resIdVal)) - .icon3DRes(resId) - .rotate((float) recognizedListResult.getHeading()) - .position(new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon())); - IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options); - cacheMarkerIconResMd5Val(resIdVal, marker); - Log.d("ADAS数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); - return marker; - } - - /** - * vr 模式切换 - */ - public void notifyVrModeChanged() { - clearOldMarker(); - } - - /** - * 清除旧的 marker 数据 - */ - public void clearOldMarker() { - if (mMarkersCaches != null) { - mMarkersCaches.clear(); - } - mLastPositions.clear(); - sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS); - } -} 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 14a5dc455b..112ada1a9b 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 @@ -239,11 +239,9 @@ public class BaseDrawer { */ public long computeAnimDuration(long lastSatelliteTime, long curSatelliteTime) { if (lastSatelliteTime == 0 || curSatelliteTime == 0) { - //Log.d("ADAS动画数据", "卫星时间存在错误"); return 45; } long interval = curSatelliteTime - lastSatelliteTime; - //Log.d("ADAS动画数据", "lastSatelliteTime : " + lastSatelliteTime +" ---- curSatelliteTime : " + curSatelliteTime + " ===== 插值 : " + interval); if (interval < 45) { interval = 45; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java index bab304721f..22be83ab23 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java @@ -6,11 +6,12 @@ import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.enums.TrafficTypeEnum; import com.mogo.eagle.core.data.traffic.TrafficData; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.module.common.MogoApisHandler; import java.util.ArrayList; +import java.util.List; import java.util.concurrent.ConcurrentHashMap; import mogo.telematics.pad.MessagePad; @@ -29,7 +30,7 @@ public class IdentifyDataDrawer { /** * 上一帧数据的缓存 */ - private static ConcurrentHashMap mMarkersCaches = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap mMarkersCaches = new ConcurrentHashMap<>(); /** * 已经感知不到的脏数据 @@ -69,16 +70,16 @@ public class IdentifyDataDrawer { * * @param resultList adas感知融合数据 */ - public void renderAdasRecognizedResult(ArrayList resultList) { + public void renderAdasRecognizedResult(List resultList) { if (resultList == null || resultList.isEmpty()) { clearOldMarker(); - Logger.w(TAG, "感知数据为空无需渲染……"); + CallerLogger.INSTANCE.w(TAG, "感知数据为空无需渲染……"); return; } if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { clearOldMarker(); - Logger.w(TAG, "渲染 adas 识别的数据 当前不是VR模式"); + CallerLogger.INSTANCE.w(TAG, "渲染 adas 识别的数据 当前不是VR模式"); return; } @@ -88,7 +89,7 @@ public class IdentifyDataDrawer { // 过滤掉未知感知数据 if (!FunctionBuildConfig.isDrawUnknownIdentifyData && trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) { - //Logger.w(TAG, "未知感知类型数据,丢弃,不渲染"); + //CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染"); continue; } trafficDataUuidList.add("" + trafficData.getUuid()); @@ -120,12 +121,12 @@ public class IdentifyDataDrawer { * * @return 过滤后的数据集合 */ - private ArrayList filterTrafficData(ArrayList trafficData) { + private ArrayList filterTrafficData(List trafficData) { mFilterTrafficData.clear(); for (MessagePad.TrackedObject data : trafficData) { // 过滤掉未知感知数据 if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) { - //Logger.w(TAG, "未知感知类型数据,丢弃,不渲染"); + //CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染"); continue; } mFilterTrafficData.add(data); @@ -148,7 +149,7 @@ public class IdentifyDataDrawer { } private void addPreVehicleModel() { - Logger.d(TAG, "添加感知模型到地图中……"); + CallerLogger.INSTANCE.d(TAG, "添加感知模型到地图中……"); addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi="); addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople="); @@ -176,13 +177,13 @@ public class IdentifyDataDrawer { .getMarkerManager(mContext) .addPreVehicleModel(typeTrafficIdWeiZhi.getType(), typeTrafficIdWeiZhi.getTraffic3DIconId()); - Logger.d(TAG, s + preVehicleStrWeiZhi); + CallerLogger.INSTANCE.d(TAG, s + preVehicleStrWeiZhi); if (preVehicleStrWeiZhi == null) { UiThreadHandler.postDelayed(new Runnable() { @Override public void run() { - Logger.w(TAG, "添加感知模型到地图中失败,尝试重复添加……"); + CallerLogger.INSTANCE.w(TAG, "添加感知模型到地图中失败,尝试重复添加……"); addPreVehicleModelWeiZhi(typeTrafficIdWeiZhi, s); } }, 1000L); 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 677a5d2651..8ad3349e4e 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 @@ -5,7 +5,6 @@ import android.text.TextUtils; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.MogoMarkerOptions; @@ -129,8 +128,6 @@ class MarkerDrawer { * @return */ public Map purgeMarkerData(List newList, String markerType) { - - final long start = System.currentTimeMillis(); Map existMap = new HashMap<>(); List allCarsList = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).getMarkers(markerType); if (allCarsList == null || allCarsList.isEmpty()) { @@ -163,7 +160,6 @@ class MarkerDrawer { } } allMap.clear(); - Logger.i("timer", "purge data cost " + (System.currentTimeMillis() - start) + "ms"); return existMap; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java index 7428d5c541..02d08f9bba 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java @@ -3,8 +3,6 @@ package com.mogo.module.common.drawer; import android.view.animation.LinearInterpolator; import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; @@ -67,7 +65,6 @@ class RoadConditionDrawer { } int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, exploreWayList ); Map< String, IMogoMarker > existCarMap = MarkerDrawer.getInstance().purgeMarkerData( exploreWayList, ModuleNames.CARD_TYPE_ROAD_CONDITION ); - Logger.i( TAG, "existCarMap: size = %d", existCarMap.size() ); for ( int i = 0; i < size; i++ ) { MarkerExploreWay markerExploreWay = exploreWayList.get( i ); if ( !markerExploreWay.getCanLive() ) { @@ -82,7 +79,6 @@ class RoadConditionDrawer { String sn = MarkerDrawer.getInstance().getPrimaryKeyFromEntity( markerExploreWay ); IMogoMarker mogoMarker = existCarMap.get( sn ); if ( mogoMarker == null || mogoMarker.isDestroyed() ) { - Logger.d( TAG, "draw road condition, sn = %s", sn ); try { if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, true, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener ); @@ -114,7 +110,6 @@ class RoadConditionDrawer { marker.startScaleAnimationWithAlpha( 0, 1.2f, 0, 1.2f, 0f, 1f, 300, new LinearInterpolator(), new OnMarkerAnimationListener() { @Override public void onAnimStart() { - Logger.d( TAG, " onAnimStart ---1----> " ); } @Override diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java index 00e2ba3d72..b1a812336d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java @@ -4,7 +4,6 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA; import android.os.Build; import android.text.TextUtils; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; @@ -14,7 +13,7 @@ import com.mogo.cloud.socket.entity.SocketDownData; import com.mogo.cloud.socket.entity.SocketDownDataHelper; import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.ViewUtils; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; @@ -84,7 +83,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic */ @Override public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - Logger.d(TAG, "%s - %s", descriptor, isTrue); mChangeCarModeStatus = true; sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches); removeUselessMarker(mMarkersCaches); @@ -185,7 +183,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic // 移除超时 marker delayRemoveUselessMarker(); removeUselessLastRecord(); - Log.d("云端数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms"); + CallerLogger.INSTANCE.d("云端数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms"); } /** @@ -221,7 +219,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic continue; } long internal = getCurSatelliteTime() - proto.getSatelliteTime(); - Log.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid() + CallerLogger.INSTANCE.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid() + " localTime : " + getCurSatelliteTime() + " originTime : " + proto.getSatelliteTime() + " internal : " + internal); @@ -308,7 +306,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic // msg.what = MSG_DISPLAY_SPEED; // msg.sendToTarget(); // } - Log.d("云端数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); + CallerLogger.INSTANCE.d("云端数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); } /** @@ -333,18 +331,18 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { for (SocketDownData.CloudRoadDataProto proto : in) { SocketDownData.CloudRoadDataProto.Builder builder = proto.toBuilder(); - Log.d(FORECAST, "ready to foreCast current uuid : " + proto.getUuid()); + CallerLogger.INSTANCE.d(FORECAST, "ready to foreCast current uuid : " + proto.getUuid()); long internal = getCurSatelliteTime() - builder.getSatelliteTime(); if (internal <= 0) { - Log.d(FORECAST, "time internal less than 0 , uuid : " + proto.getUuid()); + CallerLogger.INSTANCE.d(FORECAST, "time internal less than 0 , uuid : " + proto.getUuid()); out.add(proto); continue; } long startTime = System.currentTimeMillis(); // 预测点 - Log.d(FORECAST, "time internal : " + internal + " speed : " + proto.getSpeed()); + CallerLogger.INSTANCE.d(FORECAST, "time internal : " + internal + " speed : " + proto.getSpeed()); double foreCastDistance = proto.getSpeed() * internal / 1000; - Log.d(FORECAST, "foreCastDistance : " + foreCastDistance); + CallerLogger.INSTANCE.d(FORECAST, "foreCastDistance : " + foreCastDistance); MogoLatLng mogoLatLng = new MogoLatLng(proto.getWgslat(), proto.getWgslon()); MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, proto.getHeading()); @@ -353,7 +351,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic , foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat()); long foreCastInternal = System.currentTimeMillis() - startTime; - Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成 + CallerLogger.INSTANCE.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成 builder.setWgslat(foreCastMogoLatLon.getLat()); builder.setWgslon(foreCastMogoLatLon.getLon()); @@ -415,7 +413,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic if (!TextUtils.isEmpty(data.getSn())) { bindClickListener(marker); } - Log.d("云端数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); + CallerLogger.INSTANCE.d("云端数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); return marker; } @@ -481,7 +479,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic try { carChatting.showUserWindow(TAG, driverInfo, mContext); } catch (Exception e) { - Logger.e(TAG, e, "showCarCallPanel"); + CallerLogger.INSTANCE.e(TAG, e, "showCarCallPanel"); } }*/ } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt index a745f2dcc2..9e4083f26d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt @@ -11,7 +11,7 @@ import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.constants.DataTypes import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.data.enums.TrafficTypeEnum -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler import java.util.concurrent.ConcurrentHashMap @@ -135,7 +135,6 @@ object TrafficMarkerDrawer { } else { // 循环绘制识别的数据 mTrafficMap.forEach { - //Logger.d(TAG, "drawerCvxRvInfo:${it.value}") // 如果数据已经存在 Marker,取出做动画 if (mMarkersCaches[it.key] != null) { @@ -156,7 +155,7 @@ object TrafficMarkerDrawer { * 绘制单条 */ private fun drawObuRecognizedDataMarker(trafficData: TrafficData) { - Logger.d( + CallerLogger.d( TAG, "trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel ) @@ -220,7 +219,7 @@ object TrafficMarkerDrawer { marker: IMogoMarker, trafficData: TrafficData ) { - Logger.d( + CallerLogger.d( TAG, "trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel ) 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 f3693aae58..9eca458d44 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 @@ -1,27 +1,22 @@ package com.mogo.module.common.drawer; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.eagle.core.utilcode.util.ViewUtils; -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.EmptyMarkerView; -import com.mogo.module.common.drawer.marker.IMarkerView; -import com.mogo.module.common.drawer.marker.MapMarkerAdapter; -import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.common.utils.Trigonometric; -import com.mogo.module.common.view.MarkerBaseFloor; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.StatusDescriptor; - import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA; 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.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.module.common.entity.V2XWarningEntity; +import com.mogo.service.statusmanager.IMogoStatusChangedListener; +import com.mogo.service.statusmanager.StatusDescriptor; + /** * 云端 预警数据绘制 @@ -57,7 +52,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL @Override public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - Logger.d(TAG, "%s - %s", descriptor, isTrue); + CallerLogger.INSTANCE.d(TAG, descriptor + " , "+ isTrue); } public boolean isVrMode() { 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 c2060548f0..9c86e8b67d 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 @@ -6,14 +6,11 @@ import android.os.Looper; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; -import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.TextView; import androidx.annotation.Nullable; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.eagle.core.utilcode.util.ViewUtils; import com.mogo.eagle.core.utilcode.util.WindowUtils; @@ -61,37 +58,37 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV } @Override - public void setMarker( IMogoMarker marker ) { + public void setMarker(IMogoMarker marker) { this.mMarker = marker; } - protected abstract void initView( Context context); + protected abstract void initView(Context context); public abstract void updateView(MarkerShowEntity markerShowEntity); protected void loadImageWithMarker(final MarkerShowEntity markerShowEntity) { - if ( Looper.myLooper() != Looper.getMainLooper() ) { - UiThreadHandler.post( ()-> { - runOnUiThread( markerShowEntity ); + if (Looper.myLooper() != Looper.getMainLooper()) { + UiThreadHandler.post(() -> { + runOnUiThread(markerShowEntity); }); } else { - runOnUiThread( markerShowEntity ); + runOnUiThread(markerShowEntity); } } - protected void loadPoiTypeIcon(String url,int res) { + protected void loadPoiTypeIcon(String url, int res) { ivIcon.setImageResource(res); - if ( Looper.myLooper() != Looper.getMainLooper() ) { - UiThreadHandler.post( ()-> loadPoiTypeIconInUiThread(url, res)); + if (Looper.myLooper() != Looper.getMainLooper()) { + UiThreadHandler.post(() -> loadPoiTypeIconInUiThread(url, res)); } else { loadPoiTypeIconInUiThread(url, res); } } - private void loadPoiTypeIconInUiThread(String url,int res) { + private void loadPoiTypeIconInUiThread(String url, int res) { if (mMarker != null) { - mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this)); + mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this)); } if (!url.isEmpty()) { ivIcon.setPlaceHolder(res); @@ -108,7 +105,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV public void onCompleted(Bitmap bitmap) { // 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置 if (mMarker != null) { - mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this)); + mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this)); } } @@ -119,7 +116,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV } } - private void runOnUiThread(final MarkerShowEntity markerShowEntity){ + private void runOnUiThread(final MarkerShowEntity markerShowEntity) { if (!TextUtils.isEmpty(markerShowEntity.getIconUrl())) { MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(markerShowEntity.getIconUrl(), ivUserHead, @@ -132,21 +129,19 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV @Override public void onCompleted(Bitmap bitmap) { - Logger.d(TAG, "loadImageWithMarker loaded."); // 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置 - if ( mMarker != null ) { - mMarker.setIcon( ViewUtils.fromView( MapMarkerBaseView.this ) ); + if (mMarker != null) { + mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this)); } } @Override public void onFailure(Exception e) { - Logger.e(TAG, "loadImageWithMarker onFailure."); } }); } else { - ivUserHead.setBackgroundResource( R.drawable.icon_default_user_head); + ivUserHead.setBackgroundResource(R.drawable.icon_default_user_head); } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java index a2c30a16ff..926c452112 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java @@ -10,18 +10,17 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.Nullable; -import androidx.constraintlayout.widget.ConstraintLayout; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.ModuleNames; import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.R; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerShareMusic; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.marker.PoiWrapper; import com.mogo.module.common.utils.CloudPoiManager; -import com.mogo.module.common.R; /** * author : donghongyu @@ -37,98 +36,98 @@ public class MapMarkerInfoView extends MapMarkerBaseView { private LinearLayout clMarkerContent; private ImageView ivReverseTriangle; - public MapMarkerInfoView( Context context ) { - super( context ); + public MapMarkerInfoView(Context context) { + super(context); } - public MapMarkerInfoView( Context context, @Nullable AttributeSet attrs ) { - super( context, attrs ); + public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); } - public MapMarkerInfoView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { - super( context, attrs, defStyleAttr ); + public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); } - public MapMarkerInfoView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) { - super( context ); + public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) { + super(context); mOptions = options; try { - updateView( markerShowEntity ); - } catch ( Exception e ) { + updateView(markerShowEntity); + } catch (Exception e) { e.printStackTrace(); } } @Override - protected void initView( Context context ) { - LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout_info, this ); - ivUserHead = findViewById( R.id.ivUserHead ); + protected void initView(Context context) { + LayoutInflater.from(context).inflate(R.layout.modudle_services_marker_layout_info, this); + ivUserHead = findViewById(R.id.ivUserHead); // ivIcon = findViewById( R.id.ivIcon ); - ivIcon = findViewById( R.id.ivIcon ); - clMarkerContent = findViewById( R.id.clMarkerContent ); - ivReverseTriangle = findViewById( R.id.ivReverseTriangle ); - ivCar = findViewById( R.id.ivCar ); - tvMarkerContent = findViewById( R.id.tvMarkerContent ); + ivIcon = findViewById(R.id.ivIcon); + clMarkerContent = findViewById(R.id.clMarkerContent); + ivReverseTriangle = findViewById(R.id.ivReverseTriangle); + ivCar = findViewById(R.id.ivCar); + tvMarkerContent = findViewById(R.id.tvMarkerContent); } @Override - public void updateView( MarkerShowEntity markerShowEntity ) { + public void updateView(MarkerShowEntity markerShowEntity) { Object bindObj = markerShowEntity.getBindObj(); - if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { - ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr ); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow_vr); } else { - ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); + ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow); } - clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info ); - ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow ); - switch ( markerShowEntity.getMarkerType() ) { + clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_yellow_info); + ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_yellow); + switch (markerShowEntity.getMarkerType()) { case ModuleNames.CARD_TYPE_CARS_CHATTING: case ModuleNames.CARD_TYPE_USER_DATA: - ivUserHead.setVisibility( View.VISIBLE ); - ivIcon.setVisibility( View.INVISIBLE ); - loadImageWithMarker( markerShowEntity ); - ivCar.setImageResource( R.drawable.icon_map_marker_car_gray ); + ivUserHead.setVisibility(View.VISIBLE); + ivIcon.setVisibility(View.INVISIBLE); + loadImageWithMarker(markerShowEntity); + ivCar.setImageResource(R.drawable.icon_map_marker_car_gray); //ivCar.setRotation(new Random().nextInt(360)); - ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() ); + ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle()); break; case ModuleNames.CARD_TYPE_ROAD_CONDITION: case ModuleNames.CARD_TYPE_NOVELTY: - ivUserHead.setVisibility( View.INVISIBLE ); - ivIcon.setVisibility( View.VISIBLE ); + ivUserHead.setVisibility(View.INVISIBLE); + ivIcon.setVisibility(View.VISIBLE); - if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) { + if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) { // 根据poiType获取对应的图片 - String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType(); + String poiType = ((MarkerExploreWay) bindObj).getPoiType(); PoiWrapper poiWrapper = - CloudPoiManager.getInstance().getWrapperByPoiType( poiType ); - if ( poiWrapper != null ) { + CloudPoiManager.getInstance().getWrapperByPoiType(poiType); + if (poiWrapper != null) { // 加载图片 - loadPoiTypeIcon( poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes() ); + loadPoiTypeIcon(poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes()); } else { - Logger.e( TAG, "未能根据poiType获取对应poi信息,无法渲染info marker====" + poiType ); + CallerLogger.INSTANCE.e(TAG, "未能根据poiType获取对应poi信息,无法渲染info marker====" + poiType); } } break; case ModuleNames.CARD_TYPE_SHARE_MUSIC: - ivUserHead.setVisibility( View.INVISIBLE ); - ivIcon.setVisibility( View.VISIBLE ); + ivUserHead.setVisibility(View.INVISIBLE); + ivIcon.setVisibility(View.VISIBLE); - if ( bindObj instanceof MarkerShareMusic ) { + if (bindObj instanceof MarkerShareMusic) { // 2 为书籍听书,3 为新闻,1 为qq音乐,int - switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) { + switch (((MarkerShareMusic) bindObj).getShareType()) { case 1: - ivIcon.setImageResource( R.drawable.icon_map_marker_misic ); + ivIcon.setImageResource(R.drawable.icon_map_marker_misic); break; case 2: - ivIcon.setImageResource( R.drawable.icon_map_marker_book ); + ivIcon.setImageResource(R.drawable.icon_map_marker_book); break; case 3: - ivIcon.setImageResource( R.drawable.icon_map_marker_news ); + ivIcon.setImageResource(R.drawable.icon_map_marker_news); break; default: - ivIcon.setImageResource( R.drawable.icon_map_marker_misic ); + ivIcon.setImageResource(R.drawable.icon_map_marker_misic); break; } } @@ -137,14 +136,14 @@ public class MapMarkerInfoView extends MapMarkerBaseView { default: break; } - if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) { + if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) { String content; - if ( markerShowEntity.getTextContent().length() > 8 ) { - content = markerShowEntity.getTextContent().substring( 0, 7 ) + "..."; + if (markerShowEntity.getTextContent().length() > 8) { + content = markerShowEntity.getTextContent().substring(0, 7) + "..."; } else { content = markerShowEntity.getTextContent(); } - tvMarkerContent.setText( content ); + tvMarkerContent.setText(content); } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java index 24d063ad37..e4ef877160 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java @@ -7,7 +7,7 @@ import android.widget.FrameLayout; import androidx.annotation.Nullable; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.ModuleNames; import com.mogo.module.common.MogoApisHandler; @@ -83,7 +83,7 @@ public class MapMarkerView extends MapMarkerBaseView { // 加载图片 loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() ); } else { - Logger.e( TAG, "未能根据poiType获取对应poi信息,无法渲染marker====" + poiType ); + CallerLogger.INSTANCE.e( TAG, "未能根据poiType获取对应poi信息,无法渲染marker====" + poiType ); } } break; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/RoadConditionInfoWindow3DAdapter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/RoadConditionInfoWindow3DAdapter.java deleted file mode 100644 index 70c9db6123..0000000000 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/RoadConditionInfoWindow3DAdapter.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mogo.module.common.drawer.marker; - -import android.content.Context; -import android.view.View; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.map.marker.IMogoInfoWindowAdapter; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.module.common.entity.MarkerShowEntity; - -public -/** - * @author congtaowang - * @since 2020/12/15 - * - * 描述 - */ -class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter { - - private static final String TAG = "RoadConditionInfoWindow3DAdapter"; - - private MarkerShowEntity mEntity; - private Context mContext; - private MogoMarkerOptions mOptions; - - public RoadConditionInfoWindow3DAdapter( MarkerShowEntity entity, - Context context, - MogoMarkerOptions options ) { - this.mEntity = entity; - this.mContext = context; - this.mOptions = options; - } - - @Override - public View getInfoWindow( IMogoMarker marker ) { - Logger.d( TAG, "创建marker的infowindow" ); - IMarkerView creator = MapMarkerAdapter.getMarkerInfoWindowView( mContext, mEntity, mOptions ); - return creator.getView(); - } -} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/error/ARoutDegradeService.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/error/ARoutDegradeService.java deleted file mode 100644 index 35ae9e3412..0000000000 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/error/ARoutDegradeService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mogo.module.common.error; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.Postcard; -import com.alibaba.android.arouter.facade.service.DegradeService; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; - -/** - * 自定义当个 ARouter 加载失败的服务 - * @author donghongyu - */ -public class ARoutDegradeService implements DegradeService { - private String TAG = this.getClass().getSimpleName(); - - @Override - public void onLost(Context context, Postcard postcard) { - Logger.w(TAG, "postcard:" + postcard); - - } - - @Override - public void init(Context context) { - } -} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/CloudPoiManager.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/CloudPoiManager.java index 84dfe13882..a6d6dad15c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/CloudPoiManager.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/CloudPoiManager.java @@ -5,7 +5,7 @@ import android.content.Context; import android.util.ArrayMap; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.module.common.R; import com.mogo.module.common.enums.EventTypeEnum; @@ -92,7 +92,7 @@ public class CloudPoiManager { String config = SharedPrefsMgr.getInstance(context).getString("SHARE_BUTTON_CONFIG", ""); if (!config.isEmpty()) { List configWrappers = GsonUtil.arrayFromJson(config, PoiWrapper.class); - Logger.d(TAG, "config: " + configWrappers); + 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); @@ -104,11 +104,11 @@ public class CloudPoiManager { wrapper.setIconInfoRes(defWrapper.getIconInfoRes()); } } - Logger.d(TAG, "put===" + wrapper); + CallerLogger.INSTANCE.d(TAG, "put===" + wrapper); poiWrapper.put(wrapper.getPoiType(), wrapper); } } else { - Logger.e(TAG, "解析configWrapper异常: " + config); + CallerLogger.INSTANCE.e(TAG, "解析configWrapper异常: " + config); } } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/DrivingDirectionUtils.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/DrivingDirectionUtils.java index 9974cb2b13..a2514c954a 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/DrivingDirectionUtils.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/DrivingDirectionUtils.java @@ -25,7 +25,6 @@ public class DrivingDirectionUtils { int poiAngle = 0; // 以子午线作为y轴 计算两点的余切 再将余切值转化为角度 double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI); - //Log.w(MODULE_NAME, "getDegreeOfCar2Poi_计算车辆行驶方向 与 poi点到车辆的连线 间的夹角_angle===" + _angle); if (poiLon > carLon) { // poi 在 车辆位置的第1象限 if (poiLat > carLat) { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/LinearLayoutCommonManager.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/LinearLayoutCommonManager.java deleted file mode 100644 index 5029ba62a0..0000000000 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/LinearLayoutCommonManager.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mogo.module.common.view; - -import android.content.Context; -import android.util.AttributeSet; -import android.util.Log; - -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -public class LinearLayoutCommonManager extends LinearLayoutManager { - public LinearLayoutCommonManager(Context context) { - super(context); - } - - public LinearLayoutCommonManager(Context context, int orientation, boolean reverseLayout) { - super(context, orientation, reverseLayout); - } - - public LinearLayoutCommonManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { - try { - super.onLayoutChildren(recycler, state); - } catch (IndexOutOfBoundsException e) { - Log.d("V2XLinearLayoutManager", "崩溃信息--"+e.toString()); - } - } -} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/DialogImpl.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/DialogImpl.java index 236902e7b8..57522c11e2 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/DialogImpl.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/DialogImpl.java @@ -5,7 +5,6 @@ import android.app.Dialog; import android.view.View; import android.view.ViewGroup; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.dialog.BaseFloatDialog; /** @@ -17,10 +16,8 @@ class DialogImpl implements IWindowManagerView { @Override public void init(WindowManagerView.WMViewParams params) { - Logger.d("DialogImpl", "init===="); dialog = new BaseFloatDialog(params.mContext); contentView = params.mContentView; - Logger.d("DialogImpl", "params view : " + contentView); dialog.setContentView(contentView); } diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr00.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr00.png deleted file mode 100644 index 5246d61ccc..0000000000 Binary files a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr00.png and /dev/null differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr02.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr02.png deleted file mode 100644 index 5246d61ccc..0000000000 Binary files a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr02.png and /dev/null differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_map_marker_living.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_map_marker_living.png deleted file mode 100644 index d6f1dea192..0000000000 Binary files a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_map_marker_living.png and /dev/null differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_map_marker_pondingl2.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_map_marker_pondingl2.png deleted file mode 100755 index 478232ac79..0000000000 Binary files a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_map_marker_pondingl2.png and /dev/null differ diff --git a/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml b/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml deleted file mode 100644 index f5838417a5..0000000000 --- a/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-main/build.gradle b/modules/mogo-module-main/build.gradle deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java index ad567ab4bf..8830e4f793 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java @@ -2,7 +2,6 @@ package com.mogo.module.service; import android.content.Context; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerManager; import com.mogo.map.uicontroller.IMogoMapUIController; @@ -136,6 +135,5 @@ public class MarkerServiceHandler { */ @Deprecated public static void highlightedMarker(String typeTag) { - Logger.w(TAG, "do not invoke this method any more."); } } 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 34ee8d95d2..13f4fb89f3 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 @@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; @@ -95,7 +94,6 @@ public class MogoServiceProvider implements IMogoModuleProvider { @Override public void init( Context context ) { - Logger.d( TAG, "init" ); MarkerServiceHandler.init( context ); MogoServices.getInstance().preInit( context ); MogoServices.getInstance().init( AbsMogoApplication.getApp() ); 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 index bfc05e9303..ef09c2f548 100644 --- 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 @@ -1,5 +1,7 @@ package com.mogo.module.service; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_OTHER; + import android.content.Context; import android.content.Intent; import android.content.IntentFilter; @@ -9,7 +11,6 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.text.TextUtils; -import android.util.Log; import android.view.MotionEvent; import com.mogo.commons.debug.DebugConfig; @@ -17,7 +18,7 @@ import com.mogo.commons.voice.AIAssist; import com.mogo.commons.voice.IMogoVoiceCmdCallBack; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.map.IDestroyable; @@ -144,38 +145,38 @@ public class MogoServices implements IMogoMapListener, */ private boolean mLoopRequest = false; - private final Handler mHandler = new MainLooperHandler( Looper.getMainLooper() ) { + private final Handler mHandler = new MainLooperHandler(Looper.getMainLooper()) { @Override - protected void handleRefreshDecrease( Message msg ) { - if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { + protected void handleRefreshDecrease(Message msg) { + if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) { invokeAutoRefreshStrategy(); return; } mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL; - if ( mRefreshRemainingTime <= 0 ) { - Logger.d( TAG, "move to center and refresh data." ); + if (mRefreshRemainingTime <= 0) { + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "move to center and refresh data."); invokeAutoRefresh(); } else { - mHandler.sendEmptyMessageDelayed( msg.what, ServiceConst.DECREASE_INTERVAL ); + mHandler.sendEmptyMessageDelayed(msg.what, ServiceConst.DECREASE_INTERVAL); } } @Override - protected void handleLoopRequestMessage( Message msg ) { - if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { + protected void handleLoopRequestMessage(Message msg) { + if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) { return; } - if ( mLoopRequest ) { - Logger.d( TAG, "补偿刷新触发" ); + if (mLoopRequest) { + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "补偿刷新触发"); invokeAutoRefresh(); } } }; public RefreshModel getRefreshModel() { - if ( mRefreshModel == null ) { - mRefreshModel = new RefreshModel( mContext ); + if (mRefreshModel == null) { + mRefreshModel = new RefreshModel(mContext); } return mRefreshModel; } @@ -184,16 +185,16 @@ public class MogoServices implements IMogoMapListener, * 自动刷新:锁车、缩放比例:16、半径 2KM */ private void invokeAutoRefresh() { - if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { - mStatusManager.setUserInteractionStatus( TAG, true, false ); + if (mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow()) { + mStatusManager.setUserInteractionStatus(TAG, true, false); mUiController.recoverLockMode(); return; } - mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); - mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); - mStatusManager.setUserInteractionStatus( TAG, true, false ); + mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false); + mUiController.changeZoom(ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL); + mStatusManager.setUserInteractionStatus(TAG, true, false); mUiController.recoverLockMode(); - notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback ); + notifyRefreshData(mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback); } private Context mContext; @@ -211,13 +212,13 @@ public class MogoServices implements IMogoMapListener, /** * 手动刷新回调 */ - private final RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() { + private final RefreshCallback mCustomRefreshCallback = new RefreshCallback() { @Override - public void onSuccess( MarkerResponse o ) { - MapMarkerManager.getInstance().onSyncMarkerResponse( o ); + public void onSuccess(MarkerResponse o) { + MapMarkerManager.getInstance().onSyncMarkerResponse(o); mLoopRequest = false; // 用户手动操作地图刷新成功后,设置状态为 true,引发延时策略 - mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true ); + mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, true); } @Override @@ -229,19 +230,19 @@ public class MogoServices implements IMogoMapListener, /** * 自动刷新回调 */ - private final RefreshCallback mAutoRefreshCallback = new RefreshCallback< MarkerResponse >() { + private final RefreshCallback mAutoRefreshCallback = new RefreshCallback() { @Override - public void onSuccess( MarkerResponse o ) { - MapMarkerManager.getInstance().onSyncMarkerResponse( o ); + public void onSuccess(MarkerResponse o) { + MapMarkerManager.getInstance().onSyncMarkerResponse(o); mLoopRequest = false; invokeAutoRefreshStrategy(); } @Override public void onFail() { - if ( mLoopRequest ) { - Logger.d( TAG, "onFail and loop" ); - mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOOP_REQUEST, ServiceConst.LOOP_INTERVAL ); + if (mLoopRequest) { + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onFail and loop"); + mHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOOP_REQUEST, ServiceConst.LOOP_INTERVAL); } else { invokeAutoRefreshStrategy(); } @@ -249,7 +250,7 @@ public class MogoServices implements IMogoMapListener, }; private void invokeAutoRefreshStrategy() { - restartAutoRefreshAtTime( mAutoRefreshStrategy.getInterval() ); + restartAutoRefreshAtTime(mAutoRefreshStrategy.getInterval()); } private Handler mThreadHandler; @@ -257,144 +258,144 @@ public class MogoServices implements IMogoMapListener, private final IMogoStatusChangedListener statusChangedListener = new StatusChangedAdapter() { @Override - public void onSearchUIShow( boolean visible ) { - if ( visible ) { + public void onSearchUIShow(boolean visible) { + if (visible) { // 搜索时,不在自动刷新打点策略 stopAutoRefreshStrategy(); } else { // 搜索后,打开打点策略 - if ( mAutoRefreshCallback != null ) { - mAutoRefreshCallback.onSuccess( null ); + if (mAutoRefreshCallback != null) { + mAutoRefreshCallback.onSuccess(null); } } } }; - public void preInit( Context context ) { + public void preInit(Context context) { mContext = context; - mRefreshModel = new RefreshModel( context ); + mRefreshModel = new RefreshModel(context); mMogoMapService = MarkerServiceHandler.getMapService(); mUiController = mMogoMapService.getMapUIController(); mStatusManager = MarkerServiceHandler.getMogoStatusManager(); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.VR_MODE, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener ); - mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener ); - mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() ); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_RESUME, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.VR_MODE, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener); + mStatusManager.registerStatusChangedListener(ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener); + mStatusManager.setAIAssistReady(TAG, AIAssist.getInstance(mContext).hasFlush()); } - public void init( Context context ) { + public void init(Context context) { initWorkThread(); - registerMogoReceiver( context ); + registerMogoReceiver(context); registerInternalUnWakeupWords(); mRegisterCenter = MarkerServiceHandler.getRegisterCenter(); - mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this ); - mRegisterCenter.registerMogoLocationListener( ServiceConst.TYPE, this ); - mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this ); - mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this ); + mRegisterCenter.registerMogoMapListener(ServiceConst.TYPE, this); + mRegisterCenter.registerMogoLocationListener(ServiceConst.TYPE, this); + mRegisterCenter.registerMogoNaviListener(ServiceConst.TYPE, this); + mRegisterCenter.registerCarLocationChangedListener(ServiceConst.TYPE, this); mActionManager = MarkerServiceHandler.getActionManager(); mIntentManager = MarkerServiceHandler.getIntentManager(); - mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_UI, this ); - mIntentManager.registerIntentListener( ServiceConst.COMMAND_NEXT, this ); - mIntentManager.registerIntentListener( ServiceConst.COMMAND_PREVIOUS, this ); - mIntentManager.registerIntentListener( ServiceConst.COMMAND_SWITCH_CARD, this ); - mIntentManager.registerIntentListener( ServiceConst.COMMAND_MY_LOCATION, this ); - mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_READY, this ); - mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOCK, this ); - mIntentManager.registerIntentListener( ServiceConst.COMMAND_BACK, this ); - mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, this ); - mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_SEND, this ); - mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOGO, this ); - mIntentManager.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, this ); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_UI, this); + mIntentManager.registerIntentListener(ServiceConst.COMMAND_NEXT, this); + mIntentManager.registerIntentListener(ServiceConst.COMMAND_PREVIOUS, this); + mIntentManager.registerIntentListener(ServiceConst.COMMAND_SWITCH_CARD, this); + mIntentManager.registerIntentListener(ServiceConst.COMMAND_MY_LOCATION, this); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_READY, this); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_MOCK, this); + mIntentManager.registerIntentListener(ServiceConst.COMMAND_BACK, this); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, this); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_AUTO_NAVI_SEND, this); + mIntentManager.registerIntentListener(MogoReceiver.ACTION_MOGO, this); + mIntentManager.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this); mFragmentManager = MarkerServiceHandler.getFragmentManager(); - mFragmentManager.addMainFragmentStackTransactionListener( this ); + mFragmentManager.addMainFragmentStackTransactionListener(this); - Intent intent = new Intent( "com.freedom.ser.ACTION" ); - intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES ); - mContext.sendBroadcast( intent ); + Intent intent = new Intent("com.freedom.ser.ACTION"); + intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); + mContext.sendBroadcast(intent); - if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) { - MoGoAiCloudRealTime.startRealTime( mContext, DebugConfig.getSocketAppId() ); + if (DebugConfig.isNeedUploadCoordinatesDurationInTime()) { + MoGoAiCloudRealTime.startRealTime(mContext, DebugConfig.getSocketAppId()); } } private void initWorkThread() { - mThreadHandler = new RefreshWorkThreadHandler( WorkThreadHandler.getInstance().getLooper() ) { + mThreadHandler = new RefreshWorkThreadHandler(WorkThreadHandler.getInstance().getLooper()) { @Override - protected void handleMapChangedMessage( Message msg ) { - if ( msg.obj instanceof RefreshObject ) { - RefreshObject ro = ( ( RefreshObject ) msg.obj ); - if ( invokeRefreshWhenTranslationByUser( ro.mLonLat ) ) { - notifyRefreshData( ro.mLonLat, ro.mRadius, ro.mCallback ); + protected void handleMapChangedMessage(Message msg) { + if (msg.obj instanceof RefreshObject) { + RefreshObject ro = ((RefreshObject) msg.obj); + if (invokeRefreshWhenTranslationByUser(ro.mLonLat)) { + notifyRefreshData(ro.mLonLat, ro.mRadius, ro.mCallback); mLastCustomRefreshCenterLocation = ro.mLonLat; } } } @Override - protected void handleRequestDataMessage( Message msg ) { - if ( msg.obj instanceof RefreshObject ) { - RefreshObject ro = ( ( RefreshObject ) msg.obj ); - if ( ro.mLonLat == null ) { + protected void handleRequestDataMessage(Message msg) { + if (msg.obj instanceof RefreshObject) { + RefreshObject ro = ((RefreshObject) msg.obj); + if (ro.mLonLat == null) { invokeAutoRefreshStrategy(); - Logger.w( TAG, "lonLat is null." ); + CallerLogger.INSTANCE.w(M_OLD_OTHER + TAG, "lonLat is null."); return; } //请求大而全数据,刷新地图POI - mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback ); - Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount ); + mRefreshModel.refreshExplorerWayData(ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback); + CallerLogger.INSTANCE.i(M_OLD_OTHER + TAG, "刷新半径 = " + ro.mRadius + ", 点 = " + ro.mLonLat + " , zoomLevel = " + mLastZoomLevel + ", amount = " + ro.mAmount); } } }; } - private void registerMogoReceiver( Context context ) { - if ( context == null ) { + private void registerMogoReceiver(Context context) { + if (context == null) { return; } - List< MogoModule > modules = MogoModulePaths.getModules(); + List modules = MogoModulePaths.getModules(); if (modules.isEmpty()) { return; } - mAIAssistReceiver = new MogoReceiver( context ); + mAIAssistReceiver = new MogoReceiver(context); IntentFilter filter = new IntentFilter(); if (!modules.isEmpty()) { - for ( MogoModule module : modules ) { - if ( TextUtils.isEmpty( module.getBroadcastAction() ) ) { + for (MogoModule module : modules) { + if (TextUtils.isEmpty(module.getBroadcastAction())) { continue; } - filter.addAction( module.getBroadcastAction() ); + filter.addAction(module.getBroadcastAction()); } } - filter.addAction( MogoReceiver.VOICE_ACTION ); + filter.addAction(MogoReceiver.VOICE_ACTION); // 小智语音 - filter.addAction( MogoReceiver.ACTION_VOICE_UI ); - filter.addAction( MogoReceiver.ACTION_VOICE_READY ); - filter.addAction( MogoReceiver.ACTION_MOCK ); - filter.addAction( Intent.ACTION_CLOSE_SYSTEM_DIALOGS ); - filter.addAction( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER ); - filter.addAction( MogoReceiver.ACTION_AUTO_NAVI_SEND ); - filter.addAction( MogoReceiver.ACTION_MOGO ); - filter.addAction( ConnectivityManager.CONNECTIVITY_ACTION ); + filter.addAction(MogoReceiver.ACTION_VOICE_UI); + filter.addAction(MogoReceiver.ACTION_VOICE_READY); + filter.addAction(MogoReceiver.ACTION_MOCK); + filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); + filter.addAction(MogoReceiver.ACTION_AUTO_NAVI_RECEIVER); + filter.addAction(MogoReceiver.ACTION_AUTO_NAVI_SEND); + filter.addAction(MogoReceiver.ACTION_MOGO); + filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); try { - context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error. " ); + context.getApplicationContext().registerReceiver(mAIAssistReceiver, filter); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_OLD_OTHER + TAG, "registerMogoReceiver error : " + e); } } @@ -404,7 +405,7 @@ public class MogoServices implements IMogoMapListener, } private void initMapStatus() { - if ( mIsMapStatusOk ) { + if (mIsMapStatusOk) { return; } try { @@ -412,7 +413,7 @@ public class MogoServices implements IMogoMapListener, float height = getMapCameraFactHeight(); mIsVertical = width < height; mIsMapStatusOk = true; - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } @@ -422,8 +423,8 @@ public class MogoServices implements IMogoMapListener, */ private float getMapCameraFactWidth() { try { - return Utils.calculateLineDistance( mCameraNorthEastPosition, new MogoLatLng( mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon ) ); - } catch ( Exception e ) { + return Utils.calculateLineDistance(mCameraNorthEastPosition, new MogoLatLng(mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon)); + } catch (Exception e) { return ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS; } } @@ -433,55 +434,55 @@ public class MogoServices implements IMogoMapListener, */ private float getMapCameraFactHeight() { try { - return Utils.calculateLineDistance( mCameraSouthWestPosition, new MogoLatLng( mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon ) ); - } catch ( Exception e ) { + return Utils.calculateLineDistance(mCameraSouthWestPosition, new MogoLatLng(mCameraNorthEastPosition.lat, mCameraSouthWestPosition.lon)); + } catch (Exception e) { return ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS; } } @Override - public void onTouch( MotionEvent motionEvent ) { - switch ( motionEvent.getActionMasked() ) { + public void onTouch(MotionEvent motionEvent) { + switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: - if ( mLastZoomLevel == 0 ) { + if (mLastZoomLevel == 0) { mLastZoomLevel = mUiController.getZoomLevel(); } break; case MotionEvent.ACTION_UP: - restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT, false ); - mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR ); - mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT ); + restartAutoRefreshAtTime(ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT, false); + mThreadHandler.removeMessages(ServiceConst.MSG_LOCK_CAR); + mThreadHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT); break; } } public void stopAutoRefreshStrategy() { - stopAutoRefreshStrategy( true ); + stopAutoRefreshStrategy(true); } - private void stopAutoRefreshStrategy( boolean stopOnlineCarRefresh ) { - mHandler.removeMessages( ServiceConst.MSG_TYPE_REFRESH_DECREASE ); - if ( stopOnlineCarRefresh ) { + private void stopAutoRefreshStrategy(boolean stopOnlineCarRefresh) { + mHandler.removeMessages(ServiceConst.MSG_TYPE_REFRESH_DECREASE); + if (stopOnlineCarRefresh) { MapMarkerManager.getInstance().stopAutoRefresh(); } } @Override - public void onLockMap( boolean isLock ) { - mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR ); - if ( !isLock ) { - mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT ); + public void onLockMap(boolean isLock) { + mThreadHandler.removeMessages(ServiceConst.MSG_LOCK_CAR); + if (!isLock) { + mThreadHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT); } } @Override - public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) { + public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) { - MapMarkerManager.getInstance().syncLocation( latLng.lon, latLng.lat ); + MapMarkerManager.getInstance().syncLocation(latLng.lon, latLng.lat); - Logger.d( TAG, "zoom = %s", zoom ); + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "zoom = " + zoom); - if ( mIsCameraInited ) { + if (mIsCameraInited) { mLastZoomLevel = zoom; mLastCustomRefreshCenterLocation = latLng; mIsCameraInited = false; @@ -491,40 +492,40 @@ public class MogoServices implements IMogoMapListener, // 部分非用户操作导致地图视图变化:绘线、圈点等不触发用户刷新 // 消费状态 - if ( mStatusManager.isUserInteracted() ) { + if (mStatusManager.isUserInteracted()) { mLastCustomRefreshCenterLocation = latLng; mLastZoomLevel = zoom; return; } // v2x // adas 状态下不做任何操作 - if ( mStatusManager.isV2XShow() ) { + if (mStatusManager.isV2XShow()) { mLastCustomRefreshCenterLocation = latLng; mLastZoomLevel = zoom; return; } // 搜索页面显示时不做任何策略 - if ( mStatusManager.isSearchUIShow() ) { + if (mStatusManager.isSearchUIShow()) { mLastCustomRefreshCenterLocation = latLng; mLastZoomLevel = zoom; return; } // 手动刷新触发 - if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) { + if (mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel()) { // 缩放级别缩小 - notifyRefreshData( latLng, getQueryRadius(), mCustomRefreshCallback ); + notifyRefreshData(latLng, getQueryRadius(), mCustomRefreshCallback); mLastCustomRefreshCenterLocation = latLng; mLastZoomLevel = zoom; - } else if ( mLastZoomLevel - zoom < 0 ) { + } else if (mLastZoomLevel - zoom < 0) { mLastZoomLevel = zoom; - } else if ( mLastZoomLevel == zoom ) { + } else if (mLastZoomLevel == zoom) { // 手动平移 Message msg = Message.obtain(); msg.what = ServiceConst.MSG_MAP_CHANGED; - msg.obj = new RefreshObject( mCustomRefreshCallback, getQueryRadius(), latLng, 0 ); - mThreadHandler.sendMessage( msg ); + msg.obj = new RefreshObject(mCustomRefreshCallback, getQueryRadius(), latLng, 0); + mThreadHandler.sendMessage(msg); } } @@ -532,10 +533,10 @@ public class MogoServices implements IMogoMapListener, mCameraSouthWestPosition = mUiController.getCameraSouthWestPosition(); mCameraNorthEastPosition = mUiController.getCameraNorthEastPosition(); int radius; - if ( mIsVertical ) { - radius = ( ( int ) ( getMapCameraFactWidth() / 2 ) ); + if (mIsVertical) { + radius = ((int) (getMapCameraFactWidth() / 2)); } else { - radius = ( ( int ) ( getMapCameraFactHeight() / 2 ) ); + radius = ((int) (getMapCameraFactHeight() / 2)); } return Math.max(radius, 1000); } @@ -543,66 +544,66 @@ public class MogoServices implements IMogoMapListener, /** * 平移地图刷新策略 */ - private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) { + private boolean invokeRefreshWhenTranslationByUser(MogoLatLng latLng) { try { float factor; - if ( mIsVertical ) { + if (mIsVertical) { factor = getMapCameraFactWidth(); } else { factor = getMapCameraFactHeight(); } - if ( factor == 0.0f ) { + if (factor == 0.0f) { return false; } - float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation ); - return distance > ( factor / 2 ); - } catch ( Exception e ) { - Logger.e( TAG, e, "warming. " ); + float distance = Utils.calculateLineDistance(latLng, mLastCustomRefreshCenterLocation); + return distance > (factor / 2); + } catch (Exception e) { + CallerLogger.INSTANCE.e(M_OLD_OTHER + TAG, "invokeRefreshWhenTranslationByUser warming : " + e); return false; } } @Override - public void onLocationChanged( MogoLocation location ) { + public void onLocationChanged(MogoLocation location) { - if ( !DebugConfig.isMapBased() ) { + if (!DebugConfig.isMapBased()) { return; } - if ( !mStatusManager.isMainPageLaunched() ) { + if (!mStatusManager.isMainPageLaunched()) { return; } - if ( !mStatusManager.isMainPageOnResume() ) { + if (!mStatusManager.isMainPageOnResume()) { return; } - if ( mStatusManager.isV2XShow() ) { + if (mStatusManager.isV2XShow()) { return; } - if ( mStatusManager.isSearchUIShow() ) { + if (mStatusManager.isSearchUIShow()) { return; } - if ( location == null ) { + if (location == null) { return; } // 自动刷新触发 - final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() ); - if ( mLastAutoRefreshLocation == null ) { - startFirstLocationRequest( point ); + final MogoLatLng point = new MogoLatLng(location.getLatitude(), location.getLongitude()); + if (mLastAutoRefreshLocation == null) { + startFirstLocationRequest(point); return; } - float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point ); - if ( distance > mAutoRefreshStrategy.getDistance() ) { - mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); + float distance = Utils.calculateLineDistance(mLastAutoRefreshLocation, point); + if (distance > mAutoRefreshStrategy.getDistance()) { + mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false); mUiController.recoverLockMode(); - mStatusManager.setUserInteractionStatus( TAG, true, false ); - mUiController.changeZoom( ServiceConst.DEFAULT_ZOOM_LEVEL ); + mStatusManager.setUserInteractionStatus(TAG, true, false); + mUiController.changeZoom(ServiceConst.DEFAULT_ZOOM_LEVEL); mLastAutoRefreshLocation = point; - notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback ); + notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback); } } @@ -611,99 +612,99 @@ public class MogoServices implements IMogoMapListener, * * @param point {@link MogoLatLng} */ - private void startFirstLocationRequest( MogoLatLng point ) { + private void startFirstLocationRequest(MogoLatLng point) { mLastAutoRefreshLocation = point; mLoopRequest = true; - notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback ); + notifyRefreshData(mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback); } @Override - public void onCarLocationChanged2( Location latLng ) { - if ( latLng == null ) { + public void onCarLocationChanged2(Location latLng) { + if (latLng == null) { return; } // poi 定位无法获取时,使用该定位 - if ( mLastAutoRefreshLocation == null ) { - MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() ); - startFirstLocationRequest( point ); + if (mLastAutoRefreshLocation == null) { + MogoLatLng point = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); + startFirstLocationRequest(point); } } /** * 刷新数据 */ - private void notifyRefreshData( MogoLatLng latLng, int radius, RefreshCallback callback ) { - if ( !mStatusManager.isMainPageLaunched() ) { + private void notifyRefreshData(MogoLatLng latLng, int radius, RefreshCallback callback) { + if (!mStatusManager.isMainPageLaunched()) { return; } - if ( !mStatusManager.isMainPageOnResume() ) { + if (!mStatusManager.isMainPageOnResume()) { return; } - if ( mStatusManager.isSearchUIShow() ) { + if (mStatusManager.isSearchUIShow()) { return; } int amount = 20; Message msg = Message.obtain(); msg.what = ServiceConst.MSG_REQUEST_DATA; - msg.obj = new RefreshObject( callback, radius, latLng, amount ); - if ( mThreadHandler != null ) { - mThreadHandler.sendMessage( msg ); + msg.obj = new RefreshObject(callback, radius, latLng, amount); + if (mThreadHandler != null) { + mThreadHandler.sendMessage(msg); } } - public void restartAutoRefreshAtTime( long time ) { - restartAutoRefreshAtTime( time, true ); + public void restartAutoRefreshAtTime(long time) { + restartAutoRefreshAtTime(time, true); } public void clearAllData() { try { - MarkerServiceHandler.getMapService().getMarkerManager( mContext ).removeMarkers(); - } catch ( Exception e ) { + MarkerServiceHandler.getMapService().getMarkerManager(mContext).removeMarkers(); + } catch (Exception e) { e.printStackTrace(); } } - private void restartAutoRefreshAtTime( long time, boolean stopOnlineCarRefresh ) { - if ( time < 0 ) { - Logger.w( TAG, "refresh request case time < 0, set to 0 and go on." ); + private void restartAutoRefreshAtTime(long time, boolean stopOnlineCarRefresh) { + if (time < 0) { + CallerLogger.INSTANCE.w(M_OLD_OTHER + TAG, "refresh request case time < 0, set to 0 and go on."); time = 0; } - stopAutoRefreshStrategy( stopOnlineCarRefresh ); + stopAutoRefreshStrategy(stopOnlineCarRefresh); mRefreshRemainingTime = time; long delay = ServiceConst.DECREASE_INTERVAL; - if ( mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL ) { + if (mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL) { delay = mRefreshRemainingTime; } - if ( time == 0 ) { + if (time == 0) { invokeAutoRefresh(); } else { - mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay ); + mHandler.sendEmptyMessageDelayed(ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay); } } public void refreshStrategy() { - mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); + mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false); mUiController.recoverLockMode();// 锁车代替移到中心点 - restartAutoRefreshAtTime( 0 ); + restartAutoRefreshAtTime(0); } @Override - public void onIntentReceived( String command, Intent intent ) { + public void onIntentReceived(String command, Intent intent) { - if ( ServiceConst.COMMAND_NEXT.equals( command ) ) { - onActionDone( MogoAction.Next ); - } else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) { - onActionDone( MogoAction.Prev ); + if (ServiceConst.COMMAND_NEXT.equals(command)) { + onActionDone(MogoAction.Next); + } else if (ServiceConst.COMMAND_PREVIOUS.equals(command)) { + onActionDone(MogoAction.Prev); } else { - if ( TextUtils.equals( command, ConnectivityManager.CONNECTIVITY_ACTION ) - && NetworkUtils.isConnected( mContext ) ) { - mIntentManager.unregisterIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, this ); + if (TextUtils.equals(command, ConnectivityManager.CONNECTIVITY_ACTION) + && NetworkUtils.isConnected(mContext)) { + mIntentManager.unregisterIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this); } - IntentHandlerFactory.getInstance().handle( mContext, command, intent ); + IntentHandlerFactory.getInstance().handle(mContext, command, intent); } } @@ -711,96 +712,96 @@ public class MogoServices implements IMogoMapListener, * 注册桌面免唤醒指令 */ public void registerInternalUnWakeupWords() { - if ( mInternalUnWakeupRegisterStatus ) { + if (mInternalUnWakeupRegisterStatus) { return; } mInternalUnWakeupRegisterStatus = true; - AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, ServiceConst.CMD_UN_WAKEUP_WORDS_MY_LOCATION, this ); + AIAssist.getInstance(mContext).registerUnWakeupCommand(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, ServiceConst.CMD_UN_WAKEUP_WORDS_MY_LOCATION, this); } /** * 注销桌面免唤醒指令 */ public void unregisterInternalUnWakeupWords() { - if ( !mInternalUnWakeupRegisterStatus ) { + if (!mInternalUnWakeupRegisterStatus) { return; } mInternalUnWakeupRegisterStatus = false; - AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, this ); + AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, this); } @Override - public void onCmdSelected( String cmd ) { - if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) { - onActionDone( MogoAction.Prev ); - } else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) { - onActionDone( MogoAction.Next ); - } else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd ) ) { - if ( mStatusManager.isMainPageOnResume() ) { + public void onCmdSelected(String cmd) { + if (TextUtils.equals(ServiceConst.CMD_UN_WAKE_PREV, cmd)) { + onActionDone(MogoAction.Prev); + } else if (TextUtils.equals(ServiceConst.CMD_UN_WAKE_NEXT, cmd)) { + onActionDone(MogoAction.Next); + } else if (TextUtils.equals(ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd)) { + if (mStatusManager.isMainPageOnResume()) { mUiController.recoverLockMode(); } - } else if ( TextUtils.equals( ServiceConst.CMD_BACK, cmd ) ) { + } else if (TextUtils.equals(ServiceConst.CMD_BACK, cmd)) { mFragmentManager.clearAll(); } } - private void onActionDone( MogoAction action ) { - if ( !mStatusManager.isMainPageOnResume() ) { + private void onActionDone(MogoAction action) { + if (!mStatusManager.isMainPageOnResume()) { return; } - if ( mStatusManager.isV2XShow() ) { + if (mStatusManager.isV2XShow()) { // 分发到V2X - mActionManager.invoke( "V2X_UI", action ); + mActionManager.invoke("V2X_UI", action); } else { String biz = MapMarkerManager.getInstance().getCurrentModuleName(); - mActionManager.invoke( biz, action ); + mActionManager.invoke(biz, action); } } @Override - public void onTransaction( int size ) { - if ( size == 0 ) { - mUiController.showMyLocation( true ); - AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK ); - if ( mStatusManager.isSearchUIShow() ) { - mStatusManager.setSearchUIShow( TAG, false ); + public void onTransaction(int size) { + if (size == 0) { + mUiController.showMyLocation(true); + AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ServiceConst.CMD_BACK); + if (mStatusManager.isSearchUIShow()) { + mStatusManager.setSearchUIShow(TAG, false); } mUiController.recoverLockMode(); } else { - mUiController.showMyLocation( false ); - AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this ); + mUiController.showMyLocation(false); + AIAssist.getInstance(mContext).registerUnWakeupCommand(ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this); } } @Override public void onStartNavi() { - if ( DebugConfig.isIsScheduleCalculateNotHomeCompanyDistanceForPush() ) { - Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush" ); - scheduleCalculationNotHomeCompanyDistanceForPush( 1, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH ); + if (DebugConfig.isIsScheduleCalculateNotHomeCompanyDistanceForPush()) { + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush"); + scheduleCalculationNotHomeCompanyDistanceForPush(1, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH); } else { - Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush un support" ); + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush un support"); } } @Override public void onStopNavi() { - Logger.d( TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg" ); - mHandler.removeMessages( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH ); + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg"); + mHandler.removeMessages(ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH); } /** * 延时一分钟发起计算导航目的地推送策略 */ - public void scheduleCalculationNotHomeCompanyDistanceForPush( int time, long delay ) { + public void scheduleCalculationNotHomeCompanyDistanceForPush(int time, long delay) { Message msg = Message.obtain(); msg.what = ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH; msg.arg1 = time; - mHandler.sendMessageDelayed( msg, delay ); + mHandler.sendMessageDelayed(msg, delay); } @Override public void destroy() { - Logger.d( TAG, "MogoServices do nothings." ); + CallerLogger.INSTANCE.d(M_OLD_OTHER + TAG, "MogoServices do nothings."); MoGoAiCloudRealTime.stopRealTime(); } @@ -815,25 +816,24 @@ public class MogoServices implements IMogoMapListener, } @Override - public void onMapModeChanged( EnumMapUI ui ) { - Log.i(TAG, "onMapModeChanged:" + ui + " mLastStatusIsVr:" + mLastStatusIsVr); + public void onMapModeChanged(EnumMapUI ui) { clearAllData(); - if ( ui == EnumMapUI.Type_VR ) { - if ( !mLastStatusIsVr ) { - MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true ); + if (ui == EnumMapUI.Type_VR) { + if (!mLastStatusIsVr) { + MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true); MapMarkerManager.getInstance().redrawMarkerByStyleChanged(); - if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) { - AIAssist.getInstance( mContext ).speakTTSVoice( "已开启鹰眼模式" ); + if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) { + AIAssist.getInstance(mContext).speakTTSVoice("已开启鹰眼模式"); } mLastStatusIsVr = true; } } else { - if ( mLastStatusIsVr ) { + if (mLastStatusIsVr) { mLastStatusIsVr = false; - MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false ); + MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, false); MapMarkerManager.getInstance().redrawMarkerByStyleChanged(); - if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) { - AIAssist.getInstance( mContext ).speakTTSVoice( "已退出鹰眼模式" ); + if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) { + AIAssist.getInstance(mContext).speakTTSVoice("已退出鹰眼模式"); } } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java index d6d081ef7e..a559412815 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java @@ -2,16 +2,14 @@ package com.mogo.module.service; import android.content.Intent; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.module.service.launchercard.LauncherCardRefresher; import com.mogo.module.service.marker.MapMarkerManager; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; -import org.jetbrains.annotations.NotNull; import org.json.JSONObject; public @@ -123,7 +121,7 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener { intent.putExtra("data", data.toString()); AbsMogoApplication.getApp().sendBroadcast(intent); } catch (Exception e) { - Logger.e(TAG, e, "error."); + CallerLogger.INSTANCE.e(TAG, "notifySeekHelpingStatusChanged exception : " + e); } } @@ -157,7 +155,7 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener { try { MapMarkerManager.getInstance().onCloseCurrentSelectedMarker(); } catch (Exception e) { - Logger.e(TAG, e, "onTopViewStatusChanged"); + CallerLogger.INSTANCE.e(TAG, "onTopViewStatusChanged exception : " + e); } } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/actionmanager/MogoActionHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/actionmanager/MogoActionHandler.java index b2fa3818b6..a2789a3dd6 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/actionmanager/MogoActionHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/actionmanager/MogoActionHandler.java @@ -3,7 +3,6 @@ package com.mogo.module.service.actionmanager; import android.content.Context; import android.text.TextUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.service.module.IMogoBizActionDoneListener; import com.mogo.service.module.MogoAction; import com.mogo.service.module.IMogoActionListener; @@ -74,7 +73,6 @@ public class MogoActionHandler implements IMogoActionManager { @Override public void invoke( String biz, MogoAction action ) { - Logger.d( TAG, "dispatch action %s to %s", action, biz ); if ( !mListeners.containsKey( biz ) ) { return; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/datamanager/MogoDataHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/datamanager/MogoDataHandler.java index 586e8c134e..5ff6950b94 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/datamanager/MogoDataHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/datamanager/MogoDataHandler.java @@ -3,7 +3,7 @@ package com.mogo.module.service.datamanager; import android.content.Context; import android.text.TextUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.service.datamanager.IMogoDataChanged2Listener; import com.mogo.service.datamanager.IMogoDataChangedListener; import com.mogo.service.datamanager.IMogoDataManager; @@ -24,7 +24,7 @@ public class MogoDataHandler implements IMogoDataManager { private static final String TAG = "MogoDataHandler"; - private Map< String, List< IMogoDataChangedListener > > mListeners = new HashMap<>(); + private Map> mListeners = new HashMap<>(); private MogoDataHandler() { // private constructor @@ -39,87 +39,87 @@ public class MogoDataHandler implements IMogoDataManager { } @Override - public synchronized void registerDataListener(String tag, IMogoDataChangedListener listener ) { - if ( listener == null || TextUtils.isEmpty( tag ) ) { + public synchronized void registerDataListener(String tag, IMogoDataChangedListener listener) { + if (listener == null || TextUtils.isEmpty(tag)) { return; } - if ( !mListeners.containsKey( tag ) || mListeners.get( tag ) == null ) { - mListeners.put( tag, new ArrayList<>() ); + if (!mListeners.containsKey(tag) || mListeners.get(tag) == null) { + mListeners.put(tag, new ArrayList<>()); } - mListeners.get( tag ).add( listener ); + mListeners.get(tag).add(listener); } @Override - public synchronized void unregisterListener(String tag, IMogoDataChangedListener listener ) { - if ( listener == null || TextUtils.isEmpty( tag ) ) { + public synchronized void unregisterListener(String tag, IMogoDataChangedListener listener) { + if (listener == null || TextUtils.isEmpty(tag)) { return; } - if ( mListeners.containsKey( tag ) && mListeners.get( tag ) != null ) { - mListeners.get( tag ).remove( listener ); + if (mListeners.containsKey(tag) && mListeners.get(tag) != null) { + mListeners.get(tag).remove(listener); } } @Override - public void removeDataFrom( String module, Object object ) { - if ( module == null || mListeners.get( module ) == null ) { + public void removeDataFrom(String module, Object object) { + if (module == null || mListeners.get(module) == null) { return; } try { - Iterator< IMogoDataChangedListener > iterator = mListeners.get( module ).iterator(); - while ( iterator.hasNext() ) { + Iterator iterator = mListeners.get(module).iterator(); + while (iterator.hasNext()) { IMogoDataChangedListener listener = iterator.next(); - if ( listener instanceof IMogoDataChanged2Listener ) { - ( ( IMogoDataChanged2Listener ) listener ).onDataRemoved( module, object ); + if (listener instanceof IMogoDataChanged2Listener) { + ((IMogoDataChanged2Listener) listener).onDataRemoved(module, object); } } - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "removeDataFrom exception : " + e); } } @Override - public void addData2( String module, Object object ) { - if ( module == null || mListeners.get( module ) == null ) { + public void addData2(String module, Object object) { + if (module == null || mListeners.get(module) == null) { return; } try { - Iterator< IMogoDataChangedListener > iterator = mListeners.get( module ).iterator(); - while ( iterator.hasNext() ) { + Iterator iterator = mListeners.get(module).iterator(); + while (iterator.hasNext()) { IMogoDataChangedListener listener = iterator.next(); - if ( listener instanceof IMogoDataChanged2Listener ) { - ( ( IMogoDataChanged2Listener ) listener ).onDataAdded( module, object ); + if (listener instanceof IMogoDataChanged2Listener) { + ((IMogoDataChanged2Listener) listener).onDataAdded(module, object); } } - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "addData2 exception : " + e); } } @Override - public void init( Context context ) { + public void init(Context context) { } @Override - public void syncData( String module, Object object ) { - if ( module == null || mListeners.get( module ) == null ) { + public void syncData(String module, Object object) { + if (module == null || mListeners.get(module) == null) { return; } try { - Iterator< IMogoDataChangedListener > iterator = mListeners.get( module ).iterator(); - while ( iterator.hasNext() ) { + Iterator iterator = mListeners.get(module).iterator(); + while (iterator.hasNext()) { IMogoDataChangedListener listener = iterator.next(); - if ( listener != null ) { - listener.onDataSetChanged( object ); + if (listener != null) { + listener.onDataSetChanged(object); } } - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "syncData exception : " + e); } } @Deprecated - public void invoke( String tag, Object data ) { - syncData( tag, data ); + public void invoke(String tag, Object data) { + syncData(tag, data); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java index 5df03fb224..902c7251af 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java @@ -4,7 +4,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.service.ServiceConst; @@ -19,46 +19,46 @@ abstract class RefreshWorkThreadHandler extends Handler { private static final String TAG = "RefreshWorkThreadHandler"; - public RefreshWorkThreadHandler( Looper looper ) { - super( looper ); + public RefreshWorkThreadHandler(Looper looper) { + super(looper); } @Override - public final void handleMessage( Message msg ) { - super.handleMessage( msg ); - if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) { + public final void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == ServiceConst.MSG_MAP_CHANGED) { try { - handleMapChangedMessage( msg ); - } catch ( Exception e ) { - Logger.e( TAG, e, "handleMapChangedMessage" ); + handleMapChangedMessage(msg); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "handleMapChangedMessage exception : " + e); } - } else if ( msg.what == ServiceConst.MSG_REQUEST_DATA ) { + } else if (msg.what == ServiceConst.MSG_REQUEST_DATA) { try { - handleRequestDataMessage( msg ); - } catch ( Exception e ) { - Logger.e( TAG, e, "handleRequestDataMessage" ); + handleRequestDataMessage(msg); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "handleRequestDataMessage exception : " + e); } - } else if ( msg.what == ServiceConst.MSG_LOCK_CAR ) { + } else if (msg.what == ServiceConst.MSG_LOCK_CAR) { try { - handleLockCarMessage( msg ); - } catch ( Exception e ) { - Logger.e( TAG, e, "handleLockCarMessage" ); + handleLockCarMessage(msg); + } catch (Exception e) { + CallerLogger.INSTANCE.e(TAG, "handleLockCarMessage exception : " + e); } } } - protected abstract void handleMapChangedMessage( Message msg ); + protected abstract void handleMapChangedMessage(Message msg); - protected abstract void handleRequestDataMessage( Message msg ); + protected abstract void handleRequestDataMessage(Message msg); - protected void handleLockCarMessage( Message msg ) { - if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow() ) { + protected void handleLockCarMessage(Message msg) { + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow()) { return; } - if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { return; } - MogoApisHandler.getInstance().getApis().getStatusManagerApi().setUserInteractionStatus( TAG, true, false ); + MogoApisHandler.getInstance().getApis().getStatusManagerApi().setUserInteractionStatus(TAG, true, false); MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().recoverLockMode(); } } 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 bb7ef3564d..96e8e2df51 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 @@ -3,7 +3,6 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.utils.CarSeries; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.ServiceConst; @@ -50,12 +49,10 @@ public class AccStatusIntentHandler implements IntentHandler { if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) { if ( CarSeries.isF8xxSeries() ) { MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true ); - Logger.d( TAG, "acc status: %s", true ); } } else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) { if ( CarSeries.isF8xxSeries() ) { MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false ); - Logger.d( TAG, "acc status: %s", false ); } } else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) { int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF ); @@ -67,13 +64,11 @@ public class AccStatusIntentHandler implements IntentHandler { newIntent.putExtra( "acc", true ); newIntent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES ); context.sendBroadcast( newIntent ); - Logger.d( TAG, "发送广播:com.freedom.ser.ACTION" ); } boolean accOn = state == ACC_ON; if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) { return; } - Logger.d( TAG, "acc status: %s", state ); MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn ); if ( state == ACC_ON ) { LauncherCardRefresher.getInstance( context ).start(); 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 index d302d02119..e37f9be844 100644 --- 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 @@ -7,7 +7,6 @@ import android.graphics.BitmapFactory; import android.os.Handler; import android.os.Message; import android.text.TextUtils; -import android.util.Log; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.cloud.socket.entity.SocketDownData; @@ -20,12 +19,10 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; import com.mogo.eagle.core.utilcode.util.AppStateManager; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; @@ -110,7 +107,6 @@ public class MockIntentHandler implements IntentHandler { geoSearch.setGeoSearchListener(new IMogoGeoSearchListener() { @Override public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { - Logger.d(TAG, GsonUtil.jsonFromObject(regeocodeResult)); } @Override @@ -374,7 +370,6 @@ public class MockIntentHandler implements IntentHandler { double[] translateCoor = CoordinateUtils.transformWgsToGcj(lat, lon); double[] originCoor = CoordinateUtils.transformGcj02toWgs84(translateCoor[1], translateCoor[0]); double delta = CoordinateUtils.calculateLineDistance(lon, lat, originCoor[0], originCoor[1]); - Logger.d(TAG, "偏差值:%s", delta); } break; @@ -717,10 +712,7 @@ public class MockIntentHandler implements IntentHandler { JSONObject jo = new JSONObject(line); //改变rtk定位数据,触发自车移动 MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo); - Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms"); SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(jo); - Log.i("mock-timer-loc", "cost " + (System.currentTimeMillis() - start) + "ms"); - Log.i("mock-timer-loc-info", jo.toString()); return true; } @@ -753,7 +745,6 @@ public class MockIntentHandler implements IntentHandler { // // final long start = System.currentTimeMillis(); // SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build()); -// Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms"); //// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L ); return true; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/NetworkChangedIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/NetworkChangedIntentHandler.java index a96286562b..e71b8d0efe 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/NetworkChangedIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/NetworkChangedIntentHandler.java @@ -3,7 +3,6 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.module.common.MogoApisHandler; @@ -22,7 +21,6 @@ class NetworkChangedIntentHandler implements IntentHandler { public void handle( Context context, Intent intent ) { if ( NetworkUtils.isConnected( context ) ) { try { - Logger.d( TAG, "setTrafficEnabled" ); MogoApisHandler.getInstance() .getApis() .getMapServiceApi() diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/WholeVoiceCommandIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/WholeVoiceCommandIntentHandler.java index 707bddac8f..e277e49587 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/WholeVoiceCommandIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/WholeVoiceCommandIntentHandler.java @@ -4,7 +4,6 @@ import android.content.Context; import android.content.Intent; import android.text.TextUtils; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.service.receiver.MogoReceiver; /** @@ -48,6 +47,5 @@ public class WholeVoiceCommandIntentHandler implements IntentHandler { if ( TextUtils.isEmpty( command ) ) { return; } - Logger.i(TAG,"command:"+command); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java index 8f64a0b63c..4fed421d0a 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java @@ -16,7 +16,6 @@ import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.network.RequestOptions; import com.mogo.eagle.core.network.SubscribeImpl; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.AppUtils; import com.mogo.eagle.core.utilcode.util.NetworkUtils; @@ -173,7 +172,6 @@ class LauncherCardRefresher { if ( mStart ) { return; } - Logger.d( TAG, "start" ); mDefaultConfigCounter = 0; mRefreshTicketCounter = 0; mRefreshStrategy = mLauncherCardConfigStrategy; @@ -216,7 +214,6 @@ class LauncherCardRefresher { mHandler.removeMessages( MSG_LOAD_NET_CONFIG ); mHandler.removeMessages( MSG_LOAD_NET_CONFIG2 ); mHandler.removeMessages( MSG_WAIT_NETWORK ); - Logger.d( TAG, "stop" ); } private void restart() { @@ -259,7 +256,6 @@ class LauncherCardRefresher { return; } } - Logger.d( TAG, msg ); AIAssist.getInstance( mContext ).speakTTSVoice( msg ); } @@ -271,7 +267,6 @@ class LauncherCardRefresher { intent.putExtra( "v2x_warning_eventCount", amount ); intent.putExtra( "v2x_warning_info", info ); mContext.sendBroadcast( intent ); - Logger.d( TAG, "发送广播到桌面卡片." ); } /** @@ -294,7 +289,6 @@ class LauncherCardRefresher { intent.putExtra( "v2x_card_endTime", mDefaultLauncherCardConfig.endTime ); intent.putExtra( "v2x_card_is_default", true ); mContext.sendBroadcast( intent ); - Logger.d( TAG, "发送默认配置广播到桌面卡片." ); if ( !TextUtils.isEmpty( mDefaultLauncherCardConfig.content ) ) { mLaunchTTSText = mDefaultLauncherCardConfig.content; } @@ -354,17 +348,14 @@ class LauncherCardRefresher { @Override public void onError( Throwable e ) { super.onError( e ); - Logger.e( TAG, e, "获取配置失败" ); } @Override public void onSuccess( LauncherCardAdvertisementData data ) { super.onSuccess( data ); if ( data == null || data.result == null ) { - Logger.d( TAG, "carAdvertisingList is empty." ); return; } - Logger.d( TAG, "获取配置成功" ); handleGotCarAdvertisingList( data.result ); } @@ -374,7 +365,6 @@ class LauncherCardRefresher { if ( code == 100046 ) { refreshTicket(); } - Logger.e( TAG, "获取配置失败 msg = %s, code = %s", message, code ); } } ); } @@ -388,7 +378,6 @@ class LauncherCardRefresher { if ( lastPlayDateTime != 0 ) { Date lastPlayDate = new Date( lastPlayDateTime ); if ( lastPlayDate.getDate() == new Date( System.currentTimeMillis() ).getDate() ) { - Logger.d( TAG, "一天只播报一次" ); return; } } @@ -396,8 +385,6 @@ class LauncherCardRefresher { String name = SharedPrefsMgr.getInstance( mContext ).getString( KEY_LAST_LOAD_TTS_TYPE, LauncherCardRefreshType.Weather.name() ); LauncherCardRefreshType type = LauncherCardRefreshType.valueOf( name ); - Logger.d( TAG, "本次播报:%s", name ); - MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( mContext ).getLastKnowLocation(); TtsConfigBody body = new TtsConfigBody() .addType( LauncherCardRefreshType.NearRoads.getVal() ) @@ -418,14 +405,12 @@ class LauncherCardRefresher { @Override public void onError( Throwable e ) { super.onError( e ); - Logger.e( TAG, e, "queryBroadCastInfo" ); } @Override public void onSuccess( TtsConfigData data ) { super.onSuccess( data ); if ( data == null || data.result == null ) { - Logger.d( TAG, "获取数据为空" ); return; } handleTtsConfig( data, type ); @@ -437,7 +422,6 @@ class LauncherCardRefresher { if ( code == 100046 ) { refreshTicket(); } - Logger.e( TAG, "获取配置失败 msg = %s, code = %s", message, code ); } } ); } @@ -496,7 +480,6 @@ class LauncherCardRefresher { break; } - Logger.d( TAG, "header = %s", header.type.getVal() ); TtsConfigNode pointer = header; do { @@ -636,18 +619,15 @@ class LauncherCardRefresher { final Map< String, Object > properties = new HashMap<>(); properties.put( "type", type.name() ); MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "v2x_play", properties ); - Logger.d( TAG, "本次播报:%s,下次播报:%s", type.name(), LauncherCardRefreshType.valueOf( type.getNext() ).name() ); SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LAST_LOAD_TTS_DATE, System.currentTimeMillis() ); } private void refreshTicket() { mRefreshTicketCounter++; - Logger.d( TAG, "刷新ticket" ); MarkerServiceHandler.getApis().getPassportManagerApi().requestTicket( new IMogoTicketCallback() { @Override public void onTicketGot( String ticket ) { - Logger.d( TAG, "ticket=%s", ticket ); if ( mRefreshTicketCounter < 3 ) { loadNetworkConfigStrategy(); } @@ -655,12 +635,10 @@ class LauncherCardRefresher { @Override public void onError( int code, String msg ) { - Logger.d( TAG, "code=%s, msg=%s", code, msg ); } @Override public void onLoginSuccess( String token, String sn ) { - Logger.d( TAG, "token=%s, sn=%s", token, sn ); } } ); } @@ -683,8 +661,6 @@ class LauncherCardRefresher { long curr = System.currentTimeMillis(); if ( curr > launcherCardAdvertisement.startTime && curr < launcherCardAdvertisement.endTime ) { mAdvertisements.add( launcherCardAdvertisement ); - } else { - Logger.w( TAG, "广告已过期 %s", launcherCardAdvertisement.cardContent ); } } } @@ -718,7 +694,6 @@ class LauncherCardRefresher { mHandler.sendMessageDelayed( msg, advertisement.popupNum * ONE_MINUTE ); renderAdvertisement( advertisement ); } catch ( Exception e ) { - Logger.e( TAG, e, "loopRenderAdvertisements" ); } } @@ -745,7 +720,6 @@ class LauncherCardRefresher { if ( !AppUtils.isAppForeground( mContext ) ) { speakTTS( advertisement.content, true ); } - Logger.d( TAG, "发送广告配置广播到桌面卡片." ); } } } 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 6bb89f90e4..ffd03b7eec 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 @@ -8,7 +8,6 @@ import com.mogo.cloud.socket.entity.SocketDownData; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper; import com.mogo.eagle.core.utilcode.util.ThreadPoolService; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; @@ -95,7 +94,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener, * @param context 上下文对象 */ public void init(Context context) { - Logger.d(TAG, "<------init------>"); if (mContext != null) { return; @@ -470,9 +468,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, * @param response */ public void onSyncMarkerResponse(MarkerResponse response) { - Logger.d(TAG, "onSyncMarkerResponse response "); if (ignoreDrawRequest()) { - Logger.d(TAG, "onSyncMarkerResponse ignoreDraw "); return; } runOnTargetThread(() -> { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MogoMarkerServiceImpl.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MogoMarkerServiceImpl.java index 228cc1b89f..e06270ba39 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MogoMarkerServiceImpl.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MogoMarkerServiceImpl.java @@ -5,7 +5,6 @@ import android.content.Context; import androidx.annotation.Nullable; import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.map.marker.IMogoMarker; import com.mogo.module.common.drawer.MarkerDrawer; import com.mogo.module.common.entity.MarkerShowEntity; @@ -30,7 +29,6 @@ public class MogoMarkerServiceImpl implements IMogoMarkerService { if ( object instanceof MarkerShowEntity ) { return MarkerServiceHandler.getMapMarkerManager().drawMapMarker( ( ( MarkerShowEntity ) object ), MarkerDrawer.MARKER_Z_INDEX_HIGH ); } - Logger.w( TAG, "object must instance of [com.mogo.module.common.entity.MarkerShowEntity]" ); return null; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java index 7cee255009..7ffc90e78f 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java @@ -8,7 +8,6 @@ import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.network.RequestOptions; import com.mogo.eagle.core.network.SubscribeImpl; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.constants.HostConst; import com.mogo.module.common.entity.MarkerResponse; @@ -54,8 +53,6 @@ public class RefreshModel { String data = GsonUtil.jsonFromObject( refreshBody ); query.put( "data", data ); - Logger.d( TAG, data ); - mRefreshApiService.refreshDataSync( query ) .subscribeOn( Schedulers.io() ) 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 36a4ca606d..dc256a9477 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,7 +4,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.intent.IntentHandlerFactory; @@ -27,7 +26,6 @@ class AccStatusReceiver extends BroadcastReceiver { @Override public void onReceive( Context context, Intent intent ) { - Logger.d(TAG, "收到诺威达acc广播"); MarkerServiceHandler.init( context ); IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent ); } 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 4ec7387867..229fc5f446 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 @@ -16,8 +16,6 @@ import com.mogo.service.intent.IMogoIntentManager; */ public class MogoReceiver extends BroadcastReceiver { - private static final String TAG = "MogoReceiver"; - /** * 语音 */ @@ -56,7 +54,6 @@ public class MogoReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); - //Logger.d( TAG, action ); if (TextUtils.equals(VOICE_ACTION, action)) { String cmd = intent.getStringExtra(PARAM_COMMAND); if (!TextUtils.isEmpty(cmd)) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java index e50568b827..581ff75982 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java @@ -1,7 +1,8 @@ package com.mogo.module.service.routeoverlay; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_ROUTE; + import android.content.Context; -import android.util.Log; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; @@ -14,7 +15,7 @@ import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.module.common.utils.DrivingDirectionUtils; import org.jetbrains.annotations.NotNull; @@ -81,9 +82,9 @@ public class MogoRouteOverlayManager implements builder.append(mLocation.getSpeed()).append(";"); // ADASTrajectoryInfo adasTrajectoryInfo = trajectoryInfos.get(0); // long temp = SystemClock.currentThreadTimeMillis(); -// Log.d(TAG, "temp:"+temp+" size:" + trajectoryInfos.size()); -// Log.d(TAG, "trajectoryInfos:" + adasTrajectoryInfo.getLat()+":"+adasTrajectoryInfo.getLon()); -// Log.d(TAG, "temp:"+temp+" location:" + lat+":"+lon); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "temp:"+temp+" size:" + trajectoryInfos.size()); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "trajectoryInfos:" + adasTrajectoryInfo.getLat()+":"+adasTrajectoryInfo.getLon()); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "temp:"+temp+" location:" + lat+":"+lon); List mogoLatLngs = new ArrayList<>(); for (int i = 0; i < trajectoryInfos.size(); i++) { // 临时解决车尾拖线问题,丢弃距离车最近的几个经纬度,原因是惯性导航的中心靠近车尾,会导致经纬度靠近尾部,且两个数据不同频 @@ -97,7 +98,7 @@ public class MogoRouteOverlayManager implements mTrajectoryList = mogoLatLngs; builder.append("}"); - Log.d(TAG, builder.toString()); + CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, builder.toString()); } @Override @@ -120,7 +121,7 @@ public class MogoRouteOverlayManager implements return; } this.STATUS_AUTOPILOT = autoPilotStatusInfo.getPilotmode(); - //Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT); + //CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG ,"onAutopilotStatusResponse:"+STATUS_AUTOPILOT); // if (STATUS_AUTOPILOT == 1 ){ // if (mEnding != null){ // RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon); @@ -140,7 +141,7 @@ public class MogoRouteOverlayManager implements if (arrivalNotification == null) { return; } - Logger.d(TAG, "onArriveAt data : " + arrivalNotification.toString()); + CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "onArriveAt data : " + arrivalNotification.toString()); // //演示模式下 到达终点将忽略 引导线绘制 选项关闭 // FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false; } @@ -157,7 +158,7 @@ public class MogoRouteOverlayManager implements // if (mTrajectoryList.isEmpty()) { // return; // } -// Log.d(TAG, "onLocationChanged : " + mTrajectoryList.size()); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged : " + mTrajectoryList.size()); // ArrayList list = new ArrayList(); // for (MogoLatLng latLng : mTrajectoryList) { // if (!isPointOnCarFront(mLocation, latLng)) { @@ -171,8 +172,8 @@ public class MogoRouteOverlayManager implements // builder.append(latLng.getLon()).append(","); // builder.append(latLng.getLat()).append(","); // } -// Log.d(TAG, "onLocationChanged : " + GsonUtils.toJson(builder.toString())); -// Log.d(TAG,"onLocationChanged size = " + list.size() + "---TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "----" + STATUS_AUTOPILOT); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged : " + GsonUtils.toJson(builder.toString())); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG ,"onLocationChanged size = " + list.size() + "---TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "----" + STATUS_AUTOPILOT); // if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1) { // RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list); // } @@ -182,14 +183,14 @@ public class MogoRouteOverlayManager implements if (temp.isEmpty()) { return; } -// Log.e(TAG, "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude()); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude()); ArrayList list = new ArrayList(); for (MogoLatLng latLng : temp) { // if(!isPointOnCarFront(mLocation,latLng)){ list.add(latLng); // } } - Log.d(TAG, "TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size()); + CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size()); if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1) { RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list); } @@ -205,7 +206,7 @@ public class MogoRouteOverlayManager implements // 计算车辆与点之间的夹角 int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( carLon, carLat, poiLon, poiLat, (int) carAngle); -// Log.e(TAG,"diffAngle:"+diffAngle); +// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"diffAngle:"+diffAngle); if (diffAngle <= 90) { return true; } else { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java index 575c0cd808..a194bf73d1 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java @@ -1,15 +1,15 @@ package com.mogo.module.service.routeoverlay; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_ROUTE; + import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; -import android.util.Log; -import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.ColorUtils; -import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.map.overlay.IMogoOverlayManager; @@ -23,6 +23,8 @@ import java.util.List; public class RouteOverlayDrawer { + private static final String TAG = "MogoRouteOverlayManager"; + private IMogoPolyline mMoGoPolyline; // 连接线参数 private MogoPolylineOptions mPolylineOptions; @@ -37,6 +39,7 @@ public class RouteOverlayDrawer { private Bitmap endingBitmap; private static volatile RouteOverlayDrawer sInstance; private static final String markerType = "route_ending"; + private RouteOverlayDrawer(Context context) { mPolylineOptions = new MogoPolylineOptions(); mPolylineOptions.zIndex(75000f); @@ -46,7 +49,7 @@ public class RouteOverlayDrawer { // 引导线颜色, mPolylineColors = new ArrayList<>(); mContext = context; - mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext); + mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext); endingBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon_route_ending); } @@ -61,6 +64,7 @@ public class RouteOverlayDrawer { } return sInstance; } + public synchronized void release() { sInstance = null; } @@ -71,11 +75,11 @@ public class RouteOverlayDrawer { } - public void addEndingMarker(double lat,double lon){ - if (endMarker != null){ + public void addEndingMarker(double lat, double lon) { + if (endMarker != null) { return; } - if (markderOptions == null){ + if (markderOptions == null) { markderOptions = new MogoMarkerOptions() .matchOnRoadSide(true) .gps(true) @@ -87,14 +91,14 @@ public class RouteOverlayDrawer { // .object(markerShowEntity) } markderOptions.latitude(lat).longitude(lon); - //Log.d("lianglihui","addEndingMarker-"+lat+":"+lon); + //CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"addEndingMarker-"+lat+":"+lon); endMarker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, markderOptions); // if (DebugConfig.isDebug()){ // ToastUtils.showLong("绘制终点marker,"+lat+":"+lon); // } } - public void clearMogoRouteOverlay(){ + public void clearMogoRouteOverlay() { if (mMoGoPolyline != null) { mMoGoPolyline.remove(); mMoGoPolyline = null; @@ -103,8 +107,8 @@ public class RouteOverlayDrawer { } } - public void clearEndingMarker(){ - //Log.d("lianglihui","clearEndingMarker"); + public void clearEndingMarker() { + //CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"clearEndingMarker"); endMarker = null; MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).removeMarkers(markerType); } @@ -122,47 +126,47 @@ public class RouteOverlayDrawer { mPolylineColors.clear(); // mPolylineColors.addAll(ColorUtils.gradientAlpha_("#FF2AAFFD", "#7b2965ED", "#002965ED", mPolylinePointList.size())); long start = System.currentTimeMillis(); - List list = new ArrayList<>(); + List list = new ArrayList<>(); // list = ColorUtils.gradientAlpha("#FF2AAFFD", "#002965ED", mPolylinePointList.size()); int[] startColor = ColorUtils.hexToArgb("#CC64C3EA"); - int[] endColor = ColorUtils.hexToArgb("#0064C3EA"); - list.add(Color.argb(startColor[0],startColor[1],startColor[2],startColor[3])); - list.add(Color.argb(endColor[0],endColor[1],endColor[2],endColor[3])); + int[] endColor = ColorUtils.hexToArgb("#0064C3EA"); + list.add(Color.argb(startColor[0], startColor[1], startColor[2], startColor[3])); + list.add(Color.argb(endColor[0], endColor[1], endColor[2], endColor[3])); long end = System.currentTimeMillis(); - Log.d("MogoRouteOverlayManager","get color cost : "+ (end-start)); + CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "get color cost : " + (end - start)); mPolylineColors.addAll(list); // 线条粗细,渐变,渐变色值 mPolylineOptions.width(20).useGradient(true).colorValues(mPolylineColors); - if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()){ + if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) { mPolylineOptions.points(mPolylinePointList); mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions); - }else { + } else { mPolylineOptions.points(mPolylinePointList); mMoGoPolyline.setOption(mPolylineOptions); } } long drawend = System.currentTimeMillis(); - Log.d("MogoRouteOverlayManager","drawTrajectoryList cost : "+ (drawend-drawstart)); + CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawend - drawstart)); } public void initdraw() { mPolylinePointList.clear(); - MogoLatLng latLng = new MogoLatLng(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()); + MogoLatLng latLng = new MogoLatLng(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()); mPolylinePointList.add(latLng); mPolylinePointList.add(latLng); mPolylineColors.clear(); long start = System.currentTimeMillis(); - List list = new ArrayList<>(); - list = ColorUtils.gradientAlpha("#FF2AAFFD", "#002965ED", mPolylinePointList.size()); + List list = new ArrayList<>(); + list = ColorUtils.gradientAlpha("#FF2AAFFD", "#002965ED", mPolylinePointList.size()); mPolylineColors.addAll(list); // 线条粗细,渐变,渐变色值 mPolylineOptions.width(12).useGradient(true).colorValues(mPolylineColors); - if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()){ + if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) { mPolylineOptions.points(mPolylinePointList); mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions); - }else { + } else { mPolylineOptions.points(mPolylinePointList); mMoGoPolyline.setOption(mPolylineOptions); } diff --git a/modules/mogo-module-share/.gitignore b/modules/mogo-module-share/.gitignore deleted file mode 100644 index 796b96d1c4..0000000000 --- a/modules/mogo-module-share/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/modules/mogo-module-share/build.gradle b/modules/mogo-module-share/build.gradle deleted file mode 100644 index f1c0319740..0000000000 --- a/modules/mogo-module-share/build.gradle +++ /dev/null @@ -1,84 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-android-extensions' - id 'kotlin-kapt' - id 'com.alibaba.arouter' -} - -android { - compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion - defaultConfig { - minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion - versionCode Integer.valueOf(VERSION_CODE) - versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - - //ARouter apt 参数 - kapt { - useBuildCache = false - arguments { - arg("AROUTER_MODULE_NAME", project.getName()) - } - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation rootProject.ext.dependencies.kotlinstdlibjdk7 - implementation rootProject.ext.dependencies.androidxappcompat - implementation rootProject.ext.dependencies.androidxrecyclerview - implementation rootProject.ext.dependencies.androidxccorektx - implementation rootProject.ext.dependencies.androidxconstraintlayout - implementation rootProject.ext.dependencies.okhttpinterceptor - implementation rootProject.ext.dependencies.arouter - kapt rootProject.ext.dependencies.aroutercompiler - - implementation rootProject.ext.dependencies.rxjava - implementation rootProject.ext.dependencies.rxandroid - implementation rootProject.ext.dependencies.mogoaicloudtanlu - implementation rootProject.ext.dependencies.analytics - implementation rootProject.ext.dependencies.eventbus - implementation rootProject.ext.dependencies.coroutinescore - implementation rootProject.ext.dependencies.coroutinesandroid - implementation 'com.zhidaoauto.controller:api:1.0.8' - - if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { - implementation rootProject.ext.dependencies.mogo_core_utils - implementation rootProject.ext.dependencies.mogocommons - implementation rootProject.ext.dependencies.modulecommon - implementation rootProject.ext.dependencies.moduleservice - implementation rootProject.ext.dependencies.mogo_core_utils - implementation rootProject.ext.dependencies.mogo_core_data - } else { - implementation project(':core:mogo-core-utils') - implementation project(":foudations:mogo-commons") - implementation project(':modules:mogo-module-common') - implementation project(':modules:mogo-module-service') - implementation project(':core:mogo-core-utils') - implementation project(':core:mogo-core-data') - } - -} - -apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/modules/mogo-module-share/consumer-rules.pro b/modules/mogo-module-share/consumer-rules.pro deleted file mode 100644 index 398fdd13f3..0000000000 --- a/modules/mogo-module-share/consumer-rules.pro +++ /dev/null @@ -1,6 +0,0 @@ -#-----ShareModule----- --keep class com.mogo.module.share.adas.*{*;} --keep class com.mogo.module.share.bean.**{*;} --keep class com.mogo.module.share.constant.*{*;} --keep class com.mogo.module.share.net.*{*;} --keep class com.mogo.module.share.strategyreceiver.AccidentStrategyPushWrapper{*;} diff --git a/modules/mogo-module-share/gradle.properties b/modules/mogo-module-share/gradle.properties deleted file mode 100644 index ae56b543b4..0000000000 --- a/modules/mogo-module-share/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=com.mogo.module -POM_ARTIFACT_ID=module-share -VERSION_CODE=1 diff --git a/modules/mogo-module-share/proguard-rules.pro b/modules/mogo-module-share/proguard-rules.pro deleted file mode 100644 index 08a8bde62e..0000000000 --- a/modules/mogo-module-share/proguard-rules.pro +++ /dev/null @@ -1,30 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile - -#-----ShareModule----- --keep class com.mogo.module.share.bean.**{*;} --keep class com.mogo.module.share.constant.**{*;} --keep class com.mogo.module.share.manager.ISeekHelpListener --keep class com.mogo.module.share.net.ShareDevaApiService --keep class com.mogo.module.share.net.ShareLsApiService --keep class com.mogo.module.share.net.ShareRtlApiService -#-keep class com.mogo.module.share.net.ShareApiService \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/AndroidManifest.xml b/modules/mogo-module-share/src/main/AndroidManifest.xml deleted file mode 100644 index 2337826536..0000000000 --- a/modules/mogo-module-share/src/main/AndroidManifest.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/GaoDeAimlessProvider.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/GaoDeAimlessProvider.java deleted file mode 100644 index 57a886aae8..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/GaoDeAimlessProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.mogo.module.share; - -import android.content.Context; -import android.util.Log; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.map.navi.IMogoAimlessModeListener; -import com.mogo.map.navi.MogoCongestionInfo; -import com.mogo.map.navi.MogoCongestionLink; -import com.mogo.map.navi.MogoTraffic; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.entity.RoadTrafficSegment; -import com.mogo.module.common.entity.RoadTrafficStatus; -import com.mogo.module.common.entity.UploadTrafficEntity; -import com.mogo.module.share.net.TrafficModelData; - -import java.util.ArrayList; -import java.util.List; - - -/** - * TODO 高德巡航信息监听,并将拥堵信息上报到服务端 - */ -@Route(path = MogoServicePaths.PATH_GAODE_AIMLESS_SHARE) -public class GaoDeAimlessProvider implements IProvider { - private final String TAG = "GaoDeAimlessProvider"; - private TrafficModelData mTanluModelData; - List mlist = new ArrayList<>(); - RoadTrafficSegment roadTrafficSegment = new RoadTrafficSegment(); - - @Override - public void init(Context context) { - - Log.d(TAG, "provider init……"); - if (mTanluModelData == null) { - mTanluModelData = new TrafficModelData(); - } - - - // 注册高德巡航回调 - MogoApisHandler.getInstance() - .getApis() - .getRegisterCenterApi() - .registerMogoAimlessModeListener(TAG, new IMogoAimlessModeListener() { - @Override - public void onUpdateTraffic2(MogoTraffic traffic) { - Log.d(TAG, "onUpdateTraffic2 back……"); - } - - @Override - public void onUpdateCongestion(MogoCongestionInfo info) { - Log.d(TAG, GsonUtil.jsonFromObject(info)); - UploadInfo(info); - } - }); - - } - - /** - * 上报拥堵信息 - * - * @param info - */ - private void UploadInfo(MogoCongestionInfo info) { - UploadTrafficEntity uploadTrafficEntity = new UploadTrafficEntity(); - List roadTrafficStatusList = new ArrayList<>(); - RoadTrafficStatus mStatusBean = new RoadTrafficStatus(); - mStatusBean.setLength(info.getLength()); - mStatusBean.setRoadName(info.getRoadName()); - mStatusBean.setStatus(info.getCongestionStatus()); - mStatusBean.setSegment(true); - - if (info.getCongestionLinks() != null && info.getCongestionLinks().size() > 0) { - mlist.clear(); - for (MogoCongestionLink data : info.getCongestionLinks() - ) { - roadTrafficSegment.setStatus(data.getCongestionStatus()); - roadTrafficSegment.setMogoLatLngList(data.getCoords()); - mlist.add(roadTrafficSegment); - } - mStatusBean.setRoadTrafficSegmentList(mlist); - } - roadTrafficStatusList.add(mStatusBean); - uploadTrafficEntity.setRoadTrafficStatuses(roadTrafficStatusList); - mTanluModelData.uploadTrafficInfo(uploadTrafficEntity); - } - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/MogoTanluApiProvider.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/MogoTanluApiProvider.java deleted file mode 100644 index a1bc113f0b..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/MogoTanluApiProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mogo.module.share; - -import android.content.Context; -import android.util.ArrayMap; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.commons.analytics.AnalyticsUtils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.share.service.MainService; -import com.mogo.module.share.service.UploadParams; -import com.mogo.service.share.IMogoTanluProvider; -import com.mogo.service.share.TanluUploadParams; - -import java.util.Map; - -import static com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_TANLU_API; -import static com.mogo.module.share.constant.StrategyShareConstKt.S_TAG; - -/** - * 探路api - * - * @author tongchenfei - */ -@Route(path = PATH_TANLU_API) -public class MogoTanluApiProvider implements IMogoTanluProvider { - private Context context; - - /** - * 上传情报 - * - * @param params 情报类型 - */ - @Override - public void uploadRoadCondition(TanluUploadParams params) { - if (params != null) { - Logger.d(S_TAG, "uploadRoadCondition: " + params); - Map properties = new ArrayMap<>(); - properties.put("type", params.getEventType()); - properties.put("from", params.getFromType()); - AnalyticsUtils.track("v2x_share_type", properties); - MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation(); - MainService.Companion.launchService(context, new UploadParams(params.getEventType(), - params.getFromType(), params.getDuration(), params.getParentId(), - params.getLocation().lat, params.getLocation().lon, location.getAddress(), location.getBearing(), location.getAdCode(), location.getCityCode())); - } else { - Logger.e(S_TAG, "params为空,无法上报情报"); - } - } - - /** - * 开启探路业务服务 - */ - @Override - public void startTanluService() { - Logger.d(S_TAG, "startTanluService"); - MainService.Companion.launchService(context, null); - } - - @Override - public void init(Context context) { - this.context = context; - Logger.d(S_TAG, "新TanluApi模块 init===="); - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java deleted file mode 100644 index ced6b21a7a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java +++ /dev/null @@ -1,463 +0,0 @@ -package com.mogo.module.share; - -import static com.mogo.module.share.bean.StepAfterAuthKt.STEP_AFTER_AUTH_TYPE_SEEK_HELP; -import static com.mogo.module.share.bean.StepAfterAuthKt.STEP_AFTER_AUTH_TYPE_UPLOAD; -import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_CONFIG; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_CANCEL_SHARE; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_ACCIDENT; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_DENSE_FOG; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_REAL_TIME_TRAFFIC; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_ROAD_BLOCK; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_ROAD_CLOSURE; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_ROAD_CONDITION; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_ROAD_CONSTRUCTION; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_ROAD_ICY; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_SEEK_HELP; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_STAGNANT_WATER; -import static com.mogo.module.share.constant.ShareConstants.UNWAKE_UPLOAD_TRAFFIC_CHECK; -import static com.mogo.module.share.constant.ShareConstants.VOICE_CMD_GO_TO_SHARE; -import static com.mogo.module.share.constant.ShareConstants.VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE; -import static com.mogo.module.share.constant.ShareConstants.VOICE_CMD_PUB_ROAD_CONDITION; -import static com.mogo.module.share.constant.ShareConstants.VOICE_CMD_PUB_TROUBLE_HELP; -import static com.mogo.module.share.constant.ShareConstants.VOICE_CMD_SHARE_DIALOG_CLOSE; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_ACCIDENT; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_BLOCK; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_CLOSURE; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_DENSE_FOG; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_REAL_TIME_TRAFFIC; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_ROAD_CONSTRUCTION; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_ROAD_ICY; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_STAGNANT_WATER; -import static com.mogo.service.share.IMogoTanluProvider.TYPE_TRAFFIC_CHECK; - -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.os.Handler; -import android.os.Message; -import android.util.ArrayMap; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.NetworkUtils; -import com.mogo.module.common.constants.HostConst; -import com.mogo.module.common.dialog.BaseFloatDialog; -import com.mogo.module.common.utils.CloudPoiManager; -import com.mogo.module.share.bean.FixableButton; -import com.mogo.module.share.bean.ShareButtonConfigResponse; -import com.mogo.module.share.bean.ShareConfigRequest; -import com.mogo.module.share.bean.StepAfterAuth; -import com.mogo.module.share.constant.ShareConstants; -import com.mogo.module.share.dialog.GridFixableShareDialog; -import com.mogo.module.share.manager.ServiceApisManager; -import com.mogo.module.share.manager.UploadHelper; -import com.mogo.module.share.net.ShareDevaApiService; -import com.mogo.service.share.IMogoShareManager; -import com.mogo.service.share.IMogoTanluProvider; -import com.mogo.service.share.TanluUploadParams; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.StatusDescriptor; - -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import io.reactivex.schedulers.Schedulers; - -/** - * 分享框的逻辑都放到这里吧 - * - * @author lixiaopeng - * @description 分享弹框接口 - * @since 2020-01-10 - */ -@Route(path = MogoServicePaths.PATH_SHARE) -public class ShareControl implements IMogoShareManager, Handler.Callback { - private static final String TAG = "ShareControl"; - private Context mContext; - - private BaseFloatDialog mShareDialog; - - @Override - public void showShareDialog() { - realShowDialog(); - } - - @Override - public void dismissShareDialog() { - if (mShareDialog != null) { - Logger.d(TAG, "dismissShareDialog"); - mShareDialog.dismiss(); - } - } - - @Override - public void resetContext(Context context) { - mContext = context; - } - - @Override - public void releaseContext() { - mContext = mContext.getApplicationContext(); - } - - private void realShowDialog() { - if (mShareDialog == null) { - Logger.d(TAG, "realShowDialog context : " + mContext); - mShareDialog = new GridFixableShareDialog(mContext); - mShareDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - mShareDialog = null; - } - }); - } - mShareDialog.show(); - } - - private StepAfterAuth stepAfterAuth = new StepAfterAuth(-1, "", false); - - @Override - public void init(Context context) { - Logger.d(TAG, "start init===="); - mContext = context; - ServiceApisManager.INSTANCE.init(context); - - ServiceApisManager.serviceApis.getStatusManagerApi().registerStatusChangedListener(TAG, - StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() { - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - if (!isTrue) { - dismissShareDialog(); - } - } - }); - ServiceApisManager.serviceApis.getStatusManagerApi().registerStatusChangedListener(TAG, - StatusDescriptor.ACC_STATUS, new IMogoStatusChangedListener() { - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - if (isTrue) { - queryShareConfigRetryTime = 0; - queryShareButtonConfig(); - } - } - }); - // 获取分享框配置信息 - queryShareConfigRetryTime = 0; - queryShareButtonConfig(); - Logger.d(TAG, "init over===="); - } - - @Override - public void onGlobalUnwake(String cmd, Intent intent) { - try { - switch (cmd) { - case UNWAKE_CANCEL_SHARE: - dismissShareDialog(); - break; - case UNWAKE_UPLOAD_ROAD_BLOCK: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_BLOCK, false); - } else { - uploadFromVoice(TYPE_BLOCK); - } - break; - case UNWAKE_UPLOAD_TRAFFIC_CHECK: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_TRAFFIC_CHECK, false); - } else { - uploadFromVoice(TYPE_TRAFFIC_CHECK); - } - break; - case UNWAKE_UPLOAD_ROAD_CLOSURE: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_CLOSURE, false); - } else { - uploadFromVoice(TYPE_CLOSURE); - } - break; - case UNWAKE_UPLOAD_ACCIDENT: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_ACCIDENT, false); - } else { - uploadFromVoice(TYPE_ACCIDENT); - } - break; - case UNWAKE_UPLOAD_REAL_TIME_TRAFFIC: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_REAL_TIME_TRAFFIC, false); - } else { - uploadFromVoice(TYPE_REAL_TIME_TRAFFIC); - } - break; - case UNWAKE_UPLOAD_SEEK_HELP: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_SEEK_HELP, TYPE_BLOCK, false); - } else { - seekHelp(); - } - - break; - case UNWAKE_UPLOAD_STAGNANT_WATER: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_STAGNANT_WATER, false); - } else { - uploadFromVoice(TYPE_STAGNANT_WATER); - } - break; - case UNWAKE_UPLOAD_ROAD_ICY: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_ROAD_ICY, false); - } else { - uploadFromVoice(TYPE_ROAD_ICY); - } - break; - case UNWAKE_UPLOAD_DENSE_FOG: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_DENSE_FOG, false); - } else { - uploadFromVoice(TYPE_DENSE_FOG); - } - break; - case UNWAKE_UPLOAD_ROAD_CONSTRUCTION: - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_ROAD_CONSTRUCTION, false); - } else { - uploadFromVoice(TYPE_ROAD_CONSTRUCTION); - } - break; - case VOICE_CMD_PUB_TROUBLE_HELP: -// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { -// return; -// } - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_SEEK_HELP, TYPE_DENSE_FOG, false); - } else { - // 开启服务,准备上报求助 - seekHelp(); - dismissShareDialog(); - } - break; - case VOICE_CMD_GO_TO_SHARE: - String ob = - new JSONObject(intent.getStringExtra("data")).opt("ob").toString(); - Logger.d(TAG, "ob: " + ob); - switch (ob) { - case "积水": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_STAGNANT_WATER, false); - } else { - uploadFromVoice(TYPE_STAGNANT_WATER); - dismissShareDialog(); - } - break; - case "积冰": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_ROAD_ICY, false); - } else { - uploadFromVoice(TYPE_ROAD_ICY); - dismissShareDialog(); - } - break; - case "雾": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_DENSE_FOG, false); - } else { - uploadFromVoice(TYPE_DENSE_FOG); - dismissShareDialog(); - } - break; - case "交通事故": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_ACCIDENT, false); - } else { - uploadFromVoice(TYPE_ACCIDENT); - dismissShareDialog(); - } - break; - case "施工": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_ROAD_CONSTRUCTION, false); - } else { - uploadFromVoice(TYPE_ROAD_CONSTRUCTION); - dismissShareDialog(); - } - break; - case "封路": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_CLOSURE, false); - } else { - uploadFromVoice(TYPE_CLOSURE); - dismissShareDialog(); - } - break; - case "交通检查": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_TRAFFIC_CHECK, false); - } else { - uploadFromVoice(TYPE_TRAFFIC_CHECK); - dismissShareDialog(); - } - break; - default: - break; - } - break; - case VOICE_CMD_PUB_ROAD_CONDITION: - String obCondition = - new JSONObject(intent.getStringExtra("data")).opt("obj").toString(); - Logger.d(TAG, "ob:" + obCondition); - switch (obCondition) { - case "路况": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_REAL_TIME_TRAFFIC, false); - } else { - Logger.d(TAG, "分享框准备触发上报实时路况"); - uploadFromVoice(TYPE_REAL_TIME_TRAFFIC); - dismissShareDialog(); - } - break; - case "拥堵": - if (needAuth()) { - goAuth(STEP_AFTER_AUTH_TYPE_UPLOAD, TYPE_BLOCK, false); - } else { - Logger.d(TAG, "分享框准备触发上报拥堵"); - uploadFromVoice(TYPE_BLOCK); - dismissShareDialog(); - } - break; - default: - break; - } - case VOICE_CMD_SHARE_DIALOG_CLOSE: - dismissShareDialog(); - break; - case VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE: - dismissShareDialog(); - break; - case UNWAKE_UPLOAD_ROAD_CONDITION: - Logger.d(TAG, "免唤醒准备触发上报拥堵"); - uploadFromVoice(TYPE_BLOCK); - dismissShareDialog(); - break; - default: - break; - } - } catch (Exception e) { - Logger.e(TAG, e, "onGlobalUnwake exception"); - e.printStackTrace(); - } - } - - private void uploadFromVoice(String eventType) { - TanluUploadParams params = new TanluUploadParams(eventType, - IMogoTanluProvider.UPLOAD_FROM_VOICE); - UploadHelper.INSTANCE.upload(mContext, params, false); - } - - private void seekHelp() { - Intent seekHelp = new Intent(mContext, VoiceCmdService.class); - seekHelp.putExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, - ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP); - mContext.startService(seekHelp); - } - - private boolean needAuth() { - return false; - } - - private void goAuth(int type, String uploadType, boolean forcePlayVoice) { - stepAfterAuth.setType(type); - stepAfterAuth.setUploadType(uploadType); - stepAfterAuth.setForcePlayVoice(forcePlayVoice); - } - - private void queryShareButtonConfig() { - if (handler.hasMessages(MSG_QUERY_SHARE_CONFIG_RETRY)) { - return; - } - MogoLocation location = - ServiceApisManager.serviceApis.getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation(); - if (NetworkUtils.isConnected(mContext) && location != null && !location.getAdCode().isEmpty()) { - // 有网,且有adcode,直接请求 - Map params = new ArrayMap<>(); - ShareConfigRequest request = new ShareConfigRequest(MoGoAiCloudClientConfig.getInstance().getSn(), - location.getAdCode()); - params.put("data", request.toJson()); - ServiceApisManager.serviceApis.getNetworkApi().create(ShareDevaApiService.class, - HostConst.DEVA_HOST).queryShareButtonConfig(params).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(ShareButtonConfigResponse o) { - super.onSuccess(o); - String config = ""; - if (o.getResult() != null) { - List btnList = o.getResult().getData(); - if (btnList != null && !btnList.isEmpty()) { - config = GsonUtil.jsonFromObject(btnList); - Logger.d(TAG, "获取分享框成功:" + config); - } else { - config = GsonUtil.jsonFromObject(new ArrayList()); - Logger.d(TAG, "获取分享框成功,但是data没有内容"); - } - } else { - Logger.d(TAG, "获取分享框成功,但是detailMsg没有内容"); - } - Logger.d(TAG, "获取分享框配置成功: " + config); - SharedPrefsMgr.getInstance(mContext).putString(KEY_SHARE_CONFIG, config); - CloudPoiManager.getInstance().updateFromConfig(mContext); - } - - @Override - public void onError(Throwable e) { - super.onError(e); - Logger.d(TAG, "获取分享框配置失败: " + e.getMessage()); - retryQueryShareConfig(); - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - Logger.d(TAG, "获取分享框配置失败: " + code + ", " + message); - retryQueryShareConfig(); - } - }); - } else { - // 重试 - retryQueryShareConfig(); - } - queryShareConfigRetryTime++; - } - - private static final int MSG_QUERY_SHARE_CONFIG_RETRY = 1001; - private int queryShareConfigRetryTime = 0; - private static final int QUERY_SHARE_CONFIG_RETRY_TIME_THRESHOLD = 10; - - private void retryQueryShareConfig() { - Logger.d(TAG, "retryQueryShareConfig====" + queryShareConfigRetryTime); - if (queryShareConfigRetryTime > QUERY_SHARE_CONFIG_RETRY_TIME_THRESHOLD) { - // 重试次数超过QUERY_SHARE_CONFIG_RETRY_TIME_THRESHOLD,不再重试 - return; - } - handler.sendEmptyMessageDelayed(MSG_QUERY_SHARE_CONFIG_RETRY, 3000); - } - - private Handler handler = new Handler(this); - - @Override - public boolean handleMessage(Message msg) { - if (msg.what == MSG_QUERY_SHARE_CONFIG_RETRY) { - queryShareButtonConfig(); - return true; - } - return false; - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt deleted file mode 100644 index be18d16b9f..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/StrategyShareProvider.kt +++ /dev/null @@ -1,63 +0,0 @@ -@file:Suppress("DEPRECATION") - -package com.mogo.module.share - -import android.content.Context -import com.alibaba.android.arouter.facade.annotation.Route -import com.alibaba.android.arouter.facade.template.IProvider -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.network.utils.GsonUtil -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.share.adas.AdasFrontCarDistanceY -import com.mogo.module.share.constant.ACCIDENT_STRATEGY_SHARE_PUSH_TYPE -import com.mogo.module.share.constant.S_TAG -import com.mogo.module.share.strategyreceiver.AccidentStrategyReceiver -import com.mogo.module.share.strategyreceiver.BlockStrategy -import com.mogo.service.IMogoServiceApis -import org.json.JSONObject - -/** - * 策略上报入口,服务端策略上报Push的接收地,接收后再调用tanlu相关接口进行视频抓取 - * - * @author lixiaopeng - */ -@Route(path = MogoServicePaths.PATH_STRATEGY_SHARE) -class StrategyShareProvider : IProvider { - private lateinit var blockStrategy: BlockStrategy - private var mContext: Context? = null - - override fun init(context: Context) { - mContext = context - Logger.d(S_TAG, "策略上报Provider初始化====") - val apis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis - blockStrategy = BlockStrategy(context, apis) - // 注册事故 - apis.getSocketManagerApi(context).registerOnMessageListener(ACCIDENT_STRATEGY_SHARE_PUSH_TYPE, AccidentStrategyReceiver(apis)) -// if(!DebugConfig.isLauncher()) { - apis.registerCenterApi.registerMogoLocationListener(MogoServicePaths.PATH_STRATEGY_SHARE) { -// Logger.d(S_TAG,"定位发生变化,准备记录速度: ${it.speed}") - blockStrategy.recordSpeed(it.speed * 3.6F, it.latitude, it.longitude) - } - - apis.adasControllerApi.addAdasDataCallback { - Logger.d(S_TAG, "收到adas数据===$it") - try { - val oriJson = JSONObject(it) - val action = oriJson.optInt("action", -1) - if (action == 0) { - // adas返回前车距离,单位是米 - val frontDistanceItem = GsonUtil.objectFromJson(it, AdasFrontCarDistanceY::class.java) - frontDistanceItem.result.distanceY?.apply { - blockStrategy.refreshFrontDistance(this.toDouble().toInt()) - } - } - } catch (e: Exception) { - Logger.e(S_TAG, e, "解析adas数据异常") - } - - } -// } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluCardViewProvider.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluCardViewProvider.java deleted file mode 100644 index 3fdb0c48e1..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluCardViewProvider.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mogo.module.share; - -import android.content.Context; -import android.content.Intent; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.share.bean.event.MarkerInfo; -import com.mogo.module.share.constant.ShareConstants; -import com.mogo.service.share.IMogoTanluUiProvider; - -import org.greenrobot.eventbus.EventBus; - -import io.reactivex.Single; -import io.reactivex.SingleOnSubscribe; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; -import io.reactivex.schedulers.Schedulers; - -/** - * @author congtaowang - * @since 2019-12-24 - *

    - * 描述 - */ -@Route( path = ShareConstants.TAG ) -public class TanluCardViewProvider implements IMogoTanluUiProvider { - - private static final String TAG = "TanluCardViewProvider"; - private Context mContext; - - @Override - public void init( Context context ) { - mContext = context; - TanluServiceManager.init(context); - TanluManager.getInstance(context).init(); - } - - @Override - public void searchRoadCondition(String intentStr, String data, String city, String keywords) { - Disposable disposable = Single.create((SingleOnSubscribe) emitter -> { - Logger.d(TAG, "searchRoadCondition---> intentStr: " + intentStr + " data: " + data + " " + - "city: " + city + " keywords: " + keywords); - Intent intent = new Intent(intentStr); - intent.putExtra("data", data); - intent.putExtra("city", city); - intent.putExtra("keywords", keywords); - Thread.sleep(3000); - emitter.onSuccess(intent); - }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(intent -> { - Logger.d(TAG, "searchRoadCondition---go real share"); - TanluManager.getInstance(mContext).realShare(intentStr, intent); - }); - } - - @Override - public void shareSuccess(String poiType, MogoLatLng location) { - MarkerInfo markerInfo = new MarkerInfo(poiType, "", location.lon, location.lat, true, "1"); - EventBus.getDefault().post(markerInfo); - } - - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java deleted file mode 100644 index 2dfade35d6..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java +++ /dev/null @@ -1,838 +0,0 @@ -package com.mogo.module.share; - -import android.content.Context; -import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Rect; -import android.net.Uri; -import android.text.TextUtils; -import android.util.Log; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; - -import com.mogo.cloud.tanlu.bean.MarkerExploreWayCloud; -import com.mogo.cloud.tanlu.bean.MarkerExploreWayItemCloud; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; -import com.mogo.eagle.core.utilcode.util.NetworkUtils; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -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.map.marker.anim.OnMarkerAnimationListener; -import com.mogo.map.search.geo.IMogoGeoSearch; -import com.mogo.map.search.geo.IMogoGeoSearchListener; -import com.mogo.map.search.geo.MogoGeocodeAddress; -import com.mogo.map.search.geo.MogoGeocodeResult; -import com.mogo.map.search.geo.MogoPoiItem; -import com.mogo.map.search.geo.MogoRegeocodeResult; -import com.mogo.map.search.poisearch.IMogoPoiSearch; -import com.mogo.map.search.poisearch.IMogoPoiSearchListener; -import com.mogo.map.search.poisearch.MogoPoiResult; -import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; -import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerExploreWayItem; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.share.bean.VoiceCmdData; -import com.mogo.module.share.bean.event.MarkerInfo; -import com.mogo.module.share.callback.RoadInfoCallback; -import com.mogo.module.share.constant.ShareConstants; -import com.mogo.module.share.net.TanluModelData; -import com.mogo.module.share.utils.Utils; -import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.service.intent.IMogoIntentListener; -import com.mogo.service.intent.IMogoIntentManager; -import com.mogo.service.module.IMogoRegisterCenter; -import com.mogo.service.statusmanager.IMogoStatusManager; -import com.mogo.eagle.core.utilcode.mogo.toast.TipDrawable; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import static com.mogo.module.share.constant.ShareConstants.SPECIFIEDROAD_SEARCH; -import static com.mogo.module.share.constant.ShareConstants.TXZ_SPECIFIEDROAD_SEARCH; -import static com.mogo.module.share.constant.ShareConstants.TYPE_NAME_BLOCK; -import static com.mogo.module.share.constant.ShareConstants.TYPE_NAME_CLOSURE; -import static com.mogo.module.share.constant.ShareConstants.TYPE_NAME_TRAFFIC_CHECK; -import static com.mogo.module.share.constant.ShareConstants.VOICE_COMMAND_NOVELTY_QUERY; -import static com.mogo.module.share.constant.ShareConstants.VOICE_COMMAND_QUERY_ROAD_CLOSED; -import static com.mogo.module.share.constant.ShareConstants.VOICE_COMMAND_QUERY_TRAFFIC_CHECK; - -/** - * @author lixiaopeng - * @description 探路和新鲜事的view - * @since 2020/5/19 - */ -public class TanluManager implements IMogoMarkerClickListener, - IMogoPoiSearchListener, - IMogoGeoSearchListener { - - private static final String TAG = "TanluManager"; - private Context mContext; - //map - private IMogoMarkerManager mMarkerManager; - private IMogoStatusManager mMogoStatusManager; - private IMogoIntentManager mogoIntentManager; - private IMogoMapUIController mMApUIController; - private IMogoAnalytics mAnalytics; - private IMogoGeoSearch mIMogoGeoSearch; - - Random random = new Random(); - - //声音控制文字 - private String voiceGetInfoMationTts; - private String[] searchingVoiceStrings; - private String[] searchfaileVoiceStrings; - private String voiceShareSuccessTts; - - private List markerExploreWayList = new ArrayList<>(); - private Bitmap multiMarkerIcon; - private TanluModelData mTanluModelData; - private IMogoRegisterCenter mMogoRegisterCenter; - private String mKeywords; - private String mCity; - Random mRandom = new Random(); - - private static volatile TanluManager sInstance; - - - public TanluManager(Context context) { - mContext = context; - } - - public static TanluManager getInstance(Context context) { - if (sInstance == null) { - synchronized (TanluManager.class) { - if (sInstance == null) { - sInstance = new TanluManager(context); - } - } - } - return sInstance; - } - - - public void init() { - EventBus.getDefault().register(this); - initInterface(); - initModelData(); - initStrings(); - initListener(); - } - - private void initInterface() { - //地图marker,地图操作 - mMarkerManager = TanluServiceManager.getMapService().getMarkerManager(mContext); - mMApUIController = TanluServiceManager.getMapService().getMapUIController(); - //地图逆序 - mIMogoGeoSearch = TanluServiceManager.getMapService().getGeoSearch(mContext); - //唤醒 - mogoIntentManager = TanluServiceManager.getMogoIntentManager(); - mMogoStatusManager = TanluServiceManager.getMogoStatusManager(); - mAnalytics = TanluServiceManager.getAnalytics(); - mMogoRegisterCenter = TanluServiceManager.getIMogoRegisterCenter(); - mIMogoGeoSearch.setGeoSearchListener(this); - } - - private void initModelData() { - if (mTanluModelData == null) { - mTanluModelData = new TanluModelData(mContext); - } - } - - @Override - public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { - Logger.d(TAG, "onRegeocodeSearched -----> "); - } - - @Override - public void onGeocodeSearched(MogoGeocodeResult geocodeResult) { - Logger.d(TAG, "onGeocodeSearched ------mKeywords =" + mKeywords); - if (geocodeResult != null) { - if (geocodeResult.getAddresses() != null && geocodeResult.getAddresses().size() > 0) { - Logger.d(TAG, "geocodeResult.getAddresses().size() = " + geocodeResult.getAddresses().size()); - MogoGeocodeAddress geocodeAddress = geocodeResult.getAddresses().get(0); - MogoLatLng latLon = geocodeAddress.getLatlng(); - Double longit; //经度 - Double lat; //维度 - if (mKeywords.equals("附近")) { - Logger.d(TAG, "附近 ----1---"); - longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); - lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); - } else { - Logger.d(TAG, "其他 ---1----"); - longit = latLon.lon; - lat = latLon.lat; - } - Logger.d(TAG, "geoSearch keywords =" + mKeywords + ">>longitude= " + longit + "--latitude= " + lat); -// getVoiceControlRoadData(mKeywords, lat, longit); - } else { - Logger.d(TAG, "onGeocodeSearched ------mKeywords =" + mKeywords); - handlePoi(mKeywords); - } - } else { - Logger.e(TAG, "geocodeResult.getAddresses() == null"); - speakFailVoice(searchfaileVoiceStrings[1]); - } - } - - /** - * poi 搜索 - * - * @param keywords - */ - private void handlePoi(String keywords) { - String cityCode = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityCode(); - MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(keywords, "", cityCode); - IMogoPoiSearch poiSearch = TanluServiceManager.getMapService().getPoiSearch(mContext, poiSearchQuery); - poiSearch.setPoiSearchListener(this); - poiSearch.searchPOIAsyn(); - } - - /** - * 注册listener监听 - */ - private void initListener() { - if (mogoIntentManager != null) { - // 同行者 xxx堵不堵唤醒词语音注册 - Logger.d(TAG, "initListener===="); - mogoIntentManager.registerIntentListener(TXZ_SPECIFIEDROAD_SEARCH, mogoIntentListener); - // 通用唤醒词语音注册 - mogoIntentManager.registerIntentListener(SPECIFIEDROAD_SEARCH, mogoIntentListener); - mogoIntentManager.registerIntentListener(VOICE_COMMAND_QUERY_TRAFFIC_CHECK, mogoIntentListener); - mogoIntentManager.registerIntentListener(VOICE_COMMAND_QUERY_ROAD_CLOSED, mogoIntentListener); - mogoIntentManager.registerIntentListener(VOICE_COMMAND_NOVELTY_QUERY, mogoIntentListener); - } - } - - Double currentLat = 0.0; //维度 - Double currentLon = 0.0;//经度 - - /** - * 唤醒语音 - */ - private IMogoIntentListener mogoIntentListener = (intentStr, intent) -> { - AIAssist.getInstance(mContext).speakTTSVoice(searchingVoiceStrings[mRandom.nextInt(3)], null); - if (TanluServiceManager.getMogoStatusManager().isMainPageOnResume()) { - // 直接执行相关查询操作 - Logger.d(TAG, "智慧出行在前台,可直接分享--->"); - realShare(intentStr, intent); - } else { - // 需要打开智慧驾驶,然后执行操作 - Logger.d(TAG, "智慧出行没在前台,需要打开 --->"); - intent.setAction(Intent.ACTION_VIEW); - String data = intent.getStringExtra("data") == null ? "" : intent.getStringExtra("data"); - String city = intent.getStringExtra("city") == null ? "" : intent.getStringExtra("city"); - String keywords = intent.getStringExtra("keywords") == null ? "" : intent.getStringExtra("keywords"); - intent.setData(Uri.parse("mogo://launcher/main/switch2?type=search-road-condition" + - "&intentStr=" + intentStr + "&data=" + data + "&city=" + city + "&keywords=" + keywords)); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivity(intent); - } - }; - - public void realShare(String intentStr, Intent intent) { - String data = intent.getStringExtra("data"); - Logger.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data); - VoiceCmdData voiceData = null; - switch (intentStr) { - case VOICE_COMMAND_QUERY_TRAFFIC_CHECK: - // 搜索交通检查 - Logger.d(TAG, "搜索交通检查"); - voiceData = Utils.parseTOVoiceCmdData(data); - voiceData.setObj(TYPE_NAME_TRAFFIC_CHECK); - break; - case VOICE_COMMAND_QUERY_ROAD_CLOSED: - // 搜索封路 - Logger.d(TAG, "搜索封路"); - voiceData = Utils.parseTOVoiceCmdData(data); - voiceData.setLocation(voiceData.getObj()); - voiceData.setObj(TYPE_NAME_CLOSURE); - break; - case SPECIFIEDROAD_SEARCH: - // 拥堵和路况 - Logger.d(TAG, "拥堵和路况"); - voiceData = Utils.parseTOVoiceCmdData(data); - voiceData.setObj(TYPE_NAME_BLOCK); - mKeywords = voiceData.getLocation(); - break; - case VOICE_COMMAND_NOVELTY_QUERY: - Logger.d(TAG, "其他"); - voiceData = Utils.parseTOVoiceCmdData(data); - break; - case TXZ_SPECIFIEDROAD_SEARCH: - Logger.d(TAG, "同行者--xx堵不堵--唤醒--->"); - String keyWords = intent.getStringExtra("keywords"); - mKeywords = keyWords; - String city = intent.getStringExtra("city"); - voiceData = new VoiceCmdData("", city + keyWords, TYPE_NAME_BLOCK); - break; - default: - break; - } - - if (voiceData != null) { - mTanluModelData.queryRodeInfo(mContext, mKeywords, voiceData, new RoadInfoCallback() { - @Override - public void onQueryRoadInfoSuccess(@NotNull List roadInfoList) { - if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) { - Logger.e(TAG, "onQueryRoadInfoSuccess roadInfoList == null "); - if (TextUtils.equals(mKeywords, "附近")) { - speakFailVoice("未发现附近的特殊路况"); - } else { - speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); - } - moveToMarker(currentLat, currentLon); - return; - } - Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size() - + " >>currentLat = " + currentLat + " -->currentLon = " + currentLon); - MogoLocation location = TanluServiceManager.getLocationClient().getLastKnowLocation(); - if (location != null) { - mCity = location.getCityName(); - } - - addMarkersAction(convertMarkerExploreWayList((List) roadInfoList), currentLat, currentLon); - } - - @Override - public void onQueryRoadInfoFail(@NotNull String msg, int code) { - Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg); -// speakFailVoice(searchfaileVoiceStrings[1]); - if (TextUtils.equals(mKeywords, "附近")) { - speakFailVoice("未发现附近的特殊路况"); - } else { - speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); - } - moveToMarker(currentLat, currentLon); - } - - @Override - public void onLocatSuccess(double lat, double lon) { - currentLat = lat; - currentLon = lon; - } - }); - } - } - - - /** - * 列表转换 - * - * @param list - * @return - */ - private List convertMarkerExploreWayList(List list) { - List convertList = new ArrayList<>(); - if (list != null && list.size() != 0) { - Log.d(TAG, "--------1--------"); - for (int i = 0; i < list.size(); i++) { - MarkerExploreWayCloud exploreWayCloud = list.get(i); - Log.d(TAG, "--------2--------"); - if (exploreWayCloud != null) { - Log.d(TAG, "--------3--------"); - MarkerExploreWay exploreWay = new MarkerExploreWay(); - exploreWay.setInfoId(exploreWayCloud.getInfoId()); - exploreWay.setType(exploreWayCloud.getType()); - exploreWay.setPoiType(exploreWayCloud.getPoiType()); - exploreWay.setSn(exploreWayCloud.getSn()); - - MarkerLocation location = new MarkerLocation(); - location.setLon(exploreWayCloud.getLocation().getLon()); - location.setLat(exploreWayCloud.getLocation().getLat()); - exploreWay.setLocation(location); - exploreWay.setDirection((int) exploreWayCloud.getDirection()); - exploreWay.setCanLive(exploreWayCloud.getCanLive()); - exploreWay.setFileType((int) exploreWayCloud.getFileType()); - exploreWay.setAddr(exploreWayCloud.getAddr()); - exploreWay.setGenerateTime(exploreWayCloud.getGenerateTime()); - exploreWay.setCityName(exploreWayCloud.getCityName()); - exploreWay.setDistance(exploreWayCloud.getDistance()); - exploreWay.setFabulous(exploreWayCloud.isFabulous()); - exploreWay.setInfoCheckNode(exploreWayCloud.getInfoCheckNode()); - exploreWay.setUploadType(exploreWayCloud.getUploadType()); - - MarkerUserInfo userInfo = new MarkerUserInfo(); - userInfo.setAge(Integer.valueOf(exploreWayCloud.getUserInfo().getAge())); - userInfo.setGender(exploreWayCloud.getUserInfo().getGender()); - userInfo.setLastActiveweekAvgscore(exploreWayCloud.getUserInfo().getLastActiveweekAvgscore()); - userInfo.setSafeLabel(exploreWayCloud.getUserInfo().getSafeLabel()); - userInfo.setSn(exploreWayCloud.getUserInfo().getSn()); - userInfo.setUserHead(exploreWayCloud.getUserInfo().getUserHead()); - userInfo.setUserId(exploreWayCloud.getUserInfo().getUserId()); - userInfo.setUserName(exploreWayCloud.getUserInfo().getUserName()); - exploreWay.setUserInfo(userInfo); - - List items = new ArrayList<>(); - if (exploreWayCloud.getItems() != null && exploreWayCloud.getItems().size() > 0) { - Log.d(TAG, "--------4----------"); - for (int j = 0; j < exploreWayCloud.getItems().size(); j++) { - MarkerExploreWayItemCloud cloudItem = exploreWayCloud.getItems().get(j); - MarkerExploreWayItem item = new MarkerExploreWayItem(); - item.setContent(cloudItem.getContent()); - item.setIllegalCount(cloudItem.getIllegalCount()); - item.setThumbnail(cloudItem.getThumbnail()); - item.setUrl(cloudItem.getUrl()); - items.add(item); - } - } - convertList.add(exploreWay); - } - } - - markerExploreWayList.addAll(convertList); - Log.d(TAG, "--------5--------- markerExploreWayList.size() =" + markerExploreWayList.size()); - } else { - Logger.e(TAG, "convertMarkerExploreWayList list == null "); - } - - return convertList; - } - - /** - * 添加marker - */ - private void addMarkersAction(List list, final double lat, final double lon) { - //播报搜索结果 - speakSuccessVoice(list, ""); - - //移动到具体位置 - if (mMogoStatusManager != null) { - mMogoStatusManager.setUserInteractionStatus(ShareConstants.MODEL_NAME, true, true); - } - moveToMarker(lat, lon); - inputlon = lon; - inputlat = lat; - - Logger.d(TAG, "addMarker lat =" + lat + ">>>lon =" + lon); - if (markerExploreWayList != null && markerExploreWayList.size() > 0) { - markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的 - } - markerExploreWayList.addAll(list); - - //清除探路之前的数据 - if (mMarkerManager != null) { - mMarkerManager.removeMarkers(ShareConstants.MODEL_NAME); - } - //添加埋点数据 - datalon = list.get(0).getLocation().getLon(); - datalat = list.get(0).getLocation().getLat(); - - for (int i = 0; i < list.size(); i++) { - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerExploreWayList.get(i)); - markerShowEntity.setTextContent(list.get(i).getAddr()); - - markerShowEntity.setMarkerLocation(markerExploreWayList.get(i).getLocation()); - markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); - - TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); - - try { - post2AddAndStartAnimation(markerShowEntity, i * 100L); - } catch (Exception e) { - e.printStackTrace(); - } - } - - //防止刷新策略改变 - mMogoStatusManager.setUserInteractionStatus(ShareConstants.MODEL_NAME, true, true); - //展示6个在区域内显示 - showBonndsRoadtion(); - //直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据 - } - - - /** - * marker动画 - * - * @param entity - * @param delay - */ - private void post2AddAndStartAnimation(MarkerShowEntity entity, long delay) { - if (entity == null) { - return; - } - WorkThreadHandler.getInstance().postDelayed(() -> { - if (entity == null) { - return; - } - - IMogoMarker marker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(entity); - marker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() { - @Override - public void onAnimStart() { - } - - @Override - public void onAnimEnd() { - if (marker.isDestroyed()) { - return; - } - marker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null); - } - }); - }, delay); - } - - private void moveToMarker(double lat, double lon) { - Logger.d(TAG, "moveToMarcker lat = " + lat + " >>>>lon = " + lon); - MogoLatLng latLng = new MogoLatLng(lat, lon); - mMogoStatusManager.setUserInteractionStatus(TAG, true, false); - if (!mMogoStatusManager.isVrMode()) { - mMApUIController.moveToCenter(latLng); - } - } - - private void moveNotFresh() { - mMogoStatusManager.setUserInteractionStatus(TAG, true, false); - } - - /** - * marker点击事件 - * - * @param marker - * @return - */ - @Override - public boolean onMarkerClicked(IMogoMarker marker) { - return true; - } - - /** - * 释放资源 - */ - public void releaseAction() { -// EventBus.getDefault().unregister(this); - mMogoRegisterCenter.unregisterMogoNaviListener(ShareConstants.MODEL_NAME); - } - - /** - * poi - * - * @param p0 - * @param p1 - */ - @Override - public void onPoiSearched(MogoPoiResult p0, int p1) { - if (p1 == 1000) { - if (p0.getPois() != null && p0.getPois().size() > 0) { - MogoPoiItem poi = p0.getPois().get(0); - MogoLatLng latLon = poi.getPoint(); - Double longit; //经度 - Double lat; //维度 - if (TextUtils.equals(mKeywords, "附近")) { - Logger.d(TAG, "附近 -onPoiSearched---1---"); - longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); - lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); - } else { - Logger.d(TAG, "其他 -onPoiSearched---1----"); - longit = latLon.lon; - lat = latLon.lat; - } -// getVoiceControlRoadData(mKeywords, lat, longit); - Logger.d(TAG, "setOnPoiSearchListener keywords =" + mKeywords + ">>longitude= " + longit + "--latitude" + lat); - } else { - Logger.e(TAG, "poi == null"); - Double longit; //经度 - Double lat; //维度 - if (TextUtils.equals(mKeywords, "附近")) { - Logger.d(TAG, "附近 -onPoiSearched---2---"); - longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); - lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); -// getVoiceControlRoadData(mKeywords, lat, longit); - } else { - Logger.d(TAG, "其他 -onPoiSearched---2----"); - speakFailVoice(searchfaileVoiceStrings[1]); - } - } - } else { - Logger.e(TAG, "poi search result p1 = " + p1); - speakFailVoice(searchfaileVoiceStrings[1]); - } - } - - @Override - public void onPoiItemSearched(MogoPoiItem item, int errorCode) { - if (item == null) { - return; - } - } - - /** - * 接收到分享对应数据打点 - * - * @param event - */ - @Subscribe(threadMode = ThreadMode.MAIN) - public void onMarkerInfo(final MarkerInfo event) { - if (event == null) { - return; - } - - if (!NetworkUtils.isConnected(mContext)) { //没有网络 - TipToast.shortTip("分享失败,请检查网络", new TipDrawable(mContext.getResources().getDrawable(R.drawable.module_tanlu_upload_fail))); - } else { - float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度 - Logger.d(TAG, "onMarkerInfo event.type = " + event.type + " >>event.lat = " + event.lat + " >>event.lon = " + event.lon + " >>event.imageUrl =" + event.imageUrl); - String poiType = event.type; - String fromType = event.fromType; - boolean isCumtom = event.isCumtom; - Logger.d(TAG, "onMarkerInfo share poiType = " + poiType + " --isCumtom = " + isCumtom + " >> getMathRandom = " + getMathRandom() + " >>> bearing = " + bearing + ">>>fromType = " + fromType); - if (!fromType.equals("5")) { - if (isCumtom && !poiType.equals("0")) { - // 不管在不在前台,都要提示分享成功 - AIAssist.getInstance(mContext).speakTTSVoice(( - String.format(voiceShareSuccessTts, getMathRandom())), null); - TipToast.shortTip("分享成功", new TipDrawable(mContext.getResources().getDrawable(R.drawable.module_tanlu_upload_success))); - - if (TanluServiceManager.getMogoStatusManager().isMainPageOnResume()) { - double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); - double lon = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); - Log.d(TAG, "onMarkerInfo lat = " + lat + " >>>> lon = " + lon); - String cityName = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityName(); - String address = TanluServiceManager.getLocationClient().getLastKnowLocation().getAddress(); - MarkerExploreWay markerExploreWay = new MarkerExploreWay(); - markerExploreWay.setCityName(cityName); - markerExploreWay.setPoiType(poiType); - - com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); - markerLocation.setLat(lat); - markerLocation.setLon(lon); - markerLocation.setAddress(address); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerExploreWay); - markerShowEntity.setTextContent(address); - markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); - - markerShowEntity.setMarkerLocation(markerLocation); - - IMogoMarker mogoMarker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); - if (mogoMarker != null) { - mogoMarker.setClickable(false); - } else { - Logger.e(TAG, "mogoMarker == null "); - } - - //添加图片动画 - Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.tanlu_circle_image, null); - MarkerShowEntity markerShowEntityAnimation = new MarkerShowEntity(); - markerShowEntityAnimation.setTextContent(address); - markerShowEntityAnimation.setMarkerType(ShareConstants.MODEL_NAME); - MogoMarkerOptions options = new MogoMarkerOptions() - .data(markerShowEntityAnimation) - .icon(bitmap) - .anchor(0.5f, 0.5f) - .latitude(lat) - .owner(ShareConstants.MODEL_NAME) - .longitude(lon); - - IMogoMarker mogoAnimationMarker = mMarkerManager.addMarker(ShareConstants.MODEL_NAME, options); - mogoAnimationMarker.startScaleAnimation(0, 1f, 0, 1f, 500, new LinearInterpolator(), new OnMarkerAnimationListener() { - @Override - public void onAnimStart() { - } - - @Override - public void onAnimEnd() { - UiThreadHandler.postDelayed(() -> { - if (mogoAnimationMarker != null) { - mogoAnimationMarker.destroy(); - } - }, 1_200L); - } - }); - } - } else { - Logger.e(TAG, "onMarkerInfo share onCompleted poiType = -1 --- else ---->"); - } - } - } - mMogoStatusManager.setUploadingStatus(ShareConstants.MODEL_NAME, false); - } - - private void showJumpAnimation(final IMogoMarker mogoMarker) { - if (mogoMarker == null) { - return; - } - - mogoMarker.startJumpAnimation(80, 300, new Interpolator() { - @Override - public float getInterpolation(float input) { - if (input <= 0.5) { - return (float) (0.5f - 2.0 * (0.5 - input) * (0.5 - input)); - } else { - return (float) (0.5f - Math.sqrt(input - 0.5f) * (1.5f - input)); - } - } - }, new OnMarkerAnimationListener() { - @Override - public void onAnimStart() { - } - - @Override - public void onAnimEnd() { - } - }); - } - - private void showBonndsRoadtion() { - Logger.e(TAG, "showBonndsRoadtion markerExploreWayList.size() = " + markerExploreWayList.size()); - //经度 - Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); - //纬度 - Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); - Rect rect = new Rect( - (int) mContext.getResources().getDimension(R.dimen.tanlu_module_map_left), - (int) mContext.getResources().getDimension(R.dimen.tanlu_module_map_top), - (int) mContext.getResources().getDimension(R.dimen.tanlu_module_map_right), - (int) mContext.getResources().getDimension(R.dimen.tanlu_module_map_bottom)); - - moveNotFresh(); - //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置) - //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要) - if (getMogoList() != null && getMogoList().size() > 0) { - Log.d(TAG, "showBonndsRoadtion size = " + getMogoList().size()); - MogoLatLng mogoLatLng = new MogoLatLng(lat, longit); - mMApUIController.showBounds(ShareConstants.MODEL_NAME, mogoLatLng, - getMogoList(), rect, false); - } else { - Log.e(TAG, "getMogoList() == null "); - } - - } - - - /** - * 构造经纬度列表 - * - * @return - */ - private List getMogoList() { - List list = new ArrayList<>(); - if (markerExploreWayList != null && markerExploreWayList.size() > 0) { - if (markerExploreWayList.size() < 6) { - for (int i = 0; i < markerExploreWayList.size(); i++) { - MarkerLocation location = markerExploreWayList.get(i).getLocation(); - if (location != null) { - MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon()); - list.add(mogoLatLng); - } else { - Logger.e(TAG, "getMogoList() < 6 location == null"); - } - } - } else { - for (int i = 0; i < 6; i++) { - MarkerLocation location = markerExploreWayList.get(i).getLocation(); - if (location != null) { - MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon()); - list.add(mogoLatLng); - } else { - Logger.e(TAG, "getMogoList() location == null"); - } - } - } - } else { - Logger.e(TAG, "getMogoList() markerExploreWay == null"); - } - return list; - } - - private void speakSuccessVoice(List informations, String - trafficStatus) { - Logger.d(TAG, "speakSuccessVoice informations.size() = " + informations.size()); - switch (informations.size()) { - case 0: - speakFailVoice(searchfaileVoiceStrings[random.nextInt(1)]); - break; - - case 1: - trackVoiceSearch(1); - AIAssist.getInstance(mContext).speakTTSVoice(( - String.format(voiceGetInfoMationTts, "1") + trafficStatus), null); - break; - - case 2: - trackVoiceSearch(1); - AIAssist.getInstance(mContext).speakTTSVoice(( - String.format( - voiceGetInfoMationTts, - "2" - ) + trafficStatus), null); - break; - case 3: - trackVoiceSearch(1); - AIAssist.getInstance(mContext).speakTTSVoice(( - String.format( - voiceGetInfoMationTts, - "3" - ) + trafficStatus), null); - break; - - default: - trackVoiceSearch(1); - AIAssist.getInstance(mContext).speakTTSVoice(( - String.format( - voiceGetInfoMationTts, - "多" - ) + trafficStatus), null); - } - } - - private void initStrings() { - voiceGetInfoMationTts = - mContext.getResources().getString(R.string.voice_get_informations_tts); - searchingVoiceStrings = - mContext.getResources().getStringArray(R.array.searching_voice_string_array); - searchfaileVoiceStrings = - mContext.getResources().getStringArray(R.array.search_fail_voice_array); - voiceShareSuccessTts = mContext.getResources().getString(R.string.tanlu_share_success); - } - - private void speakFailVoice(String string) { - AIAssist.getInstance(mContext).speakTTSVoice(string, null); - } - - - Double inputlon = 0.0;//经度 - Double inputlat = 0.0; //维度 - Double datalon = 0.0; //经度 - Double datalat = 0.0; //维度 - - //上报语音搜索 - private void trackVoiceSearch(int type) { - Log.e(TAG, "type = " + type + "-- mCity =" + mCity + "-- mKeywords =" + mKeywords); - Map properties = new HashMap<>(); - properties.put("searcharea", mKeywords); - properties.put("city", mCity); - mAnalytics.track(ShareConstants.CARNET_VOICE_SEARCH, properties); - } - - private String getMathRandom() { - Random random = new Random(); - int temp = random.nextInt(50) + 10; - - return String.valueOf(temp); - } - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluServiceManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluServiceManager.java deleted file mode 100644 index 2ba015cd7a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluServiceManager.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.mogo.module.share; - -import android.content.Context; - -import com.mogo.map.location.IMogoLocationClient; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.service.IMogoServiceApis; -import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.service.intent.IMogoIntentManager; -import com.mogo.service.map.IMogoMapService; -import com.mogo.service.module.IMogoRegisterCenter; -import com.mogo.service.statusmanager.IMogoStatusManager; - -/** - * @author lixiaopeng - * @since 2020-5-19 - *

    - * 持有服务接口实例 - */ -public class TanluServiceManager { - private static IMogoMapService mMapService; - private static IMogoLocationClient mLocationClient; - private static IMogoServiceApis mServiceApis; - private static IMogoStatusManager mIMogoStatusManager; - private static IMogoAnalytics mAnalytics; - private static IMogoIntentManager mogoIntentManager; - private static IMogoRegisterCenter mogoRegisterCenter; - - public static void init(Context context) { - mServiceApis = MogoApisHandler.getInstance().getApis(); - mMapService = mServiceApis.getMapServiceApi(); - mIMogoStatusManager = mServiceApis.getStatusManagerApi(); - mAnalytics = mServiceApis.getAnalyticsApi(); - mogoIntentManager = mServiceApis.getIntentManagerApi(); - mogoRegisterCenter = mServiceApis.getRegisterCenterApi(); - mLocationClient = mMapService.getSingletonLocationClient(context); - } - - - public static IMogoRegisterCenter getIMogoRegisterCenter() { - return mogoRegisterCenter; - } - - public static IMogoMapService getMapService() { - return mMapService; - } - - public static IMogoLocationClient getLocationClient() { - return mLocationClient; - } - - public static IMogoAnalytics getAnalytics() { - return mAnalytics; - } - - public static IMogoIntentManager getMogoIntentManager() { - return mogoIntentManager; - } - - public static IMogoStatusManager getMogoStatusManager() { - return mIMogoStatusManager; - } - - public static IMogoServiceApis getServiceApis() { - return mServiceApis; - } - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TrafficUploadProvider.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TrafficUploadProvider.kt deleted file mode 100644 index 9eb353f33c..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TrafficUploadProvider.kt +++ /dev/null @@ -1,23 +0,0 @@ -@file:Suppress("DEPRECATION") - -package com.mogo.module.share - -import android.content.Context -import com.alibaba.android.arouter.facade.annotation.Route -import com.alibaba.android.arouter.facade.template.IProvider -import com.mogo.module.share.manager.TrafficUploadManager.Companion.trafficUpload -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.service.share.IMogoTrafficUploadProvider - -@Route( path = MogoServicePaths.PATH_TRAFFIC_UPLOAD ) -class TrafficUploadProvider :IProvider , IMogoTrafficUploadProvider{ - - override fun init(context: Context?) { - - } - - override fun verifyCurrentTrafficStatus() { - trafficUpload.verityTrafficStatus() - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt deleted file mode 100644 index f37f902941..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/VoiceCmdService.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.mogo.module.share - -import android.app.Service -import android.content.Intent -import android.os.IBinder -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.share.constant.ShareConstants -import com.mogo.module.share.manager.ISeekHelpListener -import com.mogo.module.share.manager.SeekHelpManager - -/** - * 用来处理唤醒词 - * - * @author tongchenfei - */ -class VoiceCmdService : Service() { - companion object { - private const val TAG = "VoiceCmdService" - } - - private val seekListener = object : ISeekHelpListener { - override fun onSeekHelpSuccess() { - // 上报完成,关掉自己 - Logger.d(TAG, "上报完成,成功") - stopSelf() - } - - override fun onSeekHelpFail() { - // 上报完成,关掉自己 - Logger.d(TAG, "上报完成,失败") - stopSelf() - } - } - - override fun onBind(intent: Intent?): IBinder? { - return null - } - - override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - intent?.let { - if (intent.getIntExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, 0) == ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP) { - // 收到语音指令,准备上报求助 - Logger.i(TAG, "收到语音指令,准备上报求助") - SeekHelpManager.seekHelp(this, seekListener, "2") - } - } - return super.onStartCommand(intent, flags, startId) - } - - override fun onDestroy() { - super.onDestroy() - Logger.d(TAG, "onDestroy") - SeekHelpManager.removeSeekHelpListener(seekListener) - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adapter/ShareBtnAdapter.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/adapter/ShareBtnAdapter.kt deleted file mode 100644 index f6b064bf74..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adapter/ShareBtnAdapter.kt +++ /dev/null @@ -1,47 +0,0 @@ -package com.mogo.module.share.adapter - -import android.content.Context -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp -import com.mogo.module.share.R -import com.mogo.module.share.bean.FixableButton - -/** - * 可配置按钮适配器 - * - * @author tongchenfei - */ -class ShareBtnAdapter(val context:Context): RecyclerView.Adapter() { - private val btnList = ArrayList() - var btnClickListener:((btn:FixableButton)->Unit)? = null - fun setFixableButtonList(btns:ArrayList) { - btnList.clear() - btnList.addAll(btns) - notifyDataSetChanged() - } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ShareBtnViewHolder { - val view = LayoutInflater.from(context).inflate(R.layout.item_share_btn, parent,false) - return ShareBtnViewHolder(view) - } - - override fun getItemCount(): Int =btnList.size - - override fun onBindViewHolder(holder: ShareBtnViewHolder, position: Int) = holder.bindData(btnList[position]) - - inner class ShareBtnViewHolder(itemView:View):RecyclerView.ViewHolder(itemView){ - private val ivIcon:ImageView = itemView.findViewById(R.id.ivShareIcon) - private val tvContent:TextView = itemView.findViewById(R.id.tvShareContent) - fun bindData(btn: FixableButton) { - GlideApp.with(context).load(btn.iconRes).into(ivIcon) - tvContent.text = btn.title - ivIcon.setOnClickListener { - btnClickListener?.invoke(btn) - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/AdasDataInfo.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/AdasDataInfo.java deleted file mode 100644 index fb28a83933..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/AdasDataInfo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.module.share.adas; - -/** - * @author nie yunlong - * @des - * @date 2020/10/20 - */ -public class AdasDataInfo { - /** - * 距离 - */ - private String distanceY; - - public String getDistanceY() { - return distanceY; - } - - public void setDistanceY(String distanceY) { - this.distanceY = distanceY; - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/AdasFrontCarDistanceY.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/AdasFrontCarDistanceY.java deleted file mode 100644 index 51b13e2df9..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/AdasFrontCarDistanceY.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mogo.module.share.adas; - -/** - * @author nie yunlong - * @des 正前方距离y - * @date 2020/10/20 - */ -public class AdasFrontCarDistanceY extends BasePushMsgModel { - - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/BasePushMsgModel.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/BasePushMsgModel.java deleted file mode 100644 index 9f4f0fae9f..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/adas/BasePushMsgModel.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mogo.module.share.adas; - -import java.io.Serializable; - -/** - * @author nie yunlong - * @des - * @date 2020/10/20 - */ -public class BasePushMsgModel implements Serializable { - //行为 - private int action; - //结果 - private T result; - - public int getAction() { - return action; - } - - public void setAction(int action) { - this.action = action; - } - - public T getResult() { - return result; - } - - public void setResult(T result) { - this.result = result; - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/AverateSpeedResponse.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/AverateSpeedResponse.kt deleted file mode 100644 index 72801a6515..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/AverateSpeedResponse.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.data.BaseData - -data class AverateSpeedResponse(var result:Result): - BaseData() -data class Result(var upload:Boolean,var poiType:String) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseDataCompat.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseDataCompat.kt deleted file mode 100644 index 3aea267196..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseDataCompat.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.data.BaseData - - -data class BaseDataCompat(var result:T?): BaseData() \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseRepository.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseRepository.kt deleted file mode 100644 index 27fe51ae50..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseRepository.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.mogo.module.share.bean - -open class BaseRepository { - - suspend fun apiCall(call: suspend () -> BaseResponse): BaseResponse { - return call.invoke() - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseResponse.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseResponse.kt deleted file mode 100644 index 1cb49ca6b1..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/BaseResponse.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.module.share.constant.HttpConstant - - -class BaseResponse(val code: Int, val msg: String, val result: T) { - fun isSuccess(baseUrl: String): Boolean { - return when (baseUrl) { - HttpConstant.getNetHost() -> true - else -> false - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/CityStrategy.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/CityStrategy.kt deleted file mode 100644 index 983432691a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/CityStrategy.kt +++ /dev/null @@ -1,91 +0,0 @@ -package com.mogo.module.share.bean - -class CityStrategy(video: Video, pic: Pic) { - var video: Video? = video - var pic: Pic? = pic -} - -fun Video.getMaxSpeed(): Int { - return if (maxSpeed == 0) { - -1 - } else { - maxSpeed - } -} - -class Video { - var strategyId: String //策略ID - var reportType: Int //一次性、周期性 - var reportTimeInterval: Int //上传时间间隔 单位:分钟 - var infoTimeout: Int //情报失效时间 单位:分钟 - var minSpeed: Int = -1//最小速度 - var maxSpeed: Int = -1//最大速度 - var strategyType: Int //策略类型:城市、热门区域、非上报区域等 - - constructor( - strategyId: String, - reportType: Int, - reportTimeInterval: Int, - infoTimeout: Int, - minSpeed: Int, - maxSpeed: Int, - strategyType: Int - ) { - this.strategyId = strategyId - this.reportType = reportType - this.reportTimeInterval = reportTimeInterval - this.infoTimeout = infoTimeout - this.minSpeed = minSpeed - this.maxSpeed = maxSpeed - this.strategyType = strategyType - } -} - -fun Pic.getMaxSpeed(): Int { - return if (maxSpeed == 0) { - -1 - } else { - maxSpeed - } -} - - -class Pic { - var strategyId: String //策略ID - var reportType: Int //一次性、周期性 - var reportTimeInterval: Int //上传时间间隔 单位:分钟 - var infoTimeout: Int //情报失效时间 单位:分钟 - var minSpeed: Int = -1 //最小速度 - var maxSpeed: Int = -1 //最大速度 - var strategyType: Int //策略类型:城市、热门区域、非上报区域等 - - constructor( - strategyId: String, - reportType: Int, - reportTimeInterval: Int, - infoTimeout: Int, - minSpeed: Int, - maxSpeed: Int, - strategyType: Int - ) { - this.strategyId = strategyId - this.reportType = reportType - this.reportTimeInterval = reportTimeInterval - this.infoTimeout = infoTimeout - this.minSpeed = minSpeed - this.maxSpeed = maxSpeed - this.strategyType = strategyType - } -} - -class StrategyRequest { - var lon: Double - var lat: Double - var cityCode: String - - constructor(lon: Double, lat: Double, cityCode: String) { - this.lon = lon - this.lat = lat - this.cityCode = cityCode - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt deleted file mode 100644 index 6e55833ed0..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/FixableButton.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.data.BaseData -import com.mogo.module.share.R -import com.mogo.service.share.IMogoTanluProvider.* - -/** - * 可配置按钮封装 - * @author tongchenfei - */ -class FixableButton(val id: Int = 0, val poiType: String = "10007", val iconUrl: String = "", val iconInfoUrl: String = "", val title: String = "拥堵") { - val iconRes: Int - get() = when (poiType) { - TYPE_SEEK_HELP -> R.drawable.module_common_icon_seek_help - TYPE_DENSE_FOG -> R.drawable.share_dense_fog - TYPE_ROAD_ICY -> R.drawable.share_road_icy - TYPE_STAGNANT_WATER -> R.drawable.share_stagnant_water - TYPE_REAL_TIME_TRAFFIC -> R.drawable.share_real_time_traffic - TYPE_ROAD_CONSTRUCTION -> R.drawable.share_road_construction - TYPE_ACCIDENT -> R.drawable.share_accident - TYPE_CLOSURE -> R.drawable.share_road_closure - TYPE_TRAFFIC_CHECK -> R.drawable.share_traffic_check - TYPE_BLOCK -> R.drawable.share_block_up - else -> R.drawable.share_block_up - } -} - -class ShareButtonConfigResponse : BaseData() { - var result: ShareButtonConfigDetailMsg? = null -} - -data class ShareButtonConfigDetailMsg(var data: List) \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/InformationBody.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/InformationBody.kt deleted file mode 100644 index fea9941f1d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/InformationBody.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.share.bean - -data class InformationBody( - val data: String, - val addr: String, - val areaCode: String, - val areaName: String, - val cityCode: String, - val cityName: String, - val generateTime: Long, - val lat: Double, - val lon: Double, - val provinceName: String, - val sn: String, - val street: String, - val type: Int, - val uid: Int, - val infoType: Int, - val infoTimeout:Int, - val trafficInfoType:String, // 上报情报类型 - val isShare: Boolean, // 是否分享给附近车机 - val direction: Float, - val poiType: String, //类型分类 - val mainInfoId: Long, //事件id - val speed: Float, //车速 - val fromType: String //上报触发来源 -) \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/LocationInfo.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/LocationInfo.kt deleted file mode 100644 index 8966c5038b..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/LocationInfo.kt +++ /dev/null @@ -1,56 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.data.map.MogoLatLng - -fun LocationInfo.toLatLngPoint(): com.mogo.eagle.core.data.map.MogoLatLng { - return com.mogo.eagle.core.data.map.MogoLatLng(latitude, longitude) -} - -class LocationInfo { - var provinceName: String = "" //省的名称 - var cityName: String = "" //城市的名称 - var cityCode :String = "" //城市编码 - var areaName :String = "" //区县名称 - var areaCode :String = "" //区县编码 - var street :String = "" //街道名称 - var longitude: Double = 0.0 - var latitude: Double = 0.0 - var address: String = "" - var time: Long = 0L - var direction: Float = 0.0f - constructor() - - constructor(longitude: Double, latitude: Double, address: String, time: Long) { - this.longitude = longitude - this.latitude = latitude - this.address = address - this.time = time - } - - constructor( - provinceName: String, - cityName: String, - cityCode: String, - areaName: String, - areaCode: String, - street: String, - longitude: Double, - latitude: Double, - address: String, - time: Long, - direction: Float = 0.0f - ) { - this.provinceName = provinceName - this.cityName = cityName - this.cityCode = cityCode - this.areaName = areaName - this.areaCode = areaCode - this.street = street - this.longitude = longitude - this.latitude = latitude - this.address = address - this.time = time - this.direction = direction - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/Results.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/Results.kt deleted file mode 100644 index 098ddadb32..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/Results.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.mogo.module.share.bean - -class Results(var cityStrategy: CityStrategy) \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/RoadInfoRequest.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/RoadInfoRequest.kt deleted file mode 100644 index 6fb5f5a59a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/RoadInfoRequest.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.mogo.module.share.bean - -data class RoadInfoRequest(var location:Location,var poiTypes:Array,var onlyFocus:Boolean = false,var onlySameCity:Boolean = false) - -data class Location(var lat:Double,var lon:Double) \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/RoadInfos.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/RoadInfos.kt deleted file mode 100644 index 171424d77a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/RoadInfos.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.data.BaseData -import com.mogo.module.common.entity.MarkerExploreWay - -data class RoadInfos(var data:List) : BaseData() diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/SeekRecord.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/SeekRecord.kt deleted file mode 100644 index 68a2057e9d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/SeekRecord.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.mogo.module.share.bean - -/** - * 求助记录,recordTime建议使用SystemClock.elapsedRealtime记录,因为此时间主要是为了做时间差,而不是精确时间 - */ -data class SeekRecord(val recordTime: Long) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/SeekRequest.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/SeekRequest.kt deleted file mode 100644 index 3067a3a24c..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/SeekRequest.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.network.utils.GsonUtil - -/** - * 故障求助接口请求参数 - * - * @param sn 当前用户sn - * @param vehicleType 改变成的目标车辆类型,因为是故障求助,所以默认是改成4(故障车辆) - */ -data class SeekRequest(val sn:String,val vehicleType:Int = 4) - -fun SeekRequest.getJson():String{ - return GsonUtil.jsonFromObject(this) -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/ShareConfigRequest.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/ShareConfigRequest.kt deleted file mode 100644 index 8f4c5da0d2..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/ShareConfigRequest.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.eagle.core.network.utils.GsonUtil - -class ShareConfigRequest(val sn:String,val adCode:String) { - fun toJson():String{ - return GsonUtil.jsonFromObject(this) - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/StepAfterAuth.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/StepAfterAuth.kt deleted file mode 100644 index 68e16ee164..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/StepAfterAuth.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.mogo.module.share.bean - -/** - * 授权完成后,下一步要做的事情 - */ -class StepAfterAuth(var type:Int,var uploadType:String,var forcePlayVoice:Boolean = false) - -const val STEP_AFTER_AUTH_TYPE_SHOW_DIALOG = 1 -const val STEP_AFTER_AUTH_TYPE_UPLOAD = 2 -const val STEP_AFTER_AUTH_TYPE_SEEK_HELP = 3 \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/StrategyServiceModel.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/StrategyServiceModel.kt deleted file mode 100644 index cbace185d8..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/StrategyServiceModel.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.share.bean - -import com.google.gson.Gson -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.module.common.constants.HostConst -import com.mogo.module.share.net.HttpClient -import com.mogo.module.share.utils.LocationUtil - -class StrategyServiceModel : BaseRepository() { - - suspend fun getCityStrategy(): BaseResponse { - return apiCall { - val map = hashMapOf() - map["sn"] = MoGoAiCloudClientConfig.getInstance().getSn() - val locInfo = LocationUtil.getInstance().getLocationInfo() - map["data"] = Gson().toJson( - StrategyRequest( - locInfo.longitude, - locInfo.latitude, - locInfo.cityCode - ) - ) - HttpClient.getInstance(HostConst.GEOFENCE_HOST).getHttpApi().getCityStrategy(map) - } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/VoiceCmdData.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/VoiceCmdData.kt deleted file mode 100644 index 33370c5357..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/VoiceCmdData.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.module.share.bean - -import com.mogo.module.share.constant.ShareConstants.* - - -/** - * 语音指令附带数据,目前只针对道路事件查询 */ -class VoiceCmdData(var op: String, var location: String, var obj: String) { - - /** - * 将obj转成服务端可识别的道路事件类型 - */ - val type: String - get() { - return when (obj) { - TYPE_NAME_BLOCK -> TANLU_ROAD_CONGESTION_COMPAT - TYPE_NAME_TRAFFIC_CHECK -> TANLU_TRAFFIC_CHECK_COMPAT - TYPE_NAME_CLOSURE -> TANLU_ROAD_CLOSURE_COMPAT - TYPE_NAME_ACCIDENT -> TANLU_ROAD_ACCIDENT - TYPE_NAME_REAL_TIME_TRAFFIC -> TANLU_ROAD_CURRENT - TYPE_NAME_STAGNANT_WATER -> TANLU_ROAD_PONDING - TYPE_NAME_ROAD_ICY -> TANLU_ROAD_ICING - TYPE_NAME_DENSE_FOG -> TANLU_ROAD_HEAVY_FOG - TYPE_NAME_ROAD_CONSTRUCTION -> TANLU_ROAD_CONSTRUCTION - else -> "" - } - } - - fun isHere(): Boolean { - return "附近" == location - } - - override fun toString(): String { - return "VoiceCmdData(op='$op', location='$location', obj='$obj', type='$type')" - } - - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/GetImageSuccessEvent.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/GetImageSuccessEvent.kt deleted file mode 100644 index 5bf69ce159..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/GetImageSuccessEvent.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.mogo.module.share.bean.event - - -/** - * @description - * - * @author lixiaopeng - * @since 2019-10-13 - */ -class GetImageSuccessEvent { - private var imageUrl: String? = null - private var type: String? = null - - constructor(imageUrl: String?, type: String?) { - this.imageUrl = imageUrl - this.type = type - } - - fun getImageUrl(): String? { - return imageUrl - } - - fun getType(): String? { - return type - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/LatLngStickyEventBus.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/LatLngStickyEventBus.kt deleted file mode 100644 index a087c35452..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/LatLngStickyEventBus.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.module.share.bean.event - -import org.greenrobot.eventbus.EventBus - -class LatLngStickyEventBus { - - companion object { - private var mEventBus = EventBus.builder() - .logNoSubscriberMessages(false) - .sendNoSubscriberEvent(false) - .build() - - fun getInstance(): EventBus { - return mEventBus - } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/MarkerInfo.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/MarkerInfo.java deleted file mode 100644 index 9dfea2c3f0..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/bean/event/MarkerInfo.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.share.bean.event; - -import java.io.Serializable; - -/** - * @author lixiaopeng - * @description marker数据 - * @since 2020-01-08 - */ -public class MarkerInfo implements Serializable { - public String type; //封路,还是上报 - public String fromType; //来源 主动,被动,策略。 - public String imageUrl; //上传完cos图片 - public double lon; //经度 - public double lat; //纬度 - public boolean isCumtom; //是否主动上报 - - public MarkerInfo(String type, String imageUrl, double lon, double lat, boolean isCumtom, String fromType) { - this.type = type; - this.imageUrl = imageUrl; - this.lon = lon; - this.lat = lat; - this.isCumtom = isCumtom; - this.fromType = fromType; - } - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt deleted file mode 100644 index 91d4456bb8..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.mogo.module.share.callback - -import com.mogo.cloud.tanlu.bean.MarkerExploreWayCloud - - -interface RoadInfoCallback { - fun onLocatSuccess(lat: Double, lon: Double) - fun onQueryRoadInfoSuccess(roadInfoList:List) - fun onQueryRoadInfoFail(msg: String, code: Int) - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt deleted file mode 100644 index 18f146150e..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/HttpConstant.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.mogo.module.share.constant - -import com.mogo.commons.debug.DebugConfig - -class HttpConstant { - - companion object { - const val HOST_DEV = "http://dzt-test.zhidaozhixing.com" - const val HOST_TEST = "http://dzt-test.zhidaozhixing.com" - const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com" - const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com" - - const val DEVA_HOST = "http://dzt-deva.zhidaozhixing.com" - const val RTL_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com" - const val LS_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com" - - - @JvmStatic - fun getNetHost(): String { - return when (DebugConfig.getNetMode()) { - DebugConfig.NET_MODE_DEV -> HOST_DEV - DebugConfig.NET_MODE_QA -> HOST_TEST - DebugConfig.NET_MODE_DEMO -> HOST_DEMO - else -> HOST_PRODUCT - } - } - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java deleted file mode 100644 index d0736ea534..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/ShareConstants.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.mogo.module.share.constant; - -/** - * @author lixiaopeng - * @since 2019-1-19 - *

    - * 描述 - */ -public class ShareConstants { - /** - * 分享分类 - */ - public static final String LAUNCHER_SHARE_TYPE = "v2x_share_type"; - /** - * 分享/上报按钮点击 - */ - public static final String LAUNCHER_SHARE_CLICK = "Launcher_Share_Click"; - public static final String CARNET_USER_UPLOAD = "CarNet_user_upload"; - - public static final String VOICE_CMD_SERVICE_EVENT_KEY = "type"; - public static final int VOICE_CMD_SERVICE_SEEK_HELP = 1; - - // 此处只记录了事故、实时路况、道路积水、道路结冰、浓雾,至于拥堵、交通检查和封路是在extention模块里面管理 - - public static final String VOICE_CMD_PUB_TROUBLE_HELP = "com.zhidao.auxiliaryDriving" + - ".pubTroubleHelp";/*唤醒词 发起故障求助*/ - public static final String VOICE_CMD_GO_TO_SHARE = "com.zhidao.share"; - - public static final String TAG = "/tanlu/ui"; - public static final String NAVI_INFO = "navi_info"; - public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION"; - public static final String TANLU = "TanLu"; - - /** - * 免唤醒词上报拥堵 - */ - public static final String UNWAKE_UPLOAD_ROAD_CONDITION = "command_upload_roadcondition"; - - /** - * 关闭分享框 唤醒 - */ - public static final String VOICE_CMD_SHARE_DIALOG_CLOSE = "com.zhidao.share.close"; - /** - * 两次未回复关闭分享对话框 - */ - public static final String VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE = "com.zhidao.share.dialog" + - ".close"; - - /** - * 免唤醒上报拥堵 - */ - public static final String UNWAKE_UPLOAD_ROAD_BLOCK = "command_upload_block"; - /** - * 免唤醒上报交通检查 - */ - public static final String UNWAKE_UPLOAD_TRAFFIC_CHECK = "command_upload_traffic_check"; - /** - * 免唤醒上报封路 - */ - public static final String UNWAKE_UPLOAD_ROAD_CLOSURE = "command_upload_road_closure"; - - public static final String UNWAKE_UPLOAD_ACCIDENT = "command_upload_accident"; - public static final String UNWAKE_UPLOAD_REAL_TIME_TRAFFIC = "command_upload_real_time_traffic"; - public static final String UNWAKE_UPLOAD_SEEK_HELP = "command_upload_seek_help"; - public static final String UNWAKE_UPLOAD_STAGNANT_WATER = "command_upload_stagnant_water"; - public static final String UNWAKE_UPLOAD_ROAD_ICY = "command_upload_road_icy"; - public static final String UNWAKE_UPLOAD_DENSE_FOG = "command_upload_dense_fog"; - public static final String UNWAKE_UPLOAD_ROAD_CONSTRUCTION = "command_upload_road_construction"; - public static final String UNWAKE_CANCEL_SHARE = "com.zhidao.launcher.cancle.share"; - - /** - * 这个是实时路况,不是拥堵,拥堵放在了extention模块里面处理 - */ - public static final String VOICE_CMD_PUB_ROAD_CONDITION = "com.zhidao.pathfinder.report.roadCondition"; - - /** - * 分享框配置本地缓存的key - */ - public static final String KEY_SHARE_CONFIG = "SHARE_BUTTON_CONFIG"; - - /** - * 外部触发 - */ - public static final String KEY_SHARE_OUTER_GUIDE = "KEY_SHARE_OUTER_GUIDE"; - public static final String KEY_SHARE_OUTER_GUIDE_TIME = "KEY_SHARE_OUTER_GUIDE_TIME"; - public static final String KEY_SERVER_SHOW_DAY_COUNT = "KEY_SERVER_SHOW_DAY_COUNT"; - - /** - * 内部触发 - */ - public static final String KEY_SHARE_INNER_GUIDE = "KEY_SHARE_INNER_GUIDE"; - public static final String KEY_SHARE_INNER_GUIDE_TIME = "KEY_SHARE_INNER_GUIDE_TIME"; - - /** - * 点击分享 - */ - public static final String KEY_CLICK_SHARE_BUTTON = "KEY_CLICK_SHARE_BUTTON"; - public static final String KEY_CLICK_SHARE_TIME = "KEY_CLICK_SHARE_TIME"; - - /** - * 点击具体分享类别 - */ - public static final String KEY_CLICK_SHARE_ITEM_BUTTON = "KEY_CLICK_SHARE_ITEM_BUTTON"; - public static final String KEY_CLICK_SHARE_ITEM_TIME = "KEY_CLICK_SHARE_ITEM_TIME"; - - public static final int VOICE_ALERT_COUNT = 3; - - //1天的毫秒 - public static final long ONE_DAY_TIME = 86400000; -// public static final long ONE_DAY_TIME = 60000; - - //7天的毫秒 - public static final long SEVEN_DAY_TIME = 604800000; - - /** - * 加油 10001 - * 交通检查 10002 - * 封路 10003 - * 商场打折 10004 - * 4S店 10005 - * 施工 10006 - * 拥堵 10007 - * 积水 10008 - * 超市折扣 10009 - * 浓雾 10010 - * 结冰 10011 - * 停车场 10012 - * 交通事故 10013 - * 社保 10014 - * 实时路况 10015 - */ - public static final String TANLU_ROAD_PONDING = "10008"; //积水 - public static final String TANLU_ROAD_ICING = "10011"; //积冰 - public static final String TANLU_ROAD_HEAVY_FOG = "10010"; //大雾 - public static final String TANLU_ROAD_ACCIDENT = "10013"; //事故 - public static final String TANLU_ROAD_CONSTRUCTION = "10006"; //道路施工 - public static final String TANLU_ROAD_CONGESTION_COMPAT = "10007"; //拥堵,适配语音不做数值转换 - public static final String TANLU_TRAFFIC_CHECK_COMPAT = "10002"; //交通检查,适配语音不做数值转换 - public static final String TANLU_ROAD_CLOSURE_COMPAT = "10003"; //封路,适配语音不做数值转换 - public static final String TANLU_ROAD_CURRENT = "10015"; //实时路况 - - // 道路事件名称,用于语音识别区分道路事件 - public static final String TYPE_NAME_BLOCK = "拥堵"; - public static final String TYPE_NAME_TRAFFIC_CHECK = "交通检查"; - public static final String TYPE_NAME_CLOSURE = "封路"; - public static final String TYPE_NAME_ACCIDENT = "交通事故"; - public static final String TYPE_NAME_REAL_TIME_TRAFFIC = "实时路况"; - public static final String TYPE_NAME_STAGNANT_WATER = "积水"; - public static final String TYPE_NAME_ROAD_ICY = "积冰"; - public static final String TYPE_NAME_DENSE_FOG = "雾"; - public static final String TYPE_NAME_ROAD_CONSTRUCTION = "施工"; - - // 同行者 xx堵不堵 唤醒 - public static final String TXZ_SPECIFIEDROAD_SEARCH = "com.zhidao.roadcondition.roadinfo"; - - //思必驰 xx堵不堵 唤醒 - public static final String SPECIFIEDROAD_SEARCH = "com.zhidao.pathfinder.specifiedroad.search"; - - /** - * 搜索交通检查 - */ - public static final String VOICE_COMMAND_QUERY_TRAFFIC_CHECK = "com.zhidao.share.traffic.police"; - - /** - * 搜索封路信息 - */ - public static final String VOICE_COMMAND_QUERY_ROAD_CLOSED = "com.zhidao.share.road.closure.query"; - - /** - * 其他道路事件,包括事故,实时路况,道路积水,道路积冰,浓雾 - */ - public static final String VOICE_COMMAND_NOVELTY_QUERY = "com.zhidao.novelty.query"; - - //语音搜索 - public static final String CARNET_VOICE_SEARCH = "CarNet_Voice_Search"; - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/StrategyShareConst.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/StrategyShareConst.kt deleted file mode 100644 index aa47aea15f..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/constant/StrategyShareConst.kt +++ /dev/null @@ -1,48 +0,0 @@ -package com.mogo.module.share.constant - -const val S_TAG = "StrategyShare" - -/** - * 目前两个策略上报(事故,拥堵)都是走的这个push - */ -const val ACCIDENT_STRATEGY_SHARE_PUSH_TYPE = 401013 - -const val TANLU_ROAD_CURRENT = "10015" //实时路况 - -/** - * 默认视频抓取时长,单位是秒 - */ -const val DEFAULT_VIDEO_DURATION = 10 - -/** - * 数据策略:交通事故上报 - */ -const val UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO = "5" - -/** - * 数据策略:已有事件云端校验 - */ -const val UPLOAD_FROM_STRATEGY_CLOUD_CHECK = "4" - -/** - * 数据策略:拥堵自动上报 - */ -const val UPLOAD_FROM_STRATEGY_BLOCK_AUTO = "3" - -/** - * 策略上报集合 - */ -val STRATEGY_UPLOAD_TYPE_ARRAY = arrayOf(UPLOAD_FROM_STRATEGY_BLOCK_AUTO, - UPLOAD_FROM_STRATEGY_CLOUD_CHECK, UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) - -val AlarmTypePic: Int = 1 //定时任务类型 1照片 -val AlarmTypeVideo: Int = 2 //定时任务类型 2视频 - -val alarmBroadAction: String = "com.zhidao.roadCondition.AlarmBroadCast" //定时广播 -val sendInformationAction: String = "com.zhidao.roadCondition.SendInformation" //主动上报广播 -val customResultAction: String = "com.zhidao.roadCondition.CustomResult" //主动上报结果广播 - -const val INFO_TYPE_IMG = 0 //图片 -const val INFO_TYPE_VIDEO = 1 -const val INFO_TYPE_VOICE = 2 -const val INFO_TYPE_WORD = 3 diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt deleted file mode 100644 index 3147b6088f..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/GridFixableShareDialog.kt +++ /dev/null @@ -1,120 +0,0 @@ -package com.mogo.module.share.dialog - -import android.content.Context -import android.widget.FrameLayout -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.module.common.dialog.BaseFloatDialog -import com.mogo.module.common.utils.CarSeries -import com.mogo.module.share.R -import com.mogo.module.share.bean.FixableButton -import com.mogo.module.share.manager.GridBtnManager -import com.mogo.module.share.manager.ISeekHelpListener -import com.mogo.module.share.manager.SeekHelpManager -import com.mogo.module.share.manager.SeekHelpManager.seekHelp -import com.mogo.module.share.manager.UploadHelper -import com.mogo.service.IMogoServiceApis -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.service.analytics.IMogoAnalytics -import com.mogo.service.share.IMogoTanluProvider -import com.mogo.service.share.TanluUploadParams -import com.mogo.service.statusmanager.IMogoStatusManager -import kotlin.random.Random - -/** - * 可动态配置的分享对话框 - * - * @author tongchenfei - */ -class GridFixableShareDialog(context: Context) : BaseFloatDialog(context) { - private val isShown = false - private val mAnalytics: IMogoAnalytics - private val mStatusManager: IMogoStatusManager - private val mApis: IMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis - - private fun setWrapContent() { - val window = window - if (CarSeries.isF8xxSeries()) { - if (window != null) { - val lp = window.attributes - lp.width = 1920 - lp.height = 1080 - window.attributes = lp - } - } else { - if (window != null) { - val lp = window.attributes - lp.width = 1024 - lp.height = 600 - window.attributes = lp - } - } - } - - private lateinit var gridBtnManager: GridBtnManager - private fun initView() { - Logger.d(TAG, "test-------3") - setContentView(R.layout.dialog_share_with_gridlayout) - setWrapContent() - gridBtnManager = GridBtnManager(context, findViewById(R.id.moduleShareBtnGridLayout),findViewById(R.id.ivTmpShow)) - gridBtnManager.setShareClickListener { - Logger.d(TAG, "share btn click: $it") - if (it.poiType == IMogoTanluProvider.TYPE_SEEK_HELP) { - // 发起故障求助 - Logger.d(TAG, "发起故障求助====") - seekHelp(context, seekListener, "1", true) - } else { - // 上报道路事件 - Logger.d(TAG, "上报道路事件=====") - sendShareReceiver(it.poiType) - } - dismiss() - } - findViewById(R.id.flShareDialogContainer).setOnClickListener { dismiss() } - } - - private fun randomGenerateBtn() { - val random = Random.nextInt(1, 10) - gridBtnManager.resetContainer() - for (i in 0 until random) { - gridBtnManager.generateShareButton(FixableButton(id = i)) - } - } - - private val seekListener: ISeekHelpListener = object : ISeekHelpListener { - override fun onSeekHelpSuccess() { - Logger.d(TAG, "上报求助完成,成功") - SeekHelpManager.removeSeekHelpListener(this) - dismiss() - } - - override fun onSeekHelpFail() { - Logger.d(TAG, "上报求助完成,失败") - SeekHelpManager.removeSeekHelpListener(this) - dismiss() - } - } - - /** - * 发送广播 1拥堵,2交通检查,3封路 - */ - private fun sendShareReceiver(type: String) { - val params = TanluUploadParams(type, IMogoTanluProvider.UPLOAD_FROM_USER) - UploadHelper.upload(context, params, true) - } - - override fun show() { - gridBtnManager.showShareButton() - super.show() - } - - companion object { - private const val TAG = "GridFixableShareDialog" - } - - init { - mAnalytics = mApis.analyticsApi - mStatusManager = mApis.statusManagerApi - initView() - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java deleted file mode 100644 index 0b3955a460..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/dialog/LaucherShareDialog.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.mogo.module.share.dialog; - -import android.content.Context; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.ImageView; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.dialog.BaseFloatDialog; -import com.mogo.module.common.utils.CarSeries; -import com.mogo.module.share.R; -import com.mogo.module.share.manager.ISeekHelpListener; -import com.mogo.module.share.manager.SeekHelpManager; -import com.mogo.module.share.manager.UploadHelper; -import com.mogo.service.IMogoServiceApis; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.service.statusmanager.IMogoStatusManager; -import com.mogo.service.share.IMogoTanluProvider; -import com.mogo.service.share.TanluUploadParams; - - -/** - * @author lixiaopeng - * @description 通用分享dialog - * - * 由于和左侧Adas冲突,改成了windowManager方式实现,这种实现方式的问题是,无法监测back键的事件 - * @since 2020-01-10 - */ -public class LaucherShareDialog extends BaseFloatDialog implements View.OnClickListener { - private static final String TAG = "LaucherShareDialog"; - - private boolean isShown = false; - - private ImageView ivBlock; - private ImageView ivTrafficCheck; - private ImageView ivClosure; - private ImageView ivNeedHelp; - - private ImageView ivAccident; - private ImageView ivRealTimeTraffic; - private ImageView ivStagnantWater; - private ImageView ivRoadIcy; - private ImageView ivDenseFog; - private ImageView ivConstruction; - - private Context mContext; - private IMogoAnalytics mAnalytics; - private IMogoStatusManager mStatusManager; - private IMogoServiceApis mApis; - - private WindowManager windowManager; - -// public LaucherShareDialog(@NonNull Context context) { -// this.mContext = context; -// mApis = (IMogoServiceApis) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation(context); -// mAnalytics = mApis.getAnalyticsApi(); -// mStatusManager = mApis.getStatusManagerApi(); -// } - - private View body; - - public LaucherShareDialog(Context context) { - super(context); -// getWindow().setWindowAnimations(R.style.ShareDialogAnim); - - this.mContext = context; - mApis = (IMogoServiceApis) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation(context); - mAnalytics = mApis.getAnalyticsApi(); - mStatusManager = mApis.getStatusManagerApi(); - - initView(); - initListener(); - } - private void setWrapContent() { - Window window = getWindow(); - if(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD){ - if (window != null) { - WindowManager.LayoutParams lp = window.getAttributes(); - lp.width = 1024; - lp.height = 600; - window.setAttributes(lp); - } - }else if(CarSeries.isF8xxSeries()){ - if (window != null) { - WindowManager.LayoutParams lp = window.getAttributes(); - lp.width = 1920; - lp.height = 1080; - window.setAttributes(lp); - } - }else{ - if (window != null) { - WindowManager.LayoutParams lp = window.getAttributes(); - lp.width = 1024; - lp.height = 600; - window.setAttributes(lp); - } - } - } - private void initView() { - Logger.d(TAG, "test-------3"); - setContentView(R.layout.launcher_dialog_share_2); -// body = LayoutInflater.from(mContext).inflate(R.layout.launcher_dialog_share_2, null); -// body.setOnClickListener(new View.OnClickListener() { -// @Override -// public void onClick(View v) { -// dismiss(); -// } -// }); - - - ivBlock = findViewById(R.id.ivBlock); - ivTrafficCheck = findViewById(R.id.ivTrafficCheck); - ivClosure = findViewById(R.id.ivClosure); - ivNeedHelp = findViewById(R.id.ivSeekHelp); - - ivAccident = findViewById(R.id.ivAccident); - ivRealTimeTraffic = findViewById(R.id.ivRealTimeTraffic); - ivStagnantWater = findViewById(R.id.ivStagnantWater); - ivRoadIcy = findViewById(R.id.ivRoadIcy); - ivDenseFog = findViewById(R.id.ivDenseFog); - ivConstruction = findViewById(R.id.ivConstruction); - } - - - private void initListener() { - ivBlock.setOnClickListener(this); - ivNeedHelp.setOnClickListener(this); - ivTrafficCheck.setOnClickListener(this); - ivClosure.setOnClickListener(this); - - ivAccident.setOnClickListener(this); - ivRealTimeTraffic.setOnClickListener(this); - ivStagnantWater.setOnClickListener(this); - ivRoadIcy.setOnClickListener(this); - ivDenseFog.setOnClickListener(this); - ivConstruction.setOnClickListener(this); - } - - @Override - public void onClick(View view) { - int id = view.getId(); - if (id == R.id.ivBlock) { - //拥堵 - Logger.d(TAG,"点击拥堵"); - sendShareReceiver(IMogoTanluProvider.TYPE_BLOCK); - dismiss(); - } else if (id == R.id.ivTrafficCheck) { - //交通检查 - Logger.d(TAG,"点击交通检查"); - sendShareReceiver(IMogoTanluProvider.TYPE_TRAFFIC_CHECK); - dismiss(); - } else if (id == R.id.ivClosure) { - //封路 - Logger.d(TAG,"点击封路"); - sendShareReceiver(IMogoTanluProvider.TYPE_CLOSURE); - dismiss(); - } else if (id == R.id.ivSeekHelp) { - // 故障求助 - Logger.d(TAG,"点击求助"); - SeekHelpManager.INSTANCE.seekHelp(mContext, seekListener, "1", true); - dismiss(); - } else if (id == R.id.ivAccident) { - // 事故 - Logger.d(TAG,"点击事故"); - sendShareReceiver(IMogoTanluProvider.TYPE_ACCIDENT); - dismiss(); - } else if (id == R.id.ivConstruction) { - // 道路施工 - Logger.d(TAG,"点击道路施工"); - sendShareReceiver(IMogoTanluProvider.TYPE_ROAD_CONSTRUCTION); - dismiss(); - } else if (id == R.id.ivRealTimeTraffic) { - // 实时路况 - Logger.d(TAG,"点击实时路况"); - sendShareReceiver(IMogoTanluProvider.TYPE_REAL_TIME_TRAFFIC); - dismiss(); - } else if (id == R.id.ivStagnantWater) { - // 道路积水 - Logger.d(TAG,"点击道路积水"); - sendShareReceiver(IMogoTanluProvider.TYPE_STAGNANT_WATER); - dismiss(); - } else if (id == R.id.ivRoadIcy) { - // 道路结冰 - Logger.d(TAG,"点击道路结冰"); - sendShareReceiver(IMogoTanluProvider.TYPE_ROAD_ICY); - dismiss(); - } else if (id == R.id.ivDenseFog) { - // 浓雾 - Logger.d(TAG,"点击浓雾"); - sendShareReceiver(IMogoTanluProvider.TYPE_DENSE_FOG); - dismiss(); - } - } - - private ISeekHelpListener seekListener = new ISeekHelpListener() { - @Override - public void onSeekHelpSuccess() { - Logger.d(TAG,"上报求助完成,成功"); - SeekHelpManager.INSTANCE.removeSeekHelpListener(seekListener); - dismiss(); - } - - @Override - public void onSeekHelpFail() { - Logger.d(TAG,"上报求助完成,失败"); - SeekHelpManager.INSTANCE.removeSeekHelpListener(seekListener); - dismiss(); - } - }; - - /** - * 发送广播 1拥堵,2交通检查,3封路 - */ - private void sendShareReceiver(String type) { - TanluUploadParams params = new TanluUploadParams(type, IMogoTanluProvider.UPLOAD_FROM_USER); - UploadHelper.INSTANCE.upload(mContext, params,true); - } - - @Override - public void show() { - Logger.d(TAG,"onShow===="); - if(!DebugConfig.isLauncher()) { - mApis.getAdasControllerApi().closeADAS(); - } - super.show(); - } - - @Override - public void dismiss() { - Logger.d(TAG,"onDismiss====="); - if (!DebugConfig.isLauncher()&&mApis.getStatusManagerApi().isMainPageOnResume()) { - mApis.getAdasControllerApi().showADAS(); - } - super.dismiss(); - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt deleted file mode 100644 index 30de00b641..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/GridBtnManager.kt +++ /dev/null @@ -1,90 +0,0 @@ -package com.mogo.module.share.manager - -import android.content.Context -import android.view.LayoutInflater -import android.view.View -import android.widget.GridLayout -import android.widget.ImageView -import android.widget.TextView -import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.network.utils.GsonUtil -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.module.share.R -import com.mogo.module.share.bean.FixableButton -import com.mogo.module.share.constant.ShareConstants -import com.mogo.service.share.IMogoTanluProvider - -/** - * 用来管理生成对应的分享按钮 - */ -class GridBtnManager(val context: Context, private val container: GridLayout, private val tmpImg: ImageView) { - companion object { - const val TAG = "GridBtnManager" - } - - private val inflater = LayoutInflater.from(context) - - fun resetContainer() { - container.removeAllViews() - } - - fun generateShareButton(button: FixableButton): View { - val view = inflater.inflate(R.layout.item_share_btn, container, false) - val img = view.findViewById(R.id.ivShareIcon) - val content = view.findViewById(R.id.tvShareContent) - // 优先加载url图片,然后加载资源图片 - if (button.iconUrl.isNotEmpty()) { - GlideApp.with(context).load(button.iconUrl).placeholder(button.iconRes).error(button.iconRes).into(img) - } else { - GlideApp.with(context).load(button.iconRes).placeholder(button.iconRes).error(button.iconRes).into(img) - } -// if (button.iconUrl.isNotEmpty()) { -// GlideApp.with(context).load(button.iconUrl).into(img) -// } else { -// GlideApp.with(context).load(button.iconRes).into(img) -// } - content.text = button.title - view.setOnClickListener { - btnClickListener?.invoke(button) - } - container.addView(view) - return view - } - - fun showShareButton() { - resetContainer() - val config = SharedPrefsMgr.getInstance(context).getString(ShareConstants.KEY_SHARE_CONFIG) - Logger.d(TAG, "showDefaultBtns: $config") - if (config.isEmpty()) { - // 默认的全部十个按钮 - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_BLOCK, title = "拥堵")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_TRAFFIC_CHECK, title = "交通检查")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_CLOSURE, title = "封路")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_ACCIDENT, title = "事故")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_ROAD_CONSTRUCTION, title = "道路施工")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_REAL_TIME_TRAFFIC, title = "实时路况")) - if(DebugConfig.isMapBased()) { - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_SEEK_HELP, title = "故障求助")) - } - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_STAGNANT_WATER, title = "道路积水")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_ROAD_ICY, title = "道路结冰")) - generateShareButton(FixableButton(poiType = IMogoTanluProvider.TYPE_DENSE_FOG, title = "浓雾")) - } else { - val btnList = GsonUtil.arrayFromJson(config, FixableButton::class.java) - if(btnList!=null&&btnList.isNotEmpty()) { - btnList.forEach { btn -> - if(btn.poiType != IMogoTanluProvider.TYPE_SEEK_HELP||btn.poiType == IMogoTanluProvider.TYPE_SEEK_HELP&&DebugConfig.isMapBased()){ - generateShareButton(btn) - } - } - } - } - } - - private var btnClickListener: ((fixableButton: FixableButton) -> Unit)? = null - fun setShareClickListener(listener: ((fixableButton: FixableButton) -> Unit)) { - btnClickListener = listener - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/ISeekHelpListener.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/ISeekHelpListener.kt deleted file mode 100644 index f338eb0533..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/ISeekHelpListener.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.module.share.manager - -/** - * 寻求帮助结果监听 - */ -interface ISeekHelpListener { - /** - * 寻求帮助成功 - */ - fun onSeekHelpSuccess() - - /** - * 寻求帮助失败 - */ - fun onSeekHelpFail() -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt deleted file mode 100644 index 07d5563c12..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/SeekHelpManager.kt +++ /dev/null @@ -1,249 +0,0 @@ -package com.mogo.module.share.manager - -import android.annotation.SuppressLint -import android.content.Context -import android.os.SystemClock -import android.util.ArrayMap -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.commons.analytics.AnalyticsUtils -import com.mogo.eagle.core.data.BaseData -import com.mogo.commons.voice.AIAssist -import com.mogo.commons.voice.IMogoVoiceCmdCallBack -import com.mogo.eagle.core.network.RequestOptions -import com.mogo.eagle.core.network.SubscribeImpl -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.module.common.constants.HostConst -import com.mogo.module.share.bean.SeekRecord -import com.mogo.module.share.bean.SeekRequest -import com.mogo.module.share.bean.getJson -import com.mogo.module.share.net.ShareRtlApiService -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers - -/** - * 故障求助管理类,相关故障求助操作的具体实现类 - * @author tongchenfei - */ -@SuppressLint("StaticFieldLeak") -object SeekHelpManager { - const val TAG = "SeekHelpManager" - /** - * 发起求助记录的限制时间,也就是只关注这段时间内的求助记录 - */ - private const val SEEK_RECORD_LIMIT_TIME = 10 * 60 * 1000 - /** - * 限制时间内,发起求助记录的限制次数 - */ - private const val SEEK_RECORD_LIMIT_AMOUNT = 2 - const val VOICE_WILL_SEEK_HELP = "将发布故障求助" - - private var context: Context? = null - private var aiAssist: AIAssist? = null - - private val seekRecordList = mutableListOf() - private val seekListenerList = mutableListOf() - private var isSeekHelp = false - private var isSeeking = false - - private val voiceCallback = object : IMogoVoiceCmdCallBack { - override fun onCmdSelected(cmd: String?) { - - } - - override fun onCmdAction(speakText: String?) { - } - - override fun onCmdCancel(speakText: String?) { - } - - override fun onSpeakEnd(speakText: String?) { - speakText?.let { - Logger.d(TAG, "onSpeakEnd: $it") - if (it == VOICE_WILL_SEEK_HELP) { - // 请求帮助语音播放完成,开始真正寻求帮助 - realSeekHelp("1") - } - } - } - - override fun onSpeakSelectTimeOut(speakText: String?) { - } - - } - - /** - * 寻求帮助,是开始故障求助的入口 - * 由于当前需求仅需要提供这一个方法,所以context的初始化放到了此方法,后面如果有增加,需要把这部分提出去 - * - * @param useLocalVoiceNotice 使用自己的语音播报,如果是从语音助手过来的请求,语音助手可能会走自己的播报,默认是使用自己的播报 - * - * @param from 1 - 手动发起求助 2 - 语音发起求助 - */ - fun seekHelp(context: Context, seekHelpListener: ISeekHelpListener,from:String = "1", useLocalVoiceNotice: Boolean = true) { - Logger.d(TAG, "seekHelp: $isSeeking") - if(!isSeeking) { - isSeeking = true - if (this.context == null) { - this.context = context.applicationContext - } - aiAssist = AIAssist.getInstance(context) - - isSeekHelp = ServiceApisManager.serviceApis.statusManagerApi.isSeekHelping - Logger.d(TAG, "开始故障求助上报---${isSeekHelp}") - seekListenerList.add(seekHelpListener) - when { - isSeekHelp -> { - // 正在求助中,进行异常提示 - toast("已发布故障求助,请耐心等待") - isSeeking = false - aiAssist?.speakTTSVoice("已发布故障求助,请耐心等待") - seekHelpSuccess() - } - getSeekAmountByLimitTime() >= SEEK_RECORD_LIMIT_AMOUNT -> { - // 超过限制时间内的限制次数,进行异常提示 - toast("已在求助状态,请勿连续发布哦") - aiAssist?.speakTTSVoice("已在求助状态,请勿连续发布哦") - isSeeking = false - seekHelpSuccess() - } - else -> { - // 没有异常情况,开始故障求助 - if (useLocalVoiceNotice) { - // 语音说完再请求,要不然可能请求的太快 - Logger.d(TAG, "使用本地播报: $aiAssist") - aiAssist?.speakTTSVoice(VOICE_WILL_SEEK_HELP) - realSeekHelp(from) - } else { - Logger.d(TAG, "不使用本地语音播报,直接开始发起求助") - realSeekHelp(from) - } - } - } - } - - } - - fun removeSeekHelpListener(seekHelpListener: ISeekHelpListener) { - seekListenerList.remove(seekHelpListener) - } - - private fun toast(msg: String) { - TipToast.tip(msg) - } - - /** - * 获得限制时间 {@link SEEK_RECORD_LIMIT_TIME} 内的请求次数,现在的请求记录是保存在内存中的,如果遇到Launcher的Crash,此记录会被重置 - * 此方法就是把seekRecordList里面超过限制时间的选项去掉,然后剩下的就是时限内的请求次数 - * - * @return 规定时间内的请求次数 - */ - private fun getSeekAmountByLimitTime(): Int { - val current = SystemClock.elapsedRealtime() - val iterator = seekRecordList.iterator() - while (iterator.hasNext()) { - if ((current - iterator.next().recordTime) >= SEEK_RECORD_LIMIT_TIME) { - iterator.remove() - } - } - return seekRecordList.size - } - - /** - * 真正开始寻求帮助,实际就是请求接口 - */ - private fun realSeekHelp(from:String) { - Logger.d(TAG, "realSeekHelp") - // 请求故障求助接口 - val seekRequest = SeekRequest(MoGoAiCloudClientConfig.getInstance().getSn()) - val param = mutableMapOf("data" to seekRequest.getJson()) - - val properties: MutableMap = ArrayMap() - properties["type"] = 9999 - properties["from"] = from - AnalyticsUtils.track("v2x_share_type", properties) - - ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl( - RequestOptions.create(context)) { - override fun onSuccess(o: BaseData?) { - super.onSuccess(o) - // 接口请求成功,内部同步v2x状态,通知adas,改变自车图标 - ServiceApisManager.serviceApis.statusManagerApi.setSeekHelping("ShareDialog", true) - SharedPrefsMgr.getInstance(context!!).putLong("seek_help_time", System.currentTimeMillis()) - SharedPrefsMgr.getInstance(context!!).putInt("seek_help_num", 0) - - isSeekHelp = true - aiAssist?.speakTTSVoice("已发布求助信息,将为你通知其他车主") - toast("已发布求助信息,将为你通知其他车主") - seekRecordList.add(SeekRecord(SystemClock.elapsedRealtime())) - seekHelpSuccess() - isSeeking = false - } - - override fun onError(e: Throwable) { - super.onError(e) - // 接口请求失败 - Logger.e(TAG, "上报求助失败,网络异常") - e.printStackTrace() - seekHelpFail() - isSeeking = false - } - - override fun onError(message: String?, code: Int) { - super.onError(message, code) - // 接口请求失败 - Logger.e(TAG, "上报求助失败") - seekHelpFail() - isSeeking = false - } - }) - } - - private fun seekHelpSuccess(){ - val iterator = seekListenerList.iterator() - while (iterator.hasNext()) { - iterator.next().onSeekHelpSuccess() - } - } - - private fun seekHelpFail() { - isSeekHelp = false - val iterator = seekListenerList.iterator() - while (iterator.hasNext()) { - iterator.next().onSeekHelpFail() - } -// seekListenerList.forEach { -// it.onSeekHelpFail() -// } - toast("求助上报失败,请稍后重试") - aiAssist?.speakTTSVoice("求助上报失败,请稍后重试") - } - - fun debugCancelSeek() { - val seekRequest = SeekRequest(MoGoAiCloudClientConfig.getInstance().getSn(), 0) - val param = mutableMapOf("data" to seekRequest.getJson()) - ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl(RequestOptions.create(context)) { - override fun onSuccess(o: BaseData?) { - super.onSuccess(o) - // 接口请求成功,内部同步v2x状态,通知adas,改变自车图标 - ServiceApisManager.serviceApis.statusManagerApi.setSeekHelping("ShareDialog", false) - isSeekHelp = false - } - - override fun onError(e: Throwable) { - super.onError(e) - // 接口请求失败 - Logger.e(TAG, "上报求助失败,网络异常") - e.printStackTrace() - } - - override fun onError(message: String?, code: Int) { - super.onError(message, code) - // 接口请求失败 - Logger.e(TAG, "上报求助失败") - } - }) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/ServiceApisManager.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/ServiceApisManager.kt deleted file mode 100644 index 77465cde3d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/ServiceApisManager.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.module.share.manager - -import android.content.Context -import com.alibaba.android.arouter.launcher.ARouter -import com.mogo.service.IMogoServiceApis -import com.mogo.eagle.core.data.constants.MogoServicePaths - -/** - * 全局管理IMogoServiceApis - */ -object ServiceApisManager { - lateinit var serviceApis: IMogoServiceApis - - fun init(context: Context) { - serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/TrafficUploadManager.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/TrafficUploadManager.kt deleted file mode 100644 index 2417a52a2b..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/TrafficUploadManager.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.mogo.module.share.manager - -import com.mogo.eagle.core.data.map.MogoLatLng -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.map.search.traffic.IMogoTrafficSearchListener -import com.mogo.map.search.traffic.MogoTrafficResult -import com.mogo.module.common.MogoApisHandler -import com.mogo.module.common.entity.RoadTrafficStatus -import com.mogo.module.common.entity.UploadTrafficEntity -import com.mogo.module.share.TanluServiceManager -import com.mogo.module.share.net.TrafficModelData -import java.util.* - -class TrafficUploadManager : IMogoTrafficSearchListener { - - companion object { - - const val TAG = "TrafficUploadManager" - const val TRAFFIC_SEARCH_AREA = 500 - - const val TRACK_UPLOAD_INVOKE = "Mogoer_Upload_Traffic_Invoke" - - val trafficUpload by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { - TrafficUploadManager() - } - } - - private val trafficModelData = TrafficModelData() - - fun verityTrafficStatus() { - val trafficSearchApi = TanluServiceManager.getMapService().trafficSearchApi - val location = TanluServiceManager.getLocationClient().lastKnowLocation - trafficSearchApi.registerTrafficSearchListener(this) - Logger.d(TAG, "verityTrafficStatus searchTrafficByCircleArea") - trafficSearchApi.searchTrafficByCircleArea( - MogoLatLng( - location.latitude, - location.longitude - ), TRAFFIC_SEARCH_AREA) - } - - override fun onTrafficSearchError(errorMsg: String?) { - errorMsg?.let { - Logger.d(TAG, "onTrafficSearchError errorMsg : $errorMsg , So drop this verity and track") - val map = hashMapOf("upload" to 2) //调用高德接口失败 - MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map) - } - } - - override fun onTrafficSearchInfo(trafficResult: MogoTrafficResult?) { - val map = hashMapOf("upload" to 1) //调用高德接口成功 - MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map) - trafficResult?.let { - val uploadTrafficEntity = UploadTrafficEntity() - val roadTrafficStatusList: MutableList = ArrayList() - val trafficStatusInfoList = it.trafficStatusInfos - trafficStatusInfoList.forEach { info -> - val roadTrafficStatus = RoadTrafficStatus() - roadTrafficStatus.angle = info.angle - roadTrafficStatus.direction = info.direction - roadTrafficStatus.isSegment = false - roadTrafficStatus.length = 0 - roadTrafficStatus.roadName = info.name - roadTrafficStatus.status = info.status.toInt() - roadTrafficStatus.mogoLatLngList = info.mogoLatLngs - roadTrafficStatusList.add(roadTrafficStatus) - } - uploadTrafficEntity.roadTrafficStatuses = roadTrafficStatusList - trafficModelData.uploadTrafficInfo(uploadTrafficEntity) - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt deleted file mode 100644 index 8d4361d1b9..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/manager/UploadHelper.kt +++ /dev/null @@ -1,85 +0,0 @@ -package com.mogo.module.share.manager - -import android.content.Context -import android.util.Log -import com.mogo.commons.voice.AIAssist -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.module.common.enums.EventTypeEnum -import com.mogo.module.share.R -import com.mogo.module.share.constant.ShareConstants.* -import com.mogo.service.share.TanluUploadParams -import com.mogo.eagle.core.utilcode.mogo.toast.TipDrawable -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast -import com.mogo.eagle.core.utilcode.util.NetworkUtils - -/** - * 上报工具类 - */ -object UploadHelper { - fun upload(context: Context, type: TanluUploadParams, forcePlayVoice: Boolean = false) { - if (ServiceApisManager.serviceApis.statusManagerApi.isUploading) { - Logger.d("UploadHelper", "upload is going -- ") - // 上报即成功,当前还有正在上报的事件,仅做界面展示,不做具体操作 - ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) - } else { - // 判断当前网络状态 - if (NetworkUtils.isConnected(context)) { - // 有网就正常上报 - ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true) - // 上报即成功 - ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location) - val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation - val latLon = com.mogo.eagle.core.data.map.MogoLatLng( - location.latitude, - location.longitude - ) - type.location = latLon - Logger.d("UploadHelper", "upload type----> $type") - ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type) - //语音播报 - showVoiceTip(context, type.eventType) - } else { - // 没网就直接提示失败 - Logger.e("UploadHelper", "upload not net ") - AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络") - @Suppress("DEPRECATION") - TipToast.tip("分享失败,请检查网络", - TipDrawable( - context.resources.getDrawable(R.drawable.module_share_upload_fail) - ) - ) - } - } -// } - } - - private fun showVoiceTip(context: Context, type: String) { - var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0) - val intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0) - if (shareItemSum < VOICE_ALERT_COUNT) { - Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type}") - val time = System.currentTimeMillis() - if (intervalTime == 0.toLong()) { - SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time) - SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum) - AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type)) - } else { - Log.d("UploadHelper", " else interval = " + (time - intervalTime)) - if ((time - intervalTime) > ONE_DAY_TIME) { - SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time) - SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum) - AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type)) - } else { - Log.e("UploadHelper", " else < ONE_DAY_TIME ") - } - } - } - } - - - private fun getTypeName(type: String): String? { - return EventTypeEnum.getTypeName(type) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/HttpApi.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/HttpApi.kt deleted file mode 100644 index bf687dbc40..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/HttpApi.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.module.share.net - -import com.mogo.module.share.bean.BaseResponse -import com.mogo.module.share.bean.Results -import retrofit2.http.* - -/** - * 接口声明 - */ -interface HttpApi { - //获取城市策略 - @FormUrlEncoded - @POST("yycp-geo-fence-carService/car/carStrategy/no/getCityStrategy/v1") - suspend fun getCityStrategy(@FieldMap cityStrategy: Map): BaseResponse - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/HttpClient.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/HttpClient.kt deleted file mode 100644 index e89ea83ec9..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/HttpClient.kt +++ /dev/null @@ -1,100 +0,0 @@ -package com.mogo.module.share.net - -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.network.NetConfig -import com.mogo.module.share.constant.HttpConstant -import okhttp3.Cache -import okhttp3.Dns -import okhttp3.OkHttpClient -import okhttp3.logging.HttpLoggingInterceptor -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory -import java.io.File -import java.util.* -import java.util.concurrent.TimeUnit - - -class HttpClient private constructor(baseUrl: String) { - - companion object { - const val DEFAULT_CONNECT_TIME = 30L - const val DEFAULT_WRITE_TIMEOUT = 30L - const val DEFAULT_READ_TIMEOUT = 30L - - private var baseUrlClientMap = HashMap() - - fun getInstance(): HttpClient { - val baseUrl = HttpConstant.getNetHost() - var httpClient = baseUrlClientMap[baseUrl] - if (httpClient == null) { - synchronized(HttpClient::class.java) { - if (httpClient == null) { - httpClient = HttpClient(baseUrl) - baseUrlClientMap[baseUrl] = httpClient!! - } - } - } - return httpClient!! - } - - fun getInstance(baseUrl: String): HttpClient { - var httpClient = baseUrlClientMap[baseUrl] - if (httpClient == null) { - synchronized(HttpClient::class.java) { - if (httpClient == null) { - httpClient = HttpClient(baseUrl) - baseUrlClientMap[baseUrl] = httpClient!! - } - } - } - return httpClient!! - } - - } - - private var retrofit: Retrofit - private var httpApi: HttpApi - - init { - retrofit = Retrofit.Builder() - .client(getOkHttpClient()) - .addConverterFactory(GsonConverterFactory.create()) - .baseUrl(baseUrl) - .build() - httpApi = retrofit.create(HttpApi::class.java) - } - - fun getHttpApi(): HttpApi { - return httpApi - } - - private fun getOkHttpClient(): OkHttpClient { - val builder = OkHttpClient.Builder() - val httpLoggingInterceptor = HttpLoggingInterceptor() - httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY - val cacheFile = File(AbsMogoApplication.getApp().applicationContext.cacheDir, "cache") - val cache = Cache(cacheFile, 1024 * 1024 * 50) - - val httpDns = NetConfig.instance().httpDns - if (httpDns != null) { - builder.dns(Dns { hostname: String? -> - val addresses = httpDns.lookup(hostname) - if (addresses != null && !addresses.isEmpty()) { - return@Dns addresses - } - Dns.SYSTEM.lookup(hostname) - }) - } - - return builder - .addInterceptor(httpLoggingInterceptor) - .cache(cache) - .connectTimeout(DEFAULT_CONNECT_TIME, TimeUnit.SECONDS) - .readTimeout(DEFAULT_READ_TIMEOUT, TimeUnit.SECONDS) - .writeTimeout(DEFAULT_WRITE_TIMEOUT, TimeUnit.SECONDS) - .retryOnConnectionFailure(true) - .build() - - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java deleted file mode 100644 index d4adcb6e0a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareDevaApiService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.mogo.module.share.net; - -import com.mogo.module.share.bean.AverateSpeedResponse; -import com.mogo.module.share.bean.ShareButtonConfigResponse; - -import java.util.Map; - -import io.reactivex.Observable; -import okhttp3.RequestBody; -import retrofit2.http.Body; -import retrofit2.http.FieldMap; -import retrofit2.http.FormUrlEncoded; -import retrofit2.http.Headers; -import retrofit2.http.POST; -import retrofit2.http.Query; - -public interface ShareDevaApiService { - /** - * 拥堵策略,上报平均速度 - */ - @Headers("Content-type:application/json;charset=UTF-8") - @POST("/deva/car/path/no/poiStrategyCheck/v1") - Observable sendAverageSpeedForBlockStrategy(@Body RequestBody request, @Query("sn")String sn); - - /** - * 获取分享框服务端配置 - */ - @FormUrlEncoded - @POST("/deva/car/poiType/no/poiTypeList") - Observable queryShareButtonConfig(@FieldMap Map param); - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java deleted file mode 100644 index 38b04706b7..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/ShareRtlApiService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mogo.module.share.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.util.Map; - -import io.reactivex.Observable; -import retrofit2.http.FieldMap; -import retrofit2.http.FormUrlEncoded; -import retrofit2.http.POST; - -public interface ShareRtlApiService { - /** - * 发起求助接口 - */ - @FormUrlEncoded - @POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1") - Observable sendHelpSignal(@FieldMap Map param ); -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluApiService.java deleted file mode 100644 index 55fe73fab3..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluApiService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mogo.module.share.net; - - -import com.mogo.module.share.bean.BaseDataCompat; -import com.mogo.module.share.bean.RoadInfos; - -import java.util.Map; - -import io.reactivex.Observable; -import retrofit2.http.FieldMap; -import retrofit2.http.FormUrlEncoded; -import retrofit2.http.POST; - -/** - * @author lixiaopeng - * @description 探路相关接口定义 - * @since 2020-01-07 - */ -public interface TanluApiService { - - /** - * 查询(搜索)道路事件信息 - * 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842 - * 文档中有些参数暂时没有用到,包括radius,limit - * @return - */ - @FormUrlEncoded - @POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync") - Observable> queryRoadInfos(@FieldMap Map params); - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java deleted file mode 100644 index 282cc05d16..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TanluModelData.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.mogo.module.share.net; - -import android.content.Context; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.cloud.network.BaseData; -import com.mogo.cloud.tanlu.api.IRoadInfoSearchCallback; -import com.mogo.cloud.tanlu.api.MogoRoadSearchManager; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.constants.HostConst; -import com.mogo.module.share.TanluServiceManager; -import com.mogo.module.share.bean.VoiceCmdData; -import com.mogo.module.share.callback.RoadInfoCallback; -import com.mogo.module.share.constant.HttpConstant; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.network.IMogoNetwork; - -import java.util.ArrayList; - - -/** - * @author lixiaopeng - * @description 探路接口数据处理 - * @since 2020-01-09 - */ -public class TanluModelData { - - private final Context mContext; - private TanluApiService mShareApiService; - private static final String TAG = "TanluModelData"; - - public TanluModelData(Context context) { - this.mContext = context; - IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context); - mShareApiService = network.create(TanluApiService.class, HostConst.LAUNCHER_SNAPSHOT_HOST); - } - - private String getBaseUrl() { - if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE) { - return HttpConstant.HOST_PRODUCT; - } else if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_DEMO) { - return HttpConstant.HOST_DEMO; - } else { - return HttpConstant.HOST_TEST; - } - } - - /** - * 查询周边道路事件,是通过语音搜索,然后根据语音提供的语义,从服务端查询道路事件 - * - * @param voiceCmdData 语音提供的语义封装 - */ - public void queryRodeInfo(Context context, String key, final VoiceCmdData voiceCmdData, final RoadInfoCallback callback) { - Logger.d(TAG, "queryRodeInfo: " + voiceCmdData); - - ArrayList list = new ArrayList(); - list.add(voiceCmdData.getType()); - - //北京市朝阳区小黄庄北街2号, 经纬度和地理位置必须有一个 - MogoLocation mogoLocation = TanluServiceManager.getServiceApis().getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation(); - com.mogo.cloud.tanlu.bean.location.Location location = new com.mogo.cloud.tanlu.bean.location.Location(); - location.setLatitude(mogoLocation.getLatitude()); - location.setLongitude(mogoLocation.getLongitude()); - com.mogo.cloud.tanlu.bean.RoadInfoRequest request = new com.mogo.cloud.tanlu.bean.RoadInfoRequest(location, key, list, false, false); - - MogoRoadSearchManager.getInstance(context).init(); - MogoRoadSearchManager.getInstance(context).queryRoadInfo(request, new IRoadInfoSearchCallback() { - @Override - public void onSuccess(BaseData result) { - if (result != null) { - if (result.getResult() != null) { - Logger.d(TAG, "搜索附近路况信息成功: " + result.getResult()); - callback.onQueryRoadInfoSuccess(result.getResult().getData()); - } else { - callback.onQueryRoadInfoFail(result.getMsg(), result.getCode()); - } - } - } - - @Override - public void onFailure(int code) { - callback.onQueryRoadInfoFail("", code); - } - - @Override - public void onError(Throwable e) { - - } - }); - - -// if (voiceCmdData.isHere()) { -// // 搜索附近路况,只需要拿到当前位置信息,就可以请求服务端 -// MogoLocation l = TanluServiceManager.getServiceApis().getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation(); -// Location location = new Location(l.getLatitude(), l.getLongitude()); -// callback.onLocatSuccess(l.getLatitude(), l.getLongitude()); -// RoadInfoRequest request; -// if (voiceCmdData.getObj().equals(TYPE_NAME_BLOCK)) { -// // 拥堵和路况同时查 -// request = new RoadInfoRequest(location, new String[]{TANLU_ROAD_CONGESTION_COMPAT, TANLU_ROAD_CURRENT}, false, false); -// }else{ -// request = new RoadInfoRequest(location, new String[]{voiceCmdData.getType()}, false, false); -// } -// -// Map params = new ParamsProvider.Builder(mContext) -// .append("sn", MoGoAiCloudClientConfig.getInstance().getSn()) -// .append("data", GsonUtil.jsonFromObject(request)) -// .build(); -// -// mShareApiService.queryRoadInfos(params) -// .subscribeOn(Schedulers.io()) -// .observeOn(AndroidSchedulers.mainThread()) -// .subscribe(new SubscribeImpl>(RequestOptions.create(mContext)) { -// @Override -// public void onError(Throwable e) { -// super.onError(e); -// } -// -// @Override -// public void onSuccess(BaseDataCompat o) { -// super.onSuccess(o); -// Logger.d(TAG, "搜索附近路况信息成功: " + o); -// callback.onQueryRoadInfoSuccess(o.getResult().getData()); -// Logger.d(TAG, "搜索附近路况信息成功2: " + o); -// } -// -// @Override -// public void onError(String message, int code) { -// super.onError(message, code); -// callback.onQueryRoadInfoFail(message, code); -// } -// }); -// } else { -// // 查询的不是附近的信息,所以需要查询一下目标地址的经纬度,然后再请求服务端 -// Observable.create(new ObservableOnSubscribe() { -// @Override -// public void subscribe(ObservableEmitter emitter) throws Exception { -// // 根据传入的地址,转成经纬度 -// IMogoMapService mapService = TanluServiceManager.getServiceApis().getMapServiceApi(); -// String cityCode = mapService.getSingletonLocationClient(mContext).getLastKnowLocation().getCityCode(); -// MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(voiceCmdData.getLocation(), "", cityCode); -// IMogoPoiSearch poiSearch = mapService.getPoiSearch(mContext, poiSearchQuery); -// MogoPoiResult result = poiSearch.searchPOI(); -// if (result != null && result.getPois() != null && result.getPois().size() > 0) { -// emitter.onNext(result); -// } else { -// emitter.onError(new IllegalArgumentException("没有根据地址查询到对应的经纬度")); -// } -// } -// }).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()) -// .flatMap(new Function>>() { -// @Override -// public Observable> apply(MogoPoiResult mogoPoiResult) throws Exception { -// // 转成经纬度后,整理参数,进行接口请求 -// Logger.d(TAG, "查询目标地址经纬度成功===" + Thread.currentThread().getName()); -// MogoPoiItem poiItem = mogoPoiResult.getPois().get(0); -// Location location = new Location(poiItem.getPoint().lat, poiItem.getPoint().lon); -// callback.onLocatSuccess(location.getLat(), location.getLon()); -// RoadInfoRequest request; -// if (voiceCmdData.getObj().equals(TYPE_NAME_BLOCK)) { -// // 拥堵和路况同时查 -// request = new RoadInfoRequest(location, new String[]{TANLU_ROAD_CONGESTION_COMPAT, TANLU_ROAD_CURRENT}, false, false); -// }else{ -// request = new RoadInfoRequest(location, new String[]{voiceCmdData.getType()}, false, false); -// } -// -// Map params = new ParamsProvider.Builder(mContext) -// .append("sn", MoGoAiCloudClientConfig.getInstance().getSn())) -// .append("data", GsonUtil.jsonFromObject(request)) -// .build(); -// return mShareApiService.queryRoadInfos(params); -// } -// }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) -// .subscribe(new SubscribeImpl>(RequestOptions.create(mContext)) { -// @Override -// public void onError(Throwable e) { -// super.onError(e); -// callback.onQueryRoadInfoFail(e.getMessage(), -1); -// } -// -// @Override -// public void onSuccess(BaseDataCompat o) { -// super.onSuccess(o); -// Logger.d(TAG, "当前线程为"+Thread.currentThread().getName()+" 搜索目标地址路况信息成功: " + o); -// callback.onQueryRoadInfoSuccess(o.getResult().getData()); -// } -// -// @Override -// public void onError(String message, int code) { -// super.onError(message, code); -// callback.onQueryRoadInfoFail(message, code); -// } -// }); -// } - } - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java deleted file mode 100644 index c201b97c22..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficApiService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.module.share.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.util.Map; - -import io.reactivex.Observable; -import retrofit2.http.FieldMap; -import retrofit2.http.FormUrlEncoded; -import retrofit2.http.POST; - -public interface TrafficApiService { - /** - * 上报路况拥堵情况 - */ - @FormUrlEncoded - @POST("/yycp-tmcServer/tmcServer/car/reportTraffic/v1") - Observable UploadCongestionInfo(@FieldMap Map parames); - -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java deleted file mode 100644 index b466e1afe7..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/net/TrafficModelData.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mogo.module.share.net; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.commons.network.ParamsProvider; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.constants.HostConst; -import com.mogo.module.common.entity.UploadTrafficEntity; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.network.IMogoNetwork; - -import java.util.Map; - -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.schedulers.Schedulers; - -import static com.mogo.commons.AbsMogoApplication.getApp; - -public class TrafficModelData { - - private static final String TAG = "TrafficModelData"; - private TrafficApiService mTrafficApiService; - - public TrafficModelData() { - IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext()); - mTrafficApiService = network.create(TrafficApiService.class, HostConst.TMC_HOST); - } - - /** - * 拥堵信息上报 - * - * @param uploadTrafficEntity 高的返回的拥堵信息对象 - * @param - */ - public void uploadTrafficInfo(UploadTrafficEntity uploadTrafficEntity) { - - final ParamsProvider.Builder builder = new ParamsProvider.Builder( getApp().getApplicationContext()); - Map parameters = builder.build(); - parameters.put("sn", MoGoAiCloudClientConfig.getInstance().getSn()); - parameters.put("data", GsonUtil.jsonFromObject(uploadTrafficEntity)); - mTrafficApiService.UploadCongestionInfo(parameters) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create( getApp().getApplicationContext())) { - @Override - public void onError(Throwable e) { - super.onError(e); - Logger.d(TAG, "拥堵上报失败" + e.toString()); -// callback.UploadFail(e.getMessage(), -1); - } - - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - Logger.d(TAG, "拥堵上报成功" + o.toString()); -// callback.UpLoadSuccess(o.msg.toString(), o.code); - - } - }); - - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/receiver/SearchTrafficInfoReceiver.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/receiver/SearchTrafficInfoReceiver.kt deleted file mode 100644 index 51cd59ba3f..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/receiver/SearchTrafficInfoReceiver.kt +++ /dev/null @@ -1,48 +0,0 @@ -package com.mogo.module.share.receiver - -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.share.bean.VoiceCmdData -import com.mogo.module.share.constant.ShareConstants.* -import com.mogo.module.share.utils.Utils - -class SearchTrafficInfoReceiver : BroadcastReceiver() { - private val TAG = "SearchTrafficInfoReceiver" - override fun onReceive(context: Context?, intent: Intent?) { - // 目前只接com.zhidao.speech.awake.notify这一个广播,所以暂不区分action - Logger.d(TAG,"收到搜索事件广播====") - val data = intent?.getStringExtra("data") ?: "" - var voiceData: VoiceCmdData? = null - when (intent?.getStringExtra("command") ?: "") { - VOICE_COMMAND_QUERY_TRAFFIC_CHECK -> { - // 搜索交通检查 - voiceData = Utils.parseTOVoiceCmdData(data) - voiceData.obj = TYPE_NAME_TRAFFIC_CHECK - } - VOICE_COMMAND_QUERY_ROAD_CLOSED -> { - // 搜索封路 - Logger.d(TAG, "封路: $data") - voiceData = Utils.parseTOVoiceCmdData(data) - voiceData.location = voiceData.obj - voiceData.obj = TYPE_NAME_CLOSURE - } - SPECIFIEDROAD_SEARCH->{ - // 拥堵和路况 - Logger.d(TAG,"拥堵和路况:$data") - voiceData = Utils.parseTOVoiceCmdData(data) - voiceData.obj = TYPE_NAME_BLOCK - } - // 其他道路事件 - VOICE_COMMAND_NOVELTY_QUERY -> voiceData = Utils.parseTOVoiceCmdData(data) - else->{ - Logger.d(TAG, "未收录广播===${intent?.getStringExtra("command")}") - } - } - - voiceData?.let { - Logger.d(TAG, "准备开始网络请求,搜索附近道路事件: $it") - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/CarCorderController.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/CarCorderController.kt deleted file mode 100644 index effe9ec59a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/CarCorderController.kt +++ /dev/null @@ -1,400 +0,0 @@ -package com.mogo.module.share.service - -import android.text.TextUtils -import com.hw.videoprocessor.VideoProcessor -import com.mogo.cloud.network.BaseData -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.cloud.tanlu.api.ITanluUploadCallback -import com.mogo.cloud.tanlu.api.MogoUploadManager -import com.mogo.cloud.tanlu.bean.UploadInfo -import com.mogo.cloud.tanlu.bean.UploadResult -import com.mogo.commons.AbsMogoApplication -import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.util.NetworkUtils -import com.mogo.module.share.bean.event.GetImageSuccessEvent -import com.mogo.module.share.bean.event.LatLngStickyEventBus -import com.mogo.module.share.constant.STRATEGY_UPLOAD_TYPE_ARRAY -import com.mogo.module.share.constant.ShareConstants.TANLU -import com.mogo.module.share.utils.* -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyMaxSpeed -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyMinSpeed -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyType -import com.zhidao.auto.carcorder.callback.TakePhotoCallback -import com.zhidao.auto.carcorder.callback.TakeVideoCallback -import com.zhidao.auto.carcorder.controller.ZdCarCoderController -import java.io.File -import kotlin.math.abs - -/** - * @description 记录仪相关操作 - * - * @author lixiaopeng - * @since 2019-10-30 - */ -object CarCorderController : TakePhotoCallback, TakeVideoCallback { - private lateinit var zdCarCoderController: ZdCarCoderController - private var outputVideoPath: String = "" - private var mType: String = "" //1 上报拥堵, 2 封路和查车 - private var mainInfoId: Long = 0 - private var mFromType: String = "" - private var mLongitude: Double = 0.0 - private var mLatitude: Double = 0.0 - private var mSpeed: Float = 0f - - private var mAddress: String = "" - private var mDirection: Float = 0f - private var mAreaCode: String = "" - private var mCityCode: String = "" - - - fun initCarCorderController() { - try { - zdCarCoderController = - ZdCarCoderController.getInstance(AbsMogoApplication.getApp().applicationContext) - zdCarCoderController.addCallback(this) - zdCarCoderController.addVideoCallback(this) - zdCarCoderController.init() - } catch (e: Exception) { - e.printStackTrace() - } - } - - - fun takePhoto( - photoType: Int, - cameraId: Int, - haveVoice: Boolean, - isCustom: Boolean = false, - type: String, - mainInfoId: Long, - fromType: String, - longitude: Double, - latitude: Double, - speed: Float, - address: String, - direction: Float, - areaCode: String, - cityCode: String - ) { - Logger.d(TANLU, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType") - this.mType = type - this.mainInfoId = mainInfoId - this.mFromType = fromType - this.mLongitude = longitude - this.mLatitude = latitude - this.mSpeed = speed - this.mAddress = address - this.mDirection = direction - this.mAreaCode = areaCode - this.mCityCode = cityCode - - CustomStatusHandler.offerPhotoStatus(isCustom) - zdCarCoderController.takePhoto(photoType, cameraId, haveVoice) - trackGetPhoto(1) - } - - /** - * @param isCustom: 是否手动上传 - * @param id: 标志是哪一个上传 - */ - fun takeVideo( - cameraId: Int, - duration: Int, - isCustom: Boolean = false, - id: Long = 0L, - type: String, - mainInfoId: Long, - fromType: String, - longitude: Double, - latitude: Double, - speed: Float, - address: String, - direction: Float, - areaCode: String, - cityCode: String - ) { - Logger.d(TANLU, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed") - this.mType = type - this.mainInfoId = mainInfoId - this.mFromType = fromType - this.mLongitude = longitude - this.mLatitude = latitude - this.mSpeed = speed - this.mAddress = address - this.mDirection = direction - this.mAreaCode = areaCode - this.mCityCode = cityCode - - if (DebugConfig.getCarMachineType() == 0) { //自研车机 - outputVideoPath = getCompressVideoPath() - CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id, fromType)) - zdCarCoderController.takeVideo(cameraId, duration) - trackGetVideo(1) - } else { //比亚迪 - Logger.d(TANLU, "takeVideo ------ isnet = " + NetworkUtils.isConnected(AbsMogoApplication.getApp().applicationContext)) - getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, CarCorderController.mainInfoId)?.let { uploadRoadInfo(it) } - } - } - - fun release() { - zdCarCoderController.release() - } - - //拍照失败回调 - override fun onTakePhotoFail(photoType: Int, camera: Int) { - trackGetPhoto(3) - val isCustom = CustomStatusHandler.pollPhotoStatus() - Logger.e(TANLU, "onTakePhotoFail -----mType = $mType --- isCustom = $isCustom") - //获取图片失败也上报,图片不打点 - if (isCustom) { - getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - } - } - - //拍照成功回调返回图片本地路径 - override fun onTakePhotoSuccess(photoType: Int, camera: Int, photoPath: String?) { - trackGetPhoto(2) - Logger.d(TANLU, "onTakePhotoSuccess -----mType = $mType --- mainInfoId = $mainInfoId") - val isCustom = CustomStatusHandler.pollPhotoStatus() - - if (!isCustom) { - trackNormalEvent(CarNet_auto_upload, null) - } - - var interceptor = false - if (interceptor) { - return - } - - val minSpeedPic = - getStrategyMinSpeed( - AbsMogoApplication.getApp().applicationContext, - "pic", - getStrategyType("pic") - ) - val maxSpeedPic = - getStrategyMaxSpeed( - AbsMogoApplication.getApp().applicationContext, - "pic", - getStrategyType("pic") - ) - val speed = LocationUtil.getInstance().getSpeed() - - if (!TextUtils.isEmpty(mType)) { - Logger.d(TANLU, "onTakePhotoSuccess mType != null") - if (photoPath != null) { - getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - } - - } else { - Logger.d(TANLU, "onTakePhotoSuccess mType == null") - Logger.d( - TANLU, - "onTakePhotoSuccess maxSpeedPic = $maxSpeedPic ---> speed = $speed ---->minSpeedPic= $minSpeedPic" - ) - if (maxSpeedPic == -1) { - if (speed >= (abs(minSpeedPic) / 3.6f)) { - Logger.d(TANLU, "onTakePhotoSuccess abs =" + (abs(minSpeedPic) / 3.6f)) - if (photoPath != null) { - getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - } - } - } - - if (minSpeedPic > 0 && maxSpeedPic > 0) { - Logger.d(TANLU, "onTakePhotoSuccess minSpeedPic > 0 -- speed = $speed") - if ((speed >= (minSpeedPic / 3.6f)) && speed <= (maxSpeedPic / 3.6f)) { - if (photoPath != null) { - getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - } - } - } - } - } - - //获取视频成功 - override fun onTakeVideoSuccess(camera: Int, videoPath: String?) { - val thumbnailPath = - AbsMogoApplication.getApp().applicationContext.filesDir.parent + File.separator + "Thumbnail${System.currentTimeMillis()}.jpg" - val isSuccess = getVideoThumbnail(videoPath!!, thumbnailPath) - Logger.d( - TANLU, - "getVideo onTakeVideoSuccess===$videoPath -----> isSuccess= $isSuccess ----> mType = $mType --- mainInfoId = $mainInfoId" - ) - - val entity = CustomStatusHandler.pollVideoStatus() - - entity?.let { - if (!entity.isCustom) { - trackNormalEvent(CarNet_auto_upload_video, null) - } - } - - if (isSuccess) { - val minSpeedVideo = getStrategyMinSpeed( - AbsMogoApplication.getApp().applicationContext, "video", - getStrategyType("video") - ) - val maxSpeedVideo = getStrategyMaxSpeed( - AbsMogoApplication.getApp().applicationContext, "video", - getStrategyType("video") - ) - val speed = LocationUtil.getInstance().getSpeed() - - entity?.let { - if (it.isCustom) { - compressVideo(videoPath, thumbnailPath, it) - - } else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) { - // 属于策略上报 - compressVideo(videoPath, thumbnailPath, it) - - } else { - Logger.d( - TANLU, - "onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo" - ) - if (maxSpeedVideo == -1) { - Logger.d(TANLU, "onTakeVideoSuccess 111 abs =" + (abs(minSpeedVideo) / 3.6f)) - if (speed >= (abs(minSpeedVideo) / 3.6f)) { - //获取视频以及缩略图成功,开始上报 - compressVideo(videoPath, thumbnailPath, it) - } - } - - if (minSpeedVideo > 0 && maxSpeedVideo > 0) { - Logger.d(TANLU, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed") - if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) { - compressVideo(videoPath, thumbnailPath, it) - } else { - } - } else { - } - } - } - trackGetVideo(2) - } - } - - private var videoAndThumbMap: MutableMap = mutableMapOf() - - //获取视频失败 - override fun onTakeVideoFail(camera: Int) { - getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - - //地图上打点 - taskAsync(3_000) { - try { - LatLngStickyEventBus.getInstance().postSticky(GetImageSuccessEvent("", mType)) - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - } - - /** - * 压缩视频并且上传 - */ - private fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) { - Logger.d( - TANLU, - "outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity.isCustom}" - ) - val startTime = System.currentTimeMillis() - Thread(Runnable { - try { - VideoProcessor.processor(AbsMogoApplication.getApp().applicationContext) - .input(videoPath) - .output(outputVideoPath) - .removeAudio(true) - .outWidth(1920) - .outHeight(1080) - .bitrate(2000 * 1024) - .frameRate(25) - .process() - Logger.d(TANLU, "compress cost time =" + (System.currentTimeMillis() - startTime)) - getInfo(outputVideoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - //删除压缩前的视频 - deletePicFile(videoPath) - } catch (e: Exception) { - Logger.e(TANLU, "compressVideo e = $e") - //删除压缩前的视频 - deletePicFile(videoPath) - e.printStackTrace() - } - }).start() - } - - /** - * 上报路况的视频和图片 - */ - private fun uploadRoadInfo(info: UploadInfo) { - MogoUploadManager.getInstance(AbsMogoApplication.getApp().applicationContext).uploadInfo(info, object : ITanluUploadCallback { - override fun onSuccess(result: BaseData) { - if (result.result != null) { - Logger.d(TANLU, "result =" + result.result) - } - } - - override fun onFailure(code: Int) { - Logger.e(TANLU, "onFailure code = $code") - } - - override fun onError(e: Throwable) { - Logger.e(TANLU, "onError e = $e") - } - }) - } - - private fun getInfo(filePath: String, addr: String, lon: Double, lat: Double, poiType: String, - direction: Float, areaCode: String, cityCode: String, type: Int, fromType: String - , mainInfoId: Long): UploadInfo? { - val info = UploadInfo() - info.filePath = filePath - info.addr = addr - info.longitude = lon - info.latitude = lat - info.poiType = poiType - info.direction = direction - info.areaCode = areaCode - info.cityCode = cityCode - info.sn = MoGoAiCloudClientConfig.getInstance().getSn() - info.type = type //0为图片, 1为视频 - info.fromType = fromType - info.mainInfoId = mainInfoId - info.infoType = 1 - - return info - } - - override fun onTakePhotoCancel(photoType: Int, camera: Int) { - Logger.d(TANLU, "onTakePhotoCancel -----photoType = $photoType") - } - - override fun onTakeVideoCancel(camera: Int) { - Logger.d(TANLU, "onTakeVideoCancel -----camera = $camera") - //失败了,传空地址,发起请求 - videoAndThumbMap["video"] = "" - videoAndThumbMap["thumb"] = "" - - getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) } - } - - //获取图片 - private fun trackGetPhoto(type: Int) { - trackNormalEvent( - CarNet_Get_Picture, mutableMapOf("type" to type), - AbsMogoApplication.getApp().applicationContext - ) - } - - //获取视频 - private fun trackGetVideo(type: Int) { - trackNormalEvent( - CarNet_Get_Video, mutableMapOf("type" to type), - AbsMogoApplication.getApp().applicationContext - ) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/CustomStatusHandler.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/CustomStatusHandler.kt deleted file mode 100644 index 13393f297a..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/CustomStatusHandler.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.mogo.module.share.service - -import java.util.* - -/** - * @author lixiaopeng - * @since 2019-11-25 - * - * 拍照、拍视频手动、被动状态队列 - */ -object CustomStatusHandler { - - private val takePhotoStatusQueue: Queue = ArrayDeque(5) - private val takeVideoStatusQueue: Queue = ArrayDeque(5) - - fun offerPhotoStatus(status: Boolean) { - takePhotoStatusQueue.offer(status) - } - - fun pollPhotoStatus() = takePhotoStatusQueue.poll() ?: false - - fun offerVideoStatus(entity: TakeEntity) { - takeVideoStatusQueue.offer(entity) - } - - fun pollVideoStatus(): TakeEntity? = takeVideoStatusQueue.poll() -} - -class TakeEntity( - var isCustom: Boolean, var id: Long, var fromType: String = "0" -) \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/MainService.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/MainService.kt deleted file mode 100644 index 36b4cd674f..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/MainService.kt +++ /dev/null @@ -1,347 +0,0 @@ -package com.mogo.module.share.service - -import android.app.AlarmManager -import android.app.PendingIntent -import android.app.Service -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.content.IntentFilter -import android.os.IBinder -import com.alibaba.android.arouter.launcher.ARouter -import com.elegant.analytics.Analytics -import com.mogo.commons.AbsMogoApplication -import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.module.common.MogoApisHandler -import com.mogo.module.share.BuildConfig -import com.mogo.module.share.bean.event.GetImageSuccessEvent -import com.mogo.module.share.bean.event.LatLngStickyEventBus -import com.mogo.module.share.constant.* -import com.mogo.module.share.constant.ShareConstants.TANLU -import com.mogo.module.share.utils.* -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.clearStrategyType -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyFrequency -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyInterval -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyType -import com.mogo.service.IMogoServiceApis -import com.zhidao.cosupload.manager.CosUploadManagerImpl -import io.reactivex.Observable -import io.reactivex.android.schedulers.AndroidSchedulers -import org.greenrobot.eventbus.Subscribe -import org.greenrobot.eventbus.ThreadMode -import java.util.concurrent.TimeUnit - - -/** - * 上报流程服务 - */ -class MainService : Service() { - - companion object { - fun launchService(context: Context, params: UploadParams?) { - val intent = Intent(context, MainService::class.java).apply { - Logger.d(TANLU, "launch type = $params") - putExtra("params", params) - } - context.startService(intent) - } - } - - private lateinit var mainServiceHttpModel: MainServiceController - private var mAlarmManager: AlarmManager = - AbsMogoApplication.getApp().applicationContext.getSystemService(Context.ALARM_SERVICE) as AlarmManager - - //是否已经获取过策略 - var isGetStrategies: Boolean = false - - //1是一次性,2是周期性 - private var picType: Int = 0 - private var videoType: Int = 0 - private var shareType: String = "type" - private var fromType: String = "" - private var isCustom: Boolean = false - private var speed: Float = 0f - - private var params: UploadParams? = null - private var mainInfoId: Long = 0 - private var mLongitude: Double = 0.0 - private var mLatitude: Double = 0.0 - private lateinit var serviceApis: IMogoServiceApis - private var mAddress: String = "" - private var mDirection: Float = 0f - private var mAreaCode: String = "" - private var mCityCode: String = "" - private var id: Long = System.currentTimeMillis() - - - override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - //清理多媒体资源和sp策略数据 - clearStrategyType(this) - //初始化埋点 - Analytics.getInstance().start(this) - //参数说明:appKey: app唯一标识(比如:包名) - CosUploadManagerImpl.getInstance(AbsMogoApplication.getApp().applicationContext) - .init(BuildConfig.APPLICATION_ID, 0) - serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(this) as IMogoServiceApis - if (serviceApis.mapServiceApi.getSingletonLocationClient(this) != null && - serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation != null) { - speed = serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation.speed - Logger.d(TANLU, "onStartCommand speed = $speed") - } - - if (intent != null) { - params = intent.getParcelableExtra("params") - params?.let { - shareType = it.eventType - fromType = it.fromType - mainInfoId = it.parentId - mLongitude = it.lon - mLatitude = it.lat - mAddress = it.addr - mDirection = it.direction - mAreaCode = it.areaCode - mCityCode = it.cityCode - - Logger.d(TANLU, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ") - if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) { - // 如果是策略上报,isCustom = false - takeVideo(it.duration) - } else { - takeVideo(it.duration, isCustom = true, id = id) - } - } - } else { - Logger.e(TANLU, "intent == null ") - } - - return super.onStartCommand(intent, flags, startId) - } - - //定时任务回调广播 - private var mAlarmBroadCast: BroadcastReceiver = object : BroadcastReceiver() { - override fun onReceive(p0: Context?, p1: Intent) { - Logger.d(TANLU, "receive alarm!!!!!!!!!!AlarmType===${p1.getIntExtra("AlarmType", 1)}") - if (p1.action == alarmBroadAction) { - if (p1.getIntExtra("AlarmType", 1) == AlarmTypePic) { - //拍照 - takePhoto(true) - } else { - //录像 - val duration = p1.getIntExtra("duration", 3) - takeVideo(duration, true) - } - } - } - } - - //主动上报图片情报广播 - var mCustomSendBroadCast: BroadcastReceiver = object : BroadcastReceiver() { - override fun onReceive(p0: Context?, p1: Intent) { - val id = p1.getLongExtra("id", 0L) - if (p1.action == sendInformationAction) { - takeVideo(DEFAULT_VIDEO_DURATION, isCustom = true, id = id) - } - } - } - - override fun onBind(intent: Intent?): IBinder? { - return null - } - - - override fun onCreate() { - super.onCreate() - init() - //初始化定位 - LocationUtil.getInstance().initLocation() - - initLocationListener() - LatLngStickyEventBus.getInstance().register(this) - trackNormalEvent(CarNet_MainService_Start, null) - } - - private fun init() { - //初始化拍照sdk - CarCorderController.initCarCorderController() - mainServiceHttpModel = MainServiceController() - registReceiver() - } - - /** - * 获取图片成功 - */ - @Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 98) - fun getImageEvent(getImageSuccessEvent: GetImageSuccessEvent) { - val info = LocationUtil.getInstance().getLocationInfo() - Logger.d(TANLU, "getImageEvent long = ${info.longitude} ----> lat= ${info.latitude}") - Logger.d(TANLU, - "getImageEvent url = " + getImageSuccessEvent.getImageUrl() + ">>>>type =" + getImageSuccessEvent.getType() - ) - - if (!DebugConfig.isMapBased()) { - MogoApisHandler.getInstance().apis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", false) - } - } - - - /** - * 初始化定位监听 - */ - private fun initLocationListener() { - val isOpen = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().applicationContext).getBoolean("KEY_SERVER_REPORTSTRATEGY_SWITCH", false) - Logger.d(TANLU, " initLocationListener ---- isOpen = $isOpen") - //开始开始监听速度,只要超过一次5公里每小时则即开始获取策略进行本地上报 只有release才加此判断,qa环境方便测试 - LocationUtil.getInstance().setonSpeedlistenner(object : LocationUtil.SpeedListener { - override fun onSpeedGet(speed: Float) { - if (isOpen) { - if (speed > (5 / 3.6f) && !isGetStrategies) { - mainServiceHttpModel.initStrategies { - handleReportStrategy() - } - Logger.d(TANLU, "initLocationListener more than 5 start upload speed = $speed") - isGetStrategies = true - } - } - } - }) - } - - /** - * 上报策略判断 - */ - private fun handleReportStrategy() { - //1是一次性,2是周期性 - picType = getStrategyFrequency( - AbsMogoApplication.getApp().applicationContext, - "pic", - getStrategyType("pic") - ) - videoType = getStrategyFrequency( - AbsMogoApplication.getApp().applicationContext, - "video", - getStrategyType("video") - ) - Logger.d(TANLU, "handleReportStrategy picType = $picType ---videoType = $videoType") - shareType = TANLU_ROAD_CURRENT - if (picType == 1) { - takePhoto() - } else if (picType == 2) { - postPhotoAlarmTask(true) - } - - if (videoType == 1) { - takeVideo(DEFAULT_VIDEO_DURATION) - } else if (videoType == 2) { - postVideoAlarmTask(true) - } - } - - private fun registReceiver() { - //注册定时任务回调 - val intentFilter = IntentFilter(alarmBroadAction) - intentFilter.addAction("com.zhidao.sendmessage.test") - intentFilter.addAction("com.zhidao.takevideo.test") - intentFilter.addAction("com.zhidao.takepic.test") - registerReceiver(mAlarmBroadCast, intentFilter) - } - - //获取图片 - private fun takePhoto(isInterval: Boolean = false, isCustom: Boolean = false) { - Logger.d(TANLU, "takePhoto -----1----->") - //判断是否授权 - //目前不支持连拍,只能定时2秒拍一张 第一期每次只拍一张 - Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { - CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) - } - - postPhotoAlarmTask(isInterval) - - this@MainService.isCustom = isCustom - } - - //获取录像 - private fun takeVideo( - duration: Int, - isInterval: Boolean = false, - isCustom: Boolean = false, - id: Long = 0 - ) { - Logger.d(TANLU, "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom") - CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) - postVideoAlarmTask(isInterval) - - this@MainService.isCustom = isCustom - } - - private fun postPhotoAlarmTask(isInterval: Boolean = false) { - if (isInterval) { - trackNormalEvent(CarNet_Create_Task, null) - val intent = Intent() - intent.action = alarmBroadAction - intent.putExtra("number", getLong(PIC_NUMBER, PIC_NUMBER_DEFAULT)) - intent.putExtra("AlarmType", AlarmTypePic) - val pendingIntent = PendingIntent.getBroadcast(this, AlarmTypePic, intent, 0) - Logger.d(TANLU, - "postPhotoAlarmTask time =" + getStrategyInterval( - AbsMogoApplication.getApp().applicationContext, - "pic", - getStrategyType("pic") - ) - ) - - mAlarmManager.setExact( - AlarmManager.RTC, System.currentTimeMillis() + - getStrategyInterval( - AbsMogoApplication.getApp().applicationContext, - "pic", - getStrategyType("pic") - ), pendingIntent - ) - } - } - - //开始倒计时任务 - private fun postVideoAlarmTask(isInterval: Boolean = false) { - if (isInterval) { - trackNormalEvent(CarNet_Create_Task, null) - val videoIntent = Intent() - videoIntent.action = alarmBroadAction - videoIntent.putExtra( - "duration", (VIDEO_DURATION_DEFAULT / 1000).toInt() - ) - videoIntent.putExtra("AlarmType", AlarmTypeVideo) - val videoPendingIntent = - PendingIntent.getBroadcast(this, AlarmTypeVideo, videoIntent, 0) - Logger.d(TANLU, - "postVideoAlarmTask time =" + getStrategyInterval( - AbsMogoApplication.getApp().applicationContext, - "video", - getStrategyType("video") - ) - ) - - mAlarmManager.setExact( - AlarmManager.RTC, System.currentTimeMillis() + - getStrategyInterval( - AbsMogoApplication.getApp().applicationContext, - "video", - getStrategyType("video") - ), videoPendingIntent - ) - } - } - - override fun onDestroy() { - super.onDestroy() - unregisterReceiver(mAlarmBroadCast) - CarCorderController.release() - LatLngStickyEventBus.getInstance().unregister(this) - LatLngStickyEventBus.getInstance().removeAllStickyEvents() - trackNormalEvent(CarNet_MainService_Destory, null) - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/MainServiceController.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/MainServiceController.kt deleted file mode 100644 index c6c624a89d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/MainServiceController.kt +++ /dev/null @@ -1,259 +0,0 @@ -package com.mogo.module.share.service - -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.network.request -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.share.bean.* -import com.mogo.module.share.constant.ShareConstants -import com.mogo.module.share.constant.ShareConstants.TANLU -import com.mogo.module.share.utils.CarNet_Get_Strategy -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyFrequency -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyInterval -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyMaxSpeed -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyMinSpeed -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyType -import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyValidity -import com.mogo.module.share.utils.trackNormalEvent -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking - -class MainServiceController { - - companion object { -// const val TAG = "MainServiceController" - } - - //逆地理编码是否重试 - private var geoRetry = false - private var mFromType: String = "" - private var mPoiType: String = "" - - private val strategyModel by lazy { StrategyServiceModel() } - - fun initStrategies(initFinish: (() -> Unit)? = null) { - request> { - loader { - strategyModel.getCityStrategy() - } - onSuccess { - it.result.let { strategy -> - trackNormalEvent(CarNet_Get_Strategy, null) - Logger.d(TANLU, "pic =" + strategy.cityStrategy.pic) - Logger.d(TANLU, "video =" + strategy.cityStrategy.video) - syncStrategiesData(strategy.cityStrategy) - initFinish?.invoke() - } - } - onError { - reInitStrategies() - Logger.e(TANLU, "initStrategies onError ${it.message}") - } - } - } - - private fun reInitStrategies() = runBlocking { - launch { - initStrategies() - } - } - - /** - * 将数据同步到sharePreference中 - */ - private fun syncStrategiesData(strategy: CityStrategy) { - if (strategy.pic != null && strategy.video!=null) { - setStrategyType(AbsMogoApplication.getApp().applicationContext, strategy.pic!!.strategyType, "pic") - setStrategyType(AbsMogoApplication.getApp().applicationContext, strategy.video!!.strategyType, "video") - setStrategyFrequency( - AbsMogoApplication.getApp().applicationContext, - strategy.pic!!.strategyType, - "pic", - strategy.pic!!.reportType - ) - setStrategyFrequency( - AbsMogoApplication.getApp().applicationContext, - strategy.video!!.strategyType, - "video", - strategy.video!!.reportType - ) - setStrategyInterval( - AbsMogoApplication.getApp().applicationContext, - strategy.pic!!.strategyType, - "pic", - strategy.pic!!.reportTimeInterval * 60 * 1000L - ) - setStrategyInterval( - AbsMogoApplication.getApp().applicationContext, - strategy.video!!.strategyType, - "video", - strategy.video!!.reportTimeInterval * 60 * 1000L - ) - setStrategyValidity( - AbsMogoApplication.getApp().applicationContext, - strategy.pic!!.strategyType, - "pic", - strategy.pic!!.infoTimeout - ) - setStrategyValidity( - AbsMogoApplication.getApp().applicationContext, - strategy.video!!.strategyType, - "video", - strategy.video!!.infoTimeout - ) - setStrategyMaxSpeed( - AbsMogoApplication.getApp().applicationContext, - strategy.pic!!.strategyType, - "pic", - strategy.pic!!.getMaxSpeed() - ) - setStrategyMaxSpeed( - AbsMogoApplication.getApp().applicationContext, - strategy.video!!.strategyType, - "video", - strategy.video!!.getMaxSpeed() - ) - setStrategyMinSpeed( - AbsMogoApplication.getApp().applicationContext, - strategy.pic!!.strategyType, - "pic", - strategy.pic!!.minSpeed - ) - setStrategyMinSpeed( - AbsMogoApplication.getApp().applicationContext, - strategy.video!!.strategyType, - "video", - strategy.video!!.minSpeed - ) - } else { - Logger.d(TANLU, "strategy Data is null") - } - } - - //上传情报数据 -// fun sendInformationMessage( -// fromType: String, -// type: Int, -// url: Map, -// isCustom: Boolean = false, -// trafficInfoType:String = "", -// isShare:Boolean = false, -// poiType:String, -// mainInfoId:Long, -// speed: Float, -// longitude: Double, -// latitude: Double, -// customSend: ((Boolean) -> Unit)? = null -// ) { -// Log.d(TAG, " sendInformationMessage poiType = $poiType -- fromType = $fromType") -// mFromType = fromType -// mPoiType = poiType -// -// val locationInfo = LocationUtil.getInstance().getLocationInfo() -// if (locationInfo.address.isEmpty()) { -// Log.d(TAG, " sendInformationMessage locationInfo.address = $locationInfo.address") -// trackUploadGeo(1) -// geoLocation(type, url, locationInfo, isCustom,trafficInfoType, isShare, customSend,poiType,mainInfoId,speed, longitude,latitude) -// } else { -// postInformationMessage( -// getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare,poiType,mainInfoId,longitude,latitude, speed, mFromType), -// customSend -// ) -// } -// } - - - //如果address为空则逆地理编码 -// private fun geoLocation( -// type: Int, -// url: Map, -// locationInfo: LocationInfo, -// isCustom: Boolean, -// trafficInfoType:String, -// isShare: Boolean, -// customSend: ((Boolean) -> Unit)? = null, -// poiType: String, -// mainInfoId: Long, -// speed: Float, -// longitude: Double, -// latitude: Double -// ) { -// Log.d(TAG, " geoLocation -- poiType = $poiType") -// LocationUtil.getInstance() -// .geoCodeLocation(locationInfo.toLatLngPoint(), { -// Log.d(TAG, "geoLocation -------start -->") -// postInformationMessage( -// getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude, speed, mFromType), -// customSend -// ) -// }, { -// //转换失败的情况下再重试一次 -// Log.d(TAG, "geoLocation -------true-->") -// geoRetry = if (!geoRetry) { -// geoLocation(type, url, locationInfo, isCustom, trafficInfoType, isShare, customSend, poiType,mainInfoId,speed, longitude,latitude) -// true -// } else { -// //如果两次都失败,直接上报服务端 -// Log.d(TAG, "geoLocation ---- postInformationMessage ---false-->") -// postInformationMessage( -// getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude,speed, mFromType), -// customSend -// ) -// false -// } -// }) -// } - - -// private fun postInformationMessage( -// informationBody: InformationBody, -// customSend: ((Boolean) -> Unit)? = null -// ) { -// trackUploadServer(3) -// request> { -// loader { -// strategyModel.uploadInformation(informationBody) -// } -// onSuccess { -// Log.i(TAG, "upload success id = " + it.result.id) -// if (mFromType == "6") { -// sendUgcStatusReceiver(it.result.id, mPoiType, mFromType) -// } -// trackUploadServer(1) -// customSend?.invoke(true) -// } -// onError { -// Log.i(TAG, "$it upload message ${it.message}") -// trackUploadServer(2) -// if (mFromType == "6") { -// sendUgcStatusReceiver(0, mPoiType, mFromType) -// } -// customSend?.invoke(false) -// } -// } -// } - -// private fun sendUgcStatusReceiver(id: Long, type: String?, fromType: String?) { -// Log.d(TAG, "sendUgcStatusReceiver id = $id ---type = $type --fromType = $fromType ") -// val intent = Intent() -// intent.action = "com.v2x.ugc.upload.status" -// intent.putExtra("id", id) -// intent.putExtra("type", type) -// intent.putExtra("fromType", fromType) -// AbsMogoApplication.getApp().applicationContext.sendBroadcast(intent) -// } -// -// //上传服务器 -// private fun trackUploadServer(type: Int) { -// trackNormalEvent( -// CarNet_Servers_Upload, mutableMapOf("type" to type) -// ) -// } -// -// //上传 -// private fun trackUploadGeo(type: Int) { -// trackNormalEvent( -// CarNet_Geo, mutableMapOf("type" to type) -// ) -// } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/UploadParams.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/UploadParams.kt deleted file mode 100644 index 2aad4ab33c..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/service/UploadParams.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.mogo.module.share.service - -import android.os.Parcel -import android.os.Parcelable - -/** - * 上报参数 - */ -class UploadParams(val eventType: String, val fromType: String, val duration: Int, val parentId: Long, val lat: Double, val lon: Double,val addr:String,val direction:Float,val areaCode:String,val cityCode:String) : Parcelable { - constructor(parcel: Parcel) : this( - parcel.readString()!!, - parcel.readString()!!, - parcel.readInt(), - parcel.readLong(), - parcel.readDouble(), - parcel.readDouble(), - parcel.readString()!!, - parcel.readFloat(), - parcel.readString()!!, - parcel.readString()!! - ) - - override fun writeToParcel(parcel: Parcel, flags: Int) { - parcel.writeString(eventType) - parcel.writeString(fromType) - parcel.writeInt(duration) - parcel.writeLong(parentId) - parcel.writeDouble(lat) - parcel.writeDouble(lon) - parcel.writeString(addr) - parcel.writeFloat(direction) - parcel.writeString(areaCode) - parcel.writeString(cityCode) - } - - - override fun describeContents(): Int { - return 0 - } - - override fun toString(): String { - return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration, parentId=$parentId, lat=$lat, lon=$lon, addr='$addr', direction=$direction, areaCode='$areaCode', cityCode='$cityCode')" - } - - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): UploadParams { - return UploadParams(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/AccidentStrategyPushWrapper.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/AccidentStrategyPushWrapper.kt deleted file mode 100644 index ec20e86046..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/AccidentStrategyPushWrapper.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.mogo.module.share.strategyreceiver - - - -data class AccidentStrategyPushWrapper( - /** - * 策略类型,[TYPE_ACCIDENT],[TYPE_BLOCK] - */ - val type: Int, - /** - * 触发点的事件id - */ - val id: Long, val lat: Double, val lon: Double){ - - companion object{ - /** - * 服务端下发push,通知收集事故视频 - */ - const val TYPE_ACCIDENT = 1 - - /** - * 服务端下发push,通知收集拥堵 - */ - const val TYPE_BLOCK = 2 - } -} diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/AccidentStrategyReceiver.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/AccidentStrategyReceiver.kt deleted file mode 100644 index ab24bc0bc6..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/AccidentStrategyReceiver.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.mogo.module.share.strategyreceiver - -import com.mogo.eagle.core.data.map.MogoLatLng -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.share.constant.S_TAG -import com.mogo.module.share.strategyreceiver.AccidentStrategyPushWrapper.Companion.TYPE_ACCIDENT -import com.mogo.module.share.strategyreceiver.AccidentStrategyPushWrapper.Companion.TYPE_BLOCK -import com.mogo.service.IMogoServiceApis -import com.mogo.service.cloud.socket.IMogoOnMessageListener -import com.mogo.service.share.IMogoTanluProvider -import com.mogo.service.share.TanluUploadParams - -/** - * 车辆经过事故事件,上报视频 - * @author tong - */ -class AccidentStrategyReceiver(private val apis: IMogoServiceApis) : IMogoOnMessageListener { - override fun target(): Class = AccidentStrategyPushWrapper::class.java - - override fun onMsgReceived(obj: AccidentStrategyPushWrapper?) { - obj?.let { - Logger.d(S_TAG, "Accident strategy share onMessageReceived: $obj") - when (obj.type) { - TYPE_ACCIDENT -> { - // 收集事故视频 - apis.tanluApi.uploadRoadCondition(TanluUploadParams(IMogoTanluProvider.TYPE_ACCIDENT, IMogoTanluProvider.UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO, it.id, - com.mogo.eagle.core.data.map.MogoLatLng(it.lat, it.lon) - )) - } - TYPE_BLOCK -> { - // 收集拥堵视频 - apis.tanluApi.uploadRoadCondition(TanluUploadParams(IMogoTanluProvider.TYPE_BLOCK, IMogoTanluProvider.UPLOAD_FROM_STRATEGY_CLOUD_CHECK, it.id, - com.mogo.eagle.core.data.map.MogoLatLng(it.lat, it.lon) - )) - } - } - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt deleted file mode 100644 index 0260ceebdc..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt +++ /dev/null @@ -1,319 +0,0 @@ -package com.mogo.module.share.strategyreceiver - -import android.content.Context -import android.os.Handler -import android.os.SystemClock -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.module.share.manager.ServiceApisManager -import com.mogo.service.IMogoServiceApis -import com.mogo.service.share.IMogoTanluProvider -import com.mogo.service.share.TanluUploadParams -import java.text.SimpleDateFormat -import java.util.* -import kotlin.collections.ArrayList - - -/** - * 速度记录间隔,单位是毫秒 - */ -private const val SPEED_RECORD_TIME_INTERVAL = 2 * 60 * 1000L - -/** - * 停车标志位阈值,单位是次,两秒一次 - */ -private const val STOP_FLAG_THRESHOLD = 30 -private const val TAG = "BlockUploadStrategy" -private const val TIME_FAULT_TOLERANT = 60 * 60 * 1000L -private const val DISTANCE_RECORD_TIME = 3 * 60 * 1000L - -private const val MORNING_PEAK_START_MINUTE = 7 * 60 + 30 -private const val MORNING_PEAK_STOP_MINUTE = 9 * 60 + 30 - -private const val NIGHT_PEAK_START_MINUTE = 17 * 60 + 30 -private const val NIGHT_PEAK_STOP_MINUTE = 19 * 60 + 30 - -private const val NORMAL_UPLOAD_COUNT = 5 // 5 -private const val MORNING_PEAK_UPLOAD_COUNT = 2 // 2 -private const val NIGHT_PEAK_UPLOAD_COUNT = 3 // 3 - -private const val DISTANCE_MORNING_PEAK_COUNT = "DISTANCE_MORNING_PEAK_COUNT" -private const val DISTANCE_NIGHT_PEAK_COUNT = "DISTANCE_NIGHT_PEAK_COUNT" -private const val DISTANCE_NORMAL_COUNT = "DISTANCE_NORMAL_COUNT" - -private const val START_BLOCK_COUNT_DATE = "START_BLOCK_COUNT_DATE" - - -private const val SPEED_MORNING_PEAK_COUNT = "SPEED_MORNING_PEAK_COUNT" -private const val SPEED_NIGHT_PEAK_COUNT = "SPEED_NIGHT_PEAK_COUNT" -private const val SPEED_NORMAL_COUNT = "SPEED _NORMAL_COUNT" - -/** - * 用于计算拥堵策略 - */ -class BlockStrategy(private val context: Context, private val apis: IMogoServiceApis) { - private var startRecordTime: Long = 0 - private var speedCacheList = ArrayList() - - /** - * 停车标志位,当速度为0时加1,超过[STOP_FLAG_THRESHOLD]判定为停车,不认为是拥堵,这组数据无效 - */ - private var stopFlag = 0 - - private var currentSpeed: Int = 0 - - private var startRecordDistanceTime = 0L - - /** - * 拥堵速度计算上报策略 - * 计算[SPEED_RECORD_TIME_INTERVAL]内的平均速度,并上报 - * - * 定义的此方法是每两秒钟调用一次, 两分钟为一段进行计算 |--两分钟--|--两分钟--|--两分钟--| - * - * 里面有一个小策略,使用了一个停车标志位,如果速度为0,停车标志位加一,一个两分钟时间段内, - * 停车标志为累加超过[STOP_FLAG_THRESHOLD]判定为停车,不是拥堵,舍弃掉整个两分钟数据,不进行上报, - * 否则上报服务端,返回是否抓取视频 - * - * * 距离策略上报 - * - * 1. 过去3分钟,行驶距离<1km,大于30m - * 2. 前车距离<5m,获取不到前车距离时,默认此项满足 - * 3. 当前车速<40km/h - * - * 满足上述条件,自动上报拥堵 - * - * @param speed 当前速度,单位需要是Km/h - */ - fun recordSpeed(speed: Float, lat: Double, lon: Double) { - currentSpeed = speed.toInt() - val current = SystemClock.uptimeMillis() - if (startRecordTime == 0L) { - // 数据初始化 - startRecordTime = current - stopFlag = 0 - speedCacheList.clear() - } - - speedCacheList.add(currentSpeed) - - if (currentSpeed == 0) { - stopFlag++ - } else if (stopFlag < STOP_FLAG_THRESHOLD) { - // 如果本次计算期间,stopFlag还没超过阈值,就置为零,如果超过阈值了,说明本次计算期间存在超过阈值的停止次数,就舍弃掉本次计算 - stopFlag = 0 - } - - if (lastLat == 0.0) { - // 定位初始化,只判断一个就行了 - lastLon = lon - lastLat = lat - } else { - // 记录行进距离 - tripDistance += com.mogo.module.service.Utils.calculateLineDistance(lastLon, lastLat, lon, lat).toInt() - lastLon = lon - lastLat = lat - } - val diff = current - startRecordTime - if (diff in DISTANCE_RECORD_TIME until TIME_FAULT_TOLERANT) { - // 重置count data - val countDate = SharedPrefsMgr.getInstance(context).getLong(START_BLOCK_COUNT_DATE, 0) - if (countDate == 0L || isDifferentDay(countDate, System.currentTimeMillis())) { - // 不是同一天,重置各种计数,重新开始计数 - SharedPrefsMgr.getInstance(context).putLong(START_BLOCK_COUNT_DATE, System.currentTimeMillis()) - SharedPrefsMgr.getInstance(context).putInt(DISTANCE_MORNING_PEAK_COUNT, 0) - SharedPrefsMgr.getInstance(context).putInt(DISTANCE_NIGHT_PEAK_COUNT, 0) - SharedPrefsMgr.getInstance(context).putInt(DISTANCE_NORMAL_COUNT, 0) - SharedPrefsMgr.getInstance(context).putInt(SPEED_NORMAL_COUNT, 0) - SharedPrefsMgr.getInstance(context).putInt(SPEED_NIGHT_PEAK_COUNT, 0) - SharedPrefsMgr.getInstance(context).putInt(SPEED_MORNING_PEAK_COUNT, 0) - } - - var blockFromSpeed = false - var blockFromDistance = false - - var latLonFromSpeed: com.mogo.eagle.core.data.map.MogoLatLng? = null - var latLonFromDistance: com.mogo.eagle.core.data.map.MogoLatLng? = null - - val p = TanluUploadParams(IMogoTanluProvider.TYPE_BLOCK, IMogoTanluProvider.UPLOAD_FROM_STRATEGY_BLOCK_AUTO) - // 到达时间限制,上报速度,数据清空 - if (stopFlag < STOP_FLAG_THRESHOLD) { - // 停车标志位小于阈值,判定不是停车,计算平均值,进行上报 - var sum = 0 - speedCacheList.forEach { - sum += it - } - val ave = sum / speedCacheList.size - Logger.d(TAG, "平均速度为: $ave") - blockFromSpeed = ave in 1..10 - // 上报平均速度 - val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation - latLonFromSpeed = com.mogo.eagle.core.data.map.MogoLatLng( - location.latitude, - location.longitude - ) - } else { - Logger.d(TAG, "判定为停车,不进行上报") - } - - // 超过阈值,准备判断是否拥堵 - if (tripDistance in 100..1000 && isClose() && currentSpeed < 40) { - Logger.d(TAG, "根据距离,判定为拥堵,准备上报, tripDistance: $tripDistance, frontDistance: $frontDistance, currentSpeed: $currentSpeed") - latLonFromDistance = - com.mogo.eagle.core.data.map.MogoLatLng(lat, lon) - blockFromDistance = true - } else { - Logger.d(TAG, "根据距离,没有判定为拥堵, tripDistance: $tripDistance, frontDistance: $frontDistance, currentSpeed: $currentSpeed") - } - tripDistance = 0 - lastLat = 0.0 - lastLon = 0.0 - startRecordTime = 0 - - if (blockFromDistance || blockFromSpeed) { - Logger.d(TAG, "判定拥堵,准备上报 blockFromDistance: $blockFromDistance, blockFromSpeed: $blockFromSpeed") - if (isMorningPeak()) { - val distanceMorningCount = SharedPrefsMgr.getInstance(context).getInt(DISTANCE_MORNING_PEAK_COUNT, 0) - val speedMorningCount = SharedPrefsMgr.getInstance(context).getInt(SPEED_MORNING_PEAK_COUNT, 0) - if (blockFromDistance && distanceMorningCount < MORNING_PEAK_UPLOAD_COUNT) { - Logger.d(TAG, "按距离策略上报早高峰") - SharedPrefsMgr.getInstance(context).putInt(DISTANCE_MORNING_PEAK_COUNT, distanceMorningCount + 1) - p.location = latLonFromDistance - apis.analyticsApi.track("v2x_share_autoUpload", mapOf("type" to 1)) - apis.tanluApi.uploadRoadCondition(p) - return - } - if (blockFromSpeed && speedMorningCount < MORNING_PEAK_UPLOAD_COUNT) { - Logger.d(TAG, "按速度策略上报早高峰") - SharedPrefsMgr.getInstance(context).putInt(SPEED_MORNING_PEAK_COUNT, speedMorningCount + 1) - p.location = latLonFromSpeed - apis.tanluApi.uploadRoadCondition(p) - return - } - } else if (isNightPeak()) { - val distanceNightCount = SharedPrefsMgr.getInstance(context).getInt(DISTANCE_NIGHT_PEAK_COUNT, 0) - val speedNightCount = SharedPrefsMgr.getInstance(context).getInt(SPEED_NIGHT_PEAK_COUNT, 0) - if (blockFromDistance && distanceNightCount < NIGHT_PEAK_UPLOAD_COUNT) { - Logger.d(TAG, "按距离策略上报晚高峰") - SharedPrefsMgr.getInstance(context).putInt(DISTANCE_NIGHT_PEAK_COUNT, distanceNightCount + 1) - p.location = latLonFromDistance - apis.analyticsApi.track("v2x_share_autoUpload", mapOf("type" to 1)) - apis.tanluApi.uploadRoadCondition(p) - return - } - if (blockFromSpeed && speedNightCount < NIGHT_PEAK_UPLOAD_COUNT) { - Logger.d(TAG, "按速度策略上报晚高峰") - SharedPrefsMgr.getInstance(context).putInt(SPEED_NIGHT_PEAK_COUNT, speedNightCount + 1) - p.location = latLonFromSpeed - apis.tanluApi.uploadRoadCondition(p) - return - } - } else { - val distanceNormalCount = SharedPrefsMgr.getInstance(context).getInt(DISTANCE_NORMAL_COUNT, 0) - val speedNormalCount = SharedPrefsMgr.getInstance(context).getInt(SPEED_NORMAL_COUNT, 0) - if (blockFromDistance && distanceNormalCount < NORMAL_UPLOAD_COUNT) { - Logger.d(TAG, "按距离策略上报一般时段") - SharedPrefsMgr.getInstance(context).putInt(DISTANCE_NORMAL_COUNT, distanceNormalCount + 1) - p.location = latLonFromDistance - apis.analyticsApi.track("v2x_share_autoUpload", mapOf("type" to 1)) - apis.tanluApi.uploadRoadCondition(p) - return - } - if (blockFromSpeed && speedNormalCount < NORMAL_UPLOAD_COUNT) { - Logger.d(TAG, "按速度策略上报一般时段") - SharedPrefsMgr.getInstance(context).putInt(SPEED_NORMAL_COUNT, speedNormalCount + 1) - p.location = latLonFromSpeed - apis.tanluApi.uploadRoadCondition(p) - return - } - } - } - } - } - - private var lastLat: Double = 0.0 - private var lastLon: Double = 0.0 - - /** - * 用于记录行进的距离 - */ - private var tripDistance: Int = 0 - - /** - * 没有有效前车距离或者前车距离小于5m - */ - private fun isClose(): Boolean { - val r = (frontDistance in 1..4) || (frontDistance == -1) - Logger.d(TAG, "r: $r") - return r - } - -// private fun uploadAverageSpeed(average: Float) { -// val params = ArrayMap() -// params["speed"] = average.toInt() -// val body = RequestBody.create(MediaType.parse("Content-type:application/json;charset=UTF-8"), GsonUtil.jsonFromObject(params)) -// apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, MoGoAiCloudClientConfig.getInstance().getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl(RequestOptions.create(context)) { -// override fun onSuccess(response: AverateSpeedResponse?) { -// super.onSuccess(response) -// response?.let { -// Logger.d(TAG, "收到服务端返回结果: $it") -// // 收到服务端回调,视情况进行视频上报 -// if (it.result.upload) { -// val p = TanluUploadParams(it.result.poiType, IMogoTanluProvider.UPLOAD_FROM_STRATEGY_BLOCK_AUTO) -// val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation -// val latLon = MogoLatLng(location.latitude, location.longitude) -// p.location = latLon -// apis.tanluApi.uploadRoadCondition(p) -// } -// } -// } -// -// }) -// } - - companion object { - const val MSG_FRONT_DISTANCE_CHECK = 1001 - const val FRONT_DISTANCE_CHECK_DELAY = 30_000L - } - - private val handler = Handler(Handler.Callback { - if (it.what == MSG_FRONT_DISTANCE_CHECK) { - frontDistance = -1 - true - } else { - false - } - }) - - @Volatile - private var frontDistance: Int = -1 - fun refreshFrontDistance(distance: Int) { - handler.removeMessages(MSG_FRONT_DISTANCE_CHECK) - frontDistance = distance - handler.sendEmptyMessageDelayed(MSG_FRONT_DISTANCE_CHECK, FRONT_DISTANCE_CHECK_DELAY) - } - - /** - * 是否是早高峰 - */ - private fun isMorningPeak(): Boolean { - val hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) - val minute = Calendar.getInstance().get(Calendar.MINUTE) + hour * 60 - return minute in MORNING_PEAK_START_MINUTE..MORNING_PEAK_STOP_MINUTE - } - - /** - * 是否在晚高峰 - */ - private fun isNightPeak(): Boolean { - val hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) - val minute = Calendar.getInstance().get(Calendar.MINUTE) + hour * 60 - return minute in NIGHT_PEAK_START_MINUTE..NIGHT_PEAK_STOP_MINUTE - } - - private fun isDifferentDay(a: Long, b: Long): Boolean { - val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA) - val aDate = dateFormat.format(a) - val bDate = dateFormat.format(b) - return aDate != bDate - } -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/AnalyticsUtil.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/AnalyticsUtil.kt deleted file mode 100644 index d107fbb4aa..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/AnalyticsUtil.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.mogo.module.share.utils - -import android.content.Context -import com.elegant.analytics.Analytics -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.commons.AbsMogoApplication -import com.mogo.commons.network.Utils.getFotaVersion -import java.util.HashMap - -const val CarNet_Alive:String = "CarNet_Alive"//探路日活DAU埋点 -const val CarNet_Scheme_Channel:String = "CarNet_Scheme_Channel"//探路Scheme渠道区分 -const val APPENTER_FRONT:String = "appenterfront"//探路Scheme渠道区分 - -const val CarNet_auto_upload:String = "CarNet_auto_upload"//情报自动上传时间(自动上报图片) -const val CarNet_click:String ="CarNet_click"//用户点击查看大图 -const val CarNet_right_handle:String ="CarNet_right_handle"//用户切换情报-地图切换 -const val CarNet_event_number:String ="CarNet_event_number" //用户获取的信息数量 -const val CarNet_user_upload:String ="CarNet_user_upload" //用户主动上报视频type=1 手动点击 type=2 语音 -const val CarNet_auto_upload_video:String ="CarNet_auto_upload_video"//自动上报视频 -const val CarNet_click_search:String = "CarNet_click_search" //点击地图搜索 -const val CarNet_user_get:String = "CarNet_user_get"//用户查看情报(首页视频/图片,开始播放即算做用户查看)type=1 视频 type=2 图片 -const val CarNet_road_search:String = "CarNet_road_search"//有导航路线时的沿途查询 - -const val CarNet_MainService:String = "CarNet_MainService" //开机 -const val CarNet_MainService_Start:String ="CarNet_MainService_Start" //服务开启 -const val CarNet_MainService_Destory:String ="CarNet_MainService_Destory" //服务销毁 -const val CarNet_Get_Strategy:String = "CarNet_Get_Strategy" //策略拉取成功 -const val CarNet_Create_Task:String = "CarNet_Create_Task" //创建定时任务 -const val CarNet_Get_Picture:String = "CarNet_Get_Picture" //获取图片,type=1 调用, type=2 成功, type=3 失败 -const val CarNet_Get_Video:String = "CarNet_Get_Video" //获取视频,type=1 调用,type=2 成功,type=3 失败 -const val CarNet_Cos_Upload:String = "CarNet_Cos_Upload" //上传COS, type=1 成功, type=2 失败, type=3 开始, type=4 成功返回视频和缩略图,type=5 成功但没有返回全视频和缩略图 -const val CarNet_Servers_Upload:String = "CarNet_Servers_Upload" //上传服务端, type=1 成功,type=2 失败, type=3 开始 -const val CarNet_Voice_Search:String = "CarNet_Voice_Search" //语音搜索路况,type=1 成功,type=2 失败 -const val CarNet_USER_SHOW:String = "CarNet_user_show" //情报展示时长,showtime 加载列表时长 -const val CarNet_USER_LOAD:String = "CarNet_user_load" //情报加载时长,type=1 视频,2图片 -const val CarNet_Geo:String = "CarNet_Geo_Location" //上传服务端, type=1开始 ,type=2 成功, type=3 失败 - - -const val CarNet_live_broadcast = "CarNet_live_broadcast" // 地图页面点击直播(在线可直播车机) -//自定义埋点 -fun trackNormalEvent(event: String, _data: MutableMap?, context: Context = AbsMogoApplication.getApp().applicationContext) { - var data = _data - if (data == null) { - data = HashMap() - } - val localParams = HashMap() - //公共参数 time sn - localParams["time"] = System.currentTimeMillis() - localParams["systemversion"] = getFotaVersion() - localParams["sn"] = MoGoAiCloudClientConfig.getInstance().getSn() - - Analytics.getInstance().track(event, data) -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/FileUtil.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/FileUtil.kt deleted file mode 100644 index 45bc568d9d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/FileUtil.kt +++ /dev/null @@ -1,143 +0,0 @@ -package com.mogo.module.share.utils - -import android.graphics.Bitmap -import android.media.MediaMetadataRetriever -import android.os.Environment -import okhttp3.MediaType -import okhttp3.MultipartBody -import okhttp3.RequestBody -import java.io.* -import java.text.SimpleDateFormat -import java.util.* - - -//创建文件上传请求体 -fun fileToMultiPart(fileUrl: String): MultipartBody.Part? { - val file = File(fileUrl) - if (file.exists()) { - val requestBody = RequestBody.create(MediaType.parse("image/jpg"), file) - return MultipartBody.Part.createFormData("file", file.name, requestBody) - } - return null -} - -fun deletePicFile(filePath: String?): Boolean { - val file = File(filePath) - if (file.exists()) { - //如果图片地址包含此路径则是C上面的拍照,需要再删除后摄图片 - if (filePath!!.contains("usbotg-1-1.1")) { - //将地址替换成后摄图片地址 - val backFile = - File(filePath.replace("frontPic", "backPic").replace("PhotoFront", "PhotoBack")) - if (backFile.exists()) { - return backFile.delete() - } - return file.delete() - } else - return file.delete() - } - return false -} - -//删除某个目录下所有文件 -fun deleteAllFile(file: File?) { //判断文件不为null或文件目录存在 - if (file == null || !file.exists()) { - return - } - //取得这个目录下的所有子文件对象 - val files: Array = file.listFiles() - //遍历该目录下的文件对象 - for (f in files) { - //判断子目录是否存在子目录,如果是文件则删除 - if (f.isDirectory) { - deleteAllFile(f) - } else { - f.delete() - } - } - //删除空文件夹 for循环已经把上一层节点的目录清空。 -// file.delete() -} - - -//根据本地视频文件生成缩略图文件 -fun getVideoThumbnail(filePath: String, picPath: String): Boolean { - var b: Bitmap? = null - val retriever = MediaMetadataRetriever() - try { - retriever.setDataSource(filePath) - b = retriever.getFrameAtTime(0) - } catch (e: IllegalArgumentException) { - e.printStackTrace() - } catch (e: RuntimeException) { - e.printStackTrace() - } finally { - try { - retriever.release() - } catch (e: RuntimeException) { - e.printStackTrace() - } - } - return bitmapToFile(b, picPath) -} - -//bitmap转为file -fun bitmapToFile(bitmap: Bitmap?, filePath: String): Boolean { - val baos = ByteArrayOutputStream() - bitmap?.compress(Bitmap.CompressFormat.JPEG, 50, baos) - val file = File(filePath) - try { - if (file.exists()) - file.delete() - file.createNewFile() - val fos = FileOutputStream(file) - val ins = ByteArrayInputStream(baos.toByteArray()) - var x = 0 - val b = ByteArray(1024 * 100) - while ({ x = ins.read(b);x }() != -1) { - fos.write(b, 0, x) - } - fos.close() - bitmap?.recycle() - } catch (e: Exception) { - e.printStackTrace() - return false - } - - return true -} - -fun deleteCompressVideoFile(path: String?) { - val file = File(path) - val files = file.listFiles() - for (f in files) { - // /storage/emulated/0/Movies/compress_video_20210202121826.mp4 - if (f.toString().contains("compress_video")) { - f.delete() - } - } -} - - -//获取压缩后的视频路径 -fun getCompressVideoPath(): String { - val moviesDir = Environment.getExternalStoragePublicDirectory( - Environment.DIRECTORY_MOVIES - ) - moviesDir.mkdirs() - - val builder = StringBuilder() - builder.append("compress_video_") - .append(SimpleDateFormat("yyyyMMddHHmmss").format(Date())) - val filePrefix = builder.toString() - val fileExtn = ".mp4" - var destPath = File(moviesDir, filePrefix + fileExtn) - - var fileNo = 0 - while (destPath.exists()) { - fileNo++ - destPath = File(moviesDir, filePrefix + fileNo + fileExtn) - } - - return destPath.absolutePath -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/LocationUtil.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/LocationUtil.kt deleted file mode 100644 index 1fbbeb8f24..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/LocationUtil.kt +++ /dev/null @@ -1,160 +0,0 @@ -package com.mogo.module.share.utils - -import android.util.Log -import com.mogo.commons.AbsMogoApplication -import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.map.search.geo.IMogoGeoSearchListener -import com.mogo.map.search.geo.MogoRegeocodeAddress -import com.mogo.map.search.geo.MogoRegeocodeResult -import com.mogo.map.search.geo.query.MogoRegeocodeQuery -import com.mogo.module.common.MogoApisHandler -import com.mogo.module.share.bean.LocationInfo - - -private fun toLocInfo( - address: MogoRegeocodeAddress, - latlngPoint: com.mogo.eagle.core.data.map.MogoLatLng -): LocationInfo { - return LocationInfo( - address.province, - address.city, - address.cityCode, - address.district, - address.adCode, - address.roads[0].name, - latlngPoint.lon, - latlngPoint.lat, - address.formatAddress, - System.currentTimeMillis() - ) -} - -private fun toLocInfo(location: MogoLocation): LocationInfo { - return LocationInfo( - location.province, - location.cityName, - location.cityCode, - location.district, - location.adCode, - location.street, - location.longitude, - location.latitude, - location.address, - location.time, - location.bearing - ) -} - -class LocationUtil private constructor() { - - companion object { - - private const val TAG = "LocationUtil" - private var instance: LocationUtil? = null - - @Synchronized - fun getInstance(): LocationUtil { - if (instance == null) { - instance = LocationUtil() - } - return instance!! - } - } - - interface OnMapLocationChangedListener { - fun onChanged(locationInfo: LocationInfo) - } - - private var listener: OnMapLocationChangedListener? = null - - private var init: Boolean = false - private var mContext = AbsMogoApplication.getApp().applicationContext - private var speedListener: SpeedListener? = null - private var locationInfo: LocationInfo? = null - private var speed: Float = 0.0f - - fun initLocation() { - //初始化client - init = true - MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).addLocationListener {location-> - if (null != location) { - locationInfo = LocationInfo() - locationInfo!!.longitude = location.longitude - locationInfo!!.latitude = location.latitude - locationInfo!!.address = location.address - locationInfo!!.time = location.time - locationInfo!!.provinceName = location.province - locationInfo!!.cityName = location.cityName - locationInfo!!.cityCode = location.cityCode - locationInfo!!.areaName = location.district - locationInfo!!.areaCode = location.adCode - locationInfo!!.street = location.street - locationInfo!!.direction = location.bearing - listener?.onChanged(locationInfo!!) - speed = location.speed - speedListener?.onSpeedGet(location.speed) - } else { - Log.d(TAG, "定位失败 -> location is null") - } - } - } - - fun getLocationInfo(): LocationInfo { - return if (null != locationInfo) { - locationInfo!! - } else { - val location = MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).lastKnowLocation - toLocInfo(location) - } - } - - //如果获取到的location address为空可以通过高德逆地理编码获得 - fun geoCodeLocation( - latlngPoint: com.mogo.eagle.core.data.map.MogoLatLng, - locGeoCode: (((locInfo: LocationInfo) -> Unit)), - onError: ((msg: String) -> Unit) - ) { - val geocoderSearch = MogoApisHandler.getInstance().apis.mapServiceApi.getGeoSearch(AbsMogoApplication.getApp().applicationContext) - val regeocodeQuery = MogoRegeocodeQuery() - regeocodeQuery.latlngType = "" - regeocodeQuery.point = latlngPoint - regeocodeQuery.radius = 200 - geocoderSearch.getFromLocationAsyn(regeocodeQuery) - geocoderSearch.setGeoSearchListener(object : IMogoGeoSearchListener { - override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) { -// super.onRegeocodeSearched(regeocodeResult) - if( regeocodeResult == null ){ - trackUploadGeo(3) - onError.invoke("geoCode") - } else { - trackUploadGeo(2) - val regeocodeAddress = regeocodeResult.regeocodeAddress - regeocodeAddress?.let { - val locInfo = toLocInfo(regeocodeAddress, latlngPoint) - locGeoCode.invoke(locInfo) - } - } - } - }) - } - - //上传 - private fun trackUploadGeo(type: Int) { - trackNormalEvent( - CarNet_Geo, mutableMapOf("type" to type) - ) - } - - fun getSpeed():Float{ - return speed - } - - fun setonSpeedlistenner(speedListener: SpeedListener) { - this.speedListener = speedListener - } - - interface SpeedListener { - fun onSpeedGet(speed: Float) - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/SharedPreferenceUtil.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/SharedPreferenceUtil.kt deleted file mode 100644 index dd555263d8..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/SharedPreferenceUtil.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.mogo.module.share.utils - -import android.content.Context -import androidx.core.content.edit -import com.mogo.commons.AbsMogoApplication - -const val FILE_NAME = "settings_data" - -const val PIC_NUMBER = "PIC_NUMBER" //图片拍摄张数 -const val VIDEO_DURATION_DEFAULT = 10_000L //视频拍摄时长 -const val PIC_NUMBER_DEFAULT = 1L //图片拍摄张数 - -fun putLong(key: String, value: Long) { - val sharedPreferences = - AbsMogoApplication.getApp().applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putLong(key, value).apply() - } -} - -fun getLong(key: String, defaultValue: Long): Long { - return AbsMogoApplication.getApp().applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) - .getLong(key, defaultValue) -} - -fun putInt(key: String, value: Int) { - val sharedPreferences = - AbsMogoApplication.getApp().applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putInt(key, value).apply() - } -} - -fun getInt(key: String, defaultValue: Int): Int { - return AbsMogoApplication.getApp().applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) - .getInt(key, defaultValue) -} - -fun putCommonString(key: String, value: String) { - val sharedPreferences = - AbsMogoApplication.getApp().applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putString(key, value).apply() - } -} - -fun getCommonBoolean(key: String, defaultValue: Boolean): Boolean { - return AbsMogoApplication.getApp().applicationContext.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) - .getBoolean(key, defaultValue) -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/StrategyPreferenceUtil.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/StrategyPreferenceUtil.kt deleted file mode 100644 index 2ee683b24e..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/StrategyPreferenceUtil.kt +++ /dev/null @@ -1,199 +0,0 @@ -package com.mogo.module.share.utils - -import android.content.Context -import android.util.Log -import androidx.core.content.edit -import com.mogo.commons.AbsMogoApplication - -const val STRATEGY_FILE_NAME = "strategy_data" - -const val STRATEGY_TYPE_COPY = "strategy_data_copy" - -/** - * 策略SP存储模式:STRATEGY_TYPE + 策略类型 + 情报类型 + 对应项 - */ -const val STRATEGY_TYPE = "STRATEGY_" - -const val FREQUENCY = "FREQUENCY" -const val DEFAULT_FREQUENCY_PIC = 2 //默认上报类型:周期性上报 -const val DEFAULT_FREQUENCY_VIDEO = 1 //默认上报类型:单次上报 - -const val INTERVAL = "INTERVAL" -const val DEFAULT_INTERVAL_PIC = 600_000L //默认图片定时任务默认间隔 -const val DEFAULT_INTERVAL_VIDEO = 900_000L //默认视频定时任务默认间隔 - -const val VALIDITY = "VALIDITY" -const val DEFAULT_VALIDITY = 4 * 60 //默认情报有效期:4小时 - -const val MAX_SPEED = "MAX_SPEED" -const val MIN_SPEED = "MIN_SPEED" -const val DEFAULT_MAX_SPEED = -1 -const val DEFAULT_MIN_SPEED = -1 - - -class StrategyPreferenceUtil { - companion object { - //保存策略类型,在AccOff的时候清除数据,更新时需要在没有情报上传时操作 - fun setStrategyType(context: Context, strategyType: Int, type: String) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_TYPE_COPY, Context.MODE_PRIVATE) - sharedPreferences.edit { - putInt(STRATEGY_TYPE + type, strategyType).commit() - } - } - - fun getStrategyType( - type: String, - context: Context = AbsMogoApplication.getApp().applicationContext - ): Int { - return context.getSharedPreferences(STRATEGY_TYPE_COPY, Context.MODE_PRIVATE) - .getInt(STRATEGY_TYPE + type, 1) - } - - fun clearStrategyType(context: Context) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_TYPE_COPY, Context.MODE_PRIVATE) - sharedPreferences.edit { - clear() - val clearStrategyType = commit() - Log.d(STRATEGY_TYPE_COPY, "clearStrategyType = $clearStrategyType") - } - } - - fun setStrategyFrequency( - context: Context, - strategyType: Int, - infoType: String, - frequency: Int - ) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putInt( - STRATEGY_TYPE + strategyType + "_" + infoType + FREQUENCY, - frequency - ).commit() - } - } - - fun getStrategyFrequency(context: Context, infoType: String, strategyType: Int = 1): Int { - return context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - .getInt( - STRATEGY_TYPE + strategyType + "_" + infoType + FREQUENCY, - convertFrequencyOfInfoType(infoType) - ) - } - - private fun convertFrequencyOfInfoType(infoType: String): Int { - return when (infoType) { - "pic" -> DEFAULT_FREQUENCY_PIC - "video" -> DEFAULT_FREQUENCY_VIDEO - else -> DEFAULT_FREQUENCY_PIC - } - } - - fun setStrategyInterval( - context: Context, - strategyType: Int, - infoType: String, - interval: Long - ) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putLong( - STRATEGY_TYPE + strategyType + "_" + infoType + INTERVAL, - interval - ).commit() - } - } - - fun getStrategyInterval(context: Context, infoType: String, strategyType: Int = 1): Long { - return context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - .getLong( - STRATEGY_TYPE + strategyType + "_" + infoType + INTERVAL, - convertIntervalOfInfoType(infoType) - ) - } - - private fun convertIntervalOfInfoType(infoType: String): Long { - return when (infoType) { - "pic" -> DEFAULT_INTERVAL_PIC - "video" -> DEFAULT_INTERVAL_VIDEO - else -> DEFAULT_INTERVAL_PIC - } - } - - fun setStrategyValidity( - context: Context, - strategyType: Int, - infoType: String, - validity: Int - ) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putInt( - STRATEGY_TYPE + strategyType + "_" + infoType + VALIDITY, - validity - ).commit() - } - } - - fun getStrategyValidity(context: Context, infoType: String, strategyType: Int = 1): Int { - return context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - .getInt( - STRATEGY_TYPE + strategyType + "_" + infoType + VALIDITY, - DEFAULT_VALIDITY - ) - } - - fun setStrategyMaxSpeed( - context: Context, - strategyType: Int, - infoType: String, - maxSpeed: Int - ) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putInt( - STRATEGY_TYPE + strategyType + "_" + infoType + MAX_SPEED, - maxSpeed - ).commit() - } - } - - fun getStrategyMaxSpeed(context: Context, infoType: String, strategyType: Int = 1): Int { - return context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - .getInt( - STRATEGY_TYPE + strategyType + "_" + infoType + MAX_SPEED, - DEFAULT_MAX_SPEED - ) - } - - fun setStrategyMinSpeed( - context: Context, - strategyType: Int, - infoType: String, - minSpeed: Int - ) { - val sharedPreferences = - context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - sharedPreferences.edit { - putInt( - STRATEGY_TYPE + strategyType + "_" + infoType + MIN_SPEED, - minSpeed - ).commit() - } - } - - fun getStrategyMinSpeed(context: Context, infoType: String, strategyType: Int = 1): Int { - return context.getSharedPreferences(STRATEGY_FILE_NAME, Context.MODE_PRIVATE) - .getInt( - STRATEGY_TYPE + strategyType + "_" + infoType + MIN_SPEED, - DEFAULT_MIN_SPEED - ) - } - } - } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/TaskCoroutines.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/TaskCoroutines.kt deleted file mode 100644 index 91e42934c3..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/TaskCoroutines.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.module.share.utils - -import bolts.Task.delay -import kotlinx.coroutines.* - -@ObsoleteCoroutinesApi -@PublishedApi -internal var ThreadPool = - newFixedThreadPoolContext(Runtime.getRuntime().availableProcessors() * 2, "ThreadPool") - - -/** - * 并发执行,常用于最外层 - * 特点带返回值 - */ -@ObsoleteCoroutinesApi -fun taskAsync(delayTime: Long = 0, job: suspend () -> T) = GlobalScope.async(ThreadPool) { - delay(delayTime) - job() -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/Utils.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/Utils.java deleted file mode 100644 index 234266e26d..0000000000 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/utils/Utils.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mogo.module.share.utils; - -import com.google.gson.Gson; -import com.mogo.module.share.bean.VoiceCmdData; - -import java.text.DecimalFormat; - -/** - * @author lixiaopeng - * @description - * @since 2020-01-08 - */ -public class Utils { - - //处理距离,大于1000时,四舍五入保留一位小数 - public static String handleDistance(double distance) { - if (distance < 1000) { - return distance + "M"; - } else { - DecimalFormat df = new DecimalFormat("0.0"); - double transformDistance = distance / 1000; - return (df.format(transformDistance)) + "KM"; - } - } - - //保留整数,四舍五入 - public static int getIntervalValue(int listSize){ -// var floatSize = listSize.toFloat(); - int transformSize = listSize / 15; - DecimalFormat df = new DecimalFormat("0"); - return Integer.parseInt((df.format(transformSize))); - } - - /** - * 解析json串为 VoiceCmdData 对象 - * - * @param dataJsonStr - * @return - */ - public static VoiceCmdData parseTOVoiceCmdData(String dataJsonStr) { - Gson gson = new Gson(); - return gson.fromJson(dataJsonStr, VoiceCmdData.class); - } - -} \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/anim/module_share_dialog_enter_anim.xml b/modules/mogo-module-share/src/main/res/anim/module_share_dialog_enter_anim.xml deleted file mode 100644 index a49af94353..0000000000 --- a/modules/mogo-module-share/src/main/res/anim/module_share_dialog_enter_anim.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/anim/module_share_dialog_exit_anim.xml b/modules/mogo-module-share/src/main/res/anim/module_share_dialog_exit_anim.xml deleted file mode 100644 index e0914a5b11..0000000000 --- a/modules/mogo-module-share/src/main/res/anim/module_share_dialog_exit_anim.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_title_icon_left.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_title_icon_left.png deleted file mode 100644 index 058a752bf6..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_title_icon_left.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_title_icon_right.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_title_icon_right.png deleted file mode 100644 index bbcedd2484..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_title_icon_right.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_upload_fail.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_upload_fail.png deleted file mode 100644 index f11f2cb3cd..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_upload_fail.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_upload_success.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_upload_success.png deleted file mode 100644 index 19829a2454..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_share_upload_success.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_tanlu_upload_fail.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/module_tanlu_upload_fail.png deleted file mode 100644 index f11f2cb3cd..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_tanlu_upload_fail.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_tanlu_upload_success.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/module_tanlu_upload_success.png deleted file mode 100644 index 19829a2454..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/module_tanlu_upload_success.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_accident.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_accident.png deleted file mode 100644 index 25a48d3421..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_accident.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_block_up.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_block_up.png deleted file mode 100644 index 84938b8857..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_block_up.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_dense_fog.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_dense_fog.png deleted file mode 100644 index 191880b2b9..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_dense_fog.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_real_time_traffic.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_real_time_traffic.png deleted file mode 100644 index 87f712f8c7..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_real_time_traffic.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_closure.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_closure.png deleted file mode 100644 index 57e9e67c75..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_closure.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_construction.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_construction.png deleted file mode 100644 index f41703de30..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_construction.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_icy.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_icy.png deleted file mode 100644 index 3ff45f0ed0..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_road_icy.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_seek_help.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_seek_help.png deleted file mode 100644 index 4f6774eae8..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_seek_help.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_stagnant_water.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_stagnant_water.png deleted file mode 100644 index 32224d0816..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_stagnant_water.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_traffic_check.png b/modules/mogo-module-share/src/main/res/drawable-ldpi/share_traffic_check.png deleted file mode 100644 index e27aa13c0a..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-ldpi/share_traffic_check.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_title_icon_left.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_title_icon_left.png deleted file mode 100644 index 058a752bf6..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_title_icon_left.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_title_icon_right.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_title_icon_right.png deleted file mode 100644 index bbcedd2484..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_title_icon_right.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_upload_fail.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_upload_fail.png deleted file mode 100644 index f11f2cb3cd..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_upload_fail.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_upload_success.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_upload_success.png deleted file mode 100644 index 19829a2454..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_share_upload_success.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_tanlu_upload_fail.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/module_tanlu_upload_fail.png deleted file mode 100644 index f11f2cb3cd..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_tanlu_upload_fail.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_tanlu_upload_success.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/module_tanlu_upload_success.png deleted file mode 100644 index 19829a2454..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/module_tanlu_upload_success.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_accident.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_accident.png deleted file mode 100644 index 25a48d3421..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_accident.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_block_up.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_block_up.png deleted file mode 100644 index 84938b8857..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_block_up.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_dense_fog.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_dense_fog.png deleted file mode 100644 index 191880b2b9..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_dense_fog.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_real_time_traffic.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_real_time_traffic.png deleted file mode 100644 index 87f712f8c7..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_real_time_traffic.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_closure.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_closure.png deleted file mode 100644 index 57e9e67c75..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_closure.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_construction.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_construction.png deleted file mode 100644 index f41703de30..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_construction.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_icy.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_icy.png deleted file mode 100644 index 3ff45f0ed0..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_road_icy.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_seek_help.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_seek_help.png deleted file mode 100644 index 4f6774eae8..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_seek_help.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_stagnant_water.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_stagnant_water.png deleted file mode 100644 index 32224d0816..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_stagnant_water.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_traffic_check.png b/modules/mogo-module-share/src/main/res/drawable-mdpi/share_traffic_check.png deleted file mode 100644 index e27aa13c0a..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-mdpi/share_traffic_check.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/module_share_title_icon_left.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/module_share_title_icon_left.png deleted file mode 100644 index aba37467b6..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/module_share_title_icon_left.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/module_share_title_icon_right.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/module_share_title_icon_right.png deleted file mode 100644 index 719c121eea..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/module_share_title_icon_right.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_accident.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_accident.png deleted file mode 100644 index 2af41503f9..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_accident.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_block_up.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_block_up.png deleted file mode 100644 index c9eb6b0a18..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_block_up.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_dense_fog.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_dense_fog.png deleted file mode 100644 index 1336432e1d..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_dense_fog.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_real_time_traffic.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_real_time_traffic.png deleted file mode 100644 index 9504c2bc87..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_real_time_traffic.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_closure.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_closure.png deleted file mode 100644 index bcd17dfa93..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_closure.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_construction.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_construction.png deleted file mode 100644 index 0122719438..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_construction.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_icy.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_icy.png deleted file mode 100644 index 6d249db767..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_road_icy.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_seek_help.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_seek_help.png deleted file mode 100644 index e1d78a093d..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_seek_help.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_stagnant_water.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_stagnant_water.png deleted file mode 100644 index 27acbbe17b..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_stagnant_water.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_traffic_check.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_traffic_check.png deleted file mode 100644 index 4daa5cb903..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi-1920x1000/share_traffic_check.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_title_icon_left.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_title_icon_left.png deleted file mode 100644 index 2285d62060..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_title_icon_left.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_title_icon_right.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_title_icon_right.png deleted file mode 100644 index 00521de23c..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_title_icon_right.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_upload_fail.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_upload_fail.png deleted file mode 100644 index 4511f314bb..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_upload_fail.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_upload_success.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_upload_success.png deleted file mode 100644 index 1ad96fc40f..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_share_upload_success.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_tanlu_upload_fail.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_tanlu_upload_fail.png deleted file mode 100644 index 4511f314bb..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_tanlu_upload_fail.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_tanlu_upload_success.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_tanlu_upload_success.png deleted file mode 100644 index 1ad96fc40f..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/module_tanlu_upload_success.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_accident.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_accident.png deleted file mode 100644 index 5a3fbe67df..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_accident.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_block_up.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_block_up.png deleted file mode 100644 index e13c42513d..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_block_up.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_dense_fog.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_dense_fog.png deleted file mode 100644 index 85ab743696..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_dense_fog.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_oil_price.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_oil_price.png deleted file mode 100644 index 2d3321bbdc..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_oil_price.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_real_time_traffic.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_real_time_traffic.png deleted file mode 100644 index 049d213148..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_real_time_traffic.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_closure.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_closure.png deleted file mode 100644 index 1e25f9439b..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_closure.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_construction.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_construction.png deleted file mode 100644 index 56f1d320ab..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_construction.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_icy.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_icy.png deleted file mode 100644 index b360bb4960..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_road_icy.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_seek_help.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_seek_help.png deleted file mode 100644 index 79ee716a3f..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_seek_help.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_stagnant_water.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_stagnant_water.png deleted file mode 100644 index 60bcfd519d..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_stagnant_water.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_traffic_check.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_traffic_check.png deleted file mode 100644 index 776f73a59c..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/share_traffic_check.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable-xhdpi/tanlu_circle_image.png b/modules/mogo-module-share/src/main/res/drawable-xhdpi/tanlu_circle_image.png deleted file mode 100644 index 32847b095d..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable-xhdpi/tanlu_circle_image.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable/module_share_btn_bg.xml b/modules/mogo-module-share/src/main/res/drawable/module_share_btn_bg.xml deleted file mode 100644 index a332210f9b..0000000000 --- a/modules/mogo-module-share/src/main/res/drawable/module_share_btn_bg.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/drawable/module_share_dialog_bg.xml b/modules/mogo-module-share/src/main/res/drawable/module_share_dialog_bg.xml deleted file mode 100644 index 1b1f5226d5..0000000000 --- a/modules/mogo-module-share/src/main/res/drawable/module_share_dialog_bg.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/drawable/module_share_title_icon.png b/modules/mogo-module-share/src/main/res/drawable/module_share_title_icon.png deleted file mode 100644 index 62daa43114..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable/module_share_title_icon.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/drawable/share_oil_price.png b/modules/mogo-module-share/src/main/res/drawable/share_oil_price.png deleted file mode 100644 index 5ef357ce54..0000000000 Binary files a/modules/mogo-module-share/src/main/res/drawable/share_oil_price.png and /dev/null differ diff --git a/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml b/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml deleted file mode 100644 index 8ca5255de6..0000000000 --- a/modules/mogo-module-share/src/main/res/layout/dialog_share_with_gridlayout.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml b/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml deleted file mode 100644 index 05cbfa82f4..0000000000 --- a/modules/mogo-module-share/src/main/res/layout/item_share_btn.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml b/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml deleted file mode 100644 index dae881e4e8..0000000000 --- a/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share_2.xml b/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share_2.xml deleted file mode 100644 index 6f1557fc09..0000000000 --- a/modules/mogo-module-share/src/main/res/layout/launcher_dialog_share_2.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/values-mdpi/dimens.xml b/modules/mogo-module-share/src/main/res/values-mdpi/dimens.xml deleted file mode 100644 index 9e9341f116..0000000000 --- a/modules/mogo-module-share/src/main/res/values-mdpi/dimens.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - 400px - 150px - 80px - 32px - - - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/values-xhdpi-1920x1000/dimens.xml b/modules/mogo-module-share/src/main/res/values-xhdpi-1920x1000/dimens.xml deleted file mode 100644 index bbd605b6e3..0000000000 --- a/modules/mogo-module-share/src/main/res/values-xhdpi-1920x1000/dimens.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - 1318px - 727px - 64px - 51px - 200px - 210px - 30px - 160px - 198px - 55px - 70px - 56px - 27px - 105px - - - 36px - 32px - 28px - 28px - - 750px - 270px - 120px - 60px - - - - diff --git a/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml deleted file mode 100644 index de87d2e54a..0000000000 --- a/modules/mogo-module-share/src/main/res/values-xhdpi/dimens.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - 1464px - 808px - 64px - 56px - 200px - 210px - 30px - 160px - 198px - 55px - 78px - 62px - 30px - 116px - - 750px - 270px - 120px - 60px - - - 40px - 32px - 28px - 32px - - 114px - 83px - 6px - 123px - 110px - - 75px - 165px - 967px - - - - diff --git a/modules/mogo-module-share/src/main/res/values/colors.xml b/modules/mogo-module-share/src/main/res/values/colors.xml deleted file mode 100644 index cea1d8cca7..0000000000 --- a/modules/mogo-module-share/src/main/res/values/colors.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - #fff - #fff - #99FFFFFF - #00FFFFFF - diff --git a/modules/mogo-module-share/src/main/res/values/dimens.xml b/modules/mogo-module-share/src/main/res/values/dimens.xml deleted file mode 100644 index f2945f04a4..0000000000 --- a/modules/mogo-module-share/src/main/res/values/dimens.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 776px - 428px - 34px - 31px - 100px - 118px - 15px - 88px - 110px - 28px - 42.6px - 34px - 16.4px - 63.4px - - 400px - 150px - 80px - 32px - - - 22px - 18px - 15px - 17.5px - - 60px - 44px - 5px - 65px - 58px - - 40px - 89px - 514px - - \ No newline at end of file diff --git a/modules/mogo-module-share/src/main/res/values/strings.xml b/modules/mogo-module-share/src/main/res/values/strings.xml deleted file mode 100644 index 49e7460208..0000000000 --- a/modules/mogo-module-share/src/main/res/values/strings.xml +++ /dev/null @@ -1,22 +0,0 @@ - - share - 正在更新情报数据 - 欢迎使用探路,您可以在探路内查看到周边的实时路况,也可以通过关键词“上报路况”来分享一段视频给其他车主 - 您还可以试试语音上报 - 为您找到%s条路况信息 - 已分享成功,你分享的内容将帮助%s位车友 - 上传失败 - 取消(%s) - 好的(%s) - - - 正在为您搜索路况 - 系统正在为您搜索 - 小智这就去查 - - - 找不到相关地址,试试换个说法 - 找不到地址,换个地址试试 - - - diff --git a/modules/mogo-module-share/src/main/res/values/styles.xml b/modules/mogo-module-share/src/main/res/values/styles.xml deleted file mode 100644 index b07cecf669..0000000000 --- a/modules/mogo-module-share/src/main/res/values/styles.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - diff --git a/modules/mogo-module-v2x/.gitignore b/modules/mogo-module-v2x/.gitignore deleted file mode 100644 index 796b96d1c4..0000000000 --- a/modules/mogo-module-v2x/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/modules/mogo-module-v2x/README.md b/modules/mogo-module-v2x/README.md deleted file mode 100644 index aacceabed4..0000000000 --- a/modules/mogo-module-v2x/README.md +++ /dev/null @@ -1,25 +0,0 @@ -#### 项目介绍 -本项目是V2X模块,必须依附于Launcher进行集成使用,无法单独使用,且需要车机安装Autopilot(ADAS)一起使用。 - -#### 项目结构 -- adapter --- 展示视图适配 -- alarm --- 提醒计算 -- entity --- 数据实体 -- listener --- Socket监听 -- manager --- 管理工具,绘制marker,绘制连接线,记录状态 -- marker --- 地图marker视图适配 -- network --- 网络请求 -- scenario --- 场景,可以简单的理解为每一种弹窗是一种场景 - - scene - - animation --- 场景动画 H5 推送下来的 - - fatigue --- 疲劳驾驶 - - help --- 自车故障求助 - - livecar --- 直播场景,H5推送的和道路事件预警的 - - park --- 违章停车 - - push --- 推送的演示场景,取快递、政府公告、顺风车、行人点赞 - - road --- 道路事件预警 - - seek --- 他人故障求助预警 - - test --- 测试页面,一堆按钮,自己点击触发以上场景 -- utils --- 工具类 -- view --- 自定义视图 -- voice --- 语音注册 \ No newline at end of file diff --git a/modules/mogo-module-v2x/build.gradle b/modules/mogo-module-v2x/build.gradle deleted file mode 100644 index d45438a3d2..0000000000 --- a/modules/mogo-module-v2x/build.gradle +++ /dev/null @@ -1,106 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'kotlin-android-extensions' - id 'kotlin-kapt' - id 'com.alibaba.arouter' -} - -android { - compileSdkVersion rootProject.ext.android.compileSdkVersion - defaultConfig { - minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion - versionCode Integer.valueOf(VERSION_CODE) - versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'consumer-rules.pro' - - //ARouter apt 参数 - kapt { - useBuildCache = false - arguments { - arg("AROUTER_MODULE_NAME", project.getName()) - } - } - ndk { - abiFilters "armeabi-v7a" - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - -// implementation 'com.tencent.liteavsdk:LiteAVSDK_Smart:7.4.9211' - implementation rootProject.ext.dependencies.livesdk - implementation rootProject.ext.dependencies.flexbox - implementation rootProject.ext.dependencies.rxandroid - implementation rootProject.ext.dependencies.androidxrecyclerview - implementation rootProject.ext.dependencies.androidxappcompat - implementation rootProject.ext.dependencies.androidxconstraintlayout - implementation rootProject.ext.dependencies.arouter - - implementation rootProject.ext.dependencies.androidxccorektx - implementation rootProject.ext.dependencies.kotlinstdlibjdk7 - implementation rootProject.ext.dependencies.material - implementation rootProject.ext.dependencies.rxjava - implementation rootProject.ext.dependencies.androidxviewpager2 - implementation rootProject.ext.dependencies.localbroadcastmanager - - implementation rootProject.ext.dependencies.coroutinescore - implementation rootProject.ext.dependencies.coroutinesandroid - - implementation rootProject.ext.dependencies.videoarmv7 - implementation rootProject.ext.dependencies.videoarm64 - implementation rootProject.ext.dependencies.videojava - - kapt rootProject.ext.dependencies.androidxroomcompiler - kapt rootProject.ext.dependencies.aroutercompiler - api rootProject.ext.dependencies.mogoaicloudtrafficlive - - if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { - implementation rootProject.ext.dependencies.mogomap - implementation rootProject.ext.dependencies.mogoserviceapi - implementation rootProject.ext.dependencies.modulecommon - implementation rootProject.ext.dependencies.moduleservice - implementation rootProject.ext.dependencies.callchatprovider - - implementation rootProject.ext.dependencies.mogo_core_res - implementation rootProject.ext.dependencies.mogo_core_utils - implementation rootProject.ext.dependencies.mogo_core_data - implementation rootProject.ext.dependencies.mogo_core_function_call - } else { - implementation project(':libraries:mogo-map') - implementation project(':services:mogo-service-api') - implementation project(':modules:mogo-module-common') - implementation project(':modules:mogo-module-service') - implementation project(':modules:mogo-module-carchattingprovider') - - implementation project(':core:mogo-core-res') - implementation project(':core:mogo-core-utils') - implementation project(':core:mogo-core-data') - implementation project(':core:mogo-core-function-call') - } - - annotationProcessor rootProject.ext.dependencies.aroutercompiler - testImplementation rootProject.ext.dependencies.junit - androidTestImplementation rootProject.ext.dependencies.androidxjunit - androidTestImplementation rootProject.ext.dependencies.androidxespressocore -} - -apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/modules/mogo-module-v2x/consumer-rules.pro b/modules/mogo-module-v2x/consumer-rules.pro deleted file mode 100644 index 05db144996..0000000000 --- a/modules/mogo-module-v2x/consumer-rules.pro +++ /dev/null @@ -1,24 +0,0 @@ -#-----V2XModule----- --keep class com.tencent.** { *; } --keep class com.mogo.module.v2x.entity.net.* { *; } --keep class com.mogo.module.v2x.entity.panel.*{*;} --keep class com.mogo.module.v2x.manager.V2XStatusDescriptor{*;} --keep class com.mogo.module.v2x.marker.*{*;} --keep class com.mogo.module.v2x.utils.SpanUtils.Align --keep class com.mogo.module.v2x.utils.TimeConstants.Unit --keep class com.mogo.module.v2x.utils.SpanUtils.SerializableSpannableStringBuilder{*;} --keep class com.mogo.module.v2x.utils.V2XUtils{*;} --keep class com.mogo.module.v2x.view.*{*;} --keep class * extends com.mogo.module.v2x.scenario.scene.V2XBasWindow{*;} --keep interface * implements com.mogo.module.v2x.alarm.V2XAlarmServer.OnFatigueDrivingListener{*;} --keep interface * implements com.mogo.module.v2x.listener.CarStatusListener{*;} --keep interface * implements com.mogo.module.v2x.listener.V2XWindowStatusListener{*;} --keep interface * implements com.mogo.module.v2x.network.V2XApiService{*;} --keep interface * implements com.mogo.module.v2x.network.V2XRefreshCallback{*;} --keep interface * implements com.mogo.module.v2x.scenario.view.*{*;} --keep interface * implements com.mogo.module.v2x.scenario.impl.*{*;} --keep interface * implements com.mogo.module.v2x.scenario.IV2XScenario{*;} --keep interface * implements com.mogo.module.v2x.scenario.IV2XScenarioManager{*;} --keep class com.mogo.module.v2x.voice.*{*;} --keep class com.mogo.module.v2x.MoGoV2XServicePaths{*;} --keep class com.mogo.module.v2x.V2XConst{*;} diff --git a/modules/mogo-module-v2x/gradle.properties b/modules/mogo-module-v2x/gradle.properties deleted file mode 100644 index 2cb3dc2a8a..0000000000 --- a/modules/mogo-module-v2x/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=com.mogo.module -POM_ARTIFACT_ID=module-v2x -VERSION_CODE=1 diff --git a/modules/mogo-module-v2x/proguard-rules.pro b/modules/mogo-module-v2x/proguard-rules.pro deleted file mode 100644 index c7797fa760..0000000000 --- a/modules/mogo-module-v2x/proguard-rules.pro +++ /dev/null @@ -1,39 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile - -#-----V2XModule----- --keep class com.tencent.** { *; } --keep class com.mogo.module.v2x.entity.net.** { *; } --keep class com.mogo.module.v2x.manager.V2XStatusDescriptor --keep class com.mogo.module.v2x.utils.SpanUtils.Align --keep class com.mogo.module.v2x.utils.TimeConstants.Unit --keep interface * implements com.mogo.module.v2x.alarm.V2XAlarmServer.OnFatigueDrivingListener --keep interface * implements com.mogo.module.v2x.listener.CarStatusListener --keep interface * implements com.mogo.module.v2x.listener.V2XWindowStatusListener --keep interface * implements com.mogo.module.v2x.network.V2XApiService --keep interface * implements com.mogo.module.v2x.network.V2XRefreshCallback --keep interface * implements com.mogo.module.v2x.scenario.view.**{*;} --keep interface * implements com.mogo.module.v2x.scenario.impl.**{*;} --keep interface * implements com.mogo.module.v2x.scenario.IV2XScenario --keep interface * implements com.mogo.module.v2x.scenario.IV2XScenarioManager --keep class com.mogo.module.v2x.voice.**{*;} --keep class com.mogo.module.v2x.V2XConst \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/AndroidManifest.xml b/modules/mogo-module-v2x/src/main/AndroidManifest.xml deleted file mode 100644 index 0f092367f4..0000000000 --- a/modules/mogo-module-v2x/src/main/AndroidManifest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java deleted file mode 100644 index 04ebf4aa95..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.mogo.module.v2x; - -import androidx.annotation.Keep; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 7:35 PM - * desc : 对外服务模块路径 - * version: 1.0 - * 使用方式: - * Arouter.getInstance().path("").navigate() - */ -@Keep -public class MoGoV2XServicePaths { - /** - * V2X 状态管理 - */ - @Keep - public static final String PATH_V2X_STATUS_MANAGER = "/v2xStatusManager/api"; - - /** - * V2X 道路事件POI点 - */ - @Keep - public static final String PATH_V2X_MARKER_MANAGER = "/v2xMarkerManager/api"; - - /** - * V2X 道路事件与车辆的连接线 - */ - @Keep - public static final String PATH_V2X_POLYLINE_MANAGER = "/v2xPolylineManager/api"; - - /** - * V2X 道路事件与车辆的连接线 - */ - @Keep - public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api"; - - /** - * V2X 二轮车和行人连接线 - */ - @Keep - public static final String PATH_V2X_PERSON_WARN_POLYLINE_MANAGER = "/v2xPersonWarnPolylineManager/api"; - - /** - * V2X 停止线连接线 - */ - @Keep - public static final String PATH_V2X_STOP_POLYLINE_MANAGER = "/v2xStopPolylineManager/api"; - - - /** - * V2X 云端数据处理 - */ - @Keep - public static final String PATH_V2X_WARN_CLOUND_DATA_MANAGER = "/v2xWarnCloundDataManager/api"; - - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java deleted file mode 100644 index 740a5364c7..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.mogo.module.v2x; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-2114:10 - * desc : V2X使用到的常量 - * version: 1.0 - */ -public class V2XConst { - - public static final String T_SCENARIO_HISTORY = "t_search_poi"; - /** - * V2X面板名称 - */ - public static final String MODULE_NAME = "V2X_UI"; - /** - * V2X模块地址 - */ - public static final String PATH_V2X_UI = "/v2x/ui"; - - /** - * 事件面板名称 - */ - public static final String MODULE_NAME_EVENT_PANEL = "MODULE_EVENT_PANEL"; - /** - * 事件面板路径 - */ - public static final String PATH_EVENT_PANEL = "/event/panel"; - - /** - * V2X 场景广播 Action - */ - public static final String BROADCAST_SCENE_HANDLER_ACTION = "com.v2x.scene_handler_broadcast"; - public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity"; - - /** - * V2X 测试控制面板广播Action - */ - public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType"; - - - public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast"; - public static final String SEEK_HELP_TIME = "seek_help_time"; - public static final String V2X_ACC_ON_TIME_STR = "v2x_acc_on_time_str"; - public static final String V2X_ACC_OFF_TIME_STR = "v2x_acc_off_time_str"; - public static final String V2X_STRATEGY_PUSH = "v2x_strategy_push"; - - - /** - * V2X 埋点 - */ - public static final String V2X_ROAD_SHOW = "v2x_road_show"; - public static final String V2X_ROAD_EVET = "v2x_road_event"; - public static final String V2X_ROAD_EVET_HISTORY_BUTTON = "V2X_button_click"; - public static final String V2X_ROAD_PRODUCE = "v2x_road_produce"; - public static final String V2X_ASK_ALERT = "v2x_ask_alert";//UGC 提问 - public static final String V2X_ASK_RESULT = "v2x_ask_result";//UGC 提问回答或消失 - public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click"; - /** - * V2X 道路事件操作类型 - */ - public static final String V2X_ROAD_ZAN = "1"; - public static final String V2X_ROAD_CHAT = "2"; - public static final String V2X_ROAD_VIDEO = "3"; - public static final String V2X_ROAD_NAVI = "4"; - public static final String V2X_ROAD_REPORT_RIGHT = "5"; - public static final String V2X_ROAD_REPORT_ERROR = "6"; - - /** - * V2X 地图上发出警告的POI - */ - public static final String V2X_ILLEGAL_PARK_POI = "V2X_ILLEGAL_PARK_POI"; - - /** - * V2X 地图上发出警告的POI - */ - public static final String V2X_EVENT_ALARM_POI = "V2X_EVENT_ALARM_POI"; - - /** - * V2X 探路数据 - */ - public static final String V2X_CARD_TYPE_ROAD_CONDITION = "V2X_CARD_TYPE_ROAD_CONDITION"; - - /** - * V2X 用户数据 - */ - public static final String V2X_CARD_TYPE_USER_DATA = "V2X_CARD_TYPE_USER_DATA"; - - /** - * V2X 新鲜事 - */ - public static final String V2X_CARD_TYPE_NOVELTY = "V2X_CARD_TYPE_NOVELTY"; - - /** - * V2X 特殊车辆 - */ - public static final String V2X_MARKER_SPECIAL_CAR = "V2X_MARKER_SPECIAL_CAR"; - - /** - * V2X 可直播车辆 - */ - public static final String V2X_MARKER_LIVE_CAR = "V2X_MARKER_LIVE_CAR"; - - /** - * V2X 取快递 - */ - public static final String V2X_MARKER_EXPRESS = "V2X_MARKER_EXPRESS"; - - /** - * V2X 顺风车 - */ - public static final String V2X_MARKER_TAXI = "V2X_MARKER_TAXI"; - - /** - * V2X 政府推送消息 - */ - public static final String V2X_MARKER_GOVERNMENT = "V2X_MARKER_GOVERNMENT"; - - /** - * 绿波车速marker - */ - public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER"; - - /* - *V2X 车路云前方预警-识别物 - * */ - public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER"; - - /* - *V2X 车路云前方预警-线 - * */ - public static final String V2X_FRONT_STOP_LINE = "V2X_FRONT_STOP_LINE"; - /** - * V2X预警日志tag - */ - public static final String LOG_NAME_WARN = "liyz"; - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XDemoManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XDemoManager.java deleted file mode 100644 index fe123cb619..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XDemoManager.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.mogo.module.v2x; - -import android.content.Intent; -import android.text.TextUtils; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.utils.ChartingUtil; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; - -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/28 12:24 PM - * desc : 演示DEMO管理 - * version: 1.0 - */ -public class V2XDemoManager { - private List userListBeanList; - private V2XDemoUserInfoRes.ResultBean.UserListBean mV2XDemoUserInfoEntity1; - private V2XDemoUserInfoRes.ResultBean.UserListBean mV2XDemoUserInfoEntity2; - private V2XDemoUserInfoRes.ResultBean.UserListBean mV2XDemoUserInfoEntity3; - private static V2XDemoManager mV2XDemoManager; - - private V2XDemoManager() { - } - - public static V2XDemoManager getInstance() { - if (mV2XDemoManager == null) { - synchronized (V2XDemoManager.class) { - if (mV2XDemoManager == null) { - mV2XDemoManager = new V2XDemoManager(); - } - } - } - return mV2XDemoManager; - } - - public void initData() { - // 获取演示车辆信息 - V2XServiceManager - .getV2XRefreshModel() - .getMockUserInfos(new V2XRefreshCallback() { - @Override - public void onSuccess(V2XDemoUserInfoRes result) { - userListBeanList = result.getResult().getUserList(); - Logger.w(MODULE_NAME, "V2X演示用户数据:" + userListBeanList); - - for (V2XDemoUserInfoRes.ResultBean.UserListBean userListBean : userListBeanList) { - switch (userListBean.getSceneType()) { - case "1": - mV2XDemoUserInfoEntity1 = userListBean; - break; - case "2": - mV2XDemoUserInfoEntity2 = userListBean; - break; - case "3": - mV2XDemoUserInfoEntity3 = userListBean; - break; - } - } - - // 呼叫前方车辆 - V2XVoiceManager.INSTANCE.registerWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR, - (String command, Intent intent) -> { - String dataStr = intent.getStringExtra("data"); - Logger.w(MODULE_NAME, "mData。。。。" + dataStr); - if (!TextUtils.isEmpty(dataStr)) { - if (dataStr.contains("address")) { - roadCallChart(mV2XDemoUserInfoEntity2); - } - } else { - roadCallChart(mV2XDemoUserInfoEntity1); - } - } - ); - } - - @Override - public void onFail(String msg) { - - } - }); - } - - public void release() { - // 呼叫前方车辆 - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR); - } - - - /** - * 打电话 - */ - private void roadCallChart(V2XDemoUserInfoRes.ResultBean.UserListBean mV2XDemoUserInfoEntity) { - Logger.w(MODULE_NAME, "正在拨打电话。。。。" + mV2XDemoUserInfoEntity); - - try { - if (mV2XDemoUserInfoEntity != null) { - MarkerUserInfo mUserInfo = new MarkerUserInfo(); - MarkerLocation location = new MarkerLocation(); - location.setLon(mV2XDemoUserInfoEntity.getLocation().getLon()); - location.setLat(mV2XDemoUserInfoEntity.getLocation().getLat()); - mUserInfo.setSn(mV2XDemoUserInfoEntity.getUserInfo().getSn()); - mUserInfo.setUserHead(mV2XDemoUserInfoEntity.getUserInfo().getUserHead()); - mUserInfo.setUserName(mV2XDemoUserInfoEntity.getUserInfo().getUserName()); - mUserInfo.setGender(mV2XDemoUserInfoEntity.getUserInfo().getGender()); - mUserInfo.setAge(mV2XDemoUserInfoEntity.getUserInfo().getAge()); - ChartingUtil.callChatting(mUserInfo, location); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - // 1-拨打前方车辆, - public V2XDemoUserInfoRes.ResultBean.UserListBean getV2XDemoUserInfoEntity1() { - return mV2XDemoUserInfoEntity1; - } - - // 2-拨打中关村附近好友, - public V2XDemoUserInfoRes.ResultBean.UserListBean getV2XDemoUserInfoEntity2() { - return mV2XDemoUserInfoEntity2; - } - - // 3-点击地图图标拨打电话 - public V2XDemoUserInfoRes.ResultBean.UserListBean getV2XDemoUserInfoEntity3() { - return mV2XDemoUserInfoEntity3; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XEventPanelModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XEventPanelModuleProvider.java deleted file mode 100644 index d103d10ab0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XEventPanelModuleProvider.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.mogo.module.v2x; - -import android.content.Context; -import android.os.Bundle; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.map.listener.IMogoMapListener; -import com.mogo.map.location.IMogoLocationListener; -import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.map.navi.IMogoNaviListener; -import com.mogo.module.v2x.fragment.V2XEventPanelFragment; -import com.mogo.service.eventpanel.IEventPanelProvider; -import com.mogo.service.module.IMogoModuleLifecycle; -import com.mogo.service.module.ModuleType; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-2114:03 - * desc : V2X的管理 - * version: 2.0 - */ -@Route(path = V2XConst.PATH_EVENT_PANEL) -public class V2XEventPanelModuleProvider implements - IEventPanelProvider { - private final String TAG = "EventPanelModuleProvider"; - - @Override - public Fragment createFragment(Context context, Bundle data) { - Logger.d(MODULE_NAME, "事件模版 createFragment。。。。"); - V2XServiceManager.init(context); - return V2XEventPanelFragment.Companion.getInstance(); - } - - @Override - public View createView(Context context) { - return null; - } - - @NonNull - @Override - public String getModuleName() { - return V2XConst.MODULE_NAME_EVENT_PANEL; - } - - @Override - public IMogoModuleLifecycle getCardLifecycle() { - return null; - } - - @Override - public IMogoMapListener getMapListener() { - return null; - } - - @Override - public int getType() { - return ModuleType.TYPE_CARD_FRAGMENT; - } - - @Override - public IMogoNaviListener getNaviListener() { - return null; - } - - @Override - public IMogoLocationListener getLocationListener() { - return null; - } - - @Override - public IMogoMarkerClickListener getMarkerClickListener() { - return null; - } - - @Override - public String getAppPackage() { - return null; - } - - @Override - public String getAppName() { - return null; - } - - @Override - public void init(Context context) { - V2XServiceManager.init(context); - Logger.d(MODULE_NAME, "事件模版 模块初始化。。。。"); - } - - @Override - public void showPanelWithSelectedItem(int item) { - V2XEventPanelFragment.Companion.getInstance().showPanelWithSelectedItem(item); - } - - @Override - public void showPanel() { - V2XEventPanelFragment.Companion.getInstance().showPanel(); - } - - @Override - public void hidePanel() { - V2XEventPanelFragment.Companion.getInstance().hidePanel(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XMarkerService.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XMarkerService.java deleted file mode 100644 index 471e4feddd..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XMarkerService.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.mogo.module.v2x; - -import android.content.Context; -import android.os.Handler; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerResponse; -import com.mogo.module.v2x.listener.V2XLocationListener; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.network.V2XRefreshModel; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/6 5:37 PM - * desc : - * version: 1.0 - */ -public class V2XMarkerService implements V2XRefreshCallback { - private final String TAG = "V2XMarkerService"; - - // 一分钟获取一次最新的路况信息 - private final int refreshTime = 60_000; - private static V2XMarkerService mV2XMarkerService; - - private V2XRefreshModel mV2XRefreshModel; - private Handler refreshHandler; - private Runnable refreshRunnable; - - public synchronized static V2XMarkerService getInstance(Context context) { - if (mV2XMarkerService == null) { - mV2XMarkerService = new V2XMarkerService(); - mV2XMarkerService.init(context); - } - return mV2XMarkerService; - } - - private void init(Context context) { - mV2XRefreshModel = V2XRefreshModel.getInstance(context); - } - - public V2XRefreshModel getV2XRefreshModel() { - return mV2XRefreshModel; - } - - public void refreshMarkerData(MogoLocation location) { - try { - if (mV2XRefreshModel != null && location != null) { - //Logger.d(MODULE_NAME, "V2X道路事件:执行气泡刷新操作。"); - // 获取目前最新的周边的poi点 - mV2XRefreshModel.querySnapshotSync( - new MogoLatLng(location.getLatitude(), location.getLongitude()), - (int) getMapCameraFactWidth(), - 999, - this); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 地图视图对应的实际宽度 - */ - private float getMapCameraFactWidth() { - return 1_000; - } - - /** - * 关闭自动刷新 - */ - public void stopAutoRefresh() { - Logger.w(MODULE_NAME, "V2X道路事件:关闭V2X地图气泡自动刷新。"); - V2XServiceManager - .getMogoRegisterCenter() - .unregisterMogoLocationListener(MODULE_NAME); - - if (refreshHandler != null) { - refreshHandler.removeCallbacks(refreshRunnable); - } - refreshRunnable = null; - } - - /** - * 开始刷新 - */ - public void startAutoRefresh() { - // 设置地图定位监听 - V2XServiceManager.getMogoRegisterCenter() - .registerMogoLocationListener(MODULE_NAME, V2XLocationListener.getInstance()); - V2XServiceManager.getMogoRegisterCenter().registerCarLocationChangedListener( MODULE_NAME, V2XLocationListener.getInstance()); - - Logger.d(MODULE_NAME, "V2X道路事件:开启V2X地图气泡自动绘制。"); - if (refreshHandler == null) { - refreshHandler = new Handler(); - } - if (refreshRunnable == null) { - refreshRunnable = new Runnable() { - @Override - public void run() { - refreshMarkerData(V2XLocationListener.getInstance().getLastCarLocation()); - refreshHandler.postDelayed(this, refreshTime); - } - }; - } - refreshHandler.post(refreshRunnable); - } - - @Override - public void onSuccess(MarkerResponse result) { - if (V2XSocketManager.getInstance().getV2XMessageListener_401011() != null) { - V2XSocketManager.getInstance().getV2XMessageListener_401011().onMsgReceived(result); - } - } - - @Override - public void onFail(String msg) { - Logger.e(TAG, "刷新V2X道路事件异常请检查参数"); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java deleted file mode 100644 index e0f2c752fb..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java +++ /dev/null @@ -1,448 +0,0 @@ -package com.mogo.module.v2x; - -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Bundle; -import android.provider.Settings; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.listener.IMogoMapListener; -import com.mogo.map.location.IMogoLocationListener; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.map.model.MogoPoi; -import com.mogo.map.navi.IMogoNaviListener; -import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.map.uicontroller.VisualAngleMode; -import com.mogo.module.common.ModuleNames; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerExploreWayItem; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.utils.Const; -import com.mogo.module.v2x.entity.net.V2XSeekHelpRes; -import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.receiver.SceneBroadcastReceiver; -import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; -import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz; -import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow; -import com.mogo.module.v2x.utils.FatigueDrivingUtils; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.module.IMogoModuleLifecycle; -import com.mogo.service.module.IMogoModuleProvider; -import com.mogo.service.module.ModuleType; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.StatusDescriptor; -import com.tencent.liteav.basic.log.TXCLog; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; -import static com.mogo.module.v2x.VideoInitKt.initVideo; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-2114:03 - * desc : V2X的管理 - * version: 2.0 - */ -@Route(path = V2XConst.PATH_V2X_UI) -public class V2XModuleProvider implements - IMogoModuleProvider, - IMogoStatusChangedListener, - IMogoMapListener { - private final String TAG = "V2XMocduleProvider"; - - private Context mContext; - - @Override - public Fragment createFragment(Context context, Bundle data) { - return null; - } - - @Override - public View createView(Context context) { - return null; - } - - @NonNull - @Override - public String getModuleName() { - return MODULE_NAME; - } - - @Override - public IMogoModuleLifecycle getCardLifecycle() { - return null; - } - - @Override - public IMogoMapListener getMapListener() { - return null; - } - - @Override - public int getType() { - return ModuleType.TYPE_SERVICE; - } - - @Override - public IMogoNaviListener getNaviListener() { - return null; - } - - @Override - public IMogoLocationListener getLocationListener() { - return null; - } - - @Override - public IMogoMarkerClickListener getMarkerClickListener() { - return null; - } - - @Override - public String getAppPackage() { - return null; - } - - @Override - public String getAppName() { - return null; - } - - @Override - public void init(Context context) { - Logger.d(MODULE_NAME, "V2X 模块初始化。。。。"); - mContext = context; - // 关闭腾讯直播日志 - TXCLog.setLevel(TXCLog.LOG_NONE); - TXCLog.setConsoleEnabled(false); - - V2XServiceManager.init(context); - V2XVoiceManager.INSTANCE.init(context); - registerListener(); - initData(); - initBiz(context); - // 注册广播接收场景弹窗使用的 - SceneBroadcastReceiver localReceiver = new SceneBroadcastReceiver(); - LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context); - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - localBroadcastManager.registerReceiver(localReceiver, intentFilter); - - - if (V2XServiceManager.getMoGoStatusManager().isTopContainerReady()) { - V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn()); - } - - } - - private void initBiz(Context context) { - V2XVoiceCallLiveBiz.getInstance().init(context); - } - - private void initData() { - try { - // 查询ACC状态 - SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_ACC_STATUS", isAccOn()); - if (isAccOn()) { - // 记录开机时间 - FatigueDrivingUtils.refreshAccOnTime(); - } else { - // 记录关机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString()); - } - } catch (Exception e) { - e.printStackTrace(); - } - // 刷新配置文件 - refreshStrategyConfig(); - } - - /** - * 获取疲劳驾驶的配置 - */ - private void refreshStrategyConfig() { - Logger.w(MODULE_NAME, "刷新V2X中的配置文件"); - - //TODO V2XDemoManager这个是演示需求获取服务端配置可用直播车机 - V2XDemoManager.getInstance().initData(); - // 获取疲劳驾驶的配置 - V2XServiceManager - .getV2XRefreshModel() - .getStrategyPush(new V2XRefreshCallback() { - @Override - public void onSuccess(V2XStrategyPushRes result) { - //Logger.w(MODULE_NAME, "V2X疲劳驾驶配置数据更新:" + GsonUtil.jsonFromObject(result)); - V2XStrategyPushRes.ResultBean resultBean = result.getResult(); - if (resultBean != null) { - // 更新本地的v2x提醒策略 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_STRATEGY_PUSH, GsonUtil.jsonFromObject(resultBean)); - } - } - - @Override - public void onFail(String msg) { - - } - }); - } - - private MarkerExploreWay extractFromMarker(IMogoMarker marker) { - if (marker == null) { - return null; - } - if (marker.getObject() instanceof MarkerShowEntity) { - MarkerShowEntity showEntity = ((MarkerShowEntity) marker.getObject()); - if (showEntity.getBindObj() instanceof MarkerExploreWay) { - return ((MarkerExploreWay) showEntity.getBindObj()); - } - } - - return null; - } - - /** - * 注册各种监听 - */ - private void registerListener() { - // 初始化监听 - V2XServiceManager.getMogoRegisterCenter() - .registerMogoMapListener(V2XConst.MODULE_NAME, this); - V2XServiceManager.getMoGoStatusManager() - .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this); - V2XServiceManager.getMoGoStatusManager() - .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.TOP_CONTAINER_READY, this); - V2XServiceManager.getMoGoStatusManager() - .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this); - - V2XServiceManager - .getMogoRegisterCenter().registerMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION, new IMogoMarkerClickListener() { - @Override - public boolean onMarkerClicked(IMogoMarker marker) { - - Log.d(TAG, "onMarkerClicked2222"); - //点击的marker的具体数据 - MarkerExploreWay exploreWay = extractFromMarker(marker); - MarkerExploreWayItem item = exploreWay.getItems().get(0); - String path = item.getUrl(); - if (path.contains(".mp4")) { - initVideo(); - } - - V2XRoadEventEntity roadEventEntity = new V2XRoadEventEntity(); - roadEventEntity.setNoveltyInfo(exploreWay); - roadEventEntity.setPoiType(exploreWay.getPoiType()); - roadEventEntity.setExpireTime(20000); - //地理位置 - MarkerLocation location = exploreWay.getLocation(); - roadEventEntity.setLocation(location); - - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity(); - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); - v2XMessageEntity.setShowState(true); - v2XMessageEntity.setOnlyShow(true); - v2XMessageEntity.setNeedAddLine(false); - - v2XMessageEntity.setContent(roadEventEntity); - - Intent intent = new Intent(Const.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(Const.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - - //埋点 - TrackUtils.trackV2XMarkerClick(2); - - return false; - } - }); - - // 响应违章停车的POI点击 - V2XServiceManager - .getMogoRegisterCenter() - .registerMogoMarkerClickListener(V2XConst.MODULE_NAME, new IMogoMarkerClickListener() { - @Override - public boolean onMarkerClicked(IMogoMarker marker) { - try { - MarkerExploreWay markerExploreWay = - (MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj(); - Logger.d(V2XConst.MODULE_NAME, - "V2X===违章停车:onMarkerClicked=" + markerExploreWay); - - //直接展示弹窗 - V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow(); - parkScenario.show(markerExploreWay, false); - } catch (Exception e) { - e.printStackTrace(); - } - return true; - } - }); - - // 注册V2X场景Socket - V2XServiceManager.getV2XSocketManager().registerSocketMessage(); - // 开启自动刷新,暂时关闭间隔查询来降低流量消耗 - V2XServiceManager.getV2XMarkerService().startAutoRefresh(); - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - V2XServiceManager.getMapUIController().recoverLockMode(); - } - - /** - * 刷新自车求助状态 - * - * @param isTrue - */ - private void refreshMeSeekHelp(boolean isTrue) { - V2XMessageEntity entity = new V2XMessageEntity<>(); - entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP); - entity.setContent(isTrue); - V2XScenarioManager.getInstance().handlerMessage(entity); - } - - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:" + descriptor + "\nisTrue:" + isTrue); - // 记录状态更改 - SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_" + descriptor, isTrue); - if (descriptor == StatusDescriptor.ACC_STATUS) { - if (isTrue) { - // 刷新配置文件 - refreshStrategyConfig(); - - // 记录开机时间 - FatigueDrivingUtils.refreshAccOnTime(); - initCarForHelpStatus(); - if (V2XServiceManager.getMoGoStatusManager().isTopContainerReady()) { - V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn()); - } - } else { - // 记录关机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString()); - } - } else if (descriptor == StatusDescriptor.SEEK_HELPING) { - refreshMeSeekHelp(isTrue); - } else if (descriptor == StatusDescriptor.TOP_CONTAINER_READY) { - if (isTrue) { - V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn()); - } - - } - } - - /** - * 是否是ACC ON操作 - * - * @return true-ACC ON | false - ACC OFF - */ - public boolean isAccOn() { - int accState = Settings.System.getInt(mContext.getContentResolver(), "mcu_state", -0x02); - //Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState); - return accState == 1; - } - - /** - * 刷新自车求助状态 - */ - private void initCarForHelpStatus() { - Logger.d(MODULE_NAME, "刷新自车求助状态……"); - //本地查询是否超时 - V2XServiceManager.getV2XRefreshModel().getHelpSignal(new V2XRefreshCallback() { - @Override - public void onSuccess(V2XSeekHelpRes result) { - if (result != null) { - V2XSeekHelpRes.ResultBean resultBean = result.getResult(); - if (resultBean != null) { - Logger.d(MODULE_NAME, "刷新自车求助状态 resultBean:" + resultBean); - int vehicleType = resultBean.getVehicleType(); - //故障车 - if (vehicleType == 4) { - refreshMeSeekHelp(true); - V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, true); - } else { - refreshMeSeekHelp(false); - V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, false); - } - } - } - } - - @Override - public void onFail(String msg) { - - } - }); - } - - @Override - public void onMapLoaded() { - //初始化获得自车求助状态 - initCarForHelpStatus(); - } - - @Override - public void onTouch(MotionEvent motionEvent) { - - } - - @Override - public void onPOIClick(MogoPoi poi) { - - } - - @Override - public void onMapClick(MogoLatLng latLng) { - - } - - @Override - public void onLockMap(boolean isLock) { - - } - - @Override - public void onMapModeChanged(EnumMapUI ui) { - - } - - @Override - public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) { - - } - - @Override - public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) { - //todo visual 涉及到V2X,V2N业务,视距状态切换回调 切换到近景如何处理 产品侧需要定义 - } - - @Override - public void onDestroy() { - - } - -// @Override -// public void onLocationChanged(@Nullable MogoLocation location) { -// V2XScenarioManager.getInstance().handlerMessage(entity); -// } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java deleted file mode 100644 index 297a8a23bf..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.mogo.module.v2x; - -import android.content.Context; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.location.IMogoLocationClient; -import com.mogo.map.marker.IMogoMarkerManager; -import com.mogo.map.navi.IMogoNavi; -import com.mogo.map.overlay.IMogoOverlayManager; -import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.v2x.alarm.V2XCalculateServer; -import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager; -import com.mogo.module.v2x.manager.IMoGoStopPolylineManager; -import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager; -import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager; -import com.mogo.module.v2x.manager.IMoGoV2XStatusManager; -import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager; -import com.mogo.module.v2x.network.V2XRefreshModel; -import com.mogo.service.IMogoServiceApis; -import com.mogo.service.analytics.IMogoAnalytics; -import com.mogo.service.cloud.socket.IMogoSocketManager; -import com.mogo.service.entrance.IMogoEntranceButtonController; -import com.mogo.service.imageloader.IMogoImageloader; -import com.mogo.service.intent.IMogoIntentManager; -import com.mogo.service.map.IMogoMapService; -import com.mogo.service.module.IMogoActionManager; -import com.mogo.service.module.IMogoMarkerService; -import com.mogo.service.module.IMogoRegisterCenter; -import com.mogo.service.share.IMogoShareManager; -import com.mogo.service.share.IMogoTanluProvider; -import com.mogo.service.share.IMogoTrafficUploadProvider; -import com.mogo.service.statusmanager.IMogoStatusManager; -import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider; -import com.mogo.service.strategy.IMogoRefreshStrategyController; -import com.mogo.service.v2x.DisplayEffectsInterface; -import com.mogo.service.windowview.IMogoTopViewManager; -import com.mogo.service.windowview.IMogoWindowManager; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICarsChattingProvider; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-2114:01 - * desc : V2X 服务 - * version: 1.0 - */ -public class V2XServiceManager { - - private static boolean isInit; - - private static Context mContext; - private static IMogoServiceApis mMogoServiceApis; - - private static IMogoMapService mMapService; - private static IMogoMarkerManager mMarkerManager; - private static IMogoNavi mNavi; - private static IMogoMapUIController mMapUIController; - private static IMogoLocationClient mMogoLocationClient; - private static IMogoTopViewManager mMogoTopViewManager; - private static DisplayEffectsInterface displayEffectsManager; - private static IMogoStatusManager mMogoStatusManager; - private static IMogoWindowManager mIMogoWindowManager; - private static IMogoImageloader mImageLoader; - private static IMogoSocketManager mMogoSocketManager; - private static IMogoAnalytics mMogoAnalytics; - private static IMogoOverlayManager mMogoOverlayManager; - private static IMogoRegisterCenter mMogoRegisterCenter; - private static IMogoRefreshStrategyController mIMogoRefreshStrategyController; - private static IMogoMarkerService mIMogoMarkerService; - private static IMogoShareManager mIMogoShareManager; - private static IMogoTanluProvider mIMogoTanluProvider; - private static IMogoTrafficUploadProvider mIMogoTrafficUploadProvider; - - private static IMogoActionManager mMogoActionManager; - private static ICarsChattingProvider mCarsChattingProvider; - private static IMogoIntentManager mMogoIntentManager; - private static IMogoEntranceButtonController mMogoEntranceButtonController; - private static IMogoOnlineCarListPanelProvider mMogoOnlineCarListPanelProvider; - - private static V2XRefreshModel mV2XRefreshModel; - private static V2XMarkerService mV2XMarkerService; - private static V2XStatusManager mV2XStatusManager; - private static V2XSocketManager mV2XSocketManager; - private static V2XCalculateServer mV2XCalculateServer; - - - // 下面的是重构后的代码,建议 - private static IMoGoV2XMarkerManager moGoV2XMarkerManager; - private static IMoGoV2XPolylineManager moGoV2XPolylineManager; - private static IMoGoV2XStatusManager moGoV2XStatusManager; - private static IMoGoWarnPolylineManager moGoWarnPolylineManager; - private static IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager; - private static IMoGoStopPolylineManager moGoStopPolylineManager; - - private V2XServiceManager() { - - } - - public static void init(final Context context) { - if (!isInit) { - isInit = true; - - mContext = context; - mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context); - - mMapService = mMogoServiceApis.getMapServiceApi(); - mImageLoader = mMogoServiceApis.getImageLoaderApi(); - mMogoStatusManager = mMogoServiceApis.getStatusManagerApi(); - mMogoSocketManager = mMogoServiceApis.getSocketManagerApi(context); - mMogoAnalytics = mMogoServiceApis.getAnalyticsApi(); - mIMogoWindowManager = mMogoServiceApis.getWindowManagerApi(); - mMogoRegisterCenter = mMogoServiceApis.getRegisterCenterApi(); - mIMogoRefreshStrategyController = mMogoServiceApis.getRefreshStrategyControllerApi(); - mMogoEntranceButtonController = mMogoServiceApis.getEntranceButtonController(); - mMogoActionManager = mMogoServiceApis.getActionManagerApi(); - mMogoTopViewManager = mMogoServiceApis.getTopViewManager(); - displayEffectsManager = mMogoServiceApis.getDisplayEffectsManager(); - mIMogoMarkerService = mMogoServiceApis.getMarkerService(); - mIMogoShareManager = mMogoServiceApis.getShareManager(); - mIMogoTanluProvider = mMogoServiceApis.getTanluApi(); - mIMogoTrafficUploadProvider = mMogoServiceApis.getTrafficUploadApi(); - mMogoOnlineCarListPanelProvider = mMogoServiceApis.getOnlineCarPanelApi(); - - mMarkerManager = mMapService.getMarkerManager(context); - mNavi = mMapService.getNavi(context); - mMapUIController = mMapService.getMapUIController(); - mMogoLocationClient = mMapService.getSingletonLocationClient(context); - mMogoOverlayManager = mMapService.getOverlayManager(context); - - mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(); - mMogoIntentManager = mMogoServiceApis.getIntentManagerApi(); - - mV2XRefreshModel = V2XRefreshModel.getInstance(context); - mV2XMarkerService = V2XMarkerService.getInstance(context); - mV2XStatusManager = V2XStatusManager.getInstance(); - mV2XSocketManager = V2XSocketManager.getInstance(); - mV2XCalculateServer = V2XCalculateServer.getInstance(); - - moGoV2XMarkerManager = (IMoGoV2XMarkerManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context); - moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context); - moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context); - moGoPersonWarnPolylineManager = (IMoGoPersonWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER).navigation(context); - moGoStopPolylineManager = (IMoGoStopPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER).navigation(context); - - moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context); - } - } - - - public static Context getContext() { - return mContext; - } - - public static IMogoTopViewManager getMogoTopViewManager() { - return mMogoTopViewManager; - } - - public static DisplayEffectsInterface getDisplayEffectsManager() { - return displayEffectsManager; - } - - public static IMogoEntranceButtonController getMogoEntranceButtonController() { - return mMogoEntranceButtonController; - } - - public static IMogoMapService getMapService() { - return mMapService; - } - - public static IMogoOverlayManager getMogoOverlayManager() { - return mMogoOverlayManager; - } - - public static IMogoRegisterCenter getMogoRegisterCenter() { - return mMogoRegisterCenter; - } - - public static IMogoMarkerManager getMarkerManager() { - return mMarkerManager; - } - - public static IMogoNavi getNavi() { - return mNavi; - } - - public static IMogoMapUIController getMapUIController() { - return mMapUIController; - } - - public static IMogoLocationClient getMogoLocationClient() { - return mMogoLocationClient; - } - - public static IMogoImageloader getImageLoader() { - return mImageLoader; - } - - public static IMogoSocketManager getMoGoSocketManager() { - return mMogoSocketManager; - } - - public static IMogoStatusManager getMoGoStatusManager() { - return mMogoStatusManager; - } - - public static IMogoWindowManager getIMogoWindowManager() { - return mIMogoWindowManager; - } - - public static ICarsChattingProvider getCarsChattingProvider() { - return mCarsChattingProvider; - } - - public static IMogoIntentManager getMogoIntentManager() { - return mMogoIntentManager; - } - - public static V2XMarkerService getV2XMarkerService() { - return mV2XMarkerService; - } - - public static V2XRefreshModel getV2XRefreshModel() { - return mV2XRefreshModel; - } - - public static V2XStatusManager getV2XStatusManager() { - return mV2XStatusManager; - } - - public static V2XSocketManager getV2XSocketManager() { - return mV2XSocketManager; - } - - public static IMoGoV2XMarkerManager getMoGoV2XMarkerManager() { - return moGoV2XMarkerManager; - } - - public static IMoGoV2XPolylineManager getMoGoV2XPolylineManager() { - return moGoV2XPolylineManager; - } - - public static IMoGoWarnPolylineManager getMoGoWarnPolylineManager() { - return moGoWarnPolylineManager; - } - - public static IMoGoV2XStatusManager getMoGoV2XStatusManager() { - if (moGoV2XStatusManager == null) { - moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(Utils.getApp()); - } - return moGoV2XStatusManager; - } - - public static IMogoActionManager getMogoActionManager() { - return mMogoActionManager; - } - - public static IMogoRefreshStrategyController getIMogoRefreshStrategyController() { - return mIMogoRefreshStrategyController; - } - - public static IMogoAnalytics getMogoAnalytics() { - return mMogoAnalytics; - } - - public static IMogoMarkerService getIMogoMarkerService() { - return mIMogoMarkerService; - } - - public static V2XCalculateServer getV2XCalculateServer() { - return mV2XCalculateServer; - } - - public static IMogoShareManager getMogoShareManager() { - return mIMogoShareManager; - } - - public static IMogoTanluProvider getTanluManager() { - return mIMogoTanluProvider; - } - - public static IMogoTrafficUploadProvider getIMogoTrafficUploadProvider() { - return mIMogoTrafficUploadProvider; - } - - public static IMogoOnlineCarListPanelProvider getMogoOnlineCarListPanelProvider() { - return mMogoOnlineCarListPanelProvider; - } - - public static IMoGoPersonWarnPolylineManager getMoGoPersonWarnPolylineManager() { - return moGoPersonWarnPolylineManager; - } - - public static IMoGoStopPolylineManager getMoGoStopPolylineManager() { - return moGoStopPolylineManager; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XSocketManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XSocketManager.java deleted file mode 100644 index f16b4596d2..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XSocketManager.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.mogo.module.v2x; - -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.listener.V2XMessageListener_401003; -import com.mogo.module.v2x.listener.V2XMessageListener_401005; -import com.mogo.module.v2x.listener.V2XMessageListener_401006; -import com.mogo.module.v2x.listener.V2XMessageListener_401007; -import com.mogo.module.v2x.listener.V2XMessageListener_401009; -import com.mogo.module.v2x.listener.V2XMessageListener_401010; -import com.mogo.module.v2x.listener.V2XMessageListener_401011; -import com.mogo.module.v2x.listener.V2XMessageListener_401012; -import com.mogo.module.v2x.listener.V2XMessageListener_402000; -import com.mogo.module.v2x.listener.V2XMessageListener_401018; -import com.mogo.module.v2x.listener.V2XMessageListener_404000; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/31 5:59 PM - * desc : V2X报警事件管理,这里进行报警事件的分发处理,TODO 这里是准备重构使用的 - * version: 1.0 - */ -public class V2XSocketManager { - - private static V2XSocketManager mV2XSocketManager; - - private V2XMessageListener_401011 v2XMessageListener_401011; - private V2XMessageListener_401012 v2XMessageListener_401012; - private V2XMessageListener_401003 v2XMessageListener_401003; - private V2XMessageListener_401005 v2XMessageListener_401005; - private V2XMessageListener_401006 v2XMessageListener_401006; - private V2XMessageListener_401007 v2XMessageListener_401007; - private V2XMessageListener_401009 v2XMessageListener_401009; - private V2XMessageListener_401010 v2XMessageListener_401010; - private V2XMessageListener_402000 mV2XMessageListener_402000; - private V2XMessageListener_401018 mV2XMessageListener401018; - private V2XMessageListener_404000 mV2XMessageListener_404000; - - private V2XSocketManager() { - } - - /** - * 获取操作实体 - */ - public static synchronized V2XSocketManager getInstance() { - synchronized (V2XSocketManager.class) { - if (mV2XSocketManager == null) { - mV2XSocketManager = new V2XSocketManager(); - } - } - return mV2XSocketManager; - } - - /** - * 注册长链接消息处理 - */ - public void registerSocketMessage() { - Logger.d(MODULE_NAME, "开始注册Socket通道...."); - register401011(); - register401012(); - // M1 不基于地图的版本不接收道路求助,原因是车机内置地图版本不一样 - if (DebugConfig.isMapBased()) { - register401005(); - } - register401007(); - register401009(); - register401020(); - register404000(); - registerWarningMsg(); - - // TODO 这里是前瞻需求,量产版本需要注释 - register401003(); - // TODO 旧版本的一种V2X预警形式,已经废弃了 - //register401006(); - } - - - /** - * 反注册消息通道,不再进行接受 - */ - public void unregisterSocketMessage() { - Logger.w(MODULE_NAME, "反注册Socket通道...."); - if (v2XMessageListener_401011 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401011, v2XMessageListener_401011); - } - if (v2XMessageListener_401012 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401012, v2XMessageListener_401012); - } - if (v2XMessageListener_401003 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401003, v2XMessageListener_401003); - } - if (v2XMessageListener_401005 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401005, v2XMessageListener_401005); - } - if (v2XMessageListener_401006 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401006, v2XMessageListener_401006); - } - if (v2XMessageListener_401007 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401007, v2XMessageListener_401007); - } - if (v2XMessageListener_401009 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(401009, v2XMessageListener_401009); - } - if (mV2XMessageListener_402000 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(402000, mV2XMessageListener_402000); - } - if (mV2XMessageListener_404000 != null) { - V2XServiceManager - .getMoGoSocketManager() - .unregisterOnMessageListener(404000, mV2XMessageListener_404000); - } - } - - /** - * 道路事件,在线车辆绘制 - */ - private void register401011() { - v2XMessageListener_401011 = new V2XMessageListener_401011(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401011, - v2XMessageListener_401011 - ); - } - - public V2XMessageListener_401011 getV2XMessageListener_401011() { - return v2XMessageListener_401011; - } - - /** - * 道路事件,服务端下发 - */ - private void register401012() { - v2XMessageListener_401012 = new V2XMessageListener_401012(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401012, - v2XMessageListener_401012 - ); - } - - /** - * ADAS & V2X 场景触发push - * TODO 这里是后台下发 http://h5service.zhidaohulian.com/v2x_remoteControl/#/ - */ - private void register401003() { - v2XMessageListener_401003 = new V2XMessageListener_401003(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401003, - v2XMessageListener_401003 - ); - } - - /** - * 特殊车辆推送绘制 - */ - private void register401005() { - v2XMessageListener_401005 = new V2XMessageListener_401005(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401005, - v2XMessageListener_401005 - ); - } - - /** - * * 3.2.1、前方静止or慢速车辆报警 - * * 3.2.2、道路危险状况告警 / 前方拥堵告警 - */ - @Deprecated - private void register401006() { - v2XMessageListener_401006 = new V2XMessageListener_401006(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401006, - v2XMessageListener_401006 - ); - } - - /** - * 限行通知 - */ - private void register401007() { - v2XMessageListener_401007 = new V2XMessageListener_401007(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401007, - v2XMessageListener_401007 - ); - } - - /** - * * 2.0.2 - * * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=35786774 - * * 注册点赞通信接收 - */ - public void register401009() { - v2XMessageListener_401009 = new V2XMessageListener_401009(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401009, - v2XMessageListener_401009 - ); - } - - /** - * * 车路云—场景预警-V1.0 - * * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799 - * * 最优路线推荐 - */ - public void register401020() { - mV2XMessageListener_402000 = new V2XMessageListener_402000(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 402000, - mV2XMessageListener_402000 - ); - } - - public void register404000() { - mV2XMessageListener_404000 = new V2XMessageListener_404000(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 404000, - mV2XMessageListener_404000 - ); - } - - /** - * * 车路云—场景预警-V1.0 - * * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799 - * * 弱势交通参与者 - */ - public void registerWarningMsg() { - mV2XMessageListener401018 = new V2XMessageListener_401018(); - V2XServiceManager.getMoGoSocketManager().registerOnMessageListener(401018, mV2XMessageListener401018); - } - - - /** - * * 2.0.3 - * * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=35788659 - * * TODO 停车场、加油站推送心跳,这里是前瞻的功能,目前仅在分体机使用, - */ - @Deprecated - private void register401010() { - v2XMessageListener_401010 = new V2XMessageListener_401010(); - // 道路事件,在线车辆绘制 - V2XServiceManager - .getMoGoSocketManager() - .registerOnMessageListener( - 401010, - v2XMessageListener_401010 - ); - } - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java deleted file mode 100644 index 2f6c77703c..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.mogo.module.v2x; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.module.common.entity.V2XRoadEventEntity; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/3 2:34 PM - * desc : V2X状态管理 - * version: 1.0 - */ -@Deprecated -public class V2XStatusManager { - private static V2XStatusManager mV2XStatusManager; - // 正在进行的告警事件详情 - private V2XRoadEventEntity mAlarmInfo; - - private MogoLocation mLocation; - - private V2XStatusManager() { - } - - /** - * 获取操作实体 - */ - public static synchronized V2XStatusManager getInstance() { - synchronized (V2XStatusManager.class) { - if (mV2XStatusManager == null) { - mV2XStatusManager = new V2XStatusManager(); - } - } - return mV2XStatusManager; - } - - public void setAlarmInfo(V2XRoadEventEntity eventEntity) { - this.mAlarmInfo = eventEntity; - } - - // 获取目标事件经纬度 - public MogoLatLng getTargetMoGoLatLng() { - if (mAlarmInfo != null) { - return new MogoLatLng( - mAlarmInfo.getLocation().getLat(), - mAlarmInfo.getLocation().getLon() - ); - } - return null; - } - - public MogoLocation getLocation() { - if (mLocation == null) { - mLocation = new MogoLocation(); - } - //Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString()); - return mLocation; - } - - public void setLocation(MogoLocation mLocation) { - this.mLocation = mLocation; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XEventPagerAdapter.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XEventPagerAdapter.kt deleted file mode 100644 index 716ce9734b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XEventPagerAdapter.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.module.v2x.adapter - -import androidx.fragment.app.Fragment -import androidx.viewpager2.adapter.FragmentStateAdapter - -/** - * 事件面板viewpager2的adapter - * - * @author tongchenfei - */ -class V2XEventPagerAdapter(fragment: Fragment, - private val fragments: Array) : - FragmentStateAdapter(fragment) { - - /** - * 目前一共就三个fragment - */ - override fun getItemCount(): Int = fragments.size - - override fun createFragment(position: Int): Fragment = fragments[position] -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java deleted file mode 100644 index 26c35201d5..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.adapter.holder.V2XEventUgcVH; -import com.mogo.module.v2x.adapter.holder.V2XFatigueDrivingVH; -import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH; -import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH; -import com.mogo.module.v2x.adapter.holder.V2XOtherSeekHelpVH; -import com.mogo.module.v2x.adapter.holder.V2XPushEventVH; -import com.mogo.module.v2x.adapter.holder.V2XRecommendRouteVH; -import com.mogo.module.v2x.adapter.holder.V2XRoadEventVH; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:05 PM - * desc : V2X 场景事件列表中的数据适配器 - * version: 1.0 - */ -public class V2XRoadEventAdapter extends RecyclerView.Adapter { - - private List itemList; - - // 当前展示条目绑定的window - private IV2XWindow mV2XWindow; - - public V2XRoadEventAdapter(List itemList, IV2XWindow v2XWindow) { - this.itemList = itemList; - this.mV2XWindow = v2XWindow; - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - RecyclerView.ViewHolder holder = null; - switch (viewType) { - // 直播 - case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING: - holder = new V2XLiveVideoVH(parent, mV2XWindow); - break; - //道路事件详情 - case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING: - holder = new V2XRoadEventVH(parent, mV2XWindow); - break; - //违章停车 - case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING: - holder = new V2XIllegalParkVH(parent, mV2XWindow); - break; - //推送展示 - case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING: - holder = new V2XPushEventVH(parent, mV2XWindow); - break; - //疲劳驾驶 - case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING: - holder = new V2XFatigueDrivingVH(parent, mV2XWindow); - break; - //他人故障求助 - case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING: - holder = new V2XOtherSeekHelpVH(parent, mV2XWindow); - break; - //道路事件UGC - case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING: - holder = new V2XEventUgcVH(parent, mV2XWindow); - break; - //线路推荐 - case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE: - holder = new V2XRecommendRouteVH(parent, mV2XWindow); - break; - } - return holder; - } - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - if (holder instanceof V2XLiveVideoVH) { - ((V2XLiveVideoVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XRoadEventVH) { - ((V2XRoadEventVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XIllegalParkVH) { - ((V2XIllegalParkVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XPushEventVH) { - ((V2XPushEventVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XFatigueDrivingVH) { - ((V2XFatigueDrivingVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XEventUgcVH) { - ((V2XEventUgcVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XOtherSeekHelpVH) { - ((V2XOtherSeekHelpVH) holder).initView(itemList.get(position)); - } - if (holder instanceof V2XRecommendRouteVH) { - ((V2XRecommendRouteVH) holder).initView(itemList.get(position)); - } - } - - @Override - public int getItemViewType(int position) { - return itemList.get(position).getViewType(); - } - - @Override - public int getItemCount() { - return itemList == null ? 0 : itemList.size(); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XScenarioHistoryAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XScenarioHistoryAdapter.java deleted file mode 100644 index f72e4f8e4b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XScenarioHistoryAdapter.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.RecyclerView.ViewHolder; - -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryIllegalParkVH; -import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryOtherSeekHelpVH; -import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryRoadEventVH; - -import java.util.ArrayList; - -/** - * @author donghongyu - */ -public class V2XScenarioHistoryAdapter extends RecyclerView.Adapter { - - private ArrayList mV2XHistoryScenarioData; - - public V2XScenarioHistoryAdapter(ArrayList v2XHistoryScenarioData) { - if (v2XHistoryScenarioData != null) { - this.mV2XHistoryScenarioData = v2XHistoryScenarioData; - } - } - - @NonNull - @Override - public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - ViewHolder holder; - switch (viewType) { - //道路事件详情 - case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING: - holder = new V2XScenarioHistoryRoadEventVH(parent); - break; - //违章停车 - case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING: - holder = new V2XScenarioHistoryIllegalParkVH(parent); - break; - //他人故障求助 - case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING: - holder = new V2XScenarioHistoryOtherSeekHelpVH(parent); - break; - //没有更多的数据的Footer - default: - View footerView = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.footer_nomore_view, parent, false); - holder = new FooterViewHolder(footerView); - break; - } - - return holder; - } - - @Override - public void onBindViewHolder(@NonNull ViewHolder holder, int position) { - if (position < mV2XHistoryScenarioData.size()) { - if (holder instanceof V2XScenarioHistoryRoadEventVH) { - ((V2XScenarioHistoryRoadEventVH) holder).initView(mV2XHistoryScenarioData.get(position)); - } - if (holder instanceof V2XScenarioHistoryIllegalParkVH) { - ((V2XScenarioHistoryIllegalParkVH) holder).initView(mV2XHistoryScenarioData.get(position)); - } - if (holder instanceof V2XScenarioHistoryOtherSeekHelpVH) { - ((V2XScenarioHistoryOtherSeekHelpVH) holder).initView(mV2XHistoryScenarioData.get(position)); - } - } - } - - @Override - public int getItemViewType(int position) { - if (position < mV2XHistoryScenarioData.size()) { - return mV2XHistoryScenarioData.get(position).getScenarioType(); - } else { - // 没有更多的Footer - return -1; - } - } - - - @Override - public int getItemCount() { - // 多添加一个Footer - return mV2XHistoryScenarioData == null ? 0 : mV2XHistoryScenarioData.size() + 1; - } - - - /** - * Footer 视图 - */ - static class FooterViewHolder extends RecyclerView.ViewHolder { - public FooterViewHolder(@NonNull View itemView) { - super(itemView); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java deleted file mode 100644 index 823f1ba2f0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.eagle.core.utilcode.util.DateTimeUtils; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.common.view.CustomRatingBar; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.entity.panel.V2XShareEventDescription; -import com.mogo.module.v2x.entity.panel.V2XShareEventItem; -import com.mogo.module.v2x.entity.panel.V2XShareEventItemEnum; -import com.mogo.module.v2x.entity.panel.V2XShareEventLoadMoreItem; -import com.mogo.module.v2x.fragment.V2XEventPanelFragment; -import com.mogo.module.v2x.listener.AdapterCallback; -import com.mogo.service.IMogoServiceApis; -import com.mogo.eagle.core.data.constants.MogoServicePaths; - -import java.util.ArrayList; - -public class V2XShareEventAdapter extends RecyclerView.Adapter { - private Context context; - private ArrayList dataArrayList; - private final LayoutInflater shareLayoutInflater; - private IMogoServiceApis mApis; - private AdapterCallback callback; - - public V2XShareEventAdapter(Context context, ArrayList dataArrayList, AdapterCallback callback) { - this.context = context; - this.dataArrayList = dataArrayList; - this.callback = callback; - shareLayoutInflater = LayoutInflater.from(context); - mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context); - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - //根据viewType创建自定义布局 - if (viewType == V2XShareEventItemEnum.ITEM_TYPE_NUM_DES) { - View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_description, parent, - false); - shareDescriptionViewHolder holder = new shareDescriptionViewHolder(v); - return holder; - } else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST) { - View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_item, parent, - false); - shareItemViewHolder holder = new shareItemViewHolder(v); - return holder; - } else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY) { - View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_empty, parent, - false); - shareEmptyViewHolder holder = new shareEmptyViewHolder(v); - return holder; - } else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS) { - View v = shareLayoutInflater.inflate(R.layout.item_v2x_event_share_load_more, parent, - false); - shareLoadStatusViewHolder holder = new shareLoadStatusViewHolder(v); - return holder; - } else { - View v = shareLayoutInflater.inflate(R.layout.footer_nomore_view, parent, - false); - shareLoadNoMoreViewHolder holder = new shareLoadNoMoreViewHolder(v); - return holder; - } - } - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - try { - - - if (holder instanceof shareDescriptionViewHolder) { - //分享次数,车友认同次数,热心指数 - if (dataArrayList.size() > position) { - V2XShareEventDescription.ResultBean.EnthusiasmIndexBean data = (V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) dataArrayList.get(position); - if (data != null) { - String shareNum = String.valueOf(data.getShareNum()); - String likeNum = String.valueOf(data.getLikeNum()); - double enthusiasmIndex = data.getEnthusiasmIndex() <= 5 ? data.getEnthusiasmIndex() : 5; - if (shareNum != null) { - ((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum); - } - if (likeNum != null) { - ((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum); - } - ((shareDescriptionViewHolder) holder).ratingBar.setRating((float) enthusiasmIndex); - } - } - } else if (holder instanceof shareItemViewHolder) { - //分享列表 - if (dataArrayList.size() > position) { - V2XShareEventItem.ResultBean.PageBean.ContentBean data = (V2XShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position); - if (data != null) { - String poitype = data.getPoiType(); - String address = data.getUploadAddress(); - String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm); - String likeNum = String.valueOf(data.getLikeNum()); - String notLikeNum = String.valueOf(data.getNotlikeNum()); - - if (poitype != null) { - ((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeEnum.getPoiTypeStr(poitype)); - ((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeEnum.getPoiTypeBgForShareItem(poitype)); - - } - if (address != null) { - ((shareItemViewHolder) holder).caseAddressTextView.setText(address); - } - if (time != null) { - ((shareItemViewHolder) holder).caseTimeTextView.setText(time); - } - if (likeNum != null) { - ((shareItemViewHolder) holder).caseUsefulTextView.setText(likeNum); - } - if (notLikeNum != null) { - ((shareItemViewHolder) holder).caseUselessTextView.setText(notLikeNum); - } - } - - } - } - } catch (Exception e) { - - } - } - - @Override - public int getItemCount() { - return dataArrayList.size(); - } - - @Override - public int getItemViewType(int position) { - Object item = dataArrayList.get(position); - if (item instanceof V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) { - return V2XShareEventItemEnum.ITEM_TYPE_NUM_DES; - } else if (item instanceof V2XShareEventItem.ResultBean.PageBean.ContentBean) { - return V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST; - } else if (item instanceof V2XShareEventLoadMoreItem) { - return ((V2XShareEventLoadMoreItem) dataArrayList.get(position)).getViewType(); - } - return V2XShareEventItemEnum.ITEM_TYPE_OTHER; - } - - /* - * 分享列表 - * */ - class shareItemViewHolder extends RecyclerView.ViewHolder { - private TextView caseStyleTextView; - private TextView caseAddressTextView; - private TextView caseTimeTextView; - private TextView caseUsefulTextView; - private TextView caseUselessTextView; - - public shareItemViewHolder(@NonNull View itemView) { - super(itemView); - caseStyleTextView = itemView.findViewById(R.id.road_case_style); - caseAddressTextView = itemView.findViewById(R.id.road_case_address); - caseTimeTextView = itemView.findViewById(R.id.road_case_share_time); - caseUsefulTextView = itemView.findViewById(R.id.road_case_useful_num); - caseUselessTextView = itemView.findViewById(R.id.road_case_useless_num); - } - } - - /* - * 分享次数,热心指数... - * */ - class shareDescriptionViewHolder extends RecyclerView.ViewHolder { - private TextView shareNumTextView; - private TextView approveNumTextView; - private CustomRatingBar ratingBar; - - public shareDescriptionViewHolder(@NonNull View itemView) { - super(itemView); - shareNumTextView = itemView.findViewById(R.id.share_num); - approveNumTextView = itemView.findViewById(R.id.share_approve); - ratingBar = itemView.findViewById(R.id.rating_bar); - } - } - - /* - * 去分享 刷新 - * */ - class shareEmptyViewHolder extends RecyclerView.ViewHolder { - public shareEmptyViewHolder(@NonNull View itemView) { - super(itemView); - - TextView share = itemView.findViewById(R.id.share_event_button); - share.setOnClickListener(view -> { - V2XEventPanelFragment.Companion.getInstance().hidePanel(); - mApis.getShareManager().showShareDialog(); - }); - - TextView refresh = itemView.findViewById(R.id.refresh_button); - refresh.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - callback.getShareEventResponse(); - } - }); - } - } - - /* - * 加载更多/没有更多 - * */ - class shareLoadStatusViewHolder extends RecyclerView.ViewHolder { - private TextView statusButton; - - public shareLoadStatusViewHolder(@NonNull View itemView) { - super(itemView); - statusButton = itemView.findViewById(R.id.event_share_load_status); - ; - statusButton.setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(View v) { - callback.loadMoreShareEventList(); - } - }); - } - } - - /* - * 没有更多记录了 - * */ - class shareLoadNoMoreViewHolder extends RecyclerView.ViewHolder { - - public shareLoadNoMoreViewHolder(@NonNull View itemView) { - super(itemView); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSurroundingAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSurroundingAdapter.java deleted file mode 100644 index 88bade2987..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSurroundingAdapter.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.adapter.holder.V2XSurroundingViewHolder; -import com.mogo.module.v2x.entity.panel.SurroundingConstruction; -import com.mogo.module.v2x.listener.SurroundingItemClickListener; - -import java.util.List; - -/** - * @author lixiaopeng - * @description 周边 - * @since 2020/7/29 - */ -public class V2XSurroundingAdapter extends RecyclerView.Adapter { - private List mPoiInfosList; - private Context mContext; - private ImageView mBgImageView; - private ImageView mTypeImageView; - private TextView mTypeTv; - private TextView mTotalTv; - - private SurroundingItemClickListener mClickListener; - - - public V2XSurroundingAdapter(Context context, List poiInfosList, SurroundingItemClickListener clickListener) { - mContext = context; - mPoiInfosList = poiInfosList; - mClickListener = clickListener; - } - - @Override - public int getItemViewType(int position) { - return super.getItemViewType(position); - } - - @NonNull - @Override - public V2XSurroundingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View inflate = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.module_fragment_surrounding_event_item, parent, false); - return new V2XSurroundingViewHolder(inflate); - } - - @Override - public void onBindViewHolder(@NonNull V2XSurroundingViewHolder holder, final int position) { - final SurroundingConstruction surroundingConstruction = mPoiInfosList.get(position); - if (surroundingConstruction == null) { - return; - } - - mBgImageView = holder.itemView.findViewById(R.id.iv_event_bg); - mTypeImageView = holder.itemView.findViewById(R.id.iv_event_type); - mTypeTv = holder.itemView.findViewById(R.id.tv_poitype); - mTotalTv = holder.itemView.findViewById(R.id.tv_info_total); - - mTypeTv.setText(EventTypeEnum.getTypeName(surroundingConstruction.getPoiType())); - if (surroundingConstruction.getConstrutList() != null) { - mTotalTv.setText(surroundingConstruction.getConstrutList().size() + "条"); - } - - holder.itemView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mClickListener != null) { - mClickListener.onItemClickListener(v, holder.getAdapterPosition(), surroundingConstruction); - } - } - }); - - mBgImageView.setBackgroundResource(EventTypeEnum.getTypeRes(surroundingConstruction.getPoiType())); - mTypeImageView.setBackgroundResource(EventTypeEnum.getTypeSmallRes(surroundingConstruction.getPoiType())); -// RequestOptions requestOptions = new RequestOptions() -// .placeholder(R.drawable.v2x_icon_live_logo) -// .error(R.drawable.v2x_icon_live_logo) -// .fallback(R.drawable.v2x_icon_live_logo); -// Glide.with(mContext) -// .asBitmap() -// .load(getTypeSmallRes(surroundingConstruction.getPoiType())) -// .apply(requestOptions) -// .into(new SkinAbleBitmapTarget(mTypeImageView, requestOptions)); - - } - - public static int dip2px(Context context, float dpValue) { - final float scale = context.getResources().getDisplayMetrics().density; - return (int) (dpValue * scale + 0.5f); - } - - @Override - public int getItemCount() { - return mPoiInfosList == null ? 0 : mPoiInfosList.size(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSurroundingDetailAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSurroundingDetailAdapter.java deleted file mode 100644 index 3f15948f29..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSurroundingDetailAdapter.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.mogo.module.v2x.adapter; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.DateTimeUtils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.adapter.holder.V2XSurroundingDetailVH; -import com.mogo.module.v2x.listener.SurroundingDetailItemListener; -import com.mogo.module.v2x.utils.RoadConditionUtils; -import com.mogo.module.v2x.view.HeartLikeView; -import com.mogo.module.v2x.view.HeartUnLikeView; - -import java.util.List; - -/** - * @author lixiaopeng - * @description 周边详情 - * @since 2020/11/18 - */ -public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter { - private List markerExploreWays; - private Context mContext; - private TextView mTypeTv; - private TextView mAddressTv; - private TextView mUserNameTv; - private TextView mTimeTv; - private HeartLikeView mHeartLikeView; - private HeartUnLikeView mUnHeartLikeView; - - private SurroundingDetailItemListener mListener; - - public V2XSurroundingDetailAdapter(Context context, List list, SurroundingDetailItemListener listener) { - mContext = context; - markerExploreWays = list; - mListener = listener; - } - - @Override - public int getItemViewType(int position) { - return super.getItemViewType(position); - } - - @NonNull - @Override - public V2XSurroundingDetailVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View inflate = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.module_v2x_event_surrounding_detail_item, parent, false); - return new V2XSurroundingDetailVH(inflate); - } - - @Override - public void onBindViewHolder(@NonNull V2XSurroundingDetailVH holder, final int position) { - final MarkerExploreWay exploreWay = markerExploreWays.get(position); - if (exploreWay == null) { - return; - } - - mAddressTv = holder.itemView.findViewById(R.id.surrounding_road_type_address); - mUserNameTv = holder.itemView.findViewById(R.id.surrounding_username); - mTimeTv = holder.itemView.findViewById(R.id.surrounding_time); - mTypeTv = holder.itemView.findViewById(R.id.surrounding_road_type); - mHeartLikeView = holder.itemView.findViewById(R.id.surrounding_road_like); - mUnHeartLikeView = holder.itemView.findViewById(R.id.surrounding_road_unlike); - - mUserNameTv.setText( exploreWay.getUserInfo() != null ? ("用户" + exploreWay.getUserInfo().getUserName() + "分享") : "蘑菇用户分享"); - mTypeTv.setText(EventTypeEnum.getTypeName(exploreWay.getPoiType())); - mAddressTv.setText(exploreWay.getAddr()); - mTimeTv.setText(DateTimeUtils.getTimeText(exploreWay.getGenerateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm)); - - Logger.d(V2XConst.MODULE_NAME, "exploreWay.isFabulous() = " + exploreWay.isFabulous()); - showView(exploreWay.isFabulous()); - - mHeartLikeView.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈有用 position = " + position); - roadReportTrue(exploreWay); - mListener.onItemClickListener(v, position, exploreWay); - }); - - mUnHeartLikeView.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈无用 position = " + position); - roadReportErr(exploreWay); - mListener.onItemClickListener(v, position, exploreWay); - }); - } - - private void showView(boolean isAlreadyShow) { - if (isAlreadyShow) { - mHeartLikeView.setVisibility(View.GONE); - mUnHeartLikeView.setVisibility(View.GONE); - } else { - mHeartLikeView.setVisibility(View.VISIBLE); - mUnHeartLikeView.setVisibility(View.VISIBLE); - } - } - - /** - * 反馈路况正确 - */ - private void roadReportTrue(MarkerExploreWay exploreWay) { - if (exploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - exploreWay.getInfoId(), - exploreWay.getPoiType(), - 2); - } - } - - /** - * 反馈路况错误 - */ - private void roadReportErr(MarkerExploreWay exploreWay) { - if (exploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - exploreWay.getInfoId(), - exploreWay.getPoiType(), - 3); - } - } - - @Override - public int getItemCount() { - return markerExploreWays == null ? 0 : markerExploreWays.size(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XBaseViewHolder.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XBaseViewHolder.java deleted file mode 100644 index 1db04e8d75..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XBaseViewHolder.java +++ /dev/null @@ -1,271 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.util.Log; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.navi.IMogoNaviListener; -import com.mogo.map.navi.MogoNaviInfo; -import com.mogo.map.navi.MogoTraffic; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XEventZanData; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.ChartingUtil; -import com.mogo.module.v2x.utils.RoadConditionUtils; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICarsChattingProvider; -import com.zhidao.carchattingprovider.MogoDriverInfo; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * V2X展示视图公用的实现 - * - * @author donghongyu - */ -public abstract class V2XBaseViewHolder - extends RecyclerView.ViewHolder - implements IMogoNaviListener { - - private static final String TAG = "V2XBaseViewHolder"; - private ICarsChattingProvider mCarsChattingProvider; - - // 当前展示条目绑定的window - protected IV2XWindow mV2XWindow; - - public V2XBaseViewHolder(@NonNull View itemView, IV2XWindow v2XWindow) { - super(itemView); - mV2XWindow = v2XWindow; - } - - /** - * 填充View视图 - * - * @param viewData 与视图绑定的数据 - */ - public abstract void initView(T viewData); - - /** - * 延迟关闭窗体视图 - */ - public void delayedCloseWindow() { - itemView.post(() -> { - if (mV2XWindow != null) { - mV2XWindow.close(); - } - }); - } - - /** - * 点赞 - */ - public void triggerZan(MarkerExploreWay noveltyInfo) { - try { - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已点赞", null); - showTip("已点赞"); - if (noveltyInfo != null) { - // 调用网络API接口 - V2XServiceManager.getV2XMarkerService() - .getV2XRefreshModel() - .giveLikeLiveVideo(null, noveltyInfo.getSn()); - - V2XEventZanData v2XEventZanData = new V2XEventZanData(); - v2XEventZanData.setEventId(noveltyInfo.getInfoId()); - v2XEventZanData.setTriggerTime(TimeUtils.getNowMills()); - V2XSQLiteUtils.saveEventZanLocalStory(v2XEventZanData); - - - // 上报数据统计 - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_ZAN); - } - } catch (Exception e) { - e.printStackTrace(); - } - delayedCloseWindow(); - } - - public void triggerIVReportHead(MarkerExploreWay noveltyInfo) { - Log.d(TAG, "点击头像" + mCarsChattingProvider); - try { - mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(); - MogoDriverInfo mogoDriverInfo = new MogoDriverInfo(); - int ageNumber = noveltyInfo.getUserInfo().getAgeNumber(); - mogoDriverInfo.setAge(ageNumber); - String gender = noveltyInfo.getUserInfo().getGender(); - mogoDriverInfo.setGender(gender); - String sn = noveltyInfo.getUserInfo().getSn(); - mogoDriverInfo.setSn(sn != null ? sn : ""); - String name = noveltyInfo.getUserInfo().getUserName(); - mogoDriverInfo.setUserName(name != null ? name : ""); - mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead()); - if (mCarsChattingProvider != null) { - mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext()); - } - - } catch (Exception e) { - Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e); - e.printStackTrace(); - } - } - - /** - * 打电话 - */ - public void triggerCallChart(MarkerExploreWay noveltyInfo) { - try { - MarkerLocation location = new MarkerLocation(); - location.setLat(noveltyInfo.getLocation().getLat()); - location.setLon(noveltyInfo.getLocation().getLon()); - - ChartingUtil.callChatting(noveltyInfo.getUserInfo(), location); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_CHAT); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("用户信息异常"); - } - delayedCloseWindow(); - } - - /** - * 反馈路况错误 - */ - public void triggerReportErr(MarkerExploreWay noveltyInfo) { - try { - RoadConditionUtils.sendShareReceiverInfo( - noveltyInfo.getInfoId(), - noveltyInfo.getPoiType(), - 3); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_REPORT_ERROR); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("路况信息异常"); - } - delayedCloseWindow(); - } - - /** - * 反馈路况正确 - */ - public void triggerReportTrue(MarkerExploreWay noveltyInfo) { - try { - RoadConditionUtils.sendShareReceiverInfo( - noveltyInfo.getInfoId(), - noveltyInfo.getPoiType(), - 2); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_REPORT_RIGHT); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("路况信息异常"); - } - delayedCloseWindow(); - } - - /** - * 导航规划路线 - */ - public void triggerStartNavi(MarkerExploreWay noveltyInfo) { - try { - V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this); - - MogoLatLng endPoint = new MogoLatLng( - noveltyInfo.getLocation().getLat(), - noveltyInfo.getLocation().getLon()); - - V2XServiceManager.getNavi().naviTo(endPoint); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_NAVI); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("路况信息异常"); - } - delayedCloseWindow(); - } - - public void triggerCancel(){ - delayedCloseWindow(); - } - - - /** - * 显示自定义 Toast - * - * @param msg - */ - public void showTip(String msg) { - TipToast.tip(msg); - } - - @Override - public void onInitNaviFailure() { - - } - - @Override - public void onInitNaviSuccess() { - - } - - @Override - public void onNaviInfoUpdate(MogoNaviInfo naviinfo) { - - } - - @Override - public void onStartNavi() { - - } - - @Override - public void onStopNavi() { - - } - - @Override - public void onCalculateSuccess() { - Logger.w(TAG, "onCalculateSuccess"); - V2XServiceManager.getNavi().startNavi(true); - V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME); - } - - @Override - public void onoCalculateFailed() { - - } - - @Override - public void onUpdateTraffic(MogoTraffic traffic) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XEventUgcVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XEventUgcVH.java deleted file mode 100644 index 42c6abab3f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XEventUgcVH.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.commons.voice.IMogoVoiceCmdCallBack; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.share.IMogoTanluProvider; -import com.mogo.service.share.TanluUploadParams; - -import java.util.HashMap; -import java.util.Map; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : 道路事件UGC - * 需求地址 - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 - * - * @author donghongyu - */ -public class V2XEventUgcVH extends V2XBaseViewHolder { - private final String TAG = "V2XEventUgcVH"; - - // 语音控制反馈 YES - private V2XVoiceCallbackListener mFeedBackYes = (command, intent) -> manualMarkingTrafficJam(1); - // 语音控制反馈 NO - private V2XVoiceCallbackListener mFeedBackNo = (command, intent) -> manualMarkingTrafficJam(0); - - - private ImageView ivEventTypeIcon; - private TextView tvEventUgcTitle; - private ImageView ivEventReportTrue; - private ImageView ivEventReportErr; - - // 当前的新鲜事儿信息 - private MarkerExploreWay mNoveltyInfo; - private V2XRoadEventEntity mV2XRoadEventEntity; - private V2XEventShowEntity mV2XEventShowEntity; - - public V2XEventUgcVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_v2x_event_ugc, viewGroup, false) - , v2XWindow); - ivEventTypeIcon = itemView.findViewById(R.id.ivEventTypeIcon); - tvEventUgcTitle = itemView.findViewById(R.id.tvEventUgcTitle); - ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue); - ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr); - - // 设置视图状态监听 - itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow"); - } - - @Override - public void onViewDetachedFromWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow"); - unRegisterVoice(); - } - }); - } - - void unRegisterVoice() { - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP) - - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP) - - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP) - - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP); - } - - @Override - public void initView(V2XEventShowEntity v2XEventShowEntity) { - try { - Log.w(MODULE_NAME + "_" + TAG, "v2XEventShowEntity=" + GsonUtil.jsonFromObject(v2XEventShowEntity)); - if (v2XEventShowEntity == null) { - return; - } - mV2XEventShowEntity = v2XEventShowEntity; - mV2XRoadEventEntity = v2XEventShowEntity.getV2XRoadEventEntity(); - - if (mV2XRoadEventEntity == null) { - return; - } - mNoveltyInfo = mV2XRoadEventEntity.getNoveltyInfo(); - - if (mNoveltyInfo != null) { - - Object[] ugcTitleStr = EventTypeEnum.getUgcTitleStr(mNoveltyInfo.getPoiType()); - - if (ugcTitleStr != null) { - tvEventUgcTitle.setText(((String) ugcTitleStr[0]).replace("####", mNoveltyInfo.getAddr())); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice((String) ugcTitleStr[1], new IMogoVoiceCmdCallBack() { - @Override - public void onSpeakEnd(String speakText) { - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerUnWakeVoice((String) ugcTitleStr[3], mFeedBackYes) - .registerUnWakeVoice((String) ugcTitleStr[4], mFeedBackNo); - } - }); - ivEventTypeIcon.setImageResource((Integer) ugcTitleStr[2]); - - // UGC 问答数据统计 - Map properties = new HashMap<>(); - properties.put("content", (String) ugcTitleStr[1]); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ASK_ALERT, properties); - } - - - ivEventReportTrue.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - - manualMarkingTrafficJam(1); - } - }); - ivEventReportErr.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - manualMarkingTrafficJam(0); - } - }); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - // UGC 提问回答或消失 - private void dataStatistics(int result) { - Map properties = new HashMap<>(); - properties.put("result", result); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ASK_RESULT, properties); - } - - /** - * 对道路事件进行反馈 - */ - void manualMarkingTrafficJam(int status) { - unRegisterVoice(); - - if (status == 1) { - // 上报事故 - TanluUploadParams params = - new TanluUploadParams( - mNoveltyInfo.getPoiType(), - IMogoTanluProvider.UPLOAD_FROM_STRATEGY_UGC, - mNoveltyInfo.getInfoIdInt(), - new MogoLatLng(mNoveltyInfo.getLocation().getLat(), - mNoveltyInfo.getLocation().getLon()) - ); - V2XServiceManager.getTanluManager().uploadRoadCondition(params); - - dataStatistics(1); - } else if (status == 0) { - dataStatistics(2); - } - - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("谢谢,您的反馈将帮助更多车友。", null); - V2XServiceManager - .getV2XRefreshModel() - .manualMarkingTrafficJam( - mNoveltyInfo.getInfoId(), - status, - "0"); - delayedCloseWindow(); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java deleted file mode 100644 index b9af1a1155..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.util.SpanUtils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.service.Utils; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.LocationUtils; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; - -/** - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : 疲劳驾驶 - * version: 1.0 - * - * @author donghongyu - */ -public class V2XFatigueDrivingVH extends V2XBaseViewHolder { - - private TextView mTvAddress, mTvAddressDistance; - private ImageView mIvToNav, mIvClose; - private MarkerExploreWay mNoveltyInfo; - private V2XPushMessageEntity mV2XPushMessageEntity; - - // 语音控制导航 - private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo); - private V2XVoiceCallbackListener mNaviCancel = (command, intent) -> triggerCancel(); - - public V2XFatigueDrivingVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false) - , v2XWindow); - mTvAddress = itemView.findViewById(R.id.tvAddress); - mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance); - mIvToNav = itemView.findViewById(R.id.ivToNav); - mIvClose = itemView.findViewById(R.id.ivClose); - mIvToNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo)); - mIvClose.setOnClickListener(v -> delayedCloseWindow()); - - // 设置视图状态监听 - itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow"); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI, - mNaviCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP, - mNaviCb); - - V2XVoiceManager.INSTANCE - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP,mNaviCancel); - - } - - @Override - public void onViewDetachedFromWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow"); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP); - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP); - } - }); - } - - @Override - public void initView(V2XEventShowEntity v2XEventShowEntity) { - mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity(); - try { - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(mV2XPushMessageEntity.getLon()); - markerLocation.setLat(mV2XPushMessageEntity.getLat()); - mNoveltyInfo = new MarkerExploreWay(); - mNoveltyInfo.setLocation(markerLocation); - } catch (Exception e) { - e.printStackTrace(); - } - - if (!TextUtils.isEmpty(mV2XPushMessageEntity.getAddress())) { - mTvAddress.setText(mV2XPushMessageEntity.getAddress()); - } else { - mTvAddress.setText(""); - } - // 计算距离 - float calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(mV2XPushMessageEntity.getLat(), mV2XPushMessageEntity.getLon()), - LocationUtils.getCurrentLatLon() - ); - mV2XPushMessageEntity.setDistance(calculateDistance); - - SpanUtils.with(mTvAddressDistance) - .append("" + (int) mV2XPushMessageEntity.getDistance()) - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text)) - .append("米") - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title)) - .create(); - } - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XHistoryBaseViewHolder.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XHistoryBaseViewHolder.java deleted file mode 100644 index 2adb521132..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XHistoryBaseViewHolder.java +++ /dev/null @@ -1,255 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.navi.IMogoNaviListener; -import com.mogo.map.navi.MogoNaviInfo; -import com.mogo.map.navi.MogoTraffic; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.utils.ChartingUtil; -import com.mogo.module.v2x.utils.RoadConditionUtils; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICarsChattingProvider; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * 出行动态 - * - * @author donghongyu - */ -public abstract class V2XHistoryBaseViewHolder - extends RecyclerView.ViewHolder - implements IMogoNaviListener { - - private static final String TAG = "V2XBaseViewHolder"; - private ICarsChattingProvider mCarsChattingProvider; - - - public V2XHistoryBaseViewHolder(@NonNull View itemView) { - super(itemView); - } - - /** - * 填充View视图 - * - * @param viewData 与视图绑定的数据 - */ - public abstract void initView(T viewData); - - /** - * 延迟关闭窗体视图 - */ - public void delayedCloseWindow() { - - } - - /** - * 点赞 - */ - public void triggerZan(MarkerExploreWay noveltyInfo) { - try { - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已点赞", null); - showTip("已点赞"); - if (noveltyInfo != null) { - // 调用网络API接口 - V2XServiceManager.getV2XMarkerService() - .getV2XRefreshModel() - .giveLikeLiveVideo(null, noveltyInfo.getSn()); - - V2XEventZanData v2XEventZanData = new V2XEventZanData(); - v2XEventZanData.setEventId(noveltyInfo.getInfoId()); - v2XEventZanData.setTriggerTime(TimeUtils.getNowMills()); - V2XSQLiteUtils.saveEventZanLocalStory(v2XEventZanData); - - - // 上报数据统计 - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_ZAN); - } - } catch (Exception e) { - e.printStackTrace(); - } - delayedCloseWindow(); - } - - public void triggerIVReportHead(MarkerExploreWay noveltyInfo) { - Log.d(TAG, "点击头像" + mCarsChattingProvider); - try { - mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(); - MogoDriverInfo mogoDriverInfo = new MogoDriverInfo(); - int ageNumber = noveltyInfo.getUserInfo().getAgeNumber(); - mogoDriverInfo.setAge(ageNumber); - String gender = noveltyInfo.getUserInfo().getGender(); - mogoDriverInfo.setGender(gender); - String sn = noveltyInfo.getUserInfo().getSn(); - mogoDriverInfo.setSn(sn != null ? sn : ""); - String name = noveltyInfo.getUserInfo().getUserName(); - mogoDriverInfo.setUserName(name != null ? name : ""); - mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead()); - if (mCarsChattingProvider != null) { - mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext()); - } - - } catch (Exception e) { - Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e); - e.printStackTrace(); - } - } - - /** - * 打电话 - */ - public void triggerCallChart(MarkerExploreWay noveltyInfo) { - try { - MarkerLocation location = new MarkerLocation(); - location.setLat(noveltyInfo.getLocation().getLat()); - location.setLon(noveltyInfo.getLocation().getLon()); - - ChartingUtil.callChatting(noveltyInfo.getUserInfo(), location); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_CHAT); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("用户信息异常"); - } - delayedCloseWindow(); - } - - /** - * 反馈路况错误 - */ - public void triggerReportErr(MarkerExploreWay noveltyInfo) { - try { - RoadConditionUtils.sendShareReceiverInfo( - noveltyInfo.getInfoId(), - noveltyInfo.getPoiType(), - 3); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_REPORT_ERROR); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("路况信息异常"); - } - delayedCloseWindow(); - } - - /** - * 反馈路况正确 - */ - public void triggerReportTrue(MarkerExploreWay noveltyInfo) { - try { - RoadConditionUtils.sendShareReceiverInfo( - noveltyInfo.getInfoId(), - noveltyInfo.getPoiType(), - 2); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_REPORT_RIGHT); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("路况信息异常"); - } - delayedCloseWindow(); - } - - /** - * 导航规划路线 - */ - public void triggerStartNavi(MarkerExploreWay noveltyInfo) { - try { - V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this); - - MogoLatLng endPoint = new MogoLatLng( - noveltyInfo.getLocation().getLat(), - noveltyInfo.getLocation().getLon()); - - V2XServiceManager.getNavi().naviTo(endPoint); - - TrackUtils.trackV2xRoadEvent( - noveltyInfo.getInfoId(), - noveltyInfo.getSn(), - V2XConst.V2X_ROAD_NAVI); - } catch (Exception e) { - e.printStackTrace(); - TipToast.tip("路况信息异常"); - } - delayedCloseWindow(); - } - - - /** - * 显示自定义 Toast - * - * @param msg - */ - public void showTip(String msg) { - TipToast.tip(msg); - } - - @Override - public void onInitNaviFailure() { - - } - - @Override - public void onInitNaviSuccess() { - - } - - @Override - public void onNaviInfoUpdate(MogoNaviInfo naviinfo) { - - } - - @Override - public void onStartNavi() { - - } - - @Override - public void onStopNavi() { - - } - - @Override - public void onCalculateSuccess() { - Logger.w(TAG, "onCalculateSuccess"); - V2XServiceManager.getNavi().startNavi(true); - V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME); - } - - @Override - public void onoCalculateFailed() { - - } - - @Override - public void onUpdateTraffic(MogoTraffic traffic) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java deleted file mode 100644 index 496ea9d097..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.RoadConditionUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.module.v2x.view.HeartLikeView; -import com.mogo.module.v2x.view.HeartUnLikeView; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : 违章停车弹窗 - * version: 1.0 - * - * @author donghongyu - */ -public class V2XIllegalParkVH extends V2XBaseViewHolder { - private TextView mAddressTv; - private TextView mIllegalNumTv; - private HeartLikeView mIlIllegalParkingLike; - private HeartUnLikeView mIIllegalParkingUnLike; - - private MarkerExploreWay mExploreWay; - - // 反馈按钮语音操控 - private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue(); - private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr(); - - public V2XIllegalParkVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.layout.item_v2x_illegal_parking_vr : - R.layout.item_v2x_illegal_parking, viewGroup, false) - , v2XWindow); - - mAddressTv = itemView.findViewById(R.id.tvAddress); - mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum); - mIlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike); - mIIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike); - - // 设置视图状态监听 - itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow"); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP, - v2XVoiceCallbackYouYongListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP, - v2XVoiceCallbackMeiYongListener); - } - - @Override - public void onViewDetachedFromWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow"); - V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP); - } - }); - } - - @Override - public void initView(V2XEventShowEntity v2XEventShowEntity) { - mExploreWay = v2XEventShowEntity.getV2XIllegalPark(); - mAddressTv.setText(mExploreWay.getAddr()); - try { - mIllegalNumTv.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount()); - } catch (Exception e) { - e.printStackTrace(); - } - - mIlIllegalParkingLike.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈有用"); - roadReportTrue(); - }); - - mIIllegalParkingUnLike.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈无用"); - roadReportErr(); - }); - } - - /** - * 延迟关闭窗体 - */ - @Override - public void delayedCloseWindow() { - V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); - v2XHistoryScenarioData.setScenarioType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING); - v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(mExploreWay)); - v2XHistoryScenarioData.setEventJsonDataHashCode(mExploreWay.hashCode()); - V2XSQLiteUtils.updateScenarioHistoryDataIsDispose(v2XHistoryScenarioData); - super.delayedCloseWindow(); - } - - /** - * 反馈路况正确 - */ - private void roadReportTrue() { - if (mExploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - mExploreWay.getInfoId(), - mExploreWay.getPoiType(), - 2); - } - if (!V2XServiceManager.getMoGoStatusManager().isVrMode()) { - delayedCloseWindow(); - } else { - mIlIllegalParkingLike.setClickable(false); - } - } - - /** - * 反馈路况错误 - */ - private void roadReportErr() { - if (mExploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - mExploreWay.getInfoId(), - mExploreWay.getPoiType(), - 3); - } - if (!V2XServiceManager.getMoGoStatusManager().isVrMode()) { - delayedCloseWindow(); - } else { - mIIllegalParkingUnLike.setClickable(false); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java deleted file mode 100644 index 04e845e93f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.LayoutInflater; -import android.view.ViewGroup; - -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XLiveCarInfoEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.module.v2x.view.V2XLiveGSYVideoView; -import com.mogo.service.imageloader.MogoImageView; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : 直播类型的卡片 - * version: 1.0 - * - * @author donghongyu - */ -public class V2XLiveVideoVH extends V2XBaseViewHolder { - - private V2XLiveGSYVideoView videoPlayer; - private MogoImageView ivReportHead; - - // 上传事件的用户信息 - private MarkerUserInfo mUserInfo = new MarkerUserInfo(); - // 直播车机数据 - private V2XLiveCarInfoEntity mV2XLiveCarEntity; - // 预警的道路事件数据 - private V2XRoadEventEntity mV2XRoadEventEntity; - - public V2XLiveVideoVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.layout.item_v2x_live_video_vr : R.layout.item_v2x_live_video, viewGroup, false), v2XWindow); - videoPlayer = itemView.findViewById(R.id.videoPlayer); - ivReportHead = itemView.findViewById(R.id.ivReportHead); - } - - @Override - public void initView(V2XEventShowEntity v2XLiveCarEntity) { - mV2XRoadEventEntity = v2XLiveCarEntity.getV2XRoadEventEntity(); - mV2XLiveCarEntity = v2XLiveCarEntity.getV2XLiveCarInfoRes(); - initView(mV2XLiveCarEntity); - } - - public void initView(V2XLiveCarInfoEntity v2XLiveCarEntity) { - mV2XLiveCarEntity = v2XLiveCarEntity; - // 由于车机自身推流的原因,这里为了浪费用户不必要的流量,用户滑动到了那个view展示了再进行直播信息的获取及展示 - MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo(); - carLiveInfo.setVideoSn(v2XLiveCarEntity.getSn()); - videoPlayer.setCarLiveInfo(carLiveInfo); - TrackUtils.trackV2xRoadEvent(mV2XRoadEventEntity.getNoveltyInfo().getInfoId(), v2XLiveCarEntity.getSn(), V2XConst.V2X_ROAD_VIDEO); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java deleted file mode 100644 index 593a35826d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.content.Context; -import android.content.res.Resources; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.request.RequestOptions; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform; -import com.mogo.eagle.core.utilcode.util.SpanUtils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.ChartingUtil; -import com.mogo.module.v2x.utils.V2XUtils; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.imageloader.MogoImageView; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -import static android.view.View.GONE; -import static android.view.View.VISIBLE; - -/** - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : 他人故障求助Window - * version: 1.0 - * - * @author donghongyu - */ -public class V2XOtherSeekHelpVH extends V2XBaseViewHolder { - - private Context mContext; - private MogoImageView ivHead; - private TextView tvName; - private TextView tvDistance; - private TextView tvEventTime; - private ImageView ivCall; - private ImageView ivNavi; - - private V2XPushMessageEntity mV2XPushMessageEntity; - private MarkerExploreWay mNoveltyInfo; - - // 上传事件的用户信息 - private MarkerUserInfo mUserInfo = new MarkerUserInfo(); - // 语音控制导航 - private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo); - // 语音控制拨打电话 - private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> { - try { - mNoveltyInfo.setUserInfo(mUserInfo); - triggerCallChart(mNoveltyInfo); - } catch (Exception e) { - e.printStackTrace(); - } - }; - // 查看车辆信息 - private V2XVoiceCallbackListener mVoiceOpenCarInfoLis = ((command, intent) -> triggerIVReportHead(mNoveltyInfo)); - - public V2XOtherSeekHelpVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.layout.item_v2x_fault_help_vr : - R.layout.item_v2x_fault_help, viewGroup, false) - , v2XWindow); - mContext = viewGroup.getContext(); - ivHead = itemView.findViewById(R.id.ivFaultHelpHead); - tvName = itemView.findViewById(R.id.tvFaultHelpName); - tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance); - tvEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime); - ivCall = itemView.findViewById(R.id.ivFaultHelpEventCall); - ivNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi); - ivNavi.setOnClickListener(v -> { - triggerStartNavi(mNoveltyInfo); - V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn()); - }); - - // 设置视图状态监听 - itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow"); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI, - mNaviCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP, - mNaviCb) - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING, - mCallChartingCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP, - mCallChartingCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP, - mVoiceOpenCarInfoLis); - } - - @Override - public void onViewDetachedFromWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow"); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP); - } - }); - } - - @Override - public void initView(V2XEventShowEntity v2XEventShowEntity) { - mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity(); - try { - mUserInfo.setSn(mV2XPushMessageEntity.getSn()); - mUserInfo.setUserHead(mV2XPushMessageEntity.getHeadImgUrl()); - mUserInfo.setUserName(mV2XPushMessageEntity.getDisplayName()); - mUserInfo.setGender(mV2XPushMessageEntity.getSex()); - mUserInfo.setAge(30); - - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(mV2XPushMessageEntity.getLon()); - markerLocation.setLat(mV2XPushMessageEntity.getLat()); - mNoveltyInfo = new MarkerExploreWay(); - mNoveltyInfo.setLocation(markerLocation); - mNoveltyInfo.setUserInfo(mUserInfo); - } catch (Exception e) { - e.printStackTrace(); - } - - // M1低配车机限制 - // 不展示打电话按钮 - // 不能查看用户详情 - if (DebugConfig.isMapBased()) { - ivHead.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - triggerIVReportHead(mNoveltyInfo); - } - }); - // 只有自研车机才会 有车聊聊通话 - if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) { - // 判断是否可以打电话 - ChartingUtil.isCanCall(b -> { - if (b) { - // 判断是否可以打电话 - ChartingUtil.isOnLine(mV2XPushMessageEntity.getSn(), b1 -> { - if (b1) { - ivCall.setVisibility(VISIBLE); - } else { - ivCall.setVisibility(GONE); - } - }); - } else { - ivCall.setVisibility(GONE); - } - }); - - ivCall.setOnClickListener(v -> { - V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn()); - if (!V2XUtils.isFastClick()) { - try { - triggerCallChart(mNoveltyInfo); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - } - try { - if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) { - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - Glide.with(mContext).load(mV2XPushMessageEntity.getHeadImgUrl()).apply(RequestOptions.bitmapTransform( - new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivHead); - } else { - V2XServiceManager.getImageLoader() - .displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead); - } - } - tvName.setText(mV2XPushMessageEntity.getDisplayName()); - - if (mV2XPushMessageEntity.getDistance() > 1000) { - SpanUtils.with(tvDistance) - .append("" + (int) mV2XPushMessageEntity.getDistance() / 1000) - .setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.module_v2x_fault_help_distance_text_size : R.dimen.module_v2x_event_distance_text)) - .append("公里") - .setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title)) - .create(); - } else { - SpanUtils.with(tvDistance) - .append("" + (int) mV2XPushMessageEntity.getDistance()) - .setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.module_v2x_fault_help_distance_text_size : R.dimen.module_v2x_event_distance_text)) - .append("米") - .setFontSize((int) itemView.getResources().getDimension( - V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title)) - .create(); - } - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA); - String eventTime = String.format("%s发布求助信息", - sdf.format(new Date(mV2XPushMessageEntity.getCreateTime()))); - tvEventTime.setText(eventTime); - - } catch (Resources.NotFoundException e) { - e.printStackTrace(); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java deleted file mode 100644 index 61f553babb..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; - -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.imageloader.MogoImageView; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : TODO 这里是前瞻演示需求,推送的消息, - * version: 1.0 - * - * @author donghongyu - */ -public class V2XPushEventVH extends V2XBaseViewHolder { - private MogoImageView ivImg; - private MogoImageView ivReportHead; - - // 控制按钮 - private ImageView ivRoadReportTrue; - private ImageView ivRoadReportErr; - private ImageView ivRoadCallChart; - private ImageView ivRoadEventNav; - private ImageView ivRoadEventLike; - - // 上传事件的用户信息 - private MarkerUserInfo mUserInfo = new MarkerUserInfo(); - - private V2XPushMessageEntity mV2XRoadEventEntity; - private MarkerExploreWay mNoveltyInfo; - - // 语音控制导航 - private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo); - // 语音控制拨打电话 - private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> { - try { - mUserInfo.setSn(mV2XRoadEventEntity.getSn()); - mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl()); - mUserInfo.setUserName("蘑菇用户"); - mUserInfo.setGender("男"); - mUserInfo.setAge(30); - mNoveltyInfo.setUserInfo(mUserInfo); - triggerCallChart(mNoveltyInfo); - } catch (Exception e) { - e.printStackTrace(); - } - }; - // 点赞语音回调 - private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = (command, intent) -> triggerZan(mNoveltyInfo); - - public V2XPushEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_v2x_push_event_detail, viewGroup, false) - , v2XWindow); - ivImg = itemView.findViewById(R.id.ivImg); - ivReportHead = itemView.findViewById(R.id.ivReportHead); - - ivRoadReportTrue = itemView.findViewById(R.id.ivRoadReportTrue); - ivRoadReportErr = itemView.findViewById(R.id.ivRoadReportErr); - ivRoadCallChart = itemView.findViewById(R.id.ivRoadCallChart); - ivRoadEventNav = itemView.findViewById(R.id.ivRoadEventNav); - ivRoadEventLike = itemView.findViewById(R.id.ivRoadEventLike); - - ivRoadEventNav.getParent().getParent().requestDisallowInterceptTouchEvent(true); - ivRoadEventNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo)); - ivRoadCallChart.setOnClickListener(v -> { - try { - mUserInfo.setSn(mV2XRoadEventEntity.getSn()); - mUserInfo.setUserHead(mV2XRoadEventEntity.getHeadImgUrl()); - mUserInfo.setUserName("蘑菇用户"); - mUserInfo.setGender("男"); - mUserInfo.setAge(30); - mNoveltyInfo.setUserInfo(mUserInfo); - triggerCallChart(mNoveltyInfo); - } catch (Exception e) { - e.printStackTrace(); - } - }); - ivRoadEventLike.setOnClickListener(v -> triggerZan(mNoveltyInfo)); - - // 设置视图状态监听 - itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow"); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI, - mNaviCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP, - mNaviCb) - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING, - mCallChartingCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP, - mCallChartingCb) - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN, - v2XVoiceCallbackLickListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP, - v2XVoiceCallbackLickListener); - } - - @Override - public void onViewDetachedFromWindow(View v) { - //Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow"); - V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR) - .unRegisterPagingCallback(); - } - }); - } - - @Override - public void initView(V2XEventShowEntity v2XEventShowEntity) { - mV2XRoadEventEntity = v2XEventShowEntity.getV2XPushMessageEntity(); - mNoveltyInfo = new MarkerExploreWay(); - mNoveltyInfo.setSn(mV2XRoadEventEntity.getSn()); - mNoveltyInfo.setInfoId(mV2XRoadEventEntity.getSceneId()); - MarkerLocation location = new MarkerLocation(); - location.setLat(mV2XRoadEventEntity.getLat()); - location.setLon(mV2XRoadEventEntity.getLon()); - mNoveltyInfo.setLocation(location); - - if (!TextUtils.isEmpty(mV2XRoadEventEntity.getMsgImgUrl())) { - V2XServiceManager.getImageLoader() - .displayImage(mV2XRoadEventEntity.getMsgImgUrl(), ivImg); - } - if (!TextUtils.isEmpty(mV2XRoadEventEntity.getHeadImgUrl())) { - V2XServiceManager.getImageLoader() - .displayImage(mV2XRoadEventEntity.getHeadImgUrl(), ivReportHead); - } - - switch (mV2XRoadEventEntity.getSceneId()) { - case "100015"://取快递 - case "100016"://顺风车 - ivRoadEventNav.setVisibility(View.VISIBLE); - ivRoadCallChart.setVisibility(View.VISIBLE); - ivRoadReportTrue.setVisibility(View.GONE); - ivRoadReportErr.setVisibility(View.GONE); - ivRoadEventLike.setVisibility(View.GONE); - break; - - case "100017"://政府公告 - case "100018"://故障车辆推送 - ivRoadEventLike.setVisibility(View.VISIBLE); - ivRoadCallChart.setVisibility(View.GONE); - ivRoadEventNav.setVisibility(View.GONE); - ivRoadReportTrue.setVisibility(View.GONE); - ivRoadReportErr.setVisibility(View.GONE); - break; - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRecommendRouteVH.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRecommendRouteVH.kt deleted file mode 100644 index a6afb1e7e9..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRecommendRouteVH.kt +++ /dev/null @@ -1,92 +0,0 @@ -package com.mogo.module.v2x.adapter.holder - -import android.content.Intent -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import com.mogo.commons.voice.AIAssist -import com.mogo.commons.voice.VoicePreemptType -import com.mogo.eagle.core.utilcode.util.Utils -import com.mogo.module.common.entity.MarkerExploreWay -import com.mogo.module.common.entity.MarkerLocation -import com.mogo.module.common.entity.V2XEventShowEntity -import com.mogo.module.v2x.R -import com.mogo.module.v2x.scenario.view.IV2XWindow -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener -import com.mogo.module.v2x.voice.V2XVoiceConstants -import com.mogo.module.v2x.voice.V2XVoiceManager.registerUnWakeVoice -import com.mogo.module.v2x.voice.V2XVoiceManager.unRegisterUnWakeVoice -import kotlinx.coroutines.MainScope -import kotlinx.coroutines.cancel -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch - -/** - * created by wujifei on 2020/12/31 16:10 - * describe: - */ -class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XBaseViewHolder( - LayoutInflater.from(viewGroup.context).inflate(R.layout.item_v2x_recommend_route, viewGroup, false), v2XWindow), V2XVoiceCallbackListener { - private var mTvAddress: TextView? = null - private var mIvToNav: ImageView? = null - private var mIvClose: ImageView? = null - private var mNoveltyInfo: MarkerExploreWay? = null - private val mainScope = MainScope() - - init { - mTvAddress = itemView.findViewById(R.id.tvAddress) - mIvToNav = itemView.findViewById(R.id.ivToNav) - mIvClose = itemView.findViewById(R.id.ivClose) - mIvToNav?.setOnClickListener { triggerStartNavi(mNoveltyInfo) } - mIvClose?.setOnClickListener { delayedCloseWindow() } - itemView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener { - override fun onViewAttachedToWindow(view: View) { - registerUnwakeNavi() - mainScope.launch { - delay(1000 * 20) - delayedCloseWindow() - } - } - - override fun onViewDetachedFromWindow(view: View) { - unRegisterUnwakeNavi() - AIAssist.getInstance(Utils.getApp()).breakOffSpeak() - mainScope.cancel() - } - }) - } - - - override fun initView(viewData: V2XEventShowEntity?) { - viewData?.let { - val markerLocation = MarkerLocation() - markerLocation.lon = it.getV2XRecommendRouteEntity().toPoint.get(0) - markerLocation.lat = it.getV2XRecommendRouteEntity().toPoint.get(1) - mNoveltyInfo = MarkerExploreWay() - mNoveltyInfo?.setLocation(markerLocation) - mTvAddress!!.text = "前往 ${it.getV2XRecommendRouteEntity().formatAddress}" - AIAssist.getInstance(Utils.getApp()).speakTTSVoice(it.getV2XRecommendRouteEntity().tts, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null) - } - - } - - override fun onCallback(command: String?, intent: Intent?) { - when (command) { - V2XVoiceConstants.V2X_CONFIRM_ACTION -> triggerStartNavi(mNoveltyInfo) - V2XVoiceConstants.V2X_CANCLE_ACTION -> delayedCloseWindow() - } - } - - - private fun registerUnwakeNavi() { - registerUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION, this) - registerUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION, this) - } - - private fun unRegisterUnwakeNavi() { - unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION) - unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION) - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java deleted file mode 100644 index 5b1588451f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ /dev/null @@ -1,527 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import static android.view.View.GONE; -import static android.view.View.VISIBLE; -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -import android.content.Context; -import android.content.Intent; -import android.os.Handler; -import android.text.TextUtils; -import android.util.Log; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.WindowManager; -import android.widget.ImageView; -import android.widget.TextView; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.request.RequestOptions; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.enums.WarningDirectionEnum; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.DateTimeUtils; -import com.mogo.module.common.animation.BezierAnimationView; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XLiveCarInfoEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.common.wm.WindowManagerView; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XUserInfoRes; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarScenario; -import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventWindow; -import com.mogo.module.v2x.scenario.scene.road.V2XRoadVideoCarScenario; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.ChartingUtil; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.module.v2x.view.HeartLikeView; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.imageloader.MogoImageView; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:35 PM - * desc : 道路事件详情 - * version: 1.0 - * - * @author donghongyu - */ -public class V2XRoadEventVH extends V2XBaseViewHolder { - private static final String TAG = "V2XRoadEventVH"; - private Context mContext; - private MogoImageView ivEventImg; - private MogoImageView ivReportHead; - private ImageView ivEventPlay; - - // 控制按钮 - private TextView tvEventTypeTitle; - private TextView tvEventAddress; - private TextView tvEventDistance; - private TextView tvEventTime; - private ImageView ivEventLive; - private ImageView ivEventCallChart; - private ImageView ivEventReportTrue; - private ImageView ivEventReportErr; - private HeartLikeView ivEventZan; - - private WindowManagerView mWindowManagerView; - - // 上传事件的用户信息 - private MarkerUserInfo mUserInfo; - // 当前的新鲜事儿信息 - private MarkerExploreWay mNoveltyInfo; - private V2XRoadEventEntity mV2XRoadEventEntity; - private V2XEventShowEntity mV2XEventShowEntity; - - // 拨打车聊聊语音回调 - private V2XVoiceCallbackListener v2XVoiceCallbackCallListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - triggerCallChart(mNoveltyInfo); - } - }; - // 点赞语音回调 - private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - triggerZan(mNoveltyInfo); - } - }; - // 反馈"正确"语音回调 - private V2XVoiceCallbackListener v2XVoiceCallbackReportTrueListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - triggerReportTrue(mNoveltyInfo); - } - }; - // 反馈"错误"语音回调 - private V2XVoiceCallbackListener v2XVoiceCallbackReportErrorListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - triggerReportErr(mNoveltyInfo); - } - }; - // 反馈"错误"语音回调 - private V2XVoiceCallbackListener v2XVoiceOpenLiveListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - showLiveCar(mV2XEventShowEntity); - } - }; - // 查看车辆信息 - private V2XVoiceCallbackListener v2xVoiceOpenCarInfoListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - triggerIVReportHead(mNoveltyInfo); - } - }; - - private MogoImageView ivEvent; - private TextView tvEvent; - private ImageView ivPlay; - private TextView tvLine; - private TextView tvPlay; - - - private void init(View itemView) { - ivEventImg = itemView.findViewById(R.id.ivEventImg); - ivReportHead = itemView.findViewById(R.id.ivEventHead); - ivEventPlay = itemView.findViewById(R.id.ivEventPlay); - tvEventTypeTitle = itemView.findViewById(R.id.tvEventTypeTitle); - tvEventAddress = itemView.findViewById(R.id.tvEventAddress); - tvEventDistance = itemView.findViewById(R.id.tvEventDistance); - tvEventTime = itemView.findViewById(R.id.tvEventTime); - ivEventLive = itemView.findViewById(R.id.ivEventLive); - ivEventCallChart = itemView.findViewById(R.id.ivEventCallChart); - ivEventZan = itemView.findViewById(R.id.ivEventZan); - ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue); - ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr); - - ivEvent = itemView.findViewById(R.id.iv_event); - tvEvent = itemView.findViewById(R.id.tv_event); - ivPlay = itemView.findViewById(R.id.iv_play); - tvLine = itemView.findViewById(R.id.tv_line); - tvPlay = itemView.findViewById(R.id.tv_play); - } - - public V2XRoadEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false) : - LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false) - , v2XWindow); - mContext = viewGroup.getContext(); - init(itemView); - // 设置视图状态监听 - itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { - @Override - public void onViewAttachedToWindow(View v) { -// Logger.w(MODULE_NAME, "列表View V2XRoadEventDetailVH 触发 onViewAttachedToWindow"); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING, - v2XVoiceCallbackCallListener) - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN, - v2XVoiceCallbackLickListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP, - v2XVoiceCallbackCallListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP, - v2XVoiceCallbackLickListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE, - v2XVoiceCallbackReportTrueListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR, - v2XVoiceCallbackReportErrorListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP, - v2xVoiceOpenCarInfoListener); - } - - @Override - public void onViewDetachedFromWindow(View v) { - Log.d(TAG, "onViewDetachedFromWindow unRegister"); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP); - } - }); - } - - @Override - public void initView(V2XEventShowEntity v2XEventShowEntity) { - try { - if (v2XEventShowEntity == null) { - return; - } - mV2XEventShowEntity = v2XEventShowEntity; - mV2XRoadEventEntity = v2XEventShowEntity.getV2XRoadEventEntity(); - - if (mV2XRoadEventEntity == null) { - return; - } - mNoveltyInfo = mV2XRoadEventEntity.getNoveltyInfo(); - if (mNoveltyInfo != null) { - mUserInfo = mNoveltyInfo.getUserInfo(); - if (!ArrayUtils.isEmpty(mNoveltyInfo.getItems())) { - String imgUrl = mNoveltyInfo.getItems().get(0).getThumbnail(); - String url = mNoveltyInfo.getItems().get(0).getUrl(); - if (TextUtils.isEmpty(imgUrl)) { - imgUrl = mNoveltyInfo.getItems().get(0).getUrl(); - } - if (!TextUtils.isEmpty(imgUrl)) { - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform( - new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg); - } else { - V2XServiceManager.getImageLoader() - .displayImage(imgUrl, ivEventImg); - } - } - if (url.contains(".mp4")) { - ivEventImg.setOnClickListener(v -> { - showRoadVideoInfo(v2XEventShowEntity); - }); - ivPlay.setVisibility(VISIBLE); - tvLine.setVisibility(VISIBLE); - tvPlay.setVisibility(VISIBLE); - tvPlay.setOnClickListener(v -> { - showRoadVideoInfo(v2XEventShowEntity); - }); - ivEventPlay.setOnClickListener(v -> { - showRoadVideoInfo(v2XEventShowEntity); - }); - ivEventPlay.setVisibility(VISIBLE); - } else { - ivEventImg.setOnClickListener(null); - ivEventPlay.setOnClickListener(null); - ivEventPlay.setVisibility(GONE); - ivPlay.setVisibility(GONE); - tvLine.setVisibility(GONE); - tvPlay.setVisibility(GONE); - } - } - if (mNoveltyInfo.getUserInfo() != null && - !TextUtils.isEmpty(mNoveltyInfo.getUserInfo().getUserHead())) { - V2XServiceManager.getImageLoader() - .displayImage(mNoveltyInfo.getUserInfo().getUserHead(), ivReportHead); - } - - String poiType = EventTypeEnum.getPoiTypeStr(mNoveltyInfo.getPoiType()); - if (!TextUtils.isEmpty(poiType)) { - tvEventTypeTitle.setText(poiType); - tvEventTypeTitle.setBackgroundResource(EventTypeEnum.getPoiTypeBg(mNoveltyInfo.getPoiType(), - V2XServiceManager.getMoGoStatusManager().isVrMode())); - - } - ivEvent.setImageResource(EventTypeEnum.getPoiTypeSrcVr(mNoveltyInfo.getPoiType())); - tvEvent.setText(EventTypeEnum.getPoiTypeStrVr(mNoveltyInfo.getPoiType())); - if (EventTypeEnum.FOURS_FOG.getPoiType().equals(mNoveltyInfo.getPoiType())) { - V2XServiceManager.getDisplayEffectsManager().displayEffects(EventTypeEnum.FOURS_FOG.getPoiType()); - CallerHmiManager.INSTANCE.showWarning(WarningDirectionEnum.ALERT_WARNING_TOP); - } - tvEventAddress.setText(mNoveltyInfo.getAddr()); - tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "米"); - - Calendar c = Calendar.getInstance(); - c.setTimeInMillis(mNoveltyInfo.getGenerateTime()); - String eventTime = DateTimeUtils.printCalendarByPattern(c, "yyyy/MM/dd HH:mm"); - if (!TextUtils.isEmpty(eventTime)) { - tvEventTime.setText(eventTime); - } - - if (!ArrayUtils.isEmpty(mV2XEventShowEntity.getV2XLiveCarList())) { - ivEventLive.setVisibility(VISIBLE); - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_LIVE_ROAD, - v2XVoiceOpenLiveListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP, - v2XVoiceOpenLiveListener); - ivEventLive.setOnClickListener(v -> { - showLiveCar(v2XEventShowEntity); - }); - } else { - ivEventLive.setVisibility(GONE); - } - - ivEventReportTrue.setVisibility(GONE); - ivEventReportErr.setVisibility(GONE); - - if (V2XSQLiteUtils.isZanEvent(mNoveltyInfo.getInfoId())) { - ivEventZan.setVisibility(GONE); - } else { - ivEventZan.setVisibility(VISIBLE); - } - - // 用户上报的才会展示拨打电话 - if (!TextUtils.isEmpty(mNoveltyInfo.getUploadType()) - && mNoveltyInfo.getUploadType().equals("1")) { - requestUserInfo(mNoveltyInfo); - } - - ivEventReportTrue.setOnClickListener(v -> { - triggerReportTrue(mNoveltyInfo); - }); - ivEventReportErr.setOnClickListener(v -> { - triggerReportErr(mNoveltyInfo); - }); - ivEventCallChart.setOnClickListener(v -> { - ivEventCallChart.setVisibility(GONE); - triggerCallChart(mNoveltyInfo); - }); - - ivEventZan.setOnClickCallListener(v -> { - triggerZan(mNoveltyInfo); - }); - - ivReportHead.setOnClickListener(v -> { - triggerIVReportHead(mNoveltyInfo); - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * 展示事件的图片/视频资源 - * */ - private void showRoadVideoInfo(V2XEventShowEntity v2XEventShowEntity) { - if (v2XEventShowEntity != null) { - /* - * MarkerExploreWay 具体事件 - * V2XRoadEventEntity 包含MarkerExploreWay 事件的二次封装(tts播报内容 事件类型等) - * V2XMessageEntity 三次封装(是否进行事件与本机连线 是否显示通话功能等) - * V2XEventShowEntity 包含V2XRoadEventEntity - * */ - Log.d(TAG, "马上展示图片/视频资源全屏"); - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setContent(v2XEventShowEntity); - V2XRoadVideoCarScenario.getInstance().init(v2XMessageEntity); - } - } - - /** - * 展示直播信息 - * - * @param v2XEventShowEntity - */ - private void showLiveCar(V2XEventShowEntity v2XEventShowEntity) { - if (v2XEventShowEntity != null) { - // 展示周边的直播车辆 - List eventShowEntityArrayList = new ArrayList<>(); - for (V2XLiveCarInfoEntity v2XLiveCarInfoRes : v2XEventShowEntity.getV2XLiveCarList()) { - V2XEventShowEntity showEntity = new V2XEventShowEntity(); - showEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING); - showEntity.setV2XLiveCarInfoRes(v2XLiveCarInfoRes); - showEntity.setV2XRoadEventEntity(mV2XRoadEventEntity); - eventShowEntityArrayList.add(showEntity); - } - - Logger.d(MODULE_NAME, "要展示的直播:" + GsonUtil.jsonFromObject(eventShowEntityArrayList)); - V2XMessageEntity> v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING); - v2XMessageEntity.setContent(eventShowEntityArrayList); - v2XMessageEntity.setShowState(true); - V2XRoadLiveCarScenario.getInstance().init(v2XMessageEntity); - - // 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时 - if (mV2XWindow != null) { - if (mV2XWindow instanceof V2XRoadEventWindow) { - ((V2XRoadEventWindow) mV2XWindow).stopCountDown(); - } - } - } - } - - private void bezierAnimation(int[] loc) { - if (mWindowManagerView == null) { - Log.d(TAG, "bezierAnimation:null"); - mWindowManagerView = new WindowManagerView.Builder(mContext.getApplicationContext()) - .contentView(R.layout.module_common_bezier_layout) - .size(WindowManager.LayoutParams.WRAP_CONTENT, - WindowManager.LayoutParams.WRAP_CONTENT) - .position(loc[0], loc[1]) - .gravity(Gravity.TOP | Gravity.LEFT) - .showInWindowManager(); - } - try { - if (mWindowManagerView.isShowing()) { - return; - } - mWindowManagerView.show(); - } catch (Exception e) { - e.printStackTrace(); - } - BezierAnimationView bezierAnimationView = mWindowManagerView.findViewById(R.id.bezier_view); - bezierAnimationView.bezierAnimationStart(); - new Handler().postDelayed(new Runnable() { - @Override - public void run() { -// mWindowManagerView.dismiss(); - } - }, 2000); - - } - - public int[] getLocation(View v) { - int[] loc = new int[4]; - int[] location = new int[2]; - v.getLocationOnScreen(location); - loc[0] = location[0]; - loc[1] = location[1]; - int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); - int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); - v.measure(w, h); - - loc[2] = v.getMeasuredWidth(); - loc[3] = v.getMeasuredHeight(); - - //base = computeWH(); - return loc; - } - - /** - * 为了给车聊聊更多的信息需要重新查询一次 - * - * @param noveltyInfo - */ - private void requestUserInfo(MarkerExploreWay noveltyInfo) { - Logger.d(MODULE_NAME, "上报事件的用户SN:" + noveltyInfo.getSn()); - // 获取道路事件周边的直播车机 - if (!TextUtils.isEmpty(noveltyInfo.getSn())) { - V2XServiceManager - .getV2XRefreshModel() - .queryUserInfoBySn( - noveltyInfo.getSn(), - new V2XRefreshCallback() { - @Override - public void onSuccess(V2XUserInfoRes result) { - if (result != null && result.getResult() != null && result.getResult().getInfo() != null) { - V2XUserInfoRes.Result.Info infoBean = result.getResult().getInfo(); - if (mUserInfo == null) { - mUserInfo = new MarkerUserInfo(); - } - mUserInfo.setSn(infoBean.getSn()); - try { - if (!TextUtils.isEmpty(infoBean.getCardIdAge())) { - mUserInfo.setAge(Integer.parseInt(infoBean.getCardIdAge())); - } - } catch (NumberFormatException e) { - e.printStackTrace(); - } - mUserInfo.setUserName(infoBean.getUserNickName()); - mUserInfo.setUserHead(infoBean.getHeadImgUrl()); - mUserInfo.setGender(infoBean.getCardIdSex()); - - // 重新设置用户信息 - mNoveltyInfo.setUserInfo(mUserInfo); - - // M1低配车机限制 - // 不展示打电话按钮 - // 不能查看用户详情 - if (DebugConfig.isMapBased()) { - // 只有自研车机才会 有车聊聊通话 - if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) { - // 判断是否可以打电话 - ChartingUtil.isCanCall(b -> { - if (b) { - // 判断是否可以打电话 - ChartingUtil.isOnLine(mUserInfo.getSn(), b1 -> { - if (b1) { - ivEventCallChart.setVisibility(VISIBLE); - } else { - ivEventCallChart.setVisibility(GONE); - } - }); - } else { - ivEventCallChart.setVisibility(GONE); - } - }); - } - } - } - } - - @Override - public void onFail(String msg) { - ivEventCallChart.setVisibility(GONE); - } - }); - } - } -// -// /** -// * 延迟关闭窗体 -// */ -// @Override -// public void delayedCloseWindow() { -//// itemView.postDelayed(() -> { -//// // 移除窗体 -//// V2XServiceManager -//// .getIMogoWindowManager() -//// .removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView()); -//// V2XRoadEventScenario.getInstance().close(); -//// }, 1000); -// } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryIllegalParkVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryIllegalParkVH.java deleted file mode 100644 index 619ec64b24..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryIllegalParkVH.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.utils.RoadConditionUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.module.v2x.view.HeartLikeView; -import com.mogo.module.v2x.view.HeartUnLikeView; - -/** - * 出行面板违章停车 - * - * @author donghongyu - */ -public class V2XScenarioHistoryIllegalParkVH extends V2XHistoryBaseViewHolder { - private TextView mTvAddress; - private TextView mTvIllegalNum; - - private TextView mTagEventType; - private TextView mTagEventEvaluate; - - private HeartLikeView mLlIllegalParkingLike; - private HeartUnLikeView mLlIllegalParkingUnLike; - - private MarkerExploreWay mExploreWay; - - private V2XHistoryScenarioData mOldScenarioData; - - public V2XScenarioHistoryIllegalParkVH(ViewGroup viewGroup) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_v2x_scennario_history, viewGroup, false)); - mTvAddress = itemView.findViewById(R.id.tvAddress); - mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum); - - mTagEventType = itemView.findViewById(R.id.tagEventType); - mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate); - - mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike); - mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike); - } - - @Override - public void initView(V2XHistoryScenarioData viewData) { - try { - mOldScenarioData = viewData; - mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class); - mTvAddress.setText(mExploreWay.getAddr()); - - try { - mTvIllegalNum.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount()); - } catch (Exception e) { - e.printStackTrace(); - } - - if (!viewData.isDispose()) { - hideControlButton(View.VISIBLE); - } else { - hideControlButton(View.GONE); - } - - mLlIllegalParkingLike.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈有用"); - roadReportTrue(); - }); - - mLlIllegalParkingUnLike.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈无用"); - roadReportErr(); - }); - } catch (Exception e) { - e.printStackTrace(); - } - } - - void hideControlButton(int gone) { - mTagEventEvaluate.setVisibility(gone); - mLlIllegalParkingLike.setVisibility(gone); - mLlIllegalParkingUnLike.setVisibility(gone); - } - - @Override - public void delayedCloseWindow() { - try { - hideControlButton(View.GONE); - // 进行数据库存储 - V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); - v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType()); - v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime()); - v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData()); - v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode()); - v2XHistoryScenarioData.setDispose(true); - V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData); - mOldScenarioData.setDispose(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 反馈路况正确 - */ - private void roadReportTrue() { - delayedCloseWindow(); - if (mExploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - mExploreWay.getInfoId(), - mExploreWay.getPoiType(), - 2); - } - } - - /** - * 反馈路况错误 - */ - private void roadReportErr() { - delayedCloseWindow(); - if (mExploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - mExploreWay.getInfoId(), - mExploreWay.getPoiType(), - 3); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java deleted file mode 100644 index 616fb7c5b8..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.util.SpanUtils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.fragment.V2XEventPanelFragment; -import com.mogo.module.v2x.utils.ChartingUtil; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.module.v2x.utils.V2XUtils; -import com.mogo.service.imageloader.MogoImageView; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -import static android.view.View.GONE; -import static android.view.View.VISIBLE; - -/** - * 出行动态中的他人故障求助 - * - * @author donghongyu - */ -public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder { - - private TextView mTagEventType; - private TextView mTagEventEvaluate; - private MogoImageView mIvFaultHelpHead; - private TextView mTvFaultHelpName; - private TextView mTvFaultHelpEventTime; - private TextView mTvFaultHelpDistance; - private ImageView mIvFaultHelpEventCall; - private ImageView mIvFaultHelpEventNavi; - - private MarkerExploreWay mNoveltyInfo; - // 上传事件的用户信息 - private MarkerUserInfo mUserInfo = new MarkerUserInfo(); - - private V2XHistoryScenarioData mOldScenarioData; - - public V2XScenarioHistoryOtherSeekHelpVH(ViewGroup viewGroup) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_v2x_scennario_history_other_help, viewGroup, false)); - mTagEventType = itemView.findViewById(R.id.tagEventType); - mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate); - mIvFaultHelpHead = itemView.findViewById(R.id.ivFaultHelpHead); - mTvFaultHelpName = itemView.findViewById(R.id.tvFaultHelpName); - mTvFaultHelpEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime); - mTvFaultHelpDistance = itemView.findViewById(R.id.tvFaultHelpDistance); - mIvFaultHelpEventCall = itemView.findViewById(R.id.ivFaultHelpEventCall); - mIvFaultHelpEventNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi); - } - - @Override - public void initView(V2XHistoryScenarioData viewData) { - try { - mOldScenarioData = viewData; - V2XPushMessageEntity xPushMessageEntity = GsonUtil.objectFromJson(viewData.getEventJsonData(), V2XPushMessageEntity.class); - - mUserInfo.setSn(xPushMessageEntity.getSn()); - mUserInfo.setUserHead(xPushMessageEntity.getHeadImgUrl()); - mUserInfo.setUserName(xPushMessageEntity.getDisplayName()); - mUserInfo.setGender(xPushMessageEntity.getSex()); - mUserInfo.setAge(xPushMessageEntity.getAge()); - - mTvFaultHelpName.setText(xPushMessageEntity.getDisplayName()); - - if (!TextUtils.isEmpty(xPushMessageEntity.getHeadImgUrl())) { - V2XServiceManager.getImageLoader() - .displayImage(xPushMessageEntity.getHeadImgUrl(), mIvFaultHelpHead); - } - - if (xPushMessageEntity.getDistance() > 1000) { - SpanUtils.with(mTvFaultHelpDistance) - .append("" + (int) xPushMessageEntity.getDistance() / 1000) - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title)) - .append("公里") - .setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_32)) - .create(); - } else { - SpanUtils.with(mTvFaultHelpDistance) - .append("" + (int) xPushMessageEntity.getDistance()) - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title)) - .append("米") - .setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_32)) - .create(); - } - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA); - String eventTime = String.format("%s发布求助信息", - sdf.format(new Date(xPushMessageEntity.getCreateTime()))); - mTvFaultHelpEventTime.setText(eventTime); - - try { - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(xPushMessageEntity.getLon()); - markerLocation.setLat(xPushMessageEntity.getLat()); - mNoveltyInfo = new MarkerExploreWay(); - mNoveltyInfo.setLocation(markerLocation); - mNoveltyInfo.setUserInfo(mUserInfo); - } catch (Exception e) { - e.printStackTrace(); - } - - mIvFaultHelpEventNavi.setOnClickListener(v -> { - V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn()); - triggerStartNavi(mNoveltyInfo); - }); - - // M1低配车机限制 - // 不展示打电话按钮 - // 不能查看用户详情 - if (DebugConfig.isMapBased()) { - // 只有自研车机才会 有车聊聊通话 - if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) { - // 判断是否可以打电话 - ChartingUtil.isCanCall(b -> { - if (b) { - // 判断是否可以打电话 - ChartingUtil.isOnLine(xPushMessageEntity.getSn(), b1 -> { - if (b1) { - mIvFaultHelpEventCall.setVisibility(VISIBLE); - } else { - mIvFaultHelpEventCall.setVisibility(GONE); - } - }); - } else { - mIvFaultHelpEventCall.setVisibility(GONE); - } - }); - - mIvFaultHelpEventCall.setOnClickListener(v -> { - if (!V2XUtils.isFastClick()) { - V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn()); - try { - triggerCallChart(mNoveltyInfo); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void delayedCloseWindow() { - try { - hideControlButton(View.GONE); - // 进行数据库存储 - V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); - v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType()); - v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime()); - v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData()); - v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode()); - v2XHistoryScenarioData.setDispose(true); - V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData); - mOldScenarioData.setDispose(true); - - V2XEventPanelFragment.Companion.getInstance().hidePanel(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - void hideControlButton(int gone) { - mTagEventEvaluate.setVisibility(gone); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryRoadEventVH.java deleted file mode 100644 index 38b8c536c3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryRoadEventVH.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.utils.RoadConditionUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.module.v2x.view.HeartLikeView; -import com.mogo.module.v2x.view.HeartUnLikeView; - -/** - * 出行面板道路事件面板 - * - * @author donghongyu - */ -public class V2XScenarioHistoryRoadEventVH extends V2XHistoryBaseViewHolder { - private TextView mTvAddress; - private TextView mTvIllegalNum; - private ImageView mIvIconP; - private TextView mTagEventType; - private TextView mTagEventEvaluate; - - private HeartLikeView mLlIllegalParkingLike; - private HeartUnLikeView mLlIllegalParkingUnLike; - - private MarkerExploreWay mExploreWay; - private V2XHistoryScenarioData mOldScenarioData; - - public V2XScenarioHistoryRoadEventVH(ViewGroup viewGroup) { - super(LayoutInflater.from(viewGroup.getContext()) - .inflate(R.layout.item_v2x_scennario_history, viewGroup, false)); - mTvAddress = itemView.findViewById(R.id.tvAddress); - mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum); - mIvIconP = itemView.findViewById(R.id.ivIconP); - mTagEventType = itemView.findViewById(R.id.tagEventType); - mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate); - - mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike); - mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike); - } - - @Override - public void initView(V2XHistoryScenarioData viewData) { - try { - mOldScenarioData = viewData; - mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class); - - mIvIconP.setVisibility(View.GONE); - mTvAddress.setText(mExploreWay.getAddr()); - mTagEventType.setText(EventTypeEnum.getPoiTypeStr(mExploreWay.getPoiType())); - - try { - mTvIllegalNum.setText(mExploreWay.getUserInfo().getUserName() + "的分享 " + - TimeUtils.millis2String(mOldScenarioData.getTriggerTime(), "MM月dd日 HH:mm")); - } catch (Exception e) { - e.printStackTrace(); - } - - if (!viewData.isDispose()) { - hideControlButton(View.VISIBLE); - } else { - hideControlButton(View.GONE); - } - - mLlIllegalParkingLike.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈有用"); - roadReportTrue(); - }); - - mLlIllegalParkingUnLike.setOnClickCallListener(v -> { - Logger.d(V2XConst.MODULE_NAME, "反馈无用"); - roadReportErr(); - }); - } catch (Exception e) { - e.printStackTrace(); - } - } - - void hideControlButton(int gone) { - mTagEventEvaluate.setVisibility(gone); - mLlIllegalParkingLike.setVisibility(gone); - mLlIllegalParkingUnLike.setVisibility(gone); - } - - @Override - public void delayedCloseWindow() { - try { - hideControlButton(View.GONE); - // 进行数据库存储 - V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); - v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType()); - v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime()); - v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData()); - v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode()); - v2XHistoryScenarioData.setDispose(true); - V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData); - - mOldScenarioData.setDispose(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 反馈路况正确 - */ - private void roadReportTrue() { - delayedCloseWindow(); - if (mExploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - mExploreWay.getInfoId(), - mExploreWay.getPoiType(), - 2); - } - } - - /** - * 反馈路况错误 - */ - private void roadReportErr() { - delayedCloseWindow(); - if (mExploreWay != null) { - RoadConditionUtils.sendShareReceiverInfo( - mExploreWay.getInfoId(), - mExploreWay.getPoiType(), - 3); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XSurroundingDetailVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XSurroundingDetailVH.java deleted file mode 100644 index 182ad106a0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XSurroundingDetailVH.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -/** - * @author lixiaopeng - * @description - * @since 2020/11/16 - */ -public class V2XSurroundingDetailVH extends RecyclerView.ViewHolder{ - - public V2XSurroundingDetailVH(@NonNull View itemView) { - super(itemView); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XSurroundingViewHolder.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XSurroundingViewHolder.java deleted file mode 100644 index 0a5cc96a61..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XSurroundingViewHolder.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mogo.module.v2x.adapter.holder; - -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -/** - * @author lixiaopeng - * @description - * @since 2020/7/29 - */ -public class V2XSurroundingViewHolder extends RecyclerView.ViewHolder{ - - public V2XSurroundingViewHolder(@NonNull View itemView) { - super(itemView); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java deleted file mode 100644 index 7b1ca6fb07..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java +++ /dev/null @@ -1,423 +0,0 @@ -package com.mogo.module.v2x.alarm; - -import android.text.TextUtils; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.constant.TimeConstants; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.ViewUtilsayUtils; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.map.search.geo.IMogoGeoSearchListener; -import com.mogo.map.search.geo.MogoGeocodeResult; -import com.mogo.map.search.geo.MogoPoiItem; -import com.mogo.map.search.geo.MogoRegeocodeResult; -import com.mogo.map.search.poisearch.IMogoPoiSearch; -import com.mogo.map.search.poisearch.IMogoPoiSearchListener; -import com.mogo.map.search.poisearch.MogoPoiResult; -import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.service.Utils; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; -import com.mogo.module.v2x.utils.DrivingDirectionUtils; -import com.mogo.module.v2x.utils.FatigueDrivingUtils; -import com.mogo.module.v2x.utils.LocationUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * @author donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/13 11:02 AM - * desc : - * 这里是车机端自己实现预警信息的触发操作,首先获取当前车位置周围2公里范围的道路事件, - * 普通模式:根据当前「车辆位置」及「行驶方向」判断「车辆前方」「500米」是否有道路事件需要触发。 - * 导航模式:根据当前「路径规划」及「行驶方向」判断「路径前方」「500米」是否有道路事件需要触发。 - * 疲劳驾驶:根据服务端下发的触发条件进行触发 - *

    - * version: 1.0 - */ -public class V2XAlarmServer { - // 记录道路播报的事件 - public static ConcurrentHashMap mAlertRoadEventList = new ConcurrentHashMap<>(); - - // 记录违章停车播报事件 - private static HashMap mAlertIllegalParkEventList = new HashMap<>(); - - // 记录疲劳驾驶播报的事件 - private static HashSet mV2XFatigueDrivingEventLevel = new HashSet<>(); - - /** - * 获取当前车辆前方距离最近的道路事件 - */ - public static V2XRoadEventEntity getDriveFrontAlarmEvent( - CopyOnWriteArrayList v2XRoadEventEntityList, - MogoLocation currentLocation) { - try { - // 检测道路事件是否需UGC问答 - V2XEarlyWarningServer.roadEventUgcCheck(currentLocation); - // 60(km/h) - if (currentLocation != null && v2XRoadEventEntityList != null) { - // 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告 - for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) { - // 0、道路事件必须有朝向,角度>=0; - if (v2XRoadEventEntity.getLocation().getAngle() >= 0) { - // 计算车辆距离指定气泡的距离 - MarkerLocation eventLocation = v2XRoadEventEntity.getLocation(); - // 1、判断是否到达了触发距离,20 ~ 500, - if (v2XRoadEventEntity.getDistance() <= 500) { - // 2、道路事件方向与当前行驶方向角度偏差《20度以内 - double carBearing = currentLocation.getBearing(); - double eventBearing = eventLocation.getAngle(); - double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing); - if (diffAngle < 20) { - // 3、计算当前车辆行驶方向与事件位置之间夹角《20度,保证道路事件在车辆前方 - double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( - currentLocation.getLongitude(), - currentLocation.getLatitude(), - eventLocation.getLon(), - eventLocation.getLat(), - (int) currentLocation.getBearing() - ); - if (0 <= eventAngle && eventAngle <= 20) { - // 判断是否已经提示过道路事件 - boolean isAlreadyAlert = false; - String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity); - if (!TextUtils.isEmpty(lastTime)) { - long timeSpan = TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN); -// Logger.w(MODULE_NAME, -// "V2X预警--事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + -// "\n上一次预警时间:" + lastTime + -// "\n距离当前时间:" + timeSpan); - // 5分钟内不重复提醒 - if (timeSpan < 5) { - isAlreadyAlert = true; - } - } - // 进行提醒 - if (!isAlreadyAlert) { -// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" + -// "\n事件详情ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + -// "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) + -// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" + -// "\n是否已经提醒:" + isAlreadyAlert + -// "\n当前车辆-经度:" + currentLocation.getLongitude() + -// "\n当前车辆-经度:" + currentLocation.getLatitude() + -// "\n当前车辆-角度:" + currentLocation.getBearing() + -// "\n道路事件-经度:" + eventLocation.getLon() + -// "\n道路事件-经度:" + eventLocation.getLat() + -// "\n道路事件-角度:" + eventLocation.getAngle() + -// "\n夹角角度:" + eventAngle + " 度" -// ); - mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString()); - return v2XRoadEventEntity; - } - return null; - } else { -// Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" + -// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + -// "\n当前车辆-经度:" + currentLocation.getLongitude() + -// "\n当前车辆-经度:" + currentLocation.getLatitude() + -// "\n当前车辆-角度:" + currentLocation.getBearing() + -// "\n道路事件-经度:" + eventLocation.getLon() + -// "\n道路事件-经度:" + eventLocation.getLat() + -// "\n道路事件-角度:" + eventLocation.getAngle() + -// "\n夹角角度:" + eventAngle + " 度" -// ); - } - } else { -// Logger.w(MODULE_NAME, -// "V2X预警--车头方向与事件方向角度不一致:" + -// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + -// "\n车头方向: " + carBearing + -// "\n事件方向:" + eventBearing + -// "\n角度差值:" + diffAngle -// ); - } - } else { -// Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了:" + -// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() + -// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" -// ); - } - } else { -// Logger.e(MODULE_NAME, -// "V2X预警--道路事件没有角度信息" + -// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() -// ); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 疲劳驾驶的展示数据 - * 分级说明: - * 1,驾驶时段 0-2小时为正常状态; - * 2,驾驶时段2-3小时为轻度疲劳; - * 3,驾驶时段3-4小时为中度疲劳; - * 4,驾驶时段4小时以上为重度疲劳; - */ - public static void getFatigueDrivingShow(MogoLocation location, OnFatigueDrivingListener onFatigueDrivingListener) { - try { - long drivingTime = FatigueDrivingUtils.getDrivingTime(); - //Logger.i(V2XConst.MODULE_NAME, "车机已经开机: " + drivingTime + " 分钟"); - - V2XStrategyPushRes.ResultBean strategyPushEntity = - GsonUtil.objectFromJson(SharedPrefsMgr.getInstance(com.mogo.eagle.core.utilcode.util.Utils.getApp()) - .getString(V2XConst.V2X_STRATEGY_PUSH), V2XStrategyPushRes.ResultBean.class); - - V2XPushMessageEntity drivingShowEntity = new V2XPushMessageEntity(); - drivingShowEntity.setSceneId(EventTypeEnum.ALERT_FATIGUE_DRIVING.getPoiType()); - - if (strategyPushEntity != null && - !ArrayUtils.isEmpty(strategyPushEntity.getLevelList())) { - for (V2XStrategyPushRes.ResultBean.LevelListBean levelListBean : - strategyPushEntity.getLevelList()) { - // 找到当前驾驶时常对应的疲劳等级 - if (drivingTime >= levelListBean.getMinMinute() - && drivingTime < levelListBean.getMaxMinute()) { - //疲劳等级:NORMAL-正常、SLIGHT-轻度、MODERATE-中度、SEVERE-重度 - switch (levelListBean.getLevel()) { - //正常 - case "NORMAL": - //Logger.d(MODULE_NAME, "驾驶疲劳程度: 正常"); - break; - //轻度 - case "SLIGHT": - //Logger.w(MODULE_NAME, "驾驶疲劳程度: 轻度"); - if (!mV2XFatigueDrivingEventLevel.contains("SLIGHT")) { - mV2XFatigueDrivingEventLevel.add("SLIGHT"); - drivingShowEntity.setShowWindow(false); - drivingShowEntity.setAlarmContent(levelListBean.getContent()); - drivingShowEntity.setTts(levelListBean.getTts()); - drivingShowEntity.setExpireTime(levelListBean.getShowSeconds()); - // 回调提醒 - if (onFatigueDrivingListener != null) { - onFatigueDrivingListener.onAlarmMessage(drivingShowEntity); - } - } - break; - //中度 - case "MODERATE": - //Logger.e(MODULE_NAME, "驾驶疲劳程度: 中度"); - //warningParkPoi(location, onFatigueDrivingListener, drivingShowEntity, levelListBean); - break; - //重度 - case "SEVERE": - //Logger.e(MODULE_NAME, "驾驶疲劳程度: 重度"); - break; - default: - //Logger.e(MODULE_NAME, "驾驶疲劳程度: 超出定义范围"); - break; - } - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - // 提醒停车 - private static void warningParkPoi(MogoLocation location, - OnFatigueDrivingListener onFatigueDrivingListener, - V2XPushMessageEntity drivingShowEntity, - V2XStrategyPushRes.ResultBean.LevelListBean levelListBean) { - if (!mV2XFatigueDrivingEventLevel.contains("MODERATE")) { - mV2XFatigueDrivingEventLevel.add("MODERATE"); - // 定位当前位置是否是高速 - LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() { - @Override - public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { - if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null || - regeocodeResult.getRegeocodeAddress().getFormatAddress() == null) { - return; - } - Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress()); - String keyword = "停车场"; - boolean isHighWay = false; - // 如果当前位置是高速则推荐服务区 - if (regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("高速")) { - keyword = "停车场|服务区"; - isHighWay = true; - } - MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(keyword, keyword); - poiSearchQuery.setPageSize(5); - poiSearchQuery.setLocation(LocationUtils.getCurrentLatLon()); - IMogoPoiSearch poiSearch = V2XServiceManager.getMapService().getPoiSearch(com.mogo.eagle.core.utilcode.util.Utils.getApp(), poiSearchQuery); - boolean finalIsHighWay = isHighWay; - poiSearch.setPoiSearchListener(new IMogoPoiSearchListener() { - @Override - public void onPoiSearched(MogoPoiResult result, int errorCode) { - Logger.i(MODULE_NAME, "附近的停车场/服务区:" + GsonUtil.jsonFromObject(result)); - drivingShowEntity.setAlarmContent(levelListBean.getContent()); - - ArrayList pois = result.getPois(); - if (pois.size() > 0) { - MogoPoiItem mogoPoiItem = getFrontPoi(finalIsHighWay, pois, location); - Logger.e(MODULE_NAME, "推荐车头前方最近的停车场/服务区:" + GsonUtil.jsonFromObject(mogoPoiItem)); - if (mogoPoiItem != null) { - drivingShowEntity.setExpireTime(levelListBean.getShowSeconds()); - drivingShowEntity.setShowWindow(true); - drivingShowEntity.setTts(levelListBean.getTts()); - drivingShowEntity.setLon(mogoPoiItem.getPoint().getLon()); - drivingShowEntity.setLat(mogoPoiItem.getPoint().getLat()); - drivingShowEntity.setAddress(mogoPoiItem.getTitle()); - float calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(mogoPoiItem.getPoint().getLat(), mogoPoiItem.getPoint().getLon()), - LocationUtils.getCurrentLatLon() - ); - drivingShowEntity.setDistance(calculateDistance); - } else { - drivingShowEntity.setShowWindow(false); - drivingShowEntity.setTts(levelListBean.getNoReTts()); - } - } else { - drivingShowEntity.setShowWindow(false); - drivingShowEntity.setTts(levelListBean.getNoReTts()); - } - - // 回调提醒 - if (onFatigueDrivingListener != null) { - onFatigueDrivingListener.onAlarmMessage(drivingShowEntity); - } - } - - @Override - public void onPoiItemSearched(MogoPoiItem item, int errorCode) { - - } - }); - poiSearch.searchPOIAsyn(); - } - - @Override - public void onGeocodeSearched(MogoGeocodeResult geocodeResult) { - - } - }); - } - } - - public interface OnFatigueDrivingListener { - void onAlarmMessage(V2XPushMessageEntity drivingShowEntity); - } - - - // 计算出与车头朝向相同的poi点 - public static MogoPoiItem getFrontPoi(boolean isHighWay, ArrayList pois, MogoLocation location) { - if (location != null && pois != null) { - // (高速道路)推荐道路前方180度服务区(限定30公里) - // (非高速)推荐停车场(限定5公里内) - for (MogoPoiItem poiItem : pois) { - // 计算距离 - float calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(poiItem.getPoint().getLat(), poiItem.getPoint().getLon()), - LocationUtils.getCurrentLatLon() - ); - Logger.e(MODULE_NAME, "车辆距离POI点距离:" + calculateDistance); - Logger.e(MODULE_NAME, "当前车辆是否在高速:" + isHighWay); - if (isHighWay) { - if (calculateDistance > 100 && calculateDistance < 30000) { - // 计算角度 - double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( - location.getLongitude(), - location.getLatitude(), - poiItem.getPoint().getLon(), - poiItem.getPoint().getLat(), - (int) location.getBearing() - ); - Logger.e(MODULE_NAME, "车辆距离POI角度:" + eventAngle); - // 车辆前方180度 - if (0 <= eventAngle && eventAngle <= 90) { - return poiItem; - } - } - } else { - if (calculateDistance < 5000) { - return poiItem; - } - } - } - } - return null; - } - - /** - * 获取车辆的前方的违章停车事件 - */ - public static MarkerExploreWay getIllegalParkAlarmEvent( - ArrayList v2XExploreWayEntityList, - MogoLocation currentLocation) { - try { - Logger.w(MODULE_NAME, "V2X预警--车辆状态:" + currentLocation); - // 60(km/h) - if (currentLocation != null && v2XExploreWayEntityList != null) { - // 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告 - for (MarkerExploreWay markerExploreWay : v2XExploreWayEntityList) { - // 计算车辆距离 - float distance = Utils.calculateLineDistance( - new MogoLatLng(markerExploreWay.getLocation().getLat(), markerExploreWay.getLocation().getLon()), - new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude()) - ); - - Logger.w(MODULE_NAME, "V2X预警--车辆与违章道路信息:" + - "\n当前车辆距离违章停车点:" + distance); - - // 判断是否到达了触发距离,50 米 - if (distance <= 50) { - Logger.w(MODULE_NAME, "V2X预警--车辆与违章道路信息:" + - "\n违章道路名称:" + markerExploreWay.getAddr() + - "\n车头角度:" + currentLocation.getBearing()); - - // 判断是否已经提示过道路事件 - boolean isAlreadyAlert = false; - String lastTime = mAlertIllegalParkEventList.get(markerExploreWay); - Logger.w(MODULE_NAME, - "V2X预警--事件ID:" + markerExploreWay.getInfoId() + - "\n上一次预警时间:" + lastTime); - if (!TextUtils.isEmpty(lastTime)) { - long timeSpan = TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN); - Logger.w(MODULE_NAME, - "V2X预警--事件ID:" + markerExploreWay.getInfoId() + - "\n距离当前时间:" + timeSpan); - // 5分钟内不重复提醒 - if (timeSpan < 5) { - isAlreadyAlert = true; - } - } - // 进行提醒 - if (!isAlreadyAlert) { - mAlertIllegalParkEventList.put(markerExploreWay, TimeUtils.getNowString()); - return markerExploreWay; - } - return null; - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XCalculateServer.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XCalculateServer.java deleted file mode 100644 index 9b66277f67..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XCalculateServer.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.mogo.module.v2x.alarm; - - -import android.os.Handler; - -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.listener.CarStatusListener; - -import java.util.HashMap; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/13 11:02 AM - * desc : - * 这里充当计算服务 - * 计算 当前 车速变化回调、方向角度 - * version: 1.0 - */ -public class V2XCalculateServer { - - private static final String TAG = "V2XCalculateServer"; - - // 当前的车辆位置,主要用 经纬度,角度,速度 - private static MogoLocation mCurrentLocation; - - // 是否处于停车状态 - private static boolean mIsPark = true; - // 没有行驶的次数 - private static int mNoDriveCount = 0; - - private static HashMap mCarStatusListener = new HashMap<>(); - private static V2XCalculateServer mV2XCalculateServer; - - // 一分钟获取一次最新的路况信息 - private static final int refreshTime = 5_000; - private static Handler refreshHandler; - private static Runnable refreshRunnable; - - private V2XCalculateServer() { - } - - public synchronized static V2XCalculateServer getInstance() { - synchronized (V2XCalculateServer.class) { - if (mV2XCalculateServer == null) { - mV2XCalculateServer = new V2XCalculateServer(); - if (refreshHandler == null) { - refreshHandler = new Handler(); - } - if (refreshRunnable == null) { - refreshRunnable = new Runnable() { - @Override - public void run() { - calculateCarStatus(); - refreshHandler.postDelayed(this, refreshTime); - } - }; - } - refreshHandler.post(refreshRunnable); - } - } - return mV2XCalculateServer; - } - - /** - * 添加车辆状态监听 - * - * @param tag 标记 - * @param carStatusListener 回调 - */ - public void addCarStatusListener(String tag, CarStatusListener carStatusListener) { - if (mCarStatusListener == null) { - mCarStatusListener = new HashMap<>(); - } - mCarStatusListener.put(tag, carStatusListener); - } - - /** - * 移除指定的标记的回调 - * - * @param tag 标记 - */ - public void removeCarStatusListener(String tag) { - if (mCarStatusListener != null) { - mCarStatusListener.remove(tag); - } - } - - /** - * 记录车辆行驶轨迹 - * - * @param location 车辆位置 - */ - public void addCarTrajectory(MogoLocation location) { - // 记录最后一次车辆位置信息 - mCurrentLocation = location; - // 车辆状态计算 - calculateCarStatus(); - } - - /** - * 计算车辆状态 - */ - private static void calculateCarStatus() { - if (mCurrentLocation != null) { - // 获取当前的车速 - float currentSpeed = mCurrentLocation.getSpeed(); -// Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "车辆状态:" + -// "\n当前车辆位置->" + V2XStatusManager.getInstance().getLocation().getAddress() + -// "\ncurrentSpeed 速度->" + currentSpeed + -// "\n车辆行驶状态mIsPark->" + mIsPark + -// "\nmNoDriveCount->" + mNoDriveCount); - - // 获取没有车速 - if (currentSpeed == 0) { - // 防止重复播报 - if (!mIsPark) { - // 超过 2 次的速度为 0 ,判定为 行驶->停止 - if ((++mNoDriveCount) > 2) { - if (mCarStatusListener != null) { - Logger.d(V2XConst.MODULE_NAME, "车辆状态:车辆从 行驶->停止"); - mIsPark = true; - for (CarStatusListener statusListener : mCarStatusListener.values()) { - statusListener.onCarDriving2Stop(mCurrentLocation); - } - } - } - } - } - // 获取到了车速 大于 3m/s = 10公里/小时 判定为行驶状态 - else if (currentSpeed > 3) { - mNoDriveCount = 0; - if (mIsPark) { - if (mCarStatusListener != null) { - //Logger.d(V2XConst.MODULE_NAME, "车辆状态:车辆从 停止->行驶"); - mIsPark = false; - for (CarStatusListener statusListener : mCarStatusListener.values()) { - statusListener.onCarStop2Driving(mCurrentLocation); - } - } - } - } - } - } - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XEarlyWarningServer.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XEarlyWarningServer.java deleted file mode 100644 index 0ad140686d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XEarlyWarningServer.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.mogo.module.v2x.alarm; - -import android.content.Intent; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.utils.DrivingDirectionUtils; - -import java.util.ArrayList; -import java.util.Set; - - -/** - * V2X 道路预警服务 - */ -public class V2XEarlyWarningServer { - private static final String TAG = "V2XEarlyWarningServer"; - - private static ArrayList alertMessageId = new ArrayList<>(); - - /** - * 对提醒过的道路事件进行UGC检测 - * - * @param currentLocation 当前车辆位置 - */ - public static void roadEventUgcCheck(MogoLocation currentLocation) { - - try { - if (currentLocation != null) { - // 循环已经播报的道路事件,将刚行驶过的道路事件进行弹窗交互,进行UGC问答, - Set keySet = V2XAlarmServer.mAlertRoadEventList.keySet(); - for (V2XRoadEventEntity v2XRoadEventEntity : keySet) { - // 计算车辆距离指定气泡的距离 - MarkerLocation eventLocation = v2XRoadEventEntity.getLocation(); - double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( - currentLocation.getLongitude(), - currentLocation.getLatitude(), - eventLocation.getLon(), - eventLocation.getLat(), - (int) currentLocation.getBearing() - ); - - double carBearing = currentLocation.getBearing(); - String roadInfoId = v2XRoadEventEntity.getNoveltyInfo().getInfoId(); - - // 封路、施工、拥堵、拥堵 才会有UGC提示 - if (EventTypeEnum.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) { -// Logger.w(MODULE_NAME, -// "V2X预警--UGC检测:" + -// "\n事件详情:" + roadInfoId + -// "\n事件详情:" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) + -// "\n车头方向: " + carBearing + -// "\n车与事件夹角:" + eventAngle + -// "\n已经UGC的事件:" + GsonUtil.jsonFromObject(alertMessageId) -// ); - // 判断是否预警过了 - if (!alertMessageId.contains(roadInfoId)) { - // 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了 - if (80 <= eventAngle) { -// Logger.w(MODULE_NAME + "_" + TAG, "V2X预警UGC--事件与车头角度夹角过大:" + -// "\n角度:" + eventAngle + " 度" + -// "\n事件详情:" + roadInfoId + -// "\n库存事件:" + V2XAlarmServer.mAlertRoadEventList.size() -// ); - - // 记录已经 UGC 提醒过的数据 - alertMessageId.add(roadInfoId); - - // 加载数据源 - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2XRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - // 弹出UGC - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); - LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent); - - } - // 移出已经预警的事件列表 - //V2XAlarmServer.mAlertRoadEventList.remove(v2XRoadEventEntity); - } - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java deleted file mode 100644 index 12d95c119d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.mogo.module.v2x.entity.model; - - -import com.mogo.eagle.core.data.map.MogoLatLng; - -/** - * @author lixiaopeng - * @description 云端警告下发数据(二轮车和弱势群体) - * @since 2021/3/30 - */ -public class CloundWarningInfo { - - /** - * 识别物体类型 - */ - public int type; - - /** - * 提示信息 - */ - public String warningContent; - - /** - * 道路唯一标识 - */ - public String roadId; - - /** - * 车道唯一标识 - */ - public String laneId; - - /** - * 识别物体唯一标识 - */ - public String uuid; - - /** - * 红绿灯颜色 - */ - public String color; - - /** - * 车ID 暂不使用 - */ - public String carId; - - /** - * 识别物体的纬度 - */ - public double lat; - - /** - * 识别物体的经度 - */ - public double lon; - - /** - * 识别物经纬度 - * */ - public MogoLatLng startLocation; - - /** - * 行人经纬度交点 - */ - public MogoLatLng endLocation; - - /** - * 停止线的纬度 - */ - public double stopLinelat; - - /** - * 停止线的经度 - */ - public double stopLinelon; - - /** - * 车头朝向 - */ - public double heading; - - /** - * 系统时间 暂时没用 - */ - public long systemTime; - - /** - * 定位卫星时间 暂时没用 - */ - public long satelliteTime; - - /** - * 速度 暂时没用 - */ - public double speed; - - /** - * 莫顿码 暂时没用 - */ - public long mortonCode; - - /** - * 停车线距离 - */ - public double distance; - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java deleted file mode 100644 index db9013f79a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.mogo.module.v2x.entity.model; - -import com.mogo.eagle.core.data.map.MogoLatLng; - -import java.util.List; - - -/** - * @author lixiaopeng - * @description - * @since 2020/7/29 - */ -public class DrawLineInfo { - //报警类型 - private String type; - - // 起点位置 - private MogoLatLng startLocation; - - //结束点位置 - private MogoLatLng endLocation; - - //绘制线的多个点位置 - private List locations; - - private double heading; - - private float width; - - private boolean hasStopLines; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public MogoLatLng getStartLocation() { - return startLocation; - } - - public void setStartLocation(MogoLatLng startLocation) { - this.startLocation = startLocation; - } - - public MogoLatLng getEndLocation() { - return endLocation; - } - - public void setEndLocation(MogoLatLng endLocation) { - this.endLocation = endLocation; - } - - public double getHeading() { - return heading; - } - - public void setHeading(double heading) { - this.heading = heading; - } - - public float getWidth() { - return width; - } - - public void setWidth(float width) { - this.width = width; - } - - public boolean isHasStopLines() { - return hasStopLines; - } - - public void setHasStopLines(boolean hasStopLines) { - this.hasStopLines = hasStopLines; - } - - public List getLocations() { - return locations; - } - - public void setLocations(List locations) { - this.locations = locations; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XAlarmEventRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XAlarmEventRes.java deleted file mode 100644 index 46aab8fa9b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XAlarmEventRes.java +++ /dev/null @@ -1,280 +0,0 @@ - -package com.mogo.module.v2x.entity.net; - -import android.text.TextUtils; - -import com.google.gson.annotations.Expose; -import com.google.gson.annotations.SerializedName; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerOnlineCar; - -import java.io.Serializable; -import java.util.ArrayList; - -@SuppressWarnings("unused") -public class V2XAlarmEventRes extends BaseData implements Serializable { - @Expose - private Result result; - - public Result getResult() { - return result; - } - - public void setResult(Result result) { - this.result = result; - } - - public class Result { - @Expose - @SerializedName(value = "recommendInfo", alternate = {"alarmInfo"}) - private AlarmInfo alarmInfo; - @Expose - private ArrayList onlineCar; - - public ArrayList getOnlineCar() { - return onlineCar; - } - - public void setOnlineCar(ArrayList onlineCar) { - this.onlineCar = onlineCar; - } - - public AlarmInfo getAlarmInfo() { - return alarmInfo; - } - - public void setAlarmInfo(AlarmInfo alarmInfo) { - this.alarmInfo = alarmInfo; - } - - @Override - public String toString() { - return "Result{" + - "alarmInfo=" + alarmInfo + - ", onlineCar=" + onlineCar + - '}'; - } - - } - - public static class AlarmInfo { - - @Expose - private ContentData contentData; - @Expose - private Double distance; - @Expose - private MarkerLocation location; - @Expose - private String poiType; - @Expose - private String tts; - @Expose - private String type; - @Expose - private String alarmContent; - @Expose - private int expireTime; - @Expose - private int parkingSpaceSurplusNum; - - public ContentData getContentData() { - return contentData; - } - - public void setContentData(ContentData contentData) { - this.contentData = contentData; - } - - public Double getDistance() { - return distance; - } - - public void setDistance(Double distance) { - this.distance = distance; - } - - 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() { - if (TextUtils.isEmpty(tts)) { - return ""; - } - return tts; - } - - public void setTts(String tts) { - this.tts = tts; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getAlarmContent() { - return alarmContent; - } - - public void setAlarmContent(String alarmContent) { - this.alarmContent = alarmContent; - } - - public int getExpireTime() { - return expireTime; - } - - public void setExpireTime(int expireTime) { - this.expireTime = expireTime; - } - - public int getParkingSpaceSurplusNum() { - return parkingSpaceSurplusNum; - } - - public void setParkingSpaceSurplusNum(int parkingSpaceSurplusNum) { - this.parkingSpaceSurplusNum = parkingSpaceSurplusNum; - } - - @Override - public String toString() { - return "AlarmInfo{" + - "contentData=" + contentData + - ", distance=" + distance + - ", location=" + location + - ", poiType='" + poiType + '\'' + - ", tts='" + tts + '\'' + - ", type='" + type + '\'' + - ", alarmContent='" + alarmContent + '\'' + - ", expireTime=" + expireTime + - ", parkingSpaceSurplusNum=" + parkingSpaceSurplusNum + - '}'; - } - } - - public class ContentData { - - @Expose - private String iconUrl; - @Expose - private String imgUrl; - @Expose - private String infoId = ""; // POI 唯一标示 「纠错」或「确认」「点赞」使用 - @Expose - private String title; - @Expose - private String content; - @Expose - private String gasPrices;//"[{\"gasCode\":\"95\",\"gasPrice\":10.0},{\"gasCode\":\"98\",\"gasPrice\":23.0}]" - @Expose - private String styleType;// 内容类型,image-图片类型,video-视频类型 - @Expose - private String carSn;// 如果是用户上报的,则需要返回该字段 - - 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 String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getGasPrices() { - return gasPrices; - } - - public void setGasPrices(String gasPrices) { - this.gasPrices = gasPrices; - } - - public String getStyleType() { - return styleType; - } - - public void setStyleType(String styleType) { - this.styleType = styleType; - } - - public String getCarSn() { - return carSn; - } - - public void setCarSn(String carSn) { - this.carSn = carSn; - } - - @Override - public String toString() { - return "ContentData{" + - "iconUrl='" + iconUrl + '\'' + - ", imgUrl='" + imgUrl + '\'' + - ", infoId='" + infoId + '\'' + - ", title='" + title + '\'' + - ", content='" + content + '\'' + - ", gasPrices='" + gasPrices + '\'' + - ", styleType='" + styleType + '\'' + - ", carSn='" + carSn + '\'' + - '}'; - } - } - - @Override - public String toString() { - return "V2XAlarmEventMessage{" + - "result=" + result + - '}'; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XDemoUserInfoRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XDemoUserInfoRes.java deleted file mode 100644 index 15c08e3f50..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XDemoUserInfoRes.java +++ /dev/null @@ -1,258 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/24 4:20 PM - * desc : TODO 前瞻需求演示使用的用户数据 - * version: 1.0 - */ -public class V2XDemoUserInfoRes extends BaseData implements Serializable { - - /** - * code : 0 - * msg : - * detailMsg : - * result : {"userList":[{"sceneType":"1","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD801B1920L00818","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}},{"sceneType":"2","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD802B1932L00779","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}},{"sceneType":"3","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD802B1932L00779","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}}]} - */ - - private ResultBean result; - - 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 ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - public static class ResultBean { - private List userList; - - public List getUserList() { - return userList; - } - - public void setUserList(List userList) { - this.userList = userList; - } - - public static class UserListBean { - /** - * sceneType : 1 - * location : {"lat":39.97541,"lon":116.41782761} - * userInfo : {"sn":"ZD801B1920L00818","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1} - */ - - private String sceneType; - private LocationBean location; - private UserInfoBean userInfo; - - public String getSceneType() { - return sceneType; - } - - public void setSceneType(String sceneType) { - this.sceneType = sceneType; - } - - public LocationBean getLocation() { - return location; - } - - public void setLocation(LocationBean location) { - this.location = location; - } - - public UserInfoBean getUserInfo() { - return userInfo; - } - - public void setUserInfo(UserInfoBean userInfo) { - this.userInfo = userInfo; - } - - public static class LocationBean { - /** - * lat : 39.97541 - * lon : 116.41782761 - */ - - private double lat; - private double lon; - - 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; - } - - @Override - public String toString() { - return "LocationBean{" + - "lat=" + lat + - ", lon=" + lon + - '}'; - } - } - - public static class UserInfoBean { - /** - * sn : ZD801B1920L00818 - * userId : 1 - * userName : 用户昵称 - * userHead : https://www.baidu.com/img/baidu_jgylogo3.png - * gender : 男 - * age : 20 - * lastActiveweekAvgscore : 96 - * safeLabel : 老司机 - * safeLabelType : 1 - */ - - private String sn; - private int userId; - private String userName; - private String userHead; - private String gender; - private int age; - private String lastActiveweekAvgscore; - private String safeLabel; - private int safeLabelType; - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserHead() { - return userHead; - } - - public void setUserHead(String userHead) { - this.userHead = userHead; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - 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 "UserInfoBean{" + - "sn='" + sn + '\'' + - ", userId=" + userId + - ", userName='" + userName + '\'' + - ", userHead='" + userHead + '\'' + - ", gender='" + gender + '\'' + - ", age=" + age + - ", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' + - ", safeLabel='" + safeLabel + '\'' + - ", safeLabelType=" + safeLabelType + - '}'; - } - } - - @Override - public String toString() { - return "UserListBean{" + - "sceneType='" + sceneType + '\'' + - ", location=" + location + - ", userInfo=" + userInfo + - '}'; - } - } - } - - @Override - public String toString() { - return "V2XDemoUserInfoEntity{" + - "result=" + result + - '}'; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XGiveLike.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XGiveLike.java deleted file mode 100644 index 9b6e16990b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XGiveLike.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.mogo.module.v2x.entity.net; - -import com.google.gson.annotations.Expose; - -import java.io.Serializable; - -@SuppressWarnings("unused") -public class V2XGiveLike implements Serializable { - - @Expose - private Long code; - @Expose - private String msg; - @Expose - private String result; - @Expose - private String sign; - - public Long getCode() { - return code; - } - - public void setCode(Long code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public String getResult() { - return result; - } - - public void setResult(String result) { - this.result = result; - } - - public String getSign() { - return sign; - } - - public void setSign(String sign) { - this.sign = sign; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCarBroadcastReq.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCarBroadcastReq.kt deleted file mode 100644 index da482ace67..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCarBroadcastReq.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.mogo.module.v2x.entity.net - -/** - * 直播心跳请求 - */ -class V2XLiveCarBroadcastReq { - - var eventId: String? = null - var sn: String - var type: Int = 0 - var videoChannel: String - - constructor(sn: String, videoChannel: String) { - this.sn = sn - this.videoChannel = videoChannel - } - - constructor(eventId: String, sn: String, type: Int, videoChannel: String) { - this.eventId = eventId - this.sn = sn - this.type = type - this.videoChannel = videoChannel - } - -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCarRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCarRes.java deleted file mode 100644 index 6416092fd0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCarRes.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.google.gson.annotations.Expose; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.module.common.entity.V2XLiveCarInfoEntity; - -import java.io.Serializable; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/14 2:58 PM - * desc : 根据经纬度查询附近可直播车机直播信息 - * version: 1.0 - */ -public class V2XLiveCarRes extends BaseData implements Serializable { - @Expose - private ResultBean result; - - public static class ResultBean { - - private List info; - - public List getInfo() { - return info; - } - - public void setInfo(List info) { - this.info = info; - } - - @Override - public String toString() { - return "ResultBean{" + - "info=" + info + - '}'; - } - } - - public ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - @Override - public String toString() { - return "V2XLiveCarRes{" + - "result=" + result + - '}'; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCrossRoad.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCrossRoad.java deleted file mode 100644 index db8824f7cd..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLiveCrossRoad.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; - -/** - * author : unknown - * desc : 路口实况返回数据 - */ -public class V2XLiveCrossRoad extends BaseData implements Serializable { - public V2XLiveCrossRoadEntity result; - - public V2XLiveCrossRoadEntity getResult() { - return result; - } - - public void setResult(V2XLiveCrossRoadEntity result) { - this.result = result; - } - - @Override - public String toString() { - return "V2XLiveCrossRoad{" + - "result=" + result + - ", code=" + code + - ", msg='" + msg + '\'' + - '}'; - } - - public class V2XLiveCrossRoadEntity { - private int cameraParentId; - private int cameraId; - private String url; - private Double lat; - private Double lon; - private Double distance; - - public V2XLiveCrossRoadEntity(int cameraParentId, int cameraId, String url, Double lat, Double lon, Double distance) { - this.cameraParentId = cameraParentId; - this.cameraId = cameraId; - this.url = url; - this.lat = lat; - this.lon = lon; - this.distance = distance; - } - - public int getCameraParentId() { - return cameraParentId; - } - - public void setCameraParentId(int cameraParentId) { - this.cameraParentId = cameraParentId; - } - - public int getCameraId() { - return cameraId; - } - - public void setCameraId(int cameraId) { - this.cameraId = cameraId; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - 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 getDistance() { - return distance; - } - - public void setDistance(Double distance) { - this.distance = distance; - } - - @Override - public String toString() { - return "V2XLiveCrossRoadEntity{" + - "cameraParentId=" + cameraParentId + - ", cameraId=" + cameraId + - ", url='" + url + '\'' + - ", lat=" + lat + - ", lon=" + lon + - ", distance=" + distance + - '}'; - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLivePushVoRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLivePushVoRes.java deleted file mode 100644 index ee9fa53609..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XLivePushVoRes.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/16 1:43 PM - * desc : 推流与停止推流接口 - * version: 1.0 - */ -public class V2XLivePushVoRes extends BaseData implements Serializable { - public V2XLivePushVoEntity result; - - public V2XLivePushVoEntity getResult() { - return result; - } - - public void setResult(V2XLivePushVoEntity result) { - this.result = result; - } - - @Override - public String toString() { - return "V2XLivePushVoRes{" + - "result=" + result + - ", code=" + code + - ", msg='" + msg + '\'' + - '}'; - } - - public class V2XLivePushVoEntity { - private String livePlayUrl; - private PlayUrl playUrl; - private String videoChannel; - - public String getLivePlayUrl() { - return livePlayUrl; - } - - public void setLivePlayUrl(String livePlayUrl) { - this.livePlayUrl = livePlayUrl; - } - - public PlayUrl getPlayUrl() { - return playUrl; - } - - public void setPlayUrl(PlayUrl playUrl) { - this.playUrl = playUrl; - } - - public String getVideoChannel() { - return videoChannel; - } - - public void setVideoChannel(String videoChannel) { - this.videoChannel = videoChannel; - } - - public class PlayUrl { - - private String flv; - private String hls; - private String rtmp; - - public String getFlv() { - return flv; - } - - public void setFlv(String flv) { - this.flv = flv; - } - - public String getHls() { - return hls; - } - - public void setHls(String hls) { - this.hls = hls; - } - - public String getRtmp() { - return rtmp; - } - - public void setRtmp(String rtmp) { - this.rtmp = rtmp; - } - - @Override - public String toString() { - return "PlayUrl{" + - "flv='" + flv + '\'' + - ", hls='" + hls + '\'' + - ", rtmp='" + rtmp + '\'' + - '}'; - } - } - - @Override - public String toString() { - return "V2XLivePushVoEntity{" + - "livePlayUrl='" + livePlayUrl + '\'' + - ", playUrl=" + playUrl + - ", videoChannel='" + videoChannel + '\'' + - '}'; - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XOptimalRouteDataRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XOptimalRouteDataRes.java deleted file mode 100644 index e532355fdd..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XOptimalRouteDataRes.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.map.MogoLatLng; - -import java.io.Serializable; -import java.util.List; - -/** - * 最优路线推荐 - */ -public class V2XOptimalRouteDataRes implements Serializable { - private String sn; - /** - * 道路ID - */ - private String road_id; - /** - * 车道ID-2D路段 - */ - private String current_lane_id; - /** - * 车道号:中心线编号为0, 中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3 - */ - private int current_lane_num; - /** - * 最优车道平均速度 - */ - private double most_speed; - /** - * 车道号:中心线编号为0, 中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3 - */ - private int most_lane_num; - /** - * Wgs84坐标系,线性经纬度轨迹列表 - **/ - private List locus_list; - /** - * 高德坐标系Gcj,线性经纬度轨迹列表 - **/ - private List gd_locus_list; - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public String getRoad_id() { - return road_id; - } - - public void setRoad_id(String road_id) { - this.road_id = road_id; - } - - public String getCurrent_lane_id() { - return current_lane_id; - } - - public void setCurrent_lane_id(String current_lane_id) { - this.current_lane_id = current_lane_id; - } - - public int getCurrent_lane_num() { - return current_lane_num; - } - - public void setCurrent_lane_num(int current_lane_num) { - this.current_lane_num = current_lane_num; - } - - public double getMost_speed() { - return most_speed; - } - - public void setMost_speed(double most_speed) { - this.most_speed = most_speed; - } - - public int getMost_lane_num() { - return most_lane_num; - } - - public void setMost_lane_num(int most_lane_num) { - this.most_lane_num = most_lane_num; - } - - public List getLocus_list() { - return locus_list; - } - - public void setLocus_list(List locus_list) { - this.locus_list = locus_list; - } - - public List getGd_locus_list() { - return gd_locus_list; - } - - public void setGd_locus_list(List gd_locus_list) { - this.gd_locus_list = gd_locus_list; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XRoadDataRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XRoadDataRes.java deleted file mode 100644 index dfdec2fc47..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XRoadDataRes.java +++ /dev/null @@ -1,535 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.util.List; - -/** - * created by wujifei on 2020/12/24 11:05 - * describe:于目的地预判的道路事件和违章高发情况的停车推荐 返回数据 - */ -public class V2XRoadDataRes extends BaseData { - - private String detailMsg; - private ResultDTO result; - - public String getDetailMsg() { - return detailMsg; - } - - public void setDetailMsg(String detailMsg) { - this.detailMsg = detailMsg; - } - - public ResultDTO getResult() { - return result; - } - - public void setResult(ResultDTO result) { - this.result = result; - } - - public static class ResultDTO { - private String formatAddress; - private List fromPoint; - private List topPoint; - private List poiData; - private List illegalParkingData; - - public String getFormatAddress() { - return formatAddress; - } - - public void setFormatAddress(String formatAddress) { - this.formatAddress = formatAddress; - } - - public List getFromPoint() { - return fromPoint; - } - - public void setFromPoint(List fromPoint) { - this.fromPoint = fromPoint; - } - - public List getTopPoint() { - return topPoint; - } - - public void setTopPoint(List topPoint) { - this.topPoint = topPoint; - } - - public List getPoiData() { - return poiData; - } - - public void setPoiData(List poiData) { - this.poiData = poiData; - } - - public List getIllegalParkingData() { - return illegalParkingData; - } - - public void setIllegalParkingData(List illegalParkingData) { - this.illegalParkingData = illegalParkingData; - } - - public static class PoiDataDTO { - /** - * generateTime : 1607061691000 - * type : 0 - * lat : 39.988346 - * lon : 116.410857 - * direction : 333 - * items : [{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1603181678357.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1607393278%3B1607400478%26q-key-time%3D1607393278%3B1607400478%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D78c0f738f4dae37e67c235561c78120b86433a04"}] - * cityName : - * distance : 21447 - * nickName : 独狼 - * headImgUrl : https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000015.jpg - * sn : - * userId : 0 - * trafficInfoType : 0 - * infoId : 784423898000445440 - * poiType : 10015 - * uploadType : 2 - * likeNum : 3 - * systemLikeNum : 3 - * fabulous : false - */ - - - private long generateTime; - - private int type; - private double lat; - private double lon; - - private int direction; - private String cityName; - - private int distance; - private String nickName; - - private String headImgUrl; - - private String sn; - - private long userId; - - private String trafficInfoType; - - private String infoId; - - private String poiType; - - private String uploadType; - - private int likeNum; - - private int systemLikeNum; - - private boolean fabulous; - - private List items; - - public long getGenerateTime() { - return generateTime; - } - - public void setGenerateTime(long generateTime) { - this.generateTime = generateTime; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - 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 int getDirection() { - return direction; - } - - public void setDirection(int direction) { - this.direction = direction; - } - - public String getCityName() { - return cityName; - } - - public void setCityName(String cityName) { - this.cityName = cityName; - } - - public int getDistance() { - return distance; - } - - public void setDistance(int distance) { - this.distance = distance; - } - - public String getNickName() { - return nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - - public String getHeadImgUrl() { - return headImgUrl; - } - - public void setHeadImgUrl(String headImgUrl) { - this.headImgUrl = headImgUrl; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - - public String getTrafficInfoType() { - return trafficInfoType; - } - - public void setTrafficInfoType(String trafficInfoType) { - this.trafficInfoType = trafficInfoType; - } - - public String getInfoId() { - return infoId; - } - - 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; - } - - public int getLikeNum() { - return likeNum; - } - - public void setLikeNum(int likeNum) { - this.likeNum = likeNum; - } - - public int getSystemLikeNum() { - return systemLikeNum; - } - - public void setSystemLikeNum(int systemLikeNum) { - this.systemLikeNum = systemLikeNum; - } - - public boolean isFabulous() { - return fabulous; - } - - public void setFabulous(boolean fabulous) { - this.fabulous = fabulous; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - - public static class ItemsDTO { - /** - * url : http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1603181678357.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1607393278%3B1607400478%26q-key-time%3D1607393278%3B1607400478%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D78c0f738f4dae37e67c235561c78120b86433a04 - */ - - - private String url; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - } - } - - - public static class IllegalParkingDataDTO { - /** - * generateTime : 1594047156488 - * type : 3 - * lat : 40.028599 - * lon : 116.412712 - * direction : 0 - * addr : 红军营南路红军营南路万科星园北口至红军营南路北苑路口段 - * items : [] - * cityName : - * distance : 6728 - * nickName : - * headImgUrl : - * sn : - * userId : 0 - * trafficInfoType : 0 - * infoId : 686267 - * poiType : 10016 - * uploadType : 3 - * likeNum : 0 - * systemLikeNum : 0 - * fabulous : false - */ - - - private long generateTime; - - private int type; - - private double lat; - - private double lon; - - private int direction; - - private String addr; - - private String cityName; - - private int distance; - - private String nickName; - - private String headImgUrl; - - private String sn; - - private long userId; - - private String trafficInfoType; - - private String infoId; - - private String poiType; - - private String uploadType; - - private int likeNum; - - private int systemLikeNum; - - private boolean fabulous; - - private List items; - - public long getGenerateTime() { - return generateTime; - } - - public void setGenerateTime(long generateTime) { - this.generateTime = generateTime; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - 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 int getDirection() { - return direction; - } - - public void setDirection(int direction) { - this.direction = direction; - } - - public String getAddr() { - return addr; - } - - public void setAddr(String addr) { - this.addr = addr; - } - - public String getCityName() { - return cityName; - } - - public void setCityName(String cityName) { - this.cityName = cityName; - } - - public int getDistance() { - return distance; - } - - public void setDistance(int distance) { - this.distance = distance; - } - - public String getNickName() { - return nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - - public String getHeadImgUrl() { - return headImgUrl; - } - - public void setHeadImgUrl(String headImgUrl) { - this.headImgUrl = headImgUrl; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - - public String getTrafficInfoType() { - return trafficInfoType; - } - - public void setTrafficInfoType(String trafficInfoType) { - this.trafficInfoType = trafficInfoType; - } - - public String getInfoId() { - return infoId; - } - - 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; - } - - public int getLikeNum() { - return likeNum; - } - - public void setLikeNum(int likeNum) { - this.likeNum = likeNum; - } - - public int getSystemLikeNum() { - return systemLikeNum; - } - - public void setSystemLikeNum(int systemLikeNum) { - this.systemLikeNum = systemLikeNum; - } - - public boolean isFabulous() { - return fabulous; - } - - public void setFabulous(boolean fabulous) { - this.fabulous = fabulous; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XSeekHelpRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XSeekHelpRes.java deleted file mode 100644 index fca7c2061d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XSeekHelpRes.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/11 4:25 PM - * desc : 故障求助查询,当前车辆是否处于求助中 - * version: 1.0 - */ -public class V2XSeekHelpRes extends BaseData implements Serializable { - private ResultBean result; - - public ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - public static class ResultBean { - private int vehicleType; - - public int getVehicleType() { - return vehicleType; - } - - public void setVehicleType(int vehicleType) { - this.vehicleType = vehicleType; - } - - @Override - public String toString() { - return "ResultBean{" + - "vehicleType=" + vehicleType + - '}'; - } - } - - @Override - public String toString() { - return "V2XSeekHelpResult{" + - "result=" + result + - ", code=" + code + - ", msg='" + msg + '\'' + - '}'; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XSpecialCarRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XSpecialCarRes.java deleted file mode 100644 index 9ffc90ca91..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XSpecialCarRes.java +++ /dev/null @@ -1,205 +0,0 @@ - -package com.mogo.module.v2x.entity.net; - -import java.io.Serializable; -import java.util.List; - -@SuppressWarnings("unused") -public class V2XSpecialCarRes implements Serializable { - - private List coordinates; - - public List getCoordinates() { - return coordinates; - } - - public void setCoordinates(List coordinates) { - this.coordinates = coordinates; - } - - @Override - public String toString() { - return "V2XMarkerResult{" + - "coordinates=" + coordinates + - '}'; - } - - public class V2XMarkerEntity implements Serializable { - - /** - * createTime : 1587111513507 - * distance : 100 - * lat : 39.96911187 - * lon : 116.41777396 - * sn : ZD802B1932L00681 - * targetId : 20007 - * targetName : 故障车 - * userInfo : {"age":33,"displayName":"飞","headImgUrl":"http://img.zhidaohulian.com/fileServer/api/qa/user_info/1068057333299/67933ffb9a7e237c8cc2d8d9f66efcd0.jpg","sex":1,"sn":"ZD801B1920L00568","userId":1068057333299} - */ - - private long createTime; - private int distance; - private double lat; - private double lon; - private String sn; - private int targetId; - private String targetName; - private V2XMarkerEntity.UserInfoBean userInfo; - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } - - public int getDistance() { - return distance; - } - - public void setDistance(int distance) { - this.distance = distance; - } - - 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 String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public int getTargetId() { - return targetId; - } - - public void setTargetId(int targetId) { - this.targetId = targetId; - } - - public String getTargetName() { - return targetName; - } - - public void setTargetName(String targetName) { - this.targetName = targetName; - } - - public V2XMarkerEntity.UserInfoBean getUserInfo() { - return userInfo; - } - - public void setUserInfo(V2XMarkerEntity.UserInfoBean userInfo) { - this.userInfo = userInfo; - } - - public class UserInfoBean implements Serializable { - /** - * age : 33 - * displayName : 飞 - * headImgUrl : http://img.zhidaohulian.com/fileServer/api/qa/user_info/1068057333299/67933ffb9a7e237c8cc2d8d9f66efcd0.jpg - * sex : 1 - * sn : ZD801B1920L00568 - * userId : 1068057333299 - */ - - private int age; - private String displayName; - private String headImgUrl; - private int sex; - private String sn; - private long userId; - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public String getHeadImgUrl() { - return headImgUrl; - } - - public void setHeadImgUrl(String headImgUrl) { - this.headImgUrl = headImgUrl; - } - - public int getSex() { - return sex; - } - - public void setSex(int sex) { - this.sex = sex; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - - @Override - public String toString() { - return "UserInfoBean{" + - "age=" + age + - ", displayName='" + displayName + '\'' + - ", headImgUrl='" + headImgUrl + '\'' + - ", sex=" + sex + - ", sn='" + sn + '\'' + - ", userId=" + userId + - '}'; - } - } - - @Override - public String toString() { - return "V2XMarkerEntity{" + - "createTime=" + createTime + - ", distance=" + distance + - ", lat=" + lat + - ", lon=" + lon + - ", sn='" + sn + '\'' + - ", targetId=" + targetId + - ", targetName='" + targetName + '\'' + - ", userInfo=" + userInfo + - '}'; - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XStrategyPushRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XStrategyPushRes.java deleted file mode 100644 index 119b296b59..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XStrategyPushRes.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.mogo.module.v2x.entity.net; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/26 2:30 PM - * desc : 疲劳驾驶提醒策略 - * version: 1.0 - */ -public class V2XStrategyPushRes extends BaseData implements Serializable { - - /** - * result : {"levelList":[{"level":"NORMAL","minMinute":0,"maxMinute":120},{"content":"已连续驾驶2小时,请注意休息","level":"SLIGHT","tts":"已连续驾驶2小时,听歌可以缓解疲劳,可以对我说打开音乐","showSeconds":15,"minMinute":120,"maxMinute":180},{"content":"已连续驾驶3小时,请注意停车休息","highSpeed":{"recommend":"REST_AREA","direction":"FRONT","angle":180,"distance":30},"level":"MODERATE","lowSpeed":{"recommend":"PARK","direction":"FRONT","angle":180,"distance":5},"tts":"已连续驾驶3小时,已为您找到附近服务区/停车场,请停车休息,可以对我说导航前往","showSeconds":20,"noReTts":"已连续驾驶3小时,为避免事故发生,请尽快进入停车区休息","minMinute":180,"maxMinute":240}],"drivingIgnoreMinutes":20,"restIgnoreMinutes":20} - */ - private ResultBean result; - - public ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - public static class ResultBean { - /** - * levelList : [{"level":"NORMAL","minMinute":0,"maxMinute":120},{"content":"已连续驾驶2小时,请注意休息","level":"SLIGHT","tts":"已连续驾驶2小时,听歌可以缓解疲劳,可以对我说打开音乐","showSeconds":15,"minMinute":120,"maxMinute":180},{"content":"已连续驾驶3小时,请注意停车休息","highSpeed":{"recommend":"REST_AREA","direction":"FRONT","angle":180,"distance":30},"level":"MODERATE","lowSpeed":{"recommend":"PARK","direction":"FRONT","angle":180,"distance":5},"tts":"已连续驾驶3小时,已为您找到附近服务区/停车场,请停车休息,可以对我说导航前往","showSeconds":20,"noReTts":"已连续驾驶3小时,为避免事故发生,请尽快进入停车区休息","minMinute":180,"maxMinute":240}] - * drivingIgnoreMinutes : 20 - * restIgnoreMinutes : 20 - */ - - private int drivingIgnoreMinutes; - private int restIgnoreMinutes; - private List levelList; - - public int getDrivingIgnoreMinutes() { - return drivingIgnoreMinutes; - } - - public void setDrivingIgnoreMinutes(int drivingIgnoreMinutes) { - this.drivingIgnoreMinutes = drivingIgnoreMinutes; - } - - public int getRestIgnoreMinutes() { - return restIgnoreMinutes; - } - - public void setRestIgnoreMinutes(int restIgnoreMinutes) { - this.restIgnoreMinutes = restIgnoreMinutes; - } - - public List getLevelList() { - return levelList; - } - - public void setLevelList(List levelList) { - this.levelList = levelList; - } - - public static class LevelListBean { - /** - * level : NORMAL - * minMinute : 0 - * maxMinute : 120 - * content : 已连续驾驶2小时,请注意休息 - * tts : 已连续驾驶2小时,听歌可以缓解疲劳,可以对我说打开音乐 - * showSeconds : 15 - * highSpeed : {"recommend":"REST_AREA","direction":"FRONT","angle":180,"distance":30} - * lowSpeed : {"recommend":"PARK","direction":"FRONT","angle":180,"distance":5} - * noReTts : 已连续驾驶3小时,为避免事故发生,请尽快进入停车区休息 - */ - - private String level; - private int minMinute; - private int maxMinute; - private String content; - private String tts; - private int showSeconds; - private HighSpeedBean highSpeed; - private LowSpeedBean lowSpeed; - private String noReTts; - - public String getLevel() { - return level; - } - - public void setLevel(String level) { - this.level = level; - } - - public int getMinMinute() { - return minMinute; - } - - public void setMinMinute(int minMinute) { - this.minMinute = minMinute; - } - - public int getMaxMinute() { - return maxMinute; - } - - public void setMaxMinute(int maxMinute) { - this.maxMinute = maxMinute; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getTts() { - return tts; - } - - public void setTts(String tts) { - this.tts = tts; - } - - public int getShowSeconds() { - return showSeconds; - } - - public void setShowSeconds(int showSeconds) { - this.showSeconds = showSeconds; - } - - public HighSpeedBean getHighSpeed() { - return highSpeed; - } - - public void setHighSpeed(HighSpeedBean highSpeed) { - this.highSpeed = highSpeed; - } - - public LowSpeedBean getLowSpeed() { - return lowSpeed; - } - - public void setLowSpeed(LowSpeedBean lowSpeed) { - this.lowSpeed = lowSpeed; - } - - public String getNoReTts() { - return noReTts; - } - - public void setNoReTts(String noReTts) { - this.noReTts = noReTts; - } - - public static class HighSpeedBean { - /** - * recommend : REST_AREA - * direction : FRONT - * angle : 180 - * distance : 30 - */ - - private String recommend; - private String direction; - private int angle; - private int distance; - - public String getRecommend() { - return recommend; - } - - public void setRecommend(String recommend) { - this.recommend = recommend; - } - - public String getDirection() { - return direction; - } - - public void setDirection(String direction) { - this.direction = direction; - } - - public int getAngle() { - return angle; - } - - public void setAngle(int angle) { - this.angle = angle; - } - - public int getDistance() { - return distance; - } - - public void setDistance(int distance) { - this.distance = distance; - } - } - - public static class LowSpeedBean { - /** - * recommend : PARK - * direction : FRONT - * angle : 180 - * distance : 5 - */ - - private String recommend; - private String direction; - private int angle; - private int distance; - - public String getRecommend() { - return recommend; - } - - public void setRecommend(String recommend) { - this.recommend = recommend; - } - - public String getDirection() { - return direction; - } - - public void setDirection(String direction) { - this.direction = direction; - } - - public int getAngle() { - return angle; - } - - public void setAngle(int angle) { - this.angle = angle; - } - - public int getDistance() { - return distance; - } - - public void setDistance(int distance) { - this.distance = distance; - } - } - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XUserInfoRes.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XUserInfoRes.java deleted file mode 100644 index f1c9f22123..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/net/V2XUserInfoRes.java +++ /dev/null @@ -1,344 +0,0 @@ - -package com.mogo.module.v2x.entity.net; - -import com.google.gson.annotations.Expose; -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; - -public class V2XUserInfoRes extends BaseData implements Serializable { - - @Expose - private Result result; - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public Result getResult() { - return result; - } - - public void setResult(Result result) { - this.result = result; - } - - public class Result { - - @Expose - private Info info; - - public Info getInfo() { - return info; - } - - public void setInfo(Info info) { - this.info = info; - } - - - public class Info { - - @Expose - private Long activeStatus; - @Expose - private Long bindStatus; - @Expose - private String bindType; - @Expose - private String bindUserId; - @Expose - private String erpSnGroup; - @Expose - private String erpSnType; - @Expose - private String iccid; - @Expose - private String ifCarcorder; - @Expose - private String ifImdemo; - @Expose - private String ifSocketservice; - @Expose - private String lastActiveCity; - @Expose - private Long lastBrandId; - @Expose - private String lastBrandName; - @Expose - private String lastCarNum; - @Expose - private String lastCarNumEn; - @Expose - private String lastFortaVersion; - @Expose - private Long lastModelId; - @Expose - private String lastModelName; - @Expose - private String sn; - @Expose - private String snGroupDetail; - @Expose - private String songTypeTop2; - @Expose - private String userNickName; - @Expose - private String cardIdAge; - @Expose - private String headImgUrl; - @Expose - private String cardIdSex; - - public String getHeadImgUrl() { - return headImgUrl; - } - - public void setHeadImgUrl(String headImgUrl) { - this.headImgUrl = headImgUrl; - } - - public String getCardIdSex() { - return cardIdSex; - } - - public void setCardIdSex(String cardIdSex) { - this.cardIdSex = cardIdSex; - } - - public String getCardIdAge() { - return cardIdAge; - } - - public void setCardIdAge(String cardIdAge) { - this.cardIdAge = cardIdAge; - } - - public Long getActiveStatus() { - return activeStatus; - } - - public void setActiveStatus(Long activeStatus) { - this.activeStatus = activeStatus; - } - - public Long getBindStatus() { - return bindStatus; - } - - public void setBindStatus(Long bindStatus) { - this.bindStatus = bindStatus; - } - - public String getBindType() { - return bindType; - } - - public void setBindType(String bindType) { - this.bindType = bindType; - } - - public String getBindUserId() { - return bindUserId; - } - - public void setBindUserId(String bindUserId) { - this.bindUserId = bindUserId; - } - - @Override - public String toString() { - return "Info{" + - "activeStatus=" + activeStatus + - ", bindStatus=" + bindStatus + - ", bindType='" + bindType + '\'' + - ", bindUserId='" + bindUserId + '\'' + - ", erpSnGroup='" + erpSnGroup + '\'' + - ", erpSnType='" + erpSnType + '\'' + - ", iccid='" + iccid + '\'' + - ", ifCarcorder='" + ifCarcorder + '\'' + - ", ifImdemo='" + ifImdemo + '\'' + - ", ifSocketservice='" + ifSocketservice + '\'' + - ", lastActiveCity='" + lastActiveCity + '\'' + - ", lastBrandId=" + lastBrandId + - ", lastBrandName='" + lastBrandName + '\'' + - ", lastCarNum='" + lastCarNum + '\'' + - ", lastCarNumEn='" + lastCarNumEn + '\'' + - ", lastFortaVersion='" + lastFortaVersion + '\'' + - ", lastModelId=" + lastModelId + - ", lastModelName='" + lastModelName + '\'' + - ", sn='" + sn + '\'' + - ", snGroupDetail='" + snGroupDetail + '\'' + - ", songTypeTop2='" + songTypeTop2 + '\'' + - ", userNickName='" + userNickName + '\'' + - ", cardIdAge='" + cardIdAge + '\'' + - ", headImgUrl='" + headImgUrl + '\'' + - ", cardIdSex='" + cardIdSex + '\'' + - '}'; - } - - public String getErpSnGroup() { - return erpSnGroup; - } - - public void setErpSnGroup(String erpSnGroup) { - this.erpSnGroup = erpSnGroup; - } - - public String getErpSnType() { - return erpSnType; - } - - public void setErpSnType(String erpSnType) { - this.erpSnType = erpSnType; - } - - public String getIccid() { - return iccid; - } - - public void setIccid(String iccid) { - this.iccid = iccid; - } - - public String getIfCarcorder() { - return ifCarcorder; - } - - public void setIfCarcorder(String ifCarcorder) { - this.ifCarcorder = ifCarcorder; - } - - public String getIfImdemo() { - return ifImdemo; - } - - public void setIfImdemo(String ifImdemo) { - this.ifImdemo = ifImdemo; - } - - public String getIfSocketservice() { - return ifSocketservice; - } - - public void setIfSocketservice(String ifSocketservice) { - this.ifSocketservice = ifSocketservice; - } - - public String getLastActiveCity() { - return lastActiveCity; - } - - public void setLastActiveCity(String lastActiveCity) { - this.lastActiveCity = lastActiveCity; - } - - public Long getLastBrandId() { - return lastBrandId; - } - - public void setLastBrandId(Long lastBrandId) { - this.lastBrandId = lastBrandId; - } - - public String getLastBrandName() { - return lastBrandName; - } - - public void setLastBrandName(String lastBrandName) { - this.lastBrandName = lastBrandName; - } - - public String getLastCarNum() { - return lastCarNum; - } - - public void setLastCarNum(String lastCarNum) { - this.lastCarNum = lastCarNum; - } - - public String getLastCarNumEn() { - return lastCarNumEn; - } - - public void setLastCarNumEn(String lastCarNumEn) { - this.lastCarNumEn = lastCarNumEn; - } - - public String getLastFortaVersion() { - return lastFortaVersion; - } - - public void setLastFortaVersion(String lastFortaVersion) { - this.lastFortaVersion = lastFortaVersion; - } - - public Long getLastModelId() { - return lastModelId; - } - - public void setLastModelId(Long lastModelId) { - this.lastModelId = lastModelId; - } - - public String getLastModelName() { - return lastModelName; - } - - public void setLastModelName(String lastModelName) { - this.lastModelName = lastModelName; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public String getSnGroupDetail() { - return snGroupDetail; - } - - public void setSnGroupDetail(String snGroupDetail) { - this.snGroupDetail = snGroupDetail; - } - - public String getSongTypeTop2() { - return songTypeTop2; - } - - public void setSongTypeTop2(String songTypeTop2) { - this.songTypeTop2 = songTypeTop2; - } - - public String getUserNickName() { - return userNickName; - } - - public void setUserNickName(String userNickName) { - this.userNickName = userNickName; - } - - } - - @Override - public String toString() { - return "Result{" + - "info=" + info + - '}'; - } - } - - @Override - public String toString() { - return "UserInfoEntity{" + - "result=" + result + - '}'; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/BackRefreshInfo.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/BackRefreshInfo.java deleted file mode 100644 index 2291ee041c..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/BackRefreshInfo.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -import java.io.Serializable; - -/** - * 返回刷新 - */ -public class BackRefreshInfo implements Serializable { - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt deleted file mode 100644 index c8a758acfa..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.module.v2x.entity.panel - -/** - * @description - * - * @author lixiaopeng - * @since 2019-10-24 - */ -data class Center ( - val lat: Double, - val lon: Double -) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingConstruction.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingConstruction.java deleted file mode 100644 index 060d207836..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingConstruction.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.enums.EventTypeEnum; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * @author lixiaopeng - * @description 构造数据 - * @since 2020/8/7 - */ -public class SurroundingConstruction implements Serializable { - private String poiType; - private List construtList; - - public SurroundingConstruction(String poiType) { - this.poiType = poiType; - construtList = new ArrayList<>(); - } - - public String getPoiType() { - return poiType; - } - - public void setPoiType(String poiType) { - this.poiType = poiType; - } - - public List getConstrutList() { - return construtList; - } - - public void addMarkerExploreWay(MarkerExploreWay item) { - construtList.add(item); - } - - public String getTypeNameTTS(String type) { - String typeName = "请查看周边的"; - typeName += EventTypeEnum.getTypeNameTTS(type); - return typeName + "信息"; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java deleted file mode 100644 index f0664eab84..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - - -/** - * @author lixiaopeng - * @description - * @since 2020/7/29 - */ -public class SurroundingRequest { - private Center center; - private String[] poiTypes; - private int radius; - private int limit; - - public SurroundingRequest(Center center, String[] poiTypes, int radius, int limit) { - this.center = center; - this.poiTypes = poiTypes; - this.radius = radius; - this.limit = limit; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java deleted file mode 100644 index d2b4c6bf94..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -import com.mogo.eagle.core.data.BaseData; -import com.mogo.module.common.entity.MarkerExploreWay; - -import java.util.List; - -/** - * @author lixiaopeng - * @description - * @since 2020/7/29 - */ -public class SurroundingResponse extends BaseData { - /** - * msg : null - * result : {"exploreWay":[{"infoId":"740635251747942400","type":"CARD_TYPE_ROAD_CONDITION","location":{"lon":116.370207,"lat":39.968394,"angle":180,"address":"测试直播"},"canLive":false,"fileType":1,"addr":"测试直播","generateTime":1596622804859,"cityName":"","distance":717,"userInfo":{"sn":"E841CC2018PZD20408","userId":0,"userName":"零下的雨008","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592473692394.jpeg"},"items":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1594952448035.mp4?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1596701407%3B1596708607%26q-key-time%3D1596701407%3B1596708607%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D465089a3c078ed60c395cb65d41f61b28e9a3397","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1594952453342.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1596701407%3B1596708607%26q-key-time%3D1596701407%3B1596708607%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D6f36b4c945197737f8576e42a5c599ed3d150a4a"}],"uploadType":"2","poiType":"10011"}]} - */ - private ResultBean result; - - public ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - public static class ResultBean { - private List exploreWay; - - public List getExploreWay() { - return exploreWay; - } - - public void setExploreWay(List exploreWay) { - this.exploreWay = exploreWay; - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventDescription.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventDescription.java deleted file mode 100644 index 4937a3e120..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventDescription.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; - -public class V2XShareEventDescription extends BaseData implements Serializable { - - /** - * detailMsg : - * result : {"enthusiasmIndex":{"id":68,"sn":"ZD802B1932L00622","score":10,"shareNum":1024,"likeNum":0,"notLikeNum":0,"enthusiasmIndex":1,"createTime":"2020-07-28T06:21:11.523+0000","updateTime":"2020-07-28T06:21:11.523+0000"}} - */ - - private String detailMsg; - private ResultBean result; - - public String getDetailMsg() { - return detailMsg; - } - - public void setDetailMsg(String detailMsg) { - this.detailMsg = detailMsg; - } - - public ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - public static class ResultBean { - /** - * enthusiasmIndex : {"id":68,"sn":"ZD802B1932L00622","score":10,"shareNum":1024,"likeNum":0,"notLikeNum":0,"enthusiasmIndex":1,"createTime":"2020-07-28T06:21:11.523+0000","updateTime":"2020-07-28T06:21:11.523+0000"} - */ - - private EnthusiasmIndexBean enthusiasmIndex; - - public EnthusiasmIndexBean getEnthusiasmIndex() { - return enthusiasmIndex; - } - - public void setEnthusiasmIndex(EnthusiasmIndexBean enthusiasmIndex) { - this.enthusiasmIndex = enthusiasmIndex; - } - - public static class EnthusiasmIndexBean{ - @Override - public String toString() { - return "EnthusiasmIndexBean{" + - ", id=" + id + - ", sn='" + sn + '\'' + - ", score=" + score + - ", shareNum=" + shareNum + - ", likeNum=" + likeNum + - ", notLikeNum=" + notLikeNum + - ", enthusiasmIndex=" + enthusiasmIndex + - ", createTime='" + createTime + '\'' + - ", updateTime='" + updateTime + '\'' + - '}'; - } - - /** - * id : 68 - * sn : ZD802B1932L00622 - * score : 10 - * shareNum : 1024 - * likeNum : 0 - * notLikeNum : 0 - * enthusiasmIndex : 1.0 - * createTime : 2020-07-28T06:21:11.523+0000 - * updateTime : 2020-07-28T06:21:11.523+0000 - */ - private int id; - private String sn; - private int score; - private int shareNum = 0; - private int likeNum = 0; - private int notLikeNum = 0; - private double enthusiasmIndex = 10; - private String createTime; - private String updateTime; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public int getScore() { - return score; - } - - public void setScore(int score) { - this.score = score; - } - - public int getShareNum() { - return shareNum; - } - - public void setShareNum(int shareNum) { - this.shareNum = shareNum; - } - - public int getLikeNum() { - return likeNum; - } - - public void setLikeNum(int likeNum) { - this.likeNum = likeNum; - } - - public int getNotLikeNum() { - return notLikeNum; - } - - public void setNotLikeNum(int notLikeNum) { - this.notLikeNum = notLikeNum; - } - - public double getEnthusiasmIndex() { - return enthusiasmIndex; - } - - public void setEnthusiasmIndex(double enthusiasmIndex) { - this.enthusiasmIndex = enthusiasmIndex; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventItem.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventItem.java deleted file mode 100644 index 41819a5ec6..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventItem.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; -import java.util.List; - -public class V2XShareEventItem extends BaseData implements Serializable { - - private String detailMsg; - private ResultBean result; - - public String getDetailMsg() { - return detailMsg; - } - - public void setDetailMsg(String detailMsg) { - this.detailMsg = detailMsg; - } - - public ResultBean getResult() { - return result; - } - - public void setResult(ResultBean result) { - this.result = result; - } - - public static class ResultBean { - private PageBean page; - - public PageBean getPage() { - return page; - } - - public void setPage(PageBean page) { - this.page = page; - } - - public static class PageBean { - - private int total; - private int pageSize; - private int pageNum; - private List content; - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public int getPageNum() { - return pageNum; - } - - public void setPageNum(int pageNum) { - this.pageNum = pageNum; - } - - public List getContent() { - return content; - } - - public void setContent(List content) { - this.content = content; - } - - public static class ContentBean { - @Override - public String toString() { - return "ContentBean{" + - "viewType=" + viewType + - ", uploadTimestamp=" + uploadTimestamp + - ", timeout=" + timeout + - ", uploadAddress='" + uploadAddress + '\'' + - ", distance=" + distance + - ", dbId='" + dbId + '\'' + - ", poiType='" + poiType + '\'' + - ", sn='" + sn + '\'' + - ", userId=" + userId + - ", userName='" + userName + '\'' + - ", userHead='" + userHead + '\'' + - ", likeNum=" + likeNum + - ", notlikeNum=" + notlikeNum + - ", uploadType=" + uploadType + - ", uploadUser='" + uploadUser + '\'' + - ", imgUrl=" + imgUrl + - ", content=" + content + - ", gasStationId=" + gasStationId + - ", gasStationName=" + gasStationName + - ", gasImg=" + gasImg + - ", gasPrices=" + gasPrices + - ", endDate='" + endDate + '\'' + - ", fabulous=" + fabulous + - ", direction=" + direction + - ", virtualLikeNum=" + virtualLikeNum + - ", status=" + status + - ", sourceType='" + sourceType + '\'' + - ", hitId='" + hitId + '\'' + - ", userType=" + userType + - ", coordinates=" + coordinates + - ", data=" + data + - '}'; - } - - private int viewType = V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST; - private Long uploadTimestamp; - private long timeout; - private String uploadAddress; - private Integer distance; - private String dbId; - private String poiType; - private String sn; - private Long userId; - private String userName; - private String userHead; - private Integer likeNum; - private int notlikeNum; - private Integer uploadType; - private String uploadUser; - private String imgUrl; - private String content; - private String gasStationId; - private String gasStationName; - private String gasImg; - private String gasPrices; - private String endDate; - private boolean fabulous; - private Integer direction; - private Integer virtualLikeNum; - private Integer status; - private String sourceType; - private String hitId; - private Integer userType; - private List coordinates; - private List data; - - public Long getUploadTimestamp() { - return uploadTimestamp; - } - - public void setUploadTimestamp(Long uploadTimestamp) { - this.uploadTimestamp = uploadTimestamp; - } - - public long getTimeout() { - return timeout; - } - - public void setTimeout(Long timeout) { - this.timeout = timeout; - } - - public String getUploadAddress() { - return uploadAddress; - } - - public void setUploadAddress(String uploadAddress) { - this.uploadAddress = uploadAddress; - } - - public Integer getDistance() { - return distance; - } - - public void setDistance(Integer distance) { - this.distance = distance; - } - - public String getDbId() { - return dbId; - } - - public void setDbId(String dbId) { - this.dbId = dbId; - } - - public String getPoiType() { - return poiType; - } - - public void setPoiType(String poiType) { - this.poiType = poiType; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserHead() { - return userHead; - } - - public void setUserHead(String userHead) { - this.userHead = userHead; - } - - public Integer getLikeNum() { - return likeNum; - } - - public void setLikeNum(Integer likeNum) { - this.likeNum = likeNum; - } - - public int getNotlikeNum() { - return notlikeNum; - } - - public void setNotlikeNum(int notlikeNum) { - this.notlikeNum = notlikeNum; - } - - public Integer getUploadType() { - return uploadType; - } - - public void setUploadType(Integer uploadType) { - this.uploadType = uploadType; - } - - public String getUploadUser() { - return uploadUser; - } - - public void setUploadUser(String uploadUser) { - this.uploadUser = uploadUser; - } - - public String getImgUrl() { - return imgUrl; - } - - public void setImgUrl(String imgUrl) { - this.imgUrl = imgUrl; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getGasStationId() { - return gasStationId; - } - - public void setGasStationId(String gasStationId) { - this.gasStationId = gasStationId; - } - - public String getGasStationName() { - return gasStationName; - } - - public void setGasStationName(String gasStationName) { - this.gasStationName = gasStationName; - } - - public String getGasImg() { - return gasImg; - } - - public void setGasImg(String gasImg) { - this.gasImg = gasImg; - } - - public String getGasPrices() { - return gasPrices; - } - - public void setGasPrices(String gasPrices) { - this.gasPrices = gasPrices; - } - - public String getEndDate() { - return endDate; - } - - public void setEndDate(String endDate) { - this.endDate = endDate; - } - - public boolean isFabulous() { - return fabulous; - } - - public void setFabulous(boolean fabulous) { - this.fabulous = fabulous; - } - - public Integer getDirection() { - return direction; - } - - public void setDirection(Integer direction) { - this.direction = direction; - } - - public Integer getVirtualLikeNum() { - return virtualLikeNum; - } - - public void setVirtualLikeNum(Integer virtualLikeNum) { - this.virtualLikeNum = virtualLikeNum; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getSourceType() { - return sourceType; - } - - public void setSourceType(String sourceType) { - this.sourceType = sourceType; - } - - public String getHitId() { - return hitId; - } - - public void setHitId(String hitId) { - this.hitId = hitId; - } - - public Integer getUserType() { - return userType; - } - - public void setUserType(Integer userType) { - this.userType = userType; - } - - public List getCoordinates() { - return coordinates; - } - - public void setCoordinates(List coordinates) { - this.coordinates = coordinates; - } - - public List getData() { - return data; - } - - public void setData(List data) { - this.data = data; - } - - public static class DataBean { - /** - * url : http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4 - * thumbnail : http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4 - * content : null - * illegalCount : null - */ - - private String url; - private String thumbnail; - private String content; - private Object illegalCount; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getThumbnail() { - return thumbnail; - } - - public void setThumbnail(String thumbnail) { - this.thumbnail = thumbnail; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Object getIllegalCount() { - return illegalCount; - } - - public void setIllegalCount(Object illegalCount) { - this.illegalCount = illegalCount; - } - } - } - } - } -} - - diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventItemEnum.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventItemEnum.java deleted file mode 100644 index 068a5369dc..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventItemEnum.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -public interface V2XShareEventItemEnum { - - int ITEM_TYPE_NUM_DES = 0; - int ITEM_TYPE_SHARE_LIST = 1; - int ITEM_TYPE_SHARE_EMPTY = 2; - int ITEM_TYPE_LOAD_MORE_STATUS = 3; - int ITEM_TYPE_NO_MORE = 4; - int ITEM_TYPE_OTHER = 5; - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventLoadMoreItem.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventLoadMoreItem.java deleted file mode 100644 index 7153024a84..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/V2XShareEventLoadMoreItem.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.module.v2x.entity.panel; - -import com.mogo.eagle.core.data.BaseData; - -import java.io.Serializable; - -/* - * 没有任何分享,去分享/加载更多/没有更多了 - * */ -public class V2XShareEventLoadMoreItem extends BaseData implements Serializable { - private String statusText; - private int viewType; - private boolean clickable = true; - - public boolean isClickable() { - return clickable; - } - - public void setClickable(boolean clickable) { - this.clickable = clickable; - } - - public int getViewType() { - return viewType; - } - - public void setViewType(int viewType) { - this.viewType = viewType; - } - - public void setStatusText(String statusText) { - this.statusText = statusText; - } - - public String getStatusText() { - return statusText; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt deleted file mode 100644 index bc86d824e2..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt +++ /dev/null @@ -1,460 +0,0 @@ -package com.mogo.module.v2x.fragment - -import android.content.Intent -import android.graphics.Color -import android.graphics.Typeface -import android.os.Bundle -import android.text.SpannableString -import android.text.Spanned -import android.text.style.AbsoluteSizeSpan -import android.text.style.ForegroundColorSpan -import android.text.style.StyleSpan -import android.view.View -import android.widget.ImageView -import android.widget.RadioButton -import android.widget.RadioGroup -import android.widget.TextView -import androidx.constraintlayout.widget.ConstraintLayout -import androidx.fragment.app.Fragment -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import androidx.viewpager2.widget.ViewPager2 -import com.google.android.material.tabs.TabLayoutMediator -import com.mogo.commons.debug.DebugConfig -import com.mogo.commons.mvp.MvpFragment -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.common.entity.MarkerExploreWay -import com.mogo.module.common.MogoApisHandler -import com.mogo.module.common.enums.EventTypeEnum -import com.mogo.module.v2x.R -import com.mogo.module.common.view.SpacesItemDecoration -import com.mogo.module.v2x.V2XConst.MODULE_NAME -import com.mogo.module.v2x.V2XServiceManager -import com.mogo.module.v2x.adapter.V2XEventPagerAdapter -import com.mogo.module.v2x.adapter.V2XSurroundingDetailAdapter -import com.mogo.module.v2x.entity.panel.BackRefreshInfo -import com.mogo.module.v2x.entity.panel.SurroundingConstruction -import com.mogo.module.v2x.listener.SurroundingDetailItemListener -import com.mogo.module.v2x.presenter.EventPanelPresenter -import com.mogo.module.v2x.utils.TrackUtils -import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener -import com.mogo.module.v2x.voice.V2XVoiceConstants -import com.mogo.module.v2x.voice.V2XVoiceManager -import com.mogo.service.statusmanager.IMogoStatusChangedListener -import com.mogo.service.statusmanager.StatusDescriptor -import org.greenrobot.eventbus.EventBus -import org.greenrobot.eventbus.Subscribe -import org.greenrobot.eventbus.ThreadMode - - -/** - * 事件面板主fragment - * - * @author tongchenfei - */ -class V2XEventPanelFragment : MvpFragment(), SurroundingDetailItemListener ,IMogoStatusChangedListener{ - - private val TAG = "V2XEventPanelFragment" - - private var isFirstLoad = false - - private var fragments: Array? = null - - private var mediator: TabLayoutMediator? = null - - private var mV2XEventPanelHistoryCountView: V2XEventPanelHistoryCountView? = null - - private var mClPanelContainer: ConstraintLayout? = null - private var mVpEventPanel: ViewPager2? = null - private var mRgTabSelect: RadioGroup? = null - private var mBtnHidePanels: ImageView? = null - private var mRbScenarioHistory: RadioButton? = null - private var mRbSurroundingEvent: RadioButton? = null - private var mRbShareEvents: RadioButton? = null - - private var mBackImage: ImageView? = null - private var mTopBriefTv: TextView? = null - private var mDetailRecyclerView: RecyclerView? = null - private lateinit var mSurroundingDetailAdapter: V2XSurroundingDetailAdapter - var markerExploreWays = mutableListOf() - - private var mV2XScenarioHistoryFragment: V2XScenarioHistoryFragment? = null - private var mV2XShareEventsFragment: V2XShareEventsFragment? = null - private var mV2XSurroundingFragment: V2XSurroundingFragment? = null - - companion object { - private var fragment: V2XEventPanelFragment? = null - fun getInstance(): V2XEventPanelFragment { - if (fragment == null) { - synchronized(this) { - if (fragment == null) { - fragment = V2XEventPanelFragment() - } - } - } - return fragment as V2XEventPanelFragment - } - } - - // 打开出行动态TAB - private val mCheckHistoryEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? -> - try { - mRbScenarioHistory?.isChecked = true - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - EventBus.getDefault().register(this) - } - - // 打开周边事件TAB - private val mCheckSurroundingCb = V2XVoiceCallbackListener { _: String?, _: Intent? -> - try { - mRbSurroundingEvent?.isChecked = true - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - - // 打开我的分享TAB - private val mCheckShearEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? -> - try { - mRbShareEvents?.isChecked = true - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - - // 打关闭事件面板 - private val mCloeEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? -> - try { - TrackUtils.trackV2xHistoryEvent(5) - hidePanel() - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - - override fun getLayoutId(): Int { - return R.layout.module_v2x_event_panel_fragment_event_panel - } - - override fun getTagName(): String { - return TAG - } - - override fun initViews() { - Logger.d(MODULE_NAME, "事件面板初始化……") - try { - mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment() - mV2XShareEventsFragment = V2XShareEventsFragment() - mV2XSurroundingFragment = V2XSurroundingFragment() - - fragments = arrayOf( - mV2XScenarioHistoryFragment!!, - mV2XSurroundingFragment!!, - mV2XShareEventsFragment!! - ) - - - mClPanelContainer = mRootView.findViewById(R.id.clPanelContainer) - mVpEventPanel = mRootView.findViewById(R.id.vpEventPanel) - mRgTabSelect = mRootView.findViewById(R.id.rgTabSelect) - mBtnHidePanels = mRootView.findViewById(R.id.btnHidePanels) - mRbScenarioHistory = mRootView.findViewById(R.id.rbScenarioHistory) - mRbSurroundingEvent = mRootView.findViewById(R.id.rbSurroundingEvent) - mRbShareEvents = mRootView.findViewById(R.id.rbShareEvents) - - mBackImage = mRootView.findViewById(R.id.back_image) - mTopBriefTv = mRootView.findViewById(R.id.tv_brief_detail) - mDetailRecyclerView = mRootView.findViewById(R.id.surrounding_detail_recycleview) - - initDetail() - - // M1 不基于地图的版本直接展示事件面板,且不可关闭 - if (!DebugConfig.isMapBased()) { - mClPanelContainer?.visibility = View.VISIBLE - mBtnHidePanels?.visibility = View.GONE - } - - //禁用预加载 - mVpEventPanel?.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT - mVpEventPanel?.adapter = V2XEventPagerAdapter(this, fragments!!) - mVpEventPanel?.isUserInputEnabled = false; //true:滑动,false:禁止滑动 - - mRgTabSelect?.setOnCheckedChangeListener { _, checkedId -> - when (checkedId) { - R.id.rbScenarioHistory -> { - // 更改选中是否加粗 - mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.BOLD) - mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - - TrackUtils.trackV2xHistoryEvent(2) - mVpEventPanel?.setCurrentItem(0, false) - } - R.id.rbSurroundingEvent -> { - // 更改选中是否加粗 - mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.BOLD) - mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - - TrackUtils.trackV2xHistoryEvent(3) - mVpEventPanel?.setCurrentItem(1, false) - } - R.id.rbShareEvents -> { - // 更改选中是否加粗 - mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) - mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.BOLD) - - TrackUtils.trackV2xHistoryEvent(4) - mVpEventPanel?.setCurrentItem(2, false) - } - } - } - - mBtnHidePanels?.setOnClickListener { - TrackUtils.trackV2xHistoryEvent(5) - hidePanel() - } - - mBackImage?.setOnClickListener { - EventBus.getDefault().post(BackRefreshInfo()) - showBaseUi(true) - } - - mV2XEventPanelHistoryCountView = V2XEventPanelHistoryCountView(context) - mV2XEventPanelHistoryCountView!!.setOnClickListener { - if (mClPanelContainer == null) { - mClPanelContainer = mRootView.findViewById(R.id.clPanelContainer); - } - if (mClPanelContainer != null) { - if (!isPanelShow()) { - TrackUtils.trackV2xHistoryEvent(1) - showPanel() - } - } - } - - // M1 不基于地图的版本直接展示事件面板,且不可关闭 - if (DebugConfig.isMapBased()) { - val x = resources.getDimensionPixelSize(if (DebugConfig.isLauncher()) { - R.dimen.module_v2x_event_panel_in_launcher_btn_x - } else { - R.dimen.module_v2x_event_panel_btn_x - }) - val y = resources.getDimensionPixelSize(R.dimen.module_v2x_event_panel_btn_y) - - if (V2XServiceManager.getMogoEntranceButtonController() != null) { - V2XServiceManager.getMogoEntranceButtonController() - .addBottomLayerView(mV2XEventPanelHistoryCountView, x, y) - } - mV2XEventPanelHistoryCountView?.visibility = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) { - View.GONE - }else{ - View.VISIBLE - } - changeEventCount() - MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this) - } else { - // 模拟手动点击,默认选择第二个,周边事件 - // http://jira.zhidaohulian.com/browse/E84XAD-250 - mRgTabSelect?.check(R.id.rbSurroundingEvent) - } - - } catch (e: Exception) { - e.printStackTrace() - } - } - - override fun onDestroyView() { - EventBus.getDefault().unregister(this) - MogoApisHandler.getInstance().apis.statusManagerApi.unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this) - mediator?.detach() - // 避免内存泄漏 - fragment = null - mClPanelContainer = null - super.onDestroyView() - } - - override fun createPresenter(): EventPanelPresenter { - - return EventPanelPresenter(this) - } - - /* - * 语音查询热心指数需求 - * */ - fun showPanelWithSelectedItem(item: Int) { - showPanel() - selectWithItem(item) - } - - override fun onItemClickListener(v: View?, position: Int, exploreWay: MarkerExploreWay?) { - markerExploreWays[position].isFabulous = true - mSurroundingDetailAdapter.notifyItemChanged(position) - } - - private fun initDetail() { - mDetailRecyclerView!!.addItemDecoration(SpacesItemDecoration(resources.getDimension(R.dimen.share_item_padding).toInt())) - mSurroundingDetailAdapter = V2XSurroundingDetailAdapter(activity, markerExploreWays, this) - mDetailRecyclerView!!.adapter = mSurroundingDetailAdapter - val linearLayoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false) - mDetailRecyclerView!!.layoutManager = linearLayoutManager - } - - @Subscribe(threadMode = ThreadMode.MAIN) - fun updateSurroundingDetail(data: SurroundingConstruction) { - loadSurroundingDetail(data) - } - - private fun loadSurroundingDetail(detailData: SurroundingConstruction?) { - showBaseUi(false) - if (detailData != null) { - markerExploreWays.clear() - markerExploreWays.addAll(detailData.construtList.toMutableList()) - mSurroundingDetailAdapter.notifyDataSetChanged() - - val originStr = String.format(context!!.resources.getString(R.string.v2x_surrounding_detail_top_brief), markerExploreWays.size) - val spannableString = SpannableString(originStr + EventTypeEnum.getTypeName(detailData.poiType)) - spannableString.setSpan(ForegroundColorSpan(Color.parseColor("#459DFF")), - 7, originStr.length - EventTypeEnum.getTypeName(detailData.poiType)?.length!!, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) - //设置字体大小,true表示前面的字体大小 dip - spannableString.setSpan(AbsoluteSizeSpan(context!!.resources.getDimension(R.dimen.module_v2x_surrounding_top_textsize).toInt(), true), - 7, originStr.length - EventTypeEnum.getTypeName(detailData.poiType)?.length!!, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) - spannableString.setSpan(StyleSpan(Typeface.BOLD), 7, - originStr.length - EventTypeEnum.getTypeName(detailData.poiType)?.length!!, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) - mTopBriefTv?.text = (spannableString) - } - } - - /** - * 是否显示基础页面 - */ - private fun showBaseUi(isShow: Boolean) { - if (isShow) { - mBackImage?.visibility = View.GONE - mTopBriefTv?.visibility = View.GONE - mDetailRecyclerView?.visibility = View.GONE - - mRgTabSelect?.visibility = View.VISIBLE - mVpEventPanel?.visibility = View.VISIBLE - if (DebugConfig.isMapBased()) { - mBtnHidePanels?.visibility = View.VISIBLE - } - } else { - mBackImage?.visibility = View.VISIBLE - mTopBriefTv?.visibility = View.VISIBLE - mDetailRecyclerView?.visibility = View.VISIBLE - - mRgTabSelect?.visibility = View.GONE - mVpEventPanel?.visibility = View.GONE - if (DebugConfig.isMapBased()) { - mBtnHidePanels?.visibility = View.GONE - } - } - } - - /* - * 语音查询事件面板内容 - * */ - private fun selectWithItem(item: Int) { - when (item) { - 0 -> { - try { - mRbScenarioHistory?.isChecked = true - mV2XScenarioHistoryFragment?.fromVoice = true - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - 1 -> { - try { - if (mRbSurroundingEvent?.isChecked == true) { - mV2XSurroundingFragment?.ttsForVoiceCheckout() - } else { - mRbSurroundingEvent?.isChecked = true - mV2XSurroundingFragment?.fromVoice = true - } - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - 2 -> { - try { - if (mRbShareEvents?.isChecked == true) { - mV2XShareEventsFragment?.ttsForVoiceCheckout() - } else { - mRbShareEvents?.isChecked = true - mV2XShareEventsFragment?.fromVoice = true - } - } catch (e: java.lang.Exception) { - e.printStackTrace() - } - } - } - } - - fun showPanel() { - Logger.d(MODULE_NAME, "in fragment show panel") - mClPanelContainer?.visibility = View.VISIBLE - - if (DebugConfig.isMapBased()) { - V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, mCloeEventCb) - } - // 注册语音交互 - V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, mCheckHistoryEventCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, mCheckSurroundingCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP, mCheckShearEventCb) - try { - if (isFirstLoad) { - mV2XScenarioHistoryFragment?.presenter?.loadHistory() - mV2XShareEventsFragment?.presenter?.loadShareEventList() - - } - } catch (e: Exception) { - e.printStackTrace() - } - isFirstLoad = true - } - - fun hidePanel() { - if (DebugConfig.isMapBased()) { - Logger.d(MODULE_NAME, "in fragment hide panel") - mClPanelContainer?.visibility = View.GONE - // 注册语音交互 - V2XVoiceManager.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP) - } - } - - fun isPanelShow(): Boolean { - return mClPanelContainer?.visibility == View.VISIBLE - } - - // 修改未处理消息 - fun changeEventCount() { -// val historyMessage = V2XSQLiteUtils.getScenarioHistoryUnDisposeData() -// if (historyMessage != null) { -// mV2XEventPanelHistoryCountView?.changeMsgCount(historyMessage.size) -// } else { -// mV2XEventPanelHistoryCountView?.changeMsgCount(0) -// } - } - - override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) { - if (isTrue) { - // 在vr模式 - mV2XEventPanelHistoryCountView?.visibility = View.GONE - }else{ - mV2XEventPanelHistoryCountView?.visibility = View.VISIBLE - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java deleted file mode 100644 index e344613883..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.mogo.module.v2x.fragment; - -import android.content.Context; -import android.util.Log; -import android.view.View; -import android.widget.LinearLayout; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.commons.mvp.MvpFragment; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.v2x.R; -import com.mogo.module.common.view.SpacesItemDecoration; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XScenarioHistoryAdapter; -import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener; -import com.mogo.module.v2x.manager.V2XStatusDescriptor; -import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.module.v2x.utils.V2XUtils; -import com.mogo.module.v2x.view.V2XListEmptyView; - -import java.util.ArrayList; -import java.util.List; - -/** - * 出行动态,V2X 提示过的场景历史 - * - * @author donghongyu - */ -public class V2XScenarioHistoryFragment - extends MvpFragment { - private String TAG = "V2XScenarioHistoryFragment"; - public Boolean fromVoice = false; - private V2XListEmptyView mEmptyView; - private LinearLayout mClHistoryList; - private RecyclerView mRecyclerView; - private V2XScenarioHistoryAdapter mV2XScenarioHistoryAdapter; - private ArrayList mV2XHistoryScenarioData = new ArrayList<>(); - private IMoGoV2XStatusChangedListener mListener; - - @Override - protected int getLayoutId() { - return R.layout.module_v2x_event_panel_fragment_scenario_history; - } - - @Override - public String getTagName() { - return TAG; - } - - @Override - protected void initViews() { - Log.d(TAG, "initViews --------> "); - - mEmptyView = findViewById(R.id.viewEmpty); - mClHistoryList = findViewById(R.id.clHistoryList); - mRecyclerView = findViewById(R.id.recyclerView); - mRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding))); - mV2XScenarioHistoryAdapter = new V2XScenarioHistoryAdapter(mV2XHistoryScenarioData); - mRecyclerView.setAdapter(mV2XScenarioHistoryAdapter); - mRecyclerView.addItemDecoration(new SpacesItemDecoration(14)); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); - mRecyclerView.setLayoutManager(layoutManager); - initListener(); - - mEmptyView.setTripMessage("暂无交通事件"); - mEmptyView.setRefreshVisibility(false); - } - - /** - * 初始化页面用到得监听 - */ - private void initListener() { - mEmptyView.setOnControlListener(new V2XListEmptyView.OnControlListener() { - @Override - public void onShearClick() { - V2XServiceManager.getMogoShareManager().showShareDialog(); - V2XEventPanelFragment.Companion.getInstance().hidePanel(); - } - - @Override - public void onRefreshClick() { - - } - }); - - - mListener = new IMoGoV2XStatusChangedListener() { - @Override - public void onStatusChanged( V2XStatusDescriptor descriptor, boolean isTrue ) { - Logger.d( TAG, descriptor + " initViews --------> " + isTrue ); - if ( descriptor == V2XStatusDescriptor.EventPanelWindow_UI ) { - mPresenter.loadHistory(); - } - } - - @Override - public void init( Context context ) { - Logger.d( TAG, "init --------> " ); - } - }; - V2XServiceManager.getMoGoV2XStatusManager() - .registerStatusChangedListener( - TAG, - V2XStatusDescriptor.EventPanelWindow_UI, - mListener ); - } - - /** - * 列表加载数据 - * - * @param v2XHistoryScenarioData 最新数据 - */ - public void loadHistory(List v2XHistoryScenarioData) { - Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData)); - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - mV2XHistoryScenarioData.clear(); - if (v2XHistoryScenarioData.size() > 0) { - mEmptyView.setVisibility(View.GONE); - mClHistoryList.setVisibility(View.VISIBLE); - mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData); - } else { - mEmptyView.setVisibility(View.VISIBLE); - mClHistoryList.setVisibility(View.GONE); - } - mV2XScenarioHistoryAdapter.notifyDataSetChanged(); - ttsForHistoryFirstToday(); - if (fromVoice == true) { - ttsForVoiceCheckout(); - fromVoice = false; - } - } - }); - } - - /* - * 手动点击出行动态 TTS播报 - * */ - private void ttsForHistoryFirstToday() { - boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_HISTORY_SELECTED"); - if (!hasBroadTts) { - if (mV2XHistoryScenarioData.size() > 0) { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("小智为您记录了今天的出行事件", null); - } else { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("小智在这里为您记录今天的出行事件", null); - } - - } - } - - /* - * 语音查询出行动态 TTS播报 - * */ - public void ttsForVoiceCheckout() { - if (mV2XHistoryScenarioData.size() > 0) { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("为您找到以下动态请查看", null); - } else { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("今天暂无出行动态,试试对我说分享拥堵给其他车友吧", null); - } - } - - @Override - public void onResume() { - super.onResume(); - // 清除V2X事件数据库中过期的数据,数据有效期为24小时 - V2XSQLiteUtils.clearYesterdayScenarioHistoryData(); - mPresenter.loadHistory(); - } - - @NonNull - @Override - protected ScenarioHistoryPresenter createPresenter() { - return new ScenarioHistoryPresenter(this); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - V2XServiceManager.getMoGoV2XStatusManager().unregisterStatusChangedListener( TAG, - V2XStatusDescriptor.EventPanelWindow_UI, - mListener - ); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java deleted file mode 100644 index 10d4831bd8..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java +++ /dev/null @@ -1,268 +0,0 @@ -package com.mogo.module.v2x.fragment; - -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.commons.mvp.MvpFragment; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.view.LinearLayoutCommonManager; -import com.mogo.module.v2x.R; -import com.mogo.module.common.view.SpacesItemDecoration; -import com.mogo.module.v2x.adapter.V2XShareEventAdapter; -import com.mogo.module.v2x.entity.panel.V2XShareEventDescription; -import com.mogo.module.v2x.entity.panel.V2XShareEventItem; -import com.mogo.module.v2x.entity.panel.V2XShareEventItemEnum; -import com.mogo.module.v2x.entity.panel.V2XShareEventLoadMoreItem; -import com.mogo.module.v2x.listener.AdapterCallback; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.network.V2XShareNetworkModel; -import com.mogo.module.v2x.presenter.ShareEventsPresenter; -import com.mogo.module.common.view.NetworkLoadingView; -import com.mogo.module.v2x.utils.V2XUtils; - -import java.util.ArrayList; - -public class V2XShareEventsFragment extends MvpFragment implements AdapterCallback { - - private static final String TAG = "V2XShareEventsFragment"; - private RecyclerView recyclerView; - private V2XShareEventAdapter adapter; - private ArrayList dataArrayList = new ArrayList(); - public Boolean fromVoice = false; - private int pageNum = 1; - private V2XShareNetworkModel v2XShareNetworkModel; - private V2XShareEventDescription resultData; - - //动画 - private NetworkLoadingView loadingView; - - @Override - protected int getLayoutId() { - return R.layout.module_v2x_event_share_recylerview; - } - - @Override - public String getTagName() { - return TAG; - } - - @Override - protected void initViews() { - v2XShareNetworkModel = new V2XShareNetworkModel(getContext()); - initRecyclerView(); - initData(); - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - super.onCreateView(inflater, container, savedInstanceState); - return mRootView; - } - - private void initRecyclerView() { - recyclerView = mRootView.findViewById(R.id.road_case_share_list); - recyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding))); - adapter = new V2XShareEventAdapter(getActivity(), dataArrayList, this); - recyclerView.setAdapter(adapter); - LinearLayoutCommonManager linearLayoutManager = - new LinearLayoutCommonManager(getActivity(), LinearLayoutCommonManager.VERTICAL, false); - recyclerView.setLayoutManager(linearLayoutManager); - loadingView = mRootView.findViewById(R.id.network_loading_imageview); - } - - private void initData() { - getShareEventResponse(); - } - - /* - * 获取热心指数,分享列表等分享内容 - * */ - @Override - public void getShareEventResponse() { - pageNum = 1; - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - animationAction(View.VISIBLE); - } - }); - - v2XShareNetworkModel.getShareEventResponse(pageNum, 10, new V2XRefreshCallback() { - @Override - public void onSuccess(Object result) { - if (result instanceof V2XShareEventDescription) { - resultData = (V2XShareEventDescription) result; - - if (resultData != null && resultData.getResult() != null - && resultData.getResult().getEnthusiasmIndex() != null) { - if (dataArrayList.size() > 0) { - dataArrayList.clear(); - } - dataArrayList.add(resultData.getResult().getEnthusiasmIndex()); - if (fromVoice == true) { - try { - ttsForVoiceCheckout(); - } catch (Exception e) { - - } - } - } - } else if (result instanceof V2XShareEventItem) { - Log.d("V2XShareEventsFragment","onSuccess--loadSuccessWithShareEventList"); - loadSuccessWithShareEventList(result); - } - } - - @Override - public void onFail(String msg) { - if (dataArrayList.size() > 0) { - dataArrayList.clear(); - Log.d("V2XShareEventsFragment","onFail--clear"); - adapter.notifyDataSetChanged(); - } - loadingView.stopWithError(msg, View.VISIBLE); - - loadingView.refresButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - getShareEventResponse(); - } - }); - } - - - }); - - } - - /* - * 语音打开我的分享,TTS播报 - * */ - public void ttsForVoiceCheckout() { - int shareNum = resultData.getResult().getEnthusiasmIndex().getShareNum(); - int approveNum = resultData.getResult().getEnthusiasmIndex().getLikeNum(); - double enthusiasm = resultData.getResult().getEnthusiasmIndex().getEnthusiasmIndex(); - Log.d(TAG, String.valueOf(enthusiasm) + "TTS播报热心指数个数"); - String ttsString = ""; - if (enthusiasm <= 2) { - ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm - + "颗星,老铁请再接再厉,对我说,上报路况。分享更多路况帮助其他车友。"; - } else if (2 < enthusiasm && enthusiasm < 5) { - ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm - + "颗星,老铁您的热心温暖了无数车友,加油距离五颗星不远了。"; - } else { - ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm - + "颗星,实至名归,老铁你就是大家一直赞扬的热心车友,请继续保持。"; - } - AIAssist.getInstance(Utils.getApp()).speakTTSVoice(ttsString, null); - fromVoice = false; - } - - /* - * 我的分享列表数据处理 - * */ - private void loadSuccessWithShareEventList(Object result) { - - animationAction(View.GONE); - V2XShareEventItem resultData = (V2XShareEventItem) result; - V2XShareEventLoadMoreItem item = new V2XShareEventLoadMoreItem(); - if (resultData != null && resultData.getResult() != null) { - if (resultData.getResult().getPage() != null) { - int total = resultData.getResult().getPage().getTotal(); - if (total == 0) { - //空白 - item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY); - dataArrayList.add(item); - int len = dataArrayList.size(); - } else { - if (dataArrayList.size() > 0) { - Object data = dataArrayList.get(dataArrayList.size() - 1); - if (data instanceof V2XShareEventLoadMoreItem) { - dataArrayList.remove(dataArrayList.size() - 1); - } - } - if (resultData.getResult().getPage().getContent().size() > 0) { - //当前页有数据 - dataArrayList.addAll(resultData.getResult().getPage().getContent()); - item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS); - } else { - //当前页没有数据 - item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_NO_MORE); - } - if (total > 10) { - dataArrayList.add(item); - } - } - } - Log.d(TAG, "分享列表:" + dataArrayList.get(0)); - } else { - //空白 - item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY); - dataArrayList.add(item); - } - - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - adapter.notifyDataSetChanged(); - } - }); - - } - - private void animationAction(int visible) { - if (visible == View.VISIBLE) { - if (loadingView != null) { - loadingView.start(); - } - } else { - if (loadingView != null) { - loadingView.stop(); - } - } - } - - @NonNull - @Override - protected ShareEventsPresenter createPresenter() { - Log.d(TAG, "createPresenter"); - ttsForSharedFirstToday(); - return new ShareEventsPresenter(this); - } - - private void ttsForSharedFirstToday() { - boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SHARED_SELECTED"); - Log.d(TAG,"shouldBroadTts"+hasBroadTts); - if (!hasBroadTts) { - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("您可以在这里查看历史的分享记录", null); - } - } - - @Override - public void loadMoreShareEventList() { - Log.d(TAG, "page--" + pageNum); - animationAction(View.VISIBLE); - pageNum += 1; - v2XShareNetworkModel.getShareEventList(pageNum, 10, new V2XRefreshCallback() { - @Override - public void onSuccess(Object result) { - loadSuccessWithShareEventList(result); - } - - @Override - public void onFail(String msg) { - loadingView.stopWithError("网络异常,点击刷新重试", View.INVISIBLE); - } - }); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XSurroundingFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XSurroundingFragment.java deleted file mode 100644 index 205d6175b8..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XSurroundingFragment.java +++ /dev/null @@ -1,472 +0,0 @@ -package com.mogo.module.v2x.fragment; - -import android.graphics.Color; -import android.graphics.Rect; -import android.graphics.Typeface; -import android.os.Bundle; -import android.text.SpannableString; -import android.text.Spanned; -import android.text.style.AbsoluteSizeSpan; -import android.text.style.ForegroundColorSpan; -import android.text.style.StyleSpan; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.LinearInterpolator; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.commons.mvp.MvpFragment; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.anim.OnMarkerAnimationListener; -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.service.ServiceConst; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XSurroundingAdapter; -import com.mogo.module.v2x.entity.panel.BackRefreshInfo; -import com.mogo.module.v2x.entity.panel.SurroundingConstruction; -import com.mogo.module.v2x.listener.SurroundingItemClickListener; -import com.mogo.module.v2x.presenter.SurroundingEventPresenter; -import com.mogo.module.v2x.utils.V2XUtils; -import com.mogo.module.v2x.view.SurroundingEventView; -import com.mogo.module.common.view.NetworkLoadingView; -import com.mogo.module.v2x.view.SurroundingMarginDecoration; -import com.mogo.service.IMogoServiceApis; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import static android.view.View.OVER_SCROLL_NEVER; - -/** - * 周边事件 - */ -public class V2XSurroundingFragment extends MvpFragment implements SurroundingEventView, - View.OnClickListener, SurroundingItemClickListener { - private static final String TAG = "V2XSurroundingFragment"; - private RelativeLayout mSurroundingLayout; - private RecyclerView mRecyclerView; - private TextView mTotalTv; - private RelativeLayout mTopLayout; - private RelativeLayout mEmptyLayout; - private TextView mTopFreshTv; - private TextView mShareTv; - private TextView mFreshTv; - private V2XSurroundingAdapter mAdapter; - private SurroundingEventPresenter surroundingEventPresenter; - private List poiInfosList = new ArrayList<>(); - private IMogoServiceApis mApis; - private NetworkLoadingView mloadingImage; - public Boolean fromVoice = false; - - @Override - protected int getLayoutId() { - return R.layout.module_event_panel_fragment_surrounding; - } - - @Override - public String getTagName() { - return TAG; - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - super.onCreateView(inflater, container, savedInstanceState); - return mRootView; - } - - @Override - protected void initViews() { - mSurroundingLayout = findViewById(R.id.layout_surrounding_event); - mRecyclerView = findViewById(R.id.surrounding_recycleview); - mTotalTv = findViewById(R.id.tv_brief); - mTopLayout = findViewById(R.id.layout_top); - mEmptyLayout = findViewById(R.id.layout_empty_data_show); - mTopFreshTv = findViewById(R.id.tv_top_refresh); - mShareTv = findViewById(R.id.tv_main_share); - mFreshTv = findViewById(R.id.tv_main_refresh); - mloadingImage = mRootView.findViewById(R.id.loading_iv); - mTopFreshTv.setOnClickListener(this); - mShareTv.setOnClickListener(this); - mFreshTv.setOnClickListener(this); - -// mRecyclerView.setHasFixedSize(true); - mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER); - GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2); - int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize); - int spacingInPixelsLeft = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_maigin_left); - mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels, spacingInPixelsLeft)); - mRecyclerView.setLayoutManager(layoutManage); - - mAdapter = new V2XSurroundingAdapter(getActivity(), poiInfosList, this); - mRecyclerView.setAdapter(mAdapter); - - initData(); - } - - @NonNull - @Override - protected SurroundingEventPresenter createPresenter() { - surroundingEventPresenter = new SurroundingEventPresenter(getContext(), this); - return surroundingEventPresenter; - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - EventBus.getDefault().register(this); - mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext()); - - } - - @Override - public void onClick(View v) { - int id = v.getId(); - if (id == R.id.tv_main_share) { - //弹出框面板消失,出现分享弹框 - V2XEventPanelFragment.Companion.getInstance().hidePanel(); - if (mApis != null && mApis.getShareManager() != null) { - mApis.getShareManager().showShareDialog(); - } - } else if (id == R.id.tv_main_refresh || id == R.id.tv_top_refresh) { //刷新 - initData(); - } - } - - /** - * 获取和刷新数据 - */ - private void initData() { - mTopLayout.setVisibility(View.GONE); - mRecyclerView.setVisibility(View.GONE); - mEmptyLayout.setVisibility(View.GONE); - mloadingImage.start(); - surroundingEventPresenter.getSurroundingEventData(); - } - - /** - * 展示列表数据 - */ - @Override - public void showSurroudingData(List exploreWayList) { - mloadingImage.stop(); - if (exploreWayList != null && exploreWayList.size() > 0) { - //展示数据 - mTopLayout.setVisibility(View.VISIBLE); - mRecyclerView.setVisibility(View.VISIBLE); - mEmptyLayout.setVisibility(View.GONE); - - poiInfosList.clear(); - //对数据进行分类 - poiInfosList.addAll(handleMapToList(getPoiTypeMap(exploreWayList))); - mAdapter.notifyDataSetChanged(); - - //总条数 - String originStr = String.format(getContext().getResources().getString(R.string.v2x_surrounding_top_brief), exploreWayList.size()); - SpannableString spannableString = new SpannableString(originStr); - spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#459DFF")), - 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - //设置字体大小,true表示前面的字体大小 dip - spannableString.setSpan(new AbsoluteSizeSpan((int) getContext().getResources().getDimension(R.dimen.module_v2x_surrounding_top), true), - 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - spannableString.setSpan(new StyleSpan(Typeface.BOLD), 7, - originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - mTotalTv.setText(spannableString); - - ttsForSurroundingFirstToday(exploreWayList.size()); - } else { - mTopLayout.setVisibility(View.GONE); - mRecyclerView.setVisibility(View.GONE); - mEmptyLayout.setVisibility(View.VISIBLE); - } - if (fromVoice == true) { - ttsForVoiceCheckout(); - fromVoice = false; - } - } - - /** - * 手动点击周边事件 TTS播报 - */ - private void ttsForSurroundingFirstToday(int eventCount) { - boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SURROUNDING_SELECTED"); - if (!hasBroadTts) { - if (eventCount > 0) { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("发现周边" + eventCount + "条交通信息", null); - } else { - Logger.e(TAG,"周边没有发现交通信息"); - } - } - } - - /* - * 语音查询周边事件 TTS播报 - * */ - public void ttsForVoiceCheckout() { - if (poiInfosList.size() > 0) { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("为您找到周边以下事件请查看", null); - } else { - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice("周边5公里内无事件,试试对我说分享路况给其他车友吧", null); - } - } - - - private Map getPoiTypeMap(List list) { - Map mPoiTypeMarkers = new HashMap<>(); - for (int i = 0; i < list.size(); i++) { - MarkerExploreWay exploreWay = list.get(i); - if (!mPoiTypeMarkers.containsKey(exploreWay.getPoiType())) { - mPoiTypeMarkers.put(exploreWay.getPoiType(), new SurroundingConstruction(exploreWay.getPoiType())); - } - SurroundingConstruction construction = mPoiTypeMarkers.get(exploreWay.getPoiType()); - construction.addMarkerExploreWay(exploreWay); - } - - Log.d(TAG, "getPoiTypeMap mPoiTypeMarkers.size() = " + mPoiTypeMarkers.size()); - - return mPoiTypeMarkers; - } - - - private List handleMapToList(Map map) { - Collection valueCollection = map.values(); - List list = new ArrayList<>(valueCollection); - List resultSurroundingList = new ArrayList<>(); - List outSurroundingList = new ArrayList<>(); - - if (list != null && list.size() > 0) { - List prioritySorts = prioritySort(); - for (String poiType : prioritySorts) { - for (SurroundingConstruction construction : list) { - if (!prioritySorts.contains(construction.getPoiType())) { - outSurroundingList.add(construction); - continue; - } else if (poiType.equals(construction.getPoiType())) { - resultSurroundingList.add(construction); - } - } - } - } - - if (outSurroundingList != null && outSurroundingList.size() > 0) { - resultSurroundingList.addAll(outSurroundingList); - } - - Log.d(TAG, "handleMapToList resultSurroundingList.size() = " + resultSurroundingList.size()); - return resultSurroundingList; - } - - public static List prioritySort() { - List poiTypes = new LinkedList<>(); - - // 封路 - poiTypes.add("10003"); - // 结冰 - poiTypes.add("10011"); - // 浓雾 - poiTypes.add("10010"); - // 交通检查 - poiTypes.add("10002"); - // 交通事故 - poiTypes.add("10013"); - // 拥堵 - poiTypes.add("10007"); - // 道路施工 - poiTypes.add("10006"); - // 积水 - poiTypes.add("10008"); - //实时路况 - poiTypes.add("10015"); - - return poiTypes; - } - - @Subscribe(threadMode = ThreadMode.MAIN) - public void onBackRefresh(final BackRefreshInfo event) { - if (event == null) { - return; - } - - initData(); - } - - /** - * 处理marker的显示 - * - * @param v - * @param position - * @param construction - */ - @Override - public void onItemClickListener(View v, int position, SurroundingConstruction construction) { - if (construction != null) { - if (!DebugConfig.isMapBased()) { - EventBus.getDefault().post(construction); - } else { - //卡片消失 - V2XEventPanelFragment.Companion.getInstance().hidePanel(); - //清除道路事件 - V2XServiceManager.getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_ROAD_CONDITION); - - try { - //处理 marker的显示 - List exploreWayList = construction.getConstrutList(); - Logger.d(TAG, "onItemClickListener exploreWayList.size() = " + exploreWayList.size()); - if (exploreWayList != null && exploreWayList.size() > 0) { - for (int i = 0; i < exploreWayList.size(); i++) { - MarkerExploreWay exploreWay = exploreWayList.get(i); - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(exploreWay); - markerShowEntity.setChecked(false); - markerShowEntity.setTextContent(exploreWay.getAddr()); - markerShowEntity.setMarkerLocation(exploreWay.getLocation()); - markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_ROAD_CONDITION); - - WorkThreadHandler.getInstance().postDelayed(() -> { - IMogoMarker mogoMarker = V2XServiceManager.getIMogoMarkerService().drawMarker(markerShowEntity); - // 点击监听,天际弹窗展示详情 - if (mogoMarker != null) { - mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() { - @Override - public void onAnimStart() { - Logger.d(TAG, " onItemClickListener onAnimStart -----> "); - } - - @Override - public void onAnimEnd() { - if (mogoMarker.isDestroyed()) { - return; - } - Logger.d(TAG, " onItemClickListener onAnimEnd ------> "); - mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null); - } - }); - mogoMarker.setOwner(markerShowEntity.getMarkerType()); - mogoMarker.setObject(markerShowEntity); - } - }, i * 100L); - } - - //自适应显示 - showBonndsRoadtion(exploreWayList); - } else { - Logger.e(TAG, "onItemClickListener exploreWayList == null"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - /** - * 子类信息tts播报 - */ - AIAssist.getInstance(Utils.getApp()). - speakTTSVoice(construction.getTypeNameTTS(construction.getPoiType()), null); - } - } - - /** - * 自适应显示 - * - * @param exploreWayList - */ - private void showBonndsRoadtion(List exploreWayList) { - Logger.d(TAG, "showBonndsRoadtion exploreWayList.size() = " + exploreWayList.size()); - Rect rect = new Rect( - (int) getContext().getResources().getDimension(R.dimen.module_v2x_map_left), - (int) getContext().getResources().getDimension(R.dimen.module_v2x_map_top), - (int) getContext().getResources().getDimension(R.dimen.module_v2x_map_right), - (int) getContext().getResources().getDimension(R.dimen.module_v2x_map_bottom)); - - moveNotFresh(); - //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置) - //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要) - V2XServiceManager.getMapUIController().showBounds(ServiceConst.CARD_TYPE_ROAD_CONDITION, null, getMogoList(exploreWayList), rect, false); - } - - private void moveNotFresh() { - V2XServiceManager.getMoGoStatusManager().setUserInteractionStatus(TAG, true, false); - } - - /** - * 构造经纬度列表 - * - * @return - */ - private List getMogoList(List markerExploreWayList) { - List list = new ArrayList<>(); - if (markerExploreWayList != null && markerExploreWayList.size() > 0) { - if (markerExploreWayList.size() < 6) { - for (int i = 0; i < markerExploreWayList.size(); i++) { - MarkerLocation location = markerExploreWayList.get(i).getLocation(); - if (location != null) { - MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon()); - list.add(mogoLatLng); - } else { - Logger.e(TAG, "getMogoList() < 6 location == null"); - } - } - } else { - for (int i = 0; i < 6; i++) { - MarkerLocation location = markerExploreWayList.get(i).getLocation(); - if (location != null) { - MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon()); - list.add(mogoLatLng); - } else { - Logger.e(TAG, "getMogoList() location == null"); - } - } - } - } else { - Logger.e(TAG, "getMogoList() markerExploreWay == null"); - } - return list; - } - - - @Override - public void onDestroy() { - super.onDestroy(); - if (poiInfosList != null) { - poiInfosList.clear(); - poiInfosList = null; - } - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - EventBus.getDefault().unregister(this); - } - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java deleted file mode 100644 index d5fb4f315e..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mogo.module.v2x.listener; - -/** - * @author liujing - */ -public interface AdapterCallback { - //分享列表加载更多 - void loadMoreShareEventList(); - //分享列表首次刷新 - void getShareEventResponse(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java deleted file mode 100644 index 2d1d2b6384..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.data.map.MogoLocation; - -/** - * @author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/13 11:02 AM - * desc : 车辆速度状态回调 - *

    - * version: 1.0 - */ -public interface CarStatusListener { - /** - * 当车辆从 行驶状态 进入 的时候回调 - */ - void onCarDriving2Stop(MogoLocation location); - - /** - * 当车辆从 停车状态 进入 行驶状态 的时候回调 - */ - void onCarStop2Driving(MogoLocation location); -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/SurroundingDetailItemListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/SurroundingDetailItemListener.java deleted file mode 100644 index 1290e78670..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/SurroundingDetailItemListener.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.module.v2x.listener; - -import android.view.View; - -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.v2x.entity.panel.SurroundingConstruction; - -/** - * @author lixiaopeng - * @description - * @since 2020/8/10 - */ -public interface SurroundingDetailItemListener { - void onItemClickListener(View v, int position, MarkerExploreWay exploreWay); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/SurroundingItemClickListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/SurroundingItemClickListener.java deleted file mode 100644 index 3ebf7bccf3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/SurroundingItemClickListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.listener; - -import android.view.View; - -import com.mogo.module.v2x.entity.panel.SurroundingConstruction; - -/** - * @author lixiaopeng - * @description - * @since 2020/8/10 - */ -public interface SurroundingItemClickListener { - void onItemClickListener(View v, int position, SurroundingConstruction construction); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java deleted file mode 100644 index f5435ef700..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java +++ /dev/null @@ -1,365 +0,0 @@ -package com.mogo.module.v2x.listener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -import android.content.Context; -import android.location.Location; - -import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.map.location.IMogoLocationListener; -import com.mogo.map.navi.IMogoCarLocationChangedListener2; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.search.geo.IMogoGeoSearchListener; -import com.mogo.map.search.geo.MogoGeocodeResult; -import com.mogo.map.search.geo.MogoRegeocodeResult; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerResponse; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.service.Utils; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.alarm.V2XAlarmServer; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.observer.CarLocationSubject; -import com.mogo.module.v2x.observer.V2XOptimalRouteObserver; -import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.module.v2x.utils.DrivingDirectionUtils; -import com.mogo.module.v2x.utils.LocationUtils; -import com.mogo.module.v2x.utils.MarkerUtils; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/9 2:31 PM - * desc : V2X中用到的位置监听。处理刷新频率,以及位置改变是否触发道路事件警报 - * version: 1.0 - */ -public class V2XLocationListener - implements IMogoLocationListener, - CarStatusListener, - IMogoCarLocationChangedListener2 { - private String TAG = "V2XLocationListener"; - - private MogoLocation mLastCarLocation; - // 记录历史行驶轨迹,用于车行驶方向计算,只保留两个数据 - private MogoLocation[] historyPath = new MogoLocation[2]; - // 触发刷新的距离 - private final int minDistance = 200; - - private static V2XLocationListener mV2XLocationListener; - - private CarLocationSubject mCarLocationSubject; - - private V2XLocationListener() { - mCarLocationSubject = CarLocationSubject.getInstance(); - // 注册最优路线的推荐观察者 - mCarLocationSubject.registerObserver( - V2XOptimalRouteObserver.TYPE, - V2XOptimalRouteObserver.getInstance()); - } - - public synchronized static V2XLocationListener getInstance() { - synchronized (V2XLocationListener.class) { - if (mV2XLocationListener == null) { - mV2XLocationListener = new V2XLocationListener(); - } - } - return mV2XLocationListener; - } - - @Override - public void onCarLocationChanged2(Location location) { - MogoLocation loc = new MogoLocation(); - loc.setTime(loc.getTime()); - loc.setAccuracy(location.getAccuracy()); - loc.setSpeed(location.getSpeed()); - loc.setLongitude(location.getLongitude()); - loc.setLatitude(location.getLatitude()); - loc.setAltitude(location.getAltitude()); - loc.setBearing(location.getBearing()); - loc.setProvider(location.getProvider()); - onLocationChangedImpl(loc); - } - - @Override - public void onLocationChanged(MogoLocation location) { -// onLocationChangedImpl(location); - } - - private void onLocationChangedImpl(MogoLocation location) { - try { - mCarLocationSubject.setCarLocation(location); - //Logger.d(V2XConst.MODULE_NAME, "V2X预警--onLocationChanged: " + GsonUtil.jsonFromObject(location)); - // 刷新角度 - getCurrentCarAngle(location); - // 只有车速大于 5 的时候进行计算 - if (location.getSpeed() >= 5) { - refreshCurrentCarState(location); - } - - // 车速从10降为0 这里统一交到 计算中心服务 进行计算,相应的状态会通过回调的方式调用 - V2XServiceManager.getV2XCalculateServer().addCarStatusListener(TAG, this); - V2XServiceManager.getV2XCalculateServer().addCarTrajectory(location); - - // 首次定位的刷新道路事件逻辑,下面是道路刷新逻辑 - if (mLastCarLocation == null) { - V2XServiceManager.getV2XMarkerService().refreshMarkerData(location); - mLastCarLocation = location; - } - // 计算车辆距离指定气泡的距离 - float calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(location.getLatitude(), location.getLongitude()), - new MogoLatLng(mLastCarLocation.getLatitude(), mLastCarLocation.getLongitude()) - ); - - // 行驶距离 > 200M 重新请求 - if (calculateDistance > minDistance) { - // Logger.d(MODULE_NAME, "V2X预警--移动距离>100米,重新刷新道路事件"); - V2XServiceManager.getV2XMarkerService().refreshMarkerData(location); - mLastCarLocation = location; - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * @param location 刷新当前车辆状态 - */ - private void refreshCurrentCarState(MogoLocation location) { - // 如果有道路事件正在预警的时候这里实时进行更新绘制 - IMogoPolyline mMogoPolyline = V2XServiceManager.getMoGoV2XPolylineManager().getMogoPolyline(); - if (mMogoPolyline != null && (V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow() - || V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow()) - && V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null) { - - // 取出原有的绘制线的经纬度点 - List pointsOdl = mMogoPolyline.getPoints(); - // 重新设置第一个坐标,也就是当前车辆位置 - pointsOdl.set(0, new MogoLatLng(location.getLatitude(), location.getLongitude())); - mMogoPolyline.setPoints(pointsOdl); - - float zoomLevel = V2XServiceManager.getMapUIController().getZoomLevel(); - //Logger.d(V2XConst.MODULE_NAME, "当前地图的缩放比例为:" + zoomLevel); - if (zoomLevel <= 17 && !V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow()) { - // 缩放地图 - Context context = V2XServiceManager.getContext(); - MarkerUtils.zoomMap(V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng(), context); - } - } - - // M1 不基于地图的版本没有疲劳检测,原因是车机内置地图版本不一样 - if (DebugConfig.isMapBased()) { - // 只有自研车机才有疲劳驾驶检测 - if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) { - V2XAlarmServer.getFatigueDrivingShow(location, drivingShowEntity -> { - Logger.i(V2XConst.MODULE_NAME, "疲劳驾驶POI查询结果为: " + GsonUtil.jsonFromObject(drivingShowEntity)); - - String style = V2XServiceManager.getMoGoStatusManager().isMainPageOnResume() ? "1" : "2"; - trackWithType(EventTypeEnum.ALERT_FATIGUE_DRIVING.getPoiType(), drivingShowEntity.getLon(), drivingShowEntity.getLat(), style); - - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING); - v2XMessageEntity.setContent(drivingShowEntity); - v2XMessageEntity.setShowState(drivingShowEntity.isShowWindow()); - // 广播给ADAS Launcher - ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), drivingShowEntity); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - }); - } - } - - // 巡航处理 - V2XRoadEventEntity v2XRoadEventEntity = - V2XAlarmServer.getDriveFrontAlarmEvent( - V2XServiceManager.getMoGoV2XMarkerManager().getV2XRoadEventEntityList(), - V2XServiceManager.getV2XStatusManager().getLocation()); - // 距离是否大于10米 && 消息是否不为空 - if (v2XRoadEventEntity != null && v2XRoadEventEntity.getDistance() >= 5) { -// Logger.w(MODULE_NAME, -// //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() + -// //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount + -// "\nV2X预警--当前预警事件:" + v2XRoadEventEntity -// ); - // Logger.w(MODULE_NAME, "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance()); - // 触发展示操作 - TrackUtils.trackV2xRoadProduceEvent(1); - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); - v2XMessageEntity.setContent(v2XRoadEventEntity); - v2XMessageEntity.setShowState(true); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - - // 存储本地,出行动态作展示 - saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING, - v2XRoadEventEntity.getNoveltyInfo()); - - //如果poiType是道路拥堵,则调用接口查询拥堵状态 - String poiType = v2XRoadEventEntity.getPoiType(); - if (poiType != null && poiType.equals(EventTypeEnum.FOURS_BLOCK_UP.getPoiType())) { - V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus(); - } - } - } - - public MogoLocation getLastCarLocation() { - try { - if (mLastCarLocation == null) { - MogoLatLng mogoLatLng = V2XServiceManager.getNavi().getCarLocation(); - mLastCarLocation = new MogoLocation(); - if (mogoLatLng != null) { - mLastCarLocation.setLongitude(mogoLatLng.getLon()); - mLastCarLocation.setLatitude(mogoLatLng.getLat()); - } else { - mLastCarLocation.setLongitude(0.0); - mLastCarLocation.setLatitude(0.0); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return mLastCarLocation; - } - - /** - * 获取当前车辆的行驶方向 0<=Angle<=360 - * - * @return 0<= Angle < = 3 6 0 - */ - private void getCurrentCarAngle(MogoLocation location) { - // 记录位置轨迹 - if (historyPath[0] != null) { - historyPath[1] = historyPath[0]; - } - historyPath[0] = location; - - if (historyPath[1] != null && historyPath[0] != null) { - double carAngle = - DrivingDirectionUtils.getCarAngle( - historyPath[1].getLatitude(), historyPath[1].getLongitude(), - historyPath[0].getLatitude(), historyPath[0].getLongitude() - ); - - //Logger.d(MODULE_NAME, - // "\n车辆经纬度:" + Arrays.toString(historyPath) + - // "\n车辆角度:" + carAngle); - // 这里是真实的车辆角度 - location.setBearing((float) carAngle); - } else { - //Logger.e(MODULE_NAME, - // "\n首次获取经纬度,默认车头朝北:" + Arrays.toString(historyPath)); - location.setBearing(0.0f); - } - V2XServiceManager.getV2XStatusManager().setLocation(location); - } - - /** - * 获取定位相关信息 - */ - private void getLocationInfo(MogoLocation location) { - // 定位当前位置是否是高速 - LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() { - @Override - public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { - try { - //Logger.i(MODULE_NAME, " 根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress()); - location.setAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress()); - // 如果有 "高速"、"环线"、"快速路"等字眼的,视为封闭式道路,流程结束; - if (regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("高速") - || regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("环线") - || regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("快速路")) { - } else { - searchIllegalParkData(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onGeocodeSearched(MogoGeocodeResult geocodeResult) { - } - }); - } - - /** - * 查询50米的违章停车数据 - */ - private void searchIllegalParkData() { - double lon = V2XServiceManager.getV2XStatusManager().getLocation().getLongitude(); - double lat = V2XServiceManager.getV2XStatusManager().getLocation().getLatitude(); - - V2XServiceManager.getV2XRefreshModel() - .queryIllegalPark(new V2XRefreshCallback() { - @Override - public void onSuccess(MarkerResponse result) { - //Logger.i(MODULE_NAME, "搜索附近的违章停车点 成功:" + GsonUtil.jsonFromObject(result)); - if (result != null) { - if (result.getResult().getExploreWay().size() > 0) { - V2XMessageEntity> entity = new V2XMessageEntity<>(); - entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING); - entity.setContent(result.getResult().getExploreWay()); - entity.setShowState(true); - V2XScenarioManager.getInstance().handlerMessage(entity); - } - } - } - - @Override - public void onFail(String msg) { - Logger.e(MODULE_NAME, "搜索附近的违章停车点 失败:" + msg); - } - }, lon, lat); - } - - - @Override - public void onCarDriving2Stop(MogoLocation location) { - // 推迟30s主Launcher中的大而全的POI刷新时间 - V2XServiceManager.getIMogoRefreshStrategyController().restartAutoRefreshAtTime(30000); - getLocationInfo(location); - } - - @Override - public void onCarStop2Driving(MogoLocation location) { - - } - - //埋点 - private static void trackWithType(String type, double lon, double lat, String style) { - Map properties = new HashMap<>(); - properties.put("type", type); - properties.put("lng", lon); - properties.put("lat", lat); - properties.put("style", style); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties); - } - - /** - * 存储本地数据 - * - * @param v2XRoadEventEntity 要存储的场景 - */ - public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) { - try { - V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMarkerClickListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMarkerClickListener.java deleted file mode 100644 index 28726db568..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMarkerClickListener.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.mogo.module.v2x.listener; - -import android.text.TextUtils; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerOnlineCar; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.service.ServiceConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.utils.ChartingUtil; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/7 7:13 PM - * desc : - * version: 1.0 - */ -public class V2XMarkerClickListener implements IMogoMarkerClickListener { - - private static V2XMarkerClickListener markerClickListener; - - // 最后一次选中的气泡 - private IMogoMarker mLastCheckMarker; - - private V2XMarkerClickListener() { - } - - public synchronized static V2XMarkerClickListener getInstance() { - synchronized (V2XMarkerClickListener.class) { - if (markerClickListener == null) { - markerClickListener = new V2XMarkerClickListener(); - } - } - return markerClickListener; - } - - @Override - public boolean onMarkerClicked(IMogoMarker marker) { - try { - if (mLastCheckMarker != null) { - // 判断点击的是否是同一个 - if (marker.equals(mLastCheckMarker)) { - Logger.d(MODULE_NAME, "onMarkerClicked 与上一次点击的Marker一样,不做处理:" + marker); - // 判断是在线车辆的时候处理打电话场景 - try { - Object object = marker.getObject(); - if (object != null) { - // 修改数据 - MarkerShowEntity showEntity = (MarkerShowEntity) object; - if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_USER_DATA)) { - Object bindObj = showEntity.getBindObj(); - if (bindObj instanceof MarkerOnlineCar) { - MarkerLocation location = new MarkerLocation(); - location.setLon(marker.getPosition().getLon()); - location.setLat(marker.getPosition().getLat()); - ChartingUtil.callChatting( - ((MarkerOnlineCar) bindObj).getUserInfo(), - location - ); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return true; - } - // 关闭上次的气泡 - V2XServiceManager.getMoGoV2XMarkerManager().closeMarker(V2XServiceManager.getContext(), mLastCheckMarker); - } - // 将当前的Marker设置为选中 - mLastCheckMarker = V2XServiceManager.getMoGoV2XMarkerManager().openMarker(V2XServiceManager.getContext(), marker); - - // marker点击展示上半部分的浮窗,只加了道路事件 - Object nov = marker.getObject(); - Logger.d(MODULE_NAME, "marker点击====" + nov); - if (nov != null) { - MarkerShowEntity showEntity = (MarkerShowEntity) nov; - if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_NOVELTY)) { - Object bindObj = showEntity.getBindObj(); - if (bindObj instanceof MarkerExploreWay) { - MarkerExploreWay noveltyInfo = (MarkerExploreWay) bindObj; - Logger.d(MODULE_NAME, "新鲜事marker点击===" + bindObj); - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(noveltyInfo.getLocation()); - v2XRoadEventEntity.setPoiType(noveltyInfo.getPoiType()); - v2XRoadEventEntity.setNoveltyInfo(noveltyInfo); - v2XRoadEventEntity.setExpireTime(20000); - v2XRoadEventEntity.setDistance(1000); - //V2XServiceManager.getMoGoV2XScenarioManager().showRoadEventWindow(v2XRoadEventEntity, false); - return true; - } - } else if (showEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_ROAD_CONDITION)) { - Object bindObj = showEntity.getBindObj(); - if (bindObj instanceof MarkerExploreWay) { - MarkerExploreWay markerExploreWay = (MarkerExploreWay) bindObj; - if (markerExploreWay.getItems().size() > 0 - && !TextUtils.isEmpty(markerExploreWay.getItems().get(0).getUrl())) { - Logger.d(MODULE_NAME, "MarkerExploreWay点击===" + bindObj); - // 记录道路事件 - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(markerExploreWay.getLocation()); - // 探路目前只有上报拥堵 - v2XRoadEventEntity.setPoiType(EventTypeEnum.FOURS_BLOCK_UP.getPoiType()); - - v2XRoadEventEntity.setDistance(1000); - v2XRoadEventEntity.setNoveltyInfo(markerExploreWay); - v2XRoadEventEntity.setExpireTime(20000); - //V2XServiceManager.getMoGoV2XScenarioManager().showRoadEventWindow(v2XRoadEventEntity, false); - return true; - } - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return true; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401003.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401003.java deleted file mode 100644 index ffc7a70067..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401003.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.module.v2x.utils.MarkerUtils; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : - * ADAS & V2X 场景触发push - * TODO 前瞻需求,这里是后台下发 http://h5service.zhidaohulian.com/v2x_remoteControl/#/ - * version: 1.0 - */ -public class V2XMessageListener_401003 implements IMogoOnMessageListener { - - @Override - public Class target() { - return V2XPushMessageEntity.class; - } - - @Override - public void onMsgReceived(V2XPushMessageEntity message) { - Logger.i(MODULE_NAME, "V2XMessageListener_401003:" + GsonUtil.jsonFromObject(message)); - ThreadUtils.runOnUiThread(() -> { - try { - handlerV2XAlarm(message); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - - /** - * 处理V2X场景 - * - * @param alarmMessage V2X消息 - */ - private void handlerV2XAlarm(V2XPushMessageEntity alarmMessage) { - // 绘制道路事件 - //Logger.w(MODULE_NAME, "处理V2X场景SceneId==" + alarmMessage.getSceneId()); - - // 修改地图比例尺 - if (alarmMessage.getZoomScale() > 0) { - V2XServiceManager.getMoGoStatusManager().setUserInteractionStatus(MODULE_NAME, true, true); - MarkerUtils.resetMapZoom(alarmMessage.getZoomScale()); - } - - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); - switch (alarmMessage.getSceneId()) { - case "100000"://前车碰撞预警 - case "100001"://车道偏离预警 - //V2XWindowManager.removeAllV2XView(); - break; - - // 下面的场景,地图缩小,显示30秒直播小视频,视频播放结束恢复地图比例尺 - case "100002"://盲区换道警告 - case "100003"://盲区行人碰撞预警 - case "100009"://危险路段(施工)告警 - case "100010"://拥堵告警 - case "100004"://逆向超车碰撞预警 - case "100011"://失控车辆告警 - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING); - v2XMessageEntity.setContent(alarmMessage); - v2XMessageEntity.setShowState(true); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - break; - // 下面的场景禁行动画效果展示 - case "100005"://前车紧急制动告警 - case "100006"://十字路口碰撞预警 - case "100007"://岔路口碰撞预警 - case "100008"://禁行车道预警 - case "100012"://应急车辆优先通行 - case "100013"://闯红灯预警 - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING); - v2XMessageEntity.setContent(alarmMessage); - v2XMessageEntity.setShowState(true); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - break; - case "100015"://取快递 - case "100016"://顺风车 - case "100017"://政府公告 - case "100018"://故障车辆推送 - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING); - v2XMessageEntity.setContent(alarmMessage); - v2XMessageEntity.setShowState(true); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - break; - case "100014"://行人点赞 - showTip(alarmMessage.getTts()); - ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmMessage); - break; - default: - ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmMessage); - break; - } - } - - private void showTip(String msg) { - TipToast.tip(msg); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401005.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401005.java deleted file mode 100644 index d279bc3d76..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401005.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity; -import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; -import com.mogo.module.v2x.utils.MarkerUtils; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -import java.util.ArrayList; -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : 特殊车辆推送绘制 - * version: 1.0 - */ -public class V2XMessageListener_401005 implements IMogoOnMessageListener { - @Override - public Class target() { - return V2XSpecialCarRes.class; - } - - @Override - public void onMsgReceived(V2XSpecialCarRes message) { - Logger.i(MODULE_NAME, "V2XMessageListener_401005:" + GsonUtil.jsonFromObject(message)); - if (!V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow()) { - ThreadUtils.getSinglePool().execute(() -> { - try { - MarkerUtils.handlerV2XSpecialVehicleMarker( - message, - V2XServiceManager.getContext(), - V2XMarkerClickListener.getInstance()); - - //获取经纬度信息 - //根据sn获取用户信息 - //V2XWindowManager展示 - handleSeekHelp(message); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - } - - - /** - * 处理故障求助 - */ - private void handleSeekHelp(V2XSpecialCarRes message) { - if (message == null) { - return; - } - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_MARKER_SPECIAL_CAR); - List coordinates = message.getCoordinates(); - List entityList = new ArrayList<>(); - - for (V2XMarkerEntity coordinate : coordinates) { - //故障车机 - if (EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(coordinate.getTargetId()+"")) { - entityList.add(coordinate); - } - } - if (!entityList.isEmpty()) { - ThreadUtils.runOnUiThread(() -> { - V2XMessageEntity> v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING); - v2XMessageEntity.setContent(entityList); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - }); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401006.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401006.java deleted file mode 100644 index 28b2a6b9bb..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401006.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.entity.net.V2XAlarmEventRes; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : - * 3.2.1、前方静止or慢速车辆报警 - * 3.2.2、道路危险状况告警 / 前方拥堵告警 - * version: 1.0 - */ -@Deprecated -public class V2XMessageListener_401006 implements IMogoOnMessageListener { - - @Override - public Class target() { - return V2XAlarmEventRes.class; - } - - @Override - public void onMsgReceived(V2XAlarmEventRes message) { - Logger.i(MODULE_NAME, "iMogoOnMessageListener_401006:" + message); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401007.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401007.java deleted file mode 100644 index 8a36962530..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401007.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.service.MarkerServiceHandler; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XAlarmEventRes; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -import java.util.HashMap; -import java.util.Map; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : 限行通知 - * version: 1.0 - */ -public class V2XMessageListener_401007 implements IMogoOnMessageListener { - @Override - public Class target() { - return V2XAlarmEventRes.class; - } - - @Override - public void onMsgReceived(V2XAlarmEventRes message) { - Logger.i(MODULE_NAME, "V2XMessageListener_401007:" + message); - try { - if (message != null) { - - // 发送广播 - V2XAlarmEventRes.AlarmInfo alarmInfo = message.getResult().getAlarmInfo(); - ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmInfo); - - // 统计代码 - final Map properties = new HashMap<>(); - properties.put("warning_id", EventTypeEnum.ALERT_TRAFFIC_CONTROL.getPoiType()); - MarkerServiceHandler.getMogoAnalytics().track("v2x_warning", properties); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java deleted file mode 100644 index e9c8eea3e7..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XGiveLike; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : - * * 2.0.2 - * * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=35786774 - * * 注册点赞通信接收 - * version: 1.0 - */ -public class V2XMessageListener_401009 implements IMogoOnMessageListener { - @Override - public Class target() { - return V2XGiveLike.class; - } - - @Override - public void onMsgReceived(V2XGiveLike message) { - Logger.i(MODULE_NAME, "V2XMessageListener_401009:" + message); - try { - V2XPushMessageEntity v2XAlarmMessage = new V2XPushMessageEntity(); - v2XAlarmMessage.setTts(message.getResult()); - v2XAlarmMessage.setAlarmContent(message.getResult()); - v2XAlarmMessage.setExpireTime(20000); - v2XAlarmMessage.setSceneId("000000"); - ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), v2XAlarmMessage); - TipToast.tip(message.getResult()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401010.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401010.java deleted file mode 100644 index 106f9670a3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401010.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.entity.net.V2XAlarmEventRes; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : - * * 2.0.3 - * * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=35788659 - * * TODO 停车场、加油站推送心跳,这里是前瞻的功能,目前仅在分体机使用, - * version: 1.0 - */ -@Deprecated -public class V2XMessageListener_401010 implements IMogoOnMessageListener { - - @Override - public Class target() { - return V2XAlarmEventRes.class; - } - - @Override - public void onMsgReceived(V2XAlarmEventRes message) { - Logger.i(MODULE_NAME, "V2XMessageListener_401010:" + message); - try { - if (message != null - && message.getResult() != null) { - - // 处理报警事件 - handlerAlarmInfo(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 处理道路事件提醒 - */ - private void handlerAlarmInfo() { - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401011.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401011.java deleted file mode 100644 index a0d3340f14..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401011.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mogo.module.v2x.listener; - -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.module.common.entity.MarkerCardResult; -import com.mogo.module.common.entity.MarkerResponse; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : 道路事件,实际就是大而全的数据进行的过滤 - * version: 1.0 - */ -public class V2XMessageListener_401011 implements IMogoOnMessageListener { - - @Override - public Class target() { - return MarkerResponse.class; - } - - @Override - public void onMsgReceived(MarkerResponse response) { - //Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新:\n" + GsonUtil.jsonFromObject(response)); - if (!V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow()) { - ThreadUtils.getSinglePool().execute(() -> { - // 解析不同的Marker类型,然后对应的进行绘制 - if (response != null && response.getResult() != null) { - MarkerCardResult markerCardResult = response.getResult(); - // 解析存储道路事件 - //V2XServiceManager.getMoGoV2XMarkerManager().drawableV2XMarker(markerCardResult); - V2XServiceManager.getMoGoV2XMarkerManager().analysisV2XRoadEvent(markerCardResult); - } - }); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java deleted file mode 100644 index 9ba8aecc4d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.mogo.module.v2x.listener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -import android.content.Intent; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.constant.TimeConstants; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.module.common.entity.MarkerCardResult; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.service.Utils; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.alarm.V2XAlarmServer; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/1 10:23 AM - * desc : 道路事件服务端下发触发 - * version: 1.0 - */ -public class V2XMessageListener_401012 implements IMogoOnMessageListener { - - @Override - public Class target() { - return MarkerCardResult.class; - } - - @Override - public void onMsgReceived(MarkerCardResult response) { - Logger.d(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:\n" - + GsonUtil.jsonFromObject(response)); - TrackUtils.trackV2xRoadProduceEvent(2); - try { - long timeSpan = TimeUtils.getTimeSpan(TimeUtils.getNowMills(), response.getMessageTime(), TimeConstants.MIN); - // 三分钟以内的消息才会提示用户 - if (timeSpan <= 3) { - if (response.getExploreWay() != null && response.getExploreWay().size() > 0) { - MarkerExploreWay markerExploreWay = response.getExploreWay().get(0); - MarkerLocation markerLocation = markerExploreWay.getLocation(); - // 记录道路事件 - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(markerLocation); - // 探路目前只有上报拥堵 - v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType()); - // 当前车辆数据 - MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation(); - float calculateDistance; - if (currentLocation.getLatitude() > 0 || currentLocation.getLongitude() > 0) { - calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()), - new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude()) - ); - markerExploreWay.setDistance(calculateDistance); - } - v2XRoadEventEntity.setDistance(markerExploreWay.getDistance()); - v2XRoadEventEntity.setNoveltyInfo(markerExploreWay); - v2XRoadEventEntity.setExpireTime(20000); - - // 记录播报过的道路事件 - V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString()); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2XRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); - LocalBroadcastManager.getInstance(com.mogo.eagle.core.utilcode.util.Utils.getApp()).sendBroadcast(intent); - } - } else { - Logger.e(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:消息已过期,大于3分钟了不进行消费"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401018.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401018.java deleted file mode 100644 index 60e7c61dc2..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401018.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.mogo.module.v2x.listener; - -import android.content.Intent; -import android.util.Log; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -/** - * desc: 车路云预警-弱势交通参与者 - */ -public class V2XMessageListener_401018 implements IMogoOnMessageListener { - - @Override - public Class target() { - return V2XWarningEntity.class; - } - - @Override - public void onMsgReceived(V2XWarningEntity info) { - Log.d(V2XConst.MODULE_NAME, "V2XWarnMessageListener onMsgReceived ---11---> "); - ThreadUtils.getSinglePool().execute(() -> { - // 解析不同的Marker类型,然后对应的进行绘制 - if (info != null) { - // 解析存储道路事件 - Log.d(V2XConst.MODULE_NAME, "V2XWarnMessageListener onMsgReceived --22--> "); - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS); - // 设置数据 - v2xMessageEntity.setContent(info); - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); - LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent); - } - }); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_402000.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_402000.java deleted file mode 100644 index 2be4d33255..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_402000.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.mogo.module.v2x.listener; - -import android.content.Intent; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes; -import com.mogo.service.cloud.socket.IMogoOnMessageListener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * @author donghongyu - * @description 车路云—场景预警-云下发数据监听 最优路线推荐 - * @since: 2021/4/13 - */ -public class V2XMessageListener_402000 implements IMogoOnMessageListener { - @Override - public Class target() { - return V2XOptimalRouteDataRes.class; - } - - @Override - public void onMsgReceived(V2XOptimalRouteDataRes message) { - // 将接收到的数据转换成最优车道推荐的场景数据 - if (message != null - && message.getGd_locus_list() != null - && !message.getGd_locus_list().isEmpty()) { - Logger.i(MODULE_NAME, "V2XMessageListener_402000:" + GsonUtil.jsonFromObject(message)); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW); - // 设置数据 - v2xMessageEntity.setContent(message); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); - LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent); - } - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_404000.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_404000.kt deleted file mode 100644 index df8b39b7d5..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_404000.kt +++ /dev/null @@ -1,138 +0,0 @@ -package com.mogo.module.v2x.listener - -import com.mogo.eagle.core.data.enums.TrafficTypeEnum -import com.mogo.eagle.core.data.traffic.TrafficData -import com.mogo.eagle.core.data.v2x.AdvanceWarningBean -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.network.utils.GsonUtil -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.util.ThreadUtils -import com.mogo.module.common.drawer.TrafficMarkerDrawer -import com.mogo.module.common.enums.EventTypeEnum -import com.mogo.module.v2x.V2XConst -import com.mogo.service.cloud.socket.IMogoOnMessageListener - -/** - * @author chenfufeng - * @description 路口碰撞预警、盲区预警等 - * @since: 2021/9/23 - */ -class V2XMessageListener_404000 : IMogoOnMessageListener { - override fun target(): Class { - return AdvanceWarningBean::class.java - } - - override fun onMsgReceived(message: AdvanceWarningBean?) { - if (message == null) { - Logger.i(V2XConst.MODULE_NAME, "V2XMessageListener_404000:message is null!") - return - } - Logger.i( - V2XConst.MODULE_NAME, - "V2XMessageListener_404000:" + GsonUtil.jsonFromObject( - message - ) - ) - ThreadUtils.runOnUiThread { - var trafficData = buildTrafficData(message) - when (message.status) { - 1 -> { - var tts = "" - var content = "" - var appId = 0 - when (message.typeId) { - // 弱势交通碰撞预警 - 1001 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt() - tts = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts - content = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content - } - // 弱势交通逆行预警 - 1002 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt() - tts = "行人逆行预警" - content = "行人逆行预警" - } - // 交叉路口碰撞预警 - 1003 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ICW.poiType.toInt() - tts = EventTypeEnum.TYPE_USECASE_ID_ICW.tts - content = EventTypeEnum.TYPE_USECASE_ID_ICW.content - } - // 盲区预警 - 1004 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_BSW.poiType.toInt() - tts = String.format(EventTypeEnum.TYPE_USECASE_ID_BSW.tts, getWarningDirection()) - content = EventTypeEnum.TYPE_USECASE_ID_BSW.content - } - // 逆向超车预警 - 1006 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType.toInt() - tts = EventTypeEnum.TYPE_USECASE_ID_DNPW.tts - content = EventTypeEnum.TYPE_USECASE_ID_DNPW.content - } - // 闯红灯预警 - 1005 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt() - tts = EventTypeEnum.TYPE_USECASE_ID_IVP.tts - content = EventTypeEnum.TYPE_USECASE_ID_IVP.content - } - // 最优车道 - 2001 -> { - appId = EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt() - tts = EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.tts - content = EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.content - } - // 前方道路拥堵预警 - 3001 -> { - appId = EventTypeEnum.FOURS_BLOCK_UP.poiType.toInt() - tts = EventTypeEnum.FOURS_BLOCK_UP.tts - content = EventTypeEnum.FOURS_BLOCK_UP.content - } - } - // 显示弹框,语音提示 - CallerHmiManager.showWarningV2X(appId, content, tts, - "$appId", object : IMoGoWarningStatusListener { - override fun onShow() {} - override fun onDismiss() { - } - }) - TrafficMarkerDrawer.updateITrafficInfo(trafficData) - } - 2 -> { - TrafficMarkerDrawer.updateITrafficInfo(trafficData) - } - 3 -> { - trafficData.uuid?.let { - TrafficMarkerDrawer.removeCvxRvInfoIndInfo(it) - } - } - } - } - } - - private fun buildTrafficData(message: AdvanceWarningBean): TrafficData { - return TrafficData().apply { - type = when (message.objectType) { - 1 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE - 2 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE - 3 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE - 4 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO - 6 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS - 8 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK - 9 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_CAMERA - else -> TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI - } - uuid = message.objectId - lat = message.position.lat - lon = message.position.lon - heading = message.heading - threatLevel = message.threatLevel - } - } - - private fun getWarningDirection(): String { - return "右" - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWindowStatusListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWindowStatusListener.java deleted file mode 100644 index 41d26f5d34..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWindowStatusListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.listener; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/15 10:20 AM - * desc : V2X 窗体状态回调 - * version: 1.0 - */ -public interface V2XWindowStatusListener { - void onViewShow(); - - void onViewClose(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java deleted file mode 100644 index 777d1257fa..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.v2x.manager; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.module.v2x.entity.model.DrawLineInfo; - -/** - * 绘制可变宽度和渐变的线, - */ -public interface IMoGoPersonWarnPolylineManager extends IProvider { - /** - * 绘制连接线,人物和二轮车 - * - * @param context - * @param info - */ - void drawPersonWarnPolyline(Context context, DrawLineInfo info); - - /** - * 移除连接线 - */ - void clearLine(); - - IMogoPolyline getMogoPersonWarnPolyline(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoStopPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoStopPolylineManager.java deleted file mode 100644 index 86aa8fb677..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoStopPolylineManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.v2x.manager; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.module.v2x.entity.model.DrawLineInfo; - -/** - * 绘制可变宽度和渐变的线 - */ -public interface IMoGoStopPolylineManager extends IProvider { - /** - * 绘制连接线,目标车,与当前车辆间连线 - * - * @param context - * @param info - */ - void drawStopPolyline(Context context, DrawLineInfo info); - - /** - * 移除连接线 - */ - void clearLine(); - - IMogoPolyline getMogoStopPolyline(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XMarkerManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XMarkerManager.java deleted file mode 100644 index f1e987d46d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XMarkerManager.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.mogo.module.v2x.manager; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.template.IProvider; -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.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 8:15 PM - * desc : V2X 涉及到的地图 POI 点的绘制 - * version: 1.0 - */ -public interface IMoGoV2XMarkerManager extends IProvider { - - /** - * 重新绘制最后一次的POI点 - */ - void drawableLastAllPOI(); - - /** - * 获取所有的道路事件点,探路事件,返回结果是按照距离当前车辆从近到远排列好的 - * - * @return 按从近到远排列好的道路事件 - */ - CopyOnWriteArrayList getV2XRoadEventEntityList(); - - /** - * 从探路数据和新鲜事儿的路况信息中解析出道路事件信息 - */ - void analysisV2XRoadEvent(MarkerCardResult markerCardResult); - - /** - * 绘制V2X 地图点事件 - * - * @param markerCardResult 大而全中过滤出来的点事件 - */ - void drawableV2XMarker(MarkerCardResult markerCardResult); - - /** - * 绘制 在线车辆 POI - * - * @param markerOnlineCars - * @param clickListener - */ - void drawableOnlineCarPOI(List markerOnlineCars, IMogoMarkerClickListener clickListener); - - /** - * 清除 在线车辆 POI - */ - void clearOnlineCarPOI(); - - /** - * 绘制 特殊车辆 - * - * @param context - * @param v2XMarkerEntity - * @param clickListener - */ - void drawableSpecialCarPOI(Context context, V2XMarkerEntity v2XMarkerEntity, IMogoMarkerClickListener clickListener); - - /** - * 清除 特殊车辆 POI - */ - void clearSpecialCarPOI(); - - /** - * 绘制可以直播的在线车辆 - * - * @param markerOnlineCars - * @param clickListener - */ - void drawableLiveCarPOI(List markerOnlineCars, IMogoMarkerClickListener clickListener); - - /** - * 清除 可以直播的在线车辆 POI - */ - void clearLiveCarPOI(); - - /** - * 绘制 探路 - * - * @param exploreWayList - * @param clickListener - */ - void drawableExplorePOI(List exploreWayList, IMogoMarkerClickListener clickListener); - - /** - * 清除 探路 POI - */ - void clearExplorePOI(); - - /** - * 绘制 新鲜事儿 - * - * @param noveltyInfoList - * @param clickListener - */ - void drawableNoveltyPOI(List noveltyInfoList, IMogoMarkerClickListener clickListener); - - /** - * 清除 新鲜事儿 POI - */ - void clearNoveltyPOI(); - - /** - * 绘制Marker,上面调用的都是这个方法 - * - * @param context - * @param markerShowEntity - * @param clickListener - */ - void drawableMarker(Context context, MarkerShowEntity markerShowEntity, IMogoMarkerClickListener clickListener); - - - /** - * 展开气泡 - * - * @param context - * @param currentMarker - */ - IMogoMarker openMarker(Context context, IMogoMarker currentMarker); - - /** - * 关闭气泡 - * - * @param context - * @param currentMarker - */ - void closeMarker(Context context, IMogoMarker currentMarker); - - /** - * 绘制正在预警的道路事件的POI点 - * - * @param context - * @param roadEventEntity - */ - void drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener); - - /** - * 清除 道路事件 POI - */ - void clearAlarmPOI(); - - /** - * 清除 所有的 POI - */ - void clearALLPOI(); - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XPolylineManager.java deleted file mode 100644 index 8ff7acf02a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XPolylineManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mogo.module.v2x.manager; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.module.common.entity.V2XRoadEventEntity; - -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 9:49 PM - * desc : 当前车辆与道路事件的连接线 - * version: 1.0 - */ -public interface IMoGoV2XPolylineManager extends IProvider { - /** - * 绘制连接线,目标车,与当前车辆间连线 - * - * @param context - * @param roadEventEntity - */ - void drawablePolyline(Context context, V2XRoadEventEntity roadEventEntity); - - /** - * 移除连接线 - */ - void clearLine(); - - IMogoPolyline getMogoPolyline(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusChangedListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusChangedListener.java deleted file mode 100644 index b200d52777..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusChangedListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mogo.module.v2x.manager; - -import com.alibaba.android.arouter.facade.template.IProvider; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 7:44 PM - * desc : 状态控制器监听 - * version: 1.0 - */ -public interface IMoGoV2XStatusChangedListener extends IProvider { - - /** - * @param descriptor 状态类型 - * @param isTrue true - v2x ui show - */ - void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java deleted file mode 100644 index a95eaefc08..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.mogo.module.v2x.manager; - -import com.alibaba.android.arouter.facade.template.IProvider; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 7:20 PM - * desc : V2X 状态管理 - * version: 1.0 - */ -public interface IMoGoV2XStatusManager extends IProvider { - /** - * 地图区域 V2X道路预警POI 是否在展示 - */ - boolean isRoadEventPOIShow(); - - /** - * 按钮区 V2X道路预警 是否在展示 - */ - boolean isRoadEventButtonShow(); - - /** - * 头部 V2X道路预警 UI 是否在展示 - */ - boolean isRoadEventWindowShow(); - - /** - * 头部 V2X的道路直播 UI 是否在展示 - */ - boolean isRoadLiveCarWindowShow(); - - /** - * 头部 他人车辆故障求助 UI 是否在展示 - */ - boolean isOtherSeekHelpWindowShow(); - - /** - * 地图区域 自身的道路求助按钮 是否在展示 - */ - boolean isMeSeekHelpButtonShow(); - - /** - * 地图区域 他人车辆故障求助POI 是否在展示 - */ - boolean isOtherSeekHelpPOIShow(); - - /** - * 前瞻需求 - * 右侧2/3 V2X 场景动画 UI 是否在展示 - */ - boolean isV2XAnimationShow(); - - /** - * 前瞻需求 - * 右侧2/3 左下角 模拟直播车机 UI 是否在展示 - */ - boolean isLeftLiveVideoShow(); - - /** - * 推送弹窗的状态 - */ - boolean isPushWindowShow(); - - /** - * 推送的 POI 状态 - */ - boolean isPushPOIShow(); - - /** - * 疲劳驾驶 状态 - */ - boolean isFatigueDrivingWindowShow(); - - /** - * 事件面板状态 状态 - */ - boolean isEventPanelWindowShow(); - - /** - * 设置 V2X道路预警POI 是否在展示 - * - * @param tag - * @param show - */ - void setRoadEventPOIShow(String tag, boolean show); - - /** - * 设置 V2X道路预警 是否在展示 - * - * @param tag - * @param show - */ - void setRoadEventButtonShow(String tag, boolean show); - - /** - * 设置 右侧2/3 头部 V2X道路预警 是否在展示 - * - * @param tag - * @param show - */ - void setRoadEventWindowShow(String tag, boolean show); - - /** - * 设置 右侧2/3 头部 V2X的道路直播 是否在展示 - * - * @param tag - * @param show - */ - void setRoadLiveCarWindowShow(String tag, boolean show); - - /** - * 设置 他人车辆故障求助 UI 是否在展示 - * - * @param tag - * @param show - */ - void setOtherSeekHelpWindowShow(String tag, boolean show); - - /** - * 地图区域 自身的道路求助按钮 是否在展示 - * - * @param tag - * @param show - */ - void setMeSeekHelpButtonShow(String tag, boolean show); - - /** - * 地图区域 他人车辆故障求助POI 是否在展示 - * - * @param tag - * @param show - */ - void setOtherSeekHelpPOIShow(String tag, boolean show); - - /** - * 设置 右侧2/3 全屏 V2X 场景动画 是否在展示 - * - * @param tag - * @param show - */ - void setV2XAnimationWindowShow(String tag, boolean show); - - /* - * 道路事件图片/视频资源 全屏 - * */ - void setV2XRoadVideoWindowShow(String tag, boolean show); - - /** - * 设置 模拟直播车机 UI 是否在展示 - * - * @param tag - * @param show - */ - void setLiveCarWindowShow(String tag, boolean show); - - /** - * 推送弹窗的状态 - * - * @param tag - * @param show - */ - void setPushWindowShow(String tag, boolean show); - - /** - * 地图区域 推送的 POI 是否在展示 - * - * @param tag - * @param show - */ - void setPushPOIShow(String tag, boolean show); - - /** - * 地图区域 疲劳驾驶 是否在展示 - * - * @param tag - * @param show - */ - void setFatigueDrivingWindowShow(String tag, boolean show); - - /** - * 事件面板状态 是否在展示 - * - * @param tag - * @param show - */ - void setEventPanelWindowShow(String tag, boolean show); - - /** - * 注册监听 - * - * @param tag 业务类型 - * @param descriptor 监听类型 - * @param listener 监听回调 - */ - void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener); - - /** - * 注销 - * - * @param tag 业务类型 - * @param descriptor 注销类型 - * @param listener 注销回调 - */ - void unregisterStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java deleted file mode 100644 index 8cf8f42847..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.v2x.manager; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.module.v2x.entity.model.DrawLineInfo; - -/** - * 绘制可变宽度和渐变的线 - */ -public interface IMoGoWarnPolylineManager extends IProvider { - /** - * 绘制连接线,目标车,与当前车辆间连线 - * - * @param context - * @param info - */ - void drawWarnPolyline(Context context, DrawLineInfo info); - - /** - * 移除连接线 - */ - void clearLine(); - - IMogoPolyline getMogoWarnPolyline(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java deleted file mode 100644 index f6d50046db..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.mogo.module.v2x.manager; - -/** - * @author congtaowang - * @since 2020-01-04 - *

    - * 状态描述 - */ -public enum V2XStatusDescriptor { - - /** - * 地图 V2X道路预警POI - */ - RoadEventPOI_UI, - - /** - * 按钮 V2X道路预警 - */ - RoadEventButton_UI, - - /** - * 头部 V2X道路预警 UI - */ - RoadEventWindow_UI, - - /** - * 头部 V2X的道路直播 UI - */ - RoadLiveCarWindow_UI, - - /** - * 地图 他人车辆故障求助POI - */ - OtherSeekHelpPOI_UI, - - /** - * 头部 他人车辆故障求助 UI 是否在展示 - */ - OtherSeekHelpWindow_UI, - - /** - * 头部 自身的道路求助按钮 UI 是否在展示 - */ - MeSeekHelpButton_UI, - - /** - * 右侧2/3 V2X 场景动画 UI 是否在展示 - */ - V2XAnimationWindow_UI, - - /** - * 右侧2/3 左下角 模拟直播车机 UI 是否在展示 - */ - LiveCarWindow_UI, - - /** - * 右侧2/3 左下角 模拟直播车机 UI 是否在展示 - */ - V2XRoadVideo_UI, - - /** - * 推送的POI - */ - PushWindowPOI_UI, - - /** - * 推送的弹窗 - */ - PushWindow_UI, - - /** - * 疲劳驾驶弹窗 - */ - FatigueDrivingWindow_UI, - - /** - * 事件面板状态 - */ - EventPanelWindow_UI, -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java deleted file mode 100644 index dfcd9256dc..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.mogo.module.v2x.manager.impl; - -import android.content.Context; -import android.util.Log; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.overlay.MogoPolylineOptions; -import com.mogo.module.v2x.MoGoV2XServicePaths; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.model.DrawLineInfo; -import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager; - -import java.util.ArrayList; -import java.util.List; - -/** - * 绘制行人和二轮车连线 - */ -@Route(path = MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER) -public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineManager { - private static IMogoPolyline mMogoPolyline; - - - @Override - public void drawPersonWarnPolyline(Context context, DrawLineInfo info) { - if (info == null) { - return; - } - - try { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - } - - // 连接线参数 - MogoPolylineOptions options = new MogoPolylineOptions().setGps(true); - - // 渐变色 - List colors = new ArrayList<>(); - colors.add(0x0DE32F46); - colors.add(0xD9E32F46); - colors.add(0x0DE32F46); - - // 线条粗细,渐变,渐变色值 - Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); - options.width(info.getWidth()).useGradient(true).colorValues(colors); - List locations = info.getLocations(); - for (int i = 0; i < locations.size(); i++) { - options.add(locations.get(i)); - } - // 绘制线的对象 - mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - mMogoPolyline.setTransparency(0.5f); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearLine() { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - mMogoPolyline = null; - } - } - - @Override - public void init(Context context) { - - } - - /** - * @return 绘制连接线的对象 - */ - @Override - public IMogoPolyline getMogoPersonWarnPolyline() { - return mMogoPolyline; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java deleted file mode 100644 index 7acd6248f0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoStopPolylineManager.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.mogo.module.v2x.manager.impl; - -import android.content.Context; -import android.util.Log; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.overlay.MogoPolylineOptions; -import com.mogo.module.v2x.MoGoV2XServicePaths; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.model.DrawLineInfo; -import com.mogo.module.v2x.manager.IMoGoStopPolylineManager; - -import java.util.ArrayList; -import java.util.List; - -/** - * 当前车辆与道路事件的连接线 - */ -@Route(path = MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER) -public class MoGoStopPolylineManager implements IMoGoStopPolylineManager { - private static IMogoPolyline mMogoPolyline; - - - @Override - public void drawStopPolyline(Context context, DrawLineInfo info) { - if (info == null) { - return; - } - - try { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - } - - // 连接线参数 - MogoPolylineOptions options = new MogoPolylineOptions() - .setGps(true); - List colors = new ArrayList<>(); - colors.add(0x0DE32F46); - colors.add(0xD9E32F46); - colors.add(0x0DE32F46); - - Log.d(V2XConst.LOG_NAME_WARN, "MoGoStopPolylineManager roadWidth = " + info.getWidth()); - // 线条粗细,渐变,渐变色值 - // 当前车辆位置 - options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors); - List locations = info.getLocations(); - for (int i = 0; i < locations.size(); i++) { - options.add(locations.get(i)); - } - // 绘制线的对象 - mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - mMogoPolyline.setTransparency(0.5f); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearLine() { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - mMogoPolyline = null; - } - } - - @Override - public void init(Context context) { - - } - - - @Override - public IMogoPolyline getMogoStopPolyline() { - return mMogoPolyline; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java deleted file mode 100644 index 9dc711140a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java +++ /dev/null @@ -1,643 +0,0 @@ -package com.mogo.module.v2x.manager.impl; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -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.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.ViewUtils; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.map.uicontroller.EnumMapUI; -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.drawer.marker.RoadConditionInfoWindow3DAdapter; -import com.mogo.module.common.entity.MarkerCardResult; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; -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.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.module.v2x.MoGoV2XServicePaths; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity; -import com.mogo.module.v2x.listener.V2XMarkerClickListener; -import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager; -import com.mogo.module.v2x.marker.V2XMarkerAdapter; -import com.mogo.module.v2x.utils.MarkerUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CopyOnWriteArraySet; - -import static com.mogo.module.service.strategy.CarIconDisplayStrategy.sFrameVr; -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; -import static com.mogo.module.v2x.V2XConst.V2X_EVENT_ALARM_POI; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 9:57 PM - * desc : V2X 涉及到的地图 POI 点的绘制 - * version: 1.0 - */ -@Route(path = MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER) -public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { - private static final String TAG = "MoGoV2XMarkerManager"; - - // 记录所有的:新鲜事儿的道路事件点、探路事件 - private static CopyOnWriteArraySet mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>(); - // 上次的道路事件的预警Marker - private static IMogoMarker mAlarmInfoMarker; - private static IMogoMarker m3DMarker; - - @Override - public void drawableLastAllPOI() { - //Logger.w(MODULE_NAME, "V2X---绘制上一次的POI,回调给Launcher底层逻辑让其进行绘制"); - // 清除连接线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - clearAlarmPOI(); - clearSpecialCarPOI(); - // 锁车 - V2XServiceManager.getMapUIController().recoverLockMode(); - // 开启主Launcher刷新 - V2XServiceManager.getIMogoRefreshStrategyController().restartAutoRefreshAtTime(0); - } - - @Override - public CopyOnWriteArrayList getV2XRoadEventEntityList() { - CopyOnWriteArrayList roadEventEntities = new CopyOnWriteArrayList<>(); - // 当前车辆数据 - MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation(); - - if (currentLocation != null) { - // 重新计算距离 - for (V2XRoadEventEntity v2XRoadEventEntity : mV2XRoadEventEntityArrayList) { - // 事件位置 - MarkerLocation location = v2XRoadEventEntity.getLocation(); - if (location != null) { - float calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(location.getLat(), location.getLon()), - new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude()) - ); - v2XRoadEventEntity.setDistance(calculateDistance); - } - roadEventEntities.add(v2XRoadEventEntity); - } - - // 按照与当前车辆距离排序 - for (int i = 0; i < roadEventEntities.size(); i++) { - for (int j = i; j > 0; j--) { - if (roadEventEntities.get(j).getDistance() < roadEventEntities.get(j - 1).getDistance()) { - V2XRoadEventEntity v2XRoadEventEntity = roadEventEntities.get(j - 1); - roadEventEntities.set(j - 1, roadEventEntities.get(j)); - roadEventEntities.set(j, v2XRoadEventEntity); - } - } - } - //输出日志查看结果 -// Log.w(TAG, "V2X==============================="); -// for (int i = 0; i < roadEventEntities.size(); i++) { -// Log.w(TAG, "V2X===" + -// "事件名称:" + roadEventEntities.get(i).getNoveltyInfo() + -// "\t 事件距离:" + roadEventEntities.get(i).getDistance()); -// } - } - - return roadEventEntities; - } - - @Override - public void analysisV2XRoadEvent(MarkerCardResult markerCardResult) { - // 预警Window状态 - boolean isShowEventWindow = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow(); - // 预警按钮状态 - boolean isShowEventButton = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventButtonShow(); - // 道路求助的window - boolean isOtherSeekHelpWindowShow = V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow(); - try { - //当没有预警提示的时候重新绘制地图POI点 - if (markerCardResult != null && !isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) { - // 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常 - mV2XRoadEventEntityArrayList.clear(); - - // 获取探路以及新鲜事儿 - List exploreWayList = markerCardResult.getExploreWay(); - - if (exploreWayList != null) { - for (MarkerExploreWay markerExploreWay : exploreWayList) { - if (EventTypeEnum.isRoadEvent(markerExploreWay.getPoiType())) { - MarkerLocation markerLocation = markerExploreWay.getLocation(); - // 记录道路事件 - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(markerLocation); - // 探路目前只有上报拥堵 - v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType()); - - v2XRoadEventEntity.setNoveltyInfo(markerExploreWay); - v2XRoadEventEntity.setExpireTime(20000); - mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity); - } - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void drawableV2XMarker(MarkerCardResult markerCardResult) { - // 预警Window状态 - boolean isShowEventWindow = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow(); - // 预警按钮状态 - boolean isShowEventButton = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventButtonShow(); - // 道路求助的window - boolean isOtherSeekHelpWindowShow = V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow(); - try { - //当没有预警提示的时候重新绘制地图POI点 - if (!isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) { - // 清除上次的道路事件,TODO 这里注意,道路事件的触发和这里是异步操作会触发异常 - //mV2XRoadEventEntityArrayList.clear(); - // 清除原来的大而全的新鲜事儿 - try { - clearALLPOI(); - } catch (Exception e) { - e.printStackTrace(); - } - // 清除连接线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - if (markerCardResult != null) { - // 绘制新的地图气泡 - List onlineCarList = markerCardResult.getOnlineCar(); - List exploreWayList = markerCardResult.getExploreWay(); - List noveltyInfoList = markerCardResult.getNoveltyInfo(); - - drawableOnlineCarPOI(onlineCarList, V2XMarkerClickListener.getInstance()); - drawableExplorePOI(exploreWayList, V2XMarkerClickListener.getInstance()); - drawableNoveltyPOI(noveltyInfoList, V2XMarkerClickListener.getInstance()); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void drawableOnlineCarPOI(List markerOnlineCars, IMogoMarkerClickListener clickListener) { - try { - if (markerOnlineCars != null) { - for (MarkerOnlineCar markerOnlineCar : markerOnlineCars) { - MarkerLocation markerLocation = markerOnlineCar.getLocation(); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerOnlineCar); - markerShowEntity.setMarkerLocation(markerLocation); - markerShowEntity.setMarkerType(markerOnlineCar.getType()); - markerShowEntity.setTextContent(markerOnlineCar.getUserInfo().getSafeLabel()); - markerShowEntity.setIconUrl(markerOnlineCar.getUserInfo().getUserHead()); - - drawableMarker(V2XServiceManager.getContext(), markerShowEntity, clickListener); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearOnlineCarPOI() { - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_CARD_TYPE_USER_DATA); - } - - @Override - public void drawableSpecialCarPOI(Context context, V2XMarkerEntity v2XMarkerEntity, IMogoMarkerClickListener clickListener) { - try { - V2XServiceManager.getMapUIController().changeMapMode(EnumMapUI.NorthUP_2D); - V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpPOIShow(TAG, true); - - // 绘制特殊车辆 - if (v2XMarkerEntity == null) { - return; - } - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(v2XMarkerEntity.getLon()); - markerLocation.setLat(v2XMarkerEntity.getLat()); - - // 进行数据转换,用于Marker展示 - V2XRoadEventEntity roadEventEntity = new V2XRoadEventEntity(); - roadEventEntity.setPoiType(v2XMarkerEntity.getTargetId() + ""); - roadEventEntity.setLocation(markerLocation); - roadEventEntity.setBindObj(v2XMarkerEntity); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(v2XMarkerEntity); - markerShowEntity.setChecked(false); - markerShowEntity.setMarkerLocation(markerLocation); - - // 重置告警信息 - V2XServiceManager.getV2XStatusManager().setAlarmInfo(roadEventEntity); - - // 清除原来的大而全的新鲜事儿 - clearALLPOI(); - if (roadEventEntity.getLocation() != null) { - // 道路事件,或者水波纹扩散效果 - MogoMarkerOptions optionsRipple = new MogoMarkerOptions() - .data(roadEventEntity) - .latitude(roadEventEntity.getLocation().getLat()) - .longitude(roadEventEntity.getLocation().getLon()); - optionsRipple.anchor(0.5f, 0.5f); - - //由于性能问题,D车机不使用事件扩散动画 - //showInfoWindow只支持添加单个marker,不支持帧动画 - if (!CarSeries.isF8xxSeries()) { - optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity)); - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null); - mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions())); - mAlarmInfoMarker.showInfoWindow(); - } else { - mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple); - } - // 当前Marker设置为最上面 - mAlarmInfoMarker.setToTop(); - } else { - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - ArrayList mBitmapFrames = new ArrayList<>(); - for (int i : sFrameVr) { - mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i)); - } - optionsRipple.icons(mBitmapFrames); - optionsRipple.period(20); - optionsRipple.scale(0.4f); - mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple); - - MogoMarkerOptions options = new MogoMarkerOptions().data(roadEventEntity) - .latitude(roadEventEntity.getLocation().getLat()).longitude(roadEventEntity.getLocation().getLon()); - options.anchor(0.5f, 0.5f); - options.icon3DRes(R.raw.special_vehicle); - options.anchorColor("#FFBF29FF"); - m3DMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, options); - m3DMarker.setToTop(); - } else { - optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity)); - optionsRipple.period(100); - mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple); - // 当前Marker设置为最上面 - mAlarmInfoMarker.setToTop(); - } - } - - // 绘制连接线 - V2XServiceManager.getMoGoV2XPolylineManager().drawablePolyline(context, roadEventEntity); - // 缩放地图 - MarkerUtils.zoomMap( - new MogoLatLng(roadEventEntity.getLocation().getLat(), - roadEventEntity.getLocation().getLon() - ), context); - } else { - Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearSpecialCarPOI() { - boolean isOtherSeekHelpPOIShow = V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow(); - if (isOtherSeekHelpPOIShow) { - V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpPOIShow(TAG, false); - // 重置告警信息 - V2XServiceManager.getV2XStatusManager().setAlarmInfo(null); - if (mAlarmInfoMarker != null) { - mAlarmInfoMarker.remove(); - } - if (m3DMarker != null) { - m3DMarker.remove(); - } - } - } - - @Override - public void drawableLiveCarPOI(List markerOnlineCars, IMogoMarkerClickListener clickListener) { - try { - Logger.w(MODULE_NAME, "V2X===事件周边的直播车机:" + markerOnlineCars); - if (markerOnlineCars != null) { - for (MarkerOnlineCar markerOnlineCar : markerOnlineCars) { - // 设置车类型 - markerOnlineCar.getUserInfo().setSafeLabelType(4); - markerOnlineCar.getCarInfo().setVehicleType(0); - - MarkerLocation markerLocation = markerOnlineCar.getLocation(); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerOnlineCar); - markerShowEntity.setMarkerLocation(markerLocation); - markerShowEntity.setMarkerType(V2XConst.V2X_MARKER_LIVE_CAR); - markerShowEntity.setTextContent(markerOnlineCar.getUserInfo().getSafeLabel()); - markerShowEntity.setIconUrl(markerOnlineCar.getUserInfo().getUserHead()); - - drawableMarker( - V2XServiceManager.getContext(), - markerShowEntity, - clickListener); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearLiveCarPOI() { - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_MARKER_LIVE_CAR); - } - - @Override - public void drawableExplorePOI(List exploreWayList, IMogoMarkerClickListener clickListener) { - try { - if (exploreWayList != null) { - for (MarkerExploreWay markerExploreWay : exploreWayList) { - // 因为目前探路卡片不支持直播,所以这里做了过滤 @李小鹏 - if (!markerExploreWay.getCanLive()) { - MarkerLocation markerLocation = markerExploreWay.getLocation(); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerExploreWay); - markerShowEntity.setMarkerLocation(markerLocation); - markerShowEntity.setMarkerType(markerExploreWay.getType()); - markerShowEntity.setTextContent(markerExploreWay.getAddr()); - - drawableMarker( - V2XServiceManager.getContext(), - markerShowEntity, - clickListener); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearExplorePOI() { - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_CARD_TYPE_ROAD_CONDITION); - } - - @Override - public void drawableNoveltyPOI(List noveltyInfoList, IMogoMarkerClickListener clickListener) { - try { - if (noveltyInfoList != null) { - for (MarkerNoveltyInfo noveltyInfo : noveltyInfoList) { - MarkerLocation markerLocation = noveltyInfo.getLocation(); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(noveltyInfo); - markerShowEntity.setMarkerLocation(markerLocation); - markerShowEntity.setMarkerType(noveltyInfo.getType()); - markerShowEntity.setTextContent(noveltyInfo.getLocation().getAddress()); - - // 这里只绘制道路事件相关 - if (EventTypeEnum.TRAFFIC_CHECK.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.ROAD_CLOSED.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ROAD_WORK.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_PONDING.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_PARKING.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ICE.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_FOG.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_01.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_02.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_03.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_04.getPoiType().equals(noveltyInfo.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_05.getPoiType().equals(noveltyInfo.getPoiType())) { - drawableMarker(V2XServiceManager.getContext(), markerShowEntity, clickListener); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearNoveltyPOI() { - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_CARD_TYPE_NOVELTY); - } - - @Override - public void drawableMarker(Context context, MarkerShowEntity markerShowEntity, IMogoMarkerClickListener clickListener) { -// Logger.i(MODULE_NAME, "绘制Marker====drawMapMarker:" + markerShowEntity); - try { - if (markerShowEntity.getMarkerLocation() != null) { - MogoMarkerOptions options = new MogoMarkerOptions() - .data(markerShowEntity) - .latitude(markerShowEntity.getMarkerLocation().getLat()) - .longitude(markerShowEntity.getMarkerLocation().getLon()); - - // 这里对Marker做下持有者转换,与大而全的区分开,由于绘制的时候用到了低层能力所以不去修改markerShowEntity中的type - switch (markerShowEntity.getMarkerType()) { - case ServiceConst.CARD_TYPE_USER_DATA: - options.owner(V2XConst.V2X_CARD_TYPE_USER_DATA); - break; - case ServiceConst.CARD_TYPE_NOVELTY: - options.owner(V2XConst.V2X_CARD_TYPE_NOVELTY); - break; - case ServiceConst.CARD_TYPE_ROAD_CONDITION: - options.owner(V2XConst.V2X_CARD_TYPE_ROAD_CONDITION); - break; - case V2XConst.V2X_MARKER_SPECIAL_CAR: - options.owner(V2XConst.V2X_MARKER_SPECIAL_CAR); - break; - case V2XConst.V2X_MARKER_LIVE_CAR: - options.owner(V2XConst.V2X_MARKER_LIVE_CAR); - break; - default: - options.owner(markerShowEntity.getMarkerType()); - break; - } - - IMogoMarker marker; - Bitmap bitmap; - if (markerShowEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_USER_DATA) - || markerShowEntity.getMarkerType().equals(V2XConst.V2X_MARKER_SPECIAL_CAR) - || markerShowEntity.getMarkerType().equals(V2XConst.V2X_MARKER_LIVE_CAR) - || markerShowEntity.getMarkerType().equals(V2XConst.V2X_MARKER_EXPRESS) - ) { - bitmap = V2XMarkerAdapter.getV2XCarMarkerView(context, markerShowEntity); - options.icon(bitmap); - marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); - } else { - IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(context, markerShowEntity, options); - bitmap = ViewUtils.fromView(iMarkerView.getView()); - options.icon(bitmap); - marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); - iMarkerView.setMarker(marker); - } - //marker.setOnMarkerClickListener(clickListener); - } else { - Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @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 { - V2XServiceManager.getMapUIController().changeMapMode(EnumMapUI.NorthUP_2D); - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventPOIShow(TAG, true); - //Logger.i(MODULE_NAME, "绘制道路事件====drawableAlarmPOI:"); - // 清除原来的大而全的新鲜事儿 - clearALLPOI(); - if (roadEventEntity.getLocation() != null) { - // 道路事件,或者水波纹扩散效果 - MogoMarkerOptions optionsRipple = new MogoMarkerOptions() - .data(roadEventEntity) - .latitude(roadEventEntity.getLocation().getLat()) - .longitude(roadEventEntity.getLocation().getLon()); - optionsRipple.anchor(0.5f, 0.5f); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - MarkerExploreWay markerExploreWay = roadEventEntity.getNoveltyInfo(); - markerShowEntity.setBindObj(markerExploreWay); - markerShowEntity.setChecked(false); - markerShowEntity.setTextContent(markerExploreWay.getAddr()); - 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); - } - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener); -// mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions())); -// mAlarmInfoMarker.showInfoWindow(); - } else { - optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity)); - mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple); - } - // 当前Marker设置为最上面 - mAlarmInfoMarker.setToTop(); - // 绘制连接线 - V2XServiceManager.getMoGoV2XPolylineManager().drawablePolyline(context, roadEventEntity); - // 缩放地图 - MarkerUtils.zoomMap( - new MogoLatLng(roadEventEntity.getLocation().getLat(), - roadEventEntity.getLocation().getLon() - ), context); - } else { - Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearAlarmPOI() { - boolean isRoadEventPOIShow = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow(); - if (isRoadEventPOIShow) { - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventPOIShow(TAG, false); - if (mAlarmInfoMarker != null) { - mAlarmInfoMarker.remove(); - } - } - } - - @Override - public void clearALLPOI() { - try { - V2XServiceManager.getMarkerManager().removeMarkers(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void init(Context context) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XPolylineManager.java deleted file mode 100644 index 2b6e611bbb..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XPolylineManager.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.mogo.module.v2x.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.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.module.v2x.MoGoV2XServicePaths; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager; - -import java.util.ArrayList; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 10:00 PM - * desc : 当前车辆与道路事件的连接线 - * version: 1.0 - */ -@Route(path = MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER) -public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager { - private static final String TAG = "MoGoV2XPolylineManager"; - private static IMogoPolyline mMogoPolyline; - - @Override - public void drawablePolyline(Context context, V2XRoadEventEntity roadEventEntity) { - try { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - } - if ((V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow() - || V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow()) - && V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null - && !V2XServiceManager.getMoGoStatusManager().isVrMode() - ) { - // 连接线参数 - MogoPolylineOptions options = new MogoPolylineOptions().setGps(true); - - // 渐变色 - List colors = new ArrayList<>(); - - if (EventTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(roadEventEntity.getPoiType()) - || EventTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(roadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(roadEventEntity.getPoiType()) - || EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(roadEventEntity.getPoiType())) { - colors.add(0xFFFFA31A); - colors.add(0xFFFFA31A); - } else { - colors.add(0xFFE32F46); - colors.add(0xFFE32F46); - } - // 线条粗细,渐变,渐变色值 - options.width(10).useGradient(true).colorValues(colors); - - // 当前车辆位置 - MogoLatLng carLocation = V2XServiceManager.getNavi().getCarLocation(); - if (carLocation != null) { - options.add(carLocation); - } else { - options.add(V2XServiceManager.getV2XStatusManager().getLocation()); - } - // 目标车辆、道路事件位置 - options.add(V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng()); - - // 绘制线的对象 - mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearLine() { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - mMogoPolyline = null; - V2XServiceManager.getV2XStatusManager().setAlarmInfo(null); - } - } - - @Override - public void init(Context context) { - - } - - /** - * @return 绘制连接线的对象 - */ - @Override - public IMogoPolyline getMogoPolyline() { - return mMogoPolyline; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java deleted file mode 100644 index 1a80dcaebe..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.mogo.module.v2x.manager.impl; - -import android.content.Context; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.module.v2x.MoGoV2XServicePaths; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener; -import com.mogo.module.v2x.manager.IMoGoV2XStatusManager; -import com.mogo.module.v2x.manager.V2XStatusDescriptor; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/17 7:34 PM - * desc : - * version: 1.0 - */ -@Route(path = MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER) -public class MoGoV2XStatusManager implements IMoGoV2XStatusManager { - private static final String TAG = "MoGoV2XStatusManager"; - - /** - * 状态记录 - */ - private static final Map mStatus = new ConcurrentHashMap<>(); - - /** - * 回调集合 - */ - private static final Map> mListeners = new ConcurrentHashMap<>(); - - /** - * 状态类型修改记录 - */ - private static final Map mModifier = new ConcurrentHashMap<>(); - - // 查询状态存储情况 - private boolean get_bool_val(V2XStatusDescriptor descriptor) { - Boolean val = mStatus.get(descriptor); - return val == null ? false : val; - } - - @Override - public boolean isRoadEventPOIShow() { - return get_bool_val(V2XStatusDescriptor.RoadEventPOI_UI); - } - - @Override - public boolean isRoadEventButtonShow() { - return get_bool_val(V2XStatusDescriptor.RoadEventButton_UI); - } - - @Override - public boolean isRoadEventWindowShow() { - return get_bool_val(V2XStatusDescriptor.RoadEventWindow_UI); - } - - @Override - public boolean isRoadLiveCarWindowShow() { - return get_bool_val(V2XStatusDescriptor.RoadLiveCarWindow_UI); - } - - @Override - public boolean isOtherSeekHelpWindowShow() { - return get_bool_val(V2XStatusDescriptor.OtherSeekHelpWindow_UI); - } - - @Override - public boolean isMeSeekHelpButtonShow() { - return get_bool_val(V2XStatusDescriptor.MeSeekHelpButton_UI); - } - - @Override - public boolean isOtherSeekHelpPOIShow() { - return get_bool_val(V2XStatusDescriptor.OtherSeekHelpPOI_UI); - } - - @Override - public boolean isV2XAnimationShow() { - return get_bool_val(V2XStatusDescriptor.V2XAnimationWindow_UI); - } - - @Override - public boolean isLeftLiveVideoShow() { - return get_bool_val(V2XStatusDescriptor.LiveCarWindow_UI); - } - - @Override - public boolean isPushWindowShow() { - return get_bool_val(V2XStatusDescriptor.PushWindow_UI); - } - - @Override - public boolean isPushPOIShow() { - return get_bool_val(V2XStatusDescriptor.PushWindowPOI_UI); - } - - @Override - public boolean isFatigueDrivingWindowShow() { - return get_bool_val(V2XStatusDescriptor.FatigueDrivingWindow_UI); - } - - @Override - public boolean isEventPanelWindowShow() { - return get_bool_val(V2XStatusDescriptor.EventPanelWindow_UI); - } - - @Override - public void setRoadEventPOIShow(String tag, boolean show) { - V2XServiceManager.getMoGoStatusManager().setV2XUIShow(V2XConst.MODULE_NAME, show); - mStatus.put(V2XStatusDescriptor.RoadEventPOI_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.RoadEventPOI_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.RoadEventPOI_UI); - } - - @Override - public void setRoadEventButtonShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.RoadEventButton_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.RoadEventButton_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.RoadEventButton_UI); - } - - @Override - public void setRoadEventWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.RoadEventWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.RoadEventWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.RoadEventWindow_UI); - } - - @Override - public void setRoadLiveCarWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.RoadLiveCarWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.RoadLiveCarWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.RoadLiveCarWindow_UI); - } - - @Override - public void setOtherSeekHelpWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.OtherSeekHelpWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.OtherSeekHelpWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.OtherSeekHelpWindow_UI); - } - - @Override - public void setMeSeekHelpButtonShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.MeSeekHelpButton_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.MeSeekHelpButton_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.MeSeekHelpButton_UI); - } - - @Override - public void setOtherSeekHelpPOIShow(String tag, boolean show) { - V2XServiceManager.getMoGoStatusManager().setV2XUIShow(V2XConst.MODULE_NAME, show); - mStatus.put(V2XStatusDescriptor.OtherSeekHelpPOI_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.OtherSeekHelpPOI_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.OtherSeekHelpPOI_UI); - } - - @Override - public void setV2XAnimationWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.V2XAnimationWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.V2XAnimationWindow_UI); - } - - @Override - public void setV2XRoadVideoWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.V2XRoadVideo_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.V2XRoadVideo_UI); - } - - @Override - public void setLiveCarWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.LiveCarWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.LiveCarWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.LiveCarWindow_UI); - } - - - @Override - public void setPushWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.PushWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.PushWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.PushWindow_UI); - } - - @Override - public void setPushPOIShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.PushWindowPOI_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.PushWindowPOI_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.PushWindowPOI_UI); - } - - @Override - public void setFatigueDrivingWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.FatigueDrivingWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.FatigueDrivingWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI); - } - - @Override - public void setEventPanelWindowShow(String tag, boolean show) { - mStatus.put(V2XStatusDescriptor.EventPanelWindow_UI, show); - invokeStatusChangedListener(V2XStatusDescriptor.EventPanelWindow_UI, show); - recordStatusModifier(tag, V2XStatusDescriptor.EventPanelWindow_UI); - } - - @Override - public void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) { - if (listener == null || descriptor == null) { - return; - } - if (!mListeners.containsKey(descriptor)) { - mListeners.put(descriptor, new ArrayList<>()); - } - if (mListeners.get(descriptor) == null) { - mListeners.put(descriptor, new ArrayList<>()); - } - List listeners = mListeners.get(descriptor); - if (listeners != null) { - listeners.add(listener); - } - } - - @Override - public void unregisterStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) { - List listeners = mListeners.get(descriptor); - if (listeners != null) { - listeners.remove(listener); - } - } - - - /** - * 调用所有存储的监听 - * - * @param descriptor - * @param status - */ - private void invokeStatusChangedListener(V2XStatusDescriptor descriptor, boolean status) { - if (mListeners.containsKey(descriptor)) { - List listeners = mListeners.get(descriptor); - if (listeners != null) { - for (IMoGoV2XStatusChangedListener listener : listeners) { - if (listener != null) { - listener.onStatusChanged(descriptor, status); - } - } - } - } - } - - /** - * 记录状态 - * - * @param tag - * @param descriptor - */ - private void recordStatusModifier(String tag, V2XStatusDescriptor descriptor) { - mModifier.put(descriptor, tag); - } - - @Override - public void init(Context context) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java deleted file mode 100644 index c39ab0aa07..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.mogo.module.v2x.manager.impl; - -import android.content.Context; -import android.util.Log; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.overlay.MogoPolylineOptions; -import com.mogo.module.v2x.MoGoV2XServicePaths; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.model.DrawLineInfo; -import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager; - -import java.util.ArrayList; -import java.util.List; - -/** - * 当前车辆与道路事件的连接线 - */ -@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER) -public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { - private static IMogoPolyline mMogoPolyline; - - - @Override - public void drawWarnPolyline(Context context, DrawLineInfo info) { - if (info == null) { - return; - } - - try { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - } - - // 连接线参数 - MogoPolylineOptions options = new MogoPolylineOptions() - .setGps(true); - List colors = new ArrayList<>(); - - if (info.isHasStopLines() == true) { - colors.add(0x0D3036FF); - colors.add(0xD93036FF); - colors.add(0x0D3036FF); - } else { - colors.add(0x0DE32F46); - colors.add(0xD9E32F46); - colors.add(0x0DE32F46); - } - - Log.d("V2XWarningMarker", "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); - // 线条粗细,渐变,渐变色值 - options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors); - List locations = info.getLocations(); - for (int i = 0; i < locations.size(); i++) { - options.add(locations.get(i)); - } - // 绘制线的对象 - mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - mMogoPolyline.setTransparency(0.5f); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearLine() { - if (mMogoPolyline != null) { - mMogoPolyline.remove(); - mMogoPolyline = null; - } else { - Log.d("V2XWarningMarker", "mMogoPolyline==null"); - } - } - - @Override - public void init(Context context) { - - } - - /** - * @return 绘制连接线的对象 - */ - @Override - public IMogoPolyline getMogoWarnPolyline() { - return mMogoPolyline; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/OptimalSpeedMarkerView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/OptimalSpeedMarkerView.java deleted file mode 100644 index 425b8c394d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/OptimalSpeedMarkerView.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mogo.module.v2x.marker; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.LayoutInflater; - -import androidx.annotation.Nullable; - -import com.mogo.module.common.drawer.marker.MapMarkerBaseView; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.v2x.R; - -/** - * 绿波速度引导在地图上打的marker - * - * @author tongchenfei - */ -public class OptimalSpeedMarkerView extends MapMarkerBaseView { - private String TAG = "OptimalSpeedMarkerView"; - - public OptimalSpeedMarkerView(Context context ) { - super( context ); - } - - public OptimalSpeedMarkerView(Context context, @Nullable AttributeSet attrs ) { - super( context, attrs ); - } - - public OptimalSpeedMarkerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { - super( context, attrs, defStyleAttr ); - } - - @Override - protected void initView( Context context ) { - LayoutInflater.from( context ).inflate(R.layout.view_v2x_optimal_speed_marker, this ); - } - - @Override - public void updateView( MarkerShowEntity markerShowEntity ) { - } - - -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XFrontTargetMarkerView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XFrontTargetMarkerView.java deleted file mode 100644 index 51c18bdc10..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XFrontTargetMarkerView.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mogo.module.v2x.marker; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.LayoutInflater; - -import androidx.annotation.Nullable; - -import com.mogo.module.common.drawer.marker.MapMarkerBaseView; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.v2x.R; - -/** - * @author liujing - * @description 前方预警目标物2D资源实现,目前只有停止线,可以按需添加其他类型 - * @since: 2021/4/9 - */ -public class V2XFrontTargetMarkerView extends MapMarkerBaseView { - private String TAG = "V2XFrontTargetMarkerView"; - - - public V2XFrontTargetMarkerView(Context context) { - super(context); - } - - public V2XFrontTargetMarkerView(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - } - - public V2XFrontTargetMarkerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @Override - protected void initView(Context context) { - LayoutInflater.from( context ).inflate(R.layout.v2x_front_target_info_view, this ); - } - - @Override - public void updateView(MarkerShowEntity markerShowEntity) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerAdapter.java deleted file mode 100644 index 316e5e203d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerAdapter.java +++ /dev/null @@ -1,218 +0,0 @@ -package com.mogo.module.v2x.marker; - -import android.content.Context; -import android.graphics.Bitmap; - -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.utils.ImageUtil; - -import java.util.ArrayList; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-1015:55 - * desc : V2X 地图气泡 - * version: 1.0 - */ -public class V2XMarkerAdapter { - - /** - * 返回道路事件 - */ - public static Bitmap getV2XRoadEventMarkerView(Context context, V2XRoadEventEntity alarmInfo) { - return new V2XMarkerRoadEventView(context, alarmInfo).getView(); - } - - /** - * 返回道路事件 - */ - public static Bitmap getV2XRoadEventMarkerView(Context context, V2XRoadEventEntity alarmInfo, int imageRes) { - return new V2XMarkerRoadEventView(context, alarmInfo).setBackground(imageRes).getView(); - } - - /** - * 返回道路事件静态的图,因为D车机性能不行,会卡顿 - */ - public static Bitmap getV2XRoadEventViewPng(Context context, V2XRoadEventEntity alarmInfo) { - Bitmap bitmap; - if (EventTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) { - bitmap = getV2XRoadEventMarkerView( - context, - alarmInfo, - R.drawable.v_to_x_warning_circle_orange_00040); - } else { - bitmap = getV2XRoadEventMarkerView( - context, - alarmInfo, - R.drawable.v_to_x_warning_circle_red_00040); - } - return bitmap; - } - - /** - * 返回道路事件gif序列图集合 - */ - public static ArrayList getV2XRoadEventViewGif(Context context, V2XRoadEventEntity alarmInfo) { - ArrayList bitmapArrayList; - if (EventTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) { - bitmapArrayList = getV2XRoadEventOrangeMarkerView(context, alarmInfo); - } else { - bitmapArrayList = getV2XRoadEventRedMarkerView(context, alarmInfo); - } - return bitmapArrayList; - } - - /** - * 返回红色扩散效果的序列 - */ - public static ArrayList getV2XRoadEventRedMarkerView(Context context, V2XRoadEventEntity alarmInfo) { - ArrayList icons = new ArrayList<>(); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00011)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00012)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00013)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00014)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00015)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00016)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00017)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00018)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00019)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00020)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00021)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00022)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00023)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00024)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00025)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00026)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00027)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00028)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00029)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00030)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00031)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00032)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00033)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00034)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00035)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00036)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00037)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00038)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00039)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00040)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00041)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00042)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00043)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00044)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00045)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00046)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00047)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_red_00048)); - return icons; - } - - /** - * 返回橘色色扩散效果的序列 - */ - public static ArrayList getV2XRoadEventOrangeMarkerView(Context context, V2XRoadEventEntity alarmInfo) { - ArrayList icons = new ArrayList<>(); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00011)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00012)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00013)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00014)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00015)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00016)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00017)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00018)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00019)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00020)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00021)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00022)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00023)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00024)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00025)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00026)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00027)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00028)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00029)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00030)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00031)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00032)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00033)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00034)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00035)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00036)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00037)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00038)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00039)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00040)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00041)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00042)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00043)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00044)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00045)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00046)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00047)); - icons.add(V2XMarkerAdapter.getV2XRoadEventMarkerView(context, alarmInfo, R.drawable.v_to_x_warning_circle_orange_00048)); - 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(); - } - } - - - /** - * TODO 都是模拟数据 - * 获取VR道路事件 - */ - public static Bitmap getV2XVRRoadEventViewPng(V2XPushMessageEntity alarmMessage) { - Bitmap bitmap = ImageUtil.createBitmap(Utils.getApp(), - R.drawable.v_to_x_warning_car_orange); - switch (alarmMessage.getSceneId()) { - case "200001"://后方VIP车辆提示 -// bitmap = ImageUtil.createBitmap(Utils.getApp(), -// R.drawable.v2x_duixiang_laiche_che); - break; - case "200002"://前车急刹 - break; - case "200003"://后方危险车辆预警 - break; - case "200004"://逆向车辆路线预判 -// bitmap = ImageUtil.createBitmap(Utils.getApp(), -// R.drawable.v2x_duixiang_laiche_che); - break; - case "200005"://VIP变灯通行 - break; - case "200006"://障碍物绕行 - break; - case "200007"://行人预警,行人路线预测 - break; - case "200008"://拥堵路线推荐 - break; - case "200009"://双闪车辆,自动绕行 - break; - } - - return bitmap; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt deleted file mode 100644 index 205cf34145..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt +++ /dev/null @@ -1,144 +0,0 @@ -package com.mogo.module.v2x.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.utilcode.util.ViewUtils -import com.mogo.module.common.entity.MarkerOnlineCar -import com.mogo.module.common.entity.MarkerShowEntity -import com.mogo.module.v2x.R -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity -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/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt deleted file mode 100644 index afc95dcf22..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt +++ /dev/null @@ -1,114 +0,0 @@ -package com.mogo.module.v2x.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.utilcode.util.ViewUtils -import com.mogo.module.common.entity.MarkerOnlineCar -import com.mogo.module.common.entity.MarkerShowEntity -import com.mogo.module.v2x.R -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity -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/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt deleted file mode 100644 index a31c08e998..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt +++ /dev/null @@ -1,68 +0,0 @@ -package com.mogo.module.v2x.marker - - -import android.content.Context -import android.graphics.Bitmap -import android.view.LayoutInflater -import androidx.constraintlayout.widget.ConstraintLayout -import com.mogo.eagle.core.utilcode.util.ViewUtils -import com.mogo.module.common.entity.V2XRoadEventEntity -import com.mogo.module.common.enums.EventTypeEnum -import com.mogo.module.v2x.R -import kotlinx.android.synthetic.main.view_marker_event_car.view.* - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-0619:55 - * desc : - * 3、道路事件 - * 2.18 演示 :驾驶模式中地图展示“拥堵“、“施工”; - * (ADAS模式下还包含 原有的拥堵、交通检查、封路事件) - * version: 1.0 - */ -class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) : - ConstraintLayout(context) { - val TAG = "V2XMarkerRoadEventView" - - init { - initView(context, alarmInfo) - } - - fun initView(context: Context, alarmInfo: V2XRoadEventEntity) { - if (alarmInfo.poiType == EventTypeEnum.ALERT_FRONT_CAR.poiType || - alarmInfo.poiType == EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.poiType - ) { - LayoutInflater.from(context) - .inflate(R.layout.view_marker_event_car, this) - } else { - LayoutInflater.from(context) - .inflate(R.layout.view_marker_event_road, this) - } - updateIcon(alarmInfo) - } - - /** - * @see EventTypeEnum - */ - private fun updateIcon(alarmInfo: V2XRoadEventEntity) { - //Logger.d(MODULE_NAME, alarmInfo.toString()) - // 道路施工、积水、路面结冰、浓雾、事故、拥堵 - val iconResId = EventTypeEnum.getUpdateIconRes(alarmInfo.poiType) - if (iconResId != 0) { - ivCar.setImageResource(iconResId) - } - } - - /** - * 背景 - */ - fun setBackground(imageRes: Int): V2XMarkerRoadEventView { - ivBg.setImageResource(imageRes) - return this - } - - fun getView(): Bitmap { - return ViewUtils.fromView(this) - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java deleted file mode 100644 index 6821ea9bc0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.mogo.module.v2x.network; - -import com.mogo.eagle.core.data.BaseData; -import com.mogo.module.common.entity.MarkerResponse; -import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes; -import com.mogo.module.v2x.entity.net.V2XLiveCarRes; -import com.mogo.module.v2x.entity.net.V2XLiveCrossRoad; -import com.mogo.module.v2x.entity.net.V2XLivePushVoRes; -import com.mogo.module.v2x.entity.net.V2XRoadDataRes; -import com.mogo.module.v2x.entity.net.V2XSeekHelpRes; -import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; -import com.mogo.module.v2x.entity.net.V2XUserInfoRes; -import com.mogo.module.v2x.entity.panel.SurroundingResponse; -import com.mogo.module.v2x.entity.panel.V2XShareEventDescription; -import com.mogo.module.v2x.entity.panel.V2XShareEventItem; - -import java.util.Map; - -import io.reactivex.Observable; -import okhttp3.RequestBody; -import retrofit2.http.Body; -import retrofit2.http.FieldMap; -import retrofit2.http.FormUrlEncoded; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.POST; -import retrofit2.http.Query; -import retrofit2.http.QueryMap; - -/** - * @author congtaowang - * @since 2020-01-03 - *

    - * 接口描述 - */ -public interface V2XApiService { - /** - * 直播心跳 - */ - @FormUrlEncoded - @POST("/dataSave/integratedServices/app/push/no/heartbeat/v1") - Observable refreshHeartBeat(@FieldMap Map liveBroadcast); - - /** - * 刷新地图气泡点,异步获取 - */ - @FormUrlEncoded - @POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync") - Observable querySnapshotAsync(@FieldMap Map parameters); - - /** - * 刷新地图气泡点,同步获取 - */ - @FormUrlEncoded - @POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync") - Observable querySnapshotSync(@FieldMap Map parameters); - - /** - * 直播点赞 - */ - @FormUrlEncoded - @POST("/yycp-geo-fence-carService/restrictedRules/car/liveBroadcastPraise") - Observable giveLikeLiveVideo(@FieldMap Map parameters); - - /** - * 同过SN获取用户信息 - */ - @Headers({"Content-Type:application/json", "Accept:application/json"}) - @POST("/yycp-realtimeLocations/realTimeLocationServer/queryUserInfoBySn") - Observable queryUserInfoBySn(@Body RequestBody jsonStr); - - /** - * 车辆故障求助查询 - * - * @param param - * @return - */ - @FormUrlEncoded - @POST("/yycp-realtimeLocations/vehicleTypeManage/car/queryVehicleType/v1") - Observable queryHelpSignal(@FieldMap Map param); - - /** - * 车辆故障求助查询 - * - * @param param - * @return - */ - @FormUrlEncoded - @POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1") - Observable sendHelpSignal(@FieldMap Map param); - - /** - * 根据经纬度查询附近可直播车机直播信息 - */ - @FormUrlEncoded - @POST("/yycp-realtimeLocations/realTimeLocationServer/car/queryNearbyVehicleLiveByLocation/v1") - Observable queryNearbyVehicleLiveByLocation(@FieldMap Map parameters); - - /** - * 推流与停止推流接口 - */ - @FormUrlEncoded - @POST("/dataSave/integratedServices/app/push/no/livePush/v1") - Observable livePush(@FieldMap Map parameters); - - /** - * TODO 查询演示车用户信息 - */ - @GET("/yycp-launcherSnapshot/mock/getMockUserInfos") - Observable getMockUserInfos(); - - /** - * 根据名称获取策略详情 - */ - @GET("/yycp-strategyPush/push/strategy/item?name=TIRE_DRIVING") - Observable getStrategyPush(); - - /** - * 违章地段查询接口 - */ - @FormUrlEncoded - @POST("/yycp-launcherSnapshot/launcherSnapshot/queryIllegalPark") - Observable queryIllegalPark(@FieldMap Map parameters); - - /** - * 我的分享-热心指数等 - */ - @FormUrlEncoded - @POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1") - Observable getEnthusiasmIndex(@FieldMap Map parames); - - /** - * 我的分享-列表 - */ - @FormUrlEncoded - @POST("/deva/car/pathAndPoi/no/queryInfo") - Observable getShareEventList(@FieldMap Map parames); - - /* - * 周边列表 - * - * */ - @Headers({"Content-Type:application/json", "Accept:application/json"}) - @POST("/deva/car/path/no/getLauncherSnapshotDataResponse/v1") - Observable getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr); - - /** - * 点赞接口 - */ - @FormUrlEncoded - @POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1") - Observable addPoiInfoFabulous(@FieldMap Map params); - - /** - * 响应求助 - */ - @FormUrlEncoded - @POST("/deva/poiInfoFabulous/car/poi/no/RespondingToHelp/v1") - Observable respondingToHelp(@FieldMap Map params); - - /** - * 道路事件UGC - * 需求地址 - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 - */ - @FormUrlEncoded - @POST("/deva/car/poi/no/manualMarkingTrafficJam") - Observable manualMarkingTrafficJam(@FieldMap Map params); - - /** - * 查询路口实况 - */ - @FormUrlEncoded - @POST("/yycp-geo-fence-carService/car/camera/no/nextTest/v1") -// @POST("/yycp-geo-fence-carService/car/camera/no/next/v1") - Observable queryCrossRoadsLive(@FieldMap Map params); - - - /** - * 基于目的地预判的道路事件和违章高发情况的停车推荐 - */ - @GET("/yycp-geo-fence-carService/car/road/getRoadDataOfVehiclesRecommend") - Observable queryRoadDataOfVehiclesRecommend(@QueryMap Map parameters); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java deleted file mode 100644 index b7e3bcde6f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiServiceFactory.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.mogo.module.v2x.network; - -import android.content.Context; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.module.common.constants.HostConst; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.network.IMogoNetwork; - -/** - * 应对不同接口对应不同服务域名的工厂累 - */ -public class V2XApiServiceFactory { - - private static V2XApiService mDevaApiService; - private static V2XApiService mDataApiService; - private static V2XApiService mLauncherSnapshotApiService; - private static V2XApiService mGeoFenceCarServiceApiService; - private static V2XApiService mRealtimeLocationApiService; - private static V2XApiService mDataServiceApiService; - - /** - * 获取指定域名下的 API 服务 - */ - public static V2XApiService getApiService(Context context, String netHost) { - IMogoNetwork network = (IMogoNetwork) ARouter.getInstance() - .build(MogoServicePaths.PATH_SERVICES_NETWORK) - .navigation(context); - return network.create(V2XApiService.class, netHost); - } - - public static V2XApiService getDevaApiService(Context context) { - if (mDevaApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mDevaApiService == null) { - mDevaApiService = getApiService(context, HostConst.DEVA_HOST); - } - } - } - return mDevaApiService; - } - - public static V2XApiService getDataApiService(Context context) { - if (mDataApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mDataApiService == null) { - mDataApiService = getApiService(context, HostConst.DATA_SERVICE_HOST); - } - } - } - return mDataApiService; - } - - public static V2XApiService getLauncherSnapshotApiService(Context context) { - if (mLauncherSnapshotApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mLauncherSnapshotApiService == null) { - mLauncherSnapshotApiService = getApiService(context, HostConst.LAUNCHER_SNAPSHOT_HOST); - } - } - } - return mLauncherSnapshotApiService; - } - - public static V2XApiService getGeoFenceCarServiceApiService(Context context) { - if (mGeoFenceCarServiceApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mGeoFenceCarServiceApiService == null) { - mGeoFenceCarServiceApiService = getApiService(context, HostConst.GEOFENCE_HOST); - } - } - } - return mGeoFenceCarServiceApiService; - } - - public static V2XApiService getRealtimeLocationApiService(Context context) { - if (mRealtimeLocationApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mRealtimeLocationApiService == null) { - mRealtimeLocationApiService = getApiService(context, HostConst.REALTIME_LOCATION_HOST); - } - } - } - return mRealtimeLocationApiService; - } - - public static V2XApiService getDataServiceApiService(Context context) { - if (mDataServiceApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mDataServiceApiService == null) { - mDataServiceApiService = getApiService(context, HostConst.DATA_SERVICE_HOST); - } - } - } - return mDataServiceApiService; - } - public static V2XApiService getStrategyPushApiService(Context context) { - if (mDataServiceApiService == null) { - synchronized (V2XApiServiceFactory.class) { - if (mDataServiceApiService == null) { - mDataServiceApiService = getApiService(context, HostConst.STRATEGY_PUSH_HOST); - } - } - } - return mDataServiceApiService; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshCallback.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshCallback.java deleted file mode 100644 index f17d3d6672..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshCallback.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.network; - -/** - * @author congtaowang - * @since 2020-01-03 - *

    - * 刷新回调 - */ -public interface V2XRefreshCallback { - - void onSuccess(T result); - - void onFail(String msg); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java deleted file mode 100644 index b3a6e47073..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java +++ /dev/null @@ -1,745 +0,0 @@ -package com.mogo.module.v2x.network; - -import android.content.Context; -import android.content.Intent; -import android.text.TextUtils; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.network.ParamsProvider; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.map.search.geo.IMogoGeoSearchListener; -import com.mogo.map.search.geo.MogoRegeocodeResult; -import com.mogo.module.common.entity.MarkerResponse; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRecommendRouteEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.service.ServiceConst; -import com.mogo.module.service.network.RefreshBody; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes; -import com.mogo.module.v2x.entity.net.V2XLiveCarBroadcastReq; -import com.mogo.module.v2x.entity.net.V2XLiveCarRes; -import com.mogo.module.v2x.entity.net.V2XLiveCrossRoad; -import com.mogo.module.v2x.entity.net.V2XLivePushVoRes; -import com.mogo.module.v2x.entity.net.V2XRoadDataRes; -import com.mogo.module.v2x.entity.net.V2XSeekHelpRes; -import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; -import com.mogo.module.v2x.entity.net.V2XUserInfoRes; -import com.mogo.module.v2x.utils.LocationUtils; - -import java.util.Map; - -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.schedulers.Schedulers; -import okhttp3.RequestBody; - -import static com.mogo.module.v2x.V2XServiceManager.getContext; - - -/** - * 数据接口API - * - * @author donghongyu - * @since 2020-01-03 - */ -public class V2XRefreshModel { - - private Context mContext; - private V2XApiService mV2XApiService; - private static V2XRefreshModel mV2XRefreshModel; - - private V2XRefreshModel() { - } - - public synchronized static V2XRefreshModel getInstance(Context context) { - if (mV2XRefreshModel == null) { - synchronized (V2XRefreshModel.class) { - if (mV2XRefreshModel == null) { - mV2XRefreshModel = new V2XRefreshModel(); - mV2XRefreshModel.init(context); - } - } - } - return mV2XRefreshModel; - } - - private void init(Context context) { - this.mContext = context; -// IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context); -// this.mV2XApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost()); - } - - /** - * 已经由 - * @see com.mogo.module.v2x.V2XMarkerService - * 短链代替 - * 刷新地图点数据,同步获取 - */ - public void querySnapshotAsync(MogoLatLng latLng, int radius, int limit) { - final Map query = new ParamsProvider.Builder(mContext).build(); - final RefreshBody refreshBody = new RefreshBody(); - refreshBody.limit = limit; - refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon); - refreshBody.radius = radius; - refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION); - refreshBody.viewPush = true; - query.put("data", GsonUtil.jsonFromObject(refreshBody)); - V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).querySnapshotAsync(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - } - }); - } - - /** - * 刷新地图点数据,同步获取 - */ - public void querySnapshotSync(MogoLatLng latLng, int radius, int limit, final V2XRefreshCallback callback) { - final Map query = new ParamsProvider.Builder(mContext).build(); - final RefreshBody refreshBody = new RefreshBody(); - refreshBody.limit = limit; - refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lon); - refreshBody.radius = radius; - refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION); - refreshBody.viewPush = true; - query.put("data", GsonUtil.jsonFromObject(refreshBody)); - V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).querySnapshotSync(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(MarkerResponse o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - callback.onFail(message); - } - } - }); - } - - /** - * 触发刷新直播心跳 - * - * @param sn 目标车机SN - * @param videoChannel 直播的频道 - * @param callback 回调 - */ - public void refreshHeartBeat(String sn, String videoChannel, final V2XRefreshCallback callback) { - final Map liveBroadcast = new ParamsProvider.Builder(mContext).build(); - liveBroadcast.put("sn", sn); - liveBroadcast.put("data", GsonUtil.getGson().toJson(new V2XLiveCarBroadcastReq(sn, videoChannel))); - V2XApiServiceFactory.getDataApiService(mContext).refreshHeartBeat(liveBroadcast) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - - /** - * 直播点赞👍 - * - * @param callback 回调 - */ - public void giveLikeLiveVideo(final V2XRefreshCallback callback, String snStr) { - Logger.d(V2XConst.MODULE_NAME, "点赞车机:" + snStr); - final Map query = new ParamsProvider.Builder(mContext).build(); - query.put("data", "{\"sn\":" + snStr + "}"); - V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).giveLikeLiveVideo(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 获取用户信息 - * - * @param sn 目标车机SN - */ - public void queryUserInfoBySn(String sn, final V2XRefreshCallback callback) { - RequestBody body = RequestBody.create( - okhttp3.MediaType.parse("application/json; charset=utf-8"), - "{\"sn\":\"" + sn + "\"}"); - - V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryUserInfoBySn(body) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XUserInfoRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 根据经纬度查询附近可直播车机直播信息 - * - * @param callback 回调 - */ - public void queryNearbyVehicleLiveByLocation( - V2XRefreshCallback callback, double lon, double lat) { - final Map query = new ParamsProvider.Builder(mContext).build(); - - StringBuffer dataStr = new StringBuffer(); - dataStr.append("{"); - dataStr.append("\"lon\":"); - dataStr.append(lon); - dataStr.append(","); - dataStr.append("\"lat\":"); - dataStr.append(lat); - dataStr.append(","); - dataStr.append("\"radius\":"); - dataStr.append(0.5); - dataStr.append(","); - dataStr.append("\"size\":"); - dataStr.append(5); - dataStr.append("}"); - - query.put("data", dataStr.toString()); - V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryNearbyVehicleLiveByLocation(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XLiveCarRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 推流与停止推流接口 - * - * @param callback 回调 - */ - public void livePush(V2XRefreshCallback callback, String sn, int playType) { - final Map query = new ParamsProvider.Builder(mContext).build(); - query.put("data", "{" + - "\"eventId\": \"yycp\"," + - "\"sn\": \"" + sn + "\"," + - "\"type\": \"" + playType + "\"," + - "\"videoChannel\": \"C_1\"" + - "}"); - V2XApiServiceFactory.getDataApiService(mContext).livePush(query) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XLivePushVoRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 取消求助 - * - * @param callback - */ - public void cancelHelpSignal(V2XRefreshCallback callback) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = new StringBuilder() - .append("{") - .append("\"sn\":").append(MoGoAiCloudClientConfig.getInstance().getSn()) - .append(",") - .append("\"vehicleType\":") - .append(0) - .append("}").toString(); - map.put("data", json); - V2XApiServiceFactory.getRealtimeLocationApiService(mContext).sendHelpSignal(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 查询当前车辆故障求助状态 - * - * @param callback - */ - public void getHelpSignal(V2XRefreshCallback callback) { - final Map map = new ParamsProvider.Builder(mContext).build(); - map.put("sn", MoGoAiCloudClientConfig.getInstance().getSn()); - V2XApiServiceFactory.getRealtimeLocationApiService(mContext).queryHelpSignal(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XSeekHelpRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * TODO 演示需求 - * - * @param callback - */ - public void getMockUserInfos(V2XRefreshCallback callback) { - V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).getMockUserInfos().subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XDemoUserInfoRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 根据名称获取策略详情 - */ - public void getStrategyPush(V2XRefreshCallback callback) { - V2XApiServiceFactory.getStrategyPushApiService(mContext).getStrategyPush().subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XStrategyPushRes o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 违章地段查询接口 - */ - public void queryIllegalPark(V2XRefreshCallback callback, double lon, double lat) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = "{\"location\":{\"lat\":" + lat + ",\"lon\":" + lon + "},\"radius\":50}"; -// String json = "{\"location\":{\"lat\":39.968139,\"lon\":116.380476},\"radius\":1000}"; - map.put("data", json); - V2XApiServiceFactory.getLauncherSnapshotApiService(mContext).queryIllegalPark(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(MarkerResponse o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 点赞接口 - */ - public void addPoiInfoFabulous(V2XRefreshCallback callback, - String infoId, - String poiType, - int likeOrDislike) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = new StringBuilder() - .append("{") - .append("\"infoId\":").append(infoId) - .append(",") - .append("\"poiType\":").append(poiType) - .append(",") - .append("\"likeOrdislike\":").append(likeOrDislike) - .append(",") - .append("\"sn\":").append(MoGoAiCloudClientConfig.getInstance().getSn()) - .append("}").toString(); - map.put("data", json); - V2XApiServiceFactory.getDevaApiService(mContext).addPoiInfoFabulous(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - /** - * 响应求助 - * "seekHelpSn":"testSn01",求助SN - * "enthusiasticSn":"testSn02",响应求助SN - */ - public void respondingToHelp(String seekHelpSn) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = new StringBuilder() - .append("{") - .append("\"seekHelpSn\":").append(seekHelpSn) - .append(",") - .append("\"enthusiasticSn\":").append(MoGoAiCloudClientConfig.getInstance().getSn()) - .append("}").toString(); - map.put("data", json); - V2XApiServiceFactory.getDevaApiService(mContext).respondingToHelp(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - } - }); - } - - /** - * 道路事件UGC - * 需求地址 - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 - * {"id":"","status":1,"markUser":"name","sn":"111111","helpId":"222"} - */ - public void manualMarkingTrafficJam(String id, - int status, - String helpId) { - final Map map = new ParamsProvider.Builder(mContext).build(); - String json = "{" + "\"id\":\"" + id + "\"," + "\"sn\":\"" + MoGoAiCloudClientConfig.getInstance().getSn() + "\"," + "\"status\":" + status + "," + "\"helpId\":\"" + helpId + "\"}"; - map.put("data", json); - V2XApiServiceFactory.getDevaApiService(mContext).manualMarkingTrafficJam(map).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - } - }); - } - - public void queryCrossRoadsLive(V2XRefreshCallback callback) { - final Map map = new ParamsProvider.Builder(mContext).build(); - MogoLocation lastKnowLocation = V2XServiceManager.getMapService().getSingletonLocationClient(AbsMogoApplication.getApp()).getLastKnowLocation(); - double lat = lastKnowLocation.getLatitude(); - double lon = lastKnowLocation.getLongitude(); - String tmpLat = String.valueOf(lat); - String tmpLon = String.valueOf(lon); - float bearing = lastKnowLocation.getBearing(); - String json = "{\"lat\":" + tmpLat + ",\"lon\":" + tmpLon + ",\"direction\":" + bearing + "}"; - map.put("sn", MoGoAiCloudClientConfig.getInstance().getSn()); - map.put("data", json); - V2XApiServiceFactory.getGeoFenceCarServiceApiService(mContext).queryCrossRoadsLive(map) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(V2XLiveCrossRoad o) { - super.onSuccess(o); - if (callback != null) { - callback.onSuccess(o); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - if (TextUtils.isEmpty(message)) { - message = "网络错误,请稍后重试"; - } - callback.onFail(message); - } - } - }); - } - - - public void queryRoadData(String sn) { - Logger.d("V2XRefreshModel:", "sn:" + sn); - if (mV2XApiService != null) { - Map map = new ParamsProvider.Builder(mContext).build(); - map.put("sn", sn); - mV2XApiService.queryRoadDataOfVehiclesRecommend(map) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - - @Override - public void onNext(V2XRoadDataRes v2XRoadDataRes) { - super.onNext(v2XRoadDataRes); - if (v2XRoadDataRes == null - || v2XRoadDataRes.getResult() == null - || v2XRoadDataRes.getResult().getTopPoint() == null - || v2XRoadDataRes.getResult().getTopPoint().isEmpty()) { - Logger.d("V2XRefreshModel:", "接口没有数据"); - return; - } - Logger.d("V2XRefreshModel:", v2XRoadDataRes.getResult().getTopPoint().toString()); - MogoLocation mogoLocation = new MogoLocation(); - mogoLocation.setLongitude(v2XRoadDataRes.getResult().getTopPoint().get(0)); - mogoLocation.setLatitude(v2XRoadDataRes.getResult().getTopPoint().get(1)); - LocationUtils.geoCodeSearch(mogoLocation, new IMogoGeoSearchListener() { - @Override - public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { - if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null) { - Logger.d("V2XRefreshModel:", "返回地址为空"); - return; - } - Logger.d("V2XRefreshModel:", regeocodeResult.getRegeocodeAddress().toString()); - try { - String province = regeocodeResult.getRegeocodeAddress().getProvince(); - String city = regeocodeResult.getRegeocodeAddress().getCity(); - v2XRoadDataRes.getResult().setFormatAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress().replaceAll(province, "").replaceAll(city, "")); - sendBroadcast(v2XRoadDataRes); - } catch (Exception e) { - Logger.d("V2XRefreshModel:", "异常:" + e); - } - - } - }); - } - - @Override - public void onError(Throwable e) { - super.onError(e); - Logger.d("V2XRefreshModel:", "接口异常:" + e); - } - }); - } - } - - private void sendBroadcast(V2XRoadDataRes v2XRoadDataRes) { - boolean isSendRecommendRoute = false; - if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) { - for (V2XRoadDataRes.ResultDTO.PoiDataDTO poiDataDTO : v2XRoadDataRes.getResult().getPoiData()) { - if (!EventTypeEnum.FOURS_LIVING.getPoiType().equals(poiDataDTO.getPoiType())) { - isSendRecommendRoute = true; - break; - } - } - } - if (isSendRecommendRoute) { - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE); - // 设置数据 - v2xMessageEntity.setContent(new V2XRecommendRouteEntity(v2XRoadDataRes.getResult().getTopPoint(), v2XRoadDataRes.getResult().getFormatAddress())); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); - LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent); - } - - if (!isSendRecommendRoute && v2XRoadDataRes.getResult().getIllegalParkingData() != null && v2XRoadDataRes.getResult().getIllegalParkingData().size() > 0) { - try { - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING); - // 设置数据 - V2XRoadDataRes.ResultDTO.IllegalParkingDataDTO parkingDataDTO = v2XRoadDataRes.getResult().getIllegalParkingData().get(0); - V2XPushMessageEntity pushMessageEntity = new V2XPushMessageEntity(); - pushMessageEntity.setAddress(parkingDataDTO.getAddr()); - pushMessageEntity.setAlarmContent("停车场推荐"); - pushMessageEntity.setLat(parkingDataDTO.getLat()); - pushMessageEntity.setLon(parkingDataDTO.getLon()); - String tts = "主人,我发现" + v2XRoadDataRes.getResult().getFormatAddress() + "停车容易违章,推荐你导航到附近停车场,开始导航吗?"; - AIAssist.getInstance(getContext()).speakTTSVoice(tts); - pushMessageEntity.setExpireTime(20000); - // 控制展示状态 - v2XMessageEntity.setContent(pushMessageEntity); - v2XMessageEntity.setShowState(true); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent); - } catch (Exception e) { - e.printStackTrace(); - } - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java deleted file mode 100644 index bcdb708835..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.mogo.module.v2x.network; - -import android.content.Context; - -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.commons.network.ParamsProvider; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.network.utils.GsonUtil; - - -import java.util.HashMap; -import java.util.Map; - -import io.reactivex.Observable; -import io.reactivex.ObservableEmitter; -import io.reactivex.ObservableOnSubscribe; -import io.reactivex.ObservableSource; -import io.reactivex.Observer; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; -import io.reactivex.functions.Function; -import io.reactivex.schedulers.Schedulers; - -public class V2XShareNetworkModel { - private static final String TAG = "V2XShareNetworkModel"; - private final Context mContext; - - public V2XShareNetworkModel(Context context) { - this.mContext = context; - } - - /** - * 两个任务串行 - * 1.分享次数,热心指数 - * 2.分享列表 - */ - public void getShareEventResponse(int page, int size, V2XRefreshCallback callback) { - - Observable indexObservable = Observable.create(new ObservableOnSubscribe() { - - @Override - public void subscribe(ObservableEmitter emitter) throws Exception { - emitter.onNext("1"); - emitter.onComplete(); - } - }); - - Observable listObservable = Observable.create(new ObservableOnSubscribe() { - @Override - public void subscribe(ObservableEmitter emitter) throws Exception { - emitter.onNext("2"); - emitter.onComplete(); - } - }); - indexObservable.flatMap(new Function>() { - @Override - public ObservableSource apply(String s) throws Exception { - return listObservable; - } - }) - .observeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Observer() { - - @Override - public void onSubscribe(Disposable d) { - try { - getShareIndex(callback); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onNext(Object o) { - try { - getShareEventList(page, size, callback); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onError(Throwable e) { - - } - - @Override - public void onComplete() { - - } - }); - } - - /** - * 热心指数 - */ - public void getShareIndex(V2XRefreshCallback callback) { - final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext); - HashMap hashMap = new HashMap<>(); - hashMap.put("sn", MoGoAiCloudClientConfig.getInstance().getSn()); - builder.append("data", GsonUtil.jsonFromObject(hashMap)); - Map parameters = builder.build(); - //热心指数 - V2XApiServiceFactory.getDevaApiService(mContext).getEnthusiasmIndex(parameters) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create((mContext))) { - @Override - public void onSuccess(BaseData resultData) { - super.onSuccess(resultData); - if (callback != null) { - callback.onSuccess(resultData); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - callback.onFail(message); - } - } - - @Override - public void onError(Throwable e) { - super.onError(e); - if (callback != null) { - callback.onFail("网络异常,点击刷新重试"); - } - } - }); - - } - - /** - * 分享列表 - */ - public void getShareEventList(int page, int size, V2XRefreshCallback callback) { - - final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext); - HashMap hashMap = new HashMap<>(); - hashMap.put("sn", MoGoAiCloudClientConfig.getInstance().getSn()); - hashMap.put("pageNum", page); - hashMap.put("pageSize", size); - builder.append("data", GsonUtil.jsonFromObject(hashMap)); - Map parameters = builder.build(); - - V2XApiServiceFactory.getDevaApiService(mContext).getShareEventList(parameters) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) { - @Override - public void onSuccess(BaseData resultData) { - super.onSuccess(resultData); - if (callback != null) { - callback.onSuccess(resultData); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - if (callback != null) { - callback.onFail(message); - } - } - - @Override - public void onError(Throwable e) { - super.onError(e); - if (callback != null) { - callback.onFail("网络异常,点击刷新重试"); - } - } - }); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/CarLocationObserver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/CarLocationObserver.java deleted file mode 100644 index d1e2b01677..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/CarLocationObserver.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.module.v2x.observer; - -import com.mogo.eagle.core.data.map.MogoLocation; - -/** - * @author donghongyu - * @date 4/9/21 2:14 PM - * 当前车辆位置观察者接口 - */ -public abstract class CarLocationObserver { - // 更新状态 - public abstract void update(MogoLocation carLocation); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/CarLocationSubject.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/CarLocationSubject.java deleted file mode 100644 index 994c4c02c8..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/CarLocationSubject.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.mogo.module.v2x.observer; - -import com.mogo.eagle.core.data.map.MogoLocation; - -import java.util.HashMap; -import java.util.Set; - -/** - * @author donghongyu - * @date 4/9/21 2:12 PM - * 当前车辆订阅 - */ -public class CarLocationSubject { - - private static CarLocationSubject mCarLocationSubject; - // 车辆位置 - public MogoLocation carLocation; - // 观察者集合 - private HashMap mObservers = new HashMap<>(); - - - private CarLocationSubject() { - } - - public static CarLocationSubject getInstance() { - if (mCarLocationSubject == null) { - synchronized (CarLocationSubject.class) { - if (mCarLocationSubject == null) { - mCarLocationSubject = new CarLocationSubject(); - } - } - } - return mCarLocationSubject; - } - - /** - * 设置新的车辆位置 - * - * @param carLocation 车辆位置 - */ - public void setCarLocation(MogoLocation carLocation) { - this.carLocation = carLocation; - notifyAllObservers(); - } - - /** - * 添加观察者 - * - * @param observerType 观察者类型 - * @param observer 新的观察者 - */ - public void registerObserver(String observerType, CarLocationObserver observer) { - mObservers.put(observerType, observer); - } - - /** - * 移除指定类型的观察者 - * - * @param observerType 观察者类型 - */ - public void removeObserver(String observerType) { - mObservers.remove(observerType); - } - - /** - * 通知所有观察者更新 - */ - private void notifyAllObservers() { - Set keySet = mObservers.keySet(); - for (String s : keySet) { - CarLocationObserver observer = mObservers.get(s); - if (observer != null) { - observer.update(carLocation); - } - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/V2XOptimalRouteObserver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/V2XOptimalRouteObserver.java deleted file mode 100644 index f3001c2817..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/observer/V2XOptimalRouteObserver.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.mogo.module.v2x.observer; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.module.v2x.overlay.V2XOptimalRouteOverlay; - -import java.util.List; - -/** - * @author donghongyu - * @date 4/9/21 2:38 PM - * 最优路线推荐 - */ -public class V2XOptimalRouteObserver extends CarLocationObserver { - public static String TYPE = "V2XOptimalRouteObserver"; - - private static V2XOptimalRouteObserver v2XOptimalRouteObserver; - //最优路线覆盖物绘制 - private V2XOptimalRouteOverlay mV2XOptimalRouteOverlay; - // 要绘制的数据 - private List polylinePoint; - - public static V2XOptimalRouteObserver getInstance() { - if (v2XOptimalRouteObserver == null) { - synchronized (V2XOptimalRouteObserver.class) { - if (v2XOptimalRouteObserver == null) { - v2XOptimalRouteObserver = new V2XOptimalRouteObserver(); - } - } - } - return v2XOptimalRouteObserver; - } - - private V2XOptimalRouteObserver() { - mV2XOptimalRouteOverlay = new V2XOptimalRouteOverlay(); - } - - /** - * 设置推荐路线 - * - * @param polylinePoint 推荐的路线 - */ - public void setPolylinePoint(List polylinePoint) { - this.polylinePoint = polylinePoint; - } - - @Override - public void update(MogoLocation carLocation) { - mV2XOptimalRouteOverlay.draw(carLocation, polylinePoint); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/overlay/V2XOptimalRouteOverlay.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/overlay/V2XOptimalRouteOverlay.java deleted file mode 100644 index 6588f9b294..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/overlay/V2XOptimalRouteOverlay.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.mogo.module.v2x.overlay; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.utilcode.util.ColorUtils; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.overlay.MogoPolylineOptions; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.utils.LocationUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * 最优路线推荐的图覆盖物 - * - * @author donghongyu - * @date 4/8/21 6:06 PM - */ -public class V2XOptimalRouteOverlay { - private IMogoPolyline mMoGoPolyline; - // 连接线参数 - private MogoPolylineOptions mPolylineOptions; - // 线路径集合 - private List mPolylinePointList; - // 渐变色 - private List mPolylineColors; - - public V2XOptimalRouteOverlay() { - mPolylineOptions = new MogoPolylineOptions(); - // 绘制路径集合 - mPolylinePointList = new ArrayList<>(); - // 引导线颜色 - mPolylineColors = new ArrayList<>(); - } - - /** - * 绘制最优路线 - * - * @param polylinePoint 要绘制的经纬度度集合 - */ - public IMogoPolyline draw(MogoLocation carLocal, List polylinePoint) { - if (mMoGoPolyline != null) { - mMoGoPolyline.remove(); - mPolylinePointList.clear(); - mPolylineColors.clear(); - } - if (polylinePoint != null) { - - // 将当前车辆位置放进去 - mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude())); - // 过滤后台推送的推荐路线集合 - for (MogoLatLng polyline : polylinePoint) { - //需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃 - if (LocationUtils.isPointOnCarFront(carLocal, polyline)) { - mPolylinePointList.add(polyline); - } - } - - mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size())); - - // 替换路径集合 - mPolylineOptions.points(mPolylinePointList); - // 线条粗细,渐变,渐变色值 - mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors); - // 绘制线 - mMoGoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(mPolylineOptions); - } - return mMoGoPolyline; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/EventPanelPresenter.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/EventPanelPresenter.kt deleted file mode 100644 index 4c19739b87..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/EventPanelPresenter.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.mogo.module.v2x.presenter - -import com.mogo.commons.mvp.Presenter -import com.mogo.module.v2x.fragment.V2XEventPanelFragment - -/** - * 事件面板presenter - * - * @author tongchenfei - */ -class EventPanelPresenter(view: V2XEventPanelFragment) : Presenter(view) \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ScenarioHistoryPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ScenarioHistoryPresenter.java deleted file mode 100644 index 74504b5d83..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ScenarioHistoryPresenter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.module.v2x.presenter; - - -import com.mogo.commons.mvp.Presenter; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.v2x.fragment.V2XScenarioHistoryFragment; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; - -import java.util.List; - -/** - * @author donghongyu - */ -public class ScenarioHistoryPresenter extends Presenter { - - public ScenarioHistoryPresenter(V2XScenarioHistoryFragment view) { - super(view); - } - - public void loadHistory() { - WorkThreadHandler.getInstance().post(() -> { - List v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData(); - mView.loadHistory(v2XHistoryScenarioData); - }); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ShareEventsPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ShareEventsPresenter.java deleted file mode 100644 index 8b43bebbb0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ShareEventsPresenter.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mogo.module.v2x.presenter; - -import com.mogo.commons.mvp.IView; -import com.mogo.commons.mvp.Presenter; -import com.mogo.module.v2x.fragment.V2XShareEventsFragment; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; - -public class ShareEventsPresenter extends Presenter { - - public ShareEventsPresenter(IView view) { super((V2XShareEventsFragment) view); } - - public void loadShareEventList() { - WorkThreadHandler.getInstance().post(() -> { - mView.getShareEventResponse(); - }); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java deleted file mode 100644 index 1061135030..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.mogo.module.v2x.presenter; - -import android.content.Context; - -import androidx.annotation.NonNull; -import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.LifecycleOwner; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.commons.mvp.Presenter; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.entity.panel.Center; -import com.mogo.module.v2x.entity.panel.SurroundingRequest; -import com.mogo.module.v2x.entity.panel.SurroundingResponse; -import com.mogo.module.v2x.network.V2XApiServiceFactory; -import com.mogo.module.v2x.view.SurroundingEventView; -import com.mogo.service.IMogoServiceApis; -import com.mogo.eagle.core.data.constants.MogoServicePaths; -import com.mogo.service.network.IMogoNetwork; - -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.schedulers.Schedulers; -import okhttp3.RequestBody; - -/** - * @author lixiaopeng - * @description - * @since 2020/7/29 - */ -public class SurroundingEventPresenter extends Presenter { - private Context mContext; - private IMogoNetwork mNetWork; - private IMogoServiceApis mApis; - private static final String TAG = "V2XSurroundingFragment"; - - - public SurroundingEventPresenter(Context context, SurroundingEventView view) { - super(view); - mContext = context; - mNetWork = - ((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi(); - mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext()); - } - - @Override - public void onCreate(@NonNull LifecycleOwner owner) { - super.onCreate(owner); - } - - public void getSurroundingEventData() { - MogoLocation location = mApis.getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation(); - if (location == null) { - return; - } - Center center = new Center(location.getLatitude(), location.getLongitude()); - String[] poiTypes = {"10002", "10003", "10006", "10007", "10008", "10010", "10011", "10013", "10015"}; - SurroundingRequest request = new SurroundingRequest(center, poiTypes, 5, 300); - - V2XApiServiceFactory.getDevaApiService(mContext).getSurroundingEventList(MoGoAiCloudClientConfig.getInstance().getSn(), convert(GsonUtil.jsonFromObject(request))) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { - @Override - public void onError(Throwable e) { - super.onError(e); - mView.showSurroudingData(null); - Logger.e(TAG, "onError e = " + e); - e.printStackTrace(); - } - - @Override - public void onSuccess(SurroundingResponse data) { - super.onSuccess(data); - Logger.d(TAG, "onSuccess ------> "); - if (data != null && data.getResult() != null) { - mView.showSurroudingData(data.getResult().getExploreWay()); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - mView.showSurroudingData(null); - Logger.e(TAG, "onError message = " + message + " >>> code = " + code); - } - }); - - } - - - public static RequestBody convert(String json) { -// String json = GsonUtil.getGson().toJson( map ); - Logger.d(TAG, "request params: %s", json); - RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json); - return requestBody; - } - - @Override - public void onDestroy(@NonNull LifecycleOwner owner) { - super.onDestroy(owner); - } - - @Override - public void onLifecycleChanged(@NonNull LifecycleOwner owner, @NonNull Lifecycle.Event event) { - super.onLifecycleChanged(owner, event); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java deleted file mode 100644 index ec0b88581e..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mogo.module.v2x.receiver; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; - -/** - * 场景广播接收,道路预警、后台下发、违章停车、故障求助、疲劳驾驶 - * - * @author donghongyu - */ -public class SceneBroadcastReceiver extends BroadcastReceiver { - - private static final String TAG = V2XConst.MODULE_NAME + "_SceneBroadcastReceiver"; - - @Override - public void onReceive(Context context, Intent intent) { - try { - V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY); - //Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/TestPanelBroadcastReceiver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/TestPanelBroadcastReceiver.java deleted file mode 100644 index 175b87fea2..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/TestPanelBroadcastReceiver.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.mogo.module.v2x.receiver; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.function.call.map.CallerSmpManager; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes; -import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz; -import com.mogo.module.v2x.utils.TestOnLineCarUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.zhidao.carchattingprovider.MogoDriverInfo; - -import java.util.List; - -import static android.text.style.TtsSpan.GENDER_MALE; -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * V2X 测试面板广播接收,目的是可以通过广播调用起来面板 - * - * @author donghongyu - */ -public class TestPanelBroadcastReceiver extends BroadcastReceiver { - private static final String TAG = V2XConst.MODULE_NAME + "_TestPanelBroadcastReceiver"; - - private Context mContext; - - @Override - public void onReceive(Context context, Intent intent) { - try { - this.mContext = context; - int sceneType = intent.getIntExtra(V2XConst.BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0); - Logger.d(TAG, "textPanelOpenType:" + sceneType); - - // 分发场景 - dispatchSceneTest(sceneType); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - /** - * 分发处理场景 - * - * @param sceneType 场景类型 - */ - private void dispatchSceneTest(int sceneType) { - Logger.d(TAG, "sceneType=" + sceneType); - if (sceneType == 0) {//打开用户信息 - MogoDriverInfo mogoDriverInfo = new MogoDriverInfo(); - mogoDriverInfo.setAge(24); - mogoDriverInfo.setGender(GENDER_MALE); - mogoDriverInfo.setSn("12345678"); - mogoDriverInfo.setUserName("测试"); - mogoDriverInfo.setUserHead("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600872867592&di=994e371880ca6ae2814f553e0d0e4139&imgtype=0&src=http%3A%2F%2Fp3.ssl.cdn.btime.com%2Ft014c5d8a1e5cef12ba.jpg%3Fsize%3D506x543"); - if (V2XServiceManager.getCarsChattingProvider() != null) { - V2XServiceManager.getCarsChattingProvider().showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, mContext); - } - } else if (sceneType == 1) {// 触发道路事件 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioRoadEventData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - - // 存储本地,出行动态作展示 - saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING, - v2XMessageEntity.getContent().getNoveltyInfo()); - } else if (sceneType == 3) {//触发H5推送事件 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioPushEventData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 4) {//触发H5推送直播事件 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioPushLiveEventData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 5) {//H5推送触发V2X动画 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioAnimationEventData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 6) {//查看前车直播 - V2XVoiceCallLiveBiz.getInstance().getFrontCarLive(); - } else if (sceneType == 7) {//查看前方路口直播 - V2XVoiceCallLiveBiz.getInstance().getOpenRoadCameraLive(); - } else if (sceneType == 8) {//触发疲劳驾驶 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioFatigueDrivingData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 9) {//触发他人发起道路求助事件 - V2XMessageEntity> v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioSeekHelpData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 10) {//触发事件UGC - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioRoadEventUGCData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 11) {//触发违章停车事件 - V2XMessageEntity> v2XMessageEntity = - TestOnLineCarUtils.getV2XIllegalParkData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 12) {//车路云场景预警-右侧 - V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("right"); - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 13) {//车路云场景预警-左侧 - V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("left"); - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 14) {//行人预警,行人路线预测 车路云预警-前方行人 - V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("pedestrians"); - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 15) {// 交通状况查询 - V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus(); - } else if (sceneType == 16) {//触发基于目的地预测的线路推荐 - V2XServiceManager.getV2XRefreshModel().queryRoadData("F803EB2046PZD00149"); - } else if (sceneType == 17) {//最优路线推荐 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XOptimalRoute(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - } else if (sceneType == 18) {// 自车求助 - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioCarForHelpEventData(); - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); - V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, true); - } else if (sceneType == 20) {// 小地图绘制线 - List coordinates = TestOnLineCarUtils.getTestCoordinates(); - CallerSmpManager.drawablePolyline(coordinates); - } else if (sceneType == 21) {// 小地图清除绘制线 - CallerSmpManager.clearPolyline(); - } - } - - - /** - * 存储本地数据 - * - * @param v2XRoadEventEntity 要存储的场景 - */ - public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) { - try { - V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/IV2XScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/IV2XScenario.java deleted file mode 100644 index 89e4de77fc..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/IV2XScenario.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.mogo.module.v2x.scenario; - -import com.mogo.commons.voice.IMogoVoiceCmdCallBack; -import com.mogo.module.common.entity.V2XMessageEntity; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 4:13 PM - * desc : V2X安全驾驶场景接口 - * version: 1.0 - */ -public interface IV2XScenario { - - /** - * 展示场景 - */ - void show(); - - /** - * 关闭场景 - */ - void close(); - - /** - * 展示Window - */ - void showWindow(); - - /** - * 关闭Window - */ - void closeWindow(); - - /** - * 展示按钮 - */ - void showButton(); - - /** - * 关闭按钮 - */ - void closeButton(); - - /** - * 绘制POI - */ - void drawPOI(); - - /** - * 清除POI - */ - void clearPOI(); - - /** - * 是否是相同的场景,如果是说明重复的场景,需要根据场景进行不同的处理 - * - * @param v2XMessageEntity 要比较的场景 - * @return true-相同的场景,false-不同场景 - */ - boolean isSameScenario(V2XMessageEntity v2XMessageEntity); - - /** - * 调用小智语音播放TTS - * - * @param msg 消息 - * @param callBack 播放回调 - */ - void speakTTSVoice(String msg, IMogoVoiceCmdCallBack callBack); - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/IV2XScenarioManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/IV2XScenarioManager.java deleted file mode 100644 index 2a061a4fca..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/IV2XScenarioManager.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.scenario; - -import com.mogo.module.common.entity.V2XMessageEntity; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 3:47 PM - * desc : V2X安全驾驶场景管理 - * version: 1.0 - */ -public interface IV2XScenarioManager { - void handlerMessage(V2XMessageEntity v2XMessageEntity); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/AbsV2XScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/AbsV2XScenario.java deleted file mode 100644 index 66dd90bf6f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/AbsV2XScenario.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.mogo.module.v2x.scenario.impl; - -import android.text.TextUtils; - -import androidx.annotation.Nullable; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.commons.voice.IMogoVoiceCmdCallBack; -import com.mogo.commons.voice.VoicePreemptType; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.scenario.IV2XScenario; -import com.mogo.module.v2x.scenario.view.IV2XButton; -import com.mogo.module.v2x.scenario.view.IV2XMarker; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:01 PM - * desc : - * version: 1.0 - */ -public abstract class AbsV2XScenario implements IV2XScenario { - protected String TAG = "AbsV2XScenario"; - private IV2XWindow mV2XWindow; - private IV2XButton mV2XButton; - private IV2XMarker mV2XMarker; - private V2XMessageEntity mV2XMessageEntity; - - protected AbsV2XScenario() { - } - - public abstract void init(@Nullable V2XMessageEntity v2XMessageEntity); - - @Override - public void close() { - closeButton(); - closeWindow(); - clearPOI(); - } - - /** - * 释放资源 - */ - public void release() { - mV2XMessageEntity = null; - mV2XWindow = null; - mV2XButton = null; - mV2XMarker = null; - } - - @Override - public void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) { - if (!TextUtils.isEmpty(msg)) { - Logger.d(TAG, "调用TTS播放语音:" + msg); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice(msg, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack); - } - } - - public IV2XWindow getV2XWindow() { - return mV2XWindow; - } - - public void setV2XWindow(@Nullable IV2XWindow mV2XWindow) { - this.mV2XWindow = mV2XWindow; - } - - public IV2XMarker getV2XMarker() { - return mV2XMarker; - } - - public IV2XButton getV2XButton() { - return mV2XButton; - } - - public void setV2XButton(@Nullable IV2XButton mV2XButton) { - this.mV2XButton = mV2XButton; - } - - public void setV2XMarker(@Nullable IV2XMarker mV2XMarker) { - this.mV2XMarker = mV2XMarker; - } - - public void setV2XMessageEntity(@Nullable V2XMessageEntity mV2XMessageEntity) { - this.mV2XMessageEntity = mV2XMessageEntity; - } - - public V2XMessageEntity getV2XMessageEntity() { - return mV2XMessageEntity; - } - - @Override - public boolean isSameScenario(@Nullable V2XMessageEntity v2XMessageEntity) { - if (mV2XMessageEntity == null) { - return false; - } - return mV2XMessageEntity.equals(v2XMessageEntity); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java deleted file mode 100644 index 9a0e30ce2a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.mogo.module.v2x.scenario.impl; - -import android.content.Intent; - -import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.uicontroller.VisualAngleMode; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.IV2XScenarioManager; -import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationScenario; -import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario; -import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario; -import com.mogo.module.v2x.scenario.scene.help.V2XCarForHelpScenario; -import com.mogo.module.v2x.scenario.scene.livecar.V2XPushLiveCarScenario; -import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveScenario; -import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario; -import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario; -import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario; -import com.mogo.module.v2x.scenario.scene.route.V2XOptimalRouteVREventScenario; -import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario; -import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario; -import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING; -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 4:22 PM - * desc : 场景管理的分发 - * version: 1.0 - */ -public class V2XScenarioManager implements IV2XScenarioManager { - private static V2XScenarioManager mV2XScenarioManager; - private AbsV2XScenario mV2XScenario = null; - - private V2XScenarioManager() { - } - - public static V2XScenarioManager getInstance() { - if (mV2XScenarioManager == null) { - synchronized (V2XScenarioManager.class) { - if (mV2XScenarioManager == null) { - mV2XScenarioManager = new V2XScenarioManager(); - } - } - } - return mV2XScenarioManager; - } - - - @Override - public void handlerMessage(V2XMessageEntity v2XMessageEntity) { - Logger.d(MODULE_NAME, "处理V2X场景:" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); - try { - synchronized (V2XScenarioManager.class) { - // 展示 - ThreadUtils.runOnUiThread(() -> { - // 提取之前存储的场景 - if (v2XMessageEntity != null) { - sceneChange(); - // 广播给应用内部其它模块 - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent); - // 如果没有拿到之前的,根据类型分发 - switch (v2XMessageEntity.getType()) { - case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING: - mV2XScenario = new V2XRoadEventScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING: - mV2XScenario = new V2XSeekHelpScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING: - case ALERT_RECOMMEND_PARKING: - mV2XScenario = new V2XFatigueDrivingScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING: - mV2XScenario = new V2XPushEventScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING: - mV2XScenario = new V2XPushLiveCarScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING: - mV2XScenario = new V2XAnimationScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP: - mV2XScenario = new V2XCarForHelpScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING: - mV2XScenario = new V2XIllegalParkScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING: - mV2XScenario = V2XServiceManager.getMoGoStatusManager().isVrMode() ? null : new V2XEventUgcScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW: - mV2XScenario = new V2XVoiceCallLiveScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE: - mV2XScenario = new V2XRecommendRouteScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW: - mV2XScenario = new V2XOptimalRouteVREventScenario(); - break; - case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS: - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - mV2XScenario = new V2XFrontWarningScenario(); - } else { - mV2XScenario = null; - } - break; - default: - mV2XScenario = null; - Logger.e(MODULE_NAME, "当前V2X消息类型未定义。"); - TipToast.tip("当前V2X消息类型未定义"); - return; - } - - // 展示最新的消息 - if (mV2XScenario != null) { - if (v2XMessageEntity.getType() != V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP) { - hidOtherPanel(); - } - mV2XScenario.init(v2XMessageEntity); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52833468 - * 道路事件触发后,切换到中景 - */ - private void sceneChange() { - if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController(). - getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) { - V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null); - } - } - - private void hidOtherPanel() { - try { - // 与其它面板互斥 - V2XServiceManager.getMogoOnlineCarListPanelProvider().hidePanel(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/V2XBasWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/V2XBasWindow.java deleted file mode 100644 index 92fd03c353..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/V2XBasWindow.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.mogo.module.v2x.scenario.scene; - -import android.content.Context; -import android.util.AttributeSet; -import android.util.Log; -import android.widget.RelativeLayout; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.service.v2x.IV2XWindowManagerListener; - -/** - * @author donghongyu - * @date 12/11/20 10:35 AM - */ -public class V2XBasWindow extends RelativeLayout implements IV2XWindowManagerListener { - private final String TAG = "V2XBasWindow"; - - public V2XBasWindow(Context context) { - super(context); - } - - public V2XBasWindow(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public V2XBasWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - Logger.w(TAG, "onAttachedToWindow……"); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - Logger.w(TAG, "onDetachedFromWindow……"); - release(); - } - - /** - * 这里释放资源 - */ - protected void release() { - Logger.w(TAG, "release……"); - } - - @Override - public void removeTipWindowByListener() { - Log.d(TAG, "removeAllTipWindow"); - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/animation/V2XAnimationScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/animation/V2XAnimationScenario.java deleted file mode 100644 index 31ad542d11..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/animation/V2XAnimationScenario.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.animation; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.utils.ADASUtils; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 场景动画的场景展示,目前这里仅在演示DEMO中使用 - * version: 1.0 - */ -public class V2XAnimationScenario extends AbsV2XScenario { - - public V2XAnimationScenario() { - setV2XWindow(new V2XAnimationWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - if (!isSameScenario(v2XMessageEntity) - && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - boolean isV2XAnimationShow = V2XServiceManager.getMoGoV2XStatusManager().isV2XAnimationShow(); - if (isV2XAnimationShow) { - close(); - } - setV2XMessageEntity(v2XMessageEntity); - show(); - } else { - setV2XMessageEntity(v2XMessageEntity); - Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化"); - } - } - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - getV2XWindow().setWindowStatusListener(new V2XWindowStatusListener() { - @Override - public void onViewShow() { - ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), getV2XMessageEntity().getContent()); - } - - @Override - public void onViewClose() { - closeWindow(); - clearPOI(); - } - }); - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager - .getIMogoWindowManager() - .addView(getV2XWindow().getView(), 0, 0, false); - V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, false); - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().show(); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - } - } - - @Override - public void clearPOI() { - setV2XMessageEntity(null); - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/animation/V2XAnimationWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/animation/V2XAnimationWindow.java deleted file mode 100644 index 6c61d514bc..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/animation/V2XAnimationWindow.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.animation; - -import android.content.Context; -import android.net.Uri; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; - -import androidx.constraintlayout.widget.ConstraintLayout; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.eagle.core.widget.TextureVideoView; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/24 11:34 AM - * desc : TODO 前瞻演示功能场景动画 - * version: 1.0 - */ -public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow { - // 弹窗状态监听 - private V2XWindowStatusListener mV2XWindowStatusListener; - private TextureVideoView vvCarAnimation; - - public V2XAnimationWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XAnimationWindow(Context context) { - this(context, null); - } - - public V2XAnimationWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XAnimationWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - public void initView(Context context) { - Logger.w(MODULE_NAME, "初始化场景动画View。。。。。"); - LayoutInflater.from(context).inflate(R.layout.window_animation, this); - vvCarAnimation = findViewById(R.id.vvCarAnimation); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XPushMessageEntity entity) { - Uri videoUri = null; - String tts = null; - switch (entity.getSceneId()) { - // 前车紧急制动告警 - case "100005": - videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_braking); - break; - // 十字路口碰撞预警 - case "100006": - videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_left_right_car); - tts = "注意路口车辆"; - break; - // 岔路口碰撞预警 - case "100007": - videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_cut_in_line); - break; - // 禁行车道预警 - case "100008": - videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_current_row_closed); - break; - // 应急车辆优先通行 - case "100012": - videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_lane); - break; - // 闯红灯预警 - case "100013": - videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_traffic_light_speed_cut); - break; - default: - Logger.e(MODULE_NAME, "未定义的类型:" + entity.getSceneId()); - } - String path = "https://v.youku.com/v_show/id_XNjAzNzI3MDA0.html"; - - if (videoUri != null) { -// vvCarAnimation.setVideoPath(path); - vvCarAnimation.setVideoURI(videoUri); - vvCarAnimation.setOnPreparedListener(mediaPlayer -> { - Logger.w(MODULE_NAME, "场景动画准备。。。。。"); - }); - vvCarAnimation.setOnCompletionListener(mediaPlayer -> { - Logger.w(MODULE_NAME, "动画播放结束..."); - if (mV2XWindowStatusListener != null) { - mV2XWindowStatusListener.onViewClose(); - } - }); - vvCarAnimation.start(); - Logger.w(MODULE_NAME, "开始播放动画。。。。。"); - if (mV2XWindowStatusListener != null) { - mV2XWindowStatusListener.onViewShow(); - } - } - if (tts != null) { - AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(tts); - } - } - - @Override - public void close() { - //移除窗体 - V2XServiceManager - .getIMogoWindowManager() - .removeView(this); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - if (vvCarAnimation != null) { - vvCarAnimation.stopPlayback(); - } - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - this.mV2XWindowStatusListener = listener; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt deleted file mode 100644 index 5552db310b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.destination - -import android.view.ViewGroup -import com.mogo.eagle.core.utilcode.util.Utils -import com.mogo.module.common.entity.V2XMessageEntity -import com.mogo.module.common.entity.V2XRecommendRouteEntity -import com.mogo.module.v2x.R -import com.mogo.module.v2x.V2XServiceManager -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario - -/** - * created by wujifei on 2020/12/29 17:57 - * describe:基于目的地预判的道路事件提醒、路线推荐 - */ -class V2XRecommendRouteScenario : AbsV2XScenario() { - - init { - v2XWindow = V2XRecommendRouteWindow() - } - - override fun init(v2XMessageEntity: V2XMessageEntity?) { - v2XMessageEntity?.content?.let { - if (v2XMessageEntity.isShowState) { - if (!isSameScenario(v2XMessageEntity)) { - setV2XMessageEntity(v2XMessageEntity) - show() - } else { - setV2XMessageEntity(v2XMessageEntity) - } - } else { - close() - } - } - } - - - override fun show() { - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume) { - showWindow() - } - } - - override fun showWindow() { - v2XWindow?.let { - val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - Utils.getApp().resources.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground).toInt()) - V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams) - it.show(v2XMessageEntity.content) - - } - } - - override fun closeWindow() { - v2XWindow?.let { - it.close() - } - } - - override fun showButton() { - TODO("Not yet implemented") - } - - override fun closeButton() { - TODO("Not yet implemented") - } - - override fun drawPOI() { - TODO("Not yet implemented") - } - - override fun clearPOI() { - TODO("Not yet implemented") - } - - -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteWindow.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteWindow.kt deleted file mode 100644 index 717301dbeb..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteWindow.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.destination - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.PagerSnapHelper -import androidx.recyclerview.widget.RecyclerView -import com.mogo.module.common.entity.V2XEventShowEntity -import com.mogo.module.common.entity.V2XMessageEntity -import com.mogo.module.common.entity.V2XRecommendRouteEntity -import com.mogo.module.v2x.R -import com.mogo.module.v2x.V2XServiceManager -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter -import com.mogo.module.v2x.listener.V2XWindowStatusListener -import com.mogo.module.v2x.scenario.scene.V2XBasWindow -import com.mogo.module.v2x.scenario.view.IV2XWindow - -/** - * created by wujifei on 2020/12/25 11:45 - * describe:基于目的地预判的道路事件场景弹窗 - */ -class V2XRecommendRouteWindow @JvmOverloads constructor( - context: Context = V2XServiceManager.getContext(), - attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow { - - private var rvRoadEventList: RecyclerView? = null - private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null - - // 列表展示 - private val mItemList = mutableListOf() - - init { - initView(context) - } - - private fun initView(context: Context) { - // 填充布局 - LayoutInflater.from(context).inflate(R.layout.window_fault_help, this) - rvRoadEventList = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = V2XRoadEventAdapter(mItemList, this) - rvRoadEventList?.setAdapter(mV2XRoadEventAdapter) - // 设置切换样式 - PagerSnapHelper().attachToRecyclerView(rvRoadEventList) - // 配置列表朝向 - val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) - rvRoadEventList?.setLayoutManager(layoutManager) - } - - - override fun close() { - //移除窗体 - V2XServiceManager.getMogoTopViewManager().removeView(this) - } - - override fun getView(): View { - return this - } - - override fun setWindowStatusListener(listener: V2XWindowStatusListener) { - - } - - override fun show(entity: V2XRecommendRouteEntity?) { - entity.let { - // 清空数据 - mItemList.clear() - val v2XEventShowEntity = V2XEventShowEntity() - v2XEventShowEntity.v2XRecommendRouteEntity = entity - v2XEventShowEntity.viewType = V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE - mItemList.add(v2XEventShowEntity) - // 刷新列表 - mV2XRoadEventAdapter?.notifyDataSetChanged() - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/fatigue/V2XFatigueDrivingScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/fatigue/V2XFatigueDrivingScenario.java deleted file mode 100644 index bf32c4465f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/fatigue/V2XFatigueDrivingScenario.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.fatigue; - -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 疲劳驾驶/目的地停车场推荐场景 - * 目的地停车场他推荐:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48958095 - * version: 1.0 - */ -public class V2XFatigueDrivingScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { - - // 语音控制导航 - private V2XVoiceCallbackListener mNaviCb = (command, intent) -> startNavi(); - - public V2XFatigueDrivingScenario() { - setV2XWindow(new V2XFatigueDrivingWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - return; - } - if (!isSameScenario(v2XMessageEntity)) { - setV2XMessageEntity(v2XMessageEntity); - if (v2XMessageEntity != null) { - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI, mNaviCb) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP, mNaviCb); - if (v2XMessageEntity.isShowState() - && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - show(); - } - } - } else { - setV2XMessageEntity(v2XMessageEntity); - Logger.w(V2XConst.MODULE_NAME, "疲劳驾驶场景,要处理的场景已经存在,丢弃这次初始化"); - } - } - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - } - - @Override - public void showButton() { - } - - @Override - public void closeButton() { - } - - @Override - public void drawPOI() { - } - - @Override - public void clearPOI() { - } - - @Override - public void onViewAdded(View view) { - Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 动画结束"); - } - - @Override - public void onViewRemoved(View view) { - Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 动画结束"); - } - - @Override - public void beforeViewAddAnim(View view) { - Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 开始"); - - } - - @Override - public void beforeViewRemoveAnim(View view) { - Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 开始"); - // 重置场景提示的消息 - setV2XMessageEntity(null); - V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, false); - } - - - /** - * 导航规划路线 - */ - private void startNavi() { - if (getV2XMessageEntity().getContent() != null) { - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP); - MogoLatLng endPoint = new MogoLatLng(getV2XMessageEntity().getContent().getLat(), - getV2XMessageEntity().getContent().getLon()); - V2XServiceManager.getNavi().naviTo(endPoint); - close(); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/fatigue/V2XFatigueDrivingWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/fatigue/V2XFatigueDrivingWindow.java deleted file mode 100644 index 6c0e0079ce..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/fatigue/V2XFatigueDrivingWindow.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.fatigue; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.RelativeLayout; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import java.util.ArrayList; -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/24 11:34 AM - * desc : 疲劳驾驶场景Window - * version: 1.0 - */ -public class V2XFatigueDrivingWindow extends V2XBasWindow - implements IV2XWindow { - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private List mItemList = new ArrayList<>(); - - // 直播30秒自动关闭 - private static Handler handlerV2XEvent = new Handler(); - private static Runnable runnableV2XEvent; - - // 推荐的停车场 - private V2XPushMessageEntity mV2XPushMessageEntity; - - public V2XFatigueDrivingWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XFatigueDrivingWindow(Context context) { - this(context, null); - } - - public V2XFatigueDrivingWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XFatigueDrivingWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - public void initView(Context context) { - //Logger.w(MODULE_NAME, "V2X-初始化疲劳驾驶"); - LayoutInflater.from(context).inflate(R.layout.window_fault_help, this); - // 详情列表 - mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList,this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - // 用户处于交互的时候延后隐藏时间 - countDownV2XEvent(); - } - } - } - }); - } - - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XPushMessageEntity entity) { - if (entity != null) { - mV2XPushMessageEntity = entity; - // 清空数据 - mItemList.clear(); - //Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity); - V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity(); - v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity); - v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING); - mItemList.add(v2XEventShowEntity); - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - - countDownV2XEvent(); - } - } - - @Override - public void close() { - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent() { - if (mV2XPushMessageEntity != null) { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - //Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - int expireTime = mV2XPushMessageEntity.getExpireTime(); - //Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java deleted file mode 100644 index 3f4d3d8b7c..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.help; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -import android.content.Intent; -import android.os.CountDownTimer; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.entrance.ButtonIndex; -import com.mogo.service.entrance.IMogoEntranceButtonController; -import com.mogo.service.statusmanager.IMogoStatusChangedListener; -import com.mogo.service.statusmanager.StatusDescriptor; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.scenario.scene - * @ClassName: V2XCarForHelpScenario - * @Description: 自车求助场景 - * @Author: fenghl - * @CreateDate: 2020/5/25 11:44 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/5/25 11:44 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public class V2XCarForHelpScenario extends AbsV2XScenario implements IMogoStatusChangedListener { - private static final String TAG = MODULE_NAME + "_" + V2XCarForHelpScenario.class.getSimpleName(); - private volatile static V2XCarForHelpScenario mV2XCarForHelpScenario; - private CountDownTimer mMySeekHelpCountDown; - private V2XSeekHelpDialog v2xFaultHelpDialog; - private V2XSeekHelpButton mV2XSeekHelpButton; - - public V2XCarForHelpScenario() { - mV2XSeekHelpButton = new V2XSeekHelpButton(); - setV2XButton(mV2XSeekHelpButton); - V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this); - V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - // 设置Button的显示 - if (v2XMessageEntity == null) { - return; - } - setV2XMessageEntity(v2XMessageEntity); - Boolean isShow = getV2XMessageEntity().getContent(); - if (isShow) { - showButton(); - mySeekHelpCountDownTimerCancel(); - mySeekHelpCountDownTimerStart(); - if (cancelCb == null) { - cancelCb = (String command, Intent intent) -> { - TextView tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2); - if (tv != null) { - showDialog(); - } - }; - } - unregisterSeekHelpButtonCmd(); - V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb); - V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP, cancelCb); - } else { - closeButton(); - } - } - - @Override - public void show() { - showButton(); - } - - @Override - public void showWindow() { - } - - @Override - public void closeWindow() { - } - - private V2XVoiceCallbackListener cancelCb = null; - - @Override - public void showButton() { - Logger.d(TAG, "打开自车求助按钮!"); - // 设置Button的显示 - ThreadUtils.runOnUiThread(() -> { - if (getV2XButton() != null) { - getV2XButton().setOnActionListener(this::showDialog); - getV2XButton().show(); - // V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助..."); - } - }); - } - - @Override - public void closeButton() { - if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { - Logger.d(TAG, "关闭自车求助按钮!"); - V2XServiceManager.getMogoEntranceButtonController().hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP); - V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false); - if (getV2XButton() != null) { - getV2XButton().close(); - SharedPrefsMgr.getInstance(Utils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0); - } - - mySeekHelpCountDownTimerCancel(); - } - if (V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow()) { - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearSpecialCarPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } - - - } - - - @Override - public void drawPOI() { - //无Poi - } - - @Override - public void clearPOI() { - //无Poi - } - - - private void mySeekHelpCountDownTimerStart() { - long seekHelpTimeStart = SharedPrefsMgr.getInstance(V2XServiceManager.getContext()).getLong(V2XConst.SEEK_HELP_TIME, 0); - if (seekHelpTimeStart == 0) { - return; - } - long curTime = System.currentTimeMillis(); - long timeOut = 10 * 60_000; - //超时时间 - if (curTime - seekHelpTimeStart < timeOut) { - long min30 = 30 * 60 * 1000; - //long min30 = 10_000; - long countDown = seekHelpTimeStart + min30 - curTime; - //从自车故障时间起 30分钟后弹框提醒 - if (mMySeekHelpCountDown == null) { - mMySeekHelpCountDown = new CountDownTimer(countDown, countDown) { - @Override - public void onTick(long millisUntilFinished) { - - } - - @Override - public void onFinish() { - showDialog(); - } - }; - mMySeekHelpCountDown.start(); - } - } - } - - private void mySeekHelpCountDownTimerCancel() { - if (mMySeekHelpCountDown != null) { - mMySeekHelpCountDown.cancel(); - mMySeekHelpCountDown = null; - } - } - - - public void showDialog() { - if (v2xFaultHelpDialog == null) { - v2xFaultHelpDialog = new V2XSeekHelpDialog(V2XServiceManager.getContext()); - } -// v2xFaultHelpDialog.setOnClickListener(new V2XSeekHelpDialog.OnClickListener() { -// @Override -// public void onClickLeft() { -// //放弃求助 -// /* if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { -// V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false); -// }*/ -// closeButton(); -// v2xFaultHelpDialog.dismiss(); -// } -// -// @Override -// public void onClickRight() { -// //继续求助 -// v2xFaultHelpDialog.dismiss(); -// -// } -// }); -// v2xFaultHelpDialog.show(); - closeButton(); - - } - - private void unregisterSeekHelpButtonCmd() { - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP); - V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP); - } - - @Override - public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { - if (descriptor == StatusDescriptor.SEEK_HELPING) { - V2XMessageEntity entity = new V2XMessageEntity<>(); - entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP); - entity.setContent(isTrue); - init(entity); - } else if (descriptor == StatusDescriptor.VR_MODE) { - if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { - if (isTrue) { - ((V2XSeekHelpButton) getV2XButton()).showTopView(); - V2XServiceManager.getMogoEntranceButtonController() - .getButton(ButtonIndex.BUTTON2).setVisibility(View.GONE); - } else { - ((V2XSeekHelpButton) getV2XButton()).closeTopView(); - V2XServiceManager.getMogoEntranceButtonController() - .getButton(ButtonIndex.BUTTON2).setVisibility(View.VISIBLE); - } - } - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java deleted file mode 100644 index 1c0b9ef22a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.help; - -import android.content.Intent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.mogo.eagle.core.data.BaseData; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.scenario.view.IV2XButton; -import com.mogo.module.v2x.scenario.view.IV2XButtonListener; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.entrance.ButtonIndex; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.scenario.view - * @ClassName: V2XSeekHelpButton - * @Description: 自车求助按钮 - * @Author: fenghl - * @CreateDate: 2020/5/18 10:46 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/5/18 10:46 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public class V2XSeekHelpButton implements IV2XButton { - private TextView tv; - private IV2XButtonListener mListener; - private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> { - doAction(); - }; - private View topView; - - - private void doAction() { - if (mListener != null) { - mListener.onAction(); - } - } - - @Override - public void setOnActionListener(IV2XButtonListener listener) { - mListener = listener; - } - - @Override - public void show() { - registerVoice(); - try { - tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2); - tv.setText("取消\n求助"); - tv.setOnClickListener(v -> { - //调用取消求助接口 - // TODO: 2020/5/18 回调,显示对话框 - doAction(); - }); - - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - showTopView(); - tv.setVisibility(View.GONE); - } else { - closeTopView(); - tv.setVisibility(View.VISIBLE); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void showTopView() { - topView = View.inflate(V2XServiceManager.getContext(), R.layout.window_carforhelp_detail, null); - TextView tvCancel = topView.findViewById(R.id.tv_cancel); - tvCancel.setOnClickListener(v -> { - doAction(); - }); - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_car_for_help_window_height)); - V2XServiceManager.getMogoTopViewManager().addView(topView, layoutParams); - } - - public void closeTopView() { - V2XServiceManager.getMogoTopViewManager().removeView(topView); - } - - @Override - public void close() { - if (tv != null) { - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已取消", null); - tv.setVisibility(View.GONE); - closeTopView(); - V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback() { - @Override - public void onSuccess(BaseData result) { - tv.setVisibility(View.GONE); - closeTopView(); - } - - @Override - public void onFail(String msg) { - tv.setVisibility(View.VISIBLE); - showTopView(); - } - }); - mListener = null; - } - unRegisterVoice(); - } - - @Override - public void registerVoice() { - V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb); - } - - @Override - public void unRegisterVoice() { - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpDialog.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpDialog.java deleted file mode 100644 index a855ca99d1..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpDialog.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.help; - -import android.content.Context; -import android.content.Intent; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.TextView; - -import androidx.constraintlayout.widget.ConstraintLayout; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.wm.WindowManagerView; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.window - * @ClassName: V2XDialog - * @Description: java类作用描述 - * @Author: fenghl - * @CreateDate: 2020/4/22 14:27 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/4/22 14:27 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickListener { - public static final String TAG = "V2XDialog"; - private TextView tvContent; - private TextView tvLeft; - private TextView tvRight; - private Context mContext; - - public V2XSeekHelpDialog(Context context) { - this(context, null); - } - - public V2XSeekHelpDialog(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XSeekHelpDialog(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - - init(context); - } - - private void init(Context context) { - mContext = context; - LayoutInflater.from(context).inflate(R.layout.dialog_v2x_seek_help, this); - tvContent = findViewById(R.id.tvDialogContent); - tvLeft = findViewById(R.id.tvDialogLeft); - tvRight = findViewById(R.id.tvDialogRight); - tvContent.setText("确定解除求助状态?"); - tvLeft.setText("确定"); - tvRight.setText("取消"); - tvLeft.setOnClickListener(this); - tvRight.setOnClickListener(this); - - } - - private OnClickListener mListener; - - public void setOnClickListener(OnClickListener listener) { - mListener = listener; - } - - public interface OnClickListener { - void onClickLeft(); - - void onClickRight(); - } - - private WindowManagerView windowManager; - - public void show() { - try { - Logger.d(TAG, "使用windowManager实现"); -// if ( windowManager == null ) { -// windowManager = new WindowManagerView.Builder( -// V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2).getContext() -// ).contentView(this).build(); -// } -// AIAssist.getInstance(Utils.getApp()).speakTTSVoice("确定要解除求助状态吗"); -// unRegisterVoiceCmd(); -// registerVoiceCmd(); -// windowManager.show(); - handleLeft(); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已取消"); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - private V2XVoiceCallbackListener voiceRightCb = (String command, Intent intent) -> { - //继续求助 - handleRight(); - }; - private V2XVoiceCallbackListener voiceLeftCb = (String command, Intent intent) -> { - - //放弃求助 - handleLeft(); - }; - - public void dismiss() { - if (windowManager != null) { - windowManager.dismiss(); - } - windowManager = null; - } - - //放弃求助 - private void handleLeft() { - if (mListener != null) { - mListener.onClickLeft(); - } -// unRegisterVoiceCmd(); - } - - //继续求助 - private void handleRight() { - if (mListener != null) { - mListener.onClickRight(); - } -// unRegisterVoiceCmd(); - } - - private void registerVoiceCmd() { - V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM, voiceLeftCb); - V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CANCEL, voiceRightCb); - V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP, voiceLeftCb); - V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_UN_WAKEUP, voiceRightCb); - } - - private void unRegisterVoiceCmd() { - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM); - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CANCEL); - V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP); - V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_UN_WAKEUP); - } - - @Override - public void onClick(View v) { - int vId = v.getId(); - if (vId == R.id.tvDialogLeft) { - handleLeft(); - } else if (vId == R.id.tvDialogRight) { - handleRight(); - } - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XPushLiveCarScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XPushLiveCarScenario.java deleted file mode 100644 index b441443e8e..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XPushLiveCarScenario.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.text.TextUtils; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.service.windowview.IMogoTopViewStatusListener; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : TODO 推送直播场景 非演示 - * version: 1.0 - */ -public class V2XPushLiveCarScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { - - public V2XPushLiveCarScenario() { - setV2XWindow(new V2XPushLiveCarWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - if (!isSameScenario(v2XMessageEntity) - && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - setV2XMessageEntity(v2XMessageEntity); - if (v2XMessageEntity != null && - (v2XMessageEntity.getContent().getVideoSn() != null || - !TextUtils.isEmpty(v2XMessageEntity.getContent().getVideoUrl()))) { - show(); - } else { - TipToast.shortTip("附近没有可直播车机"); - } - } else { - setV2XMessageEntity(v2XMessageEntity); - } - } - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - int width = (int) Utils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width); - int height = (int) Utils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height); - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height); - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - V2XServiceManager - .getMogoTopViewManager() - .addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); - } else { - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - } - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, false); - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().show(); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - } - } - - @Override - public void clearPOI() { - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - } - - @Override - public void onViewAdded(View view) { - ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), getV2XMessageEntity().getContent()); - } - - @Override - public void onViewRemoved(View view) { - } - - @Override - public void beforeViewAddAnim(View view) { - } - - @Override - public void beforeViewRemoveAnim(View view) { - // 重置场景提示的消息 - setV2XMessageEntity(null); - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, false); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XPushLiveCarWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XPushLiveCarWindow.java deleted file mode 100644 index ad3810f2ee..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XPushLiveCarWindow.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.content.Context; -import android.os.Handler; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.RelativeLayout; - -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.MarkerUtils; -import com.mogo.module.v2x.view.V2XLiveGSYVideoView; -import com.mogo.service.imageloader.MogoImageView; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/24 11:34 AM - * version: 1.0 - */ -public class V2XPushLiveCarWindow extends V2XBasWindow implements IV2XWindow { - - private V2XLiveGSYVideoView mV2XLiveGSYVideoView; - private MogoImageView mIvReportHead; - - // 弹窗状态监听 - private V2XWindowStatusListener mV2XWindowStatusListener; - - // 直播30秒自动关闭 - private static final Handler handlerV2XEvent = new Handler(); - private static Runnable runnableV2XEvent; - - public V2XPushLiveCarWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XPushLiveCarWindow(Context context) { - this(context, null); - } - - public V2XPushLiveCarWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XPushLiveCarWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - public void initView(Context context) { - //Logger.w(MODULE_NAME, "初始化直播小窗口View。。。。。"); - LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() - ? R.layout.item_v2x_push_live_video_vr - : R.layout.item_v2x_push_live_video, this); - // 详情列表 - mV2XLiveGSYVideoView = findViewById(R.id.videoPlayer); - mIvReportHead = findViewById(R.id.ivReportHead); - ImageView pushVideoClose = findViewById(R.id.pushVideoClose); - pushVideoClose.setOnClickListener(v -> close()); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XPushMessageEntity entity) { - if (entity != null) { - //Logger.w(MODULE_NAME, "更新直播信息。。。。。" + entity); - - if (!TextUtils.isEmpty(entity.getHeadImgUrl())) { - mIvReportHead.setVisibility(VISIBLE); - V2XServiceManager.getImageLoader() - .displayImage(entity.getHeadImgUrl(), mIvReportHead); - } - // 启动播放 - MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo(); - carLiveInfo.setVideoChannel(entity.getVideoChannel()); - carLiveInfo.setVideoSn(entity.getVideoSn()); - carLiveInfo.setVideoUrl(entity.getVideoUrl()); - mV2XLiveGSYVideoView.startLive(carLiveInfo); - countDownV2XEvent(entity); - - if (mV2XWindowStatusListener != null) { - mV2XWindowStatusListener.onViewShow(); - } - } - } - - @Override - public void close() { - // 修改地图比例 - V2XServiceManager.getMoGoStatusManager().setUserInteractionStatus(MODULE_NAME, true, false); - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - MarkerUtils.resetMapZoom(16); - // 如果窗体处于展示的时候 - if (mV2XWindowStatusListener != null) { - mV2XWindowStatusListener.onViewClose(); - } - // 停止倒计时 - if (runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - remove(); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - this.mV2XWindowStatusListener = listener; - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent(V2XPushMessageEntity v2XPushMessageEntity) { - // 倒计时 - if (runnableV2XEvent == null) { - //Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); - //移出Window详细信息 - runnableV2XEvent = this::close; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - int expireTime = v2XPushMessageEntity.getExpireTime(); - //Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime); - } - - //移除窗体 - private void remove(){ - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - V2XServiceManager - .getMogoTopViewManager() - .removeViewNoLinkage(this); - }else{ - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarScenario.java deleted file mode 100644 index 53d5bf9b45..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarScenario.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.util.Log; -import android.view.View; -import android.view.ViewGroup; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/29 11:16 AM - * desc : 道路预警中的直播场景 - * version: 1.0 - */ -public class V2XRoadLiveCarScenario extends AbsV2XScenario> implements IMogoTopViewStatusListener { - private static final String TAG = "V2XRoadEventScenario"; - private static V2XRoadLiveCarScenario mV2XRoadLiveCarScenario; - - private V2XRoadLiveCarScenario() { - } - - public static V2XRoadLiveCarScenario getInstance() { - if (mV2XRoadLiveCarScenario == null) { - synchronized (V2XRoadLiveCarScenario.class) { - if (mV2XRoadLiveCarScenario == null) { - mV2XRoadLiveCarScenario = new V2XRoadLiveCarScenario(); - } - } - } - return mV2XRoadLiveCarScenario; - } - - @Override - public void init(V2XMessageEntity> v2XMessageEntity) { - try { - List v2XRoadEventEntity = v2XMessageEntity.getContent(); - if (v2XRoadEventEntity != null) { - if (v2XMessageEntity.isShowState()) { - mV2XRoadLiveCarScenario.setV2XWindow(new V2XRoadLiveCarWindow()); - setV2XMessageEntity(v2XMessageEntity); - show(); - } else { - close(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void show() { - if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { - showWindow(); - } - } - - @Override - public void showWindow() { - Log.d(TAG, getV2XWindow().toString()); - if (getV2XWindow() != null) { - int width = (int) Utils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width); - int height = (int) Utils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height); - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height); - V2XServiceManager - .getMogoTopViewManager() - .addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, false); - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().show(); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - } - } - - @Override - public void clearPOI() { - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - } - - @Override - public void onViewAdded(View view) { - Logger.d(MODULE_NAME, "展示 Window 动画结束"); - } - - @Override - public void onViewRemoved(View view) { - Logger.d(MODULE_NAME, "关闭 Window 动画结束"); - - } - - @Override - public void beforeViewAddAnim(View view) { - Logger.d(MODULE_NAME, "展示 Window 开始"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - Logger.d(MODULE_NAME, "关闭 Window 开始"); - // 警报状态,true-警报中,false-警报结束 - V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, false); - // 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时 -// V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow(); -// window.startCountDown(); - // 重置场景提示的消息 - setV2XMessageEntity(null); - // 关闭场景提示 - clearPOI(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java deleted file mode 100644 index 46feba147a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XRoadLiveCarWindow.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.module.v2x.voice.V2XVoicePagingListener; - -import java.util.ArrayList; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/24 11:34 AM - * desc : 道路预警中的直播场景 - * version: 1.0 - */ -public class V2XRoadLiveCarWindow extends V2XBasWindow - implements IV2XWindow> { - private String TAG = "V2XRoadEventDetailWindow"; - private TextView mTvEventStubClose; - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private List mItemList = new ArrayList<>(); - // 当前展示的位置 - private int mCurPosition; - // 处理道路事件,30秒倒计时 - private Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private int countDownTime = 30; - // 关闭弹窗回调 - private V2XVoiceCallbackListener v2XVoiceCallbackCloseWindowListener = (command, intent) -> close(); - // 翻页回调监听 - private V2XVoicePagingListener v2XVoicePagingCallbackListener = new V2XVoicePagingListener() { - - @Override - public void onNextCallback() { - if (mRecyclerView != null && mCurPosition >= 0 && mCurPosition < mV2XRoadEventAdapter.getItemCount() - 1) { - mRecyclerView.scrollToPosition(mCurPosition + 1); - } - } - - @Override - public void onPrevCallback() { - if (mRecyclerView != null && mCurPosition > 0 && mCurPosition <= mV2XRoadEventAdapter.getItemCount() - 1) { - mRecyclerView.scrollToPosition(mCurPosition - 1); - } - } - }; - - public V2XRoadLiveCarWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XRoadLiveCarWindow(Context context) { - this(context, null); - } - - public V2XRoadLiveCarWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XRoadLiveCarWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - /** - * 初始化视图 - */ - private void initView(Context context) { - //Logger.w(MODULE_NAME, "V2X===初始化道路直播视图"); - // 填充布局 - LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.layout.item_v2x_road_live_car_detail_vr : R.layout.item_v2x_road_live_car_detail, this); - mTvEventStubClose = findViewById(R.id.tvEventStubClose); - mRecyclerView = findViewById(R.id.rvRoadEventList); - mTvEventStubClose.setOnClickListener(v -> { - close(); - }); - - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - //获得当前显示在第一个item的位置 - mCurPosition = layoutManager.findFirstCompletelyVisibleItemPosition(); - // 用户处于交互的时候延后隐藏时间 - countDownV2XEvent(30000); - } - } - } - }); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(List entity) { - //Logger.d(MODULE_NAME, "V2X===道路事件直播:展示 Window :" + GsonUtil.jsonFromObject(entity)); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW, - v2XVoiceCallbackCloseWindowListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, - v2XVoiceCallbackCloseWindowListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP, - v2XVoiceCallbackCloseWindowListener) - .registerPagingCallback(v2XVoicePagingCallbackListener); - // 更新头部的窗体视图 - updateTopWindowInfo(entity); - // 倒计时 - countDownV2XEvent(30000); - } - - /** - * 更新头部的窗体视图 - */ - private void updateTopWindowInfo(List v2XRoadEventEntity) { - // 清空数据 - mItemList.clear(); - mItemList.addAll(v2XRoadEventEntity); - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - } - - /** - * 关闭详情展示框 - */ - @Override - public void close() { - //Logger.d(MODULE_NAME, "V2X===关闭Window"); - - // 注册语音交互 - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW); - V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP); - V2XVoiceManager.INSTANCE.unRegisterPagingCallback(); - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING) - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN) - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR); - - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeViewNoLinkage(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent(int expireTime) { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - // 移出Window详细信息 - mTvEventStubClose.setText((countDownTime--) + "s"); - handlerV2XEvent.postDelayed(runnableV2XEvent, 1000); - if (countDownTime <= 0) { - close(); - } - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - //Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, 1000); - } -} - diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java deleted file mode 100644 index 123cc209c3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.content.Context; -import android.text.TextUtils; -import android.util.Log; - -import com.mogo.cloud.live.manager.LiveStreamManagerImpl; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack; -import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.ToastUtils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.map.uicontroller.VisualAngleMode; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.statusmanager.StatusDescriptor; - -import static com.mogo.map.marker.MarkerType.MAP_STATIC; -import static com.mogo.map.marker.MarkerType.MAP_STATIC_TRAFFIC; -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; -import static com.mogo.module.v2x.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_AHEAD_LIVE; -import static com.mogo.module.v2x.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP; -import static com.mogo.module.v2x.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE; -import static com.mogo.module.v2x.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP; -import static com.mogo.service.statusmanager.StatusDescriptor.MAIN_PAGE_RESUME; - -/** - * author : unknown - * desc : 语音呼叫查看直播车辆 或者 路口实况 业务模块 - */ -public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener { - - private static final String REGISTER_LIFECYCLE_TAG = "V2XVoiceCallLiveBiz"; - - private V2XVoiceCallLiveBiz() { - - } - - private static volatile V2XVoiceCallLiveBiz mV2XVoiceCallLiveBiz; - - public static V2XVoiceCallLiveBiz getInstance() { - if (mV2XVoiceCallLiveBiz == null) { - synchronized (V2XVoiceCallLiveBiz.class) { - if (mV2XVoiceCallLiveBiz == null) { - mV2XVoiceCallLiveBiz = new V2XVoiceCallLiveBiz(); - } - } - } - return mV2XVoiceCallLiveBiz; - } - - private Context mContext; - - //语音词指令 查看前车视频回调 - private final V2XVoiceCallbackListener v2XVoiceCallbackFrontLiveCarListener = (command, intent) -> { - Logger.d(MODULE_NAME, "语音词指令 查看前车视频回调"); - getFrontCarLive(); - }; - - //语音词指令 查看路口实况回调 - private final V2XVoiceCallbackListener v2XVoiceCallbackOpenRoadCameraListener = (command, intent) -> { - Logger.d(MODULE_NAME, "语音词指令 查看路口实况回调"); - AIAssist.getInstance(mContext).speakTTSVoice(mContext.getString(R.string.v2x_voice_see_crossroad_live)); - getOpenRoadCameraLive(); - }; - - public void init(Context context) { - Logger.d(MODULE_NAME, "init"); - this.mContext = context; - registerLifecycleChange(); - registerVoice(); - registerMarkerClick(); - } - - private void registerMarkerClick() { - MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoStaticMarkerClickListener(MAP_STATIC, this); - } - - /** - * 地图上静态marker点击,现在仅点击摄像头 - * - * @param marker - * @return - */ - @Override - public boolean onStaticMarkerClicked(IMogoMarker marker) { - Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker"); - if (V2XServiceManager.getMapService().getMapUIController().getCurrentMapVisualAngle().isLongSight()) { - Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker is on LongSight, so don't response"); - return false; - } - //拉近地图视角为近景 - V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_CLOSE_SIGHT, marker.getPosition()); - String assInfo = marker.getMarkerAssInfo(); - Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker assInfo : " + assInfo); - if (TextUtils.isEmpty(assInfo) || !assInfo.contains(MAP_STATIC_TRAFFIC)) { - return false; - } else { - //点击地图上marker返回assInfo,得到路口摄像头Id,获取直播 - getSpecifiedOpenCameraLive(assInfo); - return true; - } - } - - private void registerLifecycleChange() { - V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(REGISTER_LIFECYCLE_TAG, MAIN_PAGE_RESUME, (descriptor, isTrue) -> { - if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) { - if (isTrue) { - registerVoice(); - } else { - unRegisterVoice(); - } - } - }); - } - - private void registerVoice() { - V2XVoiceManager.INSTANCE.registerUnWakeVoice(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP, v2XVoiceCallbackFrontLiveCarListener) - .registerUnWakeVoice(COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP, v2XVoiceCallbackOpenRoadCameraListener) - .registerWakeCmd(COMMAND_ZHIDAO_V2X_AHEAD_LIVE, v2XVoiceCallbackFrontLiveCarListener) - .registerWakeCmd(COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE, v2XVoiceCallbackOpenRoadCameraListener); - } - - private void unRegisterVoice() { - V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP) - .unRegisterUnWakeVoice(COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP) - .unRegisterWakeCmd(COMMAND_ZHIDAO_V2X_AHEAD_LIVE).unRegisterWakeCmd(COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE); - } - - /** - * 查看前方车辆直播,同方向角 200米范围 - */ - public void getFrontCarLive() { - LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(), - MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId(), false); - V2XMessageEntity v2XMessageEntity = buildCallLiveParams(null, null, V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - } - - /** - * 查看前方路口摄像头直播,同方向角 1公里范围 - */ - public void getOpenRoadCameraLive() { - MogoLocation mogoLocation = V2XServiceManager.getMogoLocationClient().getLastKnowLocation(); - MoGoAiCloudTrafficLive.viewFrontIntersectionLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), new ITrafficIntersectionLiveCallBack() { - @Override - public void liveUrlResult(String liveUrl) { - if (!TextUtils.isEmpty(liveUrl)) { - V2XMessageEntity v2XMessageEntity = buildCallLiveParams(null, liveUrl, V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - } else { - Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空"); - ToastUtils.showShort(R.string.v2x_front_live_url_null); - } - } - - @Override - public void onError(String errorMsg) { - Logger.d(MODULE_NAME, "getOpenRoadCameraLive : " + errorMsg); - ToastUtils.showShort(R.string.v2x_front_live_url_null); - } - }); - } - - /** - * 获取特定路口摄像头直播 - * - * @param assInfo 路口摄像头Id - */ - private void getSpecifiedOpenCameraLive(String assInfo) { - MoGoAiCloudTrafficLive.viewDesignativeIntersectionLive(assInfo, new ITrafficIntersectionLiveCallBack() { - @Override - public void liveUrlResult(String liveUrl) { - if (!TextUtils.isEmpty(liveUrl)) { - V2XMessageEntity v2XMessageEntity = buildCallLiveParams(null, liveUrl, V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING); - V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); - } else { - Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空"); - ToastUtils.showShort(R.string.v2x_specific_live_url_null); - } - } - - @Override - public void onError(String errorMsg) { - Logger.d(MODULE_NAME, "getSpecifiedOpenCameraLive : " + errorMsg); - ToastUtils.showShort(R.string.v2x_specific_live_url_null); - } - }); - } - - /** - * 构建直播参数 - * - * @param sn 直播车机sn - * @param liveUrl 直播Url - * @return {@link V2XMessageEntity} - */ - private V2XMessageEntity buildCallLiveParams(String sn, String liveUrl, int type) { - V2XPushMessageEntity v2XPushMessageEntity = new V2XPushMessageEntity(); - v2XPushMessageEntity.setVideoSn(sn); - v2XPushMessageEntity.setVideoUrl(liveUrl); - v2XPushMessageEntity.setShowWindow(true); - v2XPushMessageEntity.setExpireTime(1000 * 30); - V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>(); - v2XMessageEntity.setType(type); - v2XMessageEntity.setContent(v2XPushMessageEntity); - v2XMessageEntity.setShowState(true); - return v2XMessageEntity; - } - - public void onDestroy() { - MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoStaticMarkerClickListener(MAP_STATIC, this); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveCarWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveCarWindow.java deleted file mode 100644 index 4d1ae8805b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveCarWindow.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.view.CarZegoLiveVideoView; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -public class V2XVoiceCallLiveCarWindow extends V2XBasWindow - implements IV2XWindow { - - private static final int COUNT_DOWN_TIMER = 1_000; - private static final int ALL_EXPIRE_TIMER = 1_000 * 30; - private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER; - - private TextView tvCountDown; - private ImageView ivVideoPlayingSign; - private boolean isVideoPlay = false; - - // 处理道路事件,30秒倒计时 - private final Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - - public V2XVoiceCallLiveCarWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XVoiceCallLiveCarWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XVoiceCallLiveCarWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - Logger.w(MODULE_NAME, "V2X===初始化语音呼叫直播视图"); - LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() - ? R.layout.window_see_carlive_video_vr - : R.layout.window_see_carlive_video, this); - CarZegoLiveVideoView mV2XCarLiveVideoView = findViewById(R.id.videoPlayer); - tvCountDown = findViewById(R.id.tvCountDown); -// ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose); - ivVideoPlayingSign = findViewById(R.id.ivVideoPlayingSign); - mV2XCarLiveVideoView.addOnVideoStatusChangeListener(videoPlaying -> { - isVideoPlay = videoPlaying; - if (isVideoPlay) { - startCountDown(); - } else { - stopCountDown(); - } - }); -// ivLiveVideoClose.setOnClickListener(v -> close()); - } - - @Override - public void show(V2XPushMessageEntity entity) { - if (entity != null) { - Logger.w(MODULE_NAME, "更新直播信息。。。。。" + entity); - // 启动播放 - MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo(); - carLiveInfo.setVideoChannel(entity.getVideoChannel()); - carLiveInfo.setVideoSn(entity.getVideoSn()); - carLiveInfo.setVideoUrl(entity.getVideoUrl()); - Logger.w(MODULE_NAME, "更新直播信息 END"); - if (isVideoPlay) { - startCountDown(); - } - } - } - - @Override - public void close() { - // 停止倒计时 - stopCountDown(); - remove(); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - - } - - /** - * 窗体倒计时 - */ - private void startCountDown() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER; - tvCountDown.setVisibility(View.VISIBLE); - ivVideoPlayingSign.setVisibility(View.VISIBLE); - tvCountDown.setText(String.valueOf(EXPIRE_TIMER / COUNT_DOWN_TIMER)); - if (EXPIRE_TIMER > 0) { - handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER); - } else { - close(); - } - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER); - } - - private void stopCountDown() { - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - tvCountDown.setVisibility(View.GONE); - ivVideoPlayingSign.setVisibility(View.GONE); - EXPIRE_TIMER = ALL_EXPIRE_TIMER; - } - } - - //移除窗体 - private void remove(){ - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - V2XServiceManager - .getMogoTopViewManager() - .removeViewNoLinkage(this); - }else{ - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java deleted file mode 100644 index a31c0a7161..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : unknown - * desc : 语音呼叫查看直播场景,包括车辆直播 或者 路口实况 window,区分不同页面window逻辑实现,前方直播车辆由AICloudSdk中实现,上层仅传入SurfaceView和经纬度 - */ -public class V2XVoiceCallLiveScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { - - public V2XVoiceCallLiveScenario() { - Logger.d(V2XConst.MODULE_NAME, "V2XVoiceCallLiveScenario new()" ); - setV2XWindow(new V2XVoiceCallLiveCarWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - if (v2XMessageEntity == null) { - TipToast.shortTip("附近没有可直播车机"); - return; - } - if (v2XMessageEntity.isShowState()) { - if (!isSameScenario(v2XMessageEntity) - && V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) { - setV2XMessageEntity(v2XMessageEntity); - Logger.d(V2XConst.MODULE_NAME, "v2XMessageEntity : " + v2XMessageEntity); - show(); - } else { - setV2XMessageEntity(v2XMessageEntity); - Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化"); - } - } else { - close(); - } - } - - @Override - public void show() { - if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { - showWindow(); - } - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - int width = (int) Utils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width); - int height = (int) Utils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height); - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height); - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - V2XServiceManager - .getMogoTopViewManager() - .addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); - } else { - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - } - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, false); - } - - @Override - public void showButton() { - - } - - @Override - public void closeButton() { - - } - - @Override - public void drawPOI() { - - } - - @Override - public void clearPOI() { - - } - - @Override - public void onViewAdded(View view) { - Logger.d(MODULE_NAME, "展示 Window 动画结束"); - } - - @Override - public void onViewRemoved(View view) { - Logger.d(MODULE_NAME, "关闭 Window 动画结束"); - getV2XWindow().close(); - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, false); - } - - @Override - public void beforeViewAddAnim(View view) { - Logger.d(MODULE_NAME, "展示 Window 开始"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - Logger.d(MODULE_NAME, "关闭 Window 开始"); - setV2XMessageEntity(null); - V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, false); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCrossRoadLiveWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCrossRoadLiveWindow.java deleted file mode 100644 index 4d8db8b339..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCrossRoadLiveWindow.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.livecar; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.view.V2XCrossRoadVideoView; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -public class V2XVoiceCrossRoadLiveWindow extends V2XBasWindow - implements IV2XWindow { - - private V2XCrossRoadVideoView mV2XCrossRoadVideoView; - private TextView tvCountDown; - private ImageView ivVideoPlayingSign; - private boolean isVideoPlay = false; - - // 处理道路事件,30秒倒计时 - private final Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private static final int COUNT_DOWN_TIMER = 1_000; - private static final int ALL_EXPIRE_TIMER = 1_000 * 30; - private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER; - - public V2XVoiceCrossRoadLiveWindow() { - this(V2XServiceManager.getContext(), null); - Logger.d(MODULE_NAME, "V2XVoiceCallLiveCarWindow INIT"); - } - - public V2XVoiceCrossRoadLiveWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XVoiceCrossRoadLiveWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - Logger.w(MODULE_NAME, "V2X===初始化语音呼叫直播视图"); - LayoutInflater.from(context).inflate(R.layout.window_see_crossroadlive_video, this); - mV2XCrossRoadVideoView = findViewById(R.id.videoPlayer); - tvCountDown = findViewById(R.id.tvCountDown); - ivVideoPlayingSign = findViewById(R.id.ivVideoPlayingSign); - mV2XCrossRoadVideoView.addOnVideoStatusChangeListener(videoPlaying -> { - isVideoPlay = videoPlaying; - if (isVideoPlay) { - startCountDown(); - } else { - stopCountDown(); - } - }); - } - - @Override - public void show(V2XPushMessageEntity entity) { - if (entity != null) { - Logger.w(MODULE_NAME, "更新直播信息。。。。。" + entity); - // 启动播放 - MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo(); - carLiveInfo.setVideoChannel(entity.getVideoChannel()); - carLiveInfo.setVideoSn(entity.getVideoSn()); - carLiveInfo.setVideoUrl(entity.getVideoUrl()); - Logger.w(MODULE_NAME, "更新直播信息 END"); - mV2XCrossRoadVideoView.setCarLiveInfo(carLiveInfo); - if (isVideoPlay) { - startCountDown(); - } - } - } - - @Override - public void close() { - // 停止倒计时 - stopCountDown(); - if (V2XServiceManager - .getMogoTopViewManager().isViewAdded(this)) { - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - - } - - /** - * 窗体倒计时 - */ - private void startCountDown() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER; - Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时开始,当前 :" + EXPIRE_TIMER / COUNT_DOWN_TIMER + " 秒"); - tvCountDown.setVisibility(View.VISIBLE); - ivVideoPlayingSign.setVisibility(View.VISIBLE); - tvCountDown.setText(String.valueOf(EXPIRE_TIMER / COUNT_DOWN_TIMER)); - if (EXPIRE_TIMER > 0) { - handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER); - } else { - Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - } - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时"); - handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER); - } - - private void stopCountDown() { - Logger.d(MODULE_NAME, "V2X=== Window 倒计时停止。。。"); - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - tvCountDown.setVisibility(View.GONE); - ivVideoPlayingSign.setVisibility(View.GONE); - EXPIRE_TIMER = ALL_EXPIRE_TIMER; - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkMarker.java deleted file mode 100644 index 154ce36964..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkMarker.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.park; - -import android.graphics.Bitmap; -import android.os.Handler; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.LinearInterpolator; - -import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.utilcode.util.ViewUtils; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.map.marker.anim.OnMarkerAnimationListener; -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.drawer.marker.RoadConditionInfoWindow3DAdapter; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.service.ServiceConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XMarker; -import com.mogo.module.v2x.utils.MarkerUtils; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; - -import java.util.ArrayList; -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; -import static com.mogo.module.v2x.V2XConst.V2X_EVENT_ALARM_POI; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/6/19 17:37 PM - * desc : 违章停车场景POI绘制 - * version: 1.0 - */ -public class V2XIllegalParkMarker implements IV2XMarker> { - - public ArrayList mIllegalParkMarkerList; - - // 处理道路事件,30秒倒计时 - private Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private int mExpireTime = 30000; - - @Override - public void drawPOI(List entityList) { - try { - mIllegalParkMarkerList = new ArrayList<>(); - // 清除道路事件 - V2XServiceManager - .getMoGoV2XMarkerManager().clearALLPOI(); - //清除连线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - if (entityList != null) { - for (int i = 0; i < entityList.size(); i++) { - MarkerExploreWay markerExploreWay = entityList.get(i); - - // 道路事件,或者水波纹扩散效果 - MogoMarkerOptions optionsRipple = new MogoMarkerOptions() - .data(markerExploreWay) - .latitude(markerExploreWay.getLocation().getLat()) - .longitude(markerExploreWay.getLocation().getLon()); - optionsRipple.anchor(0.5f, 0.5f); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerExploreWay); - markerShowEntity.setChecked(false); - markerShowEntity.setTextContent(markerExploreWay.getAddr()); - markerShowEntity.setMarkerLocation(markerExploreWay.getLocation()); - markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_NOVELTY); - - // 进行数据转换,用于Marker展示 - V2XRoadEventEntity roadEventEntity = new V2XRoadEventEntity(); - roadEventEntity.setLocation(markerExploreWay.getLocation()); - roadEventEntity.setBindObj(markerExploreWay); - - WorkThreadHandler.getInstance().postDelayed(() -> { - IMogoMarker mogoMarker; - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null); - mogoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions())); - mogoMarker.showInfoWindow(); - } else { - IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, optionsRipple); - Bitmap bitmap = ViewUtils.fromView(markerView.getView()); - optionsRipple.icon(bitmap); - mogoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple); - } - // 点击监听,天际弹窗展示详情 - if (mogoMarker != null) { - mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() { - @Override - public void onAnimStart() { - //Logger.d(MODULE_NAME, " onAnimStart ---1----> "); - } - - @Override - public void onAnimEnd() { - if (mogoMarker.isDestroyed()) { - return; - } - mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null); - } - }); - mogoMarker.setOwner(MODULE_NAME); - mogoMarker.setObject(markerShowEntity); - mIllegalParkMarkerList.add(mogoMarker); - } - }, i * 100L); - } - } - - countDownV2XEvent(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearPOI() { - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - MarkerUtils.resetMapZoom(16); - // 移除违章停车点 - V2XServiceManager.getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_NOVELTY); - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } - - /** - * 倒计时 - */ - public void countDownV2XEvent() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - //Logger.d(MODULE_NAME, "V2X===违章停车 30秒倒计时结束。。。"); - // 移出Window详细信息 - clearPOI(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - //Logger.d(MODULE_NAME, "V2X===违章停车 POI 展示开始倒计时:" + mExpireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkScenario.java deleted file mode 100644 index 0787ad38f8..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkScenario.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.park; - -import androidx.annotation.Nullable; - -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.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.V2XStatusManager; -import com.mogo.module.v2x.alarm.V2XAlarmServer; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.module.v2x.utils.TrackUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; - -import java.util.ArrayList; -import java.util.List; - - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 违章停车 - * version: 1.0 - */ -public class V2XIllegalParkScenario extends AbsV2XScenario> { - private static final String TAG = "V2XILLegalParkScenario"; - - public V2XIllegalParkScenario() { - setV2XWindow(new V2XIllegalParkWindow()); - setV2XMarker(new V2XIllegalParkMarker()); - } - - @Override - public void init(@Nullable V2XMessageEntity> v2XMessageEntity) { - setV2XMessageEntity(v2XMessageEntity); - show(); - } - - - @Override - public void show() { - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - drawPOI(); - } - showWindow(); - } - - @Override - public void showWindow() { - MarkerExploreWay markerExploreWay = null; - if (getV2XMessageEntity().getContent() != null) { - markerExploreWay = V2XAlarmServer - .getIllegalParkAlarmEvent( - (ArrayList) getV2XMessageEntity().getContent(), - V2XStatusManager.getInstance().getLocation()); - } - if (markerExploreWay != null) { - //弹框 - // 设置要展开的违章停车事件 - //((V2XIllegalParkMarker) mV2XMarker).setOpenPoiId(markerExploreWay.getInfoId()); - // 广播给ADAS - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setAlarmContent("违章停车"); - v2XRoadEventEntity.setExpireTime(20000); - v2XRoadEventEntity.setPoiType(EventTypeEnum.ALERT_ILLEGAL_PARK.getPoiType()); - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - v2XRoadEventEntity.setTts(markerExploreWay.getAddr() + "可能被罚违章停车,您可以说,有用或没用来帮助其它车友。"); - ((V2XIllegalParkWindow) getV2XWindow()).show(markerExploreWay, true); - TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), EventTypeEnum.ALERT_ILLEGAL_PARK.getPoiType(), "1"); - } else { - v2XRoadEventEntity.setTts(markerExploreWay.getAddr() + "可能被罚违章停车"); - TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), EventTypeEnum.ALERT_ILLEGAL_PARK.getPoiType(), "2"); - } - ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), v2XRoadEventEntity); - saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING, - markerExploreWay); - } - } - - @Override - public void closeWindow() { - V2XServiceManager.getMogoTopViewManager().removeView(getV2XWindow().getView()); - } - - @Override - public void showButton() { - } - - @Override - public void closeButton() { - } - - @Override - public void drawPOI() { - if (getV2XMessageEntity() != null) { - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - } - } - - @Override - public void clearPOI() { - } - - /** - * 存储本地数据 - * - * @param messageEntity 要存储的场景 - */ - private void saveLocalStory(int scenarioType, MarkerExploreWay messageEntity) { - try { - V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkWindow.java deleted file mode 100644 index 8ba3a65b4d..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/park/V2XIllegalParkWindow.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.park; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import java.util.ArrayList; -import java.util.List; - -/** - * 违章停车 - * 弹窗视图 - */ -public class V2XIllegalParkWindow extends V2XBasWindow implements IV2XWindow { - private static final String TAG = "V2XIllegalParkWindow"; - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private List mItemList = new ArrayList<>(); - - // 处理道路事件,20秒倒计时 - private Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private long mExpireTime = 20000; - private boolean mIsAutoClose = true; - - private MarkerExploreWay mExploreWay; - - public V2XIllegalParkWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XIllegalParkWindow(Context context) { - this(context, null); - } - - public V2XIllegalParkWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XIllegalParkWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - /** - * 初始化视图 - */ - private void initView(Context context) { - LayoutInflater.from(context).inflate(R.layout.window_fault_help, this); - // 详情列表 - mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - // 用户处于交互的时候延后隐藏时间 - countDownV2XEvent(); - } - } - } - }); - } - - public void show(MarkerExploreWay entity, boolean isAutoClose) { - mIsAutoClose = isAutoClose; - show(entity); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(MarkerExploreWay entity) { - mExploreWay = entity; - //Logger.d(V2XConst.MODULE_NAME, "V2X===违章停车:展示 Window=\n" + entity); - // 清空数据 - mItemList.clear(); - if (mExploreWay != null) { - //Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity); - V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity(); - v2XEventShowEntity.setV2XIllegalPark(mExploreWay); - v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING); - mItemList.add(v2XEventShowEntity); - } - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - // 倒计时 - if (mIsAutoClose) { - countDownV2XEvent(); - } - - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp() - .getResources() - .getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground)); - - // 添加弹窗 - V2XServiceManager.getMogoTopViewManager().addView(this, layoutParams); - } - - /** - * 关闭详情展示框 - */ - @Override - public void close() { - mIsAutoClose = false; - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - //Logger.d(V2XConst.MODULE_NAME, "V2X===20秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - //Logger.d(V2XConst.MODULE_NAME, "V2X===违章停车 Window 展示开始倒计时:" + mExpireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventMarker.java deleted file mode 100644 index 6266ddd420..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventMarker.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.push; - -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerExploreWayItem; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XMarkerClickListener; -import com.mogo.module.v2x.scenario.view.IV2XMarker; -import com.mogo.module.v2x.utils.MarkerUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 推送场景 - * version: 1.0 - */ -public class V2XPushEventMarker implements IV2XMarker { - @Override - public void drawPOI(V2XPushMessageEntity entity) { - try { - // 清除道路事件 - V2XServiceManager - .getMoGoV2XMarkerManager().clearALLPOI(); - - // 位置信息 - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(entity.getLon()); - markerLocation.setLat(entity.getLat()); - - // 进行数据转换,用于Marker展示 - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(markerLocation); - // 探路目前只有上报拥堵 - v2XRoadEventEntity.setPoiType(EventTypeEnum.ALERT_TRAFFIC_EXPRESS.getPoiType()); - - MarkerExploreWay markerNoveltyInfo = new MarkerExploreWay(); - - List items = new ArrayList<>(); - MarkerExploreWayItem exploreWayItem = new MarkerExploreWayItem(); - exploreWayItem.setThumbnail(entity.getMsgImgUrl()); - items.add(exploreWayItem); - markerNoveltyInfo.setPoiType(EventTypeEnum.ALERT_TRAFFIC_EXPRESS.getPoiType()); - markerNoveltyInfo.setItems(items); - markerNoveltyInfo.setUploadType("1"); - - v2XRoadEventEntity.setNoveltyInfo(markerNoveltyInfo); - v2XRoadEventEntity.setExpireTime(20000); - - V2XServiceManager - .getMoGoV2XMarkerManager() - .drawableAlarmPOI(V2XServiceManager.getContext(), - v2XRoadEventEntity, - V2XMarkerClickListener.getInstance()); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearPOI() { - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - MarkerUtils.resetMapZoom(16); - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventScenario.java deleted file mode 100644 index 8259b778c7..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventScenario.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.push; - -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 推送场景 - * version: 1.0 - */ -public class V2XPushEventScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { - - - public V2XPushEventScenario() { - setV2XMarker(new V2XPushEventMarker()); - setV2XWindow(new V2XPushEventWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - Logger.w(MODULE_NAME, "处理推送场景:" + GsonUtil.jsonFromObject(v2XMessageEntity)); - - if (!isSameScenario(v2XMessageEntity) - && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - setV2XMessageEntity(v2XMessageEntity); - show(); - } else { - setV2XMessageEntity(v2XMessageEntity); - Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化"); - } - } - - @Override - public void show() { - if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { - speakTTSVoice(getV2XMessageEntity().getContent().getTts(), null); - drawPOI(); - showWindow(); - } - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false); - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().show(); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, true); - } - } - - @Override - public void clearPOI() { - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, false); - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - @Override - public void onViewAdded(View view) { - Logger.d(MODULE_NAME, "展示 Window 动画结束"); - } - - @Override - public void onViewRemoved(View view) { - Logger.d(MODULE_NAME, "关闭 Window 动画结束"); - } - - @Override - public void beforeViewAddAnim(View view) { - Logger.d(MODULE_NAME, "展示 Window 开始"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - Logger.d(MODULE_NAME, "关闭 Window 开始"); - V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false); - // 重置场景提示的消息 - setV2XMessageEntity(null); - clearPOI(); - } - //////////////////////////////////////////////////////////////////////////////////////////////////// - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java deleted file mode 100644 index 34ef764e61..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.push; - -import android.content.Context; -import android.content.Intent; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; - -import java.util.ArrayList; -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/14 2:37 PM - * desc : - * TODO 目前前瞻推送使用的消息都在这里展示 - * version: 1.0 - */ -public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow { - private String TAG = "V2XPushEventDetailWindow"; - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private List mItemList = new ArrayList<>(); - // 处理道路事件,30秒倒计时 - private Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private int mExpireTime = 30000; - // 关闭弹窗回调 - private V2XVoiceCallbackListener v2XVoiceCallbackCloseWindowListener = (String command, Intent intent) -> { - close(); - }; - - public V2XPushEventWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XPushEventWindow(Context context) { - this(context, null); - } - - public V2XPushEventWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XPushEventWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - /** - * 初始化视图 - */ - private void initView(Context context) { - Logger.w(MODULE_NAME, "V2X===初始化推送的消息小窗口View。。。。。"); - // 填充布局 - LayoutInflater.from(context).inflate(R.layout.window_push_event_detail, this); - // 详情列表 - mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - // 用户处于交互的时候延后隐藏时间 - countDownV2XEvent(); - } - } - } - }); - - } - - /** - * 更新头部的窗体视图 - */ - private void updateTopWindowInfo(V2XPushMessageEntity v2XRoadEventEntity) { - // 清空数据 - mItemList.clear(); - if (v2XRoadEventEntity != null) { - //Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity); - V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity(); - v2XEventShowEntity.setV2XPushMessageEntity(v2XRoadEventEntity); - v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING); - mItemList.add(v2XEventShowEntity); - } - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XPushMessageEntity entity) { - Logger.d(MODULE_NAME, "V2X===推送消息:展示 Window=\n" + entity); - // 更新头部的窗体视图 - updateTopWindowInfo(entity); - // 倒计时 - mExpireTime = entity.getExpireTime(); - countDownV2XEvent(); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW, v2XVoiceCallbackCloseWindowListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, v2XVoiceCallbackCloseWindowListener); - } - - /** - * 关闭详情展示框 - */ - @Override - public void close() { - Logger.d(MODULE_NAME, "V2X===关闭Window"); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP) - .unRegisterPagingCallback() - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING) - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN) - .unRegisterWakeCmd( - V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE) - .unRegisterUnWakeVoice( - V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR); - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - Logger.d(MODULE_NAME, "V2X===30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - Logger.d(MODULE_NAME, "V2X===推送消息 Window 展示开始倒计时:" + mExpireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventButton.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventButton.java deleted file mode 100644 index 0297e1dd17..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventButton.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.road; - -import android.content.Intent; -import android.view.View; -import android.widget.TextView; - -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XButton; -import com.mogo.module.v2x.scenario.view.IV2XButtonListener; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.service.entrance.ButtonIndex; - -/** - * 道路实况按钮 - */ -public class V2XRoadEventButton implements IV2XButton { - private TextView tv; - private IV2XButtonListener mListener; - private V2XVoiceCallbackListener mVoiceListener = (String command, Intent intent) -> { - if (mListener != null) { - mListener.onAction(); - } - close(); - }; - - @Override - public void setOnActionListener(IV2XButtonListener listener) { - mListener = listener; - } - - @Override - public void show() { - // 注册语音交互 - registerVoice(); - tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON1); - tv.setText("查看\n详情"); - tv.setBackgroundResource(R.drawable.bg_v2x_event_live_show); - tv.setVisibility(View.VISIBLE); - tv.setOnClickListener(v -> { - if (mListener != null) { - mListener.onAction(); - } - close(); - }); - } - - @Override - public void close() { - if (tv != null) { - tv.setVisibility(View.GONE); - // 反注册语音交互 - mListener = null; - } - unRegisterVoice(); - } - - - @Override - public void registerVoice() { - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM, mVoiceListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP, mVoiceListener); - } - - @Override - public void unRegisterVoice() { - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventMarker.java deleted file mode 100644 index 423f0083e3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventMarker.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.road; - -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.view.IV2XMarker; -import com.mogo.module.v2x.utils.MarkerUtils; - -/** - * 道路V2X事件的Marker - */ -public class V2XRoadEventMarker implements IV2XMarker { - @Override - public void drawPOI(V2XRoadEventEntity entity) { - try { - // 清除道路事件 - V2XServiceManager - .getMoGoV2XMarkerManager().clearALLPOI(); - if (entity != null) { - V2XServiceManager.getMoGoV2XMarkerManager() - .drawableAlarmPOI(V2XServiceManager.getContext(), entity, null); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearPOI() { - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - MarkerUtils.resetMapZoom(16); - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventScenario.java deleted file mode 100644 index 63ed7a2f53..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventScenario.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.road; - -import android.view.View; -import android.view.ViewGroup; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarScenario; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -import java.util.HashMap; -import java.util.Map; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 道路预警场景 - * version: 1.0 - */ -public class V2XRoadEventScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { - private static final String TAG = "V2XRoadEventScenario"; - - public V2XRoadEventScenario() { - setV2XButton(new V2XRoadEventButton()); - setV2XMarker(new V2XRoadEventMarker()); - setV2XWindow(new V2XRoadEventWindow()); - } - - @Override - public void init(V2XMessageEntity v2XMessageEntity) { - try { - Logger.d(V2XConst.MODULE_NAME, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); - - V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent(); - if (v2XRoadEventEntity != null) { - if (v2XMessageEntity.isShowState()) { - if (!isSameScenario(v2XMessageEntity)) { - // 更新要提醒的数据 - setV2XMessageEntity(v2XMessageEntity); - show(); - } else { - // 更新要提醒的数据 - setV2XMessageEntity(v2XMessageEntity); - //Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化"); - } - } else { - close(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void show() { - try { - if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { - //只展示不播报 不广播 - - boolean onlyShow = getV2XMessageEntity().isOnlyShow(); - - if (onlyShow == false) { - // 设置TTS - getV2XMessageEntity().getContent().getTts(false); - // 广播给ADASzzz - ADASUtils.broadcastToADAS( - V2XServiceManager.getContext(), - getV2XMessageEntity().getContent()); - } - - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - showWindow(); - } - - // 地图主动推送/触发消息 埋点 - 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 = V2XServiceManager.getMoGoStatusManager().isMainPageOnResume() ? "1" : "2"; - Map properties = new HashMap<>(); - properties.put("dbid", infoId); - properties.put("type", poiType); - properties.put("lng", lon); - properties.put("lat", lat); - properties.put("style", style); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - // 关闭直播弹窗 - try { - IV2XWindow v2XWindow = V2XRoadLiveCarScenario.getInstance().getV2XWindow(); - if (v2XWindow != null) { - V2XServiceManager - .getMogoTopViewManager() - .removeSubView(v2XWindow.getView()); - } - } catch (Exception e) { - e.printStackTrace(); - } - // 关闭之前的事件弹窗 - boolean isShowEventWindow = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow(); - if (isShowEventWindow) { - ((V2XRoadEventWindow) getV2XWindow()).updateTopWindowInfo(getV2XMessageEntity().getContent()); - } else { - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(getV2XMessageEntity().getContent()); - } - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventWindowShow(TAG, true); - } - - - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventWindowShow(TAG, false); - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().setOnActionListener(this::showWindow); - getV2XButton().show(); - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventButtonShow(TAG, true); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventButtonShow(TAG, false); - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - // 重置告警信息 - V2XServiceManager.getV2XStatusManager().setAlarmInfo(getV2XMessageEntity().getContent()); - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - } - } - - @Override - public void clearPOI() { - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - } - - @Override - public void onViewAdded(View view) { - //Logger.d(MODULE_NAME, "展示 Window 动画结束"); - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - if (getV2XMessageEntity() != null && getV2XMessageEntity().isNeedAddLine() == true) { - drawPOI(); - } - } - } - - @Override - public void onViewRemoved(View view) { - Logger.d(V2XConst.MODULE_NAME, "关闭 Window 动画结束"); - release(); - } - - @Override - public void beforeViewAddAnim(View view) { - //Logger.d(MODULE_NAME, "展示 Window 开始"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - //Logger.d(MODULE_NAME, "关闭 Window 开始"); - V2XServiceManager.getMoGoV2XStatusManager().setRoadEventWindowShow(TAG, false); - // 重置场景提示的消息 - setV2XMessageEntity(null); - clearPOI(); - closeButton(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventWindow.java deleted file mode 100644 index 5b14ea0cdd..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadEventWindow.java +++ /dev/null @@ -1,306 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.road; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.entity.net.V2XLiveCarRes; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.module.v2x.voice.V2XVoicePagingListener; - -import java.util.ArrayList; -import java.util.List; - - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/14 2:37 PM - * desc : 显示事件的列表 - * version: 1.0 - */ -public class V2XRoadEventWindow extends V2XBasWindow - implements V2XRefreshCallback, IV2XWindow { - private String TAG = "V2XRoadEventDetailWindow"; - // 关闭按钮 - private ImageView mBtnCloseWindow; - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private final List mItemList = new ArrayList<>(); - // 当前展示的位置 - private int mCurPosition; - // 处理道路事件,30秒倒计时 - private final Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private int mExpireTime = 20000; - // 关闭弹窗回调 - private V2XVoiceCallbackListener v2XVoiceCallbackCloseWindowListener = (command, intent) -> close(); - // 翻页回调监听 - private V2XVoicePagingListener v2XVoicePagingCallbackListener = new V2XVoicePagingListener() { - - @Override - public void onNextCallback() { - if (mRecyclerView != null && mCurPosition >= 0 && mCurPosition < mV2XRoadEventAdapter.getItemCount() - 1) { - mRecyclerView.scrollToPosition(mCurPosition + 1); - } - } - - @Override - public void onPrevCallback() { - if (mRecyclerView != null && mCurPosition > 0 && mCurPosition <= mV2XRoadEventAdapter.getItemCount() - 1) { - mRecyclerView.scrollToPosition(mCurPosition - 1); - } - } - }; - - public V2XRoadEventWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XRoadEventWindow(Context context) { - this(context, null); - } - - public V2XRoadEventWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XRoadEventWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - /** - * 初始化视图 - */ - private void initView(Context context) { - //Logger.d(MODULE_NAME, "V2X===初始化道路事件小窗口View。。。。。"); - // 填充布局 - LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this); - // 详情列表 - mBtnCloseWindow = findViewById(R.id.btnCloseWindow); - // 详情列表 - mRecyclerView = findViewById(R.id.rvRoadEventList); - - mBtnCloseWindow.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - close(); - } - }); - - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - //获得当前显示在第一个item的位置 - mCurPosition = layoutManager.findFirstCompletelyVisibleItemPosition(); - // 用户处于交互的时候延后隐藏时间 - startCountDown(); - } - } - } - }); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XRoadEventEntity entity) { - //Logger.d(MODULE_NAME, "V2X===道路事件详情:展示 Window:" + entity); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW, v2XVoiceCallbackCloseWindowListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, v2XVoiceCallbackCloseWindowListener) - .registerPagingCallback(v2XVoicePagingCallbackListener); - // 更新头部的窗体视图 - updateTopWindowInfo(entity); - - // 倒计时 - mExpireTime = entity.getExpireTime(); - startCountDown(); - } - - /** - * 更新头部的窗体视图 - */ - public void updateTopWindowInfo(V2XRoadEventEntity v2XRoadEventEntity) { - //Logger.d(MODULE_NAME, "V2X===道路事件详情:更新 Window:" + v2XRoadEventEntity); - - // 清空数据 - mItemList.clear(); - if (v2XRoadEventEntity != null) { - // 道路事件行驶到了50米附近,弹出事件纠错框给用户 - //Logger.d(MODULE_NAME, "V2X===道路事件:" + v2XRoadEventEntity); - - // 进行类型分发 - if (EventTypeEnum.TRAFFIC_CHECK.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.ROAD_CLOSED.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ROAD_WORK.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_PONDING.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_FOG.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ICE.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_01.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_02.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_03.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_04.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_ACCIDENT_05.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_LIVING.getPoiType().equals(v2XRoadEventEntity.getPoiType()) - || EventTypeEnum.FOURS_NEALY.getPoiType().equals(v2XRoadEventEntity.getPoiType())) { - // 展示道路事件本身详情 - if (mItemList.isEmpty()) { - V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity(); - v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); - v2XEventShowEntity.setV2XRoadEventEntity(v2XRoadEventEntity); - mItemList.add(v2XEventShowEntity); - } - // 获取道路事件周边的直播车机 - V2XServiceManager - .getV2XRefreshModel() - .queryNearbyVehicleLiveByLocation( - this, - v2XRoadEventEntity.getLocation().getLon(), - v2XRoadEventEntity.getLocation().getLat()); - } - } - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - } - - @Override - public void onSuccess(V2XLiveCarRes result) { - //Logger.d(MODULE_NAME, "V2X===事件周边的直播车机:" + result); - try { - if (!mItemList.isEmpty() && - result != null && - result.getResult() != null && - result.getResult().getInfo() != null && - result.getResult().getInfo().size() > 0) { - mItemList.get(0).setV2XLiveCarList(result.getResult().getInfo()); - } - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onFail(String msg) { - - } - - - /** - * 关闭详情展示框 - */ - @Override - public void close() { - //Logger.d(MODULE_NAME, "V2X===关闭 Window"); - // 注册语音交互 - V2XVoiceManager.INSTANCE.unRegisterPagingCallback(); - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT) - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_LIVE_ROAD) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR); - - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void startCountDown() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - //Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - //Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + mExpireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime); - } - - /** - * 停止倒计时 - */ - public void stopCountDown() { - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - } - - @Override - protected void release() { - super.release(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java deleted file mode 100644 index e338f39e97..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.road; - -import android.util.Log; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -import javax.security.auth.DestroyFailedException; -import javax.security.auth.Destroyable; - -public class V2XRoadVideoCarScenario extends AbsV2XScenario implements IMogoTopViewStatusListener, Destroyable { - - private static V2XRoadVideoCarScenario sV2XRoadVideoCarScenario; - private static String TAG = "V2XRoadVideoCarScenario"; - - public static V2XRoadVideoCarScenario getInstance() { - if (sV2XRoadVideoCarScenario == null) { - synchronized (V2XRoadVideoCarScenario.class) { - if (sV2XRoadVideoCarScenario == null) { - sV2XRoadVideoCarScenario = new V2XRoadVideoCarScenario(); - sV2XRoadVideoCarScenario.setV2XWindow(new V2XRoadVideoWindow()); - } - - } - } - return sV2XRoadVideoCarScenario; - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - try { - setV2XMessageEntity(v2XMessageEntity); - show(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - getV2XWindow().show(getV2XMessageEntity().getContent()); - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources() - .getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode()? R.dimen.dp_394:R.dimen.v2x_video_window_height)); - V2XServiceManager - .getMogoTopViewManager() - .addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); - V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - V2XServiceManager.getMoGoV2XStatusManager().setV2XRoadVideoWindowShow(TAG, false); - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().show(); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - } - - @Override - public void drawPOI() { - - } - - @Override - public void clearPOI() { - Log.d(TAG, "clearPOI"); - } - - - @Override - public void destroy() throws DestroyFailedException { - //Log.d(TAG, "destroy"); - } - - @Override - public boolean isDestroyed() { - //Log.d(TAG, "isDestroyed"); - return false; - } - - @Override - public void onViewAdded(View view) { - //Log.d(TAG, "onViewAdded"); - } - - @Override - public void onViewRemoved(View view) { - //Log.d(TAG, "onViewRemoved"); - } - - @Override - public void beforeViewAddAnim(View view) { - - //Log.d(TAG, "beforeViewAddAnim"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - //Log.d(TAG, "beforeViewRemoveAnim"); - ((V2XRoadVideoWindow) getV2XWindow()).pauseVideo(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java deleted file mode 100644 index cb39a0f279..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoWindow.java +++ /dev/null @@ -1,291 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.road; - -import android.content.Context; -import android.graphics.Bitmap; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; -import android.widget.RelativeLayout; - -import com.mogo.eagle.core.utilcode.util.BitmapHelper; -import com.mogo.map.IDestroyable; -import com.mogo.module.common.entity.MarkerExploreWayItem; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.view.SimpleCoverVideoPlayer; -import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; -import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack; -import com.shuyu.gsyvideoplayer.utils.GSYVideoType; -import com.shuyu.gsyvideoplayer.video.base.GSYVideoView; - -import java.util.ArrayList; - -import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL; - -/** - * https://github.com/CarGuo/GSYVideoPlayer/tree/master/doc SimpleCoverVideoPlayer文档 - */ -public class V2XRoadVideoWindow extends V2XBasWindow implements - IV2XWindow, IDestroyable { - - private static final String TAG = "V2XRoadVideoWindow"; - private V2XWindowStatusListener mV2XWindowStatusListener; - private ImageView playImageView; - private ImageView thumbnailImage; - private ImageView closeImage; - - - private SimpleCoverVideoPlayer simpleCoverVideoPlayer; - private Context mContext; - - private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); - - - public V2XRoadVideoWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XRoadVideoWindow(Context context) { - this(context, null); - mContext = context; - } - - public V2XRoadVideoWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - mContext = context; - } - - public V2XRoadVideoWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - mContext = context; - initView(mContext); - } - - private void initView(Context context) { - LayoutInflater.from(mContext).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.window_road_video_layout_vr : R.layout.window_road_video_layout, this); - playImageView = this.findViewById(R.id.window_video_play); - thumbnailImage = this.findViewById(R.id.thumbnail_image); - simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView); - GSYVideoType.setShowType(SCREEN_MATCH_FULL); - closeImage = this.findViewById(R.id.roadVideoClose); - closeImage.setOnClickListener(v -> { - close(); - }); - simpleCoverVideoPlayer.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if (simpleCoverVideoPlayer.getCurrentState() == GSYVideoView.CURRENT_STATE_PAUSE) {/*播放中*/ - resume(); - } else { - pause(); - } - } - }); - } - - /** - * 开始播放 - */ - private void startPlayWithVideoUrl(String videoUrl) { - gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) - .build(simpleCoverVideoPlayer); - simpleCoverVideoPlayer.getStartButton().performClick(); - thumbnailImage.setVisibility(View.GONE); - playImageView.setVisibility(View.GONE); - } - - /** - * 暂停 - */ - private void pause() { - playImageView.setVisibility(View.VISIBLE); - thumbnailImage.setVisibility(View.GONE); - playImageView.setOnClickListener(v -> { - simpleCoverVideoPlayer.onVideoResume(); - }); - thumbnailImage.setOnClickListener(v -> { - simpleCoverVideoPlayer.onVideoResume(); - }); - } - - /** - * 继续 - */ - private void resume() { - playImageView.setImageResource(R.drawable.v2x_video_pause); - playImageView.setVisibility(View.GONE); - thumbnailImage.setVisibility(View.GONE); - } - - /** - * 播放结束后 - */ - private void complete(Bitmap firstbitmap, String path) { - thumbnailImage.setVisibility(View.VISIBLE); - thumbnailImage.setImageBitmap(firstbitmap); - playImageView.setImageResource(R.drawable.v2x_icon_event_play); - playImageView.setVisibility(View.VISIBLE); - playImageView.setOnClickListener(v -> { - startPlayWithVideoUrl(path); - }); - thumbnailImage.setOnClickListener(v -> { - startPlayWithVideoUrl(path); - }); - } - - @Override - public void show(Object entity) { - V2XEventShowEntity showEntity = (V2XEventShowEntity) entity; - V2XRoadEventEntity xRoadEventEntity = showEntity.getV2XRoadEventEntity(); - ArrayList list = (ArrayList) xRoadEventEntity.getNoveltyInfo().getItems(); - if (list.size() > 0) { - MarkerExploreWayItem item = (MarkerExploreWayItem) list.get(0); - String path = item.getUrl(); - if (path == null) { - return; - } - if (path.contains(".mp4")) { - startPlayWithVideoUrl(path); - new Thread(new Runnable() { - @Override - public void run() { - Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(path);/*获取第一帧图*/ - simpleCoverVideoPlayer.setVideoAllCallBack(new VideoAllCallBack() { - @Override - public void onAutoComplete(String url, Object... objects) { - complete(firstBitmap, path); - } - - @Override - public void onClickResume(String url, Object... objects) { - thumbnailImage.setVisibility(View.GONE); - playImageView.setVisibility(View.GONE); - } - - @Override - public void onClickStop(String url, Object... objects) { - Log.d(TAG, "onClickStop"); - } - - @Override - public void onStartPrepared(String url, Object... objects) { - Log.d(TAG, "onStartPrepared"); - } - - @Override - public void onPrepared(String url, Object... objects) { - } - - @Override - public void onClickStartIcon(String url, Object... objects) { - } - - @Override - public void onClickStartError(String url, Object... objects) { - } - - @Override - public void onClickStopFullscreen(String url, Object... objects) { - } - - @Override - public void onClickResumeFullscreen(String url, Object... objects) { - } - - @Override - public void onClickSeekbar(String url, Object... objects) { - } - - @Override - public void onClickSeekbarFullscreen(String url, Object... objects) { - } - - @Override - public void onEnterFullscreen(String url, Object... objects) { - } - - @Override - public void onQuitFullscreen(String url, Object... objects) { - } - - @Override - public void onQuitSmallWidget(String url, Object... objects) { - } - - @Override - public void onEnterSmallWidget(String url, Object... objects) { - } - - @Override - public void onTouchScreenSeekVolume(String url, Object... objects) { - } - - @Override - public void onTouchScreenSeekPosition(String url, Object... objects) { - } - - @Override - public void onTouchScreenSeekLight(String url, Object... objects) { - } - - @Override - public void onPlayError(String url, Object... objects) { - } - - @Override - public void onClickStartThumb(String url, Object... objects) { - } - - @Override - public void onClickBlank(String url, Object... objects) { - } - - @Override - public void onClickBlankFullscreen(String url, Object... objects) { - Log.d(TAG, "onClickBlankFullscreen"); - - } - }); - } - }).start(); - } - } - } - - @Override - public void close() { - pauseVideo(); - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeViewNoLinkage(this); - } - - public void pauseVideo() { - if (simpleCoverVideoPlayer != null) { - simpleCoverVideoPlayer.onVideoPause(); - } - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - this.mV2XWindowStatusListener = listener; - } - - @Override - public void destroy() { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java deleted file mode 100644 index 08b14db1be..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventMarker.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.route; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes; -import com.mogo.module.v2x.observer.V2XOptimalRouteObserver; -import com.mogo.module.v2x.scenario.view.IV2XMarker; -import com.mogo.module.v2x.utils.MarkerUtils; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 推送VR场景 - * version: 1.0 - */ -public class V2XOptimalRouteVREventMarker implements IV2XMarker { - private final String TAG = "V2XPushVREventMarker"; - - @Override - public void drawPOI(V2XOptimalRouteDataRes entity) { - Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "drawPOI 绘制VR Marker"); - - try { - // 清除道路事件 - V2XServiceManager - .getMoGoV2XMarkerManager().clearALLPOI(); - // 绘制引导线 - V2XOptimalRouteObserver.getInstance() - .setPolylinePoint(entity.getGd_locus_list()); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void clearPOI() { - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - MarkerUtils.resetMapZoom(16); - // 移除线 - clearLine(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } - - public void clearLine() { - V2XOptimalRouteObserver.getInstance().setPolylinePoint(null); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventScenario.java deleted file mode 100644 index a30fa3736c..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventScenario.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.route; - -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 最优车道选择 - * version: 1.0 - * wiki : http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799 - */ -public class V2XOptimalRouteVREventScenario - extends AbsV2XScenario - implements IMogoTopViewStatusListener { - private String TAG = "V2XPushVREventWindow"; - - public V2XOptimalRouteVREventScenario() { - setV2XMarker(new V2XOptimalRouteVREventMarker()); - setV2XWindow(new V2XOptimalRouteVREventWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity)); - - if (!isSameScenario(v2XMessageEntity) - && V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) { - setV2XMessageEntity(v2XMessageEntity); - show(); - } else { - closeWindow(); - setV2XMessageEntity(v2XMessageEntity); - show(); - Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "要处理的场景已经存在,丢弃这次初始化"); - } - } - - @Override - public void show() { - if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { - speakTTSVoice("已为您选择最优路线", null); - drawPOI(); - showWindow(); - } - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false); - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - } - - @Override - public void showButton() { - if (getV2XButton() != null) { - getV2XButton().show(); - } - } - - @Override - public void closeButton() { - if (getV2XButton() != null) { - getV2XButton().close(); - } - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - getV2XMarker().drawPOI(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, true); - } - } - - @Override - public void clearPOI() { - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, false); - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - @Override - public void onViewAdded(View view) { - Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "展示 Window 动画结束"); - } - - @Override - public void onViewRemoved(View view) { - Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "关闭 Window 动画结束"); - } - - @Override - public void beforeViewAddAnim(View view) { - Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "展示 Window 开始"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "关闭 Window 开始"); - V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false); - // 重置场景提示的消息 - setV2XMessageEntity(null); - clearPOI(); - } - //////////////////////////////////////////////////////////////////////////////////////////////////// - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventWindow.java deleted file mode 100644 index 5bd2495122..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/route/V2XOptimalRouteVREventWindow.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.route; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/14 2:37 PM - * desc : - * TODO 只有VR演示场景使用 - * version: 1.0 - */ -public class V2XOptimalRouteVREventWindow - extends V2XBasWindow - implements IV2XWindow { - private String TAG = "V2XPushVREventWindow"; - - // 处理道路事件,30秒倒计时 - private Handler handlerV2XEvent = new Handler(); - private Runnable runnableV2XEvent; - private int mExpireTime = 30000; - - public V2XOptimalRouteVREventWindow() { - this(V2XServiceManager.getContext()); - } - - public V2XOptimalRouteVREventWindow(Context context) { - this(context, null); - } - - public V2XOptimalRouteVREventWindow(Context context, AttributeSet attrs) { - this(V2XServiceManager.getContext(), null, 0); - } - - public V2XOptimalRouteVREventWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - // 填充布局 - LayoutInflater.from(context).inflate(R.layout.vr_window_top_tips, this); - } - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XOptimalRouteDataRes entity) { - - countDownV2XEvent(); - } - - /** - * 关闭详情展示框 - */ - @Override - public void close() { - Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=关闭Window"); - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent() { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息 Window 展示开始倒计时:" + mExpireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpMarker.java deleted file mode 100644 index a5531efdb5..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpMarker.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.seek; - -import android.content.Context; - -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity; -import com.mogo.module.v2x.listener.V2XMarkerClickListener; -import com.mogo.module.v2x.scenario.view.IV2XMarker; -import com.mogo.module.v2x.utils.MarkerUtils; - -import java.util.List; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.scenario.view - * @ClassName: V2XSeekHelpMarker - * @Description: java类作用描述 - * @Author: fenghl - * @CreateDate: 2020/5/18 10:48 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/5/18 10:48 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public class V2XSeekHelpMarker implements IV2XMarker> { - - @Override - public void drawPOI(List entity) { - // 移除上一次的数据 - Context context = V2XServiceManager.getContext(); - for (V2XMarkerEntity coordinate : entity) { - //故障车机 - if (EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(coordinate.getTargetId()+"")) { - //绘制 - V2XServiceManager - .getMoGoV2XMarkerManager() - .drawableSpecialCarPOI(context, coordinate, V2XMarkerClickListener.getInstance()); - } - } - } - - @Override - public void clearPOI() { - // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 - MarkerUtils.resetMapZoom(16); - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearSpecialCarPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpScenario.java deleted file mode 100644 index f218c859cd..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpScenario.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.seek; - -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.module.v2x.utils.ADASUtils; -import com.mogo.module.v2x.utils.V2XSQLiteUtils; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 故障求助场景 - * version: 1.0 - */ -public class V2XSeekHelpScenario extends AbsV2XScenario> implements IMogoTopViewStatusListener { - - - public V2XSeekHelpScenario() { - setV2XWindow(new V2XSeekHelpWindow()); - // TODO 这里引起了地图的崩溃,由于本次交付不包含此功能,所以先注释掉 2021-12-13 - //setV2XMarker(new V2XSeekHelpMarker()); - } - - private List mMarkerEntity; - private V2XPushMessageEntity mV2XPushMessageEntity; - - @Override - public void init(@Nullable V2XMessageEntity> v2XMessageEntity) { - try { - setV2XMessageEntity(v2XMessageEntity); - - // 广播给ADAS和Launcher卡片 - V2XRoadEventEntity eventEntity = new V2XRoadEventEntity(); - eventEntity.setPoiType(EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType()); - eventEntity.setExpireTime(30000); - eventEntity.setTts("发现其他车主的求助信息"); - eventEntity.setAlarmContent("其他车主求助"); - ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity); - - mMarkerEntity = getV2XMessageEntity().getContent(); - - V2XMarkerEntity markerEntity = mMarkerEntity.get(0); - mV2XPushMessageEntity = new V2XPushMessageEntity(); - mV2XPushMessageEntity.setLon(markerEntity.getLon()); - mV2XPushMessageEntity.setLat(markerEntity.getLat()); - mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName()); - mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl()); - mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex()); - mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn()); - mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime()); - mV2XPushMessageEntity.setDistance(markerEntity.getDistance()); - mV2XPushMessageEntity.setExpireTime(20000); - - saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING, mV2XPushMessageEntity); - - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - if (getV2XMessageEntity() != null && - !V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) { - show(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - if (getV2XWindow() != null && mMarkerEntity != null) { - View view = getV2XWindow().getView(); - //Logger.d(MODULE_NAME, "添加window= " + view); - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(mV2XPushMessageEntity); - } - } - - @Override - public void closeWindow() { - if (V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) { - //Logger.d(MODULE_NAME, "关闭求助车辆的Window!"); - V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpWindowShow(TAG, false); - if (getV2XWindow() != null) { - View view = getV2XWindow().getView(); - //Logger.d(MODULE_NAME, "移除window= " + view); - getV2XWindow().close(); - } - } - } - - @Override - public void showButton() { - - } - - @Override - public void closeButton() { - - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null && mMarkerEntity != null) { - getV2XMarker().drawPOI(mMarkerEntity); - } - } - - @Override - public void clearPOI() { - if (getV2XMarker() != null) { - getV2XMarker().clearPOI(); - } - } - - @Override - public void onViewAdded(View view) { - //Logger.d(MODULE_NAME, "展示 Window 动画结束"); - V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpWindowShow(TAG, true); - drawPOI(); - } - - @Override - public void onViewRemoved(View view) { - //Logger.d(MODULE_NAME, "关闭 Window 动画结束"); - } - - @Override - public void beforeViewAddAnim(View view) { - //Logger.d(MODULE_NAME, "展示 Window 开始"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - //Logger.d(MODULE_NAME, "关闭 Window 开始"); - V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpWindowShow(TAG, false); - // 重置场景提示的消息 - setV2XMessageEntity(null); - clearPOI(); - } - - /** - * 存储本地数据 - * - * @param messageEntity 要存储的场景 - */ - private void saveLocalStory(int scenarioType, V2XPushMessageEntity messageEntity) { - try { - V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpWindow.java deleted file mode 100644 index ba5c235520..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/seek/V2XSeekHelpWindow.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.seek; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import java.util.ArrayList; -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 他人发起的故障求助 - * version: 1.0 - */ -public class V2XSeekHelpWindow extends V2XBasWindow implements IV2XWindow { - private static final String TAG = "V2XSeekHelpWindow"; - - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private List mItemList = new ArrayList<>(); - - // 直播30秒自动关闭 - private static Handler handlerV2XEvent = new Handler(); - private static Runnable runnableV2XEvent; - - // 推荐的停车场 - private V2XPushMessageEntity mV2XPushMessageEntity; - - public V2XSeekHelpWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XSeekHelpWindow(Context context) { - this(context, null); - } - - public V2XSeekHelpWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XSeekHelpWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - //Logger.w(MODULE_NAME, "初始化道路故障求助窗口View。。。。。"); - LayoutInflater.from(context).inflate(R.layout.window_fault_help, this); - // 详情列表 - mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - // 用户处于交互的时候延后隐藏时间 - countDownV2XEvent(); - } - } - } - }); - } - - @Override - public void show(V2XPushMessageEntity xPushMessageEntity) { - if (xPushMessageEntity != null) { - mV2XPushMessageEntity = xPushMessageEntity; - // 清空数据 - mItemList.clear(); - //Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity); - V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity(); - v2XEventShowEntity.setV2XPushMessageEntity(xPushMessageEntity); - v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING); - mItemList.add(v2XEventShowEntity); - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - countDownV2XEvent(); - } - } - - @Override - public void close() { - //Logger.d(TAG, "移除window= " + this); - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent() { - if (mV2XPushMessageEntity != null) { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - //Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - int expireTime = mV2XPushMessageEntity.getExpireTime(); - //Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/ugc/V2XEventUgcScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/ugc/V2XEventUgcScenario.java deleted file mode 100644 index 6eb1b8601c..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/ugc/V2XEventUgcScenario.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.ugc; - -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:37 PM - * desc : 道路事件UGC - * 需求地址 - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 - * version: 1.0 - */ -public class V2XEventUgcScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { - - public V2XEventUgcScenario() { - setV2XWindow(new V2XEventUgcWindow()); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - if (!isSameScenario(v2XMessageEntity)) { - setV2XMessageEntity(v2XMessageEntity); - if (v2XMessageEntity != null) { - if (v2XMessageEntity.isShowState() - && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - show(); - } - } - } else { - setV2XMessageEntity(v2XMessageEntity); - Logger.w(V2XConst.MODULE_NAME, "疲劳驾驶场景,要处理的场景已经存在,丢弃这次初始化"); - } - } - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(getV2XMessageEntity().getContent()); - V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, true); - } - } - - @Override - public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } - } - - @Override - public void showButton() { - } - - @Override - public void closeButton() { - } - - @Override - public void drawPOI() { - } - - @Override - public void clearPOI() { - } - - @Override - public void onViewAdded(View view) { - //Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 动画结束"); - } - - @Override - public void onViewRemoved(View view) { - //Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 动画结束"); - } - - @Override - public void beforeViewAddAnim(View view) { - //Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 开始"); - - } - - @Override - public void beforeViewRemoveAnim(View view) { - //Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 开始"); - // 重置场景提示的消息 - setV2XMessageEntity(null); - V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, false); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/ugc/V2XEventUgcWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/ugc/V2XEventUgcWindow.java deleted file mode 100644 index d8de3028d3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/ugc/V2XEventUgcWindow.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.ugc; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.RelativeLayout; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.PagerSnapHelper; -import androidx.recyclerview.widget.RecyclerView; - -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.V2XEventShowEntity; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.adapter.V2XRoadEventAdapter; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import java.util.ArrayList; -import java.util.List; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/24 11:34 AM - * desc : 道路事件UGC - * 需求地址 - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443 - * version: 1.0 - */ -public class V2XEventUgcWindow extends V2XBasWindow - implements IV2XWindow { - // 展示列表 - private RecyclerView mRecyclerView; - // 列表数据适配器 - private V2XRoadEventAdapter mV2XRoadEventAdapter; - // 列表展示 - private List mItemList = new ArrayList<>(); - - // 直播30秒自动关闭 - private static Handler handlerV2XEvent = new Handler(); - private static Runnable runnableV2XEvent; - - // - private V2XRoadEventEntity mV2XRoadEventEntity; - - public V2XEventUgcWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XEventUgcWindow(Context context) { - this(context, null); - } - - public V2XEventUgcWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XEventUgcWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - public void initView(Context context) { - Logger.w(MODULE_NAME, "V2X-初始化UGC的Window"); - LayoutInflater.from(context).inflate(R.layout.window_fault_help, this); - // 详情列表 - mRecyclerView = findViewById(R.id.rvRoadEventList); - mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this); - mRecyclerView.setAdapter(mV2XRoadEventAdapter); - // 设置切换样式 - new PagerSnapHelper().attachToRecyclerView(mRecyclerView); - // 配置列表朝向 - LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); - mRecyclerView.setLayoutManager(layoutManager); - mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (recyclerView.getChildCount() > 0) { - if (newState == RecyclerView.SCROLL_STATE_IDLE) { - // 用户处于交互的时候延后隐藏时间 - countDownV2XEvent(); - } - } - } - }); - } - - - /** - * 展示道路事件详情Windows - */ - @Override - public void show(V2XRoadEventEntity entity) { - if (entity != null) { - mV2XRoadEventEntity = entity; - // 清空数据 - mItemList.clear(); - //Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity); - V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity(); - v2XEventShowEntity.setV2XRoadEventEntity(mV2XRoadEventEntity); - v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING); - mItemList.add(v2XEventShowEntity); - // 刷新列表 - mV2XRoadEventAdapter.notifyDataSetChanged(); - - countDownV2XEvent(); - } - } - - @Override - public void close() { - // 停止倒计时 - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - } - - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - } - - /** - * 窗体倒计时 - */ - public void countDownV2XEvent() { - if (mV2XRoadEventEntity != null) { - // 倒计时 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - //Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。"); - // 移出Window详细信息 - close(); - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - int expireTime = mV2XRoadEventEntity.getExpireTime(); - //Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime); - handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java deleted file mode 100644 index ec6e48687f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.warning; - -import android.location.Location; -import android.util.Log; -import android.view.View; -import android.view.ViewGroup; - -import androidx.annotation.Nullable; - -import com.google.protobuf.DescriptorProtos; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; -import com.mogo.eagle.core.utilcode.util.ObjectUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.map.navi.IMogoCarLocationChangedListener2; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; -import com.mogo.service.windowview.IMogoTopViewStatusListener; - -/** - * @author liujing - * @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警 - * @since: 2021/3/24 - */ -public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener ,IMoGoMapLocationListener{ - private static final String TAG = "V2XWarningMarker"; - private V2XWarningEntity mMarkerEntity; - static private V2XWarningMarker sV2XWarningMarker = new V2XWarningMarker(); - - public V2XFrontWarningScenario() { - setV2XWindow(new V2XWarningWindow()); - setV2XMarker(sV2XWarningMarker); - } - - @Override - public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - Log.d(TAG, "----- init -----:\n" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); - try { - if (v2XMessageEntity.getContent() != null) { - if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent(); - show(); - } - } else { - - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void show() { - showWindow(); - } - - @Override - public void showWindow() { - Log.d(TAG, "----- showWindow --- 1 --:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); - if (getV2XWindow() != null && mMarkerEntity != null) { - Log.d(TAG, "----- showWindow --- 2 --:\n" + mMarkerEntity.toString()); - ViewGroup.LayoutParams layoutParams = - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground)); - V2XServiceManager - .getMogoTopViewManager() - .addView(getV2XWindow().getView(), layoutParams, this); - getV2XWindow().show(mMarkerEntity); - getV2XMarker().drawPOI(mMarkerEntity); - } - } - - @Override - public void closeWindow() { - Log.d(TAG, "----- closeWindow -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); - } - - @Override - public void showButton() { - Log.d(TAG, "----- showButton -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); - } - - @Override - public void closeButton() { - Log.d(TAG, "----- closeButton -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); - } - - @Override - public void drawPOI() { - if (getV2XMarker() != null) { - getV2XMarker().drawPOI(mMarkerEntity); - Log.d(TAG, "drawPOI"); - } - } - - @Override - public void clearPOI() { - Log.d(TAG, "----- clearPOI -----"); - } - - @Override - public void onViewAdded(View view) { - - Log.d(TAG, "----- onViewAdded -----"); - } - - @Override - public void onViewRemoved(View view) { - Log.d(TAG, "----- onViewRemoved -----"); - } - - @Override - public void beforeViewAddAnim(View view) { - Log.d(TAG, "----- beforeViewAddAnim -----"); - } - - @Override - public void beforeViewRemoveAnim(View view) { - Log.d(TAG, "----- beforeViewRemoveAnim -----"); - } - -// @Override -// public void onCarLocationChanged2(Location latLng) { -// sV2XWarningMarker.onCarLocationChanged2(latLng); -// } - - - @Override - public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location) { - sV2XWarningMarker.onCarLocationChanged2(location); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java deleted file mode 100644 index 2cc78d7393..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ /dev/null @@ -1,431 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.warning; - -import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA; -import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA; -import static com.mogo.module.v2x.V2XConst.V2X_FRONT_WARNING_MARKER; -import static com.mogo.module.v2x.V2XServiceManager.getContext; - -import android.util.Log; - -import com.mogo.cloud.commons.utils.CoordinateUtils; -import com.mogo.eagle.core.data.enums.WarningDirectionEnum; -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; -import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.drawer.V2XWarnDataDrawer; -import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.common.utils.Trigonometric; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.model.DrawLineInfo; -import com.mogo.module.v2x.listener.V2XLocationListener; -import com.mogo.module.v2x.scenario.view.IV2XMarker; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * @author liujing - * @description 前方预警marker打点 绘制安全线和预警线 衡阳交付-取消划线需求,只渲染识别物红色模型移动过程,代码保留 - * @since: 2021/3/30 - */ -public class V2XWarningMarker implements IV2XMarker { - private static final String TAG = "V2XWarningMarker"; - private static String WARNING_ARROWS = "WARNING_ARROWS"; - private V2XWarningEntity mCloundWarningInfo; - private boolean isSelfLineClear = true;//绘制线是否已被清除 - private List fillPoints = new ArrayList();//停止线经纬度合集 - private boolean isFirstLocation = false; - private MogoLatLng carLocation = new MogoLatLng( - MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), - MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon() - ); - - /* - * 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算 - * */ - private MogoLatLng middleLocationInStopLine = new MogoLatLng(0, 0); - private static long showTime = 6000; - private float bearing; - private boolean hasStopLines = false; - - @Override - public void drawPOI(Object entity) { - try { - Log.d(TAG, "===drawPOI"); - mCloundWarningInfo = (V2XWarningEntity) entity; - drawLineWithEntity(); - - } catch (Exception e) { - Log.d(TAG, e.toString()); - } - - } - - public void drawLineWithEntity() { - showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() * 1000 : 6000; - - fillPointOnStopLine(); - bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing(); - if (mCloundWarningInfo != null && mCloundWarningInfo.getStopLines() != null) { - hasStopLines = mCloundWarningInfo.getStopLines().size() > 0; - } - isSelfLineClear = false; - isFirstLocation = false; - if (fillPoints != null && fillPoints.size() > 0) { - //存在停止线的情况 自车与停止线之间绘制蓝色安全线 停止线向前50m绘制红色预警线 - middleLocationInStopLine = getMiddleLocationInStopLine(); - //停止线前方画线 - WorkThreadHandler.getInstance().postDelayed(() -> { - if (carLocation.lat != 0 && carLocation.lon != 0) { - //在自车与停止线直线绘制蓝色预警线 - //衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 - //drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); - } else { - } - //二轮车和行人的渲染和移动 - V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); - /* 衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 - //获取停止线前方50m坐标点 - MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, - 50, angleForCarMoveDirection()); - //停止线向前方50m绘制红色预警线 - drawRedWarningLineFrontOfStopLine(mCloundWarningInfo, middleLocationInStopLine, - warningLocation); - - */ - V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo); - - //添加停止线marker - //衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 - //handleStopLine(); - }, 0); - Log.d(TAG, "显示时间为++" + String.valueOf(showTime) + "识别物类型:" + - String.valueOf(mCloundWarningInfo.getType())); - clearAllLine(); - - } else { //无停止线 - Log.d(TAG, "无停止线"); - WorkThreadHandler.getInstance().postDelayed(() -> { - /* 衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 - Log.d(TAG, "无停止线" + mCloundWarningInfo.toString()); - //绘制识别物与交汇点连线,并且更新连线数据 - drawOtherObjectLine(mCloundWarningInfo); - //二轮车和行人的渲染和移动 - V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); - if (carLocation.lat != 0 && carLocation.lon != 0) { - drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); - } else { - Log.d(TAG, "数据为空carLocation == null"); - } - */ - V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo); - - }, 0); - - clearAllLine(); - } - //预警蒙层 - WarningDirectionEnum warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_ALL; - switch (mCloundWarningInfo.getDirection()) { - case 0: - warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_NON; - break; - case 1: - warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_TOP; - break; - case 2: - warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_BOTTOM; - break; - case 3: - warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_LEFT; - break; - case 4: - warningDirectionEnum = WarningDirectionEnum.ALERT_WARNING_RIGHT; - break; - } - CallerHmiManager.INSTANCE.showWarning(warningDirectionEnum); - - } - - /* - * - * */ - public double angleForCarMoveDirection() { - MogoLatLng startLatLng = new MogoLatLng(carLocation.lat, carLocation.lon); - MogoLatLng endLatLng = new MogoLatLng(middleLocationInStopLine.lat, middleLocationInStopLine.lon); - double angle = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); - Log.d(TAG, "angle==" + String.valueOf(angle)); - return angle; - } - - - /*绘制停止线前方50m的红色预警线 - * startLatLng: 划线起点=停止线上的坐标点 - * mogoLatLng: 停止线前方50m坐标点 - * */ - private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng - startLatLng, MogoLatLng mogoLatLng) { - if (info != null) { - double angle = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, mogoLatLng.lon, mogoLatLng.lat); - Log.d(TAG, "angle==drawRedWarningLineFrontOfStopLine:" + String.valueOf(angle)); - IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline(); - MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon); - MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, 25, angle); - if (polyLine != null) { - Log.d(TAG, "drawStopLine polyLine != null"); - polyLine.setPoints(Arrays.asList(startLatLng, addMiddleLoc, endLatlng)); - polyLine.setTransparency(0.5f); - } else { - DrawLineInfo lineInfo = new DrawLineInfo(); - List locations = new ArrayList(); - locations.add(startLatLng); - locations.add(addMiddleLoc); - locations.add(endLatlng); - lineInfo.setLocations(locations); - lineInfo.setHeading(info.heading); - Log.d(TAG, "drawStopLine width = " + info.getRoadwidth()); - lineInfo.setWidth(info.getRoadwidth() * 14 + 5); - V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo); - } - Log.d(TAG, "停止线前方50m区域的三个坐标点是:" + startLatLng.lon + "," + startLatLng.lat + - "中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat - + "终点" + endLatlng.lon + "," + endLatlng.lat); - } else { - clearAllLine(); - } - } - - public void clearAllLine() { - UiThreadHandler.postDelayed(() -> { - Log.d(TAG, "清除所有预警线的时间是:" + String.valueOf(showTime)); - //清除识别物到碰撞点预警线 - V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - //清除车前方第一条预警线 - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - //清除停止线 - V2XServiceManager.getMoGoStopPolylineManager().clearLine(); - //清除小箭头 - V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS); - //清除停止线 - V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA); - isSelfLineClear = true; - }, showTime); - } - - /** - * 补点后的停止线经纬度合集 - */ - public void fillPointOnStopLine() { - try { - fillPoints.clear(); - List stopLines = mCloundWarningInfo.getStopLines(); - if (stopLines != null && stopLines.size() > 1) { - MogoLatLng x = mCloundWarningInfo.getStopLines().get(0); - MogoLatLng y = mCloundWarningInfo.getStopLines().get(1); - //两点间的距离 - float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat); - float average = distance / 3; - //两点间的角度 - double angle = Trigonometric.getAngle(x.lon, x.lat, y.lon, y.lat); - //根据距离和角度获取下个点的经纬度 - fillPoints.add(x); - for (int i = 1; i < 3; i++) { - MogoLatLng newLocation = Trigonometric.getNewLocation(x, average * i, angle); - fillPoints.add(newLocation); - } - fillPoints.add(y); - } else { - Log.d(TAG, "停止线数据不存在"); - } - } catch (Exception e) { - Log.d(TAG, "Exception"); - e.printStackTrace(); - } - } - - /* - * 停止线绘制 - * */ - private void handleStopLine() { - try { - if (mCloundWarningInfo != null) { - V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA); - for (int i = 0; i < fillPoints.size(); i++) { - V2XWarningEntity entity = new V2XWarningEntity(); - MogoLatLng latLng = (MogoLatLng) fillPoints.get(i); - entity.setLat(latLng.lat); - entity.setLon(latLng.lon); - entity.heading = mCloundWarningInfo.heading; - V2XWarnDataDrawer.getInstance().renderStopLineData(entity); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - private MogoLatLng getMogoLat(MogoLatLng latlng) { - MogoLatLng newLocation = Trigonometric.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), - mCloundWarningInfo.getAngle()); - return newLocation; - } - - /* - * 自车前方的点,落点在停止线上--通过自车位置与距离停止线之间的距离计算 - * */ - private MogoLatLng getMiddleLocationInStopLine() { - if (carLocation.lat == 0 || carLocation.lon == 0) { - Log.d(TAG, "获取不到车的位置"); - } - MogoLatLng newLocation = new MogoLatLng(0, 0); - if (mCloundWarningInfo != null && mCloundWarningInfo.getStopLines() != null && mCloundWarningInfo.getStopLines().size() > 1) { - MogoLatLng x = mCloundWarningInfo.getStopLines().get(0); - MogoLatLng y = mCloundWarningInfo.getStopLines().get(1); - float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat); - double angle = Trigonometric.getAngle(x.lon, x.lat, y.lon, y.lat); - newLocation = Trigonometric.getNewLocation(x, distance * 0.5, angle); - } else { - Log.d(TAG, "停止线返回坐标点数量不正确" + String.valueOf(mCloundWarningInfo.getStopLines().size())); - } - return newLocation; - } - - /** - * 存在停止线时自车与停止线之间为蓝色预警 - * 不存在停止线,自车与预碰撞点之间为红色预警 - * lon 自车经度 - * lat 自车纬度 - */ - public void drawSelfCarLine(double lon, double lat, float bearing) { - Log.d(TAG, "drawSelfCarLine"); - if (!isSelfLineClear) { - if (mCloundWarningInfo != null) { - IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); - MogoLatLng startLatlng = new MogoLatLng(0, 0); - MogoLatLng endLatlng = new MogoLatLng(0, 0); - MogoLatLng addMiddleLoc = new MogoLatLng(0, 0); - - if (!isFirstLocation) { - carLocation = getMogoLat(new MogoLatLng(lat, lon)); - isFirstLocation = true; - } - //绘制线的终点(在停止线上或者预碰撞点上) - endLatlng = new MogoLatLng(hasStopLines ? - middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(), hasStopLines ? - middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon()); - - startLatlng = new MogoLatLng(lat, lon); - float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat); - //扩展点为了渐变色添加 - addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, - Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat)); - Log.d(TAG, "angle==扩展点为了渐变色添加:" + - String.valueOf(Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat))); - if (mogoPolyline != null) { - mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); - mogoPolyline.setTransparency(0.5f); - } else { - DrawLineInfo info = new DrawLineInfo(); // 对象 - List locations = new ArrayList(); - locations.add(startLatlng); - locations.add(addMiddleLoc); - locations.add(endLatlng); - info.setLocations(locations); - info.setHeading(bearing); - info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5); - if (mCloundWarningInfo.getStopLines() != null) { - info.setHasStopLines(mCloundWarningInfo.getStopLines().size() > 0); - } - V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); - Log.d(TAG, "自车前方第一条线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); - } - Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat + - "中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat); - } else { - clearAllLine(); - } - } - } - - /** - * 侧方目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置 - */ - private void drawOtherObjectLine(V2XWarningEntity info) { - if (info != null) { - Log.d(TAG, "info != null"); - IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline(); - MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());//识别物坐标 - MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());//预碰撞点坐标 - float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);//识别物到碰撞点之间的距离 - MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, - Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));//补点 - if (polyLine != null) { - Log.d(TAG, "目标物与碰撞点连线 != null"); - polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); - polyLine.setTransparency(0.5f); - } else { - //识别物到预碰撞点之间的箭头 - addArrows(startLatlng, endLatlng); - DrawLineInfo lineInfo = new DrawLineInfo(); - List locations = new ArrayList(); - locations.add(startLatlng); - locations.add(addMiddleLoc); - locations.add(endLatlng); - lineInfo.setLocations(locations); - lineInfo.setHeading(info.heading); - lineInfo.setWidth(info.getRoadwidth() * 14 + 5); - V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo); - Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); - } - } else { - Log.e(TAG, "info == null"); - clearAllLine(); - } - } - - //侧面目标物与碰撞点之间添加多个小箭头 - private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) { - float distance = CoordinateUtils.calculateLineDistance( - startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); - double rotate = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); - Log.d(TAG, "添加小箭头--目标物与预碰撞点之间的距离是" + String.valueOf(distance)); - if (distance > 5) { - int count = (int) (distance / 5); - for (int i = 0; i < count; i++) { - MogoLatLng newLo = Trigonometric.getNewLocation( - startLatLng, 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat)); - V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue()); - Log.d(TAG, "小箭头位置" + newLo); - } - } - - } - - //线随车动 - public void onCarLocationChanged2(MogoLocation latLng) { - carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); - if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) { - if (mCloundWarningInfo != null) { - mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude())); - } - //衡阳交付-取消划线需求,只渲染识别物红色模型移动过程 - //drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing()); - } - Log.d(TAG, "车辆行驶轨迹" + String.valueOf(latLng.getLongitude()) + "," + String.valueOf(latLng.getLatitude())); - } - - @Override - public void clearPOI() { - V2XServiceManager.getMarkerManager().removeMarkers(V2X_FRONT_WARNING_MARKER); - } - - public void clearLine() { - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java deleted file mode 100644 index 71bb06e681..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.warning; - -import android.content.Context; -import android.os.Handler; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; - -import java.math.BigDecimal; - -/** - * @author liujing - * @description 车路云—场景预警 http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799 - * @since: 2021/3/25 - */ -public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { - private static final String TAG = "V2XWarningMarker"; - private ImageView typeImage; - private TextView warningTextView; - private TextView distance; - private V2XWarningEntity mV2XWarningEntity; - - //倒计时3s弹框取消 - private static Handler handlerV2XEvent = new Handler(); - private static Runnable runnableV2XEvent; - private static final int COUNT_DOWN_TIMER = 1_000; - private static final int ALL_EXPIRE_TIMER = 3_000; - private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER; - - public V2XWarningWindow() { - this(V2XServiceManager.getContext(), null); - } - - public V2XWarningWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XWarningWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - LayoutInflater.from(context).inflate(R.layout.v2x_road_front_warning_vr, this); - typeImage = findViewById(R.id.warning_type_image); - - warningTextView = findViewById(R.id.warning_content_text); - distance = findViewById(R.id.warning_distance); - } - - @Override - public void show(Object entity) { - if (entity != null) { - mV2XWarningEntity = (V2XWarningEntity) entity; - Log.d(TAG, mV2XWarningEntity.toString()); - //1行人/2自行车/4摩托车 - switch (mV2XWarningEntity.getType()) { - case 1: - case 11: - typeImage.setImageResource(R.drawable.v2x_road_front_p_warning); - break; - case 2: - case 4: - typeImage.setImageResource(R.drawable.v2x_road_front_m_warning); - break; - default: - break; - } - double dis = mV2XWarningEntity.getDistance(); - //距离四舍五入保留整数 - BigDecimal bg = new BigDecimal(dis); - double disBig = bg.setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue(); - distance.setText(String.format("%.0f", disBig) + "米"); - warningTextView.setText(mV2XWarningEntity.getWarningContent());//验证云端数据是否 - AIAssist.getInstance(Utils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts()); - } - //3秒后移除提示弹框 - if (runnableV2XEvent == null) { - runnableV2XEvent = () -> { - EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER; - if (EXPIRE_TIMER > 0) { - handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER); - } else { - stopCountDown(); - } - }; - } else { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - } - handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER); - - } - - @Override - public void close() { - stopCountDown(); - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - - } - - private void stopCountDown() { - if (handlerV2XEvent != null && runnableV2XEvent != null) { - handlerV2XEvent.removeCallbacks(runnableV2XEvent); - runnableV2XEvent = null; - EXPIRE_TIMER = ALL_EXPIRE_TIMER; - } - //移除窗体 - V2XServiceManager - .getMogoTopViewManager() - .removeView(this); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XButton.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XButton.java deleted file mode 100644 index 9ff7d04cc0..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XButton.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.module.v2x.scenario.view; - - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 5:02 PM - * desc : - * version: 1.0 - */ -public interface IV2XButton { - /** - * 设置监听器,处理button点击和语音唤醒 - * @param listener - */ - void setOnActionListener(IV2XButtonListener listener); - - /** - * 按钮显示 - */ - void show(); - - /** - * 按钮关闭 - */ - void close(); - - /** - * 语音注册 - */ - void registerVoice(); - - /** - * 语音反注册 - */ - void unRegisterVoice(); - -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XButtonListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XButtonListener.java deleted file mode 100644 index 6d9876fc99..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XButtonListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.module.v2x.scenario.view; - -import android.view.View; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.scenario.view - * @ClassName: IV2XButtonListener - * @Description: java类作用描述 - * @Author: fenghl - * @CreateDate: 2020/5/18 15:58 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/5/18 15:58 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public interface IV2XButtonListener { - /** - * 响应点击或语音触发事件 - */ - void onAction(); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XMarker.java deleted file mode 100644 index eb46fdef6a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XMarker.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.module.v2x.scenario.view; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 4:13 PM - * desc : V2X安全驾驶场景接口 - * version: 1.0 - */ -public interface IV2XMarker { - - void drawPOI(T entity); - - void clearPOI(); - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XWindow.java deleted file mode 100644 index 55159f0338..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/view/IV2XWindow.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.mogo.module.v2x.scenario.view; - -import android.view.View; - -import com.mogo.module.v2x.listener.V2XWindowStatusListener; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.statusmanager - * @ClassName: IV2XWindow - * @Description: java类作用描述 - * @Author: fenghl - * @CreateDate: 2020/5/15 11:24 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/5/15 11:24 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public interface IV2XWindow { - - /** - * 展示1/2窗口 - */ - void show(T entity); - - /** - * 关闭1/2窗口 - */ - void close(); - - /** - * 返回窗体 - * - * @return 当前窗体 - */ - View getView(); - - /** - * 设置Window状态监听 - * - * @param listener 监听器 - */ - void setWindowStatusListener(V2XWindowStatusListener listener); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ADASUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ADASUtils.java deleted file mode 100644 index 0126ea5d87..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ADASUtils.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.mogo.module.v2x.utils; - -import android.content.Context; -import android.content.Intent; -import android.text.TextUtils; - -import androidx.annotation.Nullable; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.commons.voice.IMogoVoiceCmdCallBack; -import com.mogo.commons.voice.VoicePreemptType; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.AppUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.entity.net.V2XAlarmEventRes; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/3 6:54 PM - * desc : - * version: 1.0 - */ -public class ADASUtils { - /** - * 广播给ADAS进行展示 - * - * @param v2XRoadEventEntity 广播信息 - */ - public static void broadcastToADAS(Context context, V2XRoadEventEntity v2XRoadEventEntity) { - try { - V2XPushMessageEntity v2XAlarmMessage = new V2XPushMessageEntity(); - v2XAlarmMessage.setTts(v2XRoadEventEntity.getTts()); - v2XAlarmMessage.setAlarmContent(v2XRoadEventEntity.getAlarmContent()); - v2XAlarmMessage.setExpireTime(v2XRoadEventEntity.getExpireTime()); - v2XAlarmMessage.setSceneId(v2XRoadEventEntity.getPoiType()); - - broadcastToADAS(context, v2XAlarmMessage); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 广播给ADAS进行展示 - * - * @param alarmInfo 广播信息 - */ - public static void broadcastToADAS(Context context, V2XAlarmEventRes.AlarmInfo alarmInfo) { - try { - V2XPushMessageEntity v2XAlarmMessage = new V2XPushMessageEntity(); - v2XAlarmMessage.setTts(alarmInfo.getTts()); - v2XAlarmMessage.setAlarmContent(alarmInfo.getAlarmContent()); - v2XAlarmMessage.setExpireTime(alarmInfo.getExpireTime()); - v2XAlarmMessage.setSceneId(alarmInfo.getPoiType()); - - broadcastToADAS(context, v2XAlarmMessage); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 广播给ADAS进行展示 - * - * @param alarmMessage 广播信息 - */ - public static void broadcastToADAS(Context context, V2XPushMessageEntity alarmMessage) { - try { - Intent intent = new Intent("com.mogo.launcher.v2x"); - intent.putExtra("v2x_warning_type", alarmMessage.getSceneId()); - intent.putExtra("v2x_warining_timeout", alarmMessage.getExpireTime()); - intent.putExtra("v2x_warning_tts", alarmMessage.getTts()); - intent.putExtra("v2x_warning_info", alarmMessage.getAlarmContent()); - context.sendBroadcast(intent); - - // 这里是兼容 1+16G 版本没有ADAS的时候自身进行TTS - if (!AppUtils.isAppInstalled(context, "com.zhidao.autopilot")) { - speakTTSVoice(alarmMessage.getTts(), null); - } - - Logger.i(MODULE_NAME, "向ADAS分发服务器下发的事件," + alarmMessage.toString()); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 广播给ADAS进行展示 - * - * @param alarmInfo 广播信息 - */ - public static void broadcastToADAS_TTS(Context context, V2XAlarmEventRes.AlarmInfo alarmInfo) { - try { - V2XPushMessageEntity v2XAlarmMessage = new V2XPushMessageEntity(); - v2XAlarmMessage.setTts(alarmInfo.getTts()); - v2XAlarmMessage.setAlarmContent(alarmInfo.getAlarmContent()); - v2XAlarmMessage.setExpireTime(alarmInfo.getExpireTime()); - v2XAlarmMessage.setSceneId(alarmInfo.getPoiType()); - - broadcastToADAS_TTS(context, v2XAlarmMessage); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 广播给ADAS进行TTS播报 - * - * @param alarmMessage 广播信息 - */ - public static void broadcastToADAS_TTS(Context context, V2XPushMessageEntity alarmMessage) { - try { - Intent intent = new Intent("com.mogo.launcher.v2x.tts"); - intent.putExtra("v2x_warning_tts", alarmMessage.getTts()); - context.sendBroadcast(intent); - - // 这里是兼容 1+16G 版本没有ADAS的时候自身进行TTS - if (!AppUtils.isAppInstalled(context, "com.zhidao.autopilot")) { - speakTTSVoice(alarmMessage.getTts(), null); - } - - Logger.i(MODULE_NAME, "向ADAS分发服务器下发的事件," + alarmMessage.toString()); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) { - if (!TextUtils.isEmpty(msg)) { - Logger.w(V2XConst.MODULE_NAME, "调用TTS播放语音:" + msg); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice(msg, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ChartingUtil.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ChartingUtil.java deleted file mode 100644 index 87baf322f1..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ChartingUtil.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.mogo.module.v2x.utils; - -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICallChatResponse; - -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/15 4:26 PM - * desc : 调用车聊聊的工具类 - * version: 1.0 - */ -public class ChartingUtil { - public interface ChartStatusListener { - void canCall(boolean b); - } - - /** - * 调用车聊聊拨打电话 - * - * @param userInfo 用户数据 - * @param location 位置信息 - */ - public static void callChatting(MarkerUserInfo userInfo, MarkerLocation location) { - try { - Map params = new HashMap<>(); - params.put(CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn()); - params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead()); - params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + ""); - params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName()); - params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + ""); - - if (location != null) { - params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress()); - params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + ""); - params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + ""); - } - - Logger.d(MODULE_NAME, "调用车聊聊传入参数:\n" + params); - if ( V2XServiceManager.getCarsChattingProvider() != null ) { - V2XServiceManager.getCarsChattingProvider().call(params); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 判断是否可以拨打电话 - * - * @param chartStatusListener 车聊聊状态监听 - */ - public static void isOnLine(String sn, ChartStatusListener chartStatusListener) { - try { - String isMe = MoGoAiCloudClientConfig.getInstance().getSn(); - if (isMe.equals(sn)) { - Logger.d("", "是我的分享"); - if (chartStatusListener != null) { - chartStatusListener.canCall(false); - return; - } - } else { - Logger.d("", "不是我的分享"); - } - if ( V2XServiceManager.getCarsChattingProvider() != null ) { - V2XServiceManager.getCarsChattingProvider().isOnLine( - "CAR_CALL_TO_" + V2XConst.MODULE_NAME, - com.mogo.eagle.core.utilcode.util.Utils.getApp(), - sn, - new ICallChatResponse() { - @Override - public void refuse(boolean b, int i) { - - } - - @Override - public void isOnLine(boolean onLine, @Nullable String errorMsg) { - Logger.e(V2XConst.MODULE_NAME, "isOnLine:" + onLine + " errorMsg:" + errorMsg); - if (chartStatusListener != null) { - chartStatusListener.canCall(onLine); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * 判断是否可以拨打电话 - * - * @param chartStatusListener 车聊聊状态监听 - */ - public static void isCanCall(ChartStatusListener chartStatusListener) { - try { - if ( V2XServiceManager.getCarsChattingProvider() != null ) { - V2XServiceManager.getCarsChattingProvider().canCall( - "CAR_CALL_TO_" + V2XConst.MODULE_NAME, - com.mogo.eagle.core.utilcode.util.Utils.getApp(), - new ICallChatResponse() { - @Override - public void canCall(boolean onLine) { - Logger.e(V2XConst.MODULE_NAME, "isOnLine:" + onLine); - if (chartStatusListener != null) { - chartStatusListener.canCall(onLine); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/CornerTransform.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/CornerTransform.java deleted file mode 100644 index 91897c33e3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/CornerTransform.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.mogo.module.v2x.utils; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapShader; -import android.graphics.Canvas; -import android.graphics.Matrix; -import android.graphics.Paint; -import android.graphics.RectF; -import android.graphics.Shader; - -import androidx.annotation.NonNull; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.load.Transformation; -import com.bumptech.glide.load.engine.Resource; -import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; -import com.bumptech.glide.load.resource.bitmap.BitmapResource; -import com.bumptech.glide.util.Util; - -import java.security.MessageDigest; - -/** - * @author lixiaopeng - * @description - * @since 2020/8/12 - */ -public class CornerTransform implements Transformation { - private BitmapPool mBitmapPool; - private float radius; - private boolean exceptLeftTop, exceptRightTop, exceptLeftBottom, exceptRightBotoom; - - /** - * 除了那几个角不需要圆角的 - * - * @param leftTop - * @param rightTop - * @param leftBottom - * @param rightBottom - */ - public void setExceptCorner(boolean leftTop, boolean rightTop, boolean leftBottom, boolean rightBottom) { - this.exceptLeftTop = leftTop; - this.exceptRightTop = rightTop; - this.exceptLeftBottom = leftBottom; - this.exceptRightBotoom = rightBottom; - } - - public CornerTransform(Context context, float radius) { - this.mBitmapPool = Glide.get(context).getBitmapPool(); - this.radius = radius; - } - - @NonNull - @Override - public Resource transform(@NonNull Context context, @NonNull Resource resource, int outWidth, int outHeight) { - Bitmap source = resource.get(); - int finalWidth, finalHeight; - float ratio; //输出目标的宽高或高宽比例 - if (outWidth > outHeight) { //输出宽度>输出高度,求高宽比 - ratio = (float) outHeight / (float) outWidth; - finalWidth = source.getWidth(); - finalHeight = (int) ((float) source.getWidth() * ratio); //固定原图宽度,求最终高度 - if (finalHeight > source.getHeight()) { //求出的最终高度>原图高度,求宽高比 - ratio = (float) outWidth / (float) outHeight; - finalHeight = source.getHeight(); - finalWidth = (int) ((float) source.getHeight() * ratio);//固定原图高度,求最终宽度 - } - } else if (outWidth < outHeight) { //输出宽度 < 输出高度,求宽高比 - ratio = (float) outWidth / (float) outHeight; - finalHeight = source.getHeight(); - finalWidth = (int) ((float) source.getHeight() * ratio);//固定原图高度,求最终宽度 - if (finalWidth > source.getWidth()) { //求出的最终宽度 > 原图宽度,求高宽比 - ratio = (float) outHeight / (float) outWidth; - finalWidth = source.getWidth(); - finalHeight = (int) ((float) source.getWidth() * ratio); - } - } else { //输出宽度=输出高度 - finalHeight = source.getHeight(); - finalWidth = finalHeight; - } - - //修正圆角 - this.radius *= (float) finalHeight / (float) outHeight; - Bitmap outBitmap = this.mBitmapPool.get(finalWidth, finalHeight, Bitmap.Config.ARGB_8888); - if (outBitmap == null) { - outBitmap = Bitmap.createBitmap(finalWidth, finalHeight, Bitmap.Config.ARGB_8888); - } - - Canvas canvas = new Canvas(outBitmap); - Paint paint = new Paint(); - //关联画笔绘制的原图bitmap - BitmapShader shader = new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); - //计算中心位置,进行偏移 - int width = (source.getWidth() - finalWidth) / 2; - int height = (source.getHeight() - finalHeight) / 2; - if (width != 0 || height != 0) { - Matrix matrix = new Matrix(); - matrix.setTranslate((float) (-width), (float) (-height)); - shader.setLocalMatrix(matrix); - } - - paint.setShader(shader); - paint.setAntiAlias(true); - RectF rectF = new RectF(0.0F, 0.0F, (float) canvas.getWidth(), (float) canvas.getHeight()); - canvas.drawRoundRect(rectF, this.radius, this.radius, paint); //先绘制圆角矩形 - - if (exceptLeftTop) { //左上角不为圆角 - canvas.drawRect(0, 0, radius, radius, paint); - } - if (exceptRightTop) {//右上角不为圆角 - canvas.drawRect(canvas.getWidth() - radius, 0, canvas.getWidth(), radius, paint); - } - - if (exceptLeftBottom) {//左下角不为圆角 - canvas.drawRect(0, canvas.getHeight() - radius, radius, canvas.getHeight(), paint); - } - - if (exceptRightBotoom) {//右下角不为圆角 - canvas.drawRect(canvas.getWidth() - radius, canvas.getHeight() - radius, canvas.getWidth(), canvas.getHeight(), paint); - } - - return BitmapResource.obtain(outBitmap, this.mBitmapPool); - } - - @Override - public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { - - } - - public String getId() { - return this.getClass().getName(); - } - - public int hashCode() { - //避免Transformation重复设置,导致图片闪烁,同一个圆角值的Transformation视为同一个对象 - return Util.hashCode(getId().hashCode(), Util.hashCode(this.radius)); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/DrivingDirectionUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/DrivingDirectionUtils.java deleted file mode 100644 index bd48e3f2ff..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/DrivingDirectionUtils.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.mogo.module.v2x.utils; - -import static java.lang.Math.PI; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/14 1:02 PM - * desc : 计算车辆驾驶方向的工具类 - * version: 1.0 - */ -public class DrivingDirectionUtils { - - /** - * 计算车辆行驶方向 与 poi点到车辆的连线 间的夹角 - * - * @param carLon 车辆位置 lon - * @param carLat 车辆位置 lat - * @param poiLon poi 位置 lon - * @param poiLat poi 位置 lat - * @param carAngle 车辆行驶方向 - * @return - */ - public static int getDegreeOfCar2Poi(double carLon, double carLat, double poiLon, double poiLat, int carAngle) { - int poiAngle = 0; - // 以子午线作为y轴 计算两点的余切 再将余切值转化为角度 - double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI); - //Log.w(MODULE_NAME, "getDegreeOfCar2Poi_计算车辆行驶方向 与 poi点到车辆的连线 间的夹角_angle===" + _angle); - if (poiLon > carLon) { - // poi 在 车辆位置的第1象限 - if (poiLat > carLat) { - poiAngle = (int) _angle; - } - // poi 在 车辆位置的第2象限 - else { - poiAngle = 180 - (int) _angle; - } - } else { - // poi 在 车辆位置的第3象限 - if (poiLat < carLat) { - poiAngle = (int) _angle + 180; - } - // poi 在 车辆位置的第4象限 - else { - poiAngle = 360 - (int) _angle; - } - } - return calculationAngle(poiAngle, carAngle); - } - - /** - * 计算两个行驶方向间的夹角 计算结果小于180度 - * - * @param angle0 - * @param angle1 - * @return - */ - public static int calculationAngle(int angle0, int angle1) { - // 获取两方向间夹角 - int angle = Math.abs(angle0 - angle1); - if (angle > 180) { - int minAngle = Math.min(angle0, angle1); - int maxAngle = Math.max(angle0, angle1); - return 180 - Math.abs(minAngle + 180 - maxAngle); - } else { - return angle; - } - } - - /** - * 计算车辆行驶方向角度,起点&终点经纬度 - * - * @param carLat 车辆位置 lat - * @param carLon 车辆位置 lon - * @param poiLat poi 位置 lat - * @param poiLon poi 位置 lon - */ - public static int getCarAngle(double carLat, double carLon, double poiLat, double poiLon) { - int poiAngle = 0; - // 以子午线作为y轴 计算两点的余切 再将余切值转化为角度 - double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI); - - if (poiLon > carLon) { - // poi 在 车辆位置的第1象限 - if (poiLat > carLat) { - poiAngle = (int) _angle; - } - // poi 在 车辆位置的第2象限 - else { - poiAngle = 180 - (int) _angle; - } - } else { - // poi 在 车辆位置的第3象限 - if (poiLat < carLat) { - poiAngle = (int) _angle + 180; - } - // poi 在 车辆位置的第4象限 - else { - poiAngle = 360 - (int) _angle; - } - } - - if (poiAngle >= 355) { - poiAngle = 0; - } - return poiAngle; - } - - /** - * 计算连两个角度差值 - * - * @param angle1 角度1 - * @param angle2 角度2 - * @return 差值 - */ - public static double getAngleDiff(double angle1, double angle2) { - // 两个角度差值较小 - return 180 - Math.abs(Math.abs(angle1 - angle2) - 180); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/FatigueDrivingUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/FatigueDrivingUtils.java deleted file mode 100644 index 5fcf170de5..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/FatigueDrivingUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.mogo.module.v2x.utils; - -import android.text.TextUtils; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.constant.TimeConstants; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/26 3:12 PM - * desc : 疲劳驾驶的工具类 - * version: 1.0 - */ -public class FatigueDrivingUtils { - - /** - * 获取驾驶时常 - * - * @return 驾驶市场 - */ - public static long getDrivingTime() { - // 获取 ACC ON 时间 - String accOnTime = SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_ACC_ON_TIME_STR); - if (TextUtils.isEmpty(accOnTime)) { - accOnTime = TimeUtils.getNowString(); - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, accOnTime); - } - return Math.abs(TimeUtils.getTimeSpanByNow(accOnTime, TimeConstants.MIN)); - } - - /** - * 刷新ACC ON时间记录 - * 获取上次记录的开机事件,判断如果当前acc on时间与上次acc off时间<20min的忽略 - */ - public static void refreshAccOnTime() { - // 获取 ACC ON 时间 - String localAccONTime = SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_ACC_ON_TIME_STR); - Logger.d(V2XConst.MODULE_NAME, "ACC ON时间:" + localAccONTime); - - // 如果本地没有记录时间则记录 - if (!TextUtils.isEmpty(localAccONTime)) { - // 获取配置信息 - V2XStrategyPushRes.ResultBean strategyPushEntity = - GsonUtil.objectFromJson(SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_STRATEGY_PUSH), V2XStrategyPushRes.ResultBean.class); - if (strategyPushEntity != null) { - // 获取 当前 ACC ON 时间 - String accOnTime = TimeUtils.getNowString(); - // 获取 ACC OFF 时间 - String accOFFTime = SharedPrefsMgr.getInstance(Utils.getApp()) - .getString(V2XConst.V2X_ACC_OFF_TIME_STR); - if (!TextUtils.isEmpty(accOFFTime)) { - // 比较开关机时间,如果acc of 比 acc on 时间还要靠近说明acc on 时间记录有问题,需要更新同步 - long timeSpan = TimeUtils.getTimeSpan(accOnTime, accOFFTime, TimeConstants.MIN); - Logger.d(V2XConst.MODULE_NAME, "开关机时间间隔:" + timeSpan); - if (timeSpan >= strategyPushEntity.getRestIgnoreMinutes()) { - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, accOnTime); - } - } - } else { - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, TimeUtils.getNowString()); - } - } else { - // 记录开机时间 - SharedPrefsMgr.getInstance(Utils.getApp()) - .putString(V2XConst.V2X_ACC_ON_TIME_STR, TimeUtils.getNowString()); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ImageUtil.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ImageUtil.java deleted file mode 100644 index fdf8a1e931..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ImageUtil.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mogo.module.v2x.utils; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.text.TextUtils; - -/** - * 图片工具来 - */ -public class ImageUtil { - - /** - * 根据需求的宽和高以及图片实际的宽和高计算SampleSize - */ - public static int caculateInSampleSize(BitmapFactory.Options options, int reqWidth, - int reqHeight) { - int width = options.outWidth; - int height = options.outHeight; - - int inSampleSize = 1; - - if (width > reqWidth || height > reqHeight) { - int widthRadio = Math.round(width * 1.0f / reqWidth); - int heightRadio = Math.round(height * 1.0f / reqHeight); - - inSampleSize = Math.max(widthRadio, heightRadio); - } - - return inSampleSize; - } - - /** - * 根据要求的宽高,从本地路径得到bitmap - * - * @param picPath - * @param width - * @param height - * @return - */ - public static Bitmap createBitmap(String picPath, int width, int height) { - if (!TextUtils.isEmpty(picPath)) { - BitmapFactory.Options opts = new BitmapFactory.Options(); -// opts.inJustDecodeBounds = true; - BitmapFactory.decodeFile(picPath, opts); -// opts.inSampleSize = caculateInSampleSize(opts, width, height); -// opts.inJustDecodeBounds = false; - Bitmap bitmap = BitmapFactory.decodeFile(picPath, opts); - return bitmap; - } - return null; - } - - public static Bitmap createBitmap(Context context, int resId, int width, int height) { - if (resId != 0) { - BitmapFactory.Options opts = new BitmapFactory.Options(); -// opts.inJustDecodeBounds = true; - BitmapFactory.decodeResource(context.getResources(), resId, opts); -// opts.inSampleSize = caculateInSampleSize(opts, width, height); -// opts.inJustDecodeBounds = false; - Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId, opts); - return bitmap; - } - return null; - } - - public static Bitmap getBitmap(Context context, Object path, int width, int height) { - Bitmap bitmap = null; - if (path instanceof String) { - bitmap = createBitmap((String) path, width, height); - } else if (path instanceof Integer) { - if (context != null) { - bitmap = createBitmap(context, (Integer) path, width, height); - } - } - return bitmap; - } - - - - public static Bitmap createBitmap(Context context, int resId) { - if (resId != 0) { - BitmapFactory.Options opts = new BitmapFactory.Options(); - BitmapFactory.decodeResource(context.getResources(), resId, opts); - Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId, opts); - return bitmap; - } - return null; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java deleted file mode 100644 index e117032a18..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.mogo.module.v2x.utils; - -import android.location.Location; -import android.util.Log; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.map.search.geo.IMogoGeoSearchListener; -import com.mogo.map.search.geo.MogoPoiItem; -import com.mogo.map.search.poisearch.IMogoPoiSearch; -import com.mogo.map.search.poisearch.IMogoPoiSearchListener; -import com.mogo.map.search.poisearch.MogoPoiResult; -import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; - - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/5/15 10:31 AM - * desc : 基于位置工具类 - * version: 1.0 - */ -public class LocationUtils { - private static final String TAG = "LocationUtils"; - - public static void geoCodeSearch(MogoLocation location, IMogoGeoSearchListener listener) { -// MogoRegeocodeQuery mogoRegeocodeQuery = new MogoRegeocodeQuery(); -// mogoRegeocodeQuery.setPoint(new MogoLatLng(location.getLatitude(), location.getLongitude())); -// -// V2XServiceManager.getMogoGeoSearch().setGeoSearchListener(listener); -// -// V2XServiceManager.getMogoGeoSearch().getFromLocationAsyn(mogoRegeocodeQuery); - } - - /** - * 根据关键词进行查询 - */ - public static void searchPOI(String keyword) { - MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(keyword, keyword); - poiSearchQuery.setPageSize(10); - poiSearchQuery.setLocation(getCurrentLatLon()); - IMogoPoiSearch poiSearch = V2XServiceManager.getMapService().getPoiSearch(Utils.getApp(), poiSearchQuery); - - poiSearch.setPoiSearchListener(new IMogoPoiSearchListener() { - @Override - public void onPoiSearched(MogoPoiResult result, int errorCode) { - Logger.i(V2XConst.MODULE_NAME, - "keyword: " + keyword + - "\nPOI查询结果为:" + GsonUtil.jsonFromObject(result.getPois())); - } - - @Override - public void onPoiItemSearched(MogoPoiItem item, int errorCode) { - - } - }); - poiSearch.searchPOIAsyn(); - } - - /** - * 获取当前位置 - * - * @return 当前位置 - */ - public static MogoLatLng getCurrentLatLon() { - MogoLatLng latLon = V2XServiceManager.getNavi().getCarLocation(); - if (latLon == null) { - Location location = V2XServiceManager.getNavi().getCarLocation2(); - if (location != null) { - latLon = new MogoLatLng(location.getLatitude(), location.getLongitude()); - } - } - if (latLon == null) { - MogoLocation location = V2XServiceManager.getMogoLocationClient().getLastKnowLocation(); - if (location != null) { - latLon = new MogoLatLng(location.getLatitude(), location.getLongitude()); - } - } - if (latLon == null) { - latLon = V2XServiceManager.getMapUIController().getWindowCenterLocation(); - } - return latLon; - } - - /** - * 获取传入的经纬度在车辆的什么位置 - * - * @return 顺时针,true-前,false-后 - */ - public static boolean isPointOnCarFront(MogoLocation carLocal, MogoLatLng pointLocal) { - double carLon = carLocal.getLongitude(); - double carLat = carLocal.getLatitude(); - double poiLon = pointLocal.getLon(); - double poiLat = pointLocal.getLat(); - float carAngle = carLocal.getBearing(); - - // 计算车辆与点之间的夹角 - int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( - carLon, carLat, poiLon, poiLat, (int) carAngle); - - if (diffAngle <= 90) { - Log.i(TAG, "目标点在车辆--前方"); - return true; - } else { - Log.i(TAG, "目标点在车辆--后方"); - return false; - } - } - - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/MarkerUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/MarkerUtils.java deleted file mode 100644 index fb364e49fe..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/MarkerUtils.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.mogo.module.v2x.utils; - -import android.content.Context; -import android.graphics.Rect; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.utilcode.util.WindowUtils; -import com.mogo.map.marker.IMogoMarkerClickListener; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerShowEntity; -import com.mogo.module.common.enums.EventTypeEnum; -import com.mogo.module.common.utils.CarSeries; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity; - -import java.util.Collections; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/3 5:52 PM - * desc : - * version: 1.0 - */ -@Deprecated -public class MarkerUtils { - private static final String TAG = "MarkerUtils"; - - /** - * 特殊车辆推送绘制,实时更新的 - * - * @param v2XSpecialCarRes 绘制地图气泡 - */ - public static void handlerV2XSpecialVehicleMarker(V2XSpecialCarRes v2XSpecialCarRes, - Context context, - IMogoMarkerClickListener clickListener) { - try { - // 移除上一次的数据 - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_MARKER_SPECIAL_CAR); - // 循环绘制 - for (V2XMarkerEntity v2XMarkerEntity : v2XSpecialCarRes.getCoordinates()) { - if (!EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(v2XMarkerEntity.getTargetId()+"")) { - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(v2XMarkerEntity.getLon()); - markerLocation.setLat(v2XMarkerEntity.getLat()); - // 进行数据转换,用于Marker展示 - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setMarkerLocation(markerLocation); - markerShowEntity.setMarkerType(V2XConst.V2X_MARKER_SPECIAL_CAR); - markerShowEntity.setBindObj(v2XMarkerEntity); - V2XServiceManager.getMoGoV2XMarkerManager().drawableMarker(context, markerShowEntity, clickListener); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 自动调整地图的镜头 - */ - public static void zoomMap(MogoLatLng latLng, Context context) { - try { - if (latLng == null) { - return; - } - //Logger.d(V2XConst.MODULE_NAME, "重新调整地图缩放比:" + latLng); - - Rect mBoundRect = new Rect(); - final int paddingTop; - final int paddingBottom; - final int paddingRight; - final int paddingLeft; - if (CarSeries.isF8xxSeries()) { - paddingTop = WindowUtils.dip2px(context, 250); - paddingBottom = WindowUtils.dip2px(context, 100); - paddingRight = WindowUtils.dip2px(context, 100); - paddingLeft = WindowUtils.dip2px(context, 475); - } else { - paddingTop = WindowUtils.dip2px(context, 370); - paddingBottom = WindowUtils.dip2px(context, 100); - paddingRight = WindowUtils.dip2px(context, 100); - paddingLeft = WindowUtils.dip2px(context, 575); - } - - mBoundRect.bottom = paddingBottom; - mBoundRect.top = paddingTop; - mBoundRect.left = paddingLeft; - mBoundRect.right = paddingRight; - - // 当前车辆位置 - MogoLatLng carLocation = V2XServiceManager.getNavi().getCarLocation(); - // 调整自适应的地图镜头 - V2XServiceManager.getMapUIController().showBounds(TAG, - carLocation, - Collections.singletonList(latLng), - mBoundRect, - true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 设置地图的缩放级别 - * - * @param zoomScale 缩放级别 - */ - public static void resetMapZoom(float zoomScale) { - V2XServiceManager.getMapUIController().loseLockMode(); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ObuConfig.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ObuConfig.java deleted file mode 100644 index 361af30cce..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/ObuConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.utils; - -/** - * obu相关设置项 - * @author tongchenfei - */ -public class ObuConfig { - /** - * 设置是否使用obu定位信息 - * - * 此定位信息目前只用于obu计算绿波车速引导和vip变灯提醒 - */ - public static boolean useObuLocation = false; -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/RoadConditionUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/RoadConditionUtils.java deleted file mode 100644 index 9e2745fc8b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/RoadConditionUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mogo.module.v2x.utils; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/16 2:25 PM - * desc : 调用探路模块相关的工具 - * version: 1.0 - * @author donghongyu - */ -public class RoadConditionUtils { - - /** - * 提交网络 - */ - public static void sendShareReceiverInfo(String infoId, - String poiType, - int likeOrDislike) { - showTip(); - V2XServiceManager - .getV2XRefreshModel() - .addPoiInfoFabulous( - null, - infoId, - poiType, - likeOrDislike); - } - - /** - * 显示Toast - */ - private static void showTip() { - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已反馈", null); - TipToast.tip("已反馈"); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java deleted file mode 100644 index 4dda1fbfc6..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java +++ /dev/null @@ -1,517 +0,0 @@ -package com.mogo.module.v2x.utils; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerResponse; -import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; -import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes; -import com.mogo.module.v2x.entity.net.V2XSpecialCarRes; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.util.List; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-01-0918:20 - * desc : 生成测试数据 - * version: 1.0 - */ -public class TestOnLineCarUtils { - - - /** - * 获取测试的违章停车数据 - */ - public static V2XMessageEntity> getV2XIllegalParkData() { - try { - InputStream inputStream = Utils.getApp().getResources().openRawResource(R.raw.illegal_park_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - MarkerResponse markerResponse = GsonUtil.objectFromJson(baos.toString(), MarkerResponse.class); - - V2XMessageEntity> v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING); - // 设置数据 - v2xMessageEntity.setContent(markerResponse.getResult().getExploreWay()); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - /** - * 模拟道路事件测试数据 - */ - public static V2XMessageEntity getV2XScenarioRoadEventData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_road_event_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XRoadEventEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XRoadEventEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - /** - * 模拟道路事件UGC测试数据 - */ - public static V2XMessageEntity getV2XScenarioRoadEventUGCData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_road_event_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XRoadEventEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XRoadEventEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟H5推送数据 - */ - public static V2XMessageEntity getV2XScenarioPushEventData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_push_event_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 测试数据 - */ - public static V2XMessageEntity getV2XScenarioPushFrontWarningEventData(String adasResult) { - - try { - int id = R.raw.scenario_warning_event_data_right; - switch (adasResult) { - case "left": - id = R.raw.scenario_warning_event_data_left; - break; - case "pedestrians": - id = R.raw.scenario_warning_event_data_pedestrians; - break; - default: - } - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(id); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class); - V2XMessageEntity messageEntity = new V2XMessageEntity(); - messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS); - messageEntity.setContent(warningEntity); - return messageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟H5推送直播数据 - */ - public static V2XMessageEntity getV2XScenarioPushLiveEventData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_push_live_event_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟H5推送场景动画数据 - */ - public static V2XMessageEntity getV2XScenarioAnimationEventData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_push_animation_event_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟H5推送场景--十字路口碰撞 - */ - public static V2XMessageEntity getV2XScenarioCrossCrash() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_push_cross_crash); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟 疲劳驾驶 - */ - public static V2XMessageEntity getV2XScenarioFatigueDrivingData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_fatigue_driving_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XPushMessageEntity v2xRoadEventEntity = - GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟 道路求助 - */ - public static V2XMessageEntity> getV2XScenarioSeekHelpData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_seek_help); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XSpecialCarRes v2xRoadEventEntity = - GsonUtil.objectFromJson(baos.toString(), V2XSpecialCarRes.class); - - V2XMessageEntity> v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity.getCoordinates()); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 模拟 后方VIP - */ - public static V2XMessageEntity> getV2XScenarionVRBehindVIPData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_push_vr_hehind_vip_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XSpecialCarRes v2xRoadEventEntity = - GsonUtil.objectFromJson(baos.toString(), V2XSpecialCarRes.class); - - V2XMessageEntity> v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity.getCoordinates()); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 逆向车辆路线预判 - */ - public static V2XMessageEntity getV2XScenarionVRReverseCarData() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.scenario_push_vr_reverse_car_data); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - /** - * 模拟最优路线推送 - */ - public static V2XMessageEntity getV2XOptimalRoute() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.test_data_v2x_zuiyouluxian); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - V2XOptimalRouteDataRes v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XOptimalRouteDataRes.class); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW); - // 设置数据 - v2xMessageEntity.setContent(v2xRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 自车求助测试数据 - */ - public static V2XMessageEntity getV2XScenarioCarForHelpEventData() { - try { - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP); - // 设置数据 - v2xMessageEntity.setContent(true); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - return v2xMessageEntity; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - /** - * 返回绘制线路测试数据 - * - * @return - */ - public static List getTestCoordinates() { - try { - InputStream inputStream = Utils.getApp() - .getResources() - .openRawResource(R.raw.test_coordinates); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int len = -1; - byte[] buffer = new byte[1024]; - while ((len = inputStream.read(buffer)) != -1) { - baos.write(buffer, 0, len); - } - inputStream.close(); - - // 加载数据源 - return GsonUtil.arrayFromJson(baos.toString(), MogoLatLng.class); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java deleted file mode 100644 index 0f79252630..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TrackUtils.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.mogo.module.v2x.utils; - -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.V2XStatusManager; - -import java.util.HashMap; -import java.util.Map; - -/** - * 统计埋点工具 - */ -public class TrackUtils { - - //埋点 - public static void trackV2xRoadShow(String dbid, String type, String style) { - try { - 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); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties); - } catch (Exception e) { - e.printStackTrace(); - } - } - - //道路事件操作埋点 v2x_road_event - public static void trackV2xRoadEvent(String dbid, String sn, String type) { - try { - Map properties = new HashMap<>(); - properties.put("dbid", dbid); - properties.put("sn", sn); - properties.put("type", type); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_EVET, properties); - } catch (Exception e) { - e.printStackTrace(); - } - } - - //道路事件操作埋点 V2X_button - - /** - * @param type type=1 桌面按钮 - *

    - * type=2 tab1按钮-出行动态 - *

    - * type=3 tab2按钮-周边事件 - *

    - * type=4 tab3按钮-我的分享 - *

    - * type=5 tab4按钮-关闭按钮 - */ - public static void trackV2xHistoryEvent(int type) { - try { - Map properties = new HashMap<>(); - properties.put("type", type); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_EVET_HISTORY_BUTTON, properties); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - /** - * @param type type=1 短距离角度匹配 - * type=2 历史轨迹匹配 - */ - public static void trackV2xRoadProduceEvent(int type) { - try { - Map properties = new HashMap<>(); - properties.put("type", type); - V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_PRODUCE, properties); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void trackV2XMarkerClick(int type) { - try { - Map properties = new HashMap<>(); - properties.put("type", type); - V2XServiceManager.getMogoAnalytics().track(V2XConst.LAUNCHER_ICON_CLICK, properties); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java deleted file mode 100644 index bad44713a6..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.mogo.module.v2x.utils; - -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.mogo.sqlite.SQLIDao; -import com.mogo.eagle.core.utilcode.util.TimeUtils; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.module.common.entity.V2XEventZanData; -import com.mogo.module.common.entity.V2XHistoryScenarioData; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.fragment.V2XEventPanelFragment; -import com.mogo.utils.sqlite.SQLDaoFactory; - -import java.util.List; - -/** - * 数据库操作工具类 - * - * @author donghongyu - */ -public class V2XSQLiteUtils { - /** - * 场景数据管理 - */ - private static SQLIDao mScenarioHistoryDao; - - /** - * 点赞数据管理 - */ - private static SQLIDao mV2XEventZanDao; - - /** - * 场景数据管理 - */ - public static SQLIDao getScenarioHistoryDao() { - if (mScenarioHistoryDao == null) { - synchronized (V2XSQLiteUtils.class) { - if (mScenarioHistoryDao == null) { - mScenarioHistoryDao = SQLDaoFactory.Companion.getInstance() - .getBaseDao(Utils.getApp(), V2XHistoryScenarioData.class); - } - } - } - return mScenarioHistoryDao; - } - - /** - * 点赞数据管理 - */ - public static SQLIDao getV2XEventZanDao() { - if (mV2XEventZanDao == null) { - synchronized (V2XSQLiteUtils.class) { - if (mV2XEventZanDao == null) { - mV2XEventZanDao = SQLDaoFactory.Companion.getInstance() - .getBaseDao(Utils.getApp(), V2XEventZanData.class); - } - } - } - return mV2XEventZanDao; - } - - /** - * 删除数据库中存储的昨天的数据 - */ - public static void clearYesterdayScenarioHistoryData() { - try { - List historyScenarioData = getScenarioHistoryDao().query(new V2XHistoryScenarioData()); - for (V2XHistoryScenarioData historyScenarioDatum : historyScenarioData) { - Long triggerTime = historyScenarioDatum.getTriggerTime(); - if (!TimeUtils.isToday(triggerTime)) { - int result = getScenarioHistoryDao().delete(historyScenarioDatum); - if (result > 0) { - Logger.d(V2XConst.MODULE_NAME, "删除过期数据成功"); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 删除数据库中所有数据 - */ - public static void clearScenarioHistoryData() { - try { - int result = getScenarioHistoryDao().delete(new V2XHistoryScenarioData()); - Logger.d(V2XConst.MODULE_NAME, "删除数据成功:" + result); - V2XEventPanelFragment.Companion.getInstance().changeEventCount(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 查询当天的V2X数据 - */ - public static List getScenarioHistoryData() { - return getScenarioHistoryDao().query(new V2XHistoryScenarioData(), "triggerTime", true); - } - - /** - * 查询当天的指定的V2X数据 - */ - public static List getTargetScenarioHistoryData(V2XHistoryScenarioData scenarioData) { - return getScenarioHistoryDao().query(scenarioData, "triggerTime", true); - } - - /** - * 查询当天的未评价V2X数据 - */ - public static List getScenarioHistoryUnDisposeData() { - V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); - v2XHistoryScenarioData.isDispose = false; - return getScenarioHistoryDao().query(v2XHistoryScenarioData, "triggerTime", true); - } - - /** - * 修改指定的数据 - */ - public static void updateScenarioHistoryData(V2XHistoryScenarioData oldScenarioData, V2XHistoryScenarioData newScenarioData) { - try { - int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData); - Logger.d(V2XConst.MODULE_NAME, "修改数据成功:" + result); - V2XEventPanelFragment.Companion.getInstance().changeEventCount(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 修改指定的数据为已经操作的数据 - */ - public static void updateScenarioHistoryDataIsDispose(V2XHistoryScenarioData oldScenarioData) { - try { - V2XHistoryScenarioData newScenarioData = new V2XHistoryScenarioData(); - newScenarioData.setDispose(true); - newScenarioData.setTriggerTime(TimeUtils.getNowMills()); - newScenarioData.setEventJsonData(oldScenarioData.getEventJsonData()); - newScenarioData.setEventJsonDataHashCode(oldScenarioData.getEventJsonDataHashCode()); - newScenarioData.setScenarioType(oldScenarioData.getScenarioType()); - - int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData); - Logger.d(V2XConst.MODULE_NAME, "修改数据成功:" + result); - V2XEventPanelFragment.Companion.getInstance().changeEventCount(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 存储本地数据,每个数据只能存在一次,所以存储之前先查询数据库如果已经存在则修改触碰时间 - * - * @param markerExploreWay 要存储的场景 - */ - public static void saveLocalStory(int scenarioType, Object markerExploreWay, int hashCode) { - try { - - Logger.d(V2XConst.MODULE_NAME, "saveLocalStory:" + markerExploreWay); - - // 进行数据库存储 - V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); - v2XHistoryScenarioData.setScenarioType(scenarioType); - v2XHistoryScenarioData.setEventJsonDataHashCode(hashCode); - - List historyScenarioData = getTargetScenarioHistoryData(v2XHistoryScenarioData); - - v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(markerExploreWay)); - v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills()); - v2XHistoryScenarioData.setDispose(false); - - if (historyScenarioData != null && historyScenarioData.size() > 0) { - // 更新数据 - V2XSQLiteUtils.getScenarioHistoryDao().update(historyScenarioData.get(0), v2XHistoryScenarioData); - } else { - // 存储新数据 - V2XSQLiteUtils.getScenarioHistoryDao().insert(v2XHistoryScenarioData); - } - V2XEventPanelFragment.Companion.getInstance().changeEventCount(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 存储本地数据 - * - * @param v2XEventZanData 要存储的场景 - */ - public static void saveEventZanLocalStory(V2XEventZanData v2XEventZanData) { - try { - if (!isZanEvent(v2XEventZanData.eventId)) { - // 进行数据库存储 - V2XSQLiteUtils.getV2XEventZanDao().insert(v2XEventZanData); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 判断是否已经存在 - * - * @param eventId 要判断的事件ID - * @return true-已存在,false-没存在 - */ - public static boolean isZanEvent(String eventId) { - try { - // 查询数据库,判断是否存在 - for (V2XEventZanData eventZanDatum : getEventZanData()) { - if (eventZanDatum.eventId.equals(eventId)) { - return true; - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - /** - * 查询当天的V2X数据 - */ - public static List getEventZanData() { - return getV2XEventZanDao().query(new V2XEventZanData()); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XUtils.java deleted file mode 100644 index 973b1e3fbf..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.mogo.module.v2x.utils; - -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.Utils; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/3/21 3:58 PM - * desc : - * version: 1.0 - */ -public class V2XUtils { - - /** - * 当天第一次 - */ - public static boolean isFirstTodayWithKey(String key) { - SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.US); - String formatString = format.format(new Date()); - String value = SharedPrefsMgr.getInstance(Utils.getApp()).getString(key); - if (value.equals(formatString)) { - return true; - } else { - SharedPrefsMgr.getInstance(Utils.getApp()).putString(key, formatString); - return false; - } - } - - // 两次点击间隔不能少于1000ms - private static final int FAST_CLICK_DELAY_TIME = 1000; - private static long lastClickTime; - - public static boolean isFastClick() { - boolean flag = true; - long currentClickTime = System.currentTimeMillis(); - if ((currentClickTime - lastClickTime) >= FAST_CLICK_DELAY_TIME) { - flag = false; - } - lastClickTime = currentClickTime; - return flag; - } - - public static int getDirection(float degree) { - if (degree > 45 && degree < 135) { - return 1; //前方 - } else if (degree > 135 && degree < 225) { - return 4; //右方 - } else if ((degree < 45 && degree > 0) || degree < 360 && degree > 315) { - return 3; //左方 - } - - return 1; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/collection/FixSizeArrayList.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/collection/FixSizeArrayList.java deleted file mode 100644 index 6b497f0798..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/collection/FixSizeArrayList.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mogo.module.v2x.utils.collection; - -import java.util.ArrayList; - -/** - * 固定大小的存储集合 - * - * @param - */ -public class FixSizeArrayList extends ArrayList { - private int capacity; - - public FixSizeArrayList(int capacity) { - super(); - this.capacity = capacity; - } - - @Override - public boolean add(T t) { - if (size() + 1 > capacity) { - //移除第一个元素 - remove(0); - } - return super.add(t); - } - - @Override - public void add(int index, T element) { - // 先让其更改数量; - super.add(index, element); - if (size() > capacity) { - super.remove(0); - } - } - - public T getLast() { - if (size() > 0) { - return super.get(size() - 1); - } - return null; - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java deleted file mode 100644 index 983019e595..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.content.Context; -import android.content.Intent; -import android.graphics.PorterDuff; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.SurfaceView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.core.content.ContextCompat; - -import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack; -import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.widget.RoundLayout; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; - -/** - * @author liujing - * @description 描述 - * @since: 2021/2/23 - */ -public class CarZegoLiveVideoView extends RoundLayout { - private static final String TAG = "CarZegoLiveVideoView"; - private SurfaceView mSurfaceView; - private ProgressBar mLoading; - private ConstraintLayout mClLoadError; - private String liveSn; - - // 重新刷新直播流 - private final V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - startLive(); - } - }; - - public CarZegoLiveVideoView() { - this(V2XServiceManager.getContext(), null); - } - - public CarZegoLiveVideoView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public CarZegoLiveVideoView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - LayoutInflater.from(context) - .inflate(R.layout.view_video_layout_see_live, this); - mSurfaceView = findViewById(R.id.surfaceView); - mSurfaceView.setZOrderOnTop(true); - mLoading = findViewById(R.id.loading); - mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY); - - mClLoadError = findViewById(R.id.clLoadError); - TextView mTvRefreshButton = findViewById(R.id.tvRefreshButton); - mTvRefreshButton.setOnClickListener(v -> { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - startLive(); - }); - } - - /** - * 开始直播 - */ - public void startLive() { - if (mSurfaceView != null) { - AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live)); - playLiveVideo(); - mClLoadError.setVisibility(GONE); - Logger.d(TAG, "startLive"); - - } else { - AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live_error)); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - Logger.d(TAG, "没有找到可直播车机"); - } - } - - /** - * 播放直播流 - */ - private void playLiveVideo() { - if (mSurfaceView != null) { - MogoLocation mogoLocation = V2XServiceManager.getMogoLocationClient().getLastKnowLocation(); - MoGoAiCloudTrafficLive.viewFrontVehicleLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), mSurfaceView, new ITrafficCarLiveCallBack() { - @Override - public void onLive(String liveSn) { - Logger.d(TAG, "onLive"); - if (!TextUtils.isEmpty(liveSn)) { - CarZegoLiveVideoView.this.liveSn = liveSn; - } - refreshStatusToListener(true); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(GONE); - } - - @Override - public void onDisConnect() { - Logger.d(TAG, "失去连接onDisConnect"); - } - - @Override - public void onError(String errorMsg) { - refreshStatusToListener(false); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("直播获取识败,可以对我说重试", null); - stopLive(); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE, - v2XVoiceCallbackRefreshListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, - v2XVoiceCallbackRefreshListener); - } - }); - } - } - - public void stopLive() { - try { - Logger.w(TAG, "心跳:关闭直播..."); - if (!TextUtils.isEmpty(liveSn)) { - MoGoAiCloudTrafficLive.stopCarLive(liveSn); - } else { - Logger.e(TAG, "直播 liveSn is null"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - startLive(); - } - - @Override - protected void onDetachedFromWindow() { - stopLive(); - mLoading.setVisibility(VISIBLE); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP); - super.onDetachedFromWindow(); - } - - private void refreshStatusToListener(boolean videoPlaying) { - if (onVideoStatusChange != null) { - onVideoStatusChange.videoPlaying(videoPlaying); - } - } - - private OnVideoStatusChange onVideoStatusChange; - - public void addOnVideoStatusChangeListener(OnVideoStatusChange onVideoStatusChange) { - this.onVideoStatusChange = onVideoStatusChange; - } - - public interface OnVideoStatusChange { - void videoPlaying(boolean videoPlaying); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/HeartLikeView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/HeartLikeView.java deleted file mode 100644 index 5adeb236e2..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/HeartLikeView.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.animation.Animator; -import android.animation.AnimatorInflater; -import android.animation.AnimatorSet; -import android.content.Context; -import android.content.res.TypedArray; -import android.util.AttributeSet; -import android.view.View; -import android.widget.ImageView; -import android.widget.LinearLayout; - -import androidx.annotation.Nullable; - -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; - - -/** - * 红心点赞按钮控件 - * - * @author donghongyu - */ -public class HeartLikeView extends LinearLayout implements Animator.AnimatorListener { - - private ImageView mIllegalParkingLike; - private AnimatorSet mAnimatorSet; - private OnClickCallListener mOnClickCallListener; - - private boolean isAnimator = false; - - public HeartLikeView(Context context) { - this(context, null); - } - - public HeartLikeView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } - - public HeartLikeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.HeartLikeView, defStyleAttr, - 0); - boolean showGrayBack = typedArray.getBoolean(R.styleable.HeartLikeView_showGrayBack, false); - if (showGrayBack) { - inflate(context, R.layout.view_heart_like_gray_back, this); - mIllegalParkingLike = findViewById(R.id.ivLikeForGrayBack); - } else { - inflate(context, V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.view_heart_like_vr : R.layout.view_heart_like, this); - mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike); - } - - setOnClickListener(v -> { - if (!isAnimator) { - isAnimator = true; - if (mAnimatorSet == null) { - mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(), - V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.anim.v2x_like_heart_animation_vr : R.anim.v2x_like_heart_animation); - mAnimatorSet.setTarget(mIllegalParkingLike); - mAnimatorSet.addListener(this); - } - mAnimatorSet.start(); - } - }); - } - - @Override - public void onAnimationStart(Animator animation) { - - } - - @Override - public void onAnimationEnd(Animator animation) { - isAnimator = false; - if (mOnClickCallListener != null) { - mOnClickCallListener.onClicked(HeartLikeView.this); - } - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - mIllegalParkingLike.setImageResource(R.drawable.module_common_icon_like_selected_vr); - } - } - - @Override - public void onAnimationCancel(Animator animation) { - - } - - @Override - public void onAnimationRepeat(Animator animation) { - - } - - public interface OnClickCallListener { - /** - * 点击回调 - */ - void onClicked(View view); - } - - public void setOnClickCallListener(OnClickCallListener clickCallListener) { - this.mOnClickCallListener = clickCallListener; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/HeartUnLikeView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/HeartUnLikeView.java deleted file mode 100644 index 9d7d45c720..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/HeartUnLikeView.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.animation.Animator; -import android.animation.AnimatorInflater; -import android.animation.AnimatorSet; -import android.content.Context; -import android.util.AttributeSet; -import android.util.Log; -import android.view.View; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; -import android.widget.ImageView; -import android.widget.LinearLayout; - -import androidx.annotation.Nullable; - -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; - - -/** - * 不喜欢按钮控件 - * - * @author donghongyu - */ -public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorListener { - - private ImageView mIllegalParkingUnLike; - private AnimatorSet mAnimatorSet; - private OnClickCallListener mOnClickCallListener; - private boolean isAnimator = false; - private ImageView animationImageView; - - public HeartUnLikeView(Context context) { - this(context, null); - } - - public HeartUnLikeView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } - - public HeartUnLikeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - inflate(context, V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.layout.view_heart_unlike_vr : R.layout.view_heart_unlike, this); - mIllegalParkingUnLike = findViewById(R.id.ivIllegalParkingUnLike); - animationImageView = findViewById(R.id.animationImage); - setOnClickListener(v -> { - if (!isAnimator) { - isAnimator = true; - - if (mAnimatorSet == null) { - mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(), - V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.anim.v2x_unlike_heart_animation_vr : R.anim.v2x_unlike_heart_animation); - mAnimatorSet.setTarget(mIllegalParkingUnLike); - mAnimatorSet.addListener(this); - } - mAnimatorSet.start(); - } - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - animationImageView.setVisibility(View.VISIBLE); - Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.v2x_unlike_heart_scale_ani_vr); - animationImageView.startAnimation(animation); - animationImageView.setVisibility(View.GONE); - } - }); - } - - @Override - public void onAnimationStart(Animator animation) { - - } - - @Override - public void onAnimationEnd(Animator animation) { - isAnimator = false; - if (mOnClickCallListener != null) { - mOnClickCallListener.onClicked(HeartUnLikeView.this); - } - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - mIllegalParkingUnLike.setImageResource(R.drawable.module_common_icon_unlike_selected_vr); - } - } - - @Override - public void onAnimationCancel(Animator animation) { - - } - - @Override - public void onAnimationRepeat(Animator animation) { - - } - - public interface OnClickCallListener { - /** - * 点击回调 - */ - void onClicked(View view); - } - - public void setOnClickCallListener(OnClickCallListener clickCallListener) { - this.mOnClickCallListener = clickCallListener; - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt deleted file mode 100644 index 0d39605a24..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SimpleCoverVideoPlayer.kt +++ /dev/null @@ -1,219 +0,0 @@ -package com.mogo.module.v2x.view - -import android.content.Context -import android.util.AttributeSet -import android.util.Log -import android.view.Surface -import android.view.View -import android.widget.ImageView -import com.bumptech.glide.Glide -import com.bumptech.glide.request.RequestOptions -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.common.glide.SkinAbleBitmapTarget -import com.mogo.module.v2x.R -import com.mogo.module.v2x.V2XServiceManager -import com.shuyu.gsyvideoplayer.GSYVideoManager -import com.shuyu.gsyvideoplayer.utils.GSYVideoType -import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer -import com.shuyu.gsyvideoplayer.video.base.GSYVideoView -import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge - - -class SimpleCoverVideoPlayer : StandardGSYVideoPlayer { - private lateinit var coverImage: ImageView - private lateinit var start: ImageView - private lateinit var fullscreen: ImageView - - companion object { - @JvmField - val TAG: String = "SimpleCoverVideoPlayer.kt" - } - - constructor(context: Context?) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag) - - override fun init(context: Context) { - super.init(context) - coverImage = findViewById(R.id.thumbImage) - start = findViewById(R.id.start) - fullscreen = findViewById(R.id.fullscreen) - if (mThumbImageViewLayout != null - && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR) - ) { - mThumbImageViewLayout.visibility = View.VISIBLE - } - } - - override fun getLayoutId(): Int { - if (V2XServiceManager.getMoGoStatusManager().isVrMode) { - return R.layout.v2x_road_video_plyer_layout_vr - } - return R.layout.v2x_road_video_plyer_layout - } - - override fun getGSYVideoManager(): GSYVideoViewBridge { - GSYVideoManager.instance().initContext(context.applicationContext) - GSYVideoManager.instance().isNeedMute = true - return GSYVideoManager.instance() - } - - override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) { - super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange) - if (progress != 0) { - mProgressBar.progress = progress - } - } - - fun loadCoverImage(url: String, mContext: Context) { - //加载图片 - val requestOptions = RequestOptions() -// .placeholder(R.drawable.v2x_icon_live_logo) -// .error(R.drawable.video_loading_img) - Glide.with(mContext).asBitmap() - .load(url) - .apply(requestOptions) - .into(SkinAbleBitmapTarget(coverImage, requestOptions)) - - } - - /* - * 默认双击暂停 单击响应事件也=暂停/继续播放 - * 因为相应区域的关系 改为onClick方法实现 - * */ - override fun onClickUiToggle() { - -// super.touchDoubleUp() - } - - override fun updateStartImage() { - super.updateStartImage() - - when (mCurrentState) { - GSYVideoView.CURRENT_STATE_PAUSE -> start.visibility = View.VISIBLE - else -> start.visibility = View.INVISIBLE - } - } - - fun setFullClickListener(listener: OnClickListener) { - fullscreen.setOnClickListener(listener) - } - - override fun changeUiToCompleteShow() { - super.changeUiToCompleteShow() -// setViewShowState(mBottomContainer, View.INVISIBLE) - mBottomContainer.visibility = View.INVISIBLE - mProgressBar.visibility = View.GONE - } - - override fun hideAllWidget() { - super.hideAllWidget() - mBottomContainer.visibility = View.INVISIBLE - mProgressBar.visibility = View.GONE - } - - override fun changeUiToPrepareingClear() { - super.changeUiToPrepareingClear() - mBottomContainer.visibility = View.INVISIBLE - mProgressBar.visibility = View.GONE - } - - override fun changeUiToPlayingBufferingClear() { - super.changeUiToPlayingBufferingClear() - mBottomContainer.visibility = View.INVISIBLE - mProgressBar.visibility = View.GONE - - } - - override fun changeUiToClear() { - super.changeUiToClear() - mBottomContainer.visibility = View.INVISIBLE - mProgressBar.visibility = View.GONE - } - - override fun changeUiToCompleteClear() { - super.changeUiToCompleteClear() - mBottomContainer.visibility = View.INVISIBLE - mProgressBar.visibility = View.GONE - } - - override fun onAutoCompletion() { - super.onAutoCompletion() - mProgressBar.progress = 0 - } - - override fun showWifiDialog() { - //直接播放,不显示WIFI对话框 - startPlayLogic() - } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - mProgressBar.progress = 0 - mFullPauseBitmap = null - if (mAudioManager != null) { - try { - @Suppress("DEPRECATION") - mAudioManager.abandonAudioFocus(onAudioFocusChangeListener) - } catch (e: Exception) { - Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus") - } - } - } - - override fun onClick(v: View?) { - super.onClick(v) - Log.d("kl", "onClick160" + mCurrentState) - if (mCurrentState == CURRENT_STATE_PAUSE) { - onVideoResume() - } else if (mCurrentState == CURRENT_STATE_PLAYING) { - onVideoPause() - } - v?.let { - when (v) { - start -> { - onVideoResume() - } - else -> { - } - } - } - } - - override fun onPrepared() { - super.onPrepared() - } - - override fun onCompletion() { - } - - override fun onSurfaceUpdated(surface: Surface) { - super.onSurfaceUpdated(surface) - if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) { - mThumbImageViewLayout.visibility = View.INVISIBLE - } - } - - override fun setViewShowState(view: View?, visibility: Int) { - if (view === mThumbImageViewLayout && visibility != View.VISIBLE) { - return - } - super.setViewShowState(view, visibility) - } - - override fun onSurfaceAvailable(surface: Surface) { - super.onSurfaceAvailable(surface) - mProgressBar.visibility = View.GONE - if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) { - if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) { - mThumbImageViewLayout.visibility = View.INVISIBLE - } - } - } - - override fun showVolumeDialog(deltaY: Float, volumePercent: Int) { - } - - override fun touchSurfaceMove(deltaX: Float, deltaY: Float, y: Float) { - } -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java deleted file mode 100644 index 0f0b6f26c3..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.module.v2x.view; - -import com.mogo.commons.mvp.IView; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.v2x.entity.panel.SurroundingResponse; - -import java.util.List; - -/** - * @author lixiaopeng - * @description - * @since 2020/7/29 - */ -public interface SurroundingEventView extends IView { - - void showSurroudingData(List exploreWayList); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingMarginDecoration.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingMarginDecoration.java deleted file mode 100644 index 30dc9326de..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingMarginDecoration.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.graphics.Rect; -import android.view.View; - -import androidx.recyclerview.widget.RecyclerView; - -/** - * @author lixiaopeng - * @description - * @since 2020/8/11 - */ -public class SurroundingMarginDecoration extends RecyclerView.ItemDecoration { - private int margin ; - private int marginLeft ; - - public SurroundingMarginDecoration(int space, int left) { - margin = space; - marginLeft = left; - } - - @Override - public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { - outRect.bottom = margin; - - //由于每行都只有2个,所以第一个都是2的倍数 - if (parent.getChildLayoutPosition(view) % 2 == 0) { - outRect.left = marginLeft; - outRect.right = margin / 2; - } else { - outRect.left = margin / 2; - outRect.right = marginLeft; - } - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XCarLiveVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XCarLiveVideoView.java deleted file mode 100644 index cd3a7fbaa2..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XCarLiveVideoView.java +++ /dev/null @@ -1,281 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.content.Context; -import android.content.Intent; -import android.graphics.PorterDuff; -import android.os.Bundle; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.core.content.ContextCompat; - -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.widget.RoundLayout; -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.net.V2XLivePushVoRes; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.tencent.rtmp.ITXLivePlayListener; -import com.tencent.rtmp.TXLiveConstants; -import com.tencent.rtmp.TXLivePlayer; -import com.tencent.rtmp.ui.TXCloudVideoView; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-02-0623:07 - * desc : - * version: 1.0 - */ -public class V2XCarLiveVideoView extends RoundLayout { - private final String TAG = "V2XLiveGSYVideoView"; - - private TXCloudVideoView mTxcVideoView; - private ProgressBar mLoading; - private TXLivePlayer mLivePlayer; - private ConstraintLayout mClLoadError; - private TextView mTvRefreshButton; - - private MarkerCarInfo.CarLiveInfo mCarLiveInfo; - // 重新刷新直播流 - private V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - }; - - public V2XCarLiveVideoView(Context context) { - this(context, null); - } - - public V2XCarLiveVideoView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XCarLiveVideoView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - LayoutInflater.from(context) - .inflate(R.layout.view_video_layout_see_live, this); - //mPlayerView 即 step1 中添加的界面 view - mTxcVideoView = findViewById(R.id.txcVideoView); - //创建 player 对象 - mLivePlayer = new TXLivePlayer(context); - //关键 player 对象与界面 view - mLivePlayer.setPlayerView(mTxcVideoView); - mLivePlayer.setMute(true); - mLivePlayer.enableHardwareDecode(true); - - mLoading = findViewById(R.id.loading); - mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY); - - mClLoadError = findViewById(R.id.clLoadError); - mTvRefreshButton = findViewById(R.id.tvRefreshButton); - mTvRefreshButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - }); - } - - /** - * 设置直播信息 - */ - public void setCarLiveInfo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - mCarLiveInfo = carLiveInfo; - } - - /** - * 开始直播 - * - * @param carLiveInfo 要直播的车机,如果没有直播的地址需要重新获取最新的直播地址 - */ - public void startLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { - // 进行直播播放 - if (mLivePlayer != null - && carLiveInfo != null) { - if (!TextUtils.isEmpty(carLiveInfo.getVideoUrl())) { - AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live)); - setCarLiveInfo(carLiveInfo); - playLiveVideo(carLiveInfo); - } - // 根据SN重新获取直播流地址 - else { - V2XServiceManager - .getV2XRefreshModel() - .livePush(new V2XRefreshCallback() { - @Override - public void onSuccess(V2XLivePushVoRes result) { - AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live)); - mClLoadError.setVisibility(GONE); - mClLoadError.setVisibility(GONE); - try { - MarkerCarInfo.CarLiveInfo carRealLiveInfo = new MarkerCarInfo.CarLiveInfo(); - carRealLiveInfo.setVideoUrl(result.getResult().getPlayUrl().getRtmp()); - carRealLiveInfo.setVideoSn(carLiveInfo.getVideoSn()); - carRealLiveInfo.setVideoChannel(result.getResult().getVideoChannel()); - setCarLiveInfo(carLiveInfo); - playLiveVideo(carRealLiveInfo); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onFail(String msg) { - Logger.e(MODULE_NAME, "播放器:" + msg); - AIAssist.getInstance(AbsMogoApplication.getApp()).speakTTSVoice(AbsMogoApplication.getApp().getString(R.string.v2x_voice_see_front_car_live_error)); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - } - }, carLiveInfo.getVideoSn(), 0); - } - } - } - - /** - * 播放直播流,且开始心跳 - */ - private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - startHeartLive(carLiveInfo); - if (mLivePlayer != null) { - mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP); - mLivePlayer.setPlayListener(new ITXLivePlayListener() { - @Override - public void onPlayEvent(int event, Bundle bundle) { - Logger.w(MODULE_NAME, "播放器:onPlayEvent==" + event + "===bundle===" + bundle); - if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - } else if (event == TXLiveConstants.PLAY_EVT_PLAY_BEGIN) { - refreshStatusToListener(true); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(GONE); - } else if (event < 0) { - refreshStatusToListener(false); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("直播获取识败,可以对我说重试", null); - stopLive(mCarLiveInfo); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE, - v2XVoiceCallbackRefreshListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, - v2XVoiceCallbackRefreshListener); - } - } - - @Override - public void onNetStatus(Bundle bundle) { - //Logger.w(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle); - } - }); - } - } - - // 刷新直播心跳 - private void startHeartLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { - try { - if (!TextUtils.isEmpty(carLiveInfo.getVideoSn()) - && !TextUtils.isEmpty(carLiveInfo.getVideoChannel())) { - V2XServiceManager - .getV2XRefreshModel() - .refreshHeartBeat(carLiveInfo.getVideoSn(), - carLiveInfo.getVideoChannel(), - null); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void stopLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { - try { - Logger.w(MODULE_NAME, "心跳:关闭直播..."); - // 暂停 - mLivePlayer.pause(); - // true 代表清除最后一帧画面 - mLivePlayer.stopPlay(true); - mTxcVideoView.onDestroy(); - // 停止推流 - V2XServiceManager - .getV2XRefreshModel() - .livePush(new V2XRefreshCallback() { - @Override - public void onSuccess(V2XLivePushVoRes result) { - Logger.d(MODULE_NAME, "播放器:" + result); - } - - @Override - public void onFail(String msg) { - Logger.e(MODULE_NAME, "播放器:" + msg); - } - }, carLiveInfo.getVideoSn(), 1); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - - @Override - protected void onDetachedFromWindow() { - stopLive(mCarLiveInfo); - mLoading.setVisibility(VISIBLE); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP); - super.onDetachedFromWindow(); - } - - private void refreshStatusToListener(boolean videoPlaying) { - if (onVideoStatusChange != null) { - onVideoStatusChange.videoPlaying(videoPlaying); - } - } - - private OnVideoStatusChange onVideoStatusChange; - - public void addOnVideoStatusChangeListener(OnVideoStatusChange onVideoStatusChange) { - this.onVideoStatusChange = onVideoStatusChange; - } - - public interface OnVideoStatusChange { - void videoPlaying(boolean videoPlaying); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XCrossRoadVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XCrossRoadVideoView.java deleted file mode 100644 index 0c3b036054..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XCrossRoadVideoView.java +++ /dev/null @@ -1,263 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.content.Context; -import android.content.Intent; -import android.graphics.PorterDuff; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.core.content.ContextCompat; - -import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack; -import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.widget.RoundLayout; -import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.shuyu.gsyvideoplayer.GSYVideoManager; -import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; -import com.shuyu.gsyvideoplayer.cache.CacheFactory; -import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager; -import com.shuyu.gsyvideoplayer.model.VideoOptionModel; -import com.shuyu.gsyvideoplayer.player.IjkPlayerManager; -import com.shuyu.gsyvideoplayer.player.PlayerFactory; -import com.shuyu.gsyvideoplayer.utils.GSYVideoType; - -import java.util.ArrayList; -import java.util.List; - -import tv.danmaku.ijk.media.player.IjkMediaPlayer; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; -import static com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN; -import static com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING; - -/** - * author : donghongyu EmArrow - * e-mail : 1358506549@qq.com - * date : 2020-02-06 23:07 - * update : 2021-04-01 17:30 - * version: 1.0 - */ -public class V2XCrossRoadVideoView extends RoundLayout { - - private static final String TAG = "CrossRoadVideo"; - - private SimpleVideoPlayer mTxcVideoView; - private final GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); - private ProgressBar mLoading; - private ConstraintLayout mClLoadError; - private boolean init = false; - - private MarkerCarInfo.CarLiveInfo mCarLiveInfo; - // 重新刷新直播流 - private final V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - }; - - public V2XCrossRoadVideoView(Context context) { - this(context, null); - } - - public V2XCrossRoadVideoView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XCrossRoadVideoView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - Logger.d(TAG, "constructor invoke initView"); - initView(context); - } - - private void initView(Context context) { - if (init) { - return; - } - Logger.d("V2XCrossRoadVideoView", "V2X===初始化语音呼叫路口直播视图"); - LayoutInflater.from(context) - .inflate(R.layout.view_video_layout_see_crossroad, this); - //mPlayerView 即 step1 中添加的界面 view - mTxcVideoView = findViewById(R.id.txcVideoView); - initGSYVideoConfig(); - - mLoading = findViewById(R.id.loading); - mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY); - - mClLoadError = findViewById(R.id.clLoadError); - TextView mTvRefreshButton = findViewById(R.id.tvRefreshButton); - mTvRefreshButton.setOnClickListener(v -> { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - }); - init = true; - } - - private void initGSYVideoConfig() { - PlayerFactory.setPlayManager(IjkPlayerManager.class); - CacheFactory.setCacheManager(ProxyCacheManager.class); - List list = new ArrayList<>(); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_transport", "tcp")); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_flags", "prefer_tcp")); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "allowed_media_types", "video")); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "timeout", 20000)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "buffer_size", 1316)); - - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "infbuf", 1)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "analyzeduration", 1)); - - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "probesize", 10240)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "flush_packets", 1)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_timeout", -1)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "analyzeduration", 1)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "packet-buffering", 0)); - list.add(new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "reconnect", 10)); - - GSYVideoManager.instance().setOptionModelList(list); - GSYVideoType.enableMediaCodec(); - GSYVideoType.enableMediaCodecTexture(); - GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL); - } - - /** - * 设置直播信息 - */ - public void setCarLiveInfo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - mCarLiveInfo = carLiveInfo; - } - - /** - * 开始直播 - * - * @param carLiveInfo 要直播的设备信息,如果没有直播的地址需要重新获取最新的直播地址 - */ - public void startLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { - // 进行直播播放 - if (mTxcVideoView != null - && carLiveInfo != null) { - if (!TextUtils.isEmpty(carLiveInfo.getVideoUrl())) { - setCarLiveInfo(carLiveInfo); - playLiveVideo(carLiveInfo); - } - //重新获取直播流地址 - else { - MogoLocation mogoLocation = V2XServiceManager.getMogoLocationClient().getLastKnowLocation(); - MoGoAiCloudTrafficLive.viewFrontIntersectionLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), new ITrafficIntersectionLiveCallBack() { - @Override - public void liveUrlResult(String liveUrl) { - if (!TextUtils.isEmpty(liveUrl)) { - MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo(); - carLiveInfo.setVideoUrl(liveUrl); - setCarLiveInfo(carLiveInfo); - playLiveVideo(carLiveInfo); - } else { - Logger.d(MODULE_NAME, "startLive 路口实况直播地址为空"); - } - } - - @Override - public void onError(String errorMsg) { - Logger.d(MODULE_NAME, "获取路口实况失败"); - } - }); - } - } - } - - /** - * 播放直播流,且开始心跳 - */ - private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - if (mTxcVideoView != null) { - mTxcVideoView.setPlayListener(event -> { - Logger.w(MODULE_NAME, "播放器:onPlayEvent==" + event); - if (event == PLAY_EVT_PLAY_LOADING) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - } else if (event == PLAY_EVT_PLAY_BEGIN) { - refreshStatusToListener(true); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(GONE); - } else if (event < 0) { - refreshStatusToListener(false); - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("直播获取识败,可以对我说重试", null); - stopLive(); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, - v2XVoiceCallbackRefreshListener); - } - }); - gsyVideoOptionBuilder.setUrl(carLiveInfo.getVideoUrl()).setCacheWithPlay(false).setPlayTag(TAG) - .build(mTxcVideoView); - mTxcVideoView.getStartButton().performClick(); - } - } - - public void stopLive() { - try { - Logger.w(MODULE_NAME, "关闭直播..."); - GSYVideoManager.releaseAllVideos(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - - @Override - protected void onDetachedFromWindow() { - stopLive(); - mLoading.setVisibility(VISIBLE); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP); - super.onDetachedFromWindow(); - } - - private void refreshStatusToListener(boolean videoPlaying) { - if (onVideoStatusChange != null) { - onVideoStatusChange.videoPlaying(videoPlaying); - } - } - - private OnVideoStatusChange onVideoStatusChange; - - public void addOnVideoStatusChangeListener(OnVideoStatusChange onVideoStatusChange) { - this.onVideoStatusChange = onVideoStatusChange; - } - - public interface OnVideoStatusChange { - void videoPlaying(boolean videoPlaying); - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java deleted file mode 100644 index 585aa6ac9e..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; - -import androidx.annotation.Nullable; - -import com.mogo.commons.debug.DebugConfig; -import com.mogo.module.v2x.R; - -/** - * 事件面板的提示按钮 - * - * @author donghongyu - */ -public class V2XEventPanelHistoryCountView extends LinearLayout { - private RelativeLayout mLlEventMore; - private TextView mTvEventCount; - - public V2XEventPanelHistoryCountView(Context context) { - this(context, null); - } - - public V2XEventPanelHistoryCountView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XEventPanelHistoryCountView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - LayoutInflater.from(context).inflate(R.layout.view_event_panel_history_count, this); - - mLlEventMore = findViewById(R.id.llEventMore); - mTvEventCount = findViewById(R.id.tvEventCount); - - if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) { - mLlEventMore.setVisibility(VISIBLE); - } else { - mLlEventMore.setVisibility(GONE); - } - } - - public void changeMsgCount(int count) { - if (mTvEventCount != null) { - if (count > 0) { - mTvEventCount.setVisibility(View.VISIBLE); - } else { - mTvEventCount.setVisibility(View.GONE); - } - mTvEventCount.setText("" + count); - } - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XListEmptyView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XListEmptyView.java deleted file mode 100644 index 4301964bd1..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XListEmptyView.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.mogo.module.v2x.view; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -import androidx.annotation.Nullable; - -import com.mogo.module.v2x.R; - -/** - * 列表空白布局View - * - * @author donghongyu - */ -public class V2XListEmptyView extends LinearLayout { - - private ImageView mIvEmptyView; - private TextView mTvTrip; - private TextView mBtnShear; - private TextView mBtnRefresh; - - private OnControlListener mOnControlListener; - - public V2XListEmptyView(Context context) { - this(context, null); - } - - public V2XListEmptyView(Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XListEmptyView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - LayoutInflater.from(context).inflate(R.layout.view_history_empty, this); - initView(); - } - - private void initView() { - mIvEmptyView = findViewById(R.id.ivEmptyView); - mTvTrip = findViewById(R.id.tvTrip); - mBtnShear = findViewById(R.id.btnShear); - mBtnRefresh = findViewById(R.id.btnRefresh); - - mBtnShear.setOnClickListener(v -> { - if (mOnControlListener != null) { - mOnControlListener.onShearClick(); - } - }); - mBtnRefresh.setOnClickListener(v -> { - if (mOnControlListener != null) { - mOnControlListener.onRefreshClick(); - } - }); - } - - public void setTripMessage(String tripMsg) { - if (mTvTrip != null) { - mTvTrip.setText(tripMsg); - } - } - - public void setShearVisibility(boolean visibility) { - if (mBtnShear != null) { - if (visibility) { - mBtnShear.setVisibility(VISIBLE); - } else { - mBtnShear.setVisibility(GONE); - } - } - } - - public void setRefreshVisibility(boolean visibility) { - if (mBtnRefresh != null) { - if (visibility) { - mBtnRefresh.setVisibility(VISIBLE); - } else { - mBtnRefresh.setVisibility(GONE); - } - } - } - - public void setOnControlListener(OnControlListener onControlListener) { - this.mOnControlListener = onControlListener; - } - - public interface OnControlListener { - void onShearClick(); - - void onRefreshClick(); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java deleted file mode 100644 index 9a6a634b81..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XLiveGSYVideoView.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.mogo.module.v2x.view; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -import android.content.Context; -import android.content.Intent; -import android.graphics.PorterDuff; -import android.os.Bundle; -import android.text.TextUtils; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.widget.ProgressBar; -import android.widget.TextView; - -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.core.content.ContextCompat; - -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.Utils; -import com.mogo.eagle.core.widget.RoundLayout; -import com.mogo.module.common.entity.MarkerCarInfo; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.tencent.rtmp.ITXLivePlayListener; -import com.tencent.rtmp.TXLiveConstants; -import com.tencent.rtmp.TXLivePlayConfig; -import com.tencent.rtmp.TXLivePlayer; -import com.tencent.rtmp.ui.TXCloudVideoView; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020-02-0623:07 - * desc : - * version: 1.0 - */ -public class V2XLiveGSYVideoView extends RoundLayout { - private final String TAG = "V2XLiveGSYVideoView"; - - private TXCloudVideoView mTxcVideoView; - private ProgressBar mLoading; - private TXLivePlayer mLivePlayer; - private ConstraintLayout mClLoadError; - - private MarkerCarInfo.CarLiveInfo mCarLiveInfo; - // 重新刷新直播流 - private final V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() { - @Override - public void onCallback(String command, Intent intent) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - }; - - public V2XLiveGSYVideoView(Context context) { - this(context, null); - } - - public V2XLiveGSYVideoView(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XLiveGSYVideoView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - - } - - private void initView(Context context) { - LayoutInflater.from(context) - .inflate(R.layout.view_video_layout_normal, this); - //mPlayerView 即 step1 中添加的界面 view - mTxcVideoView = findViewById(R.id.txcVideoView); - //创建 player 对象 - mLivePlayer = new TXLivePlayer(context); - //关键 player 对象与界面 view - mLivePlayer.setPlayerView(mTxcVideoView); - mLivePlayer.setMute(true); - - TXLivePlayConfig txLivePlayConfig = new TXLivePlayConfig(); - // 增加重试次数 - txLivePlayConfig.setConnectRetryCount(30); - mLivePlayer.setConfig(txLivePlayConfig); - - - mLivePlayer.enableHardwareDecode(true); - - mLoading = findViewById(R.id.loading); - mLoading.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.live_video_progress_bar_loading_color), PorterDuff.Mode.MULTIPLY); - - mClLoadError = findViewById(R.id.clLoadError); - TextView mTvRefreshButton = findViewById(R.id.tvRefreshButton); - mTvRefreshButton.setOnClickListener(v -> { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - }); - } - - /** - * 设置直播信息 - */ - public void setCarLiveInfo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - mCarLiveInfo = carLiveInfo; - } - - /** - * 开始直播 - * - * @param carLiveInfo 直播数据 - */ - public void startLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { - // 进行直播播放 - if (mLivePlayer != null - && carLiveInfo != null) { - if (!TextUtils.isEmpty(carLiveInfo.getVideoUrl())) { - setCarLiveInfo(carLiveInfo); - playLiveVideo(carLiveInfo); - } - } - } - - /** - * 播放直播流,且开始心跳 - */ - private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) { - try { - if (mLivePlayer != null) { - mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP); - mLivePlayer.setPlayListener(new ITXLivePlayListener() { - @Override - public void onPlayEvent(int event, Bundle bundle) { - // Logger.i(MODULE_NAME, - // "直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) + - // "\n播放器:onPlayEvent==" + event + - // "\nbundle===" + bundle); - if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) { - mLoading.setVisibility(VISIBLE); - mClLoadError.setVisibility(GONE); - } else if (event == TXLiveConstants.PLAY_EVT_PLAY_BEGIN) { - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(GONE); - } else if (event < 0) { - AIAssist.getInstance(Utils.getApp()).speakTTSVoice("直播获取失败,可以对我说重试", null); - stopLive(mCarLiveInfo); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - // 注册语音交互 - V2XVoiceManager.INSTANCE - .registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE, - v2XVoiceCallbackRefreshListener) - .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, - v2XVoiceCallbackRefreshListener); - } - } - - @Override - public void onNetStatus(Bundle bundle) { - // Logger.i(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle); - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - mLoading.setVisibility(GONE); - mClLoadError.setVisibility(VISIBLE); - Logger.e(MODULE_NAME, "直播发生异常:carLiveInfo= " + GsonUtil.jsonFromObject(carLiveInfo)); - } - } - - public void stopLive(MarkerCarInfo.CarLiveInfo carLiveInfo) { - try { - //Logger.i(MODULE_NAME, "心跳:关闭直播..."); - // 暂停 - mLivePlayer.pause(); - // true 代表清除最后一帧画面 - mLivePlayer.stopPlay(true); - mTxcVideoView.onDestroy(); - - // if (carLiveInfo.getVideoUrl() != null) { - // return; - // } - - // 停止推流 - // V2XServiceManager - // .getV2XRefreshModel() - // .livePush(new V2XRefreshCallback() { - // @Override - // public void onSuccess(V2XLivePushVoRes result) { - // Logger.d(MODULE_NAME, "播放器:" + result); - // } - // - // @Override - // public void onFail(String msg) { - // Logger.e(MODULE_NAME, "播放器:" + msg); - // } - // }, carLiveInfo.getVideoSn(), 1); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - if (mCarLiveInfo != null) { - startLive(mCarLiveInfo); - } - } - - @Override - protected void onDetachedFromWindow() { - stopLive(mCarLiveInfo); - mLoading.setVisibility(VISIBLE); - // 反注册语音交互 - V2XVoiceManager.INSTANCE - .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE) - .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP); - super.onDetachedFromWindow(); - } - -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt deleted file mode 100644 index d3e9c2c7e6..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/VideoInit.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.mogo.module.v2x - -import com.shuyu.gsyvideoplayer.GSYVideoManager -import com.shuyu.gsyvideoplayer.cache.CacheFactory -import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager -import com.shuyu.gsyvideoplayer.model.VideoOptionModel -import com.shuyu.gsyvideoplayer.player.IjkPlayerManager -import com.shuyu.gsyvideoplayer.player.PlayerFactory -import com.shuyu.gsyvideoplayer.utils.GSYVideoType -import tv.danmaku.ijk.media.player.IjkMediaPlayer - - -fun initVideo() { - PlayerFactory.setPlayManager(IjkPlayerManager::class.java) - CacheFactory.setCacheManager(ProxyCacheManager::class.java) - var list = mutableListOf() - list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1)) - list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0)) -// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1)) - GSYVideoManager.instance().optionModelList = list - GSYVideoType.enableMediaCodec() - GSYVideoType.enableMediaCodecTexture() -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceCallbackListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceCallbackListener.java deleted file mode 100644 index 8d3ec8317f..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceCallbackListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.voice; - -import android.content.Intent; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/21 4:47 PM - * desc : 语音回调 - * version: 1.0 - */ -public interface V2XVoiceCallbackListener { - void onCallback(String command, Intent intent); -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceConstants.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceConstants.java deleted file mode 100644 index b42cec802a..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceConstants.java +++ /dev/null @@ -1,347 +0,0 @@ -package com.mogo.module.v2x.voice; - -import java.util.HashMap; -import java.util.Map; - -/** - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x - * @ClassName: V2XVoiceConstants - * @Description: V2X语音唤醒词常量 - * @Author: fenghl - * @CreateDate: 2020/3/23 10:37 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/3/23 10:37 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -public class V2XVoiceConstants { - /** - * 免唤醒 - */ - public static final Map sVoiceCmds = new HashMap<>(); - /** - * 查看前方实况 - */ - public static final String COMMAND_ZHIDAO_V2X_LIVE_ROAD = "com.zhidao.auxiliaryDriving.liveBroadcastAhead"; - /** - * 关闭前方实况 - */ - public static final String COMMAND_ZHIDAO_V2X_CLOSE_WINDOW = "com.zhidao.auxiliaryDriving.closeLiveBroadcast"; - /** - * 下一条 - */ - public static final String COMMAND_ZHIDAO_V2X_NEXT = "com.zhidao.desk.next"; - /** - * 和他通话 - */ - public static final String COMMAND_ZHIDAO_V2X_CALL_CHATTING = "com.zhidao.onlinecar.chat"; - /** - * 点赞 - */ - public static final String COMMAND_ZHIDAO_V2X_ZAN = "com.zhidao.thumsup"; - /** - * 上报路况 - */ - public static final String COMMAND_ZHIDAO_V2X_REPORT = "com.zhidao.pathfinder.report.roadCondition"; - - /** - * 取消求助 - */ - public static final String COMMAND_ZHIDAO_V2X_CANCEL_HELP = "com.zhidao.auxiliaryDriving.cancelTroubleHelp"; - /** - * 发起故障求助 - */ - public static final String COMMAND_ZHIDAO_V2X_SEEK_HELP = "com.zhidao.auxiliaryDriving.pubTroubleHelp"; - /** - * 导航前往 - */ - public static final String COMMAND_ZHIDAO_V2X_NAVI = "com.zhidao.navi"; - /** - * 分享 - */ - public static final String COMMAND_ZHIDAO_V2X_SHARE = "com.zhidao.share"; - /** - * 确定 - */ - public static final String COMMAND_ZHIDAO_V2X_COMMON_CONFIRM = "com.zhidao.commin.confirm"; - /** - * 取消 - */ - public static final String COMMAND_ZHIDAO_V2X_COMMON_CANCEL = "com.zhidao.commin.cancel"; - - /** - * 呼叫前方车辆 - */ - public static final String COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR = "com.zhidao.imdemo.chat.callFrontCar"; - - /** - * 刷新直播车辆 - */ - public static final String COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE = "com.zhidao.user.action.retry"; - - /** - * 唤醒词:查看前车视频 - */ - public static final String COMMAND_ZHIDAO_V2X_AHEAD_LIVE = "com.zhidao.ahead.live"; - - /** - * 唤醒词:查看周围路口直播 - */ - public static final String COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE = "com.zhidao.crossroads.live"; - - /** - * 应用内免唤醒 - * 发起定向车聊聊 - */ - public static final String COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP = "COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP_WORDS = {"和他通话", "和他聊天", "聊更多", "拨打电话", "联系他"}; - /** - * 应用内免唤醒 - * 点赞 - */ - public static final String COMMAND_V2X_TO_ZAN_UN_WAKEUP = "COMMAND_V2X_TO_ZAN_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_ZAN_UN_WAKEUP_WORDS = {"感谢他", "感谢分享", "点个赞", "点赞"}; - /** - * 应用内免唤醒 - * 上报路况 - */ - public static final String COMMAND_V2X_TO_REPORT_ROAD_UN_WAKEUP = "COMMAND_V2X_TO_REPORT_ROAD_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_REPORT_ROAD_UN_WAKEUP_WORDS = {"信息纠错", "路况纠错"}; - /** - * 应用内免唤醒 - * 发起车聊聊求助周边车友 - */ - public static final String COMMAND_V2X_TO_SEEK_HELP_UN_WAKEUP = "COMMAND_V2X_TO_SEEK_HELP_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_SEEK_HELP_UN_WAKEUP_WORDS = {"故障求助", "发起故障求助"}; - /** - * 应用内免唤醒 - * 说取消求助,弹框显示 - */ - public static final String COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP = "COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_CANCEL_FOR_HELP_WAKEUP_WORDS = {"取消故障求助", "关闭故障求助", "取消求助"}; - /** - * 应用内免唤醒 - * 帮助他,发起车聊聊 - */ - public static final String COMMAND_V2X_TO_HELP_UN_WAKEUP = "COMMAND_V2X_TO_HELP_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_HELP_UN_WAKEUP_WORDS = {"帮助他"}; - /** - * 应用内免唤醒 - * 导航到POI信息点 - */ - public static final String COMMAND_V2X_TO_NAVI_UN_WAKEUP = "COMMAND_V2X_TO_NAVI_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_NAVI_UN_WAKEUP_WORDS = {"导航前往", "开始导航", "开启导航", "好", "开始", "导航", "确定", "确认", "好的"}; - /** - * 应用内免唤醒 - * 取消导航 - */ - public static final String COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP = "COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP"; - public static final String[] COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP_WORDS = {"取消","关闭","不要","不导航"}; - /** - * 应用内免唤醒 - * 调起分享流程 - */ - public static final String COMMAND_V2X_TO_SHARE_UN_WAKEUP = "COMMAND_V2X_TO_SHARE_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_SHARE_UN_WAKEUP_WORDS = {"上报油价", "我要分享"}; - /** - * 应用内免唤醒 - * 确定,打开路况详情,确定放弃求助 - */ - public static final String COMMAND_V2X_TO_CONFIRM_UN_WAKEUP = "COMMAND_V2X_TO_CONFIRM_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_CONFIRM_UN_WAKEUP_WORDS = {"确认", "确定"}; - /** - * 应用内免唤醒 - * 取消,继续求助 - */ - public static final String COMMAND_V2X_TO_CANCEL_UN_WAKEUP = "COMMAND_V2X_TO_CANCEL_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_CANCEL_UN_WAKEUP_WORDS = {"取消", "继续求助"}; - /** - * 应用内免唤醒 - * 关闭路况详情 - */ - public static final String COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP = "COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP"; - public static final String[] COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP_WORDS = {"关闭", "关闭页面"}; - /** - * 应用内免唤醒 - * 反馈"正确"语音回调 - */ - public static final String COMMAND_V2X_TO_FEEDBACK_TRUE = "COMMAND_V2X_TO_FEEDBACK_TRUE"; - public static final String[] COMMAND_V2X_TO_FEEDBACK_TRUE_WORDS = {"正确"}; - /** - * 应用内免唤醒 - * 反馈"错误"语音回调 - */ - public static final String COMMAND_V2X_TO_FEEDBACK_ERROR = "COMMAND_V2X_TO_FEEDBACK_ERROR"; - public static final String[] COMMAND_V2X_TO_FEEDBACK_ERROR_WORDS = {"错误"}; - - /** - * 应用内免唤醒 - * "呼叫前方车辆"语音回调 - */ - public static final String COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_UN_WAKEUP_WORDS = {"呼叫前方车辆"}; - - /** - * 应用内免唤醒 - * "查看直播","查看实况" - */ - public static final String COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP_WORDS = {"查看直播", "查看实况"}; - - /** - * 应用内免唤醒 - * "关闭直播","关闭实况" - */ - public static final String COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP_WORDS = {"关闭直播", "关闭实况"}; - - /** - * 应用内免唤醒 - * "重新尝试","重试" - */ - public static final String COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP_WORDS = {"重新尝试", "重试"}; - - /** - * 违章停车 - * 有用 - */ - public static final String COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP_WORDS = {"有用"}; - - /** - * 应用内免唤醒 - * "查看前车视频","查看前车直播","查看前车视角" - */ - public static final String COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP_WORDS = {"查看前车视频", "查看前车直播", "查看前车视角"}; - - /** - * 应用内免唤醒 - */ - public static final String COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP_WORDS = {"查看路口实况", "查看路口直播", "查看路口视频"}; - - /** - * 违章停车 - * 没用 - */ - public static final String COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP_WORDS = {"没用"}; - - /** - * 出行动态 - */ - public static final String COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP_WORDS = {"出行动态"}; - - /** - * 周边事件 - */ - public static final String COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP_WORDS = {"周边事件"}; - - /** - * 我的分享 - */ - public static final String COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP_WORDS = {"我的分享"}; - - /** - * 查看车辆信息 - */ - public static final String COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP_UN_WAKEUP_WORDS = {"查看车辆信息"}; - - - /** - * 用户UGC反馈免唤醒词语 - */ - // 拥堵 - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP_WORDS = {"拥堵", "很堵", "堵死了", "有点堵", "确定"}; - - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP_WORDS = {"没注意", "不堵", "很畅通", "取消", "关闭"}; - - - // 封路 - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP_WORDS = {"封路了", "封了", "封路", "有封路", "确定"}; - - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP_WORDS = {"不封路", "没注意", "没看到", "没有", "没封路", "无封路", "取消", "关闭"}; - - - // 事故 - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP_WORDS = {"有事故", "存在交通事故", "确定"}; - - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP_WORDS = {"没注意", "没有事故", "无事故", "没看到", "没有", "取消", "关闭"}; - - - // 道路施工 - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP_WORDS = {"有", "在施工", "有施工", "确定"}; - - public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP"; - public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP_WORDS = {"没注意", "没看到", "没有施工", "无施工", "很正常", "取消", "关闭"}; - - //免唤醒词 - public static final String V2X_CONFIRM_ACTION = "V2X_CONFIRM_ACTION"; - public static final String[] UNWAKE_NAVI_CONFIRM = {"开始导航", "开启导航", "好的", "开始", "导航", "确定", "确认", "好"}; - - public static final String V2X_CANCLE_ACTION = "V2X_CANCLE_ACTION"; - public static final String[] UNWAKE_NAVI_CANCLE = {"取消", "关闭", "不要", "不导航"}; - - - static { - // 免唤醒 默认 - sVoiceCmds.put(COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP, COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_NAVI_UN_WAKEUP, COMMAND_V2X_TO_NAVI_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP, COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_CONFIRM_UN_WAKEUP, COMMAND_V2X_TO_CONFIRM_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_CANCEL_UN_WAKEUP, COMMAND_V2X_TO_CANCEL_UN_WAKEUP_WORDS); - - sVoiceCmds.put(COMMAND_V2X_TO_ZAN_UN_WAKEUP, COMMAND_V2X_TO_ZAN_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_REPORT_ROAD_UN_WAKEUP, COMMAND_V2X_TO_REPORT_ROAD_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP_WORDS); - - sVoiceCmds.put(COMMAND_V2X_TO_SEEK_HELP_UN_WAKEUP, COMMAND_V2X_TO_SEEK_HELP_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP, COMMAND_V2X_TO_CANCEL_FOR_HELP_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_HELP_UN_WAKEUP, COMMAND_V2X_TO_HELP_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_FEEDBACK_TRUE, COMMAND_V2X_TO_FEEDBACK_TRUE_WORDS); - sVoiceCmds.put(COMMAND_V2X_TO_FEEDBACK_ERROR, COMMAND_V2X_TO_FEEDBACK_ERROR_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP, COMMAND_ZHIDAO_V2X_CLOSE_LIVE_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP, COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP_WORDS); - - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP, COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP, COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP_WORDS); - - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP_UN_WAKEUP_WORDS); - - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_YES_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_YONG_DU_NO_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_YES_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_FENG_LU_NO_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_YES_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GU_NO_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP_WORDS); - - sVoiceCmds.put(V2X_CONFIRM_ACTION, UNWAKE_NAVI_CONFIRM); - sVoiceCmds.put(V2X_CANCLE_ACTION, UNWAKE_NAVI_CANCLE); - - - //2020-6-24 顺义演示需求添加,现合并至launcher 更新时间:2020-08-25 - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP_WORDS); - sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP_WORDS); - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceManager.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceManager.kt deleted file mode 100644 index b86060cf3b..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoiceManager.kt +++ /dev/null @@ -1,190 +0,0 @@ -package com.mogo.module.v2x.voice - -import android.content.Context -import android.content.Intent -import android.text.TextUtils -import com.mogo.commons.voice.AIAssist -import com.mogo.commons.voice.IMogoVoiceCmdCallBack -import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.module.v2x.V2XConst.MODULE_NAME -import com.mogo.module.v2x.V2XServiceManager -import com.mogo.service.intent.IMogoIntentListener -import com.mogo.service.module.IMogoActionListener -import com.mogo.service.module.MogoAction -import java.lang.ref.WeakReference -import java.util.concurrent.ConcurrentHashMap - -/** - * - * @ProjectName: MoGoModulSafeDriving - * @Package: com.mogo.module.v2x.window - * @ClassName: V2XVoiceManager - * @Description: java类作用描述 - * @Author: fenghl - * @CreateDate: 2020/3/23 13:08 - * @UpdateUser: 更新者: - * @UpdateDate: 2020/3/23 13:08 - * @UpdateRemark: 更新说明: - * @Version: 1.0 - */ -object V2XVoiceManager : IMogoVoiceCmdCallBack, IMogoActionListener, IMogoIntentListener { - private val TAG = V2XVoiceManager.javaClass.simpleName - private lateinit var mContext: WeakReference - - // 翻页回调 - private var voicePagingListener: V2XVoicePagingListener? = null - - // 记录,免唤醒和唤醒词及对应的回调 - private val voiceCallbackMap = ConcurrentHashMap() - - fun init(context: Context) { - mContext = WeakReference(context) - } - - @Synchronized - fun removeAllOnVoiceReceiveListener() { - try { - for (mutableEntry in voiceCallbackMap) { - unRegisterWakeCmd(mutableEntry.key) - } - } catch (e: Exception) { - e.printStackTrace() - } - } - - // 注册唤醒词 - @Synchronized - fun registerWakeCmd(cmd: String, callbackListener: V2XVoiceCallbackListener): V2XVoiceManager { - try { - unRegisterWakeCmd(cmd) - voiceCallbackMap[cmd] = callbackListener - V2XServiceManager.getMogoIntentManager().registerIntentListener(cmd, this) - } catch (e: Exception) { - e.printStackTrace() - } - return this - } - - // 反注册唤醒词 - @Synchronized - fun unRegisterWakeCmd(cmd: String): V2XVoiceManager { - try { - voiceCallbackMap.remove(cmd) - V2XServiceManager.getMogoIntentManager().unregisterIntentListener(cmd, this) - } catch (e: Exception) { - e.printStackTrace() - } - return this - } - - // 注册免唤醒词 - @Synchronized - fun registerUnWakeVoice( - cmd: String, - callbackListener: V2XVoiceCallbackListener - ): V2XVoiceManager { - try { - if (!TextUtils.isEmpty(cmd)) { - try { - unRegisterUnWakeVoice(cmd) - mContext.get()?.let { - voiceCallbackMap[cmd] = callbackListener - AIAssist.getInstance(it) - .registerUnWakeupCommand(cmd, V2XVoiceConstants.sVoiceCmds[cmd], this) - } - } catch (e: Exception) { - e.printStackTrace() - } - } - } catch (e: Exception) { - e.printStackTrace() - } - return this - } - - // 反注册面唤醒词 - @Synchronized - fun unRegisterUnWakeVoice(cmd: String): V2XVoiceManager { - try { - if (!TextUtils.isEmpty(cmd)) { - try { - mContext.get()?.let { - voiceCallbackMap.remove(cmd) - AIAssist.getInstance(it).unregisterUnWakeupCommand(cmd, this) - } - } catch (e: Exception) { - e.printStackTrace() - } - } - } catch (e: Exception) { - e.printStackTrace() - } - return this - } - - /** - * 注册翻页回调监听 - */ - @Synchronized - fun registerPagingCallback(voicePagingListener: V2XVoicePagingListener): V2XVoiceManager { - try { - this.voicePagingListener = voicePagingListener - V2XServiceManager.getMogoActionManager().registerActionListener(MODULE_NAME, this) - } catch (e: Exception) { - e.printStackTrace() - } - return this - } - - /** - * 反注册翻页回调监听 - */ - @Synchronized - fun unRegisterPagingCallback(): V2XVoiceManager { - try { - this.voicePagingListener = null - V2XServiceManager.getMogoActionManager() - .unregisterActionListener(MODULE_NAME, this) - } catch (e: Exception) { - e.printStackTrace() - } - return this - } - - override fun onIntentReceived(command: String?, intent: Intent?) { - Logger.d(MODULE_NAME, "v2x voice command= $command") - voiceCallbackMap[command]?.onCallback(command, intent) - } - - override fun onCmdSelected(cmd: String?) { - Logger.d(MODULE_NAME, "v2x voice command== onCmdSelected $cmd") - voiceCallbackMap[cmd]?.onCallback(cmd, null) - } - - override fun onActionDone(action: MogoAction?) { - try { - Logger.d(MODULE_NAME, "v2x voice command== onActionDone $action") - when (action) { - MogoAction.Next -> { - voicePagingListener?.onNextCallback() - } - MogoAction.Prev -> { - voicePagingListener?.onPrevCallback() - } - } - } catch (e: Exception) { - e.printStackTrace() - } - } - - override fun onSpeakEnd(speakText: String?) { - - } - - override fun onCmdAction(speakText: String?) {} - - override fun onCmdCancel(speakText: String?) {} - - override fun onSpeakSelectTimeOut(speakText: String?) {} - -} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoicePagingListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoicePagingListener.java deleted file mode 100644 index 4645d2ff4e..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/voice/V2XVoicePagingListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.module.v2x.voice; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/21 4:47 PM - * desc : 语音翻页回调 - * version: 1.0 - */ -public interface V2XVoicePagingListener { - void onNextCallback(); - - void onPrevCallback(); -} diff --git a/modules/mogo-module-v2x/src/main/res/anim/v2x_like_heart_animation.xml b/modules/mogo-module-v2x/src/main/res/anim/v2x_like_heart_animation.xml deleted file mode 100644 index eb0b1e566a..0000000000 --- a/modules/mogo-module-v2x/src/main/res/anim/v2x_like_heart_animation.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/anim/v2x_like_heart_animation_vr.xml b/modules/mogo-module-v2x/src/main/res/anim/v2x_like_heart_animation_vr.xml deleted file mode 100644 index bdf486cf3f..0000000000 --- a/modules/mogo-module-v2x/src/main/res/anim/v2x_like_heart_animation_vr.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_animation.xml b/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_animation.xml deleted file mode 100644 index 80c10a9a34..0000000000 --- a/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_animation.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_animation_vr.xml b/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_animation_vr.xml deleted file mode 100644 index bdf486cf3f..0000000000 --- a/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_animation_vr.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_scale_ani_vr.xml b/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_scale_ani_vr.xml deleted file mode 100644 index 383effa7da..0000000000 --- a/modules/mogo-module-v2x/src/main/res/anim/v2x_unlike_heart_scale_ani_vr.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/color/radiobutton_textcolor.xml b/modules/mogo-module-v2x/src/main/res/color/radiobutton_textcolor.xml deleted file mode 100644 index 8c93dd733b..0000000000 --- a/modules/mogo-module-v2x/src/main/res/color/radiobutton_textcolor.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_ambulance.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_ambulance.png deleted file mode 100644 index 05ee2cfbfd..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_ambulance.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_gray.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_gray.png deleted file mode 100644 index ed4058f51a..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_gray.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_police.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_police.png deleted file mode 100644 index 5ee2ca12b0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_car_police.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_event_panel_more.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_event_panel_more.png deleted file mode 100644 index c7c8180c9c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_event_panel_more.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_like.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_like.png deleted file mode 100644 index 3ce8b5d793..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_like.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_like_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_like_bg.png deleted file mode 100644 index 95f8552545..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_like_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_unlike.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_unlike.png deleted file mode 100644 index 2df4d5ba5d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_heart_unlike.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_illegal_parking.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_illegal_parking.png deleted file mode 100644 index a49b3d9c54..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_illegal_parking.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_live_load_error.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_live_load_error.png deleted file mode 100644 index 291d9e3716..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_live_load_error.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_parking_p.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_parking_p.png deleted file mode 100644 index 3d31d18906..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_parking_p.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_err.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_err.png deleted file mode 100644 index 87f8917f9f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_err.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_err_press.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_err_press.png deleted file mode 100644 index 4318fc1e86..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_err_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_true.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_true.png deleted file mode 100644 index ac0f7e84a4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_true.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_true_press.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_true_press.png deleted file mode 100644 index ec4559d362..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_report_true_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_share_empty.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_share_empty.png deleted file mode 100644 index 2c5aece9b2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_share_empty.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_talk.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_talk.png deleted file mode 100644 index 3f90fd4af5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_talk.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/module_v2x_shadow_bkg.9.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/module_v2x_shadow_bkg.9.png deleted file mode 100644 index e73d76936f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/module_v2x_shadow_bkg.9.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/mogo_image_blank_nor.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/mogo_image_blank_nor.png deleted file mode 100644 index 893d02518c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/mogo_image_blank_nor.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live.png deleted file mode 100644 index af42121b15..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live_press.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live_press.png deleted file mode 100644 index 6947f5a5d4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav.png deleted file mode 100644 index a3b2b49a94..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav_press.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav_press.png deleted file mode 100644 index 31788252af..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk.png deleted file mode 100644 index 151904c2d9..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk_press.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk_press.png deleted file mode 100644 index 8da24b97ee..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_zan.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_zan.png deleted file mode 100644 index 41fd5acfaf..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_event_icon_zan.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_event_live_top.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_event_live_top.png deleted file mode 100644 index 5b6b44b6d6..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_event_live_top.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_event_play.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_event_play.png deleted file mode 100644 index d5935d1fb3..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_event_play.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_help_navi.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_help_navi.png deleted file mode 100644 index 146a596c25..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_help_navi.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_live_logo.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_live_logo.png deleted file mode 100644 index b964d6b4ad..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_live_logo.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png deleted file mode 100644 index bff6a53df5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_share_item_like.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_share_item_like.png deleted file mode 100644 index 49b9436c57..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_share_item_like.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_share_item_unlike.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_share_item_unlike.png deleted file mode 100644 index 86ddd897ca..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_share_item_unlike.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_surrounding_bottom_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_surrounding_bottom_bg.png deleted file mode 100644 index 5a9ca34e56..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_surrounding_bottom_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png deleted file mode 100644 index d89535c229..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png deleted file mode 100644 index 2a4abd712c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_video_pause.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_video_pause.png deleted file mode 100644 index 90b401f17f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_video_pause.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_1.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_1.png deleted file mode 100644 index 174477c2fc..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_1.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_blue.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_blue.png deleted file mode 100644 index 7ba009ab68..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_blue.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_green.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_green.png deleted file mode 100644 index 0e475f3325..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_green.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_live_vedio.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_live_vedio.png deleted file mode 100644 index 62e03cf85f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_live_vedio.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_red.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_red.png deleted file mode 100644 index 3cb6737f6d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_red.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_orange.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_orange.png deleted file mode 100644 index 3457a850ca..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_orange.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_red.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_red.png deleted file mode 100644 index 51038d26f4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_red.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00014.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00014.png deleted file mode 100644 index beb5a59f54..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00014.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00016.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00016.png deleted file mode 100644 index 9a23c12a36..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00016.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00021.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00021.png deleted file mode 100644 index 5bc6419dfe..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00021.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00022.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00022.png deleted file mode 100644 index ef392fd356..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00022.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00024.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00024.png deleted file mode 100644 index 2a72efc51b..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00024.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00025.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00025.png deleted file mode 100644 index 67c7798238..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00025.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00026.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00026.png deleted file mode 100644 index d5829c621c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00026.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00027.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00027.png deleted file mode 100644 index f8617cf9ca..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00027.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00028.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00028.png deleted file mode 100644 index d0ce57e557..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00028.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00029.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00029.png deleted file mode 100644 index 78264c7ac8..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00029.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00030.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00030.png deleted file mode 100644 index d730bd66fa..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00030.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00031.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00031.png deleted file mode 100644 index 8501a0436e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00031.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00032.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00032.png deleted file mode 100644 index 5546e8c689..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00032.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00033.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00033.png deleted file mode 100644 index 430bbfa6df..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00033.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00034.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00034.png deleted file mode 100644 index 73acf7d907..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00034.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00035.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00035.png deleted file mode 100644 index 0f28b9bfb7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00035.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00036.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00036.png deleted file mode 100644 index 9b2f25f6e2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00036.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00037.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00037.png deleted file mode 100644 index f652bdb6ae..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00037.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00038.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00038.png deleted file mode 100644 index 8dc68ecf6d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00038.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00039.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00039.png deleted file mode 100644 index 4446b13c19..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00039.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00040.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00040.png deleted file mode 100644 index f85ee6194f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00040.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00041.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00041.png deleted file mode 100644 index 47ce61dfa3..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00041.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00042.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00042.png deleted file mode 100644 index 9f4f9745c0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00042.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00043.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00043.png deleted file mode 100644 index 624af113ad..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00043.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00044.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00044.png deleted file mode 100644 index 224a21e14c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00044.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00045.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00045.png deleted file mode 100644 index 201975ff46..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00045.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00046.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00046.png deleted file mode 100644 index 8423e68d87..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00046.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00047.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00047.png deleted file mode 100644 index 973f2a7c95..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00047.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00048.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00048.png deleted file mode 100644 index 631cb79062..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00048.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_event_panel_more.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_event_panel_more.png deleted file mode 100644 index ab63bcf60e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_event_panel_more.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_gray_back_heart.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_gray_back_heart.png deleted file mode 100644 index 119a39baa7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_gray_back_heart.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_heart_like_for_gray_back.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_heart_like_for_gray_back.png deleted file mode 100644 index f3709207db..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/icon_heart_like_for_gray_back.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/module_v2x_shadow_bkg.9.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/module_v2x_shadow_bkg.9.png deleted file mode 100644 index e73d76936f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/module_v2x_shadow_bkg.9.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_back_image.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_back_image.png deleted file mode 100644 index b1752e1069..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_back_image.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_icon_live_logo.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_icon_live_logo.png deleted file mode 100644 index e02a57044f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_icon_live_logo.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_share_item_like.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_share_item_like.png deleted file mode 100644 index 49b9436c57..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_share_item_like.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_share_item_unlike.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_share_item_unlike.png deleted file mode 100644 index 86ddd897ca..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_share_item_unlike.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_surrounding_bottom_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_surrounding_bottom_bg.png deleted file mode 100644 index 5a9ca34e56..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_surrounding_bottom_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_video_pause.png b/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_video_pause.png deleted file mode 100644 index 90b401f17f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-mdpi/v2x_video_pause.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_ambulance.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_ambulance.png deleted file mode 100644 index 1fb8c62b72..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_ambulance.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_gray.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_gray.png deleted file mode 100644 index d4266a6bc5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_gray.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_police.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_police.png deleted file mode 100644 index 3407261744..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_police.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like.png deleted file mode 100644 index ce886a2383..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like_bg.png deleted file mode 100644 index f196b6ff8e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_unlike.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_unlike.png deleted file mode 100644 index 0401ccc256..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_unlike.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_illegal_parking.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_illegal_parking.png deleted file mode 100644 index 7dcda74ee9..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_illegal_parking.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_live_load_error.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_live_load_error.png deleted file mode 100644 index a1da551655..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_live_load_error.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_parking_p.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_parking_p.png deleted file mode 100644 index 6a642ee946..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_parking_p.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err.png deleted file mode 100644 index a4b8fbd13d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err_press.png deleted file mode 100644 index ffac947bc7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true.png deleted file mode 100644 index 1614677f9f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true_press.png deleted file mode 100644 index cdad7807af..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png deleted file mode 100644 index 89680bd182..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live.png deleted file mode 100644 index c9be5c80ae..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live_press.png deleted file mode 100644 index d03db9ccf3..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav.png deleted file mode 100644 index 94f4de32d9..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav_press.png deleted file mode 100644 index e3aeed7b92..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk.png deleted file mode 100644 index ffb73a8dbc..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk_press.png deleted file mode 100644 index db9134bd4d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_zan.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_zan.png deleted file mode 100644 index c9db0a1ac4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_zan.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_ahead_car_brake.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_ahead_car_brake.png deleted file mode 100644 index a6e80ec51e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_ahead_car_brake.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_car_collide_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_car_collide_warning.png deleted file mode 100644 index f5fd2de5e0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_car_collide_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_live_top.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_live_top.png deleted file mode 100644 index db5d04ce7c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_live_top.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_play.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_play.png deleted file mode 100644 index 685e1a2058..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_play.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_help_navi.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_help_navi.png deleted file mode 100644 index 0152e59bb2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_help_navi.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_live_logo.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_live_logo.png deleted file mode 100644 index dabf25dbbb..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_live_logo.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png deleted file mode 100644 index bff6a53df5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_surrounding_bottom_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_surrounding_bottom_bg.png deleted file mode 100644 index 30690aeb2e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_surrounding_bottom_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png deleted file mode 100644 index d89535c229..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png deleted file mode 100644 index 2a4abd712c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_video_pause.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_video_pause.png deleted file mode 100644 index cbd22bb486..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_video_pause.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_1.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_1.png deleted file mode 100644 index 8ac13e867f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_1.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_blue.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_blue.png deleted file mode 100644 index a1f1c64566..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_blue.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_green.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_green.png deleted file mode 100644 index 16eb35f38e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_green.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_live_vedio.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_live_vedio.png deleted file mode 100644 index 3b89ecae7c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_live_vedio.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_red.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_red.png deleted file mode 100644 index cc09e40811..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_red.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_orange.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_orange.png deleted file mode 100644 index 70b3c056ea..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_orange.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_red.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_red.png deleted file mode 100644 index ed1542ea36..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_red.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/icon_play.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/icon_play.png deleted file mode 100644 index bd17c2a12c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/icon_play.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/module_v2x_vr_close.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/module_v2x_vr_close.png deleted file mode 100644 index 95a08f52f4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/module_v2x_vr_close.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_ahead_car_brake.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_ahead_car_brake.png deleted file mode 100644 index 31ea64f0ea..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_ahead_car_brake.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_car_collide_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_car_collide_warning.png deleted file mode 100644 index e7709ff347..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_car_collide_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_optimal_route_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_optimal_route_warning.png deleted file mode 100644 index 76ae6f035a..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_optimal_route_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_car_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_car_warning.png deleted file mode 100644 index e7709ff347..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_car_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_m_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_m_warning.png deleted file mode 100644 index cc0d8a7df3..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_m_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_p_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_p_warning.png deleted file mode 100644 index f51d7f39f9..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_p_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_ambulance.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_ambulance.png deleted file mode 100644 index 1fb8c62b72..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_ambulance.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png deleted file mode 100644 index 6244ee2b2f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_gray.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_gray.png deleted file mode 100644 index d4266a6bc5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_gray.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_police.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_police.png deleted file mode 100644 index 3407261744..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_police.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_event_panel_more.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_event_panel_more.png deleted file mode 100644 index 5d6656f2d0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_event_panel_more.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like.png deleted file mode 100644 index ce886a2383..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like_bg.png deleted file mode 100644 index f196b6ff8e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like_for_gray_back.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like_for_gray_back.png deleted file mode 100644 index 728ef1d32d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_like_for_gray_back.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_unlike.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_unlike.png deleted file mode 100644 index 0401ccc256..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_heart_unlike.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking.png deleted file mode 100644 index 7dcda74ee9..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking_vr.png deleted file mode 100644 index 974fc9bbd0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking_vr.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_live_load_error.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_live_load_error.png deleted file mode 100644 index a1da551655..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_live_load_error.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_parking_p.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_parking_p.png deleted file mode 100644 index f3f8b82f3d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_parking_p.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_play.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_play.png deleted file mode 100644 index b38e732923..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_play.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_err.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_err.png deleted file mode 100644 index a4b8fbd13d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_err.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_err_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_err_press.png deleted file mode 100644 index ffac947bc7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_err_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_true.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_true.png deleted file mode 100644 index 1614677f9f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_true.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_true_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_true_press.png deleted file mode 100644 index cdad7807af..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_report_true_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_share_empty.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_share_empty.png deleted file mode 100644 index 4d860aba9b..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_share_empty.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_talk.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_talk.png deleted file mode 100644 index 89680bd182..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_talk.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_shadow_bkg.9.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_shadow_bkg.9.png deleted file mode 100644 index 239b9eb114..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_shadow_bkg.9.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_suddenly_break.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_suddenly_break.png deleted file mode 100644 index fc413a6bd0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_suddenly_break.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_vr_close.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_vr_close.png deleted file mode 100644 index c7f8ef2830..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/module_v2x_vr_close.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/mogo_image_blank_nor.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/mogo_image_blank_nor.png deleted file mode 100644 index c77748e661..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/mogo_image_blank_nor.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png deleted file mode 100644 index 8344ac641c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live.png deleted file mode 100644 index c9be5c80ae..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_press.png deleted file mode 100644 index d03db9ccf3..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_vr.png deleted file mode 100644 index eb18411f9f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_vr.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav.png deleted file mode 100644 index 94f4de32d9..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav_press.png deleted file mode 100644 index e3aeed7b92..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk.png deleted file mode 100644 index ffb73a8dbc..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_press.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_press.png deleted file mode 100644 index db9134bd4d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_press.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_vr.png deleted file mode 100644 index 5b1a5378b1..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_vr.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png deleted file mode 100644 index 3b65e46367..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_zan.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_zan.png deleted file mode 100644 index c9db0a1ac4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_zan.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_ahead_car_brake.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_ahead_car_brake.png deleted file mode 100644 index a6e80ec51e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_ahead_car_brake.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_car_collide_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_car_collide_warning.png deleted file mode 100644 index f5fd2de5e0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_car_collide_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_live_top.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_live_top.png deleted file mode 100644 index db5d04ce7c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_live_top.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_play.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_play.png deleted file mode 100644 index 685e1a2058..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_play.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_help_navi.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_help_navi.png deleted file mode 100644 index 0152e59bb2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_help_navi.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_live_logo.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_live_logo.png deleted file mode 100644 index 5480b6d165..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_live_logo.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_optimal_speed.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_optimal_speed.png deleted file mode 100644 index c7d9845123..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_optimal_speed.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_rush_red_light.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_rush_red_light.png deleted file mode 100644 index 885d5dfeb7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_rush_red_light.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_traffic_light.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_traffic_light.png deleted file mode 100644 index 81a5f5eee8..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_traffic_light.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_urgency_collision.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_urgency_collision.png deleted file mode 100644 index 383e8897b1..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_urgency_collision.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png deleted file mode 100644 index bff6a53df5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_unlike_animation_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_unlike_animation_vr.png deleted file mode 100644 index 6d0c6bcddf..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_unlike_animation_vr.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_nav_normal.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_nav_normal.png deleted file mode 100644 index 3d251225a2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_nav_normal.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_nav_select.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_nav_select.png deleted file mode 100644 index a9178c8f7b..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_nav_select.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_obu_green_point.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_obu_green_point.png deleted file mode 100644 index 6e48b03365..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_obu_green_point.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_obu_traffic_light_pop.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_obu_traffic_light_pop.png deleted file mode 100644 index 5e70e5f300..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_obu_traffic_light_pop.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_optimal_route_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_optimal_route_warning.png deleted file mode 100644 index b358c39eaf..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_optimal_route_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_car_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_car_warning.png deleted file mode 100644 index f5fd2de5e0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_car_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png deleted file mode 100644 index 26ca1bb28f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png deleted file mode 100644 index 20faebbdb1..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_share_item_like.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_share_item_like.png deleted file mode 100644 index 3a4e93249b..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_share_item_like.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_share_item_unlike.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_share_item_unlike.png deleted file mode 100644 index d169b2e1c0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_share_item_unlike.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_stop_line.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_stop_line.png deleted file mode 100644 index 2bda783ed5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_stop_line.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_surrounding_bottom_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_surrounding_bottom_bg.png deleted file mode 100644 index 30690aeb2e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_surrounding_bottom_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_tip_bg.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_tip_bg.png deleted file mode 100644 index 22404daa42..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_tip_bg.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png deleted file mode 100644 index d89535c229..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png deleted file mode 100644 index 2a4abd712c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_video_pause.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_video_pause.png deleted file mode 100644 index cbd22bb486..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_video_pause.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_event_ugc_fenglu.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_event_ugc_fenglu.png deleted file mode 100644 index b3328eba18..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_event_ugc_fenglu.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_1.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_1.png deleted file mode 100644 index 8ac13e867f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_1.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_blue.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_blue.png deleted file mode 100644 index a1f1c64566..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_blue.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_green.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_green.png deleted file mode 100644 index 16eb35f38e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_green.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_live_vedio.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_live_vedio.png deleted file mode 100644 index 3b89ecae7c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_live_vedio.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_red.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_red.png deleted file mode 100644 index cc09e40811..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_red.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_orange.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_orange.png deleted file mode 100644 index 70b3c056ea..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_orange.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_red.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_red.png deleted file mode 100644 index ed1542ea36..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_red.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png deleted file mode 100644 index 7a03a5972c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png deleted file mode 100644 index cd1e0c45a7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png deleted file mode 100644 index 7a376915ce..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png deleted file mode 100644 index c98ac95838..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png deleted file mode 100644 index ec40533fa8..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png deleted file mode 100644 index ae901b2df2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png deleted file mode 100644 index eef4b4e0ea..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png deleted file mode 100644 index 5bcd897394..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png deleted file mode 100644 index 15db7cf734..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png deleted file mode 100644 index b20d6046d7..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png deleted file mode 100644 index 608e8f2be1..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png deleted file mode 100644 index 8d4bf7cbc2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png deleted file mode 100644 index ed13d90608..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png deleted file mode 100644 index 3a06bcb678..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png deleted file mode 100644 index 6c5451ca49..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png deleted file mode 100644 index 09b2e8480f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png deleted file mode 100644 index 2841ed3770..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png deleted file mode 100644 index 18a981fdd2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png deleted file mode 100644 index cbca5fd792..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png deleted file mode 100644 index 6febc135b1..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png deleted file mode 100644 index a4561c8e5e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png deleted file mode 100644 index 7a94145199..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png deleted file mode 100644 index d69704044c..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png deleted file mode 100644 index 971078720b..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png deleted file mode 100644 index f5c9b2c48a..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png deleted file mode 100644 index a65cf8591b..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png deleted file mode 100644 index 22d424dcf0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png deleted file mode 100644 index 56c66de923..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png deleted file mode 100644 index 862fbc25f6..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png deleted file mode 100644 index 0d8e1f1b63..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png deleted file mode 100644 index 50a65c8571..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png deleted file mode 100644 index ca3d131845..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png deleted file mode 100644 index 07a4f2e837..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png deleted file mode 100644 index e477715df4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png deleted file mode 100644 index eadea4fcc2..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png deleted file mode 100644 index 062e7f2ab6..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png deleted file mode 100644 index 9dde80c060..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png deleted file mode 100644 index 69de6b84ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png deleted file mode 100644 index 6b473ad63f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png deleted file mode 100644 index bbddd52ad0..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png deleted file mode 100644 index 4d4764b480..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png deleted file mode 100644 index 9f3b4d984e..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png deleted file mode 100644 index 82562e17b5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png deleted file mode 100644 index 5d1d66203a..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png deleted file mode 100644 index 50abe7d551..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00033.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00033.png deleted file mode 100644 index 8a003c8e3d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00033.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00034.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00034.png deleted file mode 100644 index 230ee94c1d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00034.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00035.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00035.png deleted file mode 100644 index 77c8249773..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00035.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00036.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00036.png deleted file mode 100644 index eb56f215d4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00036.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00037.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00037.png deleted file mode 100644 index 5f2e25f715..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00037.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00038.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00038.png deleted file mode 100644 index 6a5a43bb81..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00038.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00039.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00039.png deleted file mode 100644 index 9e44b9cbc4..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00039.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00040.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00040.png deleted file mode 100644 index c7af54abf5..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00040.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00041.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00041.png deleted file mode 100644 index 500fc225a3..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00041.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00042.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00042.png deleted file mode 100644 index b7937f9a6f..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00042.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00043.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00043.png deleted file mode 100644 index 65e4b4e3f1..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00043.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00044.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00044.png deleted file mode 100644 index 7f6962fd0d..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00044.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00045.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00045.png deleted file mode 100644 index 42c2fd7210..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00045.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00046.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00046.png deleted file mode 100644 index 37279985dc..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00046.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00047.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00047.png deleted file mode 100644 index 99e775a8a6..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00047.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00048.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00048.png deleted file mode 100644 index 3cbad345ec..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00048.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_count_down.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_count_down.xml deleted file mode 100644 index 85ecbf1d2c..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_count_down.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_fatigue_driving.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_fatigue_driving.xml deleted file mode 100644 index a963da5710..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_fatigue_driving.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml deleted file mode 100644 index b28203b717..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_description.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_description.xml deleted file mode 100644 index 88fd3e48c6..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_description.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_list_item.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_list_item.xml deleted file mode 100644 index 19e1828951..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_list_item.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_live_show.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_live_show.xml deleted file mode 100644 index 00d8af5a9a..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_live_show.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml deleted file mode 100644 index d04f7b325b..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_gray.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_gray.xml deleted file mode 100644 index f77de0dd88..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_gray.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_green.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_green.xml deleted file mode 100644 index 1f055ae661..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_green.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml deleted file mode 100644 index 68e4fa978f..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml deleted file mode 100644 index 86fe790833..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml deleted file mode 100644 index 43b446e4c6..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml deleted file mode 100644 index ead9ee25ff..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml deleted file mode 100644 index 3d72d093db..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_red_two_round_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_red_two_round_vr.xml deleted file mode 100644 index 9181fc498d..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_red_two_round_vr.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_refresh.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_refresh.xml deleted file mode 100644 index 4d7ff1b8b4..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_refresh.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_surrounding_event_list_item.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_surrounding_event_list_item.xml deleted file mode 100644 index d1f0a2354f..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_surrounding_event_list_item.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/selector_live_btn.xml b/modules/mogo-module-v2x/src/main/res/drawable/selector_live_btn.xml deleted file mode 100644 index 28e53ff402..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/selector_live_btn.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/selector_live_btn_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/selector_live_btn_vr.xml deleted file mode 100644 index 669fac1b71..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/selector_live_btn_vr.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/selector_nav_btn.xml b/modules/mogo-module-v2x/src/main/res/drawable/selector_nav_btn.xml deleted file mode 100644 index 3bb0c35207..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/selector_nav_btn.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/selector_nav_history.xml b/modules/mogo-module-v2x/src/main/res/drawable/selector_nav_history.xml deleted file mode 100644 index d2fd354592..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/selector_nav_history.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/selector_talk_btn.xml b/modules/mogo-module-v2x/src/main/res/drawable/selector_talk_btn.xml deleted file mode 100644 index a610ade8e5..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/selector_talk_btn.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/selector_talk_btn_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/selector_talk_btn_vr.xml deleted file mode 100644 index b257f9d769..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/selector_talk_btn_vr.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_alert_window_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_alert_window_bg.xml deleted file mode 100644 index 5f9bc8d7d2..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_alert_window_bg.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_alert_window_live_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_alert_window_live_bg.xml deleted file mode 100644 index 676812c88a..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_alert_window_live_bg.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_big_image_dark.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_big_image_dark.xml deleted file mode 100644 index 318b24d43d..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_big_image_dark.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_pop_up.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_pop_up.xml deleted file mode 100644 index 4f4bca8d1c..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_pop_up.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_video_tip_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_video_tip_vr.xml deleted file mode 100644 index 3d287b5ac1..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bg_video_tip_vr.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bkg_dark_light_same.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_bkg_dark_light_same.xml deleted file mode 100644 index df4fdef366..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_bkg_dark_light_same.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_message_bkg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_message_bkg.xml deleted file mode 100644 index d4a17f0e59..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_message_bkg.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_front_warning_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_front_warning_bg.xml deleted file mode 100644 index 54f571d1e5..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_front_warning_bg.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml deleted file mode 100644 index e71c897020..0000000000 --- a/modules/mogo-module-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/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml deleted file mode 100644 index eefd1be813..0000000000 --- a/modules/mogo-module-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/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_green_info.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_green_info.xml deleted file mode 100644 index d9d5e5dade..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_green_info.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_red_info.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_red_info.xml deleted file mode 100644 index 6c70c8805c..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_map_marker_driver_type_red_info.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_nav_normal.png b/modules/mogo-module-v2x/src/main/res/drawable/v2x_nav_normal.png deleted file mode 100644 index dad9f9ebad..0000000000 Binary files a/modules/mogo-module-v2x/src/main/res/drawable/v2x_nav_normal.png and /dev/null differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_panel_color_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_panel_color_bg.xml deleted file mode 100644 index 8c81ded7de..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_panel_color_bg.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_park_car_port_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_park_car_port_bg.xml deleted file mode 100644 index bbd6610cf6..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_park_car_port_bg.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_park_title_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_park_title_bg.xml deleted file mode 100644 index 2f56f2803e..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_park_title_bg.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_refresh_button_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_refresh_button_bg.xml deleted file mode 100644 index 0fcf244473..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_refresh_button_bg.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_selector_icon_report_err.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_selector_icon_report_err.xml deleted file mode 100644 index bfbafddbd0..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_selector_icon_report_err.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_selector_icon_report_true.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_selector_icon_report_true.xml deleted file mode 100644 index c53b2ccb27..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_selector_icon_report_true.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_shadow_shape_view.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_shadow_shape_view.xml deleted file mode 100644 index 2b616f3e68..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_shadow_shape_view.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_shape_bg_count_down_corner_14.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_shape_bg_count_down_corner_14.xml deleted file mode 100644 index 9f90c34357..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_shape_bg_count_down_corner_14.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml deleted file mode 100644 index 9320416f62..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_to_nav.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_to_nav.xml deleted file mode 100644 index bc3c6b0bc9..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_to_nav.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/dialog_v2x_seek_help.xml b/modules/mogo-module-v2x/src/main/res/layout/dialog_v2x_seek_help.xml deleted file mode 100644 index 9afcb13fb0..0000000000 --- a/modules/mogo-module-v2x/src/main/res/layout/dialog_v2x_seek_help.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/footer_nomore_view.xml b/modules/mogo-module-v2x/src/main/res/layout/footer_nomore_view.xml deleted file mode 100644 index 9fc434c82f..0000000000 --- a/modules/mogo-module-v2x/src/main/res/layout/footer_nomore_view.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml deleted file mode 100644 index eb700a4ab8..0000000000 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml deleted file mode 100644 index aef6b12987..0000000000 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_share_load_more.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_share_load_more.xml deleted file mode 100644 index 644113fcf9..0000000000 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_share_load_more.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - -