diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index e5b4edcc1b..34ca704544 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -7,9 +7,6 @@ import com.mogo.eagle.core.function.main.MainMoGoApplication; 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.util.AppUtils; -import com.mogo.eagle.core.utilcode.util.CommonUtils; -import com.mogo.module.v2x.utils.ObuConfig; import com.mogo.test.crashreport.CrashReportConstants; /** @@ -58,7 +55,6 @@ public class MogoApplication extends MainMoGoApplication { DebugConfig.setNeedUploadCoordinatesInTime(BuildConfig.IS_NEED_UPLOAD_COORDINATES_IN_TIME); DebugConfig.setObuType(SharedPrefsMgr.getInstance(this).getInt("OBU_TYPE", DebugConfig.OBU_TYPE_CIDI)); - ObuConfig.useObuLocation = false; // 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU FunctionBuildConfig.gpsProvider = BuildConfig.GPS_PROVIDER; // 配置BuglyAppID diff --git a/config.gradle b/config.gradle index 9ff18f3a80..1e68d20361 100644 --- a/config.gradle +++ b/config.gradle @@ -241,6 +241,12 @@ ext { mogo_core_utils : "com.mogo.eagle.core:utils:${MOGO_CORE_UTILS_VERSION}", mogo_core_network : "com.mogo.eagle.core:network:${MOGO_CORE_NETWORK_VERSION}", + //========================= V2X SDK ========================= + mogo_v2x : "com.mogo.v2x:v2x:${MOGO_V2X_SDK_VERSION}", + + life_cycle_scope : "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0", + view_model_scope : "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0", + live_data_scope : "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0" ] } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-main/build.gradle b/core/function-impl/mogo-core-function-main/build.gradle index faba48b368..50ede9d43f 100644 --- a/core/function-impl/mogo-core-function-main/build.gradle +++ b/core/function-impl/mogo-core-function-main/build.gradle @@ -68,7 +68,7 @@ dependencies { api rootProject.ext.dependencies.mogocommons api rootProject.ext.dependencies.modulecommon api rootProject.ext.dependencies.mogoservice - api rootProject.ext.dependencies.moduleV2x + //api rootProject.ext.dependencies.moduleV2x api rootProject.ext.dependencies.moduleshare api rootProject.ext.dependencies.moduleextensions api rootProject.ext.dependencies.modulemap @@ -101,7 +101,7 @@ dependencies { api project(':foudations:mogo-commons') api project(':modules:mogo-module-common') api project(':modules:mogo-module-service') - api project(':modules:mogo-module-v2x') + //api project(':modules:mogo-module-v2x') api project(':modules:mogo-module-share') api project(':modules:mogo-module-extensions') api project(':modules:mogo-module-map') 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 850d548990..74641e677b 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 @@ -33,7 +33,6 @@ import com.mogo.module.common.constants.HostConst; import com.mogo.module.main.service.MogoMainService; import com.mogo.module.service.ServiceConst; import com.mogo.module.share.constant.ShareConstants; -import com.mogo.module.v2x.V2XConst; import com.mogo.service.IMogoServiceApis; import com.mogo.service.cloud.socket.IMogoLifecycleListener; import com.mogo.test.crashreport.CrashReportConstants; @@ -297,7 +296,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_TRAFFIC_UPLOAD, "TrafficUpload")); MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl")); 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.addBaseModule(new MogoModule(MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare")); MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare")); diff --git a/core/function-impl/mogo-core-function-v2x/build.gradle b/core/function-impl/mogo-core-function-v2x/build.gradle index eac9a1667c..e8df059182 100644 --- a/core/function-impl/mogo-core-function-v2x/build.gradle +++ b/core/function-impl/mogo-core-function-v2x/build.gradle @@ -50,25 +50,31 @@ dependencies { implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid + implementation rootProject.ext.dependencies.flexbox kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.adasHigh - + implementation rootProject.ext.dependencies.mogo_v2x + implementation rootProject.ext.dependencies.mogoaicloudtrafficlive if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.modulecommon - + implementation rootProject.ext.dependencies.moduleservice implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_function_api implementation rootProject.ext.dependencies.mogo_core_function_call + implementation rootProject.ext.dependencies.callchatprovider + implementation rootProject.ext.dependencies.mogo_core_res } else { implementation project(':modules:mogo-module-common') - + implementation project(':modules:mogo-module-service') implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-api') implementation project(':core:mogo-core-function-call') + implementation project(':modules:mogo-module-carchattingprovider') + implementation project(':core:mogo-core-res') + } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-v2x/src/main/AndroidManifest.xml index 65e530e1de..af9b0fa90e 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/AndroidManifest.xml +++ b/core/function-impl/mogo-core-function-v2x/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt index 07ad9dc633..64ccf3977f 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt @@ -5,6 +5,7 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_V2X_MODULE import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightManager +import com.mogo.eagle.core.function.v2x.events.V2XEventManager import com.mogo.eagle.core.function.v2x.redlightwarning.RedLightWarningManager import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDataManager import com.mogo.eagle.core.function.v2x.vip.VipCarManager @@ -18,12 +19,14 @@ class V2XProvider : IMoGoFunctionServerProvider { override fun init(context: Context) { CallTrafficLightManager.getTrafficLightProvider().initTrafficLightServer(context) VipCarManager.INSTANCE.initServer(context) - SpeedLimitDataManager.getInstance().start(); + SpeedLimitDataManager.getInstance().start() RedLightWarningManager.INSTANCE.listenTrafficLight() + V2XEventManager.init(context) } override fun onDestroy() { VipCarManager.INSTANCE.destroy() RedLightWarningManager.INSTANCE.onDestroy() + V2XEventManager.onDestroy() } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt new file mode 100644 index 0000000000..87f484d1fc --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -0,0 +1,634 @@ +package com.mogo.eagle.core.function.v2x.events + +import android.content.Context +import android.content.Intent +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.data.enums.TrafficTypeEnum +import com.mogo.eagle.core.data.map.MogoLatLng +import com.mogo.eagle.core.data.map.MogoLocation +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.function.call.map.CallerMapLocationListenerManager +import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_EXTRA_KEY +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_HANDLER_ACTION +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_ACC_OFF_TIME_STR +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_STRATEGY_PUSH +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.manager.V2XStatusManager +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback +import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver +import com.mogo.eagle.core.function.v2x.events.receiver.SceneBroadcastReceiver +import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager +import com.mogo.eagle.core.function.v2x.events.scenario.scene.park.V2XIllegalParkWindow +import com.mogo.eagle.core.function.v2x.events.utils.* +import com.mogo.eagle.core.network.utils.GsonUtil +import com.mogo.eagle.core.utilcode.util.ThreadUtils +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.marker.IMogoMarker +import com.mogo.map.marker.IMogoMarkerClickListener +import com.mogo.module.common.ModuleNames +import com.mogo.module.common.drawer.TrafficMarkerDrawer +import com.mogo.module.common.entity.* +import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum +import com.mogo.module.common.enums.EventTypeEnum +import com.mogo.module.common.enums.EventTypeEnum.FOURS_BLOCK_UP +import com.mogo.module.common.utils.Const +import com.mogo.module.v2x.voice.V2XVoiceManager +import com.mogo.service.statusmanager.IMogoStatusChangedListener +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 +import com.mogo.v2x.config.V2XConfig +import com.mogo.v2x.data.V2XAdvanceWarning +import com.mogo.v2x.data.V2XMarkerCardResult +import com.mogo.v2x.data.V2XOptimalRoute +import com.mogo.v2x.event.V2XEvent +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 kotlinx.coroutines.* +import kotlinx.coroutines.android.asCoroutineDispatcher +import tv.danmaku.ijk.media.player.IjkMediaPlayer +import java.lang.Exception +import java.lang.IllegalStateException +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicBoolean + +object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback, IMogoMapListener, IMogoStatusChangedListener { + + private const val TAG = "V2XEventManager" + + private val scope: CoroutineScope by lazy { + CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher(TAG)) + } + + private val hasInit by lazy { AtomicBoolean(false) } + + // 记录历史行驶轨迹,用于车行驶方向计算,只保留两个数据 + private val historyPath = arrayOfNulls(2) + + fun init(context: Context) { + BridgeApi.init(context) + if (hasInit.compareAndSet(false, true)) { + if (!V2XManager.hasInit()) { + V2XManager.init(V2XConfig.Builder().also { + it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance()) + it.context(context) + it.distanceForTriggerRefresh(200f) //行驶超过200(包含)米,刷新道路周边信息(短链请求) + it.durationForTriggerRefresh(60, TimeUnit.SECONDS) // 每隔1分钟,根据自车定位,刷新道路周边信息(短链请求) + it.executor(ThreadUtils.getIoPool()) //用到的线程池(IO类型) + it.staticParams(ParamsUtil.getStaticParams()) + }.build()) + V2XManager.start() + } + + V2XVoiceManager.init(context) + registerListener() + initData() + MoGoAiCloudClient.getInstance().addTokenCallbacks(this) + // 注册广播接收场景弹窗使用的 + val localReceiver = SceneBroadcastReceiver() + val localBroadcastManager = LocalBroadcastManager.getInstance(context) + val intentFilter = IntentFilter() + intentFilter.addAction(BROADCAST_SCENE_HANDLER_ACTION) + localBroadcastManager.registerReceiver(localReceiver, intentFilter) + } + } + + private fun registerListener() { + V2XManager.addCallback(this) + CallerMapLocationListenerManager.addListener(TAG, this) + BridgeApi.registerCenter()?.let { + it.registerMogoMapListener(MODULE_NAME, this) + it.registerMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION, object : IMogoMarkerClickListener { + override fun onMarkerClicked(marker: IMogoMarker?): Boolean { + handleRoadConditionMarkerClick(marker) + return false + } + }) + it.registerMogoMarkerClickListener(MODULE_NAME, object : IMogoMarkerClickListener { + override fun onMarkerClicked(marker: IMogoMarker?): Boolean { + handleIllegalParkMarkerClick(marker) + return true + } + }) + } + BridgeApi.statusManager()?.let { + it.registerStatusChangedListener(MODULE_NAME, ACC_STATUS, this) + it.registerStatusChangedListener(MODULE_NAME, TOP_CONTAINER_READY, this) + it.registerStatusChangedListener(MODULE_NAME, SEEK_HELPING, this) + } + } + + private fun unRegisterListener() { + V2XManager.removeCallback(this) + CallerMapLocationListenerManager.removeListener(TAG) + BridgeApi.registerCenter()?.let { + it.unregisterMogoMapListener(MODULE_NAME) + it.unregisterMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION) + it.unregisterMogoMarkerClickListener(MODULE_NAME) + } + BridgeApi.statusManager()?.let { + it.unregisterStatusChangedListener(MODULE_NAME, ACC_STATUS, this) + it.unregisterStatusChangedListener(MODULE_NAME, TOP_CONTAINER_READY, this) + it.unregisterStatusChangedListener(MODULE_NAME, SEEK_HELPING, this) + } + } + + private fun initData() { + try { // 查询ACC状态 + SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_ACC_STATUS", isAccOn()) + if (isAccOn()) { // 记录开机时间 + FatigueDrivingUtils.refreshAccOnTime() + } else { // 记录关机时间 + SharedPrefsMgr.getInstance(Utils.getApp()).putString(V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString()) + } + } catch (e: Exception) { + e.printStackTrace() + } // 刷新配置文件 + refreshStrategyConfig() + } + + /** + * 是否是ACC ON操作 + * + * @return true-ACC ON | false - ACC OFF + */ + private fun isAccOn(): Boolean { + val accState = System.getInt(context().contentResolver, "mcu_state", -0x02) + //Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState); + return accState == 1 + } + + private fun handleIllegalParkMarkerClick(marker: IMogoMarker?) { + try { + marker ?: return + val markerExploreWay = (marker.getObject() as? MarkerShowEntity)?.bindObj as? MarkerExploreWay + Logger.d(MODULE_NAME, "V2X===违章停车:onMarkerClicked=$markerExploreWay") + + //直接展示弹窗 + markerExploreWay?.let { + val parkScenario = V2XIllegalParkWindow() + parkScenario.show(it, false) + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + private fun handleRoadConditionMarkerClick(marker: IMogoMarker?) { + Log.d(TAG, "onMarkerClicked2222") //点击的marker的具体数据 + //点击的marker的具体数据 + val exploreWay = extractFromMarker(marker) + exploreWay?.let { + val item = it.items[0] + val path = item.url + if (path.contains(".mp4")) { + initVideo() + } + + val roadEventEntity = V2XRoadEventEntity() + roadEventEntity.noveltyInfo = exploreWay + roadEventEntity.poiType = it.poiType + roadEventEntity.expireTime = 20000 //地理位置 + //地理位置 + val location = it.location + roadEventEntity.location = location + + val v2XMessageEntity: V2XMessageEntity = V2XMessageEntity() + v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING + v2XMessageEntity.isShowState = true + v2XMessageEntity.isOnlyShow = true + v2XMessageEntity.isNeedAddLine = false + v2XMessageEntity.content = roadEventEntity + val intent = Intent(Const.BROADCAST_SCENE_HANDLER_ACTION) + intent.putExtra(Const.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity) + LocalBroadcastManager.getInstance(context()).sendBroadcast(intent) + //埋点 + TrackUtils.trackV2XMarkerClick(2) + } + } + + private fun initVideo() { + PlayerFactory.setPlayManager(IjkPlayerManager::class.java) + CacheFactory.setCacheManager(ProxyCacheManager::class.java) + val list = mutableListOf() + list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1)) + list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0)) + GSYVideoManager.instance().optionModelList = list + GSYVideoType.enableMediaCodec() + GSYVideoType.enableMediaCodecTexture() + } + + private fun extractFromMarker(marker: IMogoMarker?): MarkerExploreWay? { + if (marker == null) { + return null + } + if (marker.getObject() is MarkerShowEntity) { + val showEntity = marker.getObject() as MarkerShowEntity + if (showEntity.bindObj is MarkerExploreWay) { + return showEntity.bindObj as MarkerExploreWay + } + } + return null + } + + override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) { + Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:$descriptor\nisTrue:$isTrue") // 记录状态更改 + // 记录状态更改 + SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_$descriptor", isTrue) + if (descriptor == ACC_STATUS) { + if (isTrue) { // 刷新配置文件 + refreshStrategyConfig() + // 记录开机时间 + FatigueDrivingUtils.refreshAccOnTime() + initCarForHelpStatus() + BridgeApi.statusManager()?.let { + if (it.isTopContainerReady) { + V2XManager.forceRefresh() + } + } + } else { // 记录关机时间 + SharedPrefsMgr.getInstance(Utils.getApp()).putString(V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString()) + } + } else if (descriptor == SEEK_HELPING) { + refreshMeSeekHelp(isTrue) + } else if (descriptor == TOP_CONTAINER_READY) { + if (isTrue) { + V2XManager.forceRefresh() + } + } + } + + /** + * 刷新自车求助状态 + * + * @param isTrue + */ + private fun refreshMeSeekHelp(isTrue: Boolean) { + val entity = V2XMessageEntity() + entity.type = V2XTypeEnum.ALERT_CAR_FOR_HELP + entity.content = isTrue + V2XScenarioManager.getInstance().handlerMessage(entity) + } + + /** + * 刷新自车求助状态 + */ + private fun initCarForHelpStatus() { + Logger.d(MODULE_NAME, "刷新自车求助状态……") //本地查询是否超时 + 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") + val vehicleType: Int = resultBean.vehicleType //故障车 + if (vehicleType == 4) { + refreshMeSeekHelp(true) + BridgeApi.statusManager()?.setSeekHelping(MODULE_NAME, true) + } else { + refreshMeSeekHelp(false) + BridgeApi.statusManager()?.setSeekHelping(MODULE_NAME, false) + } + } + } + } + + override fun onFail(msg: String) {} + }) + } + + private fun refreshStrategyConfig() { + Logger.w(MODULE_NAME, "刷新V2X中的配置文件") + BridgeApi.refreshModel().getStrategyPush(object : V2XRefreshCallback { + override fun onSuccess(result: V2XStrategyPushRes?) { //Logger.w(MODULE_NAME, "V2X疲劳驾驶配置数据更新:" + GsonUtil.jsonFromObject(result)); + val resultBean = result?.result + if (resultBean != null) { // 更新本地的v2x提醒策略 + SharedPrefsMgr.getInstance(Utils.getApp()).putString(V2X_STRATEGY_PUSH, GsonUtil.jsonFromObject(resultBean)) + } + } + override fun onFail(msg: String?) {} + }) + } + + override fun onLocationChanged(location: MogoLocation?) { + location ?: return + BridgeApi.location.set(location) + if (V2XManager.hasInit()) { + V2XManager.onLocationChanged(longitude = location.longitude, latitude = location.latitude) + } + V2XOptimalRouteObserver.getInstance().update(location) + refreshCarState(location) + } + + private fun refreshCarState(location: MogoLocation) { + fixCarAngle(location) + // 只有车速大于 5 的时候进行计算 + if (location.speed < 5) return + val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline + val isRoadEventPOIShow = BridgeApi.v2xStatus()?.isRoadEventPOIShow ?: false + val isOtherSeekHelpPOIShow = BridgeApi.v2xStatus()?.isOtherSeekHelpPOIShow ?: false + val v2xStatusManager = V2XStatusManager.getInstance() + if (v2xPolyline != null && (isRoadEventPOIShow or isOtherSeekHelpPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点 + // 取出原有的绘制线的经纬度点 + val pointsOdl: MutableList = v2xPolyline.points // 重新设置第一个坐标,也就是当前车辆位置 + // 重新设置第一个坐标,也就是当前车辆位置 + pointsOdl[0] = MogoLatLng(location.latitude, location.longitude) + v2xPolyline.points = pointsOdl + + //Logger.d(V2XConst.MODULE_NAME, "当前地图的缩放比例为:" + zoomLevel); + val zoomLevel: Float = BridgeApi.mapUiController()?.zoomLevel ?: 0.0f + //Logger.d(V2XConst.MODULE_NAME, "当前地图的缩放比例为:" + zoomLevel); + if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图 + val context: Context = context() + MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context) + } + } + +// 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)) +// 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() +// v2XMessageEntity.type = V2XTypeEnum.ALERT_FATIGUE_DRIVING +// v2XMessageEntity.setContent(drivingShowEntity) +// v2XMessageEntity.isShowState = drivingShowEntity.isShowWindow() // 广播给ADAS Launcher +// ADASUtils.broadcastToADAS(context(), drivingShowEntity) +// V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity) +// } +// } +// } + + // 巡航处理 + val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(BridgeApi.v2xMarker()?.v2XRoadEventEntityList, V2XStatusManager.getInstance().location) // 距离是否大于10米 && 消息是否不为空 + // 距离是否大于10米 && 消息是否不为空 + if (v2XRoadEventEntity != null && v2XRoadEventEntity.distance >= 5) { // Logger.w(MODULE_NAME, + // //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() + + // //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount + + // "\nV2X预警--当前预警事件:" + v2XRoadEventEntity + // ); + // Logger.w(MODULE_NAME, "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance()); + // 触发展示操作 + TrackUtils.trackV2xRoadProduceEvent(1) + val v2XMessageEntity = V2XMessageEntity() + v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING + v2XMessageEntity.content = v2XRoadEventEntity + v2XMessageEntity.isShowState = true + V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity) + + // 存储本地,出行动态作展示 + saveLocalStory(V2XTypeEnum.ALERT_ROAD_WARNING, v2XRoadEventEntity.noveltyInfo) + + //如果poiType是道路拥堵,则调用接口查询拥堵状态 + val poiType = v2XRoadEventEntity.poiType + if (poiType != null && poiType == FOURS_BLOCK_UP.poiType) { + BridgeApi.trafficUpload()?.verifyCurrentTrafficStatus() + } + } + } + + /** + * 存储本地数据 + * + * @param v2XRoadEventEntity 要存储的场景 + */ + private fun saveLocalStory(scenarioType: Int, v2XRoadEventEntity: MarkerExploreWay) { + ThreadUtils.getIoPool().execute { + try { + V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode()) + } catch (e: Exception) { + e.printStackTrace() + Logger.e(TAG, e.message) + } + } + } + + private fun fixCarAngle(location: MogoLocation) { // 记录位置轨迹 + // 记录位置轨迹 + if (historyPath[0] != null) { + historyPath[1] = historyPath[0] + } + historyPath[0] = location + + 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, + // "\n车辆经纬度:" + Arrays.toString(historyPath) + + // "\n车辆角度:" + carAngle); + // 这里是真实的车辆角度 + location.bearing = carAngle.toFloat() + } else { //Logger.e(MODULE_NAME, + // "\n首次获取经纬度,默认车头朝北:" + Arrays.toString(historyPath)); + location.bearing = 0.0f + } + V2XStatusManager.getInstance().location = location + } + + override fun onTokenGot(token: String?, sn: String?) { + if (V2XManager.hasInit()) { + V2XManager.updateSnAndToken(sn, token) + } + } + + /** + * V2XEvent事件回调 + */ + override fun onAck(event: V2XEvent) { + Logger.d(TAG, "OK->:$event") + when (event) { + is V2XEvent.ForwardsWarning -> { + handleAdvanceWarningEvent(event) + } + is V2XEvent.OptimalRoute -> { + handleOptimalRouteEvent(event) + } + is V2XEvent.Marker -> { + event.data.result?.let { + handleRoadMarkerEvent(it) + } + } + is V2XEvent.Road -> { + handleRoadMarkerEvent(event.data) + } + else -> throw IllegalStateException("invalid event type for $event") + } + } + + private fun handleRoadMarkerEvent(data: V2XMarkerCardResult) { + try { + BridgeApi.v2xStatus()?.let { + if (it.isRoadEventWindowShow) { + return + } + } + scope.launch(Dispatchers.Default) { + BridgeApi.v2xMarker()?.analysisV2XRoadEvent(data) + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + private fun handleOptimalRouteEvent(event: V2XEvent.OptimalRoute) { + val v2xMessageEntity: V2XMessageEntity = V2XMessageEntity() // 控制类型 + v2xMessageEntity.type = V2XTypeEnum.ALERT_PUSH_VR_SHOW // 设置数据 + v2xMessageEntity.content = event.data // 控制展示状态 + v2xMessageEntity.isShowState = true + val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION) + intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity) + LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent) + } + + private fun handleAdvanceWarningEvent(event: V2XEvent.ForwardsWarning) { + scope.launch { + val message = event.data + val 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 = FOURS_BLOCK_UP.poiType.toInt() + tts = FOURS_BLOCK_UP.tts + content = 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 getWarningDirection(): String { + return "右" //TODO renwj 原来的逻辑,预警方向先写死, 后续做兼容 + } + + private fun buildTrafficData(message: V2XAdvanceWarning): 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 ?: 0.0 + lon = message.position?.lon ?: 0.0 + heading = message.heading ?: 0.0 + threatLevel = message.threatLevel ?: -1 + } + } + + override fun onFail(msg: String) { + Logger.e(TAG, "Error: $msg") + } + + override fun onError(code: Int, msg: String?) {} + + fun onDestroy() { + if (hasInit.compareAndSet(true,false)) { + try { + scope.cancel() + } catch (e: Throwable) { + e.printStackTrace() + } finally { + unRegisterListener() + } + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XEventPagerAdapter.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XEventPagerAdapter.kt new file mode 100644 index 0000000000..55e23ce2bc --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XEventPagerAdapter.kt @@ -0,0 +1,21 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XRoadEventAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XRoadEventAdapter.java new file mode 100644 index 0000000000..b7c01b2330 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XRoadEventAdapter.java @@ -0,0 +1,119 @@ +package com.mogo.eagle.core.function.v2x.events.adapter; + +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XEventUgcVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XFatigueDrivingVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XIllegalParkVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XLiveVideoVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XOtherSeekHelpVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XPushEventVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XRoadEventVH; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.v2x.adapter.holder.V2XRecommendRouteVH; +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XScenarioHistoryAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XScenarioHistoryAdapter.java new file mode 100644 index 0000000000..841b860af3 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XScenarioHistoryAdapter.java @@ -0,0 +1,102 @@ +package com.mogo.eagle.core.function.v2x.events.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.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XScenarioHistoryIllegalParkVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XScenarioHistoryOtherSeekHelpVH; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XScenarioHistoryRoadEventVH; +import com.mogo.module.common.entity.V2XHistoryScenarioData; +import com.mogo.module.common.entity.V2XMessageEntity; +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XShareEventAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XShareEventAdapter.java new file mode 100644 index 0000000000..588b919ba4 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XShareEventAdapter.java @@ -0,0 +1,239 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventDescription; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItem; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItemEnum; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventLoadMoreItem; +import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment; +import com.mogo.eagle.core.function.v2x.events.listener.AdapterCallback; +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.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XSurroundingAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XSurroundingAdapter.java new file mode 100644 index 0000000000..3fb4c40b50 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XSurroundingAdapter.java @@ -0,0 +1,105 @@ +package com.mogo.eagle.core.function.v2x.events.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.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XSurroundingViewHolder; +import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction; +import com.mogo.eagle.core.function.v2x.events.listener.SurroundingItemClickListener; +import com.mogo.module.common.enums.EventTypeEnum; + +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XSurroundingDetailAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XSurroundingDetailAdapter.java new file mode 100644 index 0000000000..cca388296b --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/V2XSurroundingDetailAdapter.java @@ -0,0 +1,135 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XSurroundingDetailVH; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.listener.SurroundingDetailItemListener; +import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils; +import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView; +import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView; +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.eagle.core.utilcode.mogo.logger.Logger; + +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XBaseViewHolder.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XBaseViewHolder.java new file mode 100644 index 0000000000..777654e927 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XBaseViewHolder.java @@ -0,0 +1,287 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil; +import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils; +import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; +import com.mogo.eagle.core.utilcode.util.TimeUtils; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.map.navi.IMogoNavi; +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.service.module.IMogoRegisterCenter; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.zhidao.carchattingprovider.CallChattingProviderConstant; +import com.zhidao.carchattingprovider.ICarsChattingProvider; +import com.zhidao.carchattingprovider.MogoDriverInfo; + +/** + * 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接口 + + V2XRefreshModel refreshModel = BridgeApi.INSTANCE.refreshModel(); + if (refreshModel != null) { + refreshModel.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 { + IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter(); + if (registerCenter != null) { + registerCenter.registerMogoNaviListener(MODULE_NAME, this); + } + MogoLatLng endPoint = new MogoLatLng( + noveltyInfo.getLocation().getLat(), + noveltyInfo.getLocation().getLon()); + + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + if (navi != null) { + navi.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"); + + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + if (navi != null) { + navi.startNavi(true); + } + IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter(); + + if (registerCenter != null) { + registerCenter.unregisterMogoNaviListener(MODULE_NAME); + } + } + + @Override + public void onoCalculateFailed() { + + } + + @Override + public void onUpdateTraffic(MogoTraffic traffic) { + + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XEventUgcVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XEventUgcVH.java new file mode 100644 index 0000000000..b564d863be --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XEventUgcVH.java @@ -0,0 +1,212 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.R; +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.network.V2XRefreshModel; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.voice.V2XVoiceManager; +import com.mogo.service.analytics.IMogoAnalytics; +import com.mogo.service.share.IMogoTanluProvider; +import com.mogo.service.share.TanluUploadParams; + +import java.util.HashMap; +import java.util.Map; + +/** + * 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]); + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics != null) { + analytics.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) { + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics == null) { + return; + } + Map properties = new HashMap<>(); + properties.put("result", result); + analytics.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()) + ); + IMogoTanluProvider tanlu = BridgeApi.INSTANCE.tanlu(); + if (tanlu != null) { + tanlu.uploadRoadCondition(params); + } + dataStatistics(1); + } else if (status == 0) { + dataStatistics(2); + } + + AIAssist.getInstance(Utils.getApp()).speakTTSVoice("谢谢,您的反馈将帮助更多车友。", null); + V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel(); + v2XRefreshModel + .manualMarkingTrafficJam( + mNoveltyInfo.getInfoId(), + status, + "0"); + delayedCloseWindow(); + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XFatigueDrivingVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XFatigueDrivingVH.java new file mode 100644 index 0000000000..95800e9af1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XFatigueDrivingVH.java @@ -0,0 +1,119 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XHistoryBaseViewHolder.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XHistoryBaseViewHolder.java new file mode 100644 index 0000000000..b2689a11a1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XHistoryBaseViewHolder.java @@ -0,0 +1,269 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil; +import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils; +import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.utilcode.util.TimeUtils; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.map.navi.IMogoNavi; +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.eagle.core.utilcode.mogo.toast.TipToast; +import com.mogo.service.module.IMogoRegisterCenter; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.zhidao.carchattingprovider.CallChattingProviderConstant; +import com.zhidao.carchattingprovider.ICarsChattingProvider; +import com.zhidao.carchattingprovider.MogoDriverInfo; + +/** + * 出行动态 + * + * @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接口 + BridgeApi.INSTANCE.refreshModel().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 { + + IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter(); + if (registerCenter != null) { + registerCenter.registerMogoNaviListener(MODULE_NAME, this); + } + MogoLatLng endPoint = new MogoLatLng( + noveltyInfo.getLocation().getLat(), + noveltyInfo.getLocation().getLon()); + + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + if (navi != null) { + navi.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"); + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + if (navi != null) { + navi.startNavi(true); + } + IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter(); + if (registerCenter != null) { + registerCenter.unregisterMogoNaviListener(MODULE_NAME); + } + } + + @Override + public void onoCalculateFailed() { + + } + + @Override + public void onUpdateTraffic(MogoTraffic traffic) { + + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XIllegalParkVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XIllegalParkVH.java new file mode 100644 index 0000000000..512d217e97 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XIllegalParkVH.java @@ -0,0 +1,167 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView; +import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.network.utils.GsonUtil; +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.voice.V2XVoiceManager; +import com.mogo.service.module.IMogoRegisterCenter; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().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"); + IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter(); + if (registerCenter != null) { + registerCenter.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); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (!isVrMode) { + delayedCloseWindow(); + } else { + mIlIllegalParkingLike.setClickable(false); + } + } + + /** + * 反馈路况错误 + */ + private void roadReportErr() { + if (mExploreWay != null) { + RoadConditionUtils.sendShareReceiverInfo( + mExploreWay.getInfoId(), + mExploreWay.getPoiType(), + 3); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (!isVrMode) { + delayedCloseWindow(); + } else { + mIIllegalParkingUnLike.setClickable(false); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XLiveVideoVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XLiveVideoVH.java new file mode 100644 index 0000000000..cce132276f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XLiveVideoVH.java @@ -0,0 +1,63 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import android.view.LayoutInflater; +import android.view.ViewGroup; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils; +import com.mogo.eagle.core.function.v2x.events.view.V2XLiveGSYVideoView; +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.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(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XOtherSeekHelpVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XOtherSeekHelpVH.java new file mode 100644 index 0000000000..a6d2cb2415 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XOtherSeekHelpVH.java @@ -0,0 +1,248 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static android.view.View.GONE; +import static android.view.View.VISIBLE; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil; +import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.voice.V2XVoiceManager; +import com.mogo.service.imageloader.IMogoImageloader; +import com.mogo.service.imageloader.MogoImageView; +import com.mogo.service.statusmanager.IMogoStatusManager; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +/** + * 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(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().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); + V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel(); + if (v2XRefreshModel != null) { + v2XRefreshModel.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 -> { + V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel(); + if (v2XRefreshModel != null) { + v2XRefreshModel.respondingToHelp(mUserInfo.getSn()); + } + + if (!V2XUtils.isFastClick()) { + try { + triggerCallChart(mNoveltyInfo); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + } + try { + if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) { + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (isVrMode) { + Glide.with(mContext).load(mV2XPushMessageEntity.getHeadImgUrl()).apply(RequestOptions.bitmapTransform( + new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivHead); + } else { + IMogoImageloader imageLoader = BridgeApi.INSTANCE.imageLoader(); + if (imageLoader != null) { + imageLoader.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead); + } + } + } + tvName.setText(mV2XPushMessageEntity.getDisplayName()); + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (mV2XPushMessageEntity.getDistance() > 1000) { + + SpanUtils.with(tvDistance) + .append("" + (int) mV2XPushMessageEntity.getDistance() / 1000) + .setFontSize((int) itemView.getResources().getDimension(isVrMode ? R.dimen.module_v2x_fault_help_distance_text_size : R.dimen.module_v2x_event_distance_text)) + .append("公里") + .setFontSize((int) itemView.getResources().getDimension(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(isVrMode ? R.dimen.module_v2x_fault_help_distance_text_size : R.dimen.module_v2x_event_distance_text)) + .append("米") + .setFontSize((int) itemView.getResources().getDimension( + 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XPushEventVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XPushEventVH.java new file mode 100644 index 0000000000..43eb867adf --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XPushEventVH.java @@ -0,0 +1,192 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +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.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.voice.V2XVoiceManager; +import com.mogo.service.imageloader.IMogoImageloader; +import com.mogo.service.imageloader.MogoImageView; +import com.mogo.service.module.IMogoRegisterCenter; + +/** + * 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"); + IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter(); + if (registerCenter != null) { + registerCenter.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())) { + IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader(); + if (imageloader != null) { + imageloader.displayImage(mV2XRoadEventEntity.getMsgImgUrl(), ivImg); + } + } + if (!TextUtils.isEmpty(mV2XRoadEventEntity.getHeadImgUrl())) { + IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader(); + if (imageloader != null) { + imageloader.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XRecommendRouteVH.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XRecommendRouteVH.kt new file mode 100644 index 0000000000..9125cf48d8 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XRecommendRouteVH.kt @@ -0,0 +1,93 @@ +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.function.v2x.R +import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XBaseViewHolder +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants +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.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XRoadEventVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XRoadEventVH.java new file mode 100644 index 0000000000..628f6e9614 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XRoadEventVH.java @@ -0,0 +1,544 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import static android.view.View.GONE; +import static android.view.View.VISIBLE; + +import static com.mogo.eagle.core.function.v2x.events.consts.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XUserInfoRes; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XRoadLiveCarScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadEventWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadVideoCarScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.network.utils.GsonUtil; +import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform; +import com.mogo.eagle.core.utilcode.util.CollectionUtils; +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.voice.V2XVoiceManager; +import com.mogo.service.imageloader.IMogoImageloader; +import com.mogo.service.imageloader.MogoImageView; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.v2x.DisplayEffectsInterface; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +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(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().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 (!CollectionUtils.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)) { + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (isVrMode) { + Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform( + new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg); + } else { + IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader(); + if (imageloader != null) { + imageloader.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())) { + + IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader(); + if (imageloader != null) { + imageloader.displayImage(mNoveltyInfo.getUserInfo().getUserHead(), ivReportHead); + } + } + + String poiType = EventTypeEnum.getPoiTypeStr(mNoveltyInfo.getPoiType()); + if (!TextUtils.isEmpty(poiType)) { + tvEventTypeTitle.setText(poiType); + tvEventTypeTitle.setBackgroundResource(EventTypeEnum.getPoiTypeBg(mNoveltyInfo.getPoiType(), + BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode())); + + } + ivEvent.setImageResource(EventTypeEnum.getPoiTypeSrcVr(mNoveltyInfo.getPoiType())); + tvEvent.setText(EventTypeEnum.getPoiTypeStrVr(mNoveltyInfo.getPoiType())); + if (EventTypeEnum.FOURS_FOG.getPoiType().equals(mNoveltyInfo.getPoiType())) { + DisplayEffectsInterface displayEffects = BridgeApi.INSTANCE.displayEffects(); + if (displayEffects != null) { + displayEffects.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 (!CollectionUtils.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())) { + BridgeApi.INSTANCE.refreshModel() + .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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryIllegalParkVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryIllegalParkVH.java new file mode 100644 index 0000000000..ddc2295482 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryIllegalParkVH.java @@ -0,0 +1,133 @@ +package com.mogo.eagle.core.function.v2x.events.adapter.holder; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.mogo.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView; +import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView; +import com.mogo.eagle.core.network.utils.GsonUtil; +import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.V2XHistoryScenarioData; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 出行面板违章停车 + * + * @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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java new file mode 100644 index 0000000000..6d9202f598 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java @@ -0,0 +1,188 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment; +import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils; +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.service.imageloader.IMogoImageloader; +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())) { + IMogoImageloader imageLoader = BridgeApi.INSTANCE.imageLoader(); + if (imageLoader != null) { + imageLoader.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 -> { + BridgeApi.INSTANCE.refreshModel().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()) { + BridgeApi.INSTANCE.refreshModel().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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryRoadEventVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryRoadEventVH.java new file mode 100644 index 0000000000..0e6983bfa8 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XScenarioHistoryRoadEventVH.java @@ -0,0 +1,139 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView; +import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView; +import com.mogo.eagle.core.network.utils.GsonUtil; +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.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 出行面板道路事件面板 + * + * @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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XSurroundingDetailVH.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XSurroundingDetailVH.java new file mode 100644 index 0000000000..285be09be0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XSurroundingDetailVH.java @@ -0,0 +1,19 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XSurroundingViewHolder.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XSurroundingViewHolder.java new file mode 100644 index 0000000000..7bb6af9867 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/adapter/holder/V2XSurroundingViewHolder.java @@ -0,0 +1,19 @@ +package com.mogo.eagle.core.function.v2x.events.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/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 new file mode 100644 index 0000000000..79342c5958 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java @@ -0,0 +1,208 @@ +package com.mogo.eagle.core.function.v2x.events.alarm; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.text.TextUtils; + +import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils; +import com.mogo.eagle.core.utilcode.constant.TimeConstants; +import com.mogo.eagle.core.utilcode.util.TimeUtils; +import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.MarkerLocation; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.service.Utils; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * @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 final HashMap mAlertIllegalParkEventList = new HashMap<>(); + + /** + * 获取车辆的前方的违章停车事件 + */ + 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 = Math.abs(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; + } + + + /** + * 获取当前车辆前方距离最近的道路事件 + */ + 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 = Math.abs(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; + } + +} 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 new file mode 100644 index 0000000000..19bfe4d260 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XEarlyWarningServer.java @@ -0,0 +1,101 @@ +package com.mogo.eagle.core.function.v2x.events.alarm; + +import android.content.Intent; + +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils; +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 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt new file mode 100644 index 0000000000..c41c2ca72e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt @@ -0,0 +1,128 @@ +package com.mogo.eagle.core.function.v2x.events.bridge + +import android.content.Context +import com.alibaba.android.arouter.launcher.ARouter +import com.mogo.eagle.core.data.map.MogoLocation +import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths +import com.mogo.eagle.core.function.v2x.events.manager.* +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel +import com.mogo.eagle.core.utilcode.util.Utils +import com.mogo.map.uicontroller.IMogoMapUIController +import com.mogo.module.common.MogoApisHandler +import com.mogo.service.statusmanager.IMogoStatusManager +import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider +import com.zhidao.carchattingprovider.CallChattingProviderConstant +import com.zhidao.carchattingprovider.ICarsChattingProvider +import java.lang.ref.WeakReference +import java.util.concurrent.atomic.AtomicReference + +internal object BridgeApi { + + private val context by lazy { + AtomicReference>(null) + } + + val location by lazy { + AtomicReference() + } + + private val apis by lazy { + MogoApisHandler.getInstance().apis + } + + private val carChatProvider by lazy { + ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(context()) as? ICarsChattingProvider + } + + private val v2xMarker by lazy { + ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context()) as? IMoGoV2XMarkerManager + } + + private val v2xPolyline by lazy { + ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context()) as? IMoGoV2XPolylineManager + } + + private val v2xWarnPolyline by lazy { + ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context()) as? IMoGoWarnPolylineManager + } + + private val v2xPersonWarnPolyline by lazy { + ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER).navigation(context()) as? IMoGoPersonWarnPolylineManager + } + + private val v2xStopPolyline by lazy { + ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER).navigation(context()) as? IMoGoStopPolylineManager + } + + private val v2xStatus by lazy { + ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context()) as? IMoGoV2XStatusManager + } + + private val v2xRefreshModel by lazy { + V2XRefreshModel.getInstance(context()) + } + + fun init(context: Context) { + this.context.set(WeakReference(context)) + } + + fun context(): Context = this.context.get()?.get() ?: Utils.getApp() + + fun mapUiController(): IMogoMapUIController? = apis?.mapServiceApi?.mapUIController + + fun map() = apis?.mapServiceApi + + fun onlineCarPanelApi(): IMogoOnlineCarListPanelProvider? = apis?.onlineCarPanelApi + + fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi + + fun topViewManager() = apis?.topViewManager + + fun analytics() = apis?.analyticsApi + + fun navi() = apis?.mapServiceApi?.getNavi(context()) + + fun overlay() = apis?.mapServiceApi?.getOverlayManager(context()) + + fun carChatProvider() = carChatProvider + + fun marker() = apis?.mapServiceApi?.getMarkerManager(context()) + + fun v2xMarker() = v2xMarker + + fun v2xPolyline() = v2xPolyline + + fun v2xWarnPolyline() = v2xWarnPolyline + + fun v2xPersonWarnPolyline() = v2xPersonWarnPolyline + + fun v2xStopPolyline() = v2xStopPolyline + + fun v2xStatus() = v2xStatus + + fun refreshModel(): V2XRefreshModel = v2xRefreshModel + + fun registerCenter() = apis?.registerCenterApi + + fun entranceButton() = apis?.entranceButtonController + + fun imageLoader() = apis?.imageLoaderApi + + fun windowManager() = apis?.windowManagerApi + + fun tanlu() = apis?.tanluApi + + fun displayEffects() = apis?.displayEffectsManager + + fun intentManager() = apis?.intentManagerApi + + fun actionManager() = apis?.actionManagerApi + + fun locationClient() = apis?.mapServiceApi?.getSingletonLocationClient(context()) + + fun share() = apis?.shareManager + + fun markerService() = apis?.markerService + + fun trafficUpload() = apis?.trafficUploadApi +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/MoGoV2XServicePaths.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/MoGoV2XServicePaths.java new file mode 100644 index 0000000000..97601cc470 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/MoGoV2XServicePaths.java @@ -0,0 +1,61 @@ +package com.mogo.eagle.core.function.v2x.events.consts; + +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java new file mode 100644 index 0000000000..81015eb70e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/consts/V2XConst.java @@ -0,0 +1,139 @@ +package com.mogo.eagle.core.function.v2x.events.consts; + +/** + * 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/model/DrawLineInfo.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/model/DrawLineInfo.java new file mode 100644 index 0000000000..8b4c5be3c3 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/model/DrawLineInfo.java @@ -0,0 +1,87 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XAlarmEventRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XAlarmEventRes.java new file mode 100644 index 0000000000..1700c72906 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XAlarmEventRes.java @@ -0,0 +1,280 @@ + +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XGiveLike.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XGiveLike.java new file mode 100644 index 0000000000..bb8613ad19 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XGiveLike.java @@ -0,0 +1,52 @@ + +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XLiveCarRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XLiveCarRes.java new file mode 100644 index 0000000000..91e4269a06 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XLiveCarRes.java @@ -0,0 +1,56 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XOptimalRouteDataRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XOptimalRouteDataRes.java new file mode 100644 index 0000000000..ac2a8a2dd0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XOptimalRouteDataRes.java @@ -0,0 +1,105 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XSeekHelpRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XSeekHelpRes.java new file mode 100644 index 0000000000..7c8b2b4f8e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XSeekHelpRes.java @@ -0,0 +1,52 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XSpecialCarRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XSpecialCarRes.java new file mode 100644 index 0000000000..28af2d615a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XSpecialCarRes.java @@ -0,0 +1,205 @@ + +package com.mogo.eagle.core.function.v2x.events.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 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 UserInfoBean getUserInfo() { + return userInfo; + } + + public void setUserInfo(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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XStrategyPushRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XStrategyPushRes.java new file mode 100644 index 0000000000..cf691af465 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XStrategyPushRes.java @@ -0,0 +1,253 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XUserInfoRes.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XUserInfoRes.java new file mode 100644 index 0000000000..a19b38a577 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/net/V2XUserInfoRes.java @@ -0,0 +1,344 @@ + +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/BackRefreshInfo.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/BackRefreshInfo.java new file mode 100644 index 0000000000..0157104db3 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/BackRefreshInfo.java @@ -0,0 +1,10 @@ +package com.mogo.eagle.core.function.v2x.events.entity.panel; + +import java.io.Serializable; + +/** + * 返回刷新 + */ +public class BackRefreshInfo implements Serializable { + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/Center.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/Center.kt new file mode 100644 index 0000000000..08afa15f04 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/Center.kt @@ -0,0 +1,12 @@ +package com.mogo.eagle.core.function.v2x.events.entity.panel + +/** + * @description + * + * @author lixiaopeng + * @since 2019-10-24 + */ +data class Center ( + val lat: Double, + val lon: Double +) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java new file mode 100644 index 0000000000..5327410adb --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java @@ -0,0 +1,45 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingRequest.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingRequest.java new file mode 100644 index 0000000000..666d9169a1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingRequest.java @@ -0,0 +1,21 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingResponse.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingResponse.java new file mode 100644 index 0000000000..a89c64fd5e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingResponse.java @@ -0,0 +1,39 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventDescription.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventDescription.java new file mode 100644 index 0000000000..6ec01fd6ca --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventDescription.java @@ -0,0 +1,158 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventItem.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventItem.java new file mode 100644 index 0000000000..653bf4e298 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventItem.java @@ -0,0 +1,439 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventItemEnum.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventItemEnum.java new file mode 100644 index 0000000000..9565d9d06e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventItemEnum.java @@ -0,0 +1,12 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventLoadMoreItem.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventLoadMoreItem.java new file mode 100644 index 0000000000..023d6ddde1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/V2XShareEventLoadMoreItem.java @@ -0,0 +1,38 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XEventPanelFragment.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XEventPanelFragment.kt new file mode 100644 index 0000000000..e2390fadb7 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XEventPanelFragment.kt @@ -0,0 +1,459 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R +import com.mogo.eagle.core.function.v2x.events.adapter.V2XEventPagerAdapter +import com.mogo.eagle.core.function.v2x.events.adapter.V2XSurroundingDetailAdapter +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.eagle.core.function.v2x.events.entity.panel.BackRefreshInfo +import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction +import com.mogo.eagle.core.function.v2x.events.fragment.presenter.EventPanelPresenter +import com.mogo.eagle.core.function.v2x.events.listener.SurroundingDetailItemListener +import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils +import com.mogo.eagle.core.function.v2x.events.view.V2XEventPanelHistoryCountView +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants +import com.mogo.module.common.entity.MarkerExploreWay +import com.mogo.module.common.MogoApisHandler +import com.mogo.module.common.enums.EventTypeEnum +import com.mogo.module.common.view.SpacesItemDecoration +import com.mogo.module.v2x.voice.V2XVoiceManager +import com.mogo.service.statusmanager.IMogoStatusChangedListener +import com.mogo.service.statusmanager.StatusDescriptor +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +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) + + BridgeApi.entranceButton()?.let { + it.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(BridgeApi.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(BridgeApi.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XScenarioHistoryFragment.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XScenarioHistoryFragment.kt new file mode 100644 index 0000000000..87fc01ad07 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XScenarioHistoryFragment.kt @@ -0,0 +1,168 @@ +package com.mogo.eagle.core.function.v2x.events.fragment + +import android.annotation.SuppressLint +import android.content.Context +import android.util.Log +import android.view.View +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.share +import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment.Companion.getInstance +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.v2xStatus +import com.mogo.commons.mvp.MvpFragment +import com.mogo.eagle.core.function.v2x.events.fragment.presenter.ScenarioHistoryPresenter +import androidx.lifecycle.lifecycleScope +import androidx.recyclerview.widget.LinearLayoutManager +import com.mogo.eagle.core.function.v2x.events.adapter.V2XScenarioHistoryAdapter +import com.mogo.module.common.entity.V2XHistoryScenarioData +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener +import com.mogo.module.common.view.SpacesItemDecoration +import com.mogo.eagle.core.function.v2x.events.view.V2XListEmptyView.OnControlListener +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor +import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils +import com.mogo.commons.voice.AIAssist +import com.mogo.eagle.core.function.v2x.R.dimen +import com.mogo.eagle.core.function.v2x.R.layout +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor.EventPanelWindow_UI +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils +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 kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_scenario_history.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import java.util.ArrayList + +/** + * 出行动态,V2X 提示过的场景历史 + * + * @author donghongyu + */ +class V2XScenarioHistoryFragment : MvpFragment() { + private val TAG = "V2XScenarioHistoryFragment" + var fromVoice = false + private var mV2XScenarioHistoryAdapter: V2XScenarioHistoryAdapter? = null + private val mV2XHistoryScenarioData = ArrayList() + private var mListener: IMoGoV2XStatusChangedListener? = null + + override fun getLayoutId(): Int { + return layout.module_v2x_event_panel_fragment_scenario_history + } + + override fun getTagName(): String { + return TAG + } + + @SuppressLint("LongLogTag") override fun initViews() { + Log.d(TAG, "initViews --------> ") + recyclerView.addItemDecoration(SpacesItemDecoration(resources.getDimension(dimen.share_item_padding).toInt())) + mV2XScenarioHistoryAdapter = V2XScenarioHistoryAdapter(mV2XHistoryScenarioData) + recyclerView.adapter = mV2XScenarioHistoryAdapter + recyclerView.addItemDecoration(SpacesItemDecoration(14)) // 配置列表朝向 + val layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false) + recyclerView.layoutManager = layoutManager + initListener() + viewEmpty.setTripMessage("暂无交通事件") + viewEmpty.setRefreshVisibility(false) + } + + /** + * 初始化页面用到得监听 + */ + private fun initListener() { + viewEmpty.setOnControlListener(object : OnControlListener { + override fun onShearClick() { + val share = share() + if (share != null) { + share.showShareDialog() + getInstance().hidePanel() + } + } + + override fun onRefreshClick() {} + }) + mListener = object : IMoGoV2XStatusChangedListener { + override fun onStatusChanged(descriptor: V2XStatusDescriptor, isTrue: Boolean) { + Logger.d(TAG, "$descriptor initViews --------> $isTrue") + if (descriptor == EventPanelWindow_UI) { + mPresenter!!.loadHistory() + } + } + + override fun init(context: Context) { + Logger.d(TAG, "init --------> ") + } + } + val v2xStatus = v2xStatus() + v2xStatus?.registerStatusChangedListener(TAG, EventPanelWindow_UI, mListener) + } + + /** + * 列表加载数据 + * + * @param v2XHistoryScenarioData 最新数据 + */ + fun loadHistory(v2XHistoryScenarioData: List) { + Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData)) + ThreadUtils.runOnUiThread { + mV2XHistoryScenarioData.clear() + if (v2XHistoryScenarioData.size > 0) { + viewEmpty.visibility = View.GONE + clHistoryList.visibility = View.VISIBLE + mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData) + } else { + viewEmpty.visibility = View.VISIBLE + clHistoryList.visibility = View.GONE + } + mV2XScenarioHistoryAdapter?.notifyDataSetChanged() + ttsForHistoryFirstToday() + if (fromVoice) { + ttsForVoiceCheckout() + fromVoice = false + } + } + } + + /* + * 手动点击出行动态 TTS播报 + * */ + private fun ttsForHistoryFirstToday() { + val 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播报 + * */ + fun ttsForVoiceCheckout() { + if (mV2XHistoryScenarioData.size > 0) { + AIAssist.getInstance(Utils.getApp()).speakTTSVoice("为您找到以下动态请查看", null) + } else { + AIAssist.getInstance(Utils.getApp()).speakTTSVoice("今天暂无出行动态,试试对我说分享拥堵给其他车友吧", null) + } + } + + override fun onResume() { + super.onResume() + // 清除V2X事件数据库中过期的数据,数据有效期为24小时 + viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) { + V2XSQLiteUtils.clearYesterdayScenarioHistoryData() + mPresenter!!.loadHistory() + } + } + + override fun createPresenter(): ScenarioHistoryPresenter { + return ScenarioHistoryPresenter(this) + } + + override fun onDestroyView() { + super.onDestroyView() + val v2xStatus = v2xStatus() + v2xStatus?.unregisterStatusChangedListener(TAG, EventPanelWindow_UI, mListener) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XShareEventsFragment.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XShareEventsFragment.java new file mode 100644 index 0000000000..0a330cc84f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XShareEventsFragment.java @@ -0,0 +1,267 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XShareEventAdapter; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventDescription; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItem; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItemEnum; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventLoadMoreItem; +import com.mogo.eagle.core.function.v2x.events.fragment.presenter.ShareEventsPresenter; +import com.mogo.eagle.core.function.v2x.events.listener.AdapterCallback; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback; +import com.mogo.eagle.core.function.v2x.events.network.V2XShareNetworkModel; +import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils; +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.common.view.SpacesItemDecoration; +import com.mogo.module.common.view.NetworkLoadingView; +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XSurroundingFragment.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XSurroundingFragment.java new file mode 100644 index 0000000000..bf1ebd9a68 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/V2XSurroundingFragment.java @@ -0,0 +1,490 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XSurroundingAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.entity.panel.BackRefreshInfo; +import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction; +import com.mogo.eagle.core.function.v2x.events.fragment.presenter.SurroundingEventPresenter; +import com.mogo.eagle.core.function.v2x.events.listener.SurroundingItemClickListener; +import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils; +import com.mogo.eagle.core.function.v2x.events.widgets.SurroundingEventView; +import com.mogo.eagle.core.function.v2x.events.widgets.SurroundingMarginDecoration; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.IMogoMarkerManager; +import com.mogo.map.marker.anim.OnMarkerAnimationListener; +import com.mogo.map.uicontroller.IMogoMapUIController; +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.common.view.NetworkLoadingView; +import com.mogo.service.IMogoServiceApis; +import com.mogo.eagle.core.data.constants.MogoServicePaths; +import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; +import com.mogo.service.module.IMogoMarkerService; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +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(); + //清除道路事件 + + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.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(() -> { + IMogoMarkerService markerService = BridgeApi.INSTANCE.markerService(); + if (markerService == null) { + return; + } + IMogoMarker mogoMarker = markerService.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边界,第五个参数:是否锁定自车位置(看业务需要) + + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.showBounds(ServiceConst.CARD_TYPE_ROAD_CONDITION, null, getMogoList(exploreWayList), rect, false); + } + } + + private void moveNotFresh() { + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + statusManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/EventPanelPresenter.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/EventPanelPresenter.kt new file mode 100644 index 0000000000..108641b5f5 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/EventPanelPresenter.kt @@ -0,0 +1,11 @@ +package com.mogo.eagle.core.function.v2x.events.fragment.presenter + +import com.mogo.commons.mvp.Presenter +import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment + +/** + * 事件面板presenter + * + * @author tongchenfei + */ +class EventPanelPresenter(view: V2XEventPanelFragment) : Presenter(view) \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/ScenarioHistoryPresenter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/ScenarioHistoryPresenter.java new file mode 100644 index 0000000000..ebfba924b0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/ScenarioHistoryPresenter.java @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.function.v2x.events.fragment.presenter; + + +import com.mogo.commons.mvp.Presenter; +import com.mogo.eagle.core.function.v2x.events.fragment.V2XScenarioHistoryFragment; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.module.common.entity.V2XHistoryScenarioData; +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/ShareEventsPresenter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/ShareEventsPresenter.java new file mode 100644 index 0000000000..7d3499ef4f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/ShareEventsPresenter.java @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.v2x.events.fragment.presenter; + +import com.mogo.commons.mvp.IView; +import com.mogo.commons.mvp.Presenter; +import com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/SurroundingEventPresenter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/SurroundingEventPresenter.java new file mode 100644 index 0000000000..eefcf6c96e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/fragment/presenter/SurroundingEventPresenter.java @@ -0,0 +1,112 @@ +package com.mogo.eagle.core.function.v2x.events.fragment.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.function.v2x.events.entity.panel.Center; +import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingRequest; +import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingResponse; +import com.mogo.eagle.core.function.v2x.events.network.V2XApiServiceFactory; +import com.mogo.eagle.core.function.v2x.events.widgets.SurroundingEventView; +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.service.IMogoServiceApis; +import com.mogo.eagle.core.data.constants.MogoServicePaths; +import com.mogo.service.network.IMogoNetwork; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/AdapterCallback.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/AdapterCallback.java new file mode 100644 index 0000000000..f439c373cb --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/AdapterCallback.java @@ -0,0 +1,11 @@ +package com.mogo.eagle.core.function.v2x.events.listener; + +/** + * @author liujing + */ +public interface AdapterCallback { + //分享列表加载更多 + void loadMoreShareEventList(); + //分享列表首次刷新 + void getShareEventResponse(); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/SurroundingDetailItemListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/SurroundingDetailItemListener.java new file mode 100644 index 0000000000..f2a7a34540 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/SurroundingDetailItemListener.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.listener; + +import android.view.View; +import com.mogo.module.common.entity.MarkerExploreWay; + +/** + * @author lixiaopeng + * @description + * @since 2020/8/10 + */ +public interface SurroundingDetailItemListener { + + void onItemClickListener(View v, int position, MarkerExploreWay exploreWay); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/SurroundingItemClickListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/SurroundingItemClickListener.java new file mode 100644 index 0000000000..fa67e9ba60 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/SurroundingItemClickListener.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.listener; + +import android.view.View; + +import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction; + +/** + * @author lixiaopeng + * @description + * @since 2020/8/10 + */ +public interface SurroundingItemClickListener { + void onItemClickListener(View v, int position, SurroundingConstruction construction); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/V2XMarkerClickListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/V2XMarkerClickListener.java new file mode 100644 index 0000000000..11a2f3c75d --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/V2XMarkerClickListener.java @@ -0,0 +1,136 @@ +package com.mogo.eagle.core.function.v2x.events.listener; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.text.TextUtils; + +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil; +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.entity.V2XRoadEventEntity; +import com.mogo.module.common.enums.EventTypeEnum; +import com.mogo.module.service.ServiceConst; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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; + } + // 关闭上次的气泡 + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + v2xMarker.closeMarker(BridgeApi.INSTANCE.context(), mLastCheckMarker); + } + } + // 将当前的Marker设置为选中 + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + mLastCheckMarker = v2xMarker.openMarker(BridgeApi.INSTANCE.context(), 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/V2XWindowStatusListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/V2XWindowStatusListener.java new file mode 100644 index 0000000000..610c3cfad9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/listener/V2XWindowStatusListener.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoPersonWarnPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoPersonWarnPolylineManager.java new file mode 100644 index 0000000000..dca12d37c2 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoPersonWarnPolylineManager.java @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.function.v2x.events.manager; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.template.IProvider; +import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo; +import com.mogo.map.overlay.IMogoPolyline; + +/** + * 绘制可变宽度和渐变的线, + */ +public interface IMoGoPersonWarnPolylineManager extends IProvider { + /** + * 绘制连接线,人物和二轮车 + * + * @param context + * @param info + */ + void drawPersonWarnPolyline(Context context, DrawLineInfo info); + + /** + * 移除连接线 + */ + void clearLine(); + + IMogoPolyline getMogoPersonWarnPolyline(); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoStopPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoStopPolylineManager.java new file mode 100644 index 0000000000..c81786bbcd --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoStopPolylineManager.java @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.function.v2x.events.manager; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.template.IProvider; +import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo; +import com.mogo.map.overlay.IMogoPolyline; + +/** + * 绘制可变宽度和渐变的线 + */ +public interface IMoGoStopPolylineManager extends IProvider { + /** + * 绘制连接线,目标车,与当前车辆间连线 + * + * @param context + * @param info + */ + void drawStopPolyline(Context context, DrawLineInfo info); + + /** + * 移除连接线 + */ + void clearLine(); + + IMogoPolyline getMogoStopPolyline(); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java new file mode 100644 index 0000000000..6913971f25 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XMarkerManager.java @@ -0,0 +1,164 @@ +package com.mogo.eagle.core.function.v2x.events.manager; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.template.IProvider; +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.IMogoMarkerClickListener; +import com.mogo.module.common.entity.MarkerCardResult; +import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.MarkerNoveltyInfo; +import com.mogo.module.common.entity.MarkerOnlineCar; +import com.mogo.module.common.entity.MarkerShowEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.v2x.data.V2XMarkerCardResult; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * 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(V2XMarkerCardResult 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, V2XSpecialCarRes.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XPolylineManager.java new file mode 100644 index 0000000000..5d79c45760 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XPolylineManager.java @@ -0,0 +1,31 @@ +package com.mogo.eagle.core.function.v2x.events.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; + +/** + * 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XStatusChangedListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XStatusChangedListener.java new file mode 100644 index 0000000000..964ce81d76 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XStatusChangedListener.java @@ -0,0 +1,19 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XStatusManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XStatusManager.java new file mode 100644 index 0000000000..87c8afa81a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoV2XStatusManager.java @@ -0,0 +1,206 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoWarnPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoWarnPolylineManager.java new file mode 100644 index 0000000000..b13fbfdcb3 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/IMoGoWarnPolylineManager.java @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.function.v2x.events.manager; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.template.IProvider; +import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo; +import com.mogo.map.overlay.IMogoPolyline; + +/** + * 绘制可变宽度和渐变的线 + */ +public interface IMoGoWarnPolylineManager extends IProvider { + /** + * 绘制连接线,目标车,与当前车辆间连线 + * + * @param context + * @param info + */ + void drawWarnPolyline(Context context, DrawLineInfo info); + + /** + * 移除连接线 + */ + void clearLine(); + + IMogoPolyline getMogoWarnPolyline(); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusDescriptor.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusDescriptor.java new file mode 100644 index 0000000000..511f8d27bc --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusDescriptor.java @@ -0,0 +1,80 @@ +package com.mogo.eagle.core.function.v2x.events.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/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 new file mode 100644 index 0000000000..3a959583f9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/V2XStatusManager.java @@ -0,0 +1,62 @@ +package com.mogo.eagle.core.function.v2x.events.manager; + +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 + */ +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/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 new file mode 100644 index 0000000000..c986a1e3bf --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoPersonWarnPolylineManager.java @@ -0,0 +1,85 @@ +package com.mogo.eagle.core.function.v2x.events.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.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineManager; +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; + +/** + * 绘制行人和二轮车连线 + */ +@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)); + } + // 绘制线的对象 + IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay(); + if (overlay != null) { + mMogoPolyline = overlay.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/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 new file mode 100644 index 0000000000..9a45f4ffdf --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoStopPolylineManager.java @@ -0,0 +1,85 @@ +package com.mogo.eagle.core.function.v2x.events.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.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoStopPolylineManager; +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; + +/** + * 当前车辆与道路事件的连接线 + */ +@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)); + } + // 绘制线的对象 + IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay(); + if (overlay != null) { + mMogoPolyline = overlay.addPolyline(options); + } + if (mMogoPolyline != null) { + 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/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 new file mode 100644 index 0000000000..dcb5c74084 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java @@ -0,0 +1,757 @@ +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.function.v2x.events.consts.V2XConst.V2X_EVENT_ALARM_POI; +import static com.mogo.module.service.strategy.CarIconDisplayStrategy.sFrameVr; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes; +import com.mogo.eagle.core.function.v2x.events.listener.V2XMarkerClickListener; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +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.util.ViewUtils; +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.uicontroller.EnumMapUI; +import com.mogo.map.uicontroller.IMogoMapUIController; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.v2x.V2XManager; +import com.mogo.v2x.data.V2XMarkerCardResult; +import com.mogo.v2x.data.V2XMarkerExploreWay; +import com.mogo.v2x.data.V2XMarkerLocation; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CopyOnWriteArraySet; + +/** + * 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底层逻辑让其进行绘制"); + // 清除连接线 + IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline(); + if (polylineManager != null) { + polylineManager.clearLine(); + } + clearAlarmPOI(); + clearSpecialCarPOI(); + // 锁车 + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.recoverLockMode(); + } + V2XManager.INSTANCE.forceRefresh(); + } + + @Override + public CopyOnWriteArrayList getV2XRoadEventEntityList() { + CopyOnWriteArrayList roadEventEntities = new CopyOnWriteArrayList<>(); + // 当前车辆数据 + MogoLocation currentLocation = V2XStatusManager.getInstance().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(V2XMarkerCardResult markerCardResult) { + boolean isShowEventWindow = false; + boolean isShowEventButton = false; + boolean isOtherSeekHelpWindowShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + //预警Window状态 + isShowEventWindow = v2xStatus.isRoadEventWindowShow(); + //预警按钮状态 + isShowEventButton = v2xStatus.isRoadEventButtonShow(); + //道路求助的window + isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow(); + } + try { + //当没有预警提示的时候重新绘制地图POI点 + if (markerCardResult != null && !isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) { + // 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常 + mV2XRoadEventEntityArrayList.clear(); + + // 获取探路以及新鲜事儿 + List exploreWayList = markerCardResult.getExploreWay(); + if (exploreWayList != null) { + for (V2XMarkerExploreWay markerExploreWay : exploreWayList) { + if (EventTypeEnum.isRoadEvent(markerExploreWay.getPoiType())) { + V2XMarkerLocation markerLocation = markerExploreWay.getLocation(); + // 记录道路事件 + V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); + v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation)); + // 探路目前只有上报拥堵 + v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType()); + + v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay)); + v2XRoadEventEntity.setExpireTime(20000); + mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void drawableV2XMarker(MarkerCardResult markerCardResult) { + + boolean isShowEventWindow = false; + boolean isShowEventButton = false; + boolean isOtherSeekHelpWindowShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + //预警Window状态 + isShowEventWindow = v2xStatus.isRoadEventWindowShow(); + //预警按钮状态 + isShowEventButton = v2xStatus.isRoadEventButtonShow(); + //道路求助的window + isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow(); + } + try { + //当没有预警提示的时候重新绘制地图POI点 + if (!isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) { + // 清除上次的道路事件,TODO 这里注意,道路事件的触发和这里是异步操作会触发异常 + //mV2XRoadEventEntityArrayList.clear(); + // 清除原来的大而全的新鲜事儿 + try { + clearALLPOI(); + } catch (Exception e) { + e.printStackTrace(); + } + // 清除连接线 + IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline(); + if (polylineManager != null) { + polylineManager.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(BridgeApi.INSTANCE.context(), markerShowEntity, clickListener); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearOnlineCarPOI() { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.removeMarkers(V2XConst.V2X_CARD_TYPE_USER_DATA); + } + } + + @Override + public void drawableSpecialCarPOI(Context context, V2XSpecialCarRes.V2XMarkerEntity v2XMarkerEntity, IMogoMarkerClickListener clickListener) { + try { + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.changeMapMode(EnumMapUI.NorthUP_2D); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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); + + // 重置告警信息 + V2XStatusManager.getInstance().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)); + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (isVrMode) { + mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null); + mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions())); + mAlarmInfoMarker.showInfoWindow(); + } else { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple); + } + } + // 当前Marker设置为最上面 + mAlarmInfoMarker.setToTop(); + } else { + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (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); + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + mAlarmInfoMarker = marker.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"); + if (marker != null) { + m3DMarker = marker.addMarker(V2X_EVENT_ALARM_POI, options); + } + if (m3DMarker != null) { + m3DMarker.setToTop(); + } + } else { + optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity)); + optionsRipple.period(100); + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple); + } + // 当前Marker设置为最上面 + if (mAlarmInfoMarker != null) { + mAlarmInfoMarker.setToTop(); + } + } + } + + // 绘制连接线 + IMoGoV2XPolylineManager iMoGoV2XPolylineManager = BridgeApi.INSTANCE.v2xPolyline(); + if (iMoGoV2XPolylineManager != null) { + iMoGoV2XPolylineManager.drawablePolyline(context, roadEventEntity); + } + // 缩放地图 + MapUtils.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 = false; + IMoGoV2XStatusManager iMoGoV2XStatusManager = BridgeApi.INSTANCE.v2xStatus(); + if (iMoGoV2XStatusManager != null) { + isOtherSeekHelpPOIShow = iMoGoV2XStatusManager.isOtherSeekHelpPOIShow(); + } + if (isOtherSeekHelpPOIShow) { + iMoGoV2XStatusManager.setOtherSeekHelpPOIShow(TAG, false); + // 重置告警信息 + V2XStatusManager.getInstance().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( + BridgeApi.INSTANCE.context(), + markerShowEntity, + clickListener); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearLiveCarPOI() { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.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( + BridgeApi.INSTANCE.context(), + markerShowEntity, + clickListener); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearExplorePOI() { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.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(BridgeApi.INSTANCE.context(), markerShowEntity, clickListener); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearNoveltyPOI() { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.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 = null; + 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); + IMogoMarkerManager markerManager = BridgeApi.INSTANCE.marker(); + if (markerManager != null) { + marker = markerManager.addMarker(markerShowEntity.getMarkerType(), options); + } + } else { + IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(context, markerShowEntity, options); + bitmap = ViewUtils.fromView(iMarkerView.getView()); + options.icon(bitmap); + IMogoMarkerManager markerManager = BridgeApi.INSTANCE.marker(); + if (markerManager != null) { + marker = markerManager.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 { + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.changeMapMode(EnumMapUI.NorthUP_2D); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (isVrMode) { + mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener); +// mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions())); +// mAlarmInfoMarker.showInfoWindow(); + } else { + optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity)); + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple); + } + } + // 当前Marker设置为最上面 + if (mAlarmInfoMarker != null) { + mAlarmInfoMarker.setToTop(); + } + // 绘制连接线 + IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline(); + if (polylineManager != null) { + polylineManager.drawablePolyline(context, roadEventEntity); + } + // 缩放地图 + MapUtils.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 = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + isRoadEventPOIShow = v2xStatus.isRoadEventPOIShow(); + } + if (isRoadEventPOIShow) { + v2xStatus.setRoadEventPOIShow(TAG, false); + if (mAlarmInfoMarker != null) { + mAlarmInfoMarker.remove(); + } + } + } + + @Override + public void clearALLPOI() { + try { + IMogoMarkerManager markerManager = BridgeApi.INSTANCE.marker(); + if (markerManager != null) { + markerManager.removeMarkers(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void init(Context context) { + + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java new file mode 100644 index 0000000000..243e66c0f9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XPolylineManager.java @@ -0,0 +1,125 @@ +package com.mogo.eagle.core.function.v2x.events.manager.impl; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; +import com.mogo.map.navi.IMogoNavi; +import com.mogo.map.overlay.IMogoOverlayManager; +import com.mogo.map.overlay.IMogoPolyline; +import com.mogo.map.overlay.MogoPolylineOptions; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.common.enums.EventTypeEnum; +import com.mogo.service.statusmanager.IMogoStatusManager; + +import java.util.ArrayList; +import java.util.List; + +/** + * author : donghongyu + * 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(); + } + boolean isRoadEventPOIShow = false; + boolean isOtherSeekHelpPOIShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + isRoadEventPOIShow = v2xStatus.isRoadEventPOIShow(); + isOtherSeekHelpPOIShow = v2xStatus.isOtherSeekHelpPOIShow(); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + + if ((isRoadEventPOIShow + || isOtherSeekHelpPOIShow) + && V2XStatusManager.getInstance().getTargetMoGoLatLng() != null + && !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); + + // 当前车辆位置 + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + MogoLatLng carLocation = null; + if (navi != null) { + carLocation = navi.getCarLocation(); + } + if (carLocation != null) { + options.add(carLocation); + } else { + options.add(V2XStatusManager.getInstance().getLocation()); + } + // 目标车辆、道路事件位置 + options.add(V2XStatusManager.getInstance().getTargetMoGoLatLng()); + + // 绘制线的对象 + IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay(); + if (overlay != null) { + mMogoPolyline = overlay.addPolyline(options); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearLine() { + if (mMogoPolyline != null) { + mMogoPolyline.remove(); + mMogoPolyline = null; + V2XStatusManager.getInstance().setAlarmInfo(null); + } + } + + @Override + public void init(Context context) { + + } + + /** + * @return 绘制连接线的对象 + */ + @Override + public IMogoPolyline getMogoPolyline() { + return mMogoPolyline; + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java new file mode 100644 index 0000000000..9653d35289 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XStatusManager.java @@ -0,0 +1,282 @@ +package com.mogo.eagle.core.function.v2x.events.manager.impl; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor; +import com.mogo.service.statusmanager.IMogoStatusManager; + +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) { + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + statusManager.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) { + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + statusManager.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/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 new file mode 100644 index 0000000000..60c289d85c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoWarnPolylineManager.java @@ -0,0 +1,96 @@ +package com.mogo.eagle.core.function.v2x.events.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.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; +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; + +/** + * 当前车辆与道路事件的连接线 + */ +@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)); + } + // 绘制线的对象 + + IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay(); + if (overlay != null) { + mMogoPolyline = overlay.addPolyline(options); + } + if (mMogoPolyline != null) { + 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java new file mode 100644 index 0000000000..9dd9aa906c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java @@ -0,0 +1,174 @@ +package com.mogo.eagle.core.function.v2x.events.marker; + +import android.content.Context; +import android.graphics.Bitmap; + +import com.mogo.eagle.core.function.v2x.R; +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 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, 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(); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarInfoView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarInfoView.kt new file mode 100644 index 0000000000..aa3c0ac469 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarInfoView.kt @@ -0,0 +1,144 @@ +package com.mogo.eagle.core.function.v2x.events.marker + +import android.content.Context +import android.graphics.Bitmap +import android.text.TextUtils +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.v2x.R +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes.V2XMarkerEntity +import com.mogo.eagle.core.utilcode.util.ViewUtils +import com.mogo.module.common.entity.MarkerOnlineCar +import com.mogo.module.common.entity.MarkerShowEntity +import kotlinx.android.synthetic.main.view_marker_car.view.* +import kotlinx.android.synthetic.main.view_marker_car_info.view.* +import kotlinx.android.synthetic.main.view_marker_car_info.view.ivCar + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020-01-0619:55 + * desc : 绘制在线车辆,特殊车辆 + * version: 1.0 + */ +class V2XMarkerCarInfoView(context: Context, showEntity: MarkerShowEntity) : + ConstraintLayout(context) { + + init { + initView(context, showEntity) + } + + private fun initView(context: Context, showEntity: MarkerShowEntity) { + val bindObj: Any = showEntity.bindObj + if (bindObj is MarkerOnlineCar) { + //1 老司机 2 安全驾驶 3 危险驾驶 4 可直播车辆 + when (bindObj.userInfo.safeLabelType) { + // 可直播车机 + 4 -> { + LayoutInflater.from(context) + .inflate(R.layout.view_marker_car, this) + ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_live_vedio) + } + else -> { + LayoutInflater.from(context) + .inflate(R.layout.view_marker_car_info, this) + } + } + } + if (bindObj is V2XMarkerEntity) { + LayoutInflater.from(context) + .inflate(R.layout.view_marker_car, this) + } + updateUI(showEntity) + } + + fun updateUI(showEntity: MarkerShowEntity) { + ivCar.rotation = showEntity.markerLocation.angle.toFloat() +// ivCar.rotation = 90f + + tvUserMarker.text = if (TextUtils.isEmpty(showEntity.textContent)) { + "" + } else { + showEntity.textContent + } + + val bindObj: Any = showEntity.bindObj + if (bindObj is MarkerOnlineCar) { + tvMarkerContent.text = + if (bindObj.userInfo == null && TextUtils.isEmpty(bindObj.userInfo.userName)) { + "蘑菇车主" + } else { + bindObj.userInfo.userName + } + + //车辆类型,0-普通车辆,1-警车,2-救护车,3-道路救援车辆', + when (bindObj.carInfo.vehicleType) { + // 普通车 + 0 -> { + clMarkerContent.visibility = View.VISIBLE + ivReverseTriangle.visibility = View.VISIBLE + ivCar.setImageResource(R.drawable.icon_car_gray) + } + // 警车 + 1 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_police) + } + // 救护车 + 2 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_ambulance) + } + // 道路救援车辆 + 3 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) + } + else -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_gray) + } + } + } + if (bindObj is V2XMarkerEntity) { + when (bindObj.targetId) { + 10001 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_gray) + } + 10002 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_ambulance) + } + 10003 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_police) + } + //失控车 + 10004 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) + } + // 故障车 + 20007 -> { + clMarkerContent.visibility = View.GONE + ivReverseTriangle.visibility = View.GONE + ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) + } + } + } + } + + fun getView(): Bitmap { + return ViewUtils.fromView(this) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarView.kt new file mode 100644 index 0000000000..fb0ab56d62 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerCarView.kt @@ -0,0 +1,114 @@ +package com.mogo.eagle.core.function.v2x.events.marker + +import android.content.Context +import android.graphics.Bitmap +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.v2x.R +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes.V2XMarkerEntity +import com.mogo.eagle.core.utilcode.util.ViewUtils +import com.mogo.module.common.entity.MarkerOnlineCar +import com.mogo.module.common.entity.MarkerShowEntity +import kotlinx.android.synthetic.main.view_marker_car.view.* + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020-01-0619:55 + * desc : 绘制在线车辆,特殊车辆 + * version: 1.0 + */ +class V2XMarkerCarView(context: Context, showEntity: MarkerShowEntity) : + ConstraintLayout(context) { + + init { + initView(context, showEntity) + } + + private fun initView(context: Context, showEntity: MarkerShowEntity) { + LayoutInflater.from(context) + .inflate(R.layout.view_marker_car, this) + updateUI(showEntity) + } + + fun updateUI(showEntity: MarkerShowEntity) { + ivCar.rotation = showEntity.markerLocation.angle.toFloat() + + val bindObj: Any = showEntity.bindObj + if (bindObj is MarkerOnlineCar) { + //1 老司机 2 安全驾驶 3 危险驾驶 4 可直播车辆 + when (bindObj.userInfo.safeLabelType) { + 1 -> { + ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_blue) + } + 2 -> { + ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_green) + } + 3 -> { + ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_red) + } + 4 -> { + ivMarkerTip.setImageResource(R.drawable.v_to_x_marker_car_live_vedio) + } + } + + //车辆类型,0-普通车辆,1-警车,2-救护车,3-道路救援车辆', + when (bindObj.carInfo.vehicleType) { + // 普通车 + 0 -> { + ivMarkerTip.visibility = View.VISIBLE + ivCar.setImageResource(R.drawable.icon_car_gray) + } + // 警车 + 1 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_police) + } + // 救护车 + 2 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_ambulance) + } + // 道路救援车辆 + 3 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) + } + else -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_gray) + } + } + } + if (bindObj is V2XMarkerEntity) { + when (bindObj.targetId) { + 10001 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_gray) + } + 10002 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_ambulance) + } + 10003 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.icon_car_police) + } + 10004 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) + } + // 故障车 + 20007 -> { + ivMarkerTip.visibility = View.GONE + ivCar.setImageResource(R.drawable.v_to_x_warning_car_red) + } + } + } + } + + fun getView(): Bitmap { + return ViewUtils.fromView(this) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt new file mode 100644 index 0000000000..5c257f0872 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerRoadEventView.kt @@ -0,0 +1,68 @@ +package com.mogo.eagle.core.function.v2x.events.marker + + +import android.content.Context +import android.graphics.Bitmap +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.v2x.R +import com.mogo.eagle.core.utilcode.util.ViewUtils +import com.mogo.module.common.entity.V2XRoadEventEntity +import com.mogo.module.common.enums.EventTypeEnum +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XApiService.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XApiService.java new file mode 100644 index 0000000000..9dfcab14fa --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XApiService.java @@ -0,0 +1,124 @@ +package com.mogo.eagle.core.function.v2x.events.network; + +import com.mogo.eagle.core.data.BaseData; +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.function.v2x.events.entity.panel.SurroundingResponse; +import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventDescription; +import com.mogo.eagle.core.function.v2x.events.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; + +/** + * @author congtaowang + * @since 2020-01-03 + *

+ * 接口描述 + */ +public interface V2XApiService { + + /** + * 直播点赞 + */ + @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/updateVehicleType/v1") + Observable sendHelpSignal(@FieldMap Map param); + + /** + * 根据经纬度查询附近可直播车机直播信息 + */ + @FormUrlEncoded + @POST("/yycp-realtimeLocations/realTimeLocationServer/car/queryNearbyVehicleLiveByLocation/v1") + Observable queryNearbyVehicleLiveByLocation(@FieldMap Map parameters); + + + /** + * 点赞接口 + */ + @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); + + /** + * 根据名称获取策略详情 + */ + @GET("/yycp-strategyPush/push/strategy/item?name=TIRE_DRIVING") + Observable getStrategyPush(); + + /** + * 车辆故障求助查询 + * + * @param param + * @return + */ + @FormUrlEncoded + @POST("/yycp-realtimeLocations/vehicleTypeManage/car/queryVehicleType/v1") + Observable queryHelpSignal(@FieldMap Map param); + + /** + * 我的分享-热心指数等 + */ + @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); + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XApiServiceFactory.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XApiServiceFactory.java new file mode 100644 index 0000000000..d106a9d025 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XApiServiceFactory.java @@ -0,0 +1,72 @@ +package com.mogo.eagle.core.function.v2x.events.network; + +import android.content.Context; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.eagle.core.data.constants.MogoServicePaths; +import com.mogo.module.common.constants.HostConst; +import com.mogo.service.network.IMogoNetwork; + +/** + * 应对不同接口对应不同服务域名的工厂累 + */ +public class V2XApiServiceFactory { + + private static V2XApiService mDevaApiService; + 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 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 getStrategyPushApiService(Context context) { + if (mDataServiceApiService == null) { + synchronized (V2XApiServiceFactory.class) { + if (mDataServiceApiService == null) { + mDataServiceApiService = getApiService(context, HostConst.STRATEGY_PUSH_HOST); + } + } + } + return mDataServiceApiService; + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshCallback.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshCallback.java new file mode 100644 index 0000000000..da774305d7 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshCallback.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.network; + +/** + * @author congtaowang + * @since 2020-01-03 + *

+ * 刷新回调 + */ +public interface V2XRefreshCallback { + + void onSuccess(T result); + + void onFail(String msg); +} 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 new file mode 100644 index 0000000000..681142f9cb --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XRefreshModel.java @@ -0,0 +1,370 @@ +package com.mogo.eagle.core.function.v2x.events.network; + +import android.content.Context; +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; +import io.reactivex.schedulers.Schedulers; +import okhttp3.RequestBody; + + +/** + * 数据接口API + * + * @author donghongyu + * @since 2020-01-03 + */ +public class V2XRefreshModel { + + private Context mContext; + 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; + } + + + /** + * 直播点赞👍 + * + * @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 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); + } + } + }); + } + + /** + * 点赞接口 + */ + 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 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); + } + } + }); + } + + /** + * 查询当前车辆故障求助状态 + * + * @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); + } + } + }); + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XShareNetworkModel.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XShareNetworkModel.java new file mode 100644 index 0000000000..44101ffeef --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/network/V2XShareNetworkModel.java @@ -0,0 +1,180 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/observer/CarLocationObserver.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/observer/CarLocationObserver.java new file mode 100644 index 0000000000..06e910f8e9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/observer/CarLocationObserver.java @@ -0,0 +1,13 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/observer/V2XOptimalRouteObserver.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/observer/V2XOptimalRouteObserver.java new file mode 100644 index 0000000000..a67b45437a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/observer/V2XOptimalRouteObserver.java @@ -0,0 +1,50 @@ +package com.mogo.eagle.core.function.v2x.events.observer; + +import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/overlay/V2XOptimalRouteOverlay.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/overlay/V2XOptimalRouteOverlay.java new file mode 100644 index 0000000000..8d072eefcd --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/overlay/V2XOptimalRouteOverlay.java @@ -0,0 +1,76 @@ +package com.mogo.eagle.core.function.v2x.events.overlay; + +import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils; +import com.mogo.eagle.core.utilcode.util.ColorUtils; +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; + +/** + * 最优路线推荐的图覆盖物 + * + * @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); + // 绘制线 + IMogoOverlayManager overlay = BridgeApi.INSTANCE.overlay(); + if (overlay != null) { + mMoGoPolyline = overlay.addPolyline(mPolylineOptions); + } + } + return mMoGoPolyline; + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/provider/V2XEventPanelModuleProvider.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/provider/V2XEventPanelModuleProvider.java new file mode 100644 index 0000000000..82f49b7bc0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/provider/V2XEventPanelModuleProvider.java @@ -0,0 +1,113 @@ +package com.mogo.eagle.core.function.v2x.events.provider; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.events.V2XEventManager; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment; +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.service.eventpanel.IEventPanelProvider; +import com.mogo.service.module.IMogoModuleLifecycle; +import com.mogo.service.module.ModuleType; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + + +/** + * 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。。。。"); + 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) { + V2XEventManager.INSTANCE.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/SceneBroadcastReceiver.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/SceneBroadcastReceiver.kt new file mode 100644 index 0000000000..f093b60e02 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/SceneBroadcastReceiver.kt @@ -0,0 +1,24 @@ +package com.mogo.eagle.core.function.v2x.events.receiver + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst +import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager +import com.mogo.module.common.entity.V2XMessageEntity +import java.lang.Exception + +class SceneBroadcastReceiver: BroadcastReceiver() { + + override fun onReceive(context: Context?, intent: Intent?) { + try { + val v2XMessageEntity = + intent?.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY) as? V2XMessageEntity<*> + v2XMessageEntity?.let { + V2XScenarioManager.getInstance().handlerMessage(it) + } + } catch (e: Exception) { + e.printStackTrace() + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/IV2XScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/IV2XScenario.java new file mode 100644 index 0000000000..d7908bbf87 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/IV2XScenario.java @@ -0,0 +1,71 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/IV2XScenarioManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/IV2XScenarioManager.java new file mode 100644 index 0000000000..90be90fbb1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/IV2XScenarioManager.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.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/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 new file mode 100644 index 0000000000..561d24058c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java @@ -0,0 +1,102 @@ +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 + * 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/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 new file mode 100644 index 0000000000..f71973af53 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java @@ -0,0 +1,174 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.impl; + +import android.content.Intent; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; +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.animation.V2XAnimationScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue.V2XFatigueDrivingScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.help.V2XCarForHelpScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XPushLiveCarScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XVoiceCallLiveScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.park.V2XIllegalParkScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.push.V2XPushEventScenario; +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.seek.V2XSeekHelpScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc.V2XEventUgcScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario; +import com.mogo.eagle.core.utilcode.util.ThreadUtils; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.map.uicontroller.IMogoMapUIController; +import com.mogo.map.uicontroller.VisualAngleMode; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario; +import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING; + +/** + * 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: + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + mV2XScenario = 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: + boolean isVrMode1 = false; + IMogoStatusManager statusManager1 = BridgeApi.INSTANCE.statusManager(); + if (statusManager1 != null) { + isVrMode1 = statusManager1.isVrMode(); + } + if (isVrMode1) { + 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() { + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null && mapUiController.getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) { + mapUiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null); + } + } + + private void hidOtherPanel() { + try { + // 与其它面板互斥 + IMogoOnlineCarListPanelProvider onlineCarListPanelProvider = BridgeApi.INSTANCE.onlineCarPanelApi(); + if (onlineCarListPanelProvider != null) { + onlineCarListPanelProvider.hidePanel(); + } + } 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/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 new file mode 100644 index 0000000000..52ec517567 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/V2XBasWindow.java @@ -0,0 +1,60 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene; + +import android.content.Context; +import android.util.AttributeSet; +import android.util.Log; +import android.widget.RelativeLayout; + +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.service.v2x.IV2XWindowManagerListener; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * @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"); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeView(this); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/animation/V2XAnimationScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/animation/V2XAnimationScenario.java new file mode 100644 index 0000000000..9037ed1130 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/animation/V2XAnimationScenario.java @@ -0,0 +1,127 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.animation; + +import androidx.annotation.Nullable; + +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.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoWindowManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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) { + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (!isSameScenario(v2XMessageEntity) + && isMainPageOnResume) { + boolean isV2XAnimationShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + isV2XAnimationShow = v2xStatus.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(BridgeApi.INSTANCE.context(), getV2XMessageEntity().getContent()); + } + + @Override + public void onViewClose() { + closeWindow(); + clearPOI(); + } + }); + getV2XWindow().show(getV2XMessageEntity().getContent()); + + IMogoWindowManager windowManager = BridgeApi.INSTANCE.windowManager(); + if (windowManager != null) { + windowManager.addView(getV2XWindow().getView(), 0, 0, false); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setV2XAnimationWindowShow(TAG, true); + } + } + } + + @Override + public void closeWindow() { + if (getV2XWindow() != null) { + getV2XWindow().close(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/animation/V2XAnimationWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/animation/V2XAnimationWindow.java new file mode 100644 index 0000000000..443c1bdd17 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/animation/V2XAnimationWindow.java @@ -0,0 +1,145 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.animation; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.eagle.core.widget.TextureVideoView; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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(BridgeApi.INSTANCE.context(), 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(BridgeApi.INSTANCE.context()).speakTTSVoice(tts); + } + } + + @Override + public void close() { + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/destination/V2XRecommendRouteScenario.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/destination/V2XRecommendRouteScenario.kt new file mode 100644 index 0000000000..609f947b1c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/destination/V2XRecommendRouteScenario.kt @@ -0,0 +1,76 @@ +package com.mogo.module.v2x.scenario.scene.destination + +import android.view.ViewGroup +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.scenario.impl.AbsV2XScenario +import com.mogo.eagle.core.utilcode.util.Utils +import com.mogo.module.common.entity.V2XMessageEntity +import com.mogo.module.common.entity.V2XRecommendRouteEntity + +/** + * 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 (BridgeApi.statusManager()?.isMainPageOnResume == true) { + 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()) + BridgeApi.topViewManager()?.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/destination/V2XRecommendRouteWindow.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/destination/V2XRecommendRouteWindow.kt new file mode 100644 index 0000000000..e4541ce5ce --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/destination/V2XRecommendRouteWindow.kt @@ -0,0 +1,78 @@ +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.eagle.core.function.v2x.R +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow +import com.mogo.module.common.entity.V2XEventShowEntity +import com.mogo.module.common.entity.V2XMessageEntity +import com.mogo.module.common.entity.V2XRecommendRouteEntity + +/** + * created by wujifei on 2020/12/25 11:45 + * describe:基于目的地预判的道路事件场景弹窗 + */ +class V2XRecommendRouteWindow @JvmOverloads constructor( + context: Context = BridgeApi.context(), + 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() { + //移除窗体 + BridgeApi.topViewManager()?.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/fatigue/V2XFatigueDrivingScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/fatigue/V2XFatigueDrivingScenario.java new file mode 100644 index 0000000000..1b0d745477 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/fatigue/V2XFatigueDrivingScenario.java @@ -0,0 +1,172 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.map.navi.IMogoNavi; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.module.v2x.voice.V2XVoiceManager; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + + +/** + * 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) { + boolean isVrMode = false; + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (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() + && isMainPageOnResume) { + show(); + } + } + } else { + setV2XMessageEntity(v2XMessageEntity); + Logger.w(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)); + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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()); + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + if (navi != null) { + navi.naviTo(endPoint); + } + close(); + } + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/fatigue/V2XFatigueDrivingWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/fatigue/V2XFatigueDrivingWindow.java new file mode 100644 index 0000000000..d4e70a5453 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/fatigue/V2XFatigueDrivingWindow.java @@ -0,0 +1,160 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue; + +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.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.PagerSnapHelper; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.service.windowview.IMogoTopViewManager; + +import java.util.ArrayList; +import java.util.List; + +/** + * 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(BridgeApi.INSTANCE.context(), 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; + } + + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XCarForHelpScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XCarForHelpScenario.java new file mode 100644 index 0000000000..0ad28fdd53 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XCarForHelpScenario.java @@ -0,0 +1,278 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.help; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.os.CountDownTimer; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +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.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.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.IMogoStatusManager; +import com.mogo.service.statusmanager.StatusDescriptor; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * @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); + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + statusManager.registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this); + statusManager.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 = (command, intent) -> { + IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton(); + TextView tv = entranceButton != null ? entranceButton.getButton(ButtonIndex.BUTTON2) : null; + 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() { + boolean isSeekHelping = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isSeekHelping = statusManager.isSeekHelping(); + } + if (isSeekHelping) { + Logger.d(TAG, "关闭自车求助按钮!"); + IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton(); + if (entranceButton != null) { + entranceButton.hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP); + } + statusManager.setSeekHelping(TAG, false); + if (getV2XButton() != null) { + getV2XButton().close(); + SharedPrefsMgr.getInstance(Utils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0); + } + + mySeekHelpCountDownTimerCancel(); + } + boolean isOtherSeekHelpPOIShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + isOtherSeekHelpPOIShow = v2xStatus.isOtherSeekHelpPOIShow(); + } + if (isOtherSeekHelpPOIShow) { + // 移除线 + IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline(); + if (v2xPolyline != null) { + v2xPolyline.clearLine(); + } + + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + // 移除事件POI + v2xMarker.clearSpecialCarPOI(); + // 绘制上次的数据 + v2xMarker.drawableLastAllPOI(); + } + } + } + + + @Override + public void drawPOI() { + //无Poi + } + + @Override + public void clearPOI() { + //无Poi + } + + + private void mySeekHelpCountDownTimerStart() { + long seekHelpTimeStart = SharedPrefsMgr.getInstance(BridgeApi.INSTANCE.context()).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(BridgeApi.INSTANCE.context()); + } +// 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) { + boolean isSeekHelping = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isSeekHelping = statusManager.isSeekHelping(); + } + if (isSeekHelping) { + if (isTrue) { + ((V2XSeekHelpButton) getV2XButton()).showTopView(); + IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton(); + if (entranceButton != null) { + TextView button = entranceButton.getButton(ButtonIndex.BUTTON2); + if (button != null) { + button.setVisibility(View.GONE); + } + } + } else { + ((V2XSeekHelpButton) getV2XButton()).closeTopView(); + IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton(); + if (entranceButton != null) { + TextView button = entranceButton.getButton(ButtonIndex.BUTTON2); + if (button != null) { + button.setVisibility(View.VISIBLE); + } + } + } + } + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XSeekHelpButton.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XSeekHelpButton.java new file mode 100644 index 0000000000..66941c9b0a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XSeekHelpButton.java @@ -0,0 +1,146 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButton; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButtonListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.module.v2x.voice.V2XVoiceManager; +import com.mogo.service.entrance.ButtonIndex; +import com.mogo.service.entrance.IMogoEntranceButtonController; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; + +/** + * @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 { + IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton(); + + tv = entranceButton != null ? entranceButton.getButton(ButtonIndex.BUTTON2) : null; + if (tv != null) { + tv.setText("取消\n求助"); + tv.setOnClickListener(v -> { + //调用取消求助接口 + // TODO: 2020/5/18 回调,显示对话框 + doAction(); + }); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (isVrMode) { + showTopView(); + tv.setVisibility(View.GONE); + } else { + closeTopView(); + tv.setVisibility(View.VISIBLE); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void showTopView() { + topView = View.inflate(BridgeApi.INSTANCE.context(), 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)); + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(topView, layoutParams); + } + } + + public void closeTopView() { + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeView(topView); + } + } + + @Override + public void close() { + if (tv != null) { + AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已取消", null); + tv.setVisibility(View.GONE); + closeTopView(); + V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel(); + v2XRefreshModel.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XSeekHelpDialog.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XSeekHelpDialog.java new file mode 100644 index 0000000000..3423005940 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/help/V2XSeekHelpDialog.java @@ -0,0 +1,158 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.module.common.wm.WindowManagerView; +import com.mogo.module.v2x.voice.V2XVoiceManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * @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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XPushLiveCarScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XPushLiveCarScenario.java new file mode 100644 index 0000000000..03bdb51329 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XPushLiveCarScenario.java @@ -0,0 +1,153 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar; + +import android.text.TextUtils; +import android.view.View; +import android.view.ViewGroup; +import androidx.annotation.Nullable; +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.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +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) { + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (!isSameScenario(v2XMessageEntity) + && 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) { + + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + int width = (int) Utils.getApp().getResources().getDimension(isVrMode ? + R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width); + int height = (int) Utils.getApp().getResources().getDimension(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); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (isVrMode) { + if (topViewManager != null) { + topViewManager.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); + } + } else { + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setLiveCarWindowShow(TAG,true); + } + } + } + + @Override + public void closeWindow() { + if (getV2XWindow() != null) { + getV2XWindow().close(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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(BridgeApi.INSTANCE.context(), getV2XMessageEntity().getContent()); + } + + @Override + public void onViewRemoved(View view) { + } + + @Override + public void beforeViewAddAnim(View view) { + } + + @Override + public void beforeViewRemoveAnim(View view) { + // 重置场景提示的消息 + setV2XMessageEntity(null); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setLiveCarWindowShow(TAG, false); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XPushLiveCarWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XPushLiveCarWindow.java new file mode 100644 index 0000000000..1685e208ed --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XPushLiveCarWindow.java @@ -0,0 +1,178 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.widget.ImageView; + +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.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.view.V2XLiveGSYVideoView; +import com.mogo.map.uicontroller.IMogoMapUIController; +import com.mogo.module.common.entity.MarkerCarInfo; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.service.imageloader.IMogoImageloader; +import com.mogo.service.imageloader.MogoImageView; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; + +/** + * 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(BridgeApi.INSTANCE.context(), 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。。。。。"); + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + LayoutInflater.from(context).inflate(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); + IMogoImageloader imageLoader = BridgeApi.INSTANCE.imageLoader(); + if (imageLoader != null) { + imageLoader.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() { + // 修改地图比例 + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + statusManager.setUserInteractionStatus(MODULE_NAME, true, false); + } + // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.loseLockMode(); + } + // 如果窗体处于展示的时候 + 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(){ + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (isVrMode) { + if (topViewManager != null) { + topViewManager.removeViewNoLinkage(this); + } + } else { + if (topViewManager != null) { + topViewManager.removeView(this); + } + } + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XRoadLiveCarScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XRoadLiveCarScenario.java new file mode 100644 index 0000000000..55d9f3075c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XRoadLiveCarScenario.java @@ -0,0 +1,174 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; + +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.manager.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +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.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +import java.util.List; + + +/** + * 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() { + IV2XWindow window = getV2XWindow(); + Log.d(TAG, window.toString()); + if (window != null) { + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + boolean isVrMode = false; + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + int width = (int) Utils.getApp().getResources().getDimension(isVrMode ? + R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width); + int height = (int) Utils.getApp().getResources().getDimension(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); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addViewNoLinkage(window.getView(), layoutParams, this); + } + window.show(getV2XMessageEntity().getContent()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setRoadLiveCarWindowShow(TAG, true); + } + } + } + + @Override + public void closeWindow() { + if (getV2XWindow() != null) { + getV2XWindow().close(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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-警报结束 + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setRoadLiveCarWindowShow(TAG, false); + } + // 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时 +// V2XRoadEventWindow window = (V2XRoadEventWindow) V2XRoadEventScenario.getInstance().getV2XWindow(); +// window.startCountDown(); + // 重置场景提示的消息 + setV2XMessageEntity(null); + // 关闭场景提示 + clearPOI(); + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XRoadLiveCarWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XRoadLiveCarWindow.java new file mode 100644 index 0000000000..8411912ae5 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XRoadLiveCarWindow.java @@ -0,0 +1,235 @@ +package com.mogo.eagle.core.function.v2x.events.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.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.PagerSnapHelper; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoicePagingListener; +import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.v2x.voice.V2XVoiceManager; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; + +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(BridgeApi.INSTANCE.context(), 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===初始化道路直播视图"); + // 填充布局 + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + LayoutInflater.from(context).inflate(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; + } + + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeView(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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveBiz.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveBiz.java new file mode 100644 index 0000000000..d64333e2e9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveBiz.java @@ -0,0 +1,242 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.utilcode.util.ToastUtils; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.map.location.IMogoLocationClient; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.IMogoMarkerClickListener; +import com.mogo.map.uicontroller.IMogoMapUIController; +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.voice.V2XVoiceManager; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.statusmanager.StatusDescriptor; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_AHEAD_LIVE; +import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP; +import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CROSSROADS_LIVE; +import static com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_ROAD_CAMERA_LIVE_UN_WAKEUP; +import static com.mogo.map.marker.MarkerType.MAP_STATIC; +import static com.mogo.map.marker.MarkerType.MAP_STATIC_TRAFFIC; +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"); + boolean isLongSight = false; + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + isLongSight = mapUiController.getCurrentMapVisualAngle().isLongSight(); + } + if (isLongSight) { + Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker is on LongSight, so don't response"); + return false; + } + //拉近地图视角为近景 + if (mapUiController != null) { + mapUiController.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() { + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + statusManager.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() { + IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient(); + if (locationClient == null) { + return; + } + MogoLocation mogoLocation = locationClient.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveCarWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveCarWindow.java new file mode 100644 index 0000000000..707bf4ce1a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveCarWindow.java @@ -0,0 +1,164 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.view.CarZegoLiveVideoView; +import com.mogo.module.common.entity.MarkerCarInfo; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +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(BridgeApi.INSTANCE.context(), 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===初始化语音呼叫直播视图"); + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + + LayoutInflater.from(context).inflate(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(){ + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (isVrMode) { + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeViewNoLinkage(this); + } + }else{ + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeView(this); + } + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveScenario.java new file mode 100644 index 0000000000..419d549ad8 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/livecar/V2XVoiceCallLiveScenario.java @@ -0,0 +1,160 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * author : unknown + * desc : 语音呼叫查看直播场景,包括车辆直播 或者 路口实况 window,区分不同页面window逻辑实现,前方直播车辆由AICloudSdk中实现,上层仅传入SurfaceView和经纬度 + */ +public class V2XVoiceCallLiveScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { + + public V2XVoiceCallLiveScenario() { + Logger.d(MODULE_NAME, "V2XVoiceCallLiveScenario new()" ); + setV2XWindow(new V2XVoiceCallLiveCarWindow()); + } + + @Override + public void init(@Nullable V2XMessageEntity v2XMessageEntity) { + if (v2XMessageEntity == null) { + TipToast.shortTip("附近没有可直播车机"); + return; + } + if (v2XMessageEntity.isShowState()) { + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (!isSameScenario(v2XMessageEntity) + && isMainPageOnResume) { + setV2XMessageEntity(v2XMessageEntity); + Logger.d(MODULE_NAME, "v2XMessageEntity : " + v2XMessageEntity); + show(); + } else { + setV2XMessageEntity(v2XMessageEntity); + Logger.w(MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化"); + } + } else { + close(); + } + } + + @Override + public void show() { + if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) { + showWindow(); + } + } + + @Override + public void showWindow() { + if (getV2XWindow() != null) { + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + int width = (int) Utils.getApp().getResources().getDimension(isVrMode ? + R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width); + int height = (int) Utils.getApp().getResources().getDimension(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 (isVrMode) { + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); + } + } else { + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setLiveCarWindowShow(TAG, true); + } + } + } + + @Override + public void closeWindow() { + if (getV2XWindow() != null) { + getV2XWindow().close(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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(); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setLiveCarWindowShow(TAG, false); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkMarker.java new file mode 100644 index 0000000000..ab630f76bf --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkMarker.java @@ -0,0 +1,183 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.park; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_EVENT_ALARM_POI; + +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.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.IMogoMarkerManager; +import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.map.marker.anim.OnMarkerAnimationListener; +import com.mogo.map.uicontroller.IMogoMapUIController; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.eagle.core.utilcode.util.ViewUtils; +import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; +import java.util.ArrayList; +import java.util.List; + + +/** + * 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<>(); + // 清除道路事件 + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + v2xMarker.clearALLPOI(); + } + //清除连线 + IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline(); + if (v2xPolyline != null) { + v2xPolyline.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 = null; + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (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); + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + mogoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple); + } + + } + // 点击监听,天际弹窗展示详情 + if (mogoMarker != null) { + IMogoMarker finalMogoMarker = mogoMarker; + 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 (finalMogoMarker.isDestroyed()) { + return; + } + finalMogoMarker.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() { + // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.loseLockMode(); + } + // 移除违章停车点 + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.removeMarkers(ServiceConst.CARD_TYPE_NOVELTY); + } + // 移除线 + IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline(); + if (v2xPolyline != null) { + v2xPolyline.clearLine(); + } + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + // 移除事件POI + v2xMarker.clearAlarmPOI(); + // 绘制上次的数据 + v2xMarker.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkScenario.java new file mode 100644 index 0000000000..62eb3e0b96 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkScenario.java @@ -0,0 +1,140 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.park; + +import androidx.annotation.Nullable; + +import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils; +import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +import com.mogo.eagle.core.utilcode.util.ThreadUtils; +import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.common.enums.EventTypeEnum; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; + +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() { + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (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()); + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (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(BridgeApi.INSTANCE.context(), v2XRoadEventEntity); + saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING, + markerExploreWay); + } + } + + @Override + public void closeWindow() { + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + IV2XWindow window = getV2XWindow(); + + if (topViewManager != null && window != null && window.getView() != null) { + topViewManager.removeView(window.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) { + ThreadUtils.getIoPool().execute(() -> { + try { + V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode()); + } 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/scenario/scene/park/V2XIllegalParkWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkWindow.java new file mode 100644 index 0000000000..607491dbb8 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/park/V2XIllegalParkWindow.java @@ -0,0 +1,183 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +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.MarkerExploreWay; +import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.service.windowview.IMogoTopViewManager; + +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(BridgeApi.INSTANCE.context(), 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)); + + // 添加弹窗 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(this, layoutParams); + } + } + + /** + * 关闭详情展示框 + */ + @Override + public void close() { + mIsAutoClose = false; + // 停止倒计时 + if (handlerV2XEvent != null && runnableV2XEvent != null) { + handlerV2XEvent.removeCallbacks(runnableV2XEvent); + runnableV2XEvent = null; + } + + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventMarker.java new file mode 100644 index 0000000000..2d6a1532ea --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventMarker.java @@ -0,0 +1,88 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.push; + +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XMarkerClickListener; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; +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.V2XPushMessageEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.common.enums.EventTypeEnum; +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 { + // 清除道路事件 + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + v2xMarker.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); + + if (v2xMarker != null) { + v2xMarker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), + v2XRoadEventEntity, + V2XMarkerClickListener.getInstance()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearPOI() { + // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.loseLockMode(); + } + // 移除线 + IMoGoV2XPolylineManager v2xPolyline = BridgeApi.INSTANCE.v2xPolyline(); + if (v2xPolyline != null) { + v2xPolyline.clearLine(); + } + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + // 移除事件POI + v2xMarker.clearAlarmPOI(); + // 绘制上次的数据 + v2xMarker.drawableLastAllPOI(); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventScenario.java new file mode 100644 index 0000000000..b869242fe2 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventScenario.java @@ -0,0 +1,163 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.push; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.network.utils.GsonUtil; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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)); + + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (!isSameScenario(v2XMessageEntity) + && 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)); + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setPushWindowShow(TAG, true); + } + } + } + + @Override + public void closeWindow() { + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setPushPOIShow(TAG, true); + } + } + } + + @Override + public void clearPOI() { + if (getV2XMarker() != null) { + getV2XMarker().clearPOI(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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 开始"); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setPushWindowShow(TAG, false); + } + // 重置场景提示的消息 + setV2XMessageEntity(null); + clearPOI(); + } + //////////////////////////////////////////////////////////////////////////////////////////////////// + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventWindow.java new file mode 100644 index 0000000000..1c1eaa2ac8 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/push/V2XPushEventWindow.java @@ -0,0 +1,209 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.push; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.voice.V2XVoiceManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +import java.util.ArrayList; +import java.util.List; + +/** + * 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(BridgeApi.INSTANCE.context(), 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; + } + + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventButton.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventButton.java new file mode 100644 index 0000000000..6785a9ddc6 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventButton.java @@ -0,0 +1,78 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; + +import android.content.Intent; +import android.view.View; +import android.widget.TextView; + +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.scenario.view.IV2XButton; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButtonListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.module.v2x.voice.V2XVoiceManager; +import com.mogo.service.entrance.ButtonIndex; +import com.mogo.service.entrance.IMogoEntranceButtonController; + +/** + * 道路实况按钮 + */ +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(); + IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton(); + tv = entranceButton != null ? entranceButton.getButton(ButtonIndex.BUTTON1) : null; + if (tv != null){ + 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java new file mode 100644 index 0000000000..8cec39cc26 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java @@ -0,0 +1,51 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; + +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; +import com.mogo.map.uicontroller.IMogoMapUIController; +import com.mogo.module.common.entity.V2XRoadEventEntity; + +/** + * 道路V2X事件的Marker + */ +public class V2XRoadEventMarker implements IV2XMarker { + @Override + public void drawPOI(V2XRoadEventEntity entity) { + try { + // 清除道路事件 + IMoGoV2XMarkerManager marker = BridgeApi.INSTANCE.v2xMarker(); + if (marker != null) { + marker.clearALLPOI(); + + if (entity != null) { + marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearPOI() { + // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.loseLockMode(); + } + // 移除线 + IMoGoV2XPolylineManager polyLineManager = BridgeApi.INSTANCE.v2xPolyline(); + if (polyLineManager != null) { + polyLineManager.clearLine(); + } + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + // 移除事件POI + v2xMarker.clearALLPOI(); + // 绘制上次的数据 + v2xMarker.drawableLastAllPOI(); + } + } +} 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 new file mode 100644 index 0000000000..c294124b8c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -0,0 +1,253 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; + +import android.view.View; +import android.view.ViewGroup; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XRoadLiveCarScenario; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils; +import com.mogo.eagle.core.network.utils.GsonUtil; +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.service.analytics.IMogoAnalytics; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +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( + BridgeApi.INSTANCE.context(), + getV2XMessageEntity().getContent()); + } + + + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + + boolean isMainPageOnResume = false; + + if (statusManager != null && statusManager.isMainPageOnResume()) { + isMainPageOnResume = true; + showWindow(); + } + + + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics != null) { + // 地图主动推送/触发消息 埋点 + String poiType = getV2XMessageEntity().getContent().getPoiType(); + String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat()); + String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon()); + String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId(); + String style = 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); + analytics.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) { + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeSubView(v2XWindow.getView()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + // 关闭之前的事件弹窗 + boolean isShowEventWindow = false; + IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus(); + if (statusManager != null) { + isShowEventWindow = statusManager.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)); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + } + if (statusManager != null) { + statusManager.setRoadEventWindowShow(TAG, true); + } + } + + + } + + @Override + public void closeWindow() { + if (getV2XWindow() != null) { + getV2XWindow().close(); + } + IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus(); + if (statusManager != null) { + statusManager.setRoadEventWindowShow(TAG, false); + } + } + + @Override + public void showButton() { + if (getV2XButton() != null) { + getV2XButton().setOnActionListener(this::showWindow); + getV2XButton().show(); + IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus(); + if (statusManager != null) { + statusManager.setRoadEventButtonShow(TAG, true); + } + } + } + + @Override + public void closeButton() { + if (getV2XButton() != null) { + getV2XButton().close(); + } + IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus(); + if (statusManager != null) { + statusManager.setRoadEventButtonShow(TAG, false); + } + } + + @Override + public void drawPOI() { + if (getV2XMarker() != null) { + // 重置告警信息 + V2XStatusManager.getInstance().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 动画结束"); + + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + boolean isMainPageOnResume = false; + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (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 开始"); + IMoGoV2XStatusManager status = BridgeApi.INSTANCE.v2xStatus(); + if (status != null) { + status.setRoadEventWindowShow(TAG, false); + } + // 重置场景提示的消息 + setV2XMessageEntity(null); + clearPOI(); + closeButton(); + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventWindow.java new file mode 100644 index 0000000000..6c1ce19762 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventWindow.java @@ -0,0 +1,312 @@ +package com.mogo.eagle.core.function.v2x.events.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.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XLiveCarRes; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback; +import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoicePagingListener; +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.voice.V2XVoiceManager; +import com.mogo.service.windowview.IMogoTopViewManager; + +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(BridgeApi.INSTANCE.context(), 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(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().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); + } + // 获取道路事件周边的直播车机 + V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel(); + if (v2XRefreshModel != null) { + v2XRefreshModel + .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; + } + + //移除窗体 + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadVideoCarScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadVideoCarScenario.java new file mode 100644 index 0000000000..0708aae536 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadVideoCarScenario.java @@ -0,0 +1,151 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; + +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; + +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.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +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) { + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + + getV2XWindow().show(getV2XMessageEntity().getContent()); + ViewGroup.LayoutParams layoutParams = + new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + (int) Utils.getApp().getResources() + .getDimension(isVrMode ? R.dimen.dp_394:R.dimen.v2x_video_window_height)); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setV2XAnimationWindowShow(TAG, true); + } + } + } + + @Override + public void closeWindow() { + if (getV2XWindow() != null) { + getV2XWindow().close(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadVideoWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadVideoWindow.java new file mode 100644 index 0000000000..08139f38d0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadVideoWindow.java @@ -0,0 +1,298 @@ +package com.mogo.eagle.core.function.v2x.events.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 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.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +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.view.SimpleCoverVideoPlayer; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +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(BridgeApi.INSTANCE.context(), 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) { + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + LayoutInflater.from(mContext).inflate(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(); + //移除窗体 + IMogoTopViewManager iMogoTopViewManager = BridgeApi.INSTANCE.topViewManager(); + if (iMogoTopViewManager != null) { + iMogoTopViewManager.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/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 new file mode 100644 index 0000000000..722e721642 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventMarker.java @@ -0,0 +1,59 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.route; + +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 + * 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 { + // 清除道路事件 + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + v2xMarker.clearALLPOI(); + } + // 绘制引导线 + V2XOptimalRouteObserver.getInstance() + .setPolylinePoint(entity.getGd_locus_list()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearPOI() { + // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + mapUiController.loseLockMode(); + } + // 移除线 + clearLine(); + // 绘制上次的数据 + IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker(); + if (v2xMarker != null) { + v2xMarker.drawableLastAllPOI(); + } + } + + public void clearLine() { + V2XOptimalRouteObserver.getInstance().setPolylinePoint(null); + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java new file mode 100644 index 0000000000..a6b10b9a75 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java @@ -0,0 +1,166 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.route; + +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.network.utils.GsonUtil; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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)); + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (!isSameScenario(v2XMessageEntity) + && isMainPageOnResume) { + 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)); + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setPushWindowShow(TAG, true); + } + } + } + + @Override + public void closeWindow() { + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setPushPOIShow(TAG, true); + } + } + } + + @Override + public void clearPOI() { + if (getV2XMarker() != null) { + getV2XMarker().clearPOI(); + } + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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 开始"); + + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setPushWindowShow(TAG, false); + } + // 重置场景提示的消息 + setV2XMessageEntity(null); + clearPOI(); + } + //////////////////////////////////////////////////////////////////////////////////////////////////// + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventWindow.java new file mode 100644 index 0000000000..94152ce410 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventWindow.java @@ -0,0 +1,111 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.route; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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(BridgeApi.INSTANCE.context()); + } + + public V2XOptimalRouteVREventWindow(Context context) { + this(context, null); + } + + public V2XOptimalRouteVREventWindow(Context context, AttributeSet attrs) { + this(context, attrs, 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; + } + + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/seek/V2XSeekHelpScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/seek/V2XSeekHelpScenario.java new file mode 100644 index 0000000000..94ef8dc38a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/seek/V2XSeekHelpScenario.java @@ -0,0 +1,206 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.seek; + +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; + +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.entity.net.V2XSpecialCarRes; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils; +import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; +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.V2XPushMessageEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.common.enums.EventTypeEnum; +import com.mogo.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +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(BridgeApi.INSTANCE.context(), eventEntity); + + mMarkerEntity = getV2XMessageEntity().getContent(); + + V2XSpecialCarRes.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); + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + boolean isOtherSeekHelpWindowShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow(); + } + if (isMainPageOnResume) { + if (getV2XMessageEntity() != null && + !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)); + + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + getV2XWindow().show(mV2XPushMessageEntity); + } + } + + @Override + public void closeWindow() { + + boolean isOtherSeekHelpWindowShow = false; + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow(); + } + if (isOtherSeekHelpWindowShow) { + //Logger.d(MODULE_NAME, "关闭求助车辆的Window!"); + v2xStatus.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 动画结束"); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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 开始"); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setOtherSeekHelpWindowShow(TAG, false); + } + // 重置场景提示的消息 + setV2XMessageEntity(null); + clearPOI(); + } + + /** + * 存储本地数据 + * + * @param messageEntity 要存储的场景 + */ + private void saveLocalStory(int scenarioType, V2XPushMessageEntity messageEntity) { + ThreadUtils.getIoPool().execute(() -> { + try { + V2XSQLiteUtils.saveLocalStory(scenarioType, messageEntity, messageEntity.hashCode()); + } 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/scenario/scene/seek/V2XSeekHelpWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/seek/V2XSeekHelpWindow.java new file mode 100644 index 0000000000..869d6fa554 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/seek/V2XSeekHelpWindow.java @@ -0,0 +1,156 @@ +package com.mogo.eagle.core.function.v2x.events.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.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.PagerSnapHelper; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.service.windowview.IMogoTopViewManager; + +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 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(BridgeApi.INSTANCE.context(), 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; + } + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/ugc/V2XEventUgcScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/ugc/V2XEventUgcScenario.java new file mode 100644 index 0000000000..e011fe822e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/ugc/V2XEventUgcScenario.java @@ -0,0 +1,131 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc; + +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; + +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.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.service.windowview.IMogoTopViewStatusListener; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * 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) { + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + boolean isMainOnPageOnResume = false; + if (statusManager != null) { + isMainOnPageOnResume = statusManager.isMainPageOnResume(); + } + if (v2XMessageEntity.isShowState() + && isMainOnPageOnResume) { + 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)); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.addView(getV2XWindow().getView(), layoutParams, this); + } + getV2XWindow().show(getV2XMessageEntity().getContent()); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.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); + IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus(); + if (v2xStatus != null) { + v2xStatus.setFatigueDrivingWindowShow(TAG, false); + } + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/ugc/V2XEventUgcWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/ugc/V2XEventUgcWindow.java new file mode 100644 index 0000000000..5efa961028 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/ugc/V2XEventUgcWindow.java @@ -0,0 +1,166 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.PagerSnapHelper; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow; +import com.mogo.module.common.entity.V2XEventShowEntity; +import com.mogo.module.common.entity.V2XMessageEntity; +import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.service.windowview.IMogoTopViewManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +import java.util.ArrayList; +import java.util.List; + + +/** + * 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(BridgeApi.INSTANCE.context(), 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; + } + + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/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 new file mode 100644 index 0000000000..40977b9b87 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -0,0 +1,140 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning; + +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; + +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.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; +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.service.statusmanager.IMogoStatusManager; +import com.mogo.service.windowview.IMogoTopViewManager; +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) { + boolean isMainPageOnResume = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isMainPageOnResume = statusManager.isMainPageOnResume(); + } + if (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)); + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.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/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 new file mode 100644 index 0000000000..835587d01e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningMarker.java @@ -0,0 +1,471 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning; + +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.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; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoStopPolylineManager; +import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager; +import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; +import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler; +import com.mogo.eagle.core.utilcode.util.UiThreadHandler; +import com.mogo.map.marker.IMogoMarkerManager; +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 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(); + MogoLocation location = BridgeApi.INSTANCE.getLocation().get(); + if (location == null) { + return; + } + bearing = location.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 { + } + //二轮车和行人的渲染和移动 + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.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())); + + } 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)); + 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"); + 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); + stopPolyLineMnager.drawStopPolyline(BridgeApi.INSTANCE.context(), 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)); + //清除识别物到碰撞点预警线 + IMoGoPersonWarnPolylineManager personStopPolyLineManager = BridgeApi.INSTANCE.v2xPersonWarnPolyline(); + if (personStopPolyLineManager != null) { + personStopPolyLineManager.clearLine(); + } + //清除车前方第一条预警线 + IMoGoWarnPolylineManager warnPolyLineManager = BridgeApi.INSTANCE.v2xWarnPolyline(); + if (warnPolyLineManager != null) { + warnPolyLineManager.clearLine(); + } + //清除停止线 + IMoGoStopPolylineManager stopPolyLineManager = BridgeApi.INSTANCE.v2xStopPolyline(); + if (stopPolyLineManager != null) { + stopPolyLineManager.clearLine(); + } + + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + //清除小箭头 + marker.removeMarkers(WARNING_ARROWS); + //清除停止线 + marker.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) { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.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) { + IMoGoWarnPolylineManager warnPolyLineManager = BridgeApi.INSTANCE.v2xWarnPolyline(); + if (warnPolyLineManager == null) { + return; + } + IMogoPolyline mogoPolyline = warnPolyLineManager.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); + } + warnPolyLineManager.drawWarnPolyline(BridgeApi.INSTANCE.context(), 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"); + IMoGoPersonWarnPolylineManager personWarnPolylineManager = BridgeApi.INSTANCE.v2xPersonWarnPolyline(); + if (personWarnPolylineManager == null) { + return; + } + IMogoPolyline polyLine = personWarnPolylineManager.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); + personWarnPolylineManager.drawPersonWarnPolyline(BridgeApi.INSTANCE.context(), 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() { + IMogoMarkerManager marker = BridgeApi.INSTANCE.marker(); + if (marker != null) { + marker.removeMarkers(V2X_FRONT_WARNING_MARKER); + } + } + + public void clearLine() { + IMoGoWarnPolylineManager warnPolylineManager = BridgeApi.INSTANCE.v2xWarnPolyline(); + if (warnPolylineManager != null) { + warnPolylineManager.clearLine(); + } + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningWindow.java new file mode 100644 index 0000000000..9a4356e459 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XWarningWindow.java @@ -0,0 +1,135 @@ +package com.mogo.eagle.core.function.v2x.events.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener; +import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow; +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.V2XWarningEntity; +import com.mogo.service.windowview.IMogoTopViewManager; + +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(BridgeApi.INSTANCE.context(), 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; + } + //移除窗体 + IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager(); + if (topViewManager != null) { + topViewManager.removeView(this); + } + } + +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XButton.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XButton.java new file mode 100644 index 0000000000..aadb570394 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XButton.java @@ -0,0 +1,38 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XButtonListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XButtonListener.java new file mode 100644 index 0000000000..d6b99335d6 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XButtonListener.java @@ -0,0 +1,22 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XMarker.java new file mode 100644 index 0000000000..5540ad2f79 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XMarker.java @@ -0,0 +1,16 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XWindow.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XWindow.java new file mode 100644 index 0000000000..afcb13eae2 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/view/IV2XWindow.java @@ -0,0 +1,45 @@ +package com.mogo.eagle.core.function.v2x.events.scenario.view; + +import android.view.View; + +import com.mogo.eagle.core.function.v2x.events.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/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 new file mode 100644 index 0000000000..0b5a854af8 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ADASUtils.java @@ -0,0 +1,79 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; + +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.function.v2x.events.consts.V2XConst; +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 + * 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 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(); + } + } + + 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ChartingUtil.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ChartingUtil.java new file mode 100644 index 0000000000..8c8d6094c0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ChartingUtil.java @@ -0,0 +1,130 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; +import com.mogo.cloud.passport.MoGoAiCloudClientConfig; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.module.common.entity.MarkerLocation; +import com.mogo.module.common.entity.MarkerUserInfo; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.zhidao.carchattingprovider.CallChattingProviderConstant; +import com.zhidao.carchattingprovider.ICallChatResponse; +import com.zhidao.carchattingprovider.ICarsChattingProvider; +import org.jetbrains.annotations.Nullable; +import java.util.HashMap; +import java.util.Map; + +/** + * 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); + ICarsChattingProvider iCarsChattingProvider = BridgeApi.INSTANCE.carChatProvider(); + if ( iCarsChattingProvider != null ) { + iCarsChattingProvider.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("", "不是我的分享"); + } + ICarsChattingProvider iCarsChattingProvider = BridgeApi.INSTANCE.carChatProvider(); + if (iCarsChattingProvider != null) { + iCarsChattingProvider.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 { + ICarsChattingProvider iCarsChattingProvider = BridgeApi.INSTANCE.carChatProvider(); + if (iCarsChattingProvider != null) { + iCarsChattingProvider.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/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 new file mode 100644 index 0000000000..008c6a0d64 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/DrivingDirectionUtils.java @@ -0,0 +1,121 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt new file mode 100644 index 0000000000..0801ac79b7 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt @@ -0,0 +1,54 @@ +package com.mogo.eagle.core.function.v2x.events.utils + +import com.mogo.module.common.entity.MarkerExploreWay +import com.mogo.module.common.entity.MarkerLocation +import com.mogo.module.common.entity.MarkerUserInfo +import com.mogo.v2x.data.MarkerExploreWayItem +import com.mogo.v2x.data.V2XMarkerExploreWay +import com.mogo.v2x.data.V2XMarkerLocation +import com.mogo.v2x.data.V2XMarkerUserInfo + + +fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? = if (this == null) null else MarkerLocation().also { + it.lon = this.lon + it.lat = this.lat + it.address = this.address + it.angle = this.angle +} + +fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.module.common.entity.MarkerExploreWayItem? = if (this == null) null else com.mogo.module.common.entity.MarkerExploreWayItem().also { + it.illegalCount = this.illegalCount + it.content = this.content + it.url = this.url + it.thumbnail = this.thumbnail +} + +fun V2XMarkerUserInfo?.toMarkerUserInfo(): MarkerUserInfo? = if (this == null) null else MarkerUserInfo().also { + it.safeLabelType = this.safeLabelType + it.safeLabel = this.safeLabel + it.lastActiveweekAvgscore = this.lastActiveweekAvgscore + it.gender = this.gender + it.userHead = this.userHead + it.userName = this.userName + it.setAge(this.age) +} + +fun V2XMarkerExploreWay.toMarkExploreWay(): MarkerExploreWay = MarkerExploreWay().also { + it.items = this.items?.map { itx -> itx.toMarkerExploreWayItem() } + it.userInfo = this.userInfo?.toMarkerUserInfo() + it.distance = this.distance + it.cityName = this.cityName + it.setGenerateTime(this.generateTime) + it.infoId = this.infoId + it.setFileType(this.fileType) + it.setDirection(this.direction) + it.location = this.location?.toMarkerLocation() + it.sn = this.sn + it.canLive = this.canLive != "0" + it.poiType = this.poiType + it.type = this.type + it.infoCheckNode = this.infoCheckNode + it.isFabulous = this.isFabulous + it.uploadType = this.uploadType + it.isCanLive = this.canLive != "0" +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java new file mode 100644 index 0000000000..5e7652688d --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/FatigueDrivingUtils.java @@ -0,0 +1,85 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import android.text.TextUtils; + +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; +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 + * 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/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 new file mode 100644 index 0000000000..d018faf0f1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/LocationUtils.java @@ -0,0 +1,82 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import android.location.Location; +import android.util.Log; + +import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.map.location.IMogoLocationClient; +import com.mogo.map.navi.IMogoNavi; +import com.mogo.map.uicontroller.IMogoMapUIController; + +/** + * 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"; + + /** + * 获取当前位置 + * + * @return 当前位置 + */ + public static MogoLatLng getCurrentLatLon() { + IMogoNavi navi = BridgeApi.INSTANCE.navi(); + MogoLatLng latLon = null; + if (navi != null) { + latLon = navi.getCarLocation(); + if (latLon == null) { + Location location = navi.getCarLocation2(); + if (location != null) { + latLon = new MogoLatLng(location.getLatitude(), location.getLongitude()); + } + } + } + if (latLon == null) { + IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient(); + if (locationClient != null) { + MogoLocation location = locationClient.getLastKnowLocation(); + if (location != null) { + latLon = new MogoLatLng(location.getLatitude(), location.getLongitude()); + } + } + } + if (latLon == null) { + IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController(); + if (mapUiController != null) { + latLon = mapUiController.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/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 new file mode 100644 index 0000000000..070bce59f9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/MapUtils.kt @@ -0,0 +1,54 @@ +package com.mogo.eagle.core.function.v2x.events.utils + +import android.content.Context +import android.graphics.Rect +import com.mogo.eagle.core.data.map.MogoLatLng +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi +import com.mogo.eagle.core.utilcode.util.WindowUtils +import com.mogo.module.common.utils.CarSeries +import java.lang.Exception + +class MapUtils { + + companion object { + + @JvmStatic + fun zoomMap(latLng: MogoLatLng?, context: Context) { + try { + if (latLng == null) { + return + } + // 当前车辆位置 + val navi = BridgeApi.navi() ?: return + //Logger.d(V2XConst.MODULE_NAME, "重新调整地图缩放比:" + latLng); + val mBoundRect = Rect() + val paddingTop: Int + val paddingBottom: Int + val paddingRight: Int + val paddingLeft: Int + if (CarSeries.isF8xxSeries()) { + paddingTop = WindowUtils.dip2px(context, 250f) + paddingBottom = WindowUtils.dip2px(context, 100f) + paddingRight = WindowUtils.dip2px(context, 100f) + paddingLeft = WindowUtils.dip2px(context, 475f) + } else { + paddingTop = WindowUtils.dip2px(context, 370f) + paddingBottom = WindowUtils.dip2px(context, 100f) + paddingRight = WindowUtils.dip2px(context, 100f) + paddingLeft = WindowUtils.dip2px(context, 575f) + } + mBoundRect.bottom = paddingBottom + mBoundRect.top = paddingTop + mBoundRect.left = paddingLeft + mBoundRect.right = paddingRight + val carLocation = navi.carLocation + // 调整自适应的地图镜头 + carLocation?.let { + BridgeApi.mapUiController()?.showBounds("MapUtils", it, listOf(latLng), mBoundRect, true) + } + } catch (e: Exception) { + e.printStackTrace() + } + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java new file mode 100644 index 0000000000..7f43127e4d --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/RoadConditionUtils.java @@ -0,0 +1,40 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import com.mogo.commons.voice.AIAssist; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; +import com.mogo.eagle.core.utilcode.util.Utils; + +/** + * 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(); + BridgeApi.INSTANCE.refreshModel() + .addPoiInfoFabulous( + null, + infoId, + poiType, + likeOrDislike); + } + + /** + * 显示Toast + */ + private static void showTip() { + AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已反馈", null); + TipToast.tip("已反馈"); + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java new file mode 100644 index 0000000000..279fac491a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/TrackUtils.java @@ -0,0 +1,109 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; +import com.mogo.service.analytics.IMogoAnalytics; +import java.util.HashMap; +import java.util.Map; + +/** + * 统计埋点工具 + */ +public class TrackUtils { + + //埋点 + public static void trackV2xRoadShow(String dbid, String type, String style) { + try { + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics == null) { + return; + } + Map properties = new HashMap<>(); + properties.put("dbid", dbid); + properties.put("type", type); + properties.put("lng", V2XStatusManager.getInstance().getLocation().getLongitude()); + properties.put("lat", V2XStatusManager.getInstance().getLocation().getLatitude()); + properties.put("style", style); + analytics.track(V2XConst.V2X_ROAD_SHOW, properties); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //道路事件操作埋点 v2x_road_event + public static void trackV2xRoadEvent(String dbid, String sn, String type) { + try { + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics == null) { + return; + } + Map properties = new HashMap<>(); + properties.put("dbid", dbid); + properties.put("sn", sn); + properties.put("type", type); + analytics.track(V2XConst.V2X_ROAD_EVET, properties); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * @param type type=1 短距离角度匹配 + * type=2 历史轨迹匹配 + */ + public static void trackV2xRoadProduceEvent(int type) { + try { + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics == null) { + return; + } + Map properties = new HashMap<>(); + properties.put("type", type); + analytics.track(V2XConst.V2X_ROAD_PRODUCE, properties); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void trackV2XMarkerClick(int type) { + try { + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics == null) { + return; + } + Map properties = new HashMap<>(); + properties.put("type", type); + analytics.track(V2XConst.LAUNCHER_ICON_CLICK, properties); + } 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 { + IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics(); + if (analytics == null) { + return; + } + Map properties = new HashMap<>(); + properties.put("type", type); + analytics.track(V2XConst.V2X_ROAD_EVET_HISTORY_BUTTON, properties); + } 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/utils/V2XSQLiteUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XSQLiteUtils.java new file mode 100644 index 0000000000..84d960e84c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XSQLiteUtils.java @@ -0,0 +1,186 @@ +package com.mogo.eagle.core.function.v2x.events.utils; + +import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; +import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment; +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.utils.sqlite.SQLDaoFactory; + +import java.util.List; + +/** + * 数据库操作工具类 + * + * @author donghongyu + */ +public class V2XSQLiteUtils { + + /** + * 场景数据管理 + */ + private static SQLIDao mScenarioHistoryDao; + + /** + * 点赞数据管理 + */ + private static SQLIDao mV2XEventZanDao; + + /** + * 点赞数据管理 + */ + public static SQLIDao getV2XEventZanDao() { + if (mV2XEventZanDao == null) { + synchronized (V2XSQLiteUtils.class) { + if (mV2XEventZanDao == null) { + mV2XEventZanDao = SQLDaoFactory.Companion.getInstance() + .getBaseDao(Utils.getApp(), V2XEventZanData.class); + } + } + } + return mV2XEventZanDao; + } + + /** + * 存储本地数据 + * + * @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()); + } + + /** + * 修改指定的数据 + */ + 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 SQLIDao getScenarioHistoryDao() { + if (mScenarioHistoryDao == null) { + synchronized (V2XSQLiteUtils.class) { + if (mScenarioHistoryDao == null) { + mScenarioHistoryDao = SQLDaoFactory.Companion.getInstance() + .getBaseDao(Utils.getApp(), V2XHistoryScenarioData.class); + } + } + } + return mScenarioHistoryDao; + } + + /** + * 查询当天的V2X数据 + */ + public static List getScenarioHistoryData() { + return getScenarioHistoryDao().query(new V2XHistoryScenarioData(), "triggerTime", true); + } + + /** + * 删除数据库中存储的昨天的数据 + */ + 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(); + } + } + + /** + * 存储本地数据,每个数据只能存在一次,所以存储之前先查询数据库如果已经存在则修改触碰时间 + * + * @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(); + } + } + + /** + * 查询当天的指定的V2X数据 + */ + public static List getTargetScenarioHistoryData(V2XHistoryScenarioData scenarioData) { + return getScenarioHistoryDao().query(scenarioData, "triggerTime", true); + } +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java new file mode 100644 index 0000000000..5f9af48ce1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/V2XUtils.java @@ -0,0 +1,48 @@ +package com.mogo.eagle.core.function.v2x.events.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 { + + // 两次点击间隔不能少于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 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; + } + } + +} 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 new file mode 100644 index 0000000000..3b6a572a22 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/CarZegoLiveVideoView.java @@ -0,0 +1,188 @@ +package com.mogo.eagle.core.function.v2x.events.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.data.map.MogoLocation; +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; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +import com.mogo.eagle.core.utilcode.util.Utils; +import com.mogo.eagle.core.widget.RoundLayout; +import com.mogo.map.location.IMogoLocationClient; +import com.mogo.module.v2x.voice.V2XVoiceManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; + +/** + * @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(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) { + IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient(); + MogoLocation mogoLocation = null; + if (locationClient != null) { + mogoLocation = locationClient.getLastKnowLocation(); + } + + if (mogoLocation != null) { + 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/HeartLikeView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/HeartLikeView.java new file mode 100644 index 0000000000..d9e1775efd --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/HeartLikeView.java @@ -0,0 +1,117 @@ +package com.mogo.eagle.core.function.v2x.events.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.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.service.statusmanager.IMogoStatusManager; + + +/** + * 红心点赞按钮控件 + * + * @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 isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + + 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, isVrMode ? R.layout.view_heart_like_vr : R.layout.view_heart_like, this); + mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike); + } + + boolean finalIsVrMode = isVrMode; + setOnClickListener(v -> { + if (!isAnimator) { + isAnimator = true; + if (mAnimatorSet == null) { + mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(), + finalIsVrMode ? R.animator.v2x_like_heart_animation_vr : R.animator.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); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/HeartUnLikeView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/HeartUnLikeView.java new file mode 100644 index 0000000000..b050310a98 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/HeartUnLikeView.java @@ -0,0 +1,117 @@ +package com.mogo.eagle.core.function.v2x.events.view; + +import android.animation.Animator; +import android.animation.AnimatorInflater; +import android.animation.AnimatorSet; +import android.content.Context; +import android.util.AttributeSet; +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.eagle.core.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; +import com.mogo.service.statusmanager.IMogoStatusManager; + + +/** + * 不喜欢按钮控件 + * + * @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); + + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + inflate(context, isVrMode ? R.layout.view_heart_unlike_vr : R.layout.view_heart_unlike, this); + mIllegalParkingUnLike = findViewById(R.id.ivIllegalParkingUnLike); + animationImageView = findViewById(R.id.animationImage); + boolean finalIsVrMode = isVrMode; + setOnClickListener(v -> { + if (!isAnimator) { + isAnimator = true; + + if (mAnimatorSet == null) { + mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(), + finalIsVrMode ? + R.animator.v2x_unlike_heart_animation_vr : R.animator.v2x_unlike_heart_animation); + mAnimatorSet.setTarget(mIllegalParkingUnLike); + mAnimatorSet.addListener(this); + } + mAnimatorSet.start(); + } + if (finalIsVrMode) { + 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); + } + boolean isVrMode = false; + IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager(); + if (statusManager != null) { + isVrMode = statusManager.isVrMode(); + } + if (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/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 new file mode 100644 index 0000000000..d337887b5e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/SimpleCoverVideoPlayer.kt @@ -0,0 +1,225 @@ +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.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 +import com.shuyu.gsyvideoplayer.video.base.GSYVideoView +import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge +import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.statusManager +import com.mogo.service.statusmanager.IMogoStatusManager + + +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 { + var isVrMode = false + val statusManager: IMogoStatusManager? = statusManager() + if (statusManager != null) { + isVrMode = statusManager.isVrMode + } + if (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/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 new file mode 100644 index 0000000000..a58b34b138 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XCrossRoadVideoView.java @@ -0,0 +1,269 @@ +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.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; +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.data.map.MogoLocation; +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; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.map.location.IMogoLocationClient; +import com.mogo.module.common.entity.MarkerCarInfo; +import com.mogo.module.v2x.voice.V2XVoiceManager; +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; +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; + +/** + * 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 { + IMogoLocationClient iMogoLocationClient = BridgeApi.INSTANCE.locationClient(); + if (iMogoLocationClient != null) { + MogoLocation mogoLocation = iMogoLocationClient.getLastKnowLocation(); + if (mogoLocation == null) { + return; + } + 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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XEventPanelHistoryCountView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XEventPanelHistoryCountView.java new file mode 100644 index 0000000000..6d7a14cb53 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XEventPanelHistoryCountView.java @@ -0,0 +1,57 @@ +package com.mogo.eagle.core.function.v2x.events.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +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.eagle.core.function.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XListEmptyView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XListEmptyView.java new file mode 100644 index 0000000000..066ffc9ee6 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XListEmptyView.java @@ -0,0 +1,96 @@ +package com.mogo.eagle.core.function.v2x.events.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import com.mogo.eagle.core.function.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/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 new file mode 100644 index 0000000000..84ff7ea605 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XLiveGSYVideoView.java @@ -0,0 +1,231 @@ +package com.mogo.eagle.core.function.v2x.events.view; + +import static com.mogo.eagle.core.function.v2x.events.consts.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.function.v2x.R; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener; +import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants; +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.module.v2x.voice.V2XVoiceManager; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceCallbackListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceCallbackListener.java new file mode 100644 index 0000000000..e687c11259 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceCallbackListener.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceConstants.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceConstants.java new file mode 100644 index 0000000000..b4c1add269 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceConstants.java @@ -0,0 +1,347 @@ +package com.mogo.eagle.core.function.v2x.events.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/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 new file mode 100644 index 0000000000..8309b11e46 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoiceManager.kt @@ -0,0 +1,190 @@ +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.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.service.module.IMogoActionListener +import com.mogo.service.module.MogoAction +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import java.lang.ref.WeakReference +import java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.v2x.events.voice.* + +/** + * + * @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 + BridgeApi.intentManager()?.registerIntentListener(cmd, this) + } catch (e: Exception) { + e.printStackTrace() + } + return this + } + + // 反注册唤醒词 + @Synchronized + fun unRegisterWakeCmd(cmd: String): V2XVoiceManager { + try { + voiceCallbackMap.remove(cmd) + BridgeApi.intentManager()?.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 + BridgeApi.actionManager()?.registerActionListener(MODULE_NAME, this) + } catch (e: Exception) { + e.printStackTrace() + } + return this + } + + /** + * 反注册翻页回调监听 + */ + @Synchronized + fun unRegisterPagingCallback(): V2XVoiceManager { + try { + this.voicePagingListener = null + BridgeApi.actionManager()?.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoicePagingListener.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoicePagingListener.java new file mode 100644 index 0000000000..3726db9e1c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/voice/V2XVoicePagingListener.java @@ -0,0 +1,14 @@ +package com.mogo.eagle.core.function.v2x.events.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/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/widgets/SurroundingEventView.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/widgets/SurroundingEventView.java new file mode 100644 index 0000000000..afcfdf13b2 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/widgets/SurroundingEventView.java @@ -0,0 +1,16 @@ +package com.mogo.eagle.core.function.v2x.events.widgets; + +import com.mogo.commons.mvp.IView; +import com.mogo.module.common.entity.MarkerExploreWay; + +import java.util.List; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +public interface SurroundingEventView extends IView { + + void showSurroudingData(List exploreWayList); +} diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/widgets/SurroundingMarginDecoration.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/widgets/SurroundingMarginDecoration.java new file mode 100644 index 0000000000..858dcf5e51 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/widgets/SurroundingMarginDecoration.java @@ -0,0 +1,36 @@ +package com.mogo.eagle.core.function.v2x.events.widgets; + +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/core/function-impl/mogo-core-function-v2x/src/main/res/anim/v2x_unlike_heart_scale_ani_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/anim/v2x_unlike_heart_scale_ani_vr.xml new file mode 100644 index 0000000000..383effa7da --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/anim/v2x_unlike_heart_scale_ani_vr.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_like_heart_animation.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_like_heart_animation.xml new file mode 100644 index 0000000000..eb0b1e566a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_like_heart_animation.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_like_heart_animation_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_like_heart_animation_vr.xml new file mode 100644 index 0000000000..bdf486cf3f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_like_heart_animation_vr.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_unlike_heart_animation.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_unlike_heart_animation.xml new file mode 100644 index 0000000000..80c10a9a34 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_unlike_heart_animation.xml @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_unlike_heart_animation_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_unlike_heart_animation_vr.xml new file mode 100644 index 0000000000..bdf486cf3f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/animator/v2x_unlike_heart_animation_vr.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/color/radiobutton_textcolor.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/color/radiobutton_textcolor.xml new file mode 100644 index 0000000000..8c93dd733b --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/color/radiobutton_textcolor.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_ambulance.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_ambulance.png new file mode 100644 index 0000000000..05ee2cfbfd Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_ambulance.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_gray.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_gray.png new file mode 100644 index 0000000000..ed4058f51a Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_gray.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_police.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_police.png new file mode 100644 index 0000000000..5ee2ca12b0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_car_police.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_event_panel_more.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_event_panel_more.png new file mode 100644 index 0000000000..c7c8180c9c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_event_panel_more.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_like.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_like.png new file mode 100644 index 0000000000..3ce8b5d793 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_like.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_like_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_like_bg.png new file mode 100644 index 0000000000..95f8552545 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_like_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_unlike.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_unlike.png new file mode 100644 index 0000000000..2df4d5ba5d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_heart_unlike.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_illegal_parking.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_illegal_parking.png new file mode 100644 index 0000000000..a49b3d9c54 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_illegal_parking.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_live_load_error.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_live_load_error.png new file mode 100644 index 0000000000..291d9e3716 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_live_load_error.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_parking_p.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_parking_p.png new file mode 100644 index 0000000000..3d31d18906 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_parking_p.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_err.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_err.png new file mode 100644 index 0000000000..87f8917f9f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_err.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_err_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_err_press.png new file mode 100644 index 0000000000..4318fc1e86 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_err_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_true.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_true.png new file mode 100644 index 0000000000..ac0f7e84a4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_true.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_true_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_true_press.png new file mode 100644 index 0000000000..ec4559d362 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_report_true_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_share_empty.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_share_empty.png new file mode 100644 index 0000000000..2c5aece9b2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_share_empty.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_talk.png new file mode 100644 index 0000000000..3f90fd4af5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/icon_talk.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/module_v2x_shadow_bkg.9.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/module_v2x_shadow_bkg.9.png new file mode 100644 index 0000000000..e73d76936f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/module_v2x_shadow_bkg.9.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/mogo_image_blank_nor.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/mogo_image_blank_nor.png new file mode 100644 index 0000000000..893d02518c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/mogo_image_blank_nor.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live.png new file mode 100644 index 0000000000..af42121b15 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live_press.png new file mode 100644 index 0000000000..6947f5a5d4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_live_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav.png new file mode 100644 index 0000000000..a3b2b49a94 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav_press.png new file mode 100644 index 0000000000..31788252af Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_nav_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk.png new file mode 100644 index 0000000000..151904c2d9 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk_press.png new file mode 100644 index 0000000000..8da24b97ee Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_talk_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_zan.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_zan.png new file mode 100644 index 0000000000..41fd5acfaf Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_event_icon_zan.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_event_live_top.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_event_live_top.png new file mode 100644 index 0000000000..5b6b44b6d6 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_event_live_top.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_event_play.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_event_play.png new file mode 100644 index 0000000000..d5935d1fb3 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_event_play.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_help_navi.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_help_navi.png new file mode 100644 index 0000000000..146a596c25 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_help_navi.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_live_logo.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_live_logo.png new file mode 100644 index 0000000000..b964d6b4ad Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_live_logo.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png new file mode 100644 index 0000000000..bff6a53df5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_share_item_like.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_share_item_like.png new file mode 100644 index 0000000000..49b9436c57 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_share_item_like.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_share_item_unlike.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_share_item_unlike.png new file mode 100644 index 0000000000..86ddd897ca Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_share_item_unlike.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_surrounding_bottom_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_surrounding_bottom_bg.png new file mode 100644 index 0000000000..5a9ca34e56 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_surrounding_bottom_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png new file mode 100644 index 0000000000..d89535c229 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png new file mode 100644 index 0000000000..2a4abd712c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_video_pause.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_video_pause.png new file mode 100644 index 0000000000..90b401f17f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v2x_video_pause.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_1.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_1.png new file mode 100644 index 0000000000..174477c2fc Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_1.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_blue.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_blue.png new file mode 100644 index 0000000000..7ba009ab68 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_blue.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_green.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_green.png new file mode 100644 index 0000000000..0e475f3325 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_green.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_live_vedio.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_live_vedio.png new file mode 100644 index 0000000000..62e03cf85f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_live_vedio.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_red.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_red.png new file mode 100644 index 0000000000..3cb6737f6d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_marker_car_red.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_orange.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_orange.png new file mode 100644 index 0000000000..3457a850ca Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_orange.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_red.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_red.png new file mode 100644 index 0000000000..51038d26f4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_car_red.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00014.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00014.png new file mode 100644 index 0000000000..beb5a59f54 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00014.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00016.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00016.png new file mode 100644 index 0000000000..9a23c12a36 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00016.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00021.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00021.png new file mode 100644 index 0000000000..5bc6419dfe Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00021.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00022.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00022.png new file mode 100644 index 0000000000..ef392fd356 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00022.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00024.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00024.png new file mode 100644 index 0000000000..2a72efc51b Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00024.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00025.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00025.png new file mode 100644 index 0000000000..67c7798238 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00025.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00026.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00026.png new file mode 100644 index 0000000000..d5829c621c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00026.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00027.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00027.png new file mode 100644 index 0000000000..f8617cf9ca Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00027.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00028.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00028.png new file mode 100644 index 0000000000..d0ce57e557 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00028.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00029.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00029.png new file mode 100644 index 0000000000..78264c7ac8 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00029.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00030.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00030.png new file mode 100644 index 0000000000..d730bd66fa Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00030.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00031.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00031.png new file mode 100644 index 0000000000..8501a0436e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00031.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00032.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00032.png new file mode 100644 index 0000000000..5546e8c689 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00032.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00033.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00033.png new file mode 100644 index 0000000000..430bbfa6df Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00033.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00034.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00034.png new file mode 100644 index 0000000000..73acf7d907 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00034.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00035.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00035.png new file mode 100644 index 0000000000..0f28b9bfb7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00035.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00036.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00036.png new file mode 100644 index 0000000000..9b2f25f6e2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00036.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00037.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00037.png new file mode 100644 index 0000000000..f652bdb6ae Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00037.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00038.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00038.png new file mode 100644 index 0000000000..8dc68ecf6d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00038.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00039.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00039.png new file mode 100644 index 0000000000..4446b13c19 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00039.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00040.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00040.png new file mode 100644 index 0000000000..f85ee6194f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00040.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00041.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00041.png new file mode 100644 index 0000000000..47ce61dfa3 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00041.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00042.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00042.png new file mode 100644 index 0000000000..9f4f9745c0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00042.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00043.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00043.png new file mode 100644 index 0000000000..624af113ad Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00043.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00044.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00044.png new file mode 100644 index 0000000000..224a21e14c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00044.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00045.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00045.png new file mode 100644 index 0000000000..201975ff46 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00045.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00046.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00046.png new file mode 100644 index 0000000000..8423e68d87 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00046.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00047.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00047.png new file mode 100644 index 0000000000..973f2a7c95 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00047.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00048.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00048.png new file mode 100644 index 0000000000..631cb79062 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-ldpi/v_to_x_warning_circle_orange_00048.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_event_panel_more.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_event_panel_more.png new file mode 100644 index 0000000000..ab63bcf60e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_event_panel_more.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_gray_back_heart.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_gray_back_heart.png new file mode 100644 index 0000000000..119a39baa7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_gray_back_heart.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_heart_like_for_gray_back.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_heart_like_for_gray_back.png new file mode 100644 index 0000000000..f3709207db Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/icon_heart_like_for_gray_back.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/module_v2x_shadow_bkg.9.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/module_v2x_shadow_bkg.9.png new file mode 100644 index 0000000000..e73d76936f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/module_v2x_shadow_bkg.9.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_back_image.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_back_image.png new file mode 100644 index 0000000000..b1752e1069 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_back_image.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_icon_live_logo.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_icon_live_logo.png new file mode 100644 index 0000000000..e02a57044f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_icon_live_logo.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_share_item_like.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_share_item_like.png new file mode 100644 index 0000000000..49b9436c57 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_share_item_like.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_share_item_unlike.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_share_item_unlike.png new file mode 100644 index 0000000000..86ddd897ca Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_share_item_unlike.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_surrounding_bottom_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_surrounding_bottom_bg.png new file mode 100644 index 0000000000..5a9ca34e56 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_surrounding_bottom_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_video_pause.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_video_pause.png new file mode 100644 index 0000000000..90b401f17f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-mdpi/v2x_video_pause.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_ambulance.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_ambulance.png new file mode 100644 index 0000000000..1fb8c62b72 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_ambulance.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_gray.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_gray.png new file mode 100644 index 0000000000..d4266a6bc5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_gray.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_police.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_police.png new file mode 100644 index 0000000000..3407261744 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_car_police.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like.png new file mode 100644 index 0000000000..ce886a2383 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like_bg.png new file mode 100644 index 0000000000..f196b6ff8e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_like_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_unlike.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_unlike.png new file mode 100644 index 0000000000..0401ccc256 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_heart_unlike.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_illegal_parking.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_illegal_parking.png new file mode 100644 index 0000000000..7dcda74ee9 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_illegal_parking.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_live_load_error.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_live_load_error.png new file mode 100644 index 0000000000..a1da551655 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_live_load_error.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_parking_p.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_parking_p.png new file mode 100644 index 0000000000..6a642ee946 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_parking_p.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err.png new file mode 100644 index 0000000000..a4b8fbd13d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err_press.png new file mode 100644 index 0000000000..ffac947bc7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_err_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true.png new file mode 100644 index 0000000000..1614677f9f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true_press.png new file mode 100644 index 0000000000..cdad7807af Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_report_true_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png new file mode 100644 index 0000000000..89680bd182 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/icon_talk.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live.png new file mode 100644 index 0000000000..c9be5c80ae Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live_press.png new file mode 100644 index 0000000000..d03db9ccf3 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_live_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav.png new file mode 100644 index 0000000000..94f4de32d9 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav_press.png new file mode 100644 index 0000000000..e3aeed7b92 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_nav_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk.png new file mode 100644 index 0000000000..ffb73a8dbc Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk_press.png new file mode 100644 index 0000000000..db9134bd4d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_talk_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_zan.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_zan.png new file mode 100644 index 0000000000..c9db0a1ac4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_event_icon_zan.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_ahead_car_brake.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_ahead_car_brake.png new file mode 100644 index 0000000000..a6e80ec51e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_ahead_car_brake.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_car_collide_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_car_collide_warning.png new file mode 100644 index 0000000000..f5fd2de5e0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_car_collide_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_live_top.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_live_top.png new file mode 100644 index 0000000000..db5d04ce7c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_live_top.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_play.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_play.png new file mode 100644 index 0000000000..685e1a2058 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_event_play.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_help_navi.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_help_navi.png new file mode 100644 index 0000000000..0152e59bb2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_help_navi.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_live_logo.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_live_logo.png new file mode 100644 index 0000000000..dabf25dbbb Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_live_logo.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png new file mode 100644 index 0000000000..bff6a53df5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_surrounding_bottom_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_surrounding_bottom_bg.png new file mode 100644 index 0000000000..30690aeb2e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_surrounding_bottom_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png new file mode 100644 index 0000000000..d89535c229 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png new file mode 100644 index 0000000000..2a4abd712c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_video_pause.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_video_pause.png new file mode 100644 index 0000000000..cbd22bb486 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_video_pause.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_1.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_1.png new file mode 100644 index 0000000000..8ac13e867f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_1.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_blue.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_blue.png new file mode 100644 index 0000000000..a1f1c64566 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_blue.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_green.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_green.png new file mode 100644 index 0000000000..16eb35f38e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_green.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_live_vedio.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_live_vedio.png new file mode 100644 index 0000000000..3b89ecae7c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_live_vedio.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_red.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_red.png new file mode 100644 index 0000000000..cc09e40811 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_marker_car_red.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_orange.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_orange.png new file mode 100644 index 0000000000..70b3c056ea Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_orange.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_red.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_red.png new file mode 100644 index 0000000000..ed1542ea36 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-1920x1000/v_to_x_warning_car_red.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/icon_play.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/icon_play.png new file mode 100644 index 0000000000..bd17c2a12c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/icon_play.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/module_v2x_vr_close.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/module_v2x_vr_close.png new file mode 100644 index 0000000000..95a08f52f4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/module_v2x_vr_close.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_ahead_car_brake.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_ahead_car_brake.png new file mode 100644 index 0000000000..31ea64f0ea Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_ahead_car_brake.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_car_collide_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_car_collide_warning.png new file mode 100644 index 0000000000..e7709ff347 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_icon_car_collide_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_optimal_route_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_optimal_route_warning.png new file mode 100644 index 0000000000..76ae6f035a Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_optimal_route_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_car_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_car_warning.png new file mode 100644 index 0000000000..e7709ff347 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_car_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_m_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_m_warning.png new file mode 100644 index 0000000000..cc0d8a7df3 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_m_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_p_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_p_warning.png new file mode 100644 index 0000000000..f51d7f39f9 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi-2560x1440/v2x_road_front_p_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_ambulance.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_ambulance.png new file mode 100644 index 0000000000..1fb8c62b72 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_ambulance.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png new file mode 100644 index 0000000000..6244ee2b2f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_gray.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_gray.png new file mode 100644 index 0000000000..d4266a6bc5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_gray.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_police.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_police.png new file mode 100644 index 0000000000..3407261744 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_car_police.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_event_panel_more.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_event_panel_more.png new file mode 100644 index 0000000000..5d6656f2d0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_event_panel_more.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like.png new file mode 100644 index 0000000000..ce886a2383 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like_bg.png new file mode 100644 index 0000000000..f196b6ff8e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like_for_gray_back.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like_for_gray_back.png new file mode 100644 index 0000000000..728ef1d32d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_like_for_gray_back.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_unlike.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_unlike.png new file mode 100644 index 0000000000..0401ccc256 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_heart_unlike.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking.png new file mode 100644 index 0000000000..7dcda74ee9 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking_vr.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking_vr.png new file mode 100644 index 0000000000..974fc9bbd0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_illegal_parking_vr.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_live_load_error.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_live_load_error.png new file mode 100644 index 0000000000..a1da551655 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_live_load_error.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_parking_p.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_parking_p.png new file mode 100644 index 0000000000..f3f8b82f3d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_parking_p.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_play.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_play.png new file mode 100644 index 0000000000..b38e732923 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_play.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_err.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_err.png new file mode 100644 index 0000000000..a4b8fbd13d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_err.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_err_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_err_press.png new file mode 100644 index 0000000000..ffac947bc7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_err_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_true.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_true.png new file mode 100644 index 0000000000..1614677f9f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_true.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_true_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_true_press.png new file mode 100644 index 0000000000..cdad7807af Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_report_true_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_share_empty.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_share_empty.png new file mode 100644 index 0000000000..4d860aba9b Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_share_empty.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_talk.png new file mode 100644 index 0000000000..89680bd182 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/icon_talk.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_shadow_bkg.9.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_shadow_bkg.9.png new file mode 100644 index 0000000000..239b9eb114 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_shadow_bkg.9.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_suddenly_break.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_suddenly_break.png new file mode 100644 index 0000000000..fc413a6bd0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_suddenly_break.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_vr_close.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_vr_close.png new file mode 100644 index 0000000000..c7f8ef2830 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/module_v2x_vr_close.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/mogo_image_blank_nor.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/mogo_image_blank_nor.png new file mode 100644 index 0000000000..c77748e661 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/mogo_image_blank_nor.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png new file mode 100644 index 0000000000..8344ac641c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live.png new file mode 100644 index 0000000000..c9be5c80ae Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_press.png new file mode 100644 index 0000000000..d03db9ccf3 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_vr.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_vr.png new file mode 100644 index 0000000000..eb18411f9f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_live_vr.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav.png new file mode 100644 index 0000000000..94f4de32d9 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav_press.png new file mode 100644 index 0000000000..e3aeed7b92 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_nav_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk.png new file mode 100644 index 0000000000..ffb73a8dbc Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_press.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_press.png new file mode 100644 index 0000000000..db9134bd4d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_press.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_vr.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_vr.png new file mode 100644 index 0000000000..5b1a5378b1 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_talk_vr.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png new file mode 100644 index 0000000000..3b65e46367 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_zan.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_zan.png new file mode 100644 index 0000000000..c9db0a1ac4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_zan.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_ahead_car_brake.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_ahead_car_brake.png new file mode 100644 index 0000000000..a6e80ec51e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_ahead_car_brake.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_car_collide_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_car_collide_warning.png new file mode 100644 index 0000000000..f5fd2de5e0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_car_collide_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_live_top.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_live_top.png new file mode 100644 index 0000000000..db5d04ce7c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_live_top.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_play.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_play.png new file mode 100644 index 0000000000..685e1a2058 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_event_play.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_help_navi.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_help_navi.png new file mode 100644 index 0000000000..0152e59bb2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_help_navi.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_live_logo.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_live_logo.png new file mode 100644 index 0000000000..5480b6d165 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_live_logo.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_optimal_speed.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_optimal_speed.png new file mode 100644 index 0000000000..c7d9845123 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_optimal_speed.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_rush_red_light.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_rush_red_light.png new file mode 100644 index 0000000000..885d5dfeb7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_rush_red_light.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_traffic_light.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_traffic_light.png new file mode 100644 index 0000000000..81a5f5eee8 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_traffic_light.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_urgency_collision.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_urgency_collision.png new file mode 100644 index 0000000000..383e8897b1 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_obu_urgency_collision.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png new file mode 100644 index 0000000000..bff6a53df5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_unlike_animation_vr.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_unlike_animation_vr.png new file mode 100644 index 0000000000..6d0c6bcddf Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_icon_unlike_animation_vr.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_nav_normal.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_nav_normal.png new file mode 100644 index 0000000000..3d251225a2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_nav_normal.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_nav_select.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_nav_select.png new file mode 100644 index 0000000000..a9178c8f7b Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_nav_select.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_obu_green_point.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_obu_green_point.png new file mode 100644 index 0000000000..6e48b03365 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_obu_green_point.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_obu_traffic_light_pop.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_obu_traffic_light_pop.png new file mode 100644 index 0000000000..5e70e5f300 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_obu_traffic_light_pop.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_optimal_route_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_optimal_route_warning.png new file mode 100644 index 0000000000..b358c39eaf Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_optimal_route_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_car_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_car_warning.png new file mode 100644 index 0000000000..f5fd2de5e0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_car_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png new file mode 100644 index 0000000000..26ca1bb28f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png new file mode 100644 index 0000000000..20faebbdb1 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_share_item_like.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_share_item_like.png new file mode 100644 index 0000000000..3a4e93249b Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_share_item_like.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_share_item_unlike.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_share_item_unlike.png new file mode 100644 index 0000000000..d169b2e1c0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_share_item_unlike.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_stop_line.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_stop_line.png new file mode 100644 index 0000000000..2bda783ed5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_stop_line.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_surrounding_bottom_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_surrounding_bottom_bg.png new file mode 100644 index 0000000000..30690aeb2e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_surrounding_bottom_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_tip_bg.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_tip_bg.png new file mode 100644 index 0000000000..22404daa42 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_tip_bg.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png new file mode 100644 index 0000000000..d89535c229 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png new file mode 100644 index 0000000000..2a4abd712c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_video_pause.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_video_pause.png new file mode 100644 index 0000000000..cbd22bb486 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v2x_video_pause.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_event_ugc_fenglu.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_event_ugc_fenglu.png new file mode 100644 index 0000000000..b3328eba18 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_event_ugc_fenglu.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_1.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_1.png new file mode 100644 index 0000000000..8ac13e867f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_1.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_blue.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_blue.png new file mode 100644 index 0000000000..a1f1c64566 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_blue.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_green.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_green.png new file mode 100644 index 0000000000..16eb35f38e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_green.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_live_vedio.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_live_vedio.png new file mode 100644 index 0000000000..3b89ecae7c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_live_vedio.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_red.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_red.png new file mode 100644 index 0000000000..cc09e40811 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_marker_car_red.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_orange.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_orange.png new file mode 100644 index 0000000000..70b3c056ea Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_orange.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_red.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_red.png new file mode 100644 index 0000000000..ed1542ea36 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_car_red.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00011.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00012.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00013.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00014.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00015.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00016.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00017.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png new file mode 100644 index 0000000000..7a03a5972c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00018.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png new file mode 100644 index 0000000000..cd1e0c45a7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00019.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png new file mode 100644 index 0000000000..7a376915ce Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00020.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png new file mode 100644 index 0000000000..c98ac95838 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00021.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png new file mode 100644 index 0000000000..ec40533fa8 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00022.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png new file mode 100644 index 0000000000..ae901b2df2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00023.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png new file mode 100644 index 0000000000..eef4b4e0ea Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00024.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png new file mode 100644 index 0000000000..5bcd897394 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00025.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png new file mode 100644 index 0000000000..15db7cf734 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00026.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png new file mode 100644 index 0000000000..b20d6046d7 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00027.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png new file mode 100644 index 0000000000..608e8f2be1 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00028.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png new file mode 100644 index 0000000000..8d4bf7cbc2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00029.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png new file mode 100644 index 0000000000..ed13d90608 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00030.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png new file mode 100644 index 0000000000..3a06bcb678 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00031.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png new file mode 100644 index 0000000000..6c5451ca49 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00032.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png new file mode 100644 index 0000000000..09b2e8480f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00033.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png new file mode 100644 index 0000000000..2841ed3770 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00034.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png new file mode 100644 index 0000000000..18a981fdd2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00035.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png new file mode 100644 index 0000000000..cbca5fd792 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00036.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png new file mode 100644 index 0000000000..6febc135b1 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00037.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png new file mode 100644 index 0000000000..a4561c8e5e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00038.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png new file mode 100644 index 0000000000..7a94145199 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00039.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png new file mode 100644 index 0000000000..d69704044c Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00040.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png new file mode 100644 index 0000000000..971078720b Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00041.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png new file mode 100644 index 0000000000..f5c9b2c48a Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00042.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png new file mode 100644 index 0000000000..a65cf8591b Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00043.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png new file mode 100644 index 0000000000..22d424dcf0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00044.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png new file mode 100644 index 0000000000..56c66de923 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00045.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png new file mode 100644 index 0000000000..862fbc25f6 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00046.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png new file mode 100644 index 0000000000..0d8e1f1b63 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00047.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png new file mode 100644 index 0000000000..50a65c8571 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_orange_00048.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00011.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00012.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00013.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00014.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00015.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00016.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00017.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00018.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png new file mode 100644 index 0000000000..ca3d131845 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00019.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png new file mode 100644 index 0000000000..07a4f2e837 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00020.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png new file mode 100644 index 0000000000..e477715df4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00021.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png new file mode 100644 index 0000000000..eadea4fcc2 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00022.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png new file mode 100644 index 0000000000..062e7f2ab6 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00023.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png new file mode 100644 index 0000000000..9dde80c060 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00024.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png new file mode 100644 index 0000000000..69de6b84ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00025.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png new file mode 100644 index 0000000000..6b473ad63f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00026.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png new file mode 100644 index 0000000000..bbddd52ad0 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00027.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png new file mode 100644 index 0000000000..4d4764b480 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00028.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png new file mode 100644 index 0000000000..9f3b4d984e Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00029.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png new file mode 100644 index 0000000000..82562e17b5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00030.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png new file mode 100644 index 0000000000..5d1d66203a Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00031.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png new file mode 100644 index 0000000000..50abe7d551 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00032.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00033.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00033.png new file mode 100644 index 0000000000..8a003c8e3d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00033.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00034.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00034.png new file mode 100644 index 0000000000..230ee94c1d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00034.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00035.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00035.png new file mode 100644 index 0000000000..77c8249773 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00035.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00036.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00036.png new file mode 100644 index 0000000000..eb56f215d4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00036.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00037.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00037.png new file mode 100644 index 0000000000..5f2e25f715 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00037.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00038.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00038.png new file mode 100644 index 0000000000..6a5a43bb81 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00038.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00039.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00039.png new file mode 100644 index 0000000000..9e44b9cbc4 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00039.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00040.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00040.png new file mode 100644 index 0000000000..c7af54abf5 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00040.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00041.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00041.png new file mode 100644 index 0000000000..500fc225a3 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00041.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00042.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00042.png new file mode 100644 index 0000000000..b7937f9a6f Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00042.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00043.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00043.png new file mode 100644 index 0000000000..65e4b4e3f1 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00043.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00044.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00044.png new file mode 100644 index 0000000000..7f6962fd0d Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00044.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00045.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00045.png new file mode 100644 index 0000000000..42c2fd7210 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00045.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00046.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00046.png new file mode 100644 index 0000000000..37279985dc Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00046.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00047.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00047.png new file mode 100644 index 0000000000..99e775a8a6 Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00047.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00048.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00048.png new file mode 100644 index 0000000000..3cbad345ec Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable-xhdpi/v_to_x_warning_circle_red_00048.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_count_down.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_count_down.xml new file mode 100644 index 0000000000..85ecbf1d2c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_count_down.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_fatigue_driving.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_fatigue_driving.xml new file mode 100644 index 0000000000..a963da5710 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_fatigue_driving.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_bg.xml new file mode 100644 index 0000000000..b28203b717 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_description.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_description.xml new file mode 100644 index 0000000000..88fd3e48c6 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_description.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_list_item.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_list_item.xml new file mode 100644 index 0000000000..19e1828951 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_list_item.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_live_show.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_live_show.xml new file mode 100644 index 0000000000..00d8af5a9a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_live_show.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml new file mode 100644 index 0000000000..d04f7b325b --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_gray.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_gray.xml new file mode 100644 index 0000000000..f77de0dd88 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_gray.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_green.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_green.xml new file mode 100644 index 0000000000..1f055ae661 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_green.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml new file mode 100644 index 0000000000..68e4fa978f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml new file mode 100644 index 0000000000..86fe790833 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml new file mode 100644 index 0000000000..43b446e4c6 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml new file mode 100644 index 0000000000..ead9ee25ff --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml new file mode 100644 index 0000000000..3d72d093db --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_red_two_round_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_red_two_round_vr.xml new file mode 100644 index 0000000000..9181fc498d --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_red_two_round_vr.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_refresh.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_refresh.xml new file mode 100644 index 0000000000..4d7ff1b8b4 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_refresh.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_surrounding_event_list_item.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_surrounding_event_list_item.xml new file mode 100644 index 0000000000..d1f0a2354f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/bg_v2x_surrounding_event_list_item.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_live_btn.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_live_btn.xml new file mode 100644 index 0000000000..28e53ff402 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_live_btn.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_live_btn_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_live_btn_vr.xml new file mode 100644 index 0000000000..669fac1b71 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_live_btn_vr.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_nav_btn.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_nav_btn.xml new file mode 100644 index 0000000000..3bb0c35207 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_nav_btn.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_nav_history.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_nav_history.xml new file mode 100644 index 0000000000..d2fd354592 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_nav_history.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_talk_btn.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_talk_btn.xml new file mode 100644 index 0000000000..a610ade8e5 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_talk_btn.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_talk_btn_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_talk_btn_vr.xml new file mode 100644 index 0000000000..b257f9d769 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/selector_talk_btn_vr.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_alert_window_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_alert_window_bg.xml new file mode 100644 index 0000000000..5f9bc8d7d2 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_alert_window_bg.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_alert_window_live_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_alert_window_live_bg.xml new file mode 100644 index 0000000000..676812c88a --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_alert_window_live_bg.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_big_image_dark.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_big_image_dark.xml new file mode 100644 index 0000000000..318b24d43d --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_big_image_dark.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_pop_up.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_pop_up.xml new file mode 100644 index 0000000000..4f4bca8d1c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_pop_up.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_video_tip_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_video_tip_vr.xml new file mode 100644 index 0000000000..3d287b5ac1 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bg_video_tip_vr.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bkg_dark_light_same.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bkg_dark_light_same.xml new file mode 100644 index 0000000000..df4fdef366 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_bkg_dark_light_same.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_drawable_event_message_bkg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_drawable_event_message_bkg.xml new file mode 100644 index 0000000000..d4a17f0e59 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_drawable_event_message_bkg.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_front_warning_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_front_warning_bg.xml new file mode 100644 index 0000000000..54f571d1e5 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_front_warning_bg.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml new file mode 100644 index 0000000000..e71c897020 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_blue_info.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml new file mode 100644 index 0000000000..eefd1be813 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_blue_info.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_green_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_green_info.xml new file mode 100644 index 0000000000..d9d5e5dade --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_green_info.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_red_info.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_red_info.xml new file mode 100644 index 0000000000..6c70c8805c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_map_marker_driver_type_red_info.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_nav_normal.png b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_nav_normal.png new file mode 100644 index 0000000000..dad9f9ebad Binary files /dev/null and b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_nav_normal.png differ diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_panel_color_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_panel_color_bg.xml new file mode 100644 index 0000000000..8c81ded7de --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_panel_color_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_park_car_port_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_park_car_port_bg.xml new file mode 100644 index 0000000000..bbd6610cf6 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_park_car_port_bg.xml @@ -0,0 +1,10 @@ + + + + diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_park_title_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_park_title_bg.xml new file mode 100644 index 0000000000..2f56f2803e --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_park_title_bg.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_refresh_button_bg.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_refresh_button_bg.xml new file mode 100644 index 0000000000..0fcf244473 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_refresh_button_bg.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_selector_icon_report_err.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_selector_icon_report_err.xml new file mode 100644 index 0000000000..bfbafddbd0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_selector_icon_report_err.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_selector_icon_report_true.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_selector_icon_report_true.xml new file mode 100644 index 0000000000..c53b2ccb27 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_selector_icon_report_true.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shadow_shape_view.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shadow_shape_view.xml new file mode 100644 index 0000000000..2b616f3e68 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shadow_shape_view.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_bg_count_down_corner_14.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_bg_count_down_corner_14.xml new file mode 100644 index 0000000000..9f90c34357 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_bg_count_down_corner_14.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml new file mode 100644 index 0000000000..9320416f62 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_shape_reverse_triangle_blue.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_to_nav.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_to_nav.xml new file mode 100644 index 0000000000..bc3c6b0bc9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/drawable/v2x_to_nav.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/dialog_v2x_seek_help.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/dialog_v2x_seek_help.xml new file mode 100644 index 0000000000..9afcb13fb0 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/dialog_v2x_seek_help.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/footer_nomore_view.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/footer_nomore_view.xml new file mode 100644 index 0000000000..9fc434c82f --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/footer_nomore_view.xml @@ -0,0 +1,42 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml new file mode 100644 index 0000000000..a87f69c85b --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail.xml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml new file mode 100644 index 0000000000..a054e62a0c --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_share_load_more.xml b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_share_load_more.xml new file mode 100644 index 0000000000..644113fcf9 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/layout/item_v2x_event_share_load_more.xml @@ -0,0 +1,21 @@ + + + +