[V2X模块重构]代码提交
[temp code]
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
|
||||
}
|
||||
@@ -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')
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.v2x">
|
||||
|
||||
</manifest>
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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<MogoLocation>(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<V2XRoadEventEntity> = V2XMessageEntity<V2XRoadEventEntity>()
|
||||
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<VideoOptionModel>()
|
||||
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<Boolean>()
|
||||
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<V2XSeekHelpRes?> {
|
||||
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<V2XStrategyPushRes> {
|
||||
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<MogoLatLng> = 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<V2XPushMessageEntity>()
|
||||
// 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<V2XRoadEventEntity>()
|
||||
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<V2XOptimalRoute> = V2XMessageEntity<V2XOptimalRoute>() // 控制类型
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Fragment>) :
|
||||
FragmentStateAdapter(fragment) {
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -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<RecyclerView.ViewHolder> {
|
||||
|
||||
private List<V2XEventShowEntity> itemList;
|
||||
|
||||
// 当前展示条目绑定的window
|
||||
private IV2XWindow mV2XWindow;
|
||||
|
||||
public V2XRoadEventAdapter(List<V2XEventShowEntity> 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<ViewHolder> {
|
||||
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData;
|
||||
|
||||
public V2XScenarioHistoryAdapter(ArrayList<V2XHistoryScenarioData> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<RecyclerView.ViewHolder> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<V2XSurroundingViewHolder> {
|
||||
private List<SurroundingConstruction> mPoiInfosList;
|
||||
private Context mContext;
|
||||
private ImageView mBgImageView;
|
||||
private ImageView mTypeImageView;
|
||||
private TextView mTypeTv;
|
||||
private TextView mTotalTv;
|
||||
|
||||
private SurroundingItemClickListener mClickListener;
|
||||
|
||||
|
||||
public V2XSurroundingAdapter(Context context, List<SurroundingConstruction> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<V2XSurroundingDetailVH> {
|
||||
private List<MarkerExploreWay> 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<MarkerExploreWay> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<T>
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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<String, Object> 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<String, Object> 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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<T>
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XEventShowEntity>(
|
||||
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<TextView>(R.id.tvAddress)
|
||||
mIvToNav = itemView.findViewById<ImageView>(R.id.ivToNav)
|
||||
mIvClose = itemView.findViewById<ImageView>(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)
|
||||
}
|
||||
}
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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<V2XEventShowEntity> 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<List<V2XEventShowEntity>> 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<V2XUserInfoRes>() {
|
||||
@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);
|
||||
// }
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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米」是否有道路事件需要触发。
|
||||
* 疲劳驾驶:根据服务端下发的触发条件进行触发
|
||||
* <p>
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XAlarmServer {
|
||||
|
||||
// 记录道路播报的事件
|
||||
public static ConcurrentHashMap<V2XRoadEventEntity, String> mAlertRoadEventList = new ConcurrentHashMap<>();
|
||||
|
||||
// 记录违章停车播报事件
|
||||
private static final HashMap<MarkerExploreWay, String> mAlertIllegalParkEventList = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 获取车辆的前方的违章停车事件
|
||||
*/
|
||||
public static MarkerExploreWay getIllegalParkAlarmEvent(
|
||||
ArrayList<MarkerExploreWay> 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<V2XRoadEventEntity> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String> alertMessageId = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 对提醒过的道路事件进行UGC检测
|
||||
*
|
||||
* @param currentLocation 当前车辆位置
|
||||
*/
|
||||
public static void roadEventUgcCheck(MogoLocation currentLocation) {
|
||||
|
||||
try {
|
||||
if (currentLocation != null) {
|
||||
// 循环已经播报的道路事件,将刚行驶过的道路事件进行弹窗交互,进行UGC问答,
|
||||
Set<V2XRoadEventEntity> 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<V2XRoadEventEntity> 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<WeakReference<Context>>(null)
|
||||
}
|
||||
|
||||
val location by lazy {
|
||||
AtomicReference<MogoLocation>()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
}
|
||||
@@ -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<MogoLatLng> 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<MogoLatLng> getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
public void setLocations(List<MogoLatLng> locations) {
|
||||
this.locations = locations;
|
||||
}
|
||||
}
|
||||
@@ -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<MarkerOnlineCar> onlineCar;
|
||||
|
||||
public ArrayList<MarkerOnlineCar> getOnlineCar() {
|
||||
return onlineCar;
|
||||
}
|
||||
|
||||
public void setOnlineCar(ArrayList<MarkerOnlineCar> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XLiveCarInfoEntity> info;
|
||||
|
||||
public List<V2XLiveCarInfoEntity> getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(List<V2XLiveCarInfoEntity> 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 +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<MogoLatLng> locus_list;
|
||||
/**
|
||||
* 高德坐标系Gcj,线性经纬度轨迹列表
|
||||
**/
|
||||
private List<MogoLatLng> 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<MogoLatLng> getLocus_list() {
|
||||
return locus_list;
|
||||
}
|
||||
|
||||
public void setLocus_list(List<MogoLatLng> locus_list) {
|
||||
this.locus_list = locus_list;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getGd_locus_list() {
|
||||
return gd_locus_list;
|
||||
}
|
||||
|
||||
public void setGd_locus_list(List<MogoLatLng> gd_locus_list) {
|
||||
this.gd_locus_list = gd_locus_list;
|
||||
}
|
||||
}
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -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<V2XMarkerEntity> coordinates;
|
||||
|
||||
public List<V2XMarkerEntity> getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List<V2XMarkerEntity> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<LevelListBean> 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<LevelListBean> getLevelList() {
|
||||
return levelList;
|
||||
}
|
||||
|
||||
public void setLevelList(List<LevelListBean> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.entity.panel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 返回刷新
|
||||
*/
|
||||
public class BackRefreshInfo implements Serializable {
|
||||
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
@@ -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<MarkerExploreWay> 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<MarkerExploreWay> getConstrutList() {
|
||||
return construtList;
|
||||
}
|
||||
|
||||
public void addMarkerExploreWay(MarkerExploreWay item) {
|
||||
construtList.add(item);
|
||||
}
|
||||
|
||||
public String getTypeNameTTS(String type) {
|
||||
String typeName = "请查看周边的";
|
||||
typeName += EventTypeEnum.getTypeNameTTS(type);
|
||||
return typeName + "信息";
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<MarkerExploreWay> exploreWay;
|
||||
|
||||
public List<MarkerExploreWay> getExploreWay() {
|
||||
return exploreWay;
|
||||
}
|
||||
|
||||
public void setExploreWay(List<MarkerExploreWay> exploreWay) {
|
||||
this.exploreWay = exploreWay;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<ContentBean> 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<ContentBean> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(List<ContentBean> 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<Double> coordinates;
|
||||
private List<DataBean> 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<Double> getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List<Double> coordinates) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<V2XEventPanelFragment, EventPanelPresenter>(), SurroundingDetailItemListener,IMogoStatusChangedListener{
|
||||
|
||||
private val TAG = "V2XEventPanelFragment"
|
||||
|
||||
private var isFirstLoad = false
|
||||
|
||||
private var fragments: Array<Fragment>? = 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<MarkerExploreWay>()
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<V2XScenarioHistoryFragment?, ScenarioHistoryPresenter?>() {
|
||||
private val TAG = "V2XScenarioHistoryFragment"
|
||||
var fromVoice = false
|
||||
private var mV2XScenarioHistoryAdapter: V2XScenarioHistoryAdapter? = null
|
||||
private val mV2XHistoryScenarioData = ArrayList<V2XHistoryScenarioData>()
|
||||
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<V2XHistoryScenarioData>) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -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<V2XShareEventsFragment, ShareEventsPresenter> 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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<SurroundingEventView, SurroundingEventPresenter> 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<SurroundingConstruction> 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<MarkerExploreWay> 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<String, SurroundingConstruction> getPoiTypeMap(List<MarkerExploreWay> list) {
|
||||
Map<String, SurroundingConstruction> 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<SurroundingConstruction> handleMapToList(Map<String, SurroundingConstruction> map) {
|
||||
Collection<? extends SurroundingConstruction> valueCollection = map.values();
|
||||
List<SurroundingConstruction> list = new ArrayList<>(valueCollection);
|
||||
List<SurroundingConstruction> resultSurroundingList = new ArrayList<>();
|
||||
List<SurroundingConstruction> outSurroundingList = new ArrayList<>();
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
List<String> 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<String> prioritySort() {
|
||||
List<String> 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<MarkerExploreWay> 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<MarkerExploreWay> 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<MogoLatLng> getMogoList(List<MarkerExploreWay> markerExploreWayList) {
|
||||
List<MogoLatLng> 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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<V2XEventPanelFragment>(view)
|
||||
@@ -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<V2XScenarioHistoryFragment> {
|
||||
|
||||
public ScenarioHistoryPresenter(V2XScenarioHistoryFragment view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
public void loadHistory() {
|
||||
WorkThreadHandler.getInstance().post(() -> {
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
mView.loadHistory(v2XHistoryScenarioData);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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<V2XShareEventsFragment> {
|
||||
|
||||
public ShareEventsPresenter(IView view) { super((V2XShareEventsFragment) view); }
|
||||
|
||||
public void loadShareEventList() {
|
||||
WorkThreadHandler.getInstance().post(() -> {
|
||||
mView.getShareEventResponse();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<SurroundingEventView> {
|
||||
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<SurroundingResponse>(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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.listener;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
*/
|
||||
public interface AdapterCallback {
|
||||
//分享列表加载更多
|
||||
void loadMoreShareEventList();
|
||||
//分享列表首次刷新
|
||||
void getShareEventResponse();
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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<V2XRoadEventEntity> getV2XRoadEventEntityList();
|
||||
|
||||
/**
|
||||
* 从探路数据和新鲜事儿的路况信息中解析出道路事件信息
|
||||
*/
|
||||
void analysisV2XRoadEvent(V2XMarkerCardResult markerCardResult);
|
||||
|
||||
/**
|
||||
* 绘制V2X 地图点事件
|
||||
*
|
||||
* @param markerCardResult 大而全中过滤出来的点事件
|
||||
*/
|
||||
void drawableV2XMarker(MarkerCardResult markerCardResult);
|
||||
|
||||
/**
|
||||
* 绘制 在线车辆 POI
|
||||
*
|
||||
* @param markerOnlineCars
|
||||
* @param clickListener
|
||||
*/
|
||||
void drawableOnlineCarPOI(List<MarkerOnlineCar> 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<MarkerOnlineCar> markerOnlineCars, IMogoMarkerClickListener clickListener);
|
||||
|
||||
/**
|
||||
* 清除 可以直播的在线车辆 POI
|
||||
*/
|
||||
void clearLiveCarPOI();
|
||||
|
||||
/**
|
||||
* 绘制 探路
|
||||
*
|
||||
* @param exploreWayList
|
||||
* @param clickListener
|
||||
*/
|
||||
void drawableExplorePOI(List<MarkerExploreWay> exploreWayList, IMogoMarkerClickListener clickListener);
|
||||
|
||||
/**
|
||||
* 清除 探路 POI
|
||||
*/
|
||||
void clearExplorePOI();
|
||||
|
||||
/**
|
||||
* 绘制 新鲜事儿
|
||||
*
|
||||
* @param noveltyInfoList
|
||||
* @param clickListener
|
||||
*/
|
||||
void drawableNoveltyPOI(List<MarkerNoveltyInfo> 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();
|
||||
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.manager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-04
|
||||
* <p>
|
||||
* 状态描述
|
||||
*/
|
||||
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,
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<Integer> 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<MogoLatLng> 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;
|
||||
}
|
||||
}
|
||||
@@ -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<Integer> 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<MogoLatLng> 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;
|
||||
}
|
||||
}
|
||||
@@ -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<V2XRoadEventEntity> 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<V2XRoadEventEntity> getV2XRoadEventEntityList() {
|
||||
CopyOnWriteArrayList<V2XRoadEventEntity> 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<V2XMarkerExploreWay> 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<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
List<MarkerNoveltyInfo> 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<MarkerOnlineCar> 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<Bitmap> 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<MarkerOnlineCar> 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<MarkerExploreWay> 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<MarkerNoveltyInfo> 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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<Integer> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XStatusDescriptor, Boolean> mStatus = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 回调集合
|
||||
*/
|
||||
private static final Map<V2XStatusDescriptor, List<IMoGoV2XStatusChangedListener>> mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 状态类型修改记录
|
||||
*/
|
||||
private static final Map<V2XStatusDescriptor, String> 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<IMoGoV2XStatusChangedListener> listeners = mListeners.get(descriptor);
|
||||
if (listeners != null) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) {
|
||||
List<IMoGoV2XStatusChangedListener> 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<IMoGoV2XStatusChangedListener> 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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<Integer> 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<MogoLatLng> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Bitmap> getV2XRoadEventViewGif(Context context, V2XRoadEventEntity alarmInfo) {
|
||||
ArrayList<Bitmap> 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<Bitmap> getV2XRoadEventRedMarkerView(Context context, V2XRoadEventEntity alarmInfo) {
|
||||
ArrayList<Bitmap> 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<Bitmap> getV2XRoadEventOrangeMarkerView(Context context, V2XRoadEventEntity alarmInfo) {
|
||||
ArrayList<Bitmap> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
* <p>
|
||||
* 接口描述
|
||||
*/
|
||||
public interface V2XApiService {
|
||||
|
||||
/**
|
||||
* 直播点赞
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-geo-fence-carService/restrictedRules/car/liveBroadcastPraise")
|
||||
Observable<BaseData> giveLikeLiveVideo(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 同过SN获取用户信息
|
||||
*/
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/yycp-realtimeLocations/realTimeLocationServer/queryUserInfoBySn")
|
||||
Observable<V2XUserInfoRes> queryUserInfoBySn(@Body RequestBody jsonStr);
|
||||
|
||||
/**
|
||||
* 车辆故障求助查询
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-realtimeLocations/vehicleTypeManage/car/updateVehicleType/v1")
|
||||
Observable<BaseData> sendHelpSignal(@FieldMap Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 根据经纬度查询附近可直播车机直播信息
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-realtimeLocations/realTimeLocationServer/car/queryNearbyVehicleLiveByLocation/v1")
|
||||
Observable<V2XLiveCarRes> queryNearbyVehicleLiveByLocation(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
|
||||
/**
|
||||
* 点赞接口
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1")
|
||||
Observable<BaseData> addPoiInfoFabulous(@FieldMap Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 响应求助
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/RespondingToHelp/v1")
|
||||
Observable<BaseData> respondingToHelp(@FieldMap Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/poi/no/manualMarkingTrafficJam")
|
||||
Observable<BaseData> manualMarkingTrafficJam(@FieldMap Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 根据名称获取策略详情
|
||||
*/
|
||||
@GET("/yycp-strategyPush/push/strategy/item?name=TIRE_DRIVING")
|
||||
Observable<V2XStrategyPushRes> getStrategyPush();
|
||||
|
||||
/**
|
||||
* 车辆故障求助查询
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-realtimeLocations/vehicleTypeManage/car/queryVehicleType/v1")
|
||||
Observable<V2XSeekHelpRes> queryHelpSignal(@FieldMap Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 我的分享-热心指数等
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1")
|
||||
Observable<V2XShareEventDescription> getEnthusiasmIndex(@FieldMap Map<String, Object> parames);
|
||||
|
||||
/**
|
||||
* 我的分享-列表
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/pathAndPoi/no/queryInfo")
|
||||
Observable<V2XShareEventItem> getShareEventList(@FieldMap Map<String, Object> parames);
|
||||
|
||||
/*
|
||||
* 周边列表
|
||||
*
|
||||
* */
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/deva/car/path/no/getLauncherSnapshotDataResponse/v1")
|
||||
Observable<SurroundingResponse> getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.network;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* 刷新回调
|
||||
*/
|
||||
public interface V2XRefreshCallback<T> {
|
||||
|
||||
void onSuccess(T result);
|
||||
|
||||
void onFail(String msg);
|
||||
}
|
||||
@@ -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<String, Object> 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<BaseData>(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<V2XUserInfoRes> 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<V2XUserInfoRes>(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<V2XLiveCarRes> callback, double lon, double lat) {
|
||||
final Map<String, Object> 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<V2XLiveCarRes>(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<BaseData> callback) {
|
||||
final Map<String, Object> 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<BaseData>(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<BaseData> callback,
|
||||
String infoId,
|
||||
String poiType,
|
||||
int likeOrDislike) {
|
||||
final Map<String, Object> 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<BaseData>(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<String, Object> 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<BaseData>(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<String, Object> 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<BaseData>(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<V2XStrategyPushRes> callback) {
|
||||
V2XApiServiceFactory.getStrategyPushApiService(mContext).getStrategyPush().subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<V2XStrategyPushRes>(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<V2XSeekHelpRes> callback) {
|
||||
final Map<String, Object> 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<V2XSeekHelpRes>(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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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<String> indexObservable = Observable.create(new ObservableOnSubscribe<String>() {
|
||||
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
emitter.onNext("1");
|
||||
emitter.onComplete();
|
||||
}
|
||||
});
|
||||
|
||||
Observable<String> listObservable = Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
emitter.onNext("2");
|
||||
emitter.onComplete();
|
||||
}
|
||||
});
|
||||
indexObservable.flatMap(new Function<String, ObservableSource<?>>() {
|
||||
@Override
|
||||
public ObservableSource<?> apply(String s) throws Exception {
|
||||
return listObservable;
|
||||
}
|
||||
})
|
||||
.observeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Object>() {
|
||||
|
||||
@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<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
builder.append("data", GsonUtil.jsonFromObject(hashMap));
|
||||
Map<String, Object> parameters = builder.build();
|
||||
//热心指数
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).getEnthusiasmIndex(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(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<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
hashMap.put("pageNum", page);
|
||||
hashMap.put("pageSize", size);
|
||||
builder.append("data", GsonUtil.jsonFromObject(hashMap));
|
||||
Map<String, Object> parameters = builder.build();
|
||||
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).getShareEventList(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(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("网络异常,点击刷新重试");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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<MogoLatLng> 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<MogoLatLng> polylinePoint) {
|
||||
this.polylinePoint = polylinePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(MogoLocation carLocation) {
|
||||
mV2XOptimalRouteOverlay.draw(carLocation, polylinePoint);
|
||||
}
|
||||
}
|
||||
@@ -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<MogoLatLng> mPolylinePointList;
|
||||
// 渐变色
|
||||
private List<Integer> mPolylineColors;
|
||||
|
||||
public V2XOptimalRouteOverlay() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
// 引导线颜色
|
||||
mPolylineColors = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制最优路线
|
||||
*
|
||||
* @param polylinePoint 要绘制的经纬度度集合
|
||||
*/
|
||||
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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<T> implements IV2XScenario {
|
||||
protected String TAG = "AbsV2XScenario";
|
||||
private IV2XWindow mV2XWindow;
|
||||
private IV2XButton mV2XButton;
|
||||
private IV2XMarker mV2XMarker;
|
||||
private V2XMessageEntity<T> mV2XMessageEntity;
|
||||
|
||||
protected AbsV2XScenario() {
|
||||
}
|
||||
|
||||
public abstract void init(@Nullable V2XMessageEntity<T> 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<T> mV2XMessageEntity) {
|
||||
this.mV2XMessageEntity = mV2XMessageEntity;
|
||||
}
|
||||
|
||||
public V2XMessageEntity<T> getV2XMessageEntity() {
|
||||
return mV2XMessageEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameScenario(@Nullable V2XMessageEntity v2XMessageEntity) {
|
||||
if (mV2XMessageEntity == null) {
|
||||
return false;
|
||||
}
|
||||
return mV2XMessageEntity.equals(v2XMessageEntity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<V2XPushMessageEntity> {
|
||||
|
||||
public V2XAnimationScenario() {
|
||||
setV2XWindow(new V2XAnimationWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user