[8.4.0][乘客屏] 移除B4无用代码
@@ -11,7 +11,7 @@ interface CommonService : IProvider {
|
|||||||
|
|
||||||
fun resetFragment(){}
|
fun resetFragment(){}
|
||||||
|
|
||||||
fun getStatusBarView(context: Context): View
|
fun getStatusBarView(context: Context): View?
|
||||||
|
|
||||||
fun invokeByName(type:String,value:Any){}
|
fun invokeByName(type:String,value:Any){}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ abstract class CommonServiceImpl : CommonService {
|
|||||||
|
|
||||||
var statusBarView: View? = null
|
var statusBarView: View? = null
|
||||||
|
|
||||||
override fun getStatusBarView(context: Context): View {
|
override fun getStatusBarView(context: Context): View? {
|
||||||
if (statusBarView == null) {
|
if (statusBarView == null) {
|
||||||
statusBarView = if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
statusBarView = if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||||
StatusBarUnmannedView(context)
|
StatusBarUnmannedView(context)
|
||||||
@@ -19,7 +19,7 @@ abstract class CommonServiceImpl : CommonService {
|
|||||||
StatusBarView(context)
|
StatusBarView(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return statusBarView!!
|
return statusBarView
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -201,6 +201,10 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
|||||||
decorView.clipToPadding = false
|
decorView.clipToPadding = false
|
||||||
var statusBarView = decorView.findViewWithTag<View>("status_bar")
|
var statusBarView = decorView.findViewWithTag<View>("status_bar")
|
||||||
val statusBar = _commonService?.getStatusBarView(it)
|
val statusBar = _commonService?.getStatusBarView(it)
|
||||||
|
if (_commonService != null && statusBar == null) {
|
||||||
|
removeStatusBar()
|
||||||
|
return
|
||||||
|
}
|
||||||
if(statusBarView!=null){
|
if(statusBarView!=null){
|
||||||
if(statusBar == statusBarView||statusBar==null){
|
if(statusBar == statusBarView||statusBar==null){
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -3,12 +3,8 @@ package com.mogo.och.shuttle.weaknet.passenger.presenter
|
|||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import com.amap.api.maps.model.LatLng
|
import com.amap.api.maps.model.LatLng
|
||||||
import com.mogo.commons.mvp.Presenter
|
import com.mogo.commons.mvp.Presenter
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
||||||
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
||||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
|
||||||
import com.mogo.och.common.module.utils.RxUtils
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
import com.mogo.och.data.bean.BusStationBean
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ADASCallback
|
import com.mogo.och.shuttle.weaknet.passenger.callback.ADASCallback
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
||||||
@@ -16,14 +12,10 @@ import com.mogo.och.shuttle.weaknet.passenger.constant.B4Const.Companion.M2_MAP_
|
|||||||
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.model.PM2ADASModel
|
import com.mogo.och.shuttle.weaknet.passenger.model.PM2ADASModel
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.map.PB4HPMapFragment
|
import com.mogo.och.shuttle.weaknet.passenger.ui.map.PB4HPMapFragment
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
||||||
Presenter<PB4HPMapFragment?>(view), ADASCallback, ICommonCallback, BridgeListener,
|
Presenter<PB4HPMapFragment?>(view), ADASCallback, ICommonCallback, BridgeListener {
|
||||||
B4AIMessageManager.AIMessageListener {
|
|
||||||
|
|
||||||
private val TAG = "PB4ADASPresenter"
|
private val TAG = "PB4ADASPresenter"
|
||||||
|
|
||||||
@@ -50,23 +42,6 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var aiMessageShowmagic: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
|
|
||||||
if (oldValue != newValue) {
|
|
||||||
checkScreenChange()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var lastAiMessageTime: Long by Delegates.observable(System.currentTimeMillis()) { _, oldValue, newValue ->
|
|
||||||
if (oldValue != newValue) {
|
|
||||||
aiMessageShowmagic = true
|
|
||||||
RxUtils.disposeSubscribe(lastAIMessageCountDown)
|
|
||||||
lastAIMessageCountDown = RxUtils.createSubscribe(5_000) {
|
|
||||||
aiMessageShowmagic = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var lastAIMessageCountDown: Disposable? = null
|
|
||||||
|
|
||||||
override fun onCreate(owner: LifecycleOwner) {
|
override fun onCreate(owner: LifecycleOwner) {
|
||||||
super.onCreate(owner)
|
super.onCreate(owner)
|
||||||
@@ -78,7 +53,6 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
PM2ADASModel.INSTANCE.setAdasCallback(this)
|
PM2ADASModel.INSTANCE.setAdasCallback(this)
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, this)
|
CommonModel.setRouteLineInfoCallback(TAG, this)
|
||||||
BridgeManager.addBridgeListener(TAG, this)
|
BridgeManager.addBridgeListener(TAG, this)
|
||||||
B4AIMessageManager.registerListener(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeListener() {
|
private fun removeListener() {
|
||||||
@@ -86,7 +60,6 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
CommonModel.setRouteLineInfoCallback(TAG, null)
|
CommonModel.setRouteLineInfoCallback(TAG, null)
|
||||||
CommonModel.releaseListeners()
|
CommonModel.releaseListeners()
|
||||||
BridgeManager.removeBridgeListener(TAG)
|
BridgeManager.removeBridgeListener(TAG)
|
||||||
B4AIMessageManager.unregisterListener(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy(owner: LifecycleOwner) {
|
override fun onDestroy(owner: LifecycleOwner) {
|
||||||
@@ -102,9 +75,7 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun clearCustomPolyline() {
|
override fun clearCustomPolyline() {
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.clearCustomPolyline()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateLineStations(stations: MutableList<BusStationBean>) {
|
override fun updateLineStations(stations: MutableList<BusStationBean>) {
|
||||||
@@ -140,10 +111,6 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.updateLineStations(stationsList, stationsListPass, startStation, endStation)
|
|
||||||
}
|
|
||||||
PM2ADASModel.INSTANCE.updateHDMapStations(stations)
|
PM2ADASModel.INSTANCE.updateHDMapStations(stations)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,9 +120,6 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
|
|
||||||
override fun showNoTaskView(noLine: Boolean) {
|
override fun showNoTaskView(noLine: Boolean) {
|
||||||
haveLine = !noLine
|
haveLine = !noLine
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
mView?.showNoTaskView(!noLine)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -169,35 +133,4 @@ class PB4ADASPresenter(view: PB4HPMapFragment?) :
|
|||||||
// checkScreenChange()
|
// checkScreenChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReceive(msg: B4AIMessage) {
|
|
||||||
lastAiMessageTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun clear() {
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkScreenChange() {
|
|
||||||
CallerLogger.d(TAG, "haveLine:$haveLine arrived:$arrived havePredictionInfos:$havePredictionInfos haveTrajectoryInfos:$haveTrajectoryInfos aiMessageShowmagic:$aiMessageShowmagic")
|
|
||||||
BizLoopManager.runInMainThread {
|
|
||||||
if (aiMessageShowmagic) {// 有mogomind 消息
|
|
||||||
updateMapFlag(false)
|
|
||||||
// 展示高精地图+mogoMind
|
|
||||||
mView?.showHDMap_mind()
|
|
||||||
} else {
|
|
||||||
updateMapFlag(false)
|
|
||||||
// 展示高精地图
|
|
||||||
mView?.showHDMap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateMapFlag(open: Boolean) {
|
|
||||||
// if (open) {
|
|
||||||
// FunctionBuildConfig.isDrawDecIdentifyData = true
|
|
||||||
// FunctionBuildConfig.isDrawPreIdentifyData = true
|
|
||||||
// } else {
|
|
||||||
// FunctionBuildConfig.isDrawDecIdentifyData = false
|
|
||||||
// FunctionBuildConfig.isDrawPreIdentifyData = false
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui
|
package com.mogo.och.shuttle.weaknet.passenger.ui
|
||||||
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import com.mogo.commons.mvp.MvpFragment
|
import com.mogo.commons.mvp.MvpFragment
|
||||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
||||||
@@ -13,21 +9,11 @@ import com.mogo.eagle.core.utilcode.util.AppUtils
|
|||||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
import com.mogo.eagle.core.utilcode.util.UriUtils
|
import com.mogo.eagle.core.utilcode.util.UriUtils
|
||||||
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
|
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
|
||||||
import com.mogo.och.common.module.biz.media.MediaManager
|
|
||||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
|
||||||
import com.mogo.och.common.module.manager.transform.OchTransform
|
|
||||||
import com.mogo.och.common.module.manager.transform.OchTransformDispatch
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
import com.mogo.och.shuttle.weaknet.passenger.R
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.presenter.PB4Presenter
|
import com.mogo.och.shuttle.weaknet.passenger.presenter.PB4Presenter
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.line.PB4DrivingInfoFragment
|
import com.mogo.och.shuttle.weaknet.passenger.ui.line.PB4DrivingInfoFragment
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.map.PB4HPMapFragment
|
import com.mogo.och.shuttle.weaknet.passenger.ui.map.PB4HPMapFragment
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_fragment.b4_test1
|
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_fragment.b4_test2
|
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_fragment.b4_test3
|
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_fragment.b4_tv_shuttle_b2_p_version
|
import kotlinx.android.synthetic.main.shuttle_p_b4_fragment.b4_tv_shuttle_b2_p_version
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_fragment.b4_video_fragment
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,33 +27,7 @@ class PB4BaseFragment :
|
|||||||
|
|
||||||
private var drivingFragment: PB4DrivingInfoFragment? = null
|
private var drivingFragment: PB4DrivingInfoFragment? = null
|
||||||
private var hdMapFragment: PB4HPMapFragment? = null
|
private var hdMapFragment: PB4HPMapFragment? = null
|
||||||
private var mediaFragment: Fragment? = null
|
|
||||||
private var mediaView: View? = null
|
|
||||||
|
|
||||||
// 视频直播流
|
|
||||||
private val ochTransform = object : OchTransformDispatch {
|
|
||||||
override fun setVideoView(target: View?) {
|
|
||||||
super.setVideoView(target)
|
|
||||||
if (target != null) {
|
|
||||||
BizLoopManager.runInMainThread {
|
|
||||||
target.id = R.id.b4_video_show
|
|
||||||
val params = FrameLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
|
||||||
b4_video_fragment.addView(target, params)
|
|
||||||
MediaManager.setMediaPause()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
BizLoopManager.runInMainThread {
|
|
||||||
findViewById<View>(R.id.b4_video_show)?.let {
|
|
||||||
b4_video_fragment.removeView(it)
|
|
||||||
MediaManager.setMediaResume()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getLayoutId(): Int {
|
override fun getLayoutId(): Int {
|
||||||
return R.layout.shuttle_p_b4_fragment
|
return R.layout.shuttle_p_b4_fragment
|
||||||
@@ -81,11 +41,9 @@ class PB4BaseFragment :
|
|||||||
// tv_shuttle_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
// tv_shuttle_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
||||||
b4_tv_shuttle_b2_p_version.text = StringUtils.getString(R.string.module_och_version, AppUtils.getAppVersionName())
|
b4_tv_shuttle_b2_p_version.text = StringUtils.getString(R.string.module_och_version, AppUtils.getAppVersionName())
|
||||||
initFragment()
|
initFragment()
|
||||||
OchTransform.addListener(TAG, ochTransform)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
OchTransform.removeListener(TAG)
|
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +51,6 @@ class PB4BaseFragment :
|
|||||||
* 初始化行程信息,高静地图,宣传 三个fragment
|
* 初始化行程信息,高静地图,宣传 三个fragment
|
||||||
*/
|
*/
|
||||||
private fun initFragment() {
|
private fun initFragment() {
|
||||||
|
|
||||||
if (drivingFragment == null) drivingFragment = PB4DrivingInfoFragment()
|
if (drivingFragment == null) drivingFragment = PB4DrivingInfoFragment()
|
||||||
childFragmentManager.beginTransaction().add(R.id.b4_driving_fragment, drivingFragment!!)
|
childFragmentManager.beginTransaction().add(R.id.b4_driving_fragment, drivingFragment!!)
|
||||||
.show(drivingFragment!!).commitAllowingStateLoss()
|
.show(drivingFragment!!).commitAllowingStateLoss()
|
||||||
@@ -102,83 +59,7 @@ class PB4BaseFragment :
|
|||||||
childFragmentManager.beginTransaction().add(R.id.b4_hd_map_fragment, hdMapFragment!!)
|
childFragmentManager.beginTransaction().add(R.id.b4_hd_map_fragment, hdMapFragment!!)
|
||||||
.show(hdMapFragment!!).commitAllowingStateLoss()
|
.show(hdMapFragment!!).commitAllowingStateLoss()
|
||||||
|
|
||||||
// if (mediaFragment == null) {
|
|
||||||
// mediaFragment = MediaManager.Video.getAdFragment()
|
|
||||||
// }
|
|
||||||
if (mediaView == null && context != null) {
|
|
||||||
context?.let {
|
|
||||||
mediaView = MediaManager.Video.getAdView(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mediaView?.let {
|
|
||||||
b4_video_fragment.addView(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
// childFragmentManager.beginTransaction().add(R.id.video_fragment, mediaFragment!!)
|
|
||||||
// .show(mediaFragment!!).commitAllowingStateLoss()
|
|
||||||
|
|
||||||
|
|
||||||
b4_test1.onClick {
|
|
||||||
CallerRoadV2NEventWindowListenerManager.showImage(
|
|
||||||
System.currentTimeMillis().toString(),
|
|
||||||
System.currentTimeMillis(),
|
|
||||||
EventTypeEnumNew.getUpdateIconRes(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
|
|
||||||
String.format(
|
|
||||||
EventTypeEnumNew.getAlarmContent(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
|
|
||||||
100
|
|
||||||
),
|
|
||||||
false,
|
|
||||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
|
|
||||||
UriUtils.res2Uri(
|
|
||||||
EventTypeEnumNew.getPoiTypeBg(
|
|
||||||
EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType,
|
|
||||||
false
|
|
||||||
).toString()
|
|
||||||
).toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
b4_test2.onClick {
|
|
||||||
CallerMapRoadListenerManager.invokeCrossDevice(true)
|
|
||||||
}
|
|
||||||
b4_test3.onClick {
|
|
||||||
val one = RoadMsg(201, 1, true, false)
|
|
||||||
val two = RoadMsg(202, 2, false, false)
|
|
||||||
val three = RoadMsg(203, 3, false, true)
|
|
||||||
|
|
||||||
val sortedList = ArrayList<RoadMsg>()
|
|
||||||
sortedList.add(one)
|
|
||||||
sortedList.add(two)
|
|
||||||
sortedList.add(three)
|
|
||||||
// val ndeEvent = AIMessage.NDEData(System.currentTimeMillis().toString(),"路口车龙","前方路口有车龙",sortedList)
|
|
||||||
val ndeEvent = B4AIMessage.B4NDEData(
|
|
||||||
System.currentTimeMillis().toString(),
|
|
||||||
StringUtils.getString(R.string.module_och_crossing_tailback),
|
|
||||||
StringUtils.getString(R.string.module_och_crossing_tailback_desc),
|
|
||||||
sortedList
|
|
||||||
)
|
|
||||||
B4AIMessageManager.post(ndeEvent)
|
|
||||||
|
|
||||||
// CallerRoadV2NEventWindowListenerManager.showImage(
|
|
||||||
// System.currentTimeMillis().toString(),
|
|
||||||
// System.currentTimeMillis(),
|
|
||||||
// EventTypeEnumNew.getUpdateIconRes(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
|
|
||||||
// String.format(
|
|
||||||
// EventTypeEnumNew.getAlarmContent(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
|
|
||||||
// 100
|
|
||||||
// ),
|
|
||||||
// false,
|
|
||||||
// String.format(
|
|
||||||
// EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
|
|
||||||
// 100
|
|
||||||
// ),
|
|
||||||
// UriUtils.res2Uri(
|
|
||||||
// EventTypeEnumNew.getPoiTypeBg(
|
|
||||||
// EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType,
|
|
||||||
// false
|
|
||||||
// ).toString()
|
|
||||||
// ).toString()
|
|
||||||
// )
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createPresenter(): PB4Presenter {
|
override fun createPresenter(): PB4Presenter {
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.map
|
package com.mogo.och.shuttle.weaknet.passenger.ui.map
|
||||||
|
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import com.amap.api.maps.model.LatLng
|
|
||||||
import com.mogo.commons.AbsMogoApplication
|
import com.mogo.commons.AbsMogoApplication
|
||||||
import com.mogo.commons.mvp.MvpFragment
|
import com.mogo.commons.mvp.MvpFragment
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.function.view.SiteMarkerBean
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
|
||||||
import com.mogo.map.MapDataWrapper
|
import com.mogo.map.MapDataWrapper
|
||||||
import com.mogo.map.overlay.core.Level
|
import com.mogo.map.overlay.core.Level
|
||||||
import com.mogo.map.overlay.point.Point
|
import com.mogo.map.overlay.point.Point
|
||||||
@@ -18,10 +14,7 @@ import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
|||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
import com.mogo.och.shuttle.weaknet.passenger.R
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.constant.B4Const.Companion.TYPE_MARKER_M2_LINE
|
import com.mogo.och.shuttle.weaknet.passenger.constant.B4Const.Companion.TYPE_MARKER_M2_LINE
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.presenter.PB4ADASPresenter
|
import com.mogo.och.shuttle.weaknet.passenger.presenter.PB4ADASPresenter
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_hpmap_fragment.b4_aciv_top_shader
|
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_hpmap_fragment.b4HomeView
|
import kotlinx.android.synthetic.main.shuttle_p_b4_hpmap_fragment.b4HomeView
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_hpmap_fragment.b4MindView
|
|
||||||
import kotlinx.android.synthetic.main.shuttle_p_b4_hpmap_fragment.b4OverMapView
|
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -32,22 +25,6 @@ import java.util.*
|
|||||||
class PB4HPMapFragment :
|
class PB4HPMapFragment :
|
||||||
MvpFragment<PB4HPMapFragment?, PB4ADASPresenter?>() {
|
MvpFragment<PB4HPMapFragment?, PB4ADASPresenter?>() {
|
||||||
|
|
||||||
private val stationIcon = BitmapFactory.decodeResource(
|
|
||||||
AbsMogoApplication.getApp().resources,
|
|
||||||
R.drawable.shuttle_p_b4_map_staton_icon
|
|
||||||
)
|
|
||||||
private val stationPassIcon = BitmapFactory.decodeResource(
|
|
||||||
AbsMogoApplication.getApp().resources,
|
|
||||||
R.drawable.shuttle_p_b4_map_staton_arrived_icon
|
|
||||||
)
|
|
||||||
private val startStationIcon = BitmapFactory.decodeResource(
|
|
||||||
AbsMogoApplication.getApp().resources,
|
|
||||||
R.drawable.shuttle_p_b4_map_start_icon
|
|
||||||
)
|
|
||||||
private val endStationIcon = BitmapFactory.decodeResource(
|
|
||||||
AbsMogoApplication.getApp().resources,
|
|
||||||
R.drawable.shuttle_p_b4_map_end_icon
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 改变自动驾驶状态
|
* 改变自动驾驶状态
|
||||||
@@ -69,20 +46,12 @@ class PB4HPMapFragment :
|
|||||||
override fun initViews(savedInstanceState: Bundle?) {
|
override fun initViews(savedInstanceState: Bundle?) {
|
||||||
super.initViews(savedInstanceState)
|
super.initViews(savedInstanceState)
|
||||||
b4HomeView.onCreate(savedInstanceState)
|
b4HomeView.onCreate(savedInstanceState)
|
||||||
b4OverMapView?.let {
|
|
||||||
it.onCreateView(savedInstanceState)
|
|
||||||
val radius = AutoSizeUtils.dp2px(requireContext(), 16f)
|
|
||||||
it.outlineProvider = TextureVideoViewOutlineProvider(radius.toFloat())
|
|
||||||
it.clipToOutline = true
|
|
||||||
it.hideResetView()
|
|
||||||
}
|
|
||||||
// cl_prediction_contain.onCreate(savedInstanceState)
|
// cl_prediction_contain.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
b4HomeView.onResume()
|
b4HomeView.onResume()
|
||||||
b4OverMapView?.onResume()
|
|
||||||
// cl_prediction_contain.onResume()
|
// cl_prediction_contain.onResume()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,13 +70,11 @@ class PB4HPMapFragment :
|
|||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
b4HomeView.onPause()
|
b4HomeView.onPause()
|
||||||
b4OverMapView?.onPause()
|
|
||||||
// cl_prediction_contain.onPause()
|
// cl_prediction_contain.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
b4HomeView.onDestroy()
|
b4HomeView.onDestroy()
|
||||||
b4OverMapView?.onDestroy()
|
|
||||||
// cl_prediction_contain.onDestroy()
|
// cl_prediction_contain.onDestroy()
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
}
|
}
|
||||||
@@ -120,29 +87,6 @@ class PB4HPMapFragment :
|
|||||||
private val TAG = PB4HPMapFragment::class.java.simpleName
|
private val TAG = PB4HPMapFragment::class.java.simpleName
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateLineStations(
|
|
||||||
stations: MutableList<LatLng>,
|
|
||||||
stationsPass: MutableList<LatLng>,
|
|
||||||
startStation: LatLng?,
|
|
||||||
endStation: LatLng?
|
|
||||||
) {
|
|
||||||
b4OverMapView?.let {
|
|
||||||
val stationsList: MutableList<SiteMarkerBean> = mutableListOf()
|
|
||||||
startStation?.let { start ->
|
|
||||||
stationsList.add(SiteMarkerBean(start, startStationIcon, 0.5f, 0.5f))
|
|
||||||
}
|
|
||||||
for (stationPass in stationsPass) {
|
|
||||||
stationsList.add(SiteMarkerBean(stationPass, stationPassIcon, 0.5f, 0.5f))
|
|
||||||
}
|
|
||||||
for (stationPass in stations) {
|
|
||||||
stationsList.add(SiteMarkerBean(stationPass, stationIcon, 0.5f, 0.5f))
|
|
||||||
}
|
|
||||||
endStation?.let { end ->
|
|
||||||
stationsList.add(SiteMarkerBean(end, endStationIcon, 0.5f, 0.5f))
|
|
||||||
}
|
|
||||||
it.drawSiteMarkers(stationsList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setMapMaker(
|
fun setMapMaker(
|
||||||
uuid: String,
|
uuid: String,
|
||||||
@@ -194,16 +138,6 @@ class PB4HPMapFragment :
|
|||||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showNoTaskView(b: Boolean) {
|
|
||||||
if (!b) {
|
|
||||||
b4OverMapView?.clearSiteMarkers()
|
|
||||||
clearCustomPolyline()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clearCustomPolyline() {
|
|
||||||
b4OverMapView?.clearCustomPolyline()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 展示高精地图
|
// 展示高精地图
|
||||||
// 展示高精地图+展示预测和决策
|
// 展示高精地图+展示预测和决策
|
||||||
@@ -220,79 +154,11 @@ class PB4HPMapFragment :
|
|||||||
layoutParams.marginStart = 0
|
layoutParams.marginStart = 0
|
||||||
b4HomeView.layoutParams = layoutParams
|
b4HomeView.layoutParams = layoutParams
|
||||||
|
|
||||||
b4_aciv_top_shader.visibility = View.GONE
|
|
||||||
|
|
||||||
// cl_aip_contain.visibility = View.GONE
|
// cl_aip_contain.visibility = View.GONE
|
||||||
// cl_prediction_contain.visibility = View.GONE
|
// cl_prediction_contain.visibility = View.GONE
|
||||||
|
|
||||||
b4MindView.visibility = View.GONE
|
|
||||||
b4OverMapView.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 展示高德地图
|
|
||||||
fun showAmap() {
|
|
||||||
b4HomeView.visibility = View.GONE
|
|
||||||
b4_aciv_top_shader.visibility = View.GONE
|
|
||||||
|
|
||||||
// cl_aip_contain.visibility = View.GONE
|
|
||||||
// cl_prediction_contain.visibility = View.GONE
|
|
||||||
|
|
||||||
b4MindView.visibility = View.GONE
|
|
||||||
b4OverMapView.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
val layoutParams = b4OverMapView.layoutParams as ConstraintLayout.LayoutParams
|
|
||||||
layoutParams.marginStart = 0
|
|
||||||
b4OverMapView.layoutParams = layoutParams
|
|
||||||
}
|
|
||||||
|
|
||||||
// 展示高精地图+mogoMind
|
|
||||||
fun showHDMap_mind() {
|
|
||||||
b4HomeView.visibility = View.VISIBLE
|
|
||||||
val layoutParams = b4HomeView.layoutParams as ConstraintLayout.LayoutParams
|
|
||||||
layoutParams.marginStart = hdMapMarginEnd
|
|
||||||
b4HomeView.layoutParams = layoutParams
|
|
||||||
|
|
||||||
b4_aciv_top_shader.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
// cl_aip_contain.visibility = View.GONE
|
|
||||||
// cl_prediction_contain.visibility = View.GONE
|
|
||||||
|
|
||||||
b4MindView.visibility = View.VISIBLE
|
|
||||||
b4OverMapView.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
// 展示高精地图+展示预测和决策
|
|
||||||
fun showHDMap_aip_prediction() {
|
|
||||||
b4HomeView.visibility = View.VISIBLE
|
|
||||||
val layoutParams = b4HomeView.layoutParams as ConstraintLayout.LayoutParams
|
|
||||||
layoutParams.marginStart = hdMapMarginEnd
|
|
||||||
b4HomeView.layoutParams = layoutParams
|
|
||||||
|
|
||||||
b4_aciv_top_shader.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
// cl_aip_contain.visibility = View.VISIBLE
|
|
||||||
// cl_prediction_contain.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
b4MindView.visibility = View.GONE
|
|
||||||
b4OverMapView.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun showAmap_mind() {
|
|
||||||
b4HomeView.visibility = View.GONE
|
|
||||||
|
|
||||||
b4_aciv_top_shader.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
// cl_aip_contain.visibility = View.GONE
|
|
||||||
// cl_prediction_contain.visibility = View.GONE
|
|
||||||
|
|
||||||
b4MindView.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
b4OverMapView.visibility = View.VISIBLE
|
|
||||||
|
|
||||||
val layoutParams = b4OverMapView.layoutParams as ConstraintLayout.LayoutParams
|
|
||||||
layoutParams.marginStart = hdMapMarginEnd
|
|
||||||
b4OverMapView.layoutParams = layoutParams
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind
|
|
||||||
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList
|
|
||||||
|
|
||||||
|
|
||||||
object B4AIMessageManager {
|
|
||||||
|
|
||||||
// 使用 CopyOnWriteArrayList 来存储消息回调列表,保证线程安全
|
|
||||||
private val messageListeners: MutableList<AIMessageListener> = CopyOnWriteArrayList()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册一个消息监听器。
|
|
||||||
*
|
|
||||||
* @param listener 要注册的 AiMessageListener 实例。
|
|
||||||
*/
|
|
||||||
fun registerListener(listener: AIMessageListener) {
|
|
||||||
messageListeners.add(listener)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消注册一个消息监听器。
|
|
||||||
*
|
|
||||||
* @param listener 要取消注册的 AiMessageListener 实例。
|
|
||||||
*/
|
|
||||||
fun unregisterListener(listener: AIMessageListener) {
|
|
||||||
messageListeners.remove(listener)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发布一条消息。
|
|
||||||
*
|
|
||||||
* 这条消息会被发送给所有已注册的监听器。
|
|
||||||
*
|
|
||||||
* @param msg 要发布的消息。
|
|
||||||
*/
|
|
||||||
fun post(msg: B4AIMessage) {
|
|
||||||
// 遍历所有已注册的监听器,并调用它们的 onReceive 方法
|
|
||||||
messageListeners.forEach { callback ->
|
|
||||||
callback.onReceive(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clearData() {
|
|
||||||
messageListeners.forEach { callback ->
|
|
||||||
callback.clear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息监听器接口。
|
|
||||||
*/
|
|
||||||
interface AIMessageListener {
|
|
||||||
/**
|
|
||||||
* 当接收到消息时,会调用此方法。
|
|
||||||
*
|
|
||||||
* @param msg 接收到的消息。
|
|
||||||
*/
|
|
||||||
fun onReceive(msg: B4AIMessage)
|
|
||||||
|
|
||||||
fun clear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
import androidx.lifecycle.ViewModelProvider
|
|
||||||
import androidx.lifecycle.findViewTreeLifecycleOwner
|
|
||||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter.B4AIMessageAdapter
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter.B4OnItemClickListener
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter.B4PaddingItemDecoration
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.data.B4AutomaticExplorationViewModel
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.data.B4NDEViewModel
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.data.B4RoadCrossRoamViewModel
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.data.B4RoadV2NEventViewModel
|
|
||||||
import kotlinx.android.synthetic.main.b4_mind_view.view.b4_rv_mind_list
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
class B4MindView : ConstraintLayout, B4MindViewModel.AiViewCallback {
|
|
||||||
|
|
||||||
private val TAG = "B4MindView"
|
|
||||||
|
|
||||||
constructor(context: Context) : super(context)
|
|
||||||
|
|
||||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
|
||||||
|
|
||||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
|
||||||
|
|
||||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
|
||||||
|
|
||||||
private var roadV2NEventModel: B4RoadV2NEventViewModel? = null
|
|
||||||
private var roadCrossRoamModel: B4RoadCrossRoamViewModel? = null
|
|
||||||
private var automaticExplorationModel: B4AutomaticExplorationViewModel? = null
|
|
||||||
private var ndeViewModel: B4NDEViewModel? = null
|
|
||||||
|
|
||||||
|
|
||||||
private var viewModel: B4MindViewModel? = null
|
|
||||||
|
|
||||||
private var isUserScrollingTime = 0L
|
|
||||||
|
|
||||||
private val SCROLL_THRESHOLD = 2000L
|
|
||||||
|
|
||||||
private val messageAdapter: B4AIMessageAdapter by lazy { B4AIMessageAdapter() }
|
|
||||||
private val messageLayoutManager: LinearLayoutManager by lazy {
|
|
||||||
LinearLayoutManager(context).apply {
|
|
||||||
stackFromEnd = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initView() {
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.b4_mind_view, this, true)
|
|
||||||
|
|
||||||
b4_rv_mind_list.layoutManager = messageLayoutManager
|
|
||||||
b4_rv_mind_list.adapter = messageAdapter
|
|
||||||
b4_rv_mind_list.addItemDecoration(B4PaddingItemDecoration(200, 300))
|
|
||||||
messageAdapter.onItemClickListener = B4OnItemClickListener { item, position ->
|
|
||||||
if (item is B4AIMessage.B4Event) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
b4_rv_mind_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
|
||||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
|
||||||
super.onScrollStateChanged(recyclerView, newState)
|
|
||||||
if (newState != RecyclerView.SCROLL_STATE_IDLE) {
|
|
||||||
isUserScrollingTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
|
||||||
ViewModelProvider(it).get(B4MindViewModel::class.java)
|
|
||||||
}
|
|
||||||
viewModel?.setViewCallback(this)
|
|
||||||
|
|
||||||
roadV2NEventModel = findViewTreeViewModelStoreOwner()?.let {
|
|
||||||
ViewModelProvider(it)[B4RoadV2NEventViewModel::class.java]
|
|
||||||
}
|
|
||||||
roadV2NEventModel?.init()
|
|
||||||
roadCrossRoamModel = findViewTreeViewModelStoreOwner()?.let {
|
|
||||||
ViewModelProvider(it)[B4RoadCrossRoamViewModel::class.java]
|
|
||||||
}
|
|
||||||
roadCrossRoamModel?.init(context)
|
|
||||||
// automaticExplorationModel = findViewTreeViewModelStoreOwner()?.let{
|
|
||||||
// ViewModelProvider(it)[AutomaticExplorationViewModel::class.java]
|
|
||||||
// }
|
|
||||||
// automaticExplorationModel?.init()
|
|
||||||
ndeViewModel = findViewTreeViewModelStoreOwner()?.let {
|
|
||||||
ViewModelProvider(it)[B4NDEViewModel::class.java]
|
|
||||||
}
|
|
||||||
ndeViewModel?.init()
|
|
||||||
|
|
||||||
findViewTreeLifecycleOwner()?.lifecycleScope?.launch {
|
|
||||||
viewModel?.messagesFlow?.collect {
|
|
||||||
Log.d(TAG, "${tName()} onMessages update: ${it}")
|
|
||||||
if (it.isNotEmpty()) {
|
|
||||||
b4_rv_mind_list.visibility = View.VISIBLE
|
|
||||||
} else {
|
|
||||||
b4_rv_mind_list.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
messageAdapter.submitList(it) {
|
|
||||||
Log.d(TAG, "${tName()} adapter submit: ")
|
|
||||||
scrollToBottom()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 滚动到RecyclerView底部
|
|
||||||
private fun scrollToBottom() {
|
|
||||||
val delay = System.currentTimeMillis() - isUserScrollingTime
|
|
||||||
if (delay < SCROLL_THRESHOLD) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val layoutManager = b4_rv_mind_list.layoutManager as LinearLayoutManager
|
|
||||||
layoutManager.scrollToPositionWithOffset(messageAdapter.itemCount - 1, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun tName(): String {
|
|
||||||
return "【${Thread.currentThread().name}】"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
|
||||||
super.onVisibilityAggregated(isVisible)
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
try {
|
|
||||||
initView()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind
|
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import com.mogo.eagle.core.data.ai.V2XRepository
|
|
||||||
import com.mogo.eagle.core.data.map.MogoLocation
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
|
||||||
import com.mogo.och.bridge.autopilot.location.OchLocationManager
|
|
||||||
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
|
||||||
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
|
||||||
import com.mogo.och.common.module.biz.media.VoiceNotice
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.SharedFlow
|
|
||||||
|
|
||||||
class B4MindViewModel : ViewModel(), B4AIMessageManager.AIMessageListener,
|
|
||||||
BridgeListener {
|
|
||||||
|
|
||||||
private val msgList = mutableListOf<B4AIMessage>()
|
|
||||||
private var lastTimestamp = System.currentTimeMillis()
|
|
||||||
|
|
||||||
// 记录最后一次事件发生的时间,使用 private set 限制外部修改
|
|
||||||
// private val TIMESTAMP_THRESHOLD = 1000 * 60 * 5 // 5分钟
|
|
||||||
private val TIMESTAMP_THRESHOLD = 1000 * 30
|
|
||||||
|
|
||||||
private var llmResultJob: Job? = null
|
|
||||||
|
|
||||||
private var isChecking = false
|
|
||||||
|
|
||||||
private val _messagesFlow = MutableStateFlow<List<B4AIMessage>>(emptyList())
|
|
||||||
val messagesFlow: SharedFlow<List<B4AIMessage>> get() = _messagesFlow
|
|
||||||
|
|
||||||
private val commontCallback = object : ICommonCallback {
|
|
||||||
override fun showNoTaskView(isTrue: Boolean) {
|
|
||||||
if (isTrue) {
|
|
||||||
clearMsg()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val locationCallback = object : IMoGoChassisLocationGCJ02Listener {
|
|
||||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
|
||||||
mogoLocation?.let {
|
|
||||||
V2XRepository.provideLocation(it, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setViewCallback(aiView: AiViewCallback) {
|
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, commontCallback)
|
|
||||||
OchLocationManager.addGCJ02Listener(TAG, 1, locationCallback)
|
|
||||||
B4AIMessageManager.registerListener(this)
|
|
||||||
|
|
||||||
BridgeManager.addBridgeListener(TAG, this)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCleared() {
|
|
||||||
B4AIMessageManager.unregisterListener(this)
|
|
||||||
llmResultJob?.cancel()
|
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, null)
|
|
||||||
OchLocationManager.removeGCJ02Listener(TAG)
|
|
||||||
super.onCleared()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onReceive(msg: B4AIMessage) {
|
|
||||||
Log.d(TAG, "onReceive: $msg")
|
|
||||||
if (isChecking) {
|
|
||||||
if (msg is B4AIMessage.B4Event) {
|
|
||||||
msg.showScanFlag = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获更新消息
|
|
||||||
updateMsg(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun clear() {
|
|
||||||
clearMsg()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handleMsg(newMessage: B4AIMessage) {
|
|
||||||
val existingIndex = findMessageIndex(newMessage.id)
|
|
||||||
if (existingIndex != -1) {
|
|
||||||
handleExistingMessage(existingIndex, newMessage)
|
|
||||||
} else {
|
|
||||||
handleNewMessage(newMessage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun findMessageIndex(messageId: String): Int {
|
|
||||||
return msgList.indexOfFirst { it.id == messageId }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handleExistingMessage(index: Int, newMessage: B4AIMessage) {
|
|
||||||
val oldMessage = msgList[index]
|
|
||||||
|
|
||||||
newMessage.showTimestamp = oldMessage.showTimestamp
|
|
||||||
msgList[index] = newMessage
|
|
||||||
|
|
||||||
speakMessageIfNeeded(newMessage, isLastMessage = msgList.last() == newMessage)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handleNewMessage(newMessage: B4AIMessage) {
|
|
||||||
updateTimestampIfNeeded(newMessage)
|
|
||||||
msgList.add(newMessage)
|
|
||||||
speakMessageIfNeeded(newMessage, isLastMessage = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateTimestampIfNeeded(newMessage: B4AIMessage) {
|
|
||||||
val time = newMessage.timestamp - lastTimestamp
|
|
||||||
if (time >= TIMESTAMP_THRESHOLD) {
|
|
||||||
newMessage.showTimestamp = true
|
|
||||||
lastTimestamp = newMessage.timestamp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun speakMessageIfNeeded(newMessage: B4AIMessage, isLastMessage: Boolean) {
|
|
||||||
if (isLastMessage && newMessage.tts.isNotEmpty()) {
|
|
||||||
VoiceNotice.showNotice(newMessage.tts)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "B4MindViewModel"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateMsg(msg: B4AIMessage) {
|
|
||||||
synchronized(msgList) {
|
|
||||||
handleMsg(msg)
|
|
||||||
_messagesFlow.value = msgList.toList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun deleteMsg(msgId: String) {
|
|
||||||
synchronized(msgList) {
|
|
||||||
val iterator = msgList.iterator()
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
if (iterator.next().id == msgId) {
|
|
||||||
iterator.remove()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_messagesFlow.value = msgList.toList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun clearMsg() {
|
|
||||||
synchronized(msgList) {
|
|
||||||
msgList.clear()
|
|
||||||
_messagesFlow.value = msgList.toList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface AiViewCallback {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import android.animation.Animator
|
|
||||||
import android.animation.AnimatorListenerAdapter
|
|
||||||
import android.animation.ObjectAnimator
|
|
||||||
import android.animation.ValueAnimator
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.animation.LinearInterpolator
|
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自动探查适配器
|
|
||||||
* 鹰眼650需求
|
|
||||||
*/
|
|
||||||
class AutomaticExplorationB4Adapter(val context: Context) : RecyclerView.Adapter<AutomaticExplorationB4Adapter.ExplorationHolder>() {
|
|
||||||
|
|
||||||
private var data: List<AutoExplorationEntity>? = null
|
|
||||||
private var completeListener: CompleteListener? = null
|
|
||||||
|
|
||||||
fun setData(data: List<AutoExplorationEntity>) {
|
|
||||||
this.data = data
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setListener(listener: CompleteListener) {
|
|
||||||
completeListener = listener
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ExplorationHolder {
|
|
||||||
val view = LayoutInflater.from(parent.context)
|
|
||||||
.inflate(R.layout.item_auto_exploration_b4, parent, false)
|
|
||||||
return ExplorationHolder(view)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = data?.size ?: 0
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ExplorationHolder, position: Int) {
|
|
||||||
data?.let {
|
|
||||||
val entity = it[position]
|
|
||||||
holder.tvExplorationContent.text = entity.explorationContent
|
|
||||||
holder.ivExplorationLoading.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_exploration_loading_p
|
|
||||||
))
|
|
||||||
val rotationAnim = ObjectAnimator.ofFloat(holder.ivExplorationLoading, "rotation", 0f, 360f)
|
|
||||||
rotationAnim.repeatCount = entity.explorationDuration.toInt() / 1000
|
|
||||||
rotationAnim.repeatMode = ValueAnimator.RESTART
|
|
||||||
rotationAnim.duration = 1000
|
|
||||||
rotationAnim.interpolator = LinearInterpolator()
|
|
||||||
rotationAnim.addListener(object : AnimatorListenerAdapter() {
|
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
|
||||||
super.onAnimationEnd(animation)
|
|
||||||
completeListener?.onComplete(entity)
|
|
||||||
holder.ivExplorationLoading.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_exploration_done_p
|
|
||||||
))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
rotationAnim.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExplorationHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
|
||||||
var ivExplorationLoading: ImageView = itemView.findViewById(R.id.b4IvExplorationLoading)
|
|
||||||
var tvExplorationContent: TextView = itemView.findViewById(R.id.b4TvExplorationContent)
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CompleteListener {
|
|
||||||
fun onComplete(entity: AutoExplorationEntity)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
|
|
||||||
class B4AIMessageAdapter : ListAdapter<B4AIMessage, B4MessageViewHolder>(B4MessageDiffCallback()) {
|
|
||||||
|
|
||||||
var onItemClickListener: B4OnItemClickListener? = null
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: B4MessageViewHolder, position: Int) {
|
|
||||||
getItem(position)?.let {
|
|
||||||
holder.bind(it, onItemClickListener)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): B4MessageViewHolder {
|
|
||||||
val inflater = LayoutInflater.from(parent.context)
|
|
||||||
return when (viewType) {
|
|
||||||
B4AIMessage.TYPE_PNC_ACTION -> B4PNCActionViewHolder(inflater.inflate(R.layout.b4_item_ai_pnc_action, parent, false))
|
|
||||||
B4AIMessage.TYPE_ROAD_V2N -> B4RoadV2NEventViewHolder(inflater.inflate(R.layout.b4_item_ai_road_v2n_event, parent, false))
|
|
||||||
B4AIMessage.TYPE_ROAD_CROSS -> B4RoadCrossRoamViewHolder(inflater.inflate(R.layout.b4_item_ai_road_cross_roam, parent, false))// 全息路口
|
|
||||||
B4AIMessage.TYPE_AUTOMATIC_EXPLORATION -> B4AutomaticExplorationViewHolder(inflater.inflate(R.layout.b4_item_ai_automatic_exploration, parent, false))// 探查
|
|
||||||
B4AIMessage.TYPE_NDE -> B4NDEViewHolder(inflater.inflate(R.layout.b4_item_ai_nde_event, parent, false))// 车龙
|
|
||||||
else -> throw IllegalArgumentException("Invalid view type")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemViewType(position: Int): Int {
|
|
||||||
return when (getItem(position)) {
|
|
||||||
is B4AIMessage.B4Event -> B4AIMessage.TYPE_EVENT
|
|
||||||
is B4AIMessage.B4Scan -> B4AIMessage.TYPE_SCAN
|
|
||||||
is B4AIMessage.B4Light -> B4AIMessage.TYPE_LIGHT
|
|
||||||
is B4AIMessage.B4Speed -> B4AIMessage.TYPE_SPEED
|
|
||||||
is B4AIMessage.B4Warning -> B4AIMessage.TYPE_WARNING
|
|
||||||
is B4AIMessage.B4PNCAction -> B4AIMessage.TYPE_PNC_ACTION
|
|
||||||
is B4AIMessage.B4RoadV2NEvent -> B4AIMessage.TYPE_ROAD_V2N
|
|
||||||
is B4AIMessage.B4RoadCrossRoam -> B4AIMessage.TYPE_ROAD_CROSS
|
|
||||||
is B4AIMessage.B4AutomaticExploration -> B4AIMessage.TYPE_AUTOMATIC_EXPLORATION
|
|
||||||
is B4AIMessage.B4NDEData -> B4AIMessage.TYPE_NDE
|
|
||||||
else -> B4AIMessage.TYPE_EVENT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewRecycled(holder: B4MessageViewHolder) {
|
|
||||||
super.onViewRecycled(holder)
|
|
||||||
holder.viewRecycled(holder)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
|
|
||||||
import com.mogo.eagle.core.data.v2x.RoadV2NEventType
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventLivePlayView
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView
|
|
||||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Date
|
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
|
|
||||||
abstract class B4MessageViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
|
||||||
abstract fun bind(item: B4AIMessage, onItemClickListener: B4OnItemClickListener? = null)
|
|
||||||
open fun viewRecycled(holder: B4MessageViewHolder) {}
|
|
||||||
private val sampleDateFormat = SimpleDateFormat("HH:mm", Locale.CHINA)
|
|
||||||
protected val TAG = javaClass.simpleName
|
|
||||||
|
|
||||||
fun handleTimestamp(item: B4AIMessage, tvTimestamp: TextView) {
|
|
||||||
if (item.showTimestamp) {
|
|
||||||
tvTimestamp.visibility = View.VISIBLE
|
|
||||||
tvTimestamp.text = sampleDateFormat.format(Date(item.timestamp))
|
|
||||||
} else {
|
|
||||||
tvTimestamp.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun View.setVisibilityBasedOn(condition: Boolean) {
|
|
||||||
visibility = if (condition) View.VISIBLE else View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun TextView.setTextAndVisibility(text: String) {
|
|
||||||
if (text.isEmpty()) {
|
|
||||||
visibility = View.GONE
|
|
||||||
this.text = ""
|
|
||||||
} else {
|
|
||||||
visibility = View.VISIBLE
|
|
||||||
this.text = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ImageView.showOrHideWithUrl(url: String) {
|
|
||||||
if (url.isEmpty()) {
|
|
||||||
visibility = View.GONE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
visibility = View.VISIBLE
|
|
||||||
Glide.with(this)
|
|
||||||
.load(url)
|
|
||||||
.placeholder(R.drawable.b4_icon_pic_holder)
|
|
||||||
.error(R.drawable.b4_icon_pic_error)
|
|
||||||
// .error(R.drawable.icon_marker_window_place_holder)
|
|
||||||
// .placeholder(R.drawable.icon_marker_window_place_holder)
|
|
||||||
.into(this)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class B4PNCActionViewHolder(binding: View) : B4MessageViewHolder(binding) {
|
|
||||||
|
|
||||||
private var tvPncActionDesc: TextView = binding.findViewById(R.id.b4TvPNCHintContent)
|
|
||||||
|
|
||||||
override fun bind(item: B4AIMessage, onItemClickListener: B4OnItemClickListener?) {
|
|
||||||
if (item is B4AIMessage.B4PNCAction) {
|
|
||||||
tvPncActionDesc.text = item.actionDesc
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class B4RoadV2NEventViewHolder(binding: View) : B4MessageViewHolder(binding) {
|
|
||||||
|
|
||||||
private var tvV2XHintContent: TextView = binding.findViewById(R.id.b4TvV2XHintContent)
|
|
||||||
private var containerImageAndLiveVideo: FrameLayout = binding.findViewById(R.id.b4ContainerImageAndLiveVideo)
|
|
||||||
private var livePlayView: RoadV2NEventLivePlayView = binding.findViewById(R.id.b4LivePlayView)
|
|
||||||
private var contentImageView: MogoImageView = binding.findViewById(R.id.b4ContentImageView)
|
|
||||||
|
|
||||||
override fun bind(item: B4AIMessage, onItemClickListener: B4OnItemClickListener?) {
|
|
||||||
if (item is B4AIMessage.B4RoadV2NEvent) {
|
|
||||||
tvV2XHintContent.text = item.title
|
|
||||||
when (item.eventType) {
|
|
||||||
RoadV2NEventType.TEXT -> {
|
|
||||||
containerImageAndLiveVideo.visibility = View.GONE
|
|
||||||
contentImageView.visibility = View.GONE
|
|
||||||
livePlayView.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
RoadV2NEventType.IMAGE -> {
|
|
||||||
containerImageAndLiveVideo.visibility = View.VISIBLE
|
|
||||||
contentImageView.visibility = View.VISIBLE
|
|
||||||
livePlayView.visibility = View.GONE
|
|
||||||
GlideImageLoader.getInstance()
|
|
||||||
.displayImage(item.contentImageUrl, contentImageView)
|
|
||||||
}
|
|
||||||
|
|
||||||
RoadV2NEventType.LIVE_VIDEO -> {
|
|
||||||
containerImageAndLiveVideo.visibility = View.VISIBLE
|
|
||||||
contentImageView.visibility = View.GONE
|
|
||||||
livePlayView.visibility = View.VISIBLE
|
|
||||||
val cityCode =
|
|
||||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode
|
|
||||||
livePlayView.startRoadCameraLive(
|
|
||||||
item.id,
|
|
||||||
item.cameraIp, item.lon, item.lat, cityCode
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class B4RoadCrossRoamViewHolder(binding: View) : B4MessageViewHolder(binding) {
|
|
||||||
|
|
||||||
private var tvRoadRoamTitle: TextView = binding.findViewById(R.id.b4TvRoadRoamTitle)
|
|
||||||
private var lvRoadCrossRoamTip: RecyclerView = binding.findViewById(R.id.b4LvRoadCrossRoamTip)
|
|
||||||
|
|
||||||
override fun bind(item: B4AIMessage, onItemClickListener: B4OnItemClickListener?) {
|
|
||||||
if (item is B4AIMessage.B4RoadCrossRoam) {
|
|
||||||
lvRoadCrossRoamTip.layoutManager = B4NoScrollLayoutManager(itemView.context)
|
|
||||||
lvRoadCrossRoamTip.adapter = RoadCrossRoamListB4Adapter(itemView.context)
|
|
||||||
tvRoadRoamTitle.setTextColor(itemView.context.getColor(R.color.color_131415))
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class B4AutomaticExplorationViewHolder(binding: View) : B4MessageViewHolder(binding) {
|
|
||||||
|
|
||||||
private var rvExplorationList: RecyclerView = binding.findViewById(R.id.b4RvExplorationList)
|
|
||||||
private lateinit var automaticExplorationAdapter: AutomaticExplorationB4Adapter
|
|
||||||
|
|
||||||
override fun bind(item: B4AIMessage, onItemClickListener: B4OnItemClickListener?) {
|
|
||||||
val linearLayoutManager = LinearLayoutManager(itemView.context)
|
|
||||||
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
|
|
||||||
automaticExplorationAdapter = AutomaticExplorationB4Adapter(itemView.context)
|
|
||||||
rvExplorationList.adapter = automaticExplorationAdapter
|
|
||||||
rvExplorationList.layoutManager = linearLayoutManager
|
|
||||||
initData()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initData() {
|
|
||||||
val dataList = ArrayList<AutoExplorationEntity>(7)
|
|
||||||
// dataList.add(AutoExplorationEntity("当前道路事件分析",2000L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_crossing_event_analyse), 2000L, false))
|
|
||||||
// dataList.add(AutoExplorationEntity("前方车辆",2000L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_vehicle_ahead), 2000L, false))
|
|
||||||
// dataList.add(AutoExplorationEntity("两侧车辆",2600L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_vehicle_both_sides), 2600L, false))
|
|
||||||
// dataList.add(AutoExplorationEntity("后方车辆",3000L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_vehicle_behind), 3000L, false))
|
|
||||||
// dataList.add(AutoExplorationEntity("前方路口车辆流速分析",4000L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_analysis_vehicle_flow_ahead), 4000L, false))
|
|
||||||
// dataList.add(AutoExplorationEntity("前方路口行人/非机动车分析",4300L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_pedestrians_ahead), 4300L, false))
|
|
||||||
// dataList.add(AutoExplorationEntity("路侧视频分析",5000L,false))
|
|
||||||
dataList.add(AutoExplorationEntity(StringUtils.getString(R.string.module_och_sidewalk_video_analysis), 5000L, false))
|
|
||||||
automaticExplorationAdapter.setListener(object : AutomaticExplorationB4Adapter.CompleteListener {
|
|
||||||
override fun onComplete(entity: AutoExplorationEntity) {
|
|
||||||
dataList.forEach {
|
|
||||||
if (it.explorationContent == entity.explorationContent) {
|
|
||||||
it.explorationComplete = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
automaticExplorationAdapter.setData(dataList)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class B4NDEViewHolder(binding: View) : B4MessageViewHolder(binding) {
|
|
||||||
|
|
||||||
private var tvNdeContent: TextView = binding.findViewById(R.id.b4TvNdeHintContent)
|
|
||||||
private var rvNdeList: RecyclerView = binding.findViewById(R.id.b4RvNdeList)
|
|
||||||
|
|
||||||
override fun bind(item: B4AIMessage, onItemClickListener: B4OnItemClickListener?) {
|
|
||||||
if (item is B4AIMessage.B4NDEData) {
|
|
||||||
tvNdeContent.text = item.desc
|
|
||||||
val linearLayoutManager = LinearLayoutManager(itemView.context)
|
|
||||||
linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
||||||
val ndeRoadAdapter = B4AINDERoadAdapter(itemView.context)
|
|
||||||
rvNdeList.adapter = ndeRoadAdapter
|
|
||||||
rvNdeList.layoutManager = linearLayoutManager
|
|
||||||
ndeRoadAdapter.setData(item.roadList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class B4NoScrollLayoutManager(context: Context?) : LinearLayoutManager(context) {
|
|
||||||
override fun canScrollVertically(): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun canScrollHorizontally(): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun interface B4OnItemClickListener {
|
|
||||||
fun onItemClick(item: B4AIMessage, position: Int)
|
|
||||||
}
|
|
||||||
@@ -1,237 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.TypedValue
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
|
|
||||||
class B4AINDERoadAdapter(private val context: Context) : RecyclerView.Adapter<B4AINDERoadAdapter.AIRoadHolder>() {
|
|
||||||
|
|
||||||
private var roadList: List<RoadMsg>? = null
|
|
||||||
|
|
||||||
fun setData(list: List<RoadMsg>) {
|
|
||||||
roadList = list
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AIRoadHolder {
|
|
||||||
val view = LayoutInflater.from(parent.context)
|
|
||||||
.inflate(R.layout.b4_item_ai_nde_road, parent, false)
|
|
||||||
return AIRoadHolder(view)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: AIRoadHolder, position: Int) {
|
|
||||||
roadList?.let {
|
|
||||||
val roadMsg = it[position]
|
|
||||||
if (it.size < 3) {
|
|
||||||
//设置item宽度为最大宽度180dp
|
|
||||||
val params = ConstraintLayout.LayoutParams(
|
|
||||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 90f,
|
|
||||||
context.resources.displayMetrics).toInt(),
|
|
||||||
ConstraintLayout.LayoutParams.WRAP_CONTENT)
|
|
||||||
holder.clRoadLayout.layoutParams = params
|
|
||||||
} else if (it.size == 3) {
|
|
||||||
//设置item宽度为最大宽度180dp
|
|
||||||
val params = ConstraintLayout.LayoutParams(
|
|
||||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 60f,
|
|
||||||
context.resources.displayMetrics).toInt(),
|
|
||||||
ConstraintLayout.LayoutParams.WRAP_CONTENT)
|
|
||||||
holder.clRoadLayout.layoutParams = params
|
|
||||||
} else if (it.size == 4) {
|
|
||||||
//设置item宽度为最大宽度180dp
|
|
||||||
val params = ConstraintLayout.LayoutParams(
|
|
||||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50f,
|
|
||||||
context.resources.displayMetrics).toInt(),
|
|
||||||
ConstraintLayout.LayoutParams.WRAP_CONTENT)
|
|
||||||
holder.clRoadLayout.layoutParams = params
|
|
||||||
} else {
|
|
||||||
val params = ConstraintLayout.LayoutParams(
|
|
||||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 45f,
|
|
||||||
context.resources.displayMetrics).toInt(),
|
|
||||||
ConstraintLayout.LayoutParams.WRAP_CONTENT)
|
|
||||||
holder.clRoadLayout.layoutParams = params
|
|
||||||
}
|
|
||||||
when (roadMsg.arrowType) {
|
|
||||||
//直行
|
|
||||||
201 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_forward
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//直行或左转
|
|
||||||
202 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_forward_or_turn_left
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//直行或右转
|
|
||||||
203 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_forward_or_turn_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//直行或掉头
|
|
||||||
204 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_forward_or_reverse
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//左转
|
|
||||||
205 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_left
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//左转或掉头
|
|
||||||
206 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_left_or_reverse
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//左弯或向左合流
|
|
||||||
207 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_or_merge_left
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//右转
|
|
||||||
208 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//右转或向右合流
|
|
||||||
209 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_or_merge_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//左右转弯
|
|
||||||
210 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_left_or_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//掉头
|
|
||||||
211 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_reverse
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//禁止左转
|
|
||||||
212 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_prohibit_turn_left
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//禁止右转
|
|
||||||
213 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_prohibit_turn_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//禁止掉头
|
|
||||||
214 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_prohibit_reverse
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//直行或左转或右转
|
|
||||||
215 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_forward_turn_left_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//直行或掉头或左转
|
|
||||||
216 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_forward_turn_left_reverse
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//右转或掉头
|
|
||||||
217 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_turn_right_or_reverse
|
|
||||||
))
|
|
||||||
}
|
|
||||||
//禁止右转或向右合流
|
|
||||||
218 -> {
|
|
||||||
holder.ivRoadType.setImageDrawable(
|
|
||||||
ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.icon_road_prohibit_turn_or_merge_right
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//是否是推荐车道
|
|
||||||
if (roadMsg.isRecommend) {
|
|
||||||
holder.tvRoadStatus.text = context.getString(R.string.nde_road_recommend)
|
|
||||||
holder.tvRoadStatus.setTextColor(context.getColor(R.color.msg_nde_road_recommend))
|
|
||||||
holder.clRoadLayout.background = ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.drawable.bg_nde_road_recommend
|
|
||||||
)
|
|
||||||
}
|
|
||||||
//是否有车龙,代表拥堵、行驶缓慢
|
|
||||||
if (roadMsg.isCheLong) {
|
|
||||||
holder.tvRoadStatus.text = context.getString(R.string.nde_road_slow)
|
|
||||||
holder.tvRoadStatus.setTextColor(context.getColor(R.color.msg_nde_road_slow))
|
|
||||||
}
|
|
||||||
if (position == it.lastIndex) {
|
|
||||||
holder.viewDivider.visibility = View.INVISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = roadList?.size ?: 0
|
|
||||||
|
|
||||||
class AIRoadHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
|
||||||
var clRoadLayout: ConstraintLayout = itemView.findViewById(R.id.clRoadLayout)
|
|
||||||
var ivRoadType: ImageView = itemView.findViewById(R.id.b4IvRoadType)
|
|
||||||
var tvRoadStatus: TextView = itemView.findViewById(R.id.b4TvRoadStatus)
|
|
||||||
var viewDivider: View = itemView.findViewById(R.id.b4ViewDivider)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
|
|
||||||
class B4MessageDiffCallback : DiffUtil.ItemCallback<B4AIMessage>() {
|
|
||||||
|
|
||||||
override fun areContentsTheSame(oldItem: B4AIMessage, newItem: B4AIMessage): Boolean {
|
|
||||||
return oldItem == newItem
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun areItemsTheSame(oldItem: B4AIMessage, newItem: B4AIMessage): Boolean {
|
|
||||||
return oldItem.id == newItem.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Rect
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.graphics.drawable.GradientDrawable
|
|
||||||
import android.view.View
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
|
||||||
import com.mogo.commons.AbsMogoApplication
|
|
||||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
|
||||||
|
|
||||||
class B4PaddingItemDecoration(private val topPadding: Int, private val bottomPadding: Int) : RecyclerView.ItemDecoration() {
|
|
||||||
|
|
||||||
private var divider: Drawable
|
|
||||||
|
|
||||||
private var padding = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(), 13f)
|
|
||||||
|
|
||||||
init {
|
|
||||||
val shapeDrawable = GradientDrawable()
|
|
||||||
shapeDrawable.setColor(ResourcesUtils.getColor(R.color.b4_BBC9D4))
|
|
||||||
shapeDrawable.shape = GradientDrawable.RECTANGLE
|
|
||||||
val width = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(), 343f)
|
|
||||||
val height = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(), 1f)
|
|
||||||
shapeDrawable.setSize(width, height)
|
|
||||||
divider = shapeDrawable
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
|
||||||
super.getItemOffsets(outRect, view, parent, state)
|
|
||||||
|
|
||||||
|
|
||||||
// 只有第一个 item 的顶部添加空白
|
|
||||||
if (parent.getChildAdapterPosition(view) == 0) {
|
|
||||||
outRect.top = topPadding
|
|
||||||
} else {
|
|
||||||
outRect.top = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// 最后一个 item 的底部添加空白
|
|
||||||
// if (parent.getChildAdapterPosition(view) == state.itemCount - 1) {
|
|
||||||
// outRect.bottom = bottomPadding
|
|
||||||
// } else{
|
|
||||||
// outRect.bottom = 0
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
|
|
||||||
super.onDraw(c, parent, state)
|
|
||||||
val childCount = parent.childCount //获取可见item的数量
|
|
||||||
val spanCount: Int = getSpanCount(parent)
|
|
||||||
for (i in 0 until childCount) {
|
|
||||||
val child = parent.getChildAt(i)
|
|
||||||
val params = child
|
|
||||||
.layoutParams as RecyclerView.LayoutParams
|
|
||||||
val left = child.left - params.leftMargin + padding
|
|
||||||
val right = child.right - padding //- params.rightMargin - divider.intrinsicWidth
|
|
||||||
val top = child.bottom + params.bottomMargin
|
|
||||||
val bottom = top + divider.intrinsicHeight
|
|
||||||
divider.setBounds(left, top, right, bottom)
|
|
||||||
divider.draw(c)
|
|
||||||
if (i < spanCount) { //画第一行顶部的分割线
|
|
||||||
drawHorizontalForFirstRow(c, child)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun drawHorizontalForFirstRow(c: Canvas, child: View) {
|
|
||||||
val params = child
|
|
||||||
.layoutParams as RecyclerView.LayoutParams
|
|
||||||
val left = child.left - params.leftMargin - divider.intrinsicWidth
|
|
||||||
val top = child.top - params.topMargin - divider.intrinsicHeight
|
|
||||||
val right = child.right + params.rightMargin + divider.intrinsicWidth
|
|
||||||
val bottom = top + divider.intrinsicHeight
|
|
||||||
divider.setBounds(left, top, right, bottom)
|
|
||||||
divider.draw(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getSpanCount(parent: RecyclerView): Int {
|
|
||||||
// 列数
|
|
||||||
var spanCount = -1
|
|
||||||
val layoutManager = parent.layoutManager
|
|
||||||
if (layoutManager is GridLayoutManager) {
|
|
||||||
spanCount = layoutManager.spanCount
|
|
||||||
} else if (layoutManager is StaggeredGridLayoutManager) {
|
|
||||||
spanCount = layoutManager
|
|
||||||
.spanCount
|
|
||||||
}
|
|
||||||
return spanCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.adapter
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.ProgressBar
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import kotlin.random.Random
|
|
||||||
|
|
||||||
|
|
||||||
class RoadCrossRoamListB4Adapter(private val mContext: Context) : RecyclerView.Adapter<RoadCrossRoamListB4Adapter.ViewHolder>() {
|
|
||||||
|
|
||||||
private val items: MutableList<String> = mutableListOf()
|
|
||||||
|
|
||||||
init {
|
|
||||||
// items.add("前方路况拥堵分析")
|
|
||||||
items.add(StringUtils.getString(R.string.module_och_analysis_traffic_conditions_ahead))
|
|
||||||
// items.add("路口危险车辆分析")
|
|
||||||
items.add(StringUtils.getString(R.string.module_och_analysis_dangerous_vehicles_intersections))
|
|
||||||
// items.add("路口交通事故分析")
|
|
||||||
items.add(StringUtils.getString(R.string.module_och_analysis_roadside_traffic_accidents))
|
|
||||||
// items.add("路口行人碰撞分析")
|
|
||||||
items.add(StringUtils.getString(R.string.module_och_analysis_pedestrian_collisions_crossroads))
|
|
||||||
// items.add("路口非机动车分析")
|
|
||||||
items.add(StringUtils.getString(R.string.module_och_analysis_non_motorized_vehicles_intersections))
|
|
||||||
// items.add("路口灯态分析")
|
|
||||||
items.add(StringUtils.getString(R.string.module_och_analysis_intersection_signal_status))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
|
||||||
val view: View =
|
|
||||||
LayoutInflater.from(mContext).inflate(R.layout.item_road_cross_ai_roam_tip_b4, parent, false)
|
|
||||||
return ViewHolder(view)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
|
||||||
return 6
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
|
||||||
val item = items[position]
|
|
||||||
holder.textView.setTextColor(mContext.getColor(R.color.color_191A1C))
|
|
||||||
holder.textView.text = item
|
|
||||||
// 随机决定是否显示ProgressBar
|
|
||||||
// if (Random.nextBoolean()) { // 50%的几率显示ProgressBar
|
|
||||||
holder.progressBar.visibility = View.VISIBLE
|
|
||||||
holder.checkIcon.visibility = View.INVISIBLE
|
|
||||||
|
|
||||||
val r0 = Random.nextInt(0, 3)
|
|
||||||
val r1 = Random.nextInt(1, 9)
|
|
||||||
// 模拟加载完成
|
|
||||||
holder.itemView.postDelayed({
|
|
||||||
holder.progressBar.visibility = View.INVISIBLE
|
|
||||||
holder.checkIcon.visibility = View.VISIBLE
|
|
||||||
}, r0 * 1000L + r1 * 100L)
|
|
||||||
// } else {
|
|
||||||
// holder.progressBar.visibility = View.GONE
|
|
||||||
// holder.checkIcon.visibility = View.VISIBLE
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
|
||||||
var textView: TextView = itemView.findViewById(R.id.b4TvRoadItemTip)
|
|
||||||
var progressBar: ProgressBar = itemView.findViewById(R.id.b4PbRoadItemTip)
|
|
||||||
var checkIcon: ImageView = itemView.findViewById(R.id.b4IvRoadItemTip)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean
|
|
||||||
|
|
||||||
import android.os.CountDownTimer
|
|
||||||
import android.util.Log
|
|
||||||
import com.mogo.eagle.core.data.v2x.RoadV2NEventType
|
|
||||||
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
|
|
||||||
import kotlin.math.floor
|
|
||||||
|
|
||||||
|
|
||||||
sealed class B4AIMessage(
|
|
||||||
open val id: String,
|
|
||||||
open val title: String,
|
|
||||||
open val tts: String = "",
|
|
||||||
val timestamp: Long = System.currentTimeMillis(),
|
|
||||||
var showTimestamp: Boolean = false
|
|
||||||
) {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TYPE_SCAN = 0
|
|
||||||
const val TYPE_EVENT = 1
|
|
||||||
const val TYPE_LIGHT = 3
|
|
||||||
const val TYPE_SPEED = 4
|
|
||||||
const val TYPE_WARNING = 5
|
|
||||||
const val TYPE_PNC_ACTION = 6
|
|
||||||
const val TYPE_ROAD_V2N = 7
|
|
||||||
const val TYPE_ROAD_CROSS = 8
|
|
||||||
const val TYPE_AUTOMATIC_EXPLORATION = 9
|
|
||||||
const val TYPE_NDE = 11
|
|
||||||
}
|
|
||||||
|
|
||||||
data class B4Scan(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
val pictureUrl: String = "",
|
|
||||||
var showScanFlag: Boolean = false
|
|
||||||
) : B4AIMessage(id, title)
|
|
||||||
|
|
||||||
data class B4Event(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
override val tts: String = "",
|
|
||||||
val position: String = "",
|
|
||||||
val distance: String = "",
|
|
||||||
val range: String = "",
|
|
||||||
val time: String = "",
|
|
||||||
val pictureUrl: String = "",
|
|
||||||
val videoUrl: String = "",
|
|
||||||
var showScanFlag: Boolean = false
|
|
||||||
) : B4AIMessage(id, title, tts)
|
|
||||||
|
|
||||||
data class B4QA(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
override val tts: String = "",
|
|
||||||
val question: String,
|
|
||||||
val answer: String,
|
|
||||||
var state: B4QuestionState = B4QuestionState.UNDERSTAND,
|
|
||||||
val pictureUrl: String = "",
|
|
||||||
var pictureUrlList: List<String> = listOf(),
|
|
||||||
val videoUrl: String = "",
|
|
||||||
) : B4AIMessage(id, title, tts) {
|
|
||||||
|
|
||||||
enum class B4QuestionState(val code: Int) {
|
|
||||||
UNDERSTAND(1),
|
|
||||||
ANALYZE(2),
|
|
||||||
ANSWER(3),
|
|
||||||
FINISH(4),
|
|
||||||
ERROR(-1),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class B4Light(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
override val tts: String = "",
|
|
||||||
var seconds: Int,
|
|
||||||
val status: Int
|
|
||||||
) : B4AIMessage(id, title, tts) {
|
|
||||||
private var countDownTimer: CountDownTimer? = null
|
|
||||||
private var listener: OnCountdownUpdateListener? = null
|
|
||||||
|
|
||||||
fun startCountdown(millisInFuture: Long, countDownInternal: Long) {
|
|
||||||
countDownTimer?.cancel()
|
|
||||||
countDownTimer = object : CountDownTimer(millisInFuture, countDownInternal) {
|
|
||||||
override fun onTick(millisUntilFinished: Long) {
|
|
||||||
//倒计时开始
|
|
||||||
Log.d(
|
|
||||||
"StartOrSlowDownTip",
|
|
||||||
"millisUntilFinished = $millisUntilFinished, countDownInternal = $countDownInternal"
|
|
||||||
)
|
|
||||||
val cd = millisUntilFinished / 1000.0
|
|
||||||
// val split = String.format("%.2f", cd).split(".")
|
|
||||||
seconds = floor(cd).toInt()
|
|
||||||
listener?.onCountdownUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFinish() {
|
|
||||||
//倒计时完成
|
|
||||||
seconds = 0
|
|
||||||
listener?.onCountdownFinish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
countDownTimer?.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun stopCountdown() {
|
|
||||||
countDownTimer?.cancel()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setOnCountdownUpdateListener(listener: OnCountdownUpdateListener) {
|
|
||||||
this.listener = listener
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OnCountdownUpdateListener {
|
|
||||||
fun onCountdownUpdate()
|
|
||||||
fun onCountdownFinish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
data class B4Speed(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
override val tts: String = "",
|
|
||||||
val speedMax: Int,
|
|
||||||
val speedMin: Int,
|
|
||||||
) : B4AIMessage(id, title, tts)
|
|
||||||
|
|
||||||
data class B4Warning(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
override val tts: String = "",
|
|
||||||
) : B4AIMessage(id, title, tts)
|
|
||||||
|
|
||||||
data class B4PNCAction(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
var actionDesc: String,
|
|
||||||
var timeStamp: Long = 0, //事件发生事件戳
|
|
||||||
) : B4AIMessage(id, title)
|
|
||||||
|
|
||||||
data class B4RoadV2NEvent(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
override val tts: String = "", //TTS的文案
|
|
||||||
var eventType: RoadV2NEventType, //事件弹框类型
|
|
||||||
var timeStamp: Long = 0, //事件发生事件戳
|
|
||||||
var iconResId: Int, //事件icon res id
|
|
||||||
var isNeedTTS: Boolean = false, //事件文案是否需要同步tts
|
|
||||||
var contentImageUrl: String, // Image 类型时图片 url
|
|
||||||
var cameraIp: String, // 路侧camera ip,用于请求获取拉流地址
|
|
||||||
var lon: Double, //事件坐标-经度
|
|
||||||
var lat: Double, //事件坐标-纬度
|
|
||||||
) : B4AIMessage(id, title, tts)
|
|
||||||
|
|
||||||
data class B4RoadCrossRoam(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String
|
|
||||||
) : B4AIMessage(id, title)
|
|
||||||
|
|
||||||
data class B4AutomaticExploration(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String
|
|
||||||
) : B4AIMessage(id, title)
|
|
||||||
|
|
||||||
data class B4EvaluateData(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
var isFirst: Boolean = true
|
|
||||||
) : B4AIMessage(id, title)
|
|
||||||
|
|
||||||
data class B4NDEData(
|
|
||||||
override val id: String,
|
|
||||||
override val title: String,
|
|
||||||
var desc: String,
|
|
||||||
var roadList: List<RoadMsg>
|
|
||||||
) : B4AIMessage(id, title)
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean
|
|
||||||
|
|
||||||
data class B4ListenUIState(val show: Boolean, val text: String, val showTips: Boolean = false)
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.data
|
|
||||||
|
|
||||||
import android.os.CountDownTimer
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
|
||||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
|
||||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
|
||||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
|
||||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
|
||||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自动探查
|
|
||||||
*/
|
|
||||||
class B4AutomaticExplorationViewModel : ViewModel(), IMsgBoxListener, ICommonCallback {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "B4AutomaticExplorationViewModel"
|
|
||||||
private const val EXPLORATION_SHOW_TIME = 300000L //距离用户在触发上一次事件播报的时间5分钟后,自动触发常规道路情况检测
|
|
||||||
}
|
|
||||||
|
|
||||||
private var showViewTimer: CountDownTimer? = null //展示自动探查倒计时
|
|
||||||
private var isCountingDown: Boolean = false //是否处于倒计时中
|
|
||||||
private var hasOrder: Boolean = false // 车当前是否有订单
|
|
||||||
|
|
||||||
fun init() {
|
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, this)
|
|
||||||
CallerMsgBoxListenerManager.addListener(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCleared() {
|
|
||||||
super.onCleared()
|
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, null)
|
|
||||||
CallerMsgBoxListenerManager.removeListener(TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun showNoTaskView(isTrue: Boolean) {
|
|
||||||
super.showNoTaskView(isTrue)
|
|
||||||
if (isTrue) {
|
|
||||||
cancelTimer()
|
|
||||||
currentOrderStatus(false)
|
|
||||||
} else {
|
|
||||||
startShowTimer()
|
|
||||||
currentOrderStatus(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) {
|
|
||||||
if (category == MsgCategory.NOTICE) {
|
|
||||||
if (msgBoxList.type == MsgBoxType.V2X) {
|
|
||||||
//重置倒计时时长
|
|
||||||
cancelTimer()
|
|
||||||
if (hasOrder) {
|
|
||||||
startShowTimer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消倒计时
|
|
||||||
*/
|
|
||||||
private fun cancelTimer() {
|
|
||||||
CallerLogger.d(TAG, "cancelTimer")
|
|
||||||
showViewTimer?.cancel()
|
|
||||||
showViewTimer = null
|
|
||||||
isCountingDown = false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始倒计时
|
|
||||||
*/
|
|
||||||
private fun startShowTimer() {
|
|
||||||
CallerLogger.d(TAG, "startShowTimer")
|
|
||||||
if (!isCountingDown) {
|
|
||||||
ThreadUtils.runOnUiThread {
|
|
||||||
if (showViewTimer == null) {
|
|
||||||
showViewTimer = object : CountDownTimer(EXPLORATION_SHOW_TIME, EXPLORATION_SHOW_TIME) {
|
|
||||||
override fun onTick(millisUntilFinished: Long) {
|
|
||||||
CallerLogger.d(TAG, "倒计时+:${millisUntilFinished}")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFinish() {
|
|
||||||
if (hasOrder) {
|
|
||||||
showAutoExploration()
|
|
||||||
}
|
|
||||||
isCountingDown = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isCountingDown = true
|
|
||||||
showViewTimer?.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置当前订单状态
|
|
||||||
* @param orderStatus true有订单;false没有订单
|
|
||||||
*/
|
|
||||||
private fun currentOrderStatus(orderStatus: Boolean) {
|
|
||||||
hasOrder = orderStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun showAutoExploration() {
|
|
||||||
val automaticExploration = B4AIMessage.B4AutomaticExploration(System.currentTimeMillis().toString(), "")
|
|
||||||
B4AIMessageManager.post(automaticExploration)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.data
|
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
|
||||||
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
|
||||||
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车龙信息
|
|
||||||
*/
|
|
||||||
class B4NDEViewModel : ViewModel(), BridgeListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "B4NDEViewModel"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun init() {
|
|
||||||
BridgeManager.addBridgeListener(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCleared() {
|
|
||||||
super.onCleared()
|
|
||||||
BridgeManager.removeBridgeListener(TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNdeDataListener(title: String, desc: String, sortedList: List<RoadMsg>) {
|
|
||||||
val ndeEvent = B4AIMessage.B4NDEData(System.currentTimeMillis().toString(), title, desc, sortedList)
|
|
||||||
B4AIMessageManager.post(ndeEvent)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,357 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.data
|
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import com.mogo.eagle.core.data.autopilot.pnc.PncActionsHelper
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
|
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
|
||||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
|
||||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
|
||||||
import com.mogo.och.data.bean.BusStationBean
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.model.CommonModel
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import mogo.telematics.pad.MessagePad
|
|
||||||
|
|
||||||
class B4PNCActionsViewModel : ViewModel(), IMoGoAutopilotPlanningActionsListener, ICommonCallback {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "B4PNCActionsViewModel"
|
|
||||||
}
|
|
||||||
|
|
||||||
private var currentAction = ""
|
|
||||||
|
|
||||||
private var currentStation: BusStationBean? = null
|
|
||||||
|
|
||||||
fun init() {
|
|
||||||
CallerPlanningActionsListenerManager.addListener(TAG, this)
|
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCleared() {
|
|
||||||
super.onCleared()
|
|
||||||
CallerPlanningActionsListenerManager.removeListener(TAG)
|
|
||||||
CommonModel.setRouteLineInfoCallback(TAG, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateStationsInfo(
|
|
||||||
stations: MutableList<BusStationBean>?,
|
|
||||||
currentStationIndex: Int,
|
|
||||||
isArrived: Boolean
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
currentStation = stations?.get(currentStationIndex)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
OchChainLogManager.writeChainLogError("PNCActionsViewModel 设置错误", "${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun showNoTaskView(isTrue: Boolean) {
|
|
||||||
super.showNoTaskView(isTrue)
|
|
||||||
if (isTrue) {
|
|
||||||
currentStation = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) {
|
|
||||||
try {
|
|
||||||
BizLoopManager.runInMainThread {
|
|
||||||
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
|
||||||
var actions: String? = null
|
|
||||||
planningActionMsg.actionMsg?.let {
|
|
||||||
try {
|
|
||||||
actions = PncActionsHelper.getAction(
|
|
||||||
it.drivingState.number,
|
|
||||||
it.drivingAction.number
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
planningActionMsg.v2NActionMsgList?.forEach { v2nAction ->
|
|
||||||
actions = PncActionsHelper.getAction(
|
|
||||||
v2nAction.drivingState.number,
|
|
||||||
v2nAction.drivingAction.number
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// update view
|
|
||||||
actions?.let {
|
|
||||||
if (it.isNotEmpty() && it != currentAction) {
|
|
||||||
currentAction = it
|
|
||||||
val title = getActionTitle(it)
|
|
||||||
if (title.isNotEmpty()) {
|
|
||||||
val desc = getActionDesc(title)
|
|
||||||
val action = B4AIMessage.B4PNCAction(it + System.currentTimeMillis(), title, desc, System.currentTimeMillis())
|
|
||||||
B4AIMessageManager.post(action)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getActionTitle(pncAction: String): String {
|
|
||||||
return when (pncAction) {
|
|
||||||
// "正在进站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_entering_the_station) -> {
|
|
||||||
// "车辆进站"
|
|
||||||
StringUtils.getString(R.string.module_core_entering_the_station_title)
|
|
||||||
}
|
|
||||||
// "等待进站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_await_station) -> {
|
|
||||||
// "车辆等待进站"
|
|
||||||
StringUtils.getString(R.string.module_core_await_station_title)
|
|
||||||
}
|
|
||||||
// "正在出站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_leaving_the_station) -> {
|
|
||||||
// "车辆出站"
|
|
||||||
StringUtils.getString(R.string.module_core_leaving_the_station_title)
|
|
||||||
}
|
|
||||||
// "等待出站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_await_leaving_the_station) -> {
|
|
||||||
// "车辆等待出站"
|
|
||||||
StringUtils.getString(R.string.module_core_await_leaving_the_station_title)
|
|
||||||
}
|
|
||||||
// "正在向左变道"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left) -> {
|
|
||||||
// "车辆向左变道"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_title)
|
|
||||||
}
|
|
||||||
// "正在向右变道"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right) -> {
|
|
||||||
// "车辆向右变道"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right_title)
|
|
||||||
}
|
|
||||||
// "正在完成变道"->{
|
|
||||||
StringUtils.getString(R.string.module_core_completing_lane_change) -> {
|
|
||||||
// "车辆完成变道"
|
|
||||||
StringUtils.getString(R.string.module_core_completing_lane_change_title)
|
|
||||||
}
|
|
||||||
// "正在绕过障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_bypassing_obstacle) -> {
|
|
||||||
// "车辆正在绕过前方障碍物"
|
|
||||||
StringUtils.getString(R.string.module_core_bypassing_obstacle_title)
|
|
||||||
}
|
|
||||||
// "正在向左绕行避让前方静止障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_stationary_obstacle_ahead) -> {
|
|
||||||
// "车辆正在绕过前方障碍物"
|
|
||||||
StringUtils.getString(R.string.module_core_bypassing_obstacle_title)
|
|
||||||
}
|
|
||||||
// "正在向右绕行避让前方静止障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_right_to_bypass_stationary_obstacle_ahead) -> {
|
|
||||||
// "车辆正在绕过前方障碍物"
|
|
||||||
StringUtils.getString(R.string.module_core_bypassing_obstacle_title)
|
|
||||||
}
|
|
||||||
// "正在避让障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_obstacle) -> {
|
|
||||||
// "车辆正在避让前方障碍物"
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_obstacle_title)
|
|
||||||
}
|
|
||||||
// "正在向左变道避让前方静止障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_stationary_obstacle_ahead) -> {
|
|
||||||
// "车辆正在避让前方障碍物"
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_obstacle_title)
|
|
||||||
}
|
|
||||||
// "正在向右变道避让前方静止障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right_to_avoid_stationary_obstacle_ahead) -> {
|
|
||||||
// "车辆正在避让前方障碍物"
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_obstacle_title)
|
|
||||||
}
|
|
||||||
// "正在等红灯"->{
|
|
||||||
StringUtils.getString(R.string.module_core_waiting_for_red_light) -> {
|
|
||||||
// "路口等红灯"
|
|
||||||
StringUtils.getString(R.string.module_core_waiting_for_red_light_title)
|
|
||||||
}
|
|
||||||
// "正在向左变道避让前方道路施工"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_construction_ahead) -> {
|
|
||||||
// "车辆正在变道避让前方道路施工"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_construction_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向右变道避让前方道路施工"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right_to_avoid_road_construction_ahead) -> {
|
|
||||||
// "车辆正在变道避让前方道路施工"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_construction_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向左绕行避让前方道路施工"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_construction_ahead) -> {
|
|
||||||
// "车辆正在绕行避让前方道路施工"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_construction_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向右绕行避让前方道路施工"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_right_to_bypass_road_construction_ahead) -> {
|
|
||||||
// "车辆正在绕行避让前方道路施工"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_construction_ahead_title)
|
|
||||||
}
|
|
||||||
|
|
||||||
// "正在向左变道避让前方道路事故"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_accident_ahead) -> {
|
|
||||||
// "车辆正在变道避让前方道路事故"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_accident_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向右变道避让前方道路事故"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right_to_avoid_road_accident_ahead) -> {
|
|
||||||
// "车辆正在变道避让前方道路事故"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_accident_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向左绕行避让前方道路事故"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_accident_ahead) -> {
|
|
||||||
// "车辆正在绕行避让前方道路事故"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_accident_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向右绕行避让前方道路事故"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_right_to_bypass_road_accident_ahead) -> {
|
|
||||||
// "车辆正在绕行避让前方道路事故"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_accident_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在跟随车辆行驶"->{
|
|
||||||
StringUtils.getString(R.string.module_core_following_vehicle_driving) -> {
|
|
||||||
// "车辆正在跟车通行"
|
|
||||||
StringUtils.getString(R.string.module_core_following_vehicle_driving_title)
|
|
||||||
}
|
|
||||||
// "正在跟车行驶"->{
|
|
||||||
StringUtils.getString(R.string.module_core_following_the_vehicle_ahead) -> {
|
|
||||||
// "车辆正在跟车通行"
|
|
||||||
StringUtils.getString(R.string.module_core_following_vehicle_driving_title)
|
|
||||||
}
|
|
||||||
// "正在向左变道避让前方车龙"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_left_avoid_vehicle_queue_ahead) -> {
|
|
||||||
// "车辆正在绕行前方车龙"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_left_avoid_vehicle_queue_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在向右变道避让前方车龙"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_right_avoid_vehicle_queue_ahead) -> {
|
|
||||||
// "车辆正在绕行前方车龙"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_left_avoid_vehicle_queue_ahead_title)
|
|
||||||
}
|
|
||||||
// "正在使用云端规划通过路口"->{
|
|
||||||
StringUtils.getString(R.string.module_core_using_cloud_planning_pass_intersection) -> {
|
|
||||||
// "车辆正在使用云端轨迹通行"
|
|
||||||
StringUtils.getString(R.string.module_core_using_cloud_planning_pass_intersection_title)
|
|
||||||
}
|
|
||||||
// "正在避让后方来车"->{
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_oncoming_vehicles_from_behind) -> {
|
|
||||||
// "车辆正在避让后方来车"
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_oncoming_vehicles_from_behind_title)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getActionDesc(action: String): String {
|
|
||||||
return when (action) {
|
|
||||||
// "车辆进站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_entering_the_station_title) -> {
|
|
||||||
// "前方即将到达${CommonModel.routesResult}," +
|
|
||||||
// "车辆正在规划减速并进站停靠,请安心等待车辆停稳再下车哦~"
|
|
||||||
StringUtils.getString(R.string.module_core_entering_the_station_desc, CommonModel.routesResult)
|
|
||||||
}
|
|
||||||
// "车辆等待进站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_await_station_title) -> {
|
|
||||||
// "车辆待环境安全后进站,耐心等几秒,安全比赶路更重要~"
|
|
||||||
StringUtils.getString(R.string.module_core_await_station_desc)
|
|
||||||
}
|
|
||||||
// "车辆出站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_leaving_the_station_title) -> {
|
|
||||||
// "欢迎乘坐MOGO RoboTaxi~车辆正在规划出站,坐稳扶好哦,我们出发啦!小智持续守护您的行程。"
|
|
||||||
StringUtils.getString(R.string.module_core_leaving_the_station_desc_bus)
|
|
||||||
}
|
|
||||||
// "车辆等待出站"->{
|
|
||||||
StringUtils.getString(R.string.module_core_await_leaving_the_station_title) -> {
|
|
||||||
// "车辆待环境安全后出站,耐心等几秒,安全比赶路更重要~"
|
|
||||||
StringUtils.getString(R.string.module_core_await_leaving_the_station_desc)
|
|
||||||
}
|
|
||||||
// "车辆向左变道"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_title) -> {
|
|
||||||
// "确认环境安全,车辆正在规划平稳向左变道,同时持续监测周边交通参与者动向,放心交给我们吧!"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_desc)
|
|
||||||
}
|
|
||||||
// "车辆向右变道"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right_title) -> {
|
|
||||||
// "确认环境安全,车辆正在规划平稳向右变道,同时持续监测周边交通参与者动向,放心交给我们吧!"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_right_desc)
|
|
||||||
}
|
|
||||||
// "车辆完成变道"->{
|
|
||||||
StringUtils.getString(R.string.module_core_completing_lane_change_title) -> {
|
|
||||||
// "变道完成啦,继续前进!小智持续守护您的行程。"
|
|
||||||
StringUtils.getString(R.string.module_core_completing_lane_change_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在绕过前方障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_stationary_obstacle_ahead_title) -> {
|
|
||||||
// "发现前方障碍物,车辆正在规划平稳变道,即将画出一条完美弧线~"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_stationary_obstacle_ahead_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在避让前方障碍物"->{
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_obstacle_title) -> {
|
|
||||||
// "发现前方障碍物,车辆正在规划平稳避让,诠释优雅与丝滑~"
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_obstacle_desc)
|
|
||||||
}
|
|
||||||
// "车辆完成绕障"->{
|
|
||||||
StringUtils.getString(R.string.module_core_vehicle_completed_obstacle_avoidance_title) -> {
|
|
||||||
// "绕障完成啦,继续前进!小智持续守护您的行程。"
|
|
||||||
StringUtils.getString(R.string.module_core_vehicle_completed_obstacle_avoidance_desc)
|
|
||||||
}
|
|
||||||
// "路口等红灯"->{
|
|
||||||
StringUtils.getString(R.string.module_core_waiting_for_red_light_title) -> {
|
|
||||||
// "车辆正在路口等红灯,可以安心放空望望窗外~小智一直在您身边哦!"
|
|
||||||
StringUtils.getString(R.string.module_core_waiting_for_red_light_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在变道避让前方道路施工"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_construction_ahead_title) -> {
|
|
||||||
// "车辆正在提前规划变道避让前方道路施工,稳稳的很安心~您已体验到车路云一体化协同应用场景,是当之无愧的先锋体验官!"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_construction_ahead_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在绕行避让前方道路施工"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_construction_ahead_title) -> {
|
|
||||||
// "车辆正在提前规划绕行避让前方道路施工,稳稳的很安心~您已体验到车路云一体化协同应用场景,是当之无愧的先锋体验官!"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_construction_ahead_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在变道避让前方道路事故"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_accident_ahead_title) -> {
|
|
||||||
// "车辆正在提前规划变道避让前方道路事故,放心看我表现吧!您已体验到车路云一体化协同应用场景,小智为您欢呼!"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_to_left_to_avoid_road_accident_ahead_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在绕行避让前方道路事故"->{
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_accident_ahead_title) -> {
|
|
||||||
// "车辆正在提前规划绕行避让前方道路事故,放心看我表现吧!您已体验到车路云一体化协同应用场景,小智为您欢呼!"
|
|
||||||
StringUtils.getString(R.string.module_core_turning_left_to_bypass_road_accident_ahead_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在跟车通行"->{
|
|
||||||
StringUtils.getString(R.string.module_core_following_vehicle_driving_title) -> {
|
|
||||||
// "车辆正在跟随前车通行,舒适度MAX~您已体验到车路云一体化协同应用场景,超越全国99%的乘客!"
|
|
||||||
StringUtils.getString(R.string.module_core_following_vehicle_driving_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在绕行前方车龙"->{
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_left_avoid_vehicle_queue_ahead_title) -> {
|
|
||||||
// "车辆正在提前规划变道避让路口车龙,舒适度MAX~。您已体验到车路云一体化协同应用场景,超越全国99%的乘客!"
|
|
||||||
StringUtils.getString(R.string.module_core_changing_lane_left_avoid_vehicle_queue_ahead_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在使用云端轨迹通行"->{
|
|
||||||
StringUtils.getString(R.string.module_core_using_cloud_planning_pass_intersection_title) -> {
|
|
||||||
// "前方智慧路口内有障碍物,车辆正在使用云端规划轨迹通行。您已体验到车路云一体化协同应用场景,超越全国99%的乘客!"
|
|
||||||
StringUtils.getString(R.string.module_core_using_cloud_planning_pass_intersection_desc)
|
|
||||||
}
|
|
||||||
// "车辆正在避让后方来车"->{
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_oncoming_vehicles_from_behind_title) -> {
|
|
||||||
// "车辆正在避让后方来车,耐心等几秒,安全比赶路更重要~"
|
|
||||||
StringUtils.getString(R.string.module_core_avoiding_oncoming_vehicles_from_behind_desc)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.data
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import com.mogo.commons.voice.AIAssist
|
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
|
||||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerServicesEventManager
|
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
|
||||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
|
|
||||||
class B4RoadCrossRoamViewModel : ViewModel(), IMoGoMapRoadListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "B4RoadCrossRoamViewModel"
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var mContext: Context
|
|
||||||
|
|
||||||
fun init(context: Context) {
|
|
||||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
|
||||||
mContext = context
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCrossDevice(trigger: Boolean) {
|
|
||||||
super.onCrossDevice(trigger)
|
|
||||||
if (trigger) {
|
|
||||||
show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun show() {
|
|
||||||
// 没有路线不做提示
|
|
||||||
if (CallerAutoPilotStatusListenerManager.getLineId() == 0L) {
|
|
||||||
CallerLogger.d(TAG, "没有路线不做提示")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 首页被遮挡不做提示
|
|
||||||
if (!CallerHmiViewControlListenerManager.getMainPageVisible()) {
|
|
||||||
CallerLogger.d(TAG, "attachView return , mainPageVisible is false")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 没有路侧设备,不做处理
|
|
||||||
CallerLogger.d(TAG, "命中,attachView")
|
|
||||||
val cross = CallerMapRoadListenerManager.getCrossEndInfo()
|
|
||||||
if (cross.isNullOrEmpty()) {
|
|
||||||
CallerLogger.d(TAG, "未触发,路口ID:$cross")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
|
||||||
// val disStr = "为您提供路口全息影像,助力出行"
|
|
||||||
val disStr = StringUtils.getString(R.string.module_och_offer_intersection_holographic_image)
|
|
||||||
AIAssist.getInstance(mContext).speakTTSVoiceWithLevel(disStr, AIAssist.NEW_LEVEL_2)
|
|
||||||
}
|
|
||||||
CallerServicesEventManager.updateServicesNum(CallerServicesEventManager.ServiceType.ROAD)
|
|
||||||
B4AIMessageManager.post(B4AIMessage.B4RoadCrossRoam(System.currentTimeMillis().toString(), ""))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.mind.data
|
|
||||||
|
|
||||||
import androidx.lifecycle.ProcessLifecycleOwner
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
|
||||||
import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean
|
|
||||||
import com.mogo.eagle.core.function.api.hmi.v2n.IRoadV2NEventWindowListener
|
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
|
||||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog
|
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4AIMessageManager
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.B4AIMessage
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
class B4RoadV2NEventViewModel : ViewModel(), IRoadV2NEventWindowListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "B4RoadV2NEventViewModel"
|
|
||||||
const val ANALYTICS_KEY = "hmi_road_event_window_view"
|
|
||||||
|
|
||||||
fun trackEvent(msg: String) {
|
|
||||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.IO) {
|
|
||||||
val map: MutableMap<String, Any> = HashMap()
|
|
||||||
map["msg"] = msg
|
|
||||||
MogoAnalyticUtils.track(
|
|
||||||
ANALYTICS_KEY,
|
|
||||||
map
|
|
||||||
)
|
|
||||||
HmiActionLog.hmiAction(TAG, msg)
|
|
||||||
}
|
|
||||||
CallerLogger.i(TAG, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun init() {
|
|
||||||
CallerRoadV2NEventWindowListenerManager.addListener(TAG, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun show(dataBean: RoadV2NEventWindowBean) {
|
|
||||||
trackEvent("show --> $dataBean")
|
|
||||||
val canShowV2NEventWindowView = CallerHmiViewControlListenerManager.getMainPageVisible()
|
|
||||||
if (!canShowV2NEventWindowView) {
|
|
||||||
trackEvent("show --> 当前不在高精地图页面,跳过")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val lineId = CallerAutoPilotStatusListenerManager.getLineId()
|
|
||||||
if (lineId <= 0) {
|
|
||||||
trackEvent("show --> 当前无订单,跳过")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val event = B4AIMessage.B4RoadV2NEvent(
|
|
||||||
dataBean.eventId,
|
|
||||||
dataBean.hintStr,
|
|
||||||
"",
|
|
||||||
dataBean.eventType,
|
|
||||||
dataBean.timestamp,
|
|
||||||
dataBean.iconResId,
|
|
||||||
false,
|
|
||||||
dataBean.contentImageUrl,
|
|
||||||
dataBean.cameraIp,
|
|
||||||
dataBean.lon,
|
|
||||||
dataBean.lat
|
|
||||||
)
|
|
||||||
B4AIMessageManager.post(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun dismiss(eventId: String) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.mogo.och.shuttle.weaknet.passenger.ui.widget
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import com.mogo.eagle.core.function.view.MapBizView
|
|
||||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
|
||||||
|
|
||||||
class B4OchMapBizPView(context: Context?, attrs: AttributeSet?) : MapBizView(context, attrs) {
|
|
||||||
|
|
||||||
|
|
||||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
|
||||||
super.onSizeChanged(w, h, oldw, oldh)
|
|
||||||
this.outlineProvider =
|
|
||||||
TextureVideoViewOutlineProvider(AutoSizeUtils.dp2px(context, 36f).toFloat())
|
|
||||||
this.clipToOutline = true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ import com.mogo.och.shuttle.weaknet.passenger.model.TicketModel
|
|||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPassengerRouteFragment
|
import com.mogo.och.shuttle.weaknet.passenger.ui.BusPassengerRouteFragment
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.PB4BaseFragment
|
import com.mogo.och.shuttle.weaknet.passenger.ui.PB4BaseFragment
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.PM2BaseFragment
|
import com.mogo.och.shuttle.weaknet.passenger.ui.PM2BaseFragment
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.statusbar.B4StatusBarView
|
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.statusbar.M2StatusBarView
|
import com.mogo.och.shuttle.weaknet.passenger.ui.statusbar.M2StatusBarView
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.ui.widget.BusPStatusBarView
|
import com.mogo.och.shuttle.weaknet.passenger.ui.widget.BusPStatusBarView
|
||||||
|
|
||||||
@@ -33,19 +32,19 @@ class ShuttlePassengerProvider : CommonServiceImpl() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStatusBarView(context: Context): View {
|
override fun getStatusBarView(context: Context): View? {
|
||||||
if (statusBarView == null) {
|
if (statusBarView == null) {
|
||||||
statusBarView = if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
statusBarView = if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||||
M2StatusBarView(context);
|
M2StatusBarView(context);
|
||||||
} else if (AppIdentityModeUtils.isB4(FunctionBuildConfig.appIdentityMode)) {
|
} else if (AppIdentityModeUtils.isB4(FunctionBuildConfig.appIdentityMode)) {
|
||||||
//TODO 返回null 没有状态栏
|
null
|
||||||
} else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
} else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||||
BusPStatusBarView(context);
|
BusPStatusBarView(context);
|
||||||
} else {
|
} else {
|
||||||
BusPStatusBarView(context);
|
BusPStatusBarView(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return statusBarView!!
|
return statusBarView
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFragment(): Fragment {
|
override fun getFragment(): Fragment {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 791 B |
|
Before Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 828 B |
|
Before Width: | Height: | Size: 841 B |
|
Before Width: | Height: | Size: 899 B |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 973 B |
|
Before Width: | Height: | Size: 1018 B |
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="#DDDDDD" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<item>
|
|
||||||
<inset android:inset="100dp">
|
|
||||||
<bitmap android:src="@drawable/b4_icon_image_error" />
|
|
||||||
</inset>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</layer-list>
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="#DDDDDD" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<inset android:inset="100dp">
|
|
||||||
<bitmap android:src="@drawable/b4_icon_image_holder" />
|
|
||||||
</inset>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</layer-list>
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="@dimen/dp_373"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvScan"
|
|
||||||
android:layout_width="@dimen/dp_18"
|
|
||||||
android:layout_height="@dimen/dp_18"
|
|
||||||
android:layout_marginStart="@dimen/dp_18"
|
|
||||||
android:layout_marginTop="@dimen/dp_28"
|
|
||||||
android:src="@drawable/b4_mind_item_icon"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvExplorationTitle"
|
|
||||||
android:layout_width="@dimen/dp_0"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_19"
|
|
||||||
android:layout_marginEnd="@dimen/dp_13"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="start|top"
|
|
||||||
android:text="@string/exploration_title"
|
|
||||||
android:textColor="@color/b4_394047"
|
|
||||||
android:textSize="@dimen/dp_20"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/b4IvScan"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/b4RvExplorationList"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_14"
|
|
||||||
android:layout_marginBottom="@dimen/dp_14"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/b4TvExplorationTitle"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/b4TvExplorationTitle" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="@dimen/dp_373"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvNdeImage"
|
|
||||||
android:layout_width="@dimen/dp_18"
|
|
||||||
android:layout_height="@dimen/dp_18"
|
|
||||||
android:layout_marginStart="@dimen/dp_18"
|
|
||||||
android:layout_marginTop="@dimen/dp_28"
|
|
||||||
android:src="@drawable/b4_mind_item_icon"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvNdeHintContent"
|
|
||||||
android:layout_width="@dimen/dp_0"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_19"
|
|
||||||
android:layout_marginEnd="@dimen/dp_13"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="start|top"
|
|
||||||
android:textColor="@color/b4_394047"
|
|
||||||
android:textSize="@dimen/dp_20"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/b4IvNdeImage"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="前方路口有车龙" />
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/b4RvNdeList"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/dp_140"
|
|
||||||
android:layout_marginStart="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_15"
|
|
||||||
android:layout_marginEnd="@dimen/dp_13"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/b4IvNdeImage"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/b4IvNdeImage" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/clRoadLayout"
|
|
||||||
android:layout_width="@dimen/dp_90"
|
|
||||||
android:layout_height="@dimen/dp_120"
|
|
||||||
android:maxWidth="@dimen/dp_180"
|
|
||||||
android:minWidth="@dimen/dp_90">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvRoadType"
|
|
||||||
android:layout_width="@dimen/dp_55"
|
|
||||||
android:layout_height="@dimen/dp_55"
|
|
||||||
android:contentDescription="@string/nde_road_icon"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvRoadStatus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_12"
|
|
||||||
android:textSize="@dimen/sp_22"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/b4IvRoadType" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/b4ViewDivider"
|
|
||||||
android:layout_width="@dimen/dp_4"
|
|
||||||
android:layout_height="@dimen/dp_0"
|
|
||||||
android:background="@color/msg_nde_road_divider"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="@dimen/dp_373"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvPncImage"
|
|
||||||
android:layout_width="@dimen/dp_18"
|
|
||||||
android:layout_height="@dimen/dp_18"
|
|
||||||
android:layout_marginStart="@dimen/dp_18"
|
|
||||||
android:layout_marginTop="@dimen/dp_28"
|
|
||||||
android:src="@drawable/b4_mind_item_icon"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvPNCHintContent"
|
|
||||||
android:layout_width="@dimen/dp_0"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_19"
|
|
||||||
android:layout_marginEnd="@dimen/dp_13"
|
|
||||||
android:layout_marginBottom="@dimen/dp_29"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="start|top"
|
|
||||||
android:textColor="@color/b4_394047"
|
|
||||||
android:textSize="@dimen/dp_20"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/b4IvPncImage"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="前方100米有道路施工,施工长度100米,影响第1、2车道通行。正在向第3车道变道避让前方施工区域" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="@dimen/dp_373"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvZhiRoadRoamView"
|
|
||||||
android:layout_width="@dimen/dp_18"
|
|
||||||
android:layout_height="@dimen/dp_18"
|
|
||||||
android:layout_marginStart="@dimen/dp_18"
|
|
||||||
android:layout_marginTop="@dimen/dp_28"
|
|
||||||
android:src="@drawable/b4_mind_item_icon"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvRoadRoamTitle"
|
|
||||||
android:layout_width="@dimen/dp_0"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_19"
|
|
||||||
android:layout_marginEnd="@dimen/dp_13"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="start|top"
|
|
||||||
android:text="@string/road_cross_roam_tip"
|
|
||||||
android:textColor="@color/b4_394047"
|
|
||||||
android:textSize="@dimen/dp_20"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/b4IvZhiRoadRoamView"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/b4LvRoadCrossRoamTip"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
|
||||||
android:layout_marginBottom="@dimen/dp_29"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/b4TvRoadRoamTitle"
|
|
||||||
app:layout_constraintRight_toRightOf="@+id/b4TvRoadRoamTitle"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/b4TvRoadRoamTitle" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/containerEventContent"
|
|
||||||
android:layout_width="@dimen/dp_373"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvV2XImage"
|
|
||||||
android:layout_width="@dimen/dp_18"
|
|
||||||
android:layout_height="@dimen/dp_18"
|
|
||||||
android:layout_marginStart="@dimen/dp_18"
|
|
||||||
android:layout_marginTop="@dimen/dp_28"
|
|
||||||
android:src="@drawable/b4_mind_item_icon"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvV2XHintContent"
|
|
||||||
android:layout_width="@dimen/dp_0"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_11"
|
|
||||||
android:layout_marginTop="@dimen/dp_19"
|
|
||||||
android:layout_marginEnd="@dimen/dp_13"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="start|top"
|
|
||||||
android:textColor="@color/b4_394047"
|
|
||||||
android:textSize="@dimen/dp_20"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/b4IvV2XImage"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:text="前方100米有道路施工,施工长度100米,影响第1、2车道通行。正在向第3车道变道避让前方施工区域" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/b4ContainerImageAndLiveVideo"
|
|
||||||
android:layout_width="@dimen/dp_321"
|
|
||||||
android:layout_height="@dimen/dp_207"
|
|
||||||
android:layout_marginTop="@dimen/dp_16"
|
|
||||||
android:layout_marginBottom="@dimen/dp_29"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/b4TvV2XHintContent"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/b4TvV2XHintContent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/b4TvV2XHintContent">
|
|
||||||
|
|
||||||
<com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventLivePlayView
|
|
||||||
android:id="@+id/b4LivePlayView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:visibility="visible" />
|
|
||||||
|
|
||||||
<com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView
|
|
||||||
android:id="@+id/b4ContentImageView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:visibility="visible"
|
|
||||||
app:miv_radius="@dimen/dp_16"
|
|
||||||
app:miv_shape="round"
|
|
||||||
tools:src="@drawable/bg_v2x_bus_station" />
|
|
||||||
</FrameLayout>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="@dimen/dp_411"
|
|
||||||
android:layout_height="@dimen/dp_650"
|
|
||||||
android:background="@drawable/b4_mind_bg"
|
|
||||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/b4_rv_mind_list"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginStart="@dimen/dp_19"
|
|
||||||
android:layout_marginTop="@dimen/dp_17"
|
|
||||||
android:layout_marginEnd="@dimen/dp_19"
|
|
||||||
android:layout_marginBottom="@dimen/dp_21"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:layout_width="@dimen/dp_373"
|
|
||||||
android:layout_height="@dimen/dp_70"
|
|
||||||
android:layout_marginTop="@dimen/dp_17"
|
|
||||||
android:src="@drawable/b4_mind_top_shader"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_34"
|
|
||||||
android:text="MogoMind"
|
|
||||||
android:textColor="@color/b4_394047"
|
|
||||||
android:textSize="@dimen/dp_24"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</merge>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_6"
|
|
||||||
android:layout_marginBottom="@dimen/dp_6"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
tools:ignore="UseCompoundDrawables">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvExplorationLoading"
|
|
||||||
android:layout_width="@dimen/dp_20"
|
|
||||||
android:layout_height="@dimen/dp_20"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:contentDescription="@string/exploration_loading"
|
|
||||||
android:src="@drawable/icon_exploration_loading_p" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvExplorationContent"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="@dimen/dp_7"
|
|
||||||
android:textColor="@color/auto_exploration_content_p"
|
|
||||||
android:textSize="@dimen/sp_19" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_6"
|
|
||||||
android:layout_marginBottom="@dimen/dp_6">
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/b4PbRoadItemTip"
|
|
||||||
android:layout_width="@dimen/dp_20"
|
|
||||||
android:layout_height="@dimen/dp_20"
|
|
||||||
android:indeterminateBehavior="repeat"
|
|
||||||
android:indeterminateDrawable="@drawable/anim_road_cross_progress"
|
|
||||||
android:indeterminateOnly="true"
|
|
||||||
android:visibility="visible"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/b4IvRoadItemTip"
|
|
||||||
android:layout_width="@dimen/dp_20"
|
|
||||||
android:layout_height="@dimen/dp_20"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:src="@drawable/icon_road_roam_tip"
|
|
||||||
android:visibility="visible"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/b4TvRoadItemTip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_7"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_19"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/b4IvRoadItemTip"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -10,11 +10,17 @@
|
|||||||
android:id="@+id/b4_hd_map_fragment"
|
android:id="@+id/b4_hd_map_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="@dimen/dp_14"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/b4_driving_fragment" />
|
app:layout_constraintTop_toBottomOf="@+id/b4_driving_fragment" />
|
||||||
|
|
||||||
|
<com.mogo.och.common.module.wigets.LoadingMapStatusView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/b4_hd_map_fragment"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/b4_hd_map_fragment"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/b4_hd_map_fragment"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/b4_hd_map_fragment" />
|
||||||
|
|
||||||
<!-- 行车卡片--><!-- 全览地图带站点-->
|
<!-- 行车卡片--><!-- 全览地图带站点-->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
@@ -26,65 +32,16 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/b4_video_fragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="562.5dp"
|
|
||||||
android:layout_marginStart="@dimen/dp_40"
|
|
||||||
android:layout_marginEnd="@dimen/dp_40"
|
|
||||||
android:layout_marginBottom="@dimen/dp_40"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1290dp"
|
|
||||||
android:src="@drawable/b4_map_video_bg"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/b4_tv_shuttle_b2_p_version"
|
android:id="@+id/b4_tv_shuttle_b2_p_version"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/dp_8"
|
||||||
android:textColor="@color/shuttle_p_b4_color_A5B6C7"
|
android:textColor="@color/shuttle_p_b4_color_A5B6C7"
|
||||||
android:textSize="@dimen/dp_14"
|
android:textSize="@dimen/dp_14"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
app:layout_constraintTop_toBottomOf="@+id/b4_video_fragment" />
|
|
||||||
|
|
||||||
<com.mogo.och.common.module.wigets.LoadingMapStatusView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
|
||||||
android:id="@+id/b4_test1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="测试1" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
|
||||||
android:id="@+id/b4_test2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="测试2" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
|
||||||
android:id="@+id/b4_test3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="测试3" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -6,70 +6,32 @@
|
|||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="@dimen/dp_996"
|
android:layout_width="0dp"
|
||||||
android:layout_height="@dimen/dp_650"
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
<!-- 高精地图 -->
|
<!-- 高精地图 -->
|
||||||
<com.mogo.och.shuttle.weaknet.passenger.ui.widget.B4OchMapBizPView
|
<com.mogo.eagle.core.function.view.MapBizView
|
||||||
android:id="@+id/b4HomeView"
|
android:id="@+id/b4HomeView"
|
||||||
android:layout_width="@dimen/dp_996"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dp_650"
|
android:layout_height="match_parent"
|
||||||
app:isWeatherEnable="false"
|
app:isWeatherEnable="false"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:locationIcon3DRes="@raw/m2"
|
app:locationIcon3DRes="@raw/b4"
|
||||||
app:styleMode="MAP_STYLE_DAY_VR" />
|
app:styleMode="MAP_STYLE_DAY_VR" />
|
||||||
|
|
||||||
<!-- 全览地图带站点-->
|
|
||||||
<com.mogo.eagle.core.function.view.OverMapView
|
|
||||||
android:id="@+id/b4OverMapView"
|
|
||||||
android:layout_width="@dimen/dp_996"
|
|
||||||
android:layout_height="@dimen/dp_650"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:arrivedDrawable="@drawable/shuttle_p_b4_amap_arrived_road"
|
|
||||||
app:carDrawable="@drawable/shuttle_p_b4_map_car_icon"
|
|
||||||
app:compassDrawable="@drawable/shuttle_p_b4_amap_custom_corner"
|
|
||||||
app:isClearArrived="false"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:mapStyleExtraPath="@string/shuttle_p_b4_over_map_style_extra_path"
|
|
||||||
app:mapStylePath="@string/shuttle_p_b4_over_map_style_path"
|
|
||||||
app:mapTilt="0"
|
|
||||||
app:unArrivedDrawable="@drawable/shuttle_p_b4_amap_arriving_road" />
|
|
||||||
|
|
||||||
<!--虚化阴影-->
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/b4_aciv_top_shader"
|
|
||||||
android:layout_width="@dimen/dp_430"
|
|
||||||
android:layout_height="@dimen/dp_650"
|
|
||||||
android:src="@drawable/b4_map_right_top"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<com.mogo.och.shuttle.weaknet.passenger.ui.mind.B4MindView
|
|
||||||
android:id="@+id/b4MindView"
|
|
||||||
android:layout_width="@dimen/dp_411"
|
|
||||||
android:layout_height="@dimen/dp_650"
|
|
||||||
android:background="@drawable/b4_mind_bg"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<com.mogo.och.common.module.wigets.remote.EnterExitRemotePassengerView
|
<com.mogo.och.common.module.wigets.remote.EnterExitRemotePassengerView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/dp_30"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import android.util.AttributeSet
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||||
|
import com.mogo.eagle.core.data.enums.Carmodel
|
||||||
import com.mogo.eagle.core.data.enums.Carmodel.T2
|
import com.mogo.eagle.core.data.enums.Carmodel.T2
|
||||||
|
import com.mogo.eagle.core.data.enums.Carmodel.B4
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||||
@@ -76,6 +78,9 @@ class MoGoAutoView: MapAutoView {
|
|||||||
if (HdMapBuildConfig.currentCarVrIconRes == T2.rawValue) {
|
if (HdMapBuildConfig.currentCarVrIconRes == T2.rawValue) {
|
||||||
Log.d(TAG, "addSelfCar-> T2 --")
|
Log.d(TAG, "addSelfCar-> T2 --")
|
||||||
markerOptions.scale = 1.05f
|
markerOptions.scale = 1.05f
|
||||||
|
} else if (HdMapBuildConfig.currentCarVrIconRes == B4.rawValue) {
|
||||||
|
Log.d(TAG, "addSelfCar-> B4 --")
|
||||||
|
markerOptions.scale = 0.9f
|
||||||
}
|
}
|
||||||
return controller.addSelfCar(markerOptions)
|
return controller.addSelfCar(markerOptions)
|
||||||
}
|
}
|
||||||
|
|||||||