Merge branch 'dev_robo_240612_6.5.0_tmp' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robo_240612_6.5.0_tmp
# Conflicts: # core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt
This commit is contained in:
@@ -6,6 +6,7 @@ import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import androidx.core.util.Pair
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.CommunicationType
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
@@ -33,7 +34,9 @@ import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerMan
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
||||
@@ -46,14 +49,17 @@ import com.mogo.eagle.function.biz.v2x.v2n.utils.EventDismissManager
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.utils.IEventDismissListener
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2NUtils
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
|
||||
import com.mogo.map.MapDataWrapper
|
||||
import com.mogo.map.entities.Lane
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.Header
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.telematics.pad.MessagePad.V2nCrossSpeed
|
||||
import mogo.v2x.MogoV2X
|
||||
import mogo.v2x.MogoV2X.RSI_PB
|
||||
import mogo.v2x.MogoV2X.RTEData_PB
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* V2N上车相关事件绘制
|
||||
@@ -66,6 +72,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
private const val MSG_WHAT_DRAW_SHIGU = 0x1011 // 交通事故
|
||||
private const val MSG_WHAT_DRAW_YONGDU = 0x1012 // 交通拥堵
|
||||
private const val MSG_WHAT_DRAW_OTHER_RETROGRADE_VEHICLE = 0x1013 // 他车倒车/逆行
|
||||
private const val MSG_WHAT_DRAW_GREEN_WAVE = 0x1014 // 绿波通行
|
||||
|
||||
private val callback = Handler.Callback { msg ->
|
||||
if (msg.what == MSG_WHAT_DRAW_SHIGONE || msg.what == MSG_WHAT_DRAW_SHIGU) {
|
||||
@@ -156,33 +163,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
)
|
||||
)
|
||||
)
|
||||
// CallerHmiManager.warningV2X(
|
||||
// poiType,
|
||||
// alertContent,
|
||||
// ttsContent,
|
||||
// object : IMoGoWarningStatusListener {
|
||||
// override fun onShow() {
|
||||
// super.onShow()
|
||||
// runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.START) }
|
||||
// CallerVisualAngleManager.changeAngle(
|
||||
// RoadEvent(
|
||||
// itx.longitude,
|
||||
// itx.latitude,
|
||||
// itx.angle
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// override fun onDismiss() {
|
||||
// super.onDismiss()
|
||||
// runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.STOP) }
|
||||
// CallerVisualAngleManager.changeAngle(Default())
|
||||
// }
|
||||
// },
|
||||
// ALERT_WARNING_TOP,
|
||||
// 10000,
|
||||
// false
|
||||
// )
|
||||
if (polygon.isNotEmpty()) {
|
||||
val decision = V2NUtils.computeOccupyLanesInfo(Triple(car.longitude, car.latitude, car.heading.toFloat()), Triple(itx.longitude, itx.latitude, itx.heading.toFloat()), polygon.map { kotlin.Pair(it.first, it.second) })
|
||||
if (decision != null) {
|
||||
@@ -377,6 +357,41 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if (msg.what == MSG_WHAT_DRAW_GREEN_WAVE) {
|
||||
val data = msg.obj as? V2nCrossSpeed ?: return@Callback true
|
||||
val destX = data.lng
|
||||
val destY = data.lat
|
||||
val id = "${destX}_${destY}"
|
||||
AiRoadMarker.aiMakers.getOrPut(id) {
|
||||
AiRoadMarker().apply {
|
||||
try {
|
||||
val location = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val current = abs(location.gnssSpeed) * 3.6f.toInt()
|
||||
val min = abs(data.speedStraightMin * 3.6f).toInt()
|
||||
val max = abs(data.speedStraightMax * 3.6f).toInt()
|
||||
marker(Marker(id, EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType, destX, destY, 0.0, null, null, null), drawMarker = false, false)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
AppStateManager.currentActivity()?.let {
|
||||
val speakText = StringBuilder("保持当前车速即可通过路口,好丝滑!")
|
||||
if (current < min) {
|
||||
speakText.setLength(0)
|
||||
speakText.append("蘑菇推荐您提升车速至${min}千米每小小, 当前车速${current}千米每小时")
|
||||
}
|
||||
if (current > max) {
|
||||
speakText.setLength(0)
|
||||
speakText.append("蘑菇推荐您降低车速至${max}千米每小时, 当前车速${current}千米每小时")
|
||||
}
|
||||
AIAssist.getInstance(it).speakTTSVoice(speakText.toString())
|
||||
}
|
||||
}
|
||||
CallerHmiManager.showGreenWave(min, max, computeCrossCountBetween(Triple(location.longitude, location.latitude, location.heading), kotlin.Pair(destX, destY)))
|
||||
} finally {
|
||||
receive()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
@@ -446,6 +461,21 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun computeCrossCountBetween(start: kotlin.Triple<Double, Double, Double>, end: kotlin.Pair<Double, Double>): Int {
|
||||
val points = V2NUtils.generateIntermediatePoints(kotlin.Pair(start.first, start.second), end, 10.0 * 1e-7)
|
||||
var crossId = MapDataWrapper.getCrossRoad(start.first, start.second, start.third)?.cross_id_end
|
||||
val angle = start.third
|
||||
var count = 1
|
||||
for (p in points) {
|
||||
val crossRoad = MapDataWrapper.getCrossRoad(p.first, p.second, angle)
|
||||
if (crossRoad != null && !TextUtils.isEmpty(crossRoad.cross_id) && !TextUtils.equals(crossId, crossRoad.cross_id)) {
|
||||
count++
|
||||
crossId = crossRoad.cross_id
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
private fun getAlertContent(poiType: String, distance: Double): String {
|
||||
return when (poiType) {
|
||||
EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType -> {
|
||||
@@ -531,29 +561,43 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
}
|
||||
|
||||
private fun drawOtherRetrogradeVehicle(event: MessagePad.Event) {
|
||||
Log.d("V2NIdentifyDrawer", "---drawOtherRetrogradeVehicle --- :${event.toString()}, [${FunctionBuildConfig.v2nMainSwitch}, ${FunctionBuildConfig.isNewV2NData}]")
|
||||
Logger.i("V2NIdentifyDrawer", "---drawOtherRetrogradeVehicle --- :${event.toString()}, [${FunctionBuildConfig.v2nMainSwitch}, ${FunctionBuildConfig.isNewV2NData}]")
|
||||
if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
||||
handler.removeMessages(MSG_WHAT_DRAW_OTHER_RETROGRADE_VEHICLE)
|
||||
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_OTHER_RETROGRADE_VEHICLE, event))
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawGreenWave(crossSpeed: V2nCrossSpeed) {
|
||||
Log.d("V2NIdentifyDrawer", "---drawGreenWave---: $crossSpeed, [${FunctionBuildConfig.v2nMainSwitch}, ${FunctionBuildConfig.isNewV2NData}]")
|
||||
if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
||||
handler.removeMessages(MSG_WHAT_DRAW_GREEN_WAVE)
|
||||
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_GREEN_WAVE, crossSpeed))
|
||||
}
|
||||
}
|
||||
|
||||
private val nioEventListener = object : IMoGoV2nNioEventListener {
|
||||
override fun onV2nNioCongestionEvent(congestion: MessagePad.V2nCongestion) {
|
||||
super.onV2nNioCongestionEvent(congestion)
|
||||
V2XBizTrace.onAck(congestion, "onV2nNioCongestionEvent", true)
|
||||
}
|
||||
|
||||
override fun onV2nNioCrossoverEvent(event: MessagePad.Event) {
|
||||
super.onV2nNioCrossoverEvent(event)
|
||||
V2XBizTrace.onAck(event,"onV2nNioCrossoverEvent", true)
|
||||
//TODO renwj
|
||||
}
|
||||
|
||||
override fun onV2nNioGreenWavePassageEvent(crossSpeed: MessagePad.V2nCrossSpeed) {
|
||||
override fun onV2nNioGreenWavePassageEvent(crossSpeed: V2nCrossSpeed) {
|
||||
super.onV2nNioGreenWavePassageEvent(crossSpeed)
|
||||
V2XBizTrace.onAck(crossSpeed, "onV2nNioGreenWavePassageEvent", true)
|
||||
drawGreenWave(crossSpeed)
|
||||
}
|
||||
|
||||
override fun onV2nNioOtherRetrogradeEvent(event: MessagePad.Event) {
|
||||
super.onV2nNioOtherRetrogradeEvent(event)
|
||||
Logger.i(TAG, "onV2nNioOtherRetrogradeEvent --> ${event.toString()}")
|
||||
CallerLogger.i(TAG, "onV2nNioOtherRetrogradeEvent --> ${event}")
|
||||
V2XBizTrace.onAck(event, "onV2nNioOtherRetrogradeEvent", true)
|
||||
drawOtherRetrogradeVehicle(event)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,11 @@ import com.mogo.map.entities.Lane
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.GeometryFactory
|
||||
import org.locationtech.jts.geom.LineString
|
||||
import org.locationtech.jts.linearref.LengthIndexedLine
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
|
||||
object V2NUtils {
|
||||
|
||||
private const val TAG = "V2NUtils"
|
||||
@@ -42,4 +45,25 @@ object V2NUtils {
|
||||
}
|
||||
|
||||
data class Decision(val laneId: Int? = null,val total: List<Lane>, val occupy: List<Lane>)
|
||||
|
||||
|
||||
fun generateIntermediatePoints(head: Pair<Double, Double>, tail: Pair<Double, Double>, interval: Double): List<Pair<Double, Double>> {
|
||||
val geometryFactory = GeometryFactory()
|
||||
val start = Coordinate(head.first, head.second)
|
||||
val end = Coordinate(tail.first, tail.second)
|
||||
val line: LineString = geometryFactory.createLineString(arrayOf(start, end))
|
||||
val indexedLine = LengthIndexedLine(line)
|
||||
val lineLength = indexedLine.endIndex
|
||||
val result: MutableList<Coordinate> = ArrayList()
|
||||
var i = 0.0
|
||||
while (i <= lineLength) {
|
||||
val p = indexedLine.extractPoint(i)
|
||||
result.add(p)
|
||||
i += interval
|
||||
}
|
||||
if (result[result.size - 1].distance(end) > 0.0001) {
|
||||
result.add(end)
|
||||
}
|
||||
return result.map { Pair(it.x, it.y) }
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,12 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
"${SceneConstant.M_D_C}${TAG}",
|
||||
"onAutopilotPerceptionTrafficLight ---- hasObuLightStatus = $hasObuLightStatus ----hasAiLightStatus = $hasAiLightStatus , trafficLights : ${trafficLights?:"null"}"
|
||||
)
|
||||
Log.i(TAG,"source="+trafficLights?.source)
|
||||
if(trafficLights?.source == 2){
|
||||
hasObuLightStatus = false
|
||||
hasAiLightStatus = false
|
||||
hasFusionLightStatus = true
|
||||
}
|
||||
if (!hasObuLightStatus) {
|
||||
if (!hasAiLightStatus) {
|
||||
trafficLights?.let {
|
||||
@@ -130,6 +136,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
if (!hasAutopilotPerception) {
|
||||
hasAutopilotPerception = true
|
||||
}
|
||||
|
||||
if(light.nextState == null || light.nextState == FusionTrafficLightOuterClass.FusionLightState.STATE_OFF_FUSION
|
||||
|| light.nextTwoState == null || light.nextTwoState == FusionTrafficLightOuterClass.FusionLightState.STATE_OFF_FUSION){
|
||||
if (HmiBuildConfig.isShowCarSourceTrafficLightView) {
|
||||
@@ -147,17 +154,25 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
onTrafficLightPlusSource(convert(light.state), 0, DataSourceType.TELEMATIC)
|
||||
}
|
||||
}else{
|
||||
//有下一和下二灯态,则为融合V2N红绿灯数据
|
||||
onFusionTrafficLight(convert(light.state),light.duration.toInt(),
|
||||
convert(light.nextState),light.nextDuration.toInt(),
|
||||
convert(light.nextTwoState),light.nextTwoDuration.toInt(),
|
||||
DataSourceType.TELEMATIC_UNION_V2N
|
||||
)
|
||||
//当前灯态倒计时小于5S时,展示额外的提示框
|
||||
if(light.duration < 5){
|
||||
onTrafficLightPrompt(convert(light.state),light.duration.toInt())
|
||||
Log.i(TAG,"current state="+light.state+" current duration="+light.duration+
|
||||
" nextState="+light.nextState+" nextDuration="+light.nextDuration+
|
||||
" nextTwoState="+light.nextTwoState+" nextTwoDuration="+light.nextTwoDuration)
|
||||
if(convert(light.state) == TrafficLightEnum.BLACK){
|
||||
//隐藏当前红绿灯以及额外提示框
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}else{
|
||||
//有下一和下二灯态,则为融合V2N红绿灯数据
|
||||
onFusionTrafficLight(convert(light.state),light.duration.toInt(),
|
||||
convert(light.nextState),light.nextDuration.toInt(),
|
||||
convert(light.nextTwoState),light.nextTwoDuration.toInt(),
|
||||
DataSourceType.TELEMATIC_UNION_V2N
|
||||
)
|
||||
//当前灯态倒计时小于5S时,展示额外的提示框
|
||||
if(light.duration < 5){
|
||||
onTrafficLightPrompt(convert(light.state),light.duration,convert(light.nextState),light.nextDuration,
|
||||
convert(light.nextTwoState),light.nextTwoDuration)
|
||||
}
|
||||
}
|
||||
//TODO 提示框的消失逻辑
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,10 +292,11 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_TRAFFIC_LIGHT,
|
||||
paramIndexes = [0, 1])
|
||||
override fun onTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Int) {
|
||||
super.onTrafficLightPrompt(currentState, currentDuration)
|
||||
Log.i("xuxinchao","融合V2N红绿灯额外提示框提醒 Dis")
|
||||
CallerTrafficLightListenerManager.onShowTrafficLightPrompt(currentState, currentDuration)
|
||||
override fun onTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Float,
|
||||
nextState: TrafficLightEnum, nextDuration: Float,
|
||||
nextTwoState: TrafficLightEnum, nextTwoDuration: Float) {
|
||||
super.onTrafficLightPrompt(currentState, currentDuration,nextState, nextDuration, nextTwoState, nextTwoDuration)
|
||||
CallerTrafficLightListenerManager.onShowTrafficLightPrompt(currentState, currentDuration,nextState, nextDuration, nextTwoState, nextTwoDuration)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
@@ -30,6 +31,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.greenwave.GreenWaveView
|
||||
import com.mogo.eagle.core.function.hmi.ui.lookaround.M1LookAroundView
|
||||
import com.mogo.eagle.core.function.hmi.ui.notice.DispatchDialogManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
|
||||
@@ -83,6 +85,8 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
|
||||
private val xiaozhi by lazy { XiaoZhiStateManager() }
|
||||
|
||||
private val greenWave by lazy { AtomicReference<MoGoPopWindow>() }
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
@@ -403,4 +407,29 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
override fun notifyXiaoZhiStatusChanged(event: Event, state: State) {
|
||||
xiaozhi.notify(event, state)
|
||||
}
|
||||
|
||||
override fun showGreenWave(min: Int, max: Int, cross: Int) {
|
||||
val activity = AppStateManager.currentActivity() ?: return
|
||||
greenWave.get()?.hide()
|
||||
val content = GreenWaveView(activity)
|
||||
MoGoPopWindow.Builder()
|
||||
.contentView(content)
|
||||
.width(WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.height(WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.attachToActivity(activity)
|
||||
.gravityInActivity(Gravity.END)
|
||||
.onDismissed {
|
||||
greenWave.set(null)
|
||||
}
|
||||
.onShowed {
|
||||
content.bind(min, max, cross)
|
||||
}
|
||||
.build().also {
|
||||
greenWave.set(it)
|
||||
}.show()
|
||||
}
|
||||
|
||||
override fun dismissGreenWave() {
|
||||
greenWave.get()?.hide()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.greenwave
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.kotlin.scope
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.SizeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.coroutines.Runnable
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.abs
|
||||
import kotlinx.android.synthetic.main.view_green_wave_passenger_layout.view.speed as passenger_speed
|
||||
import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.speed as driver_speed
|
||||
import kotlinx.android.synthetic.main.view_green_wave_passenger_layout.view.wave_rv as passenger_wave_rv
|
||||
import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.wave_rv as driver_wave_rv
|
||||
import kotlinx.android.synthetic.main.view_green_wave_passenger_layout.view.recommend_speed as passenger_recommend_speed
|
||||
import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.recommend_speed as driver_recommend_speed
|
||||
import kotlinx.android.synthetic.main.view_green_wave_passenger_layout.view.recommend_cross as passenger_recommend_cross
|
||||
import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.recommend_cross as driver_recommend_cross
|
||||
|
||||
class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerView.OnItemTouchListener, Runnable {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "GreenWaveView"
|
||||
}
|
||||
|
||||
private var lastSpeed: Int = Int.MIN_VALUE
|
||||
|
||||
constructor(context: Context) : this(context, null)
|
||||
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
LayoutInflater.from(context).inflate(if (isDriver) R.layout.view_green_wave_driver_layout else R.layout.view_green_wave_passenger_layout, this)
|
||||
background = if (isDriver) ContextCompat.getDrawable(context, R.drawable.bg_green_wave_driver) else ContextCompat.getDrawable(context, R.drawable.bg_green_wave_passenger)
|
||||
}
|
||||
|
||||
private val isDriver by lazy {
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
|
||||
private class WaveHolder(item: ImageView): RecyclerView.ViewHolder(item)
|
||||
|
||||
private class WaveAdapter: RecyclerView.Adapter<WaveHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WaveHolder {
|
||||
val item = ImageView(parent.context)
|
||||
item.layoutParams = RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
return WaveHolder(item)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return 5000
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: WaveHolder, position: Int) {
|
||||
val item = holder.itemView as? ImageView ?: return
|
||||
val reminder = position % 3
|
||||
when(reminder) {
|
||||
0 -> {
|
||||
item.background = ContextCompat.getDrawable(item.context, R.drawable.icon_green_wave_alpha_low)
|
||||
}
|
||||
1 -> {
|
||||
item.background = ContextCompat.getDrawable(item.context, R.drawable.icon_green_wave_alpha_mid)
|
||||
}
|
||||
else -> {
|
||||
item.background = ContextCompat.getDrawable(item.context, R.drawable.icon_green_wave_alpha_high)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, this)
|
||||
val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv
|
||||
rv?.addItemDecoration(CommonDividerItemDecoration.Builder()
|
||||
.spanCountTBCare(false)
|
||||
.horizontalInnerSpace(SizeUtils.dp2px(10f))
|
||||
.build())
|
||||
rv?.addOnItemTouchListener(this)
|
||||
rv?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true)
|
||||
rv?.adapter = WaveAdapter()
|
||||
startAutoScroll()
|
||||
}
|
||||
|
||||
private fun startAutoScroll() {
|
||||
removeCallbacks(this)
|
||||
post(this)
|
||||
}
|
||||
|
||||
private fun stopAutoScroll() {
|
||||
removeCallbacks(this)
|
||||
}
|
||||
|
||||
override fun run() {
|
||||
val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv
|
||||
rv?.scrollBy(-3, 0)
|
||||
postDelayed(this, 20)
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) { }
|
||||
|
||||
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) { }
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv
|
||||
rv?.removeOnItemTouchListener(this)
|
||||
stopAutoScroll()
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
var isChanged = false
|
||||
val speed = (abs(mogoLocation?.gnssSpeed ?: 0f) * 3.6f).toInt()
|
||||
if (lastSpeed != speed) {
|
||||
isChanged = true
|
||||
lastSpeed = speed
|
||||
}
|
||||
if (isChanged) {
|
||||
UiThreadHandler.post {
|
||||
if (isDriver) {
|
||||
driver_speed?.text = speed.toString()
|
||||
} else {
|
||||
passenger_speed?.text = speed.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(minSpeed: Int, maxSpeed: Int, cross: Int) {
|
||||
scope.launch {
|
||||
if (isDriver) {
|
||||
driver_recommend_speed?.text = "建议车速${minSpeed}-${maxSpeed}km/h"
|
||||
driver_recommend_cross?.text = "可丝滑通过${cross}个路口"
|
||||
} else {
|
||||
passenger_recommend_speed?.text = "建议车速${minSpeed}-${maxSpeed}km/h"
|
||||
passenger_recommend_cross?.text = "可丝滑通过${cross}个路口"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotSummaryInfo
|
||||
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
@@ -86,6 +87,18 @@ class AutomaticExplorationView @JvmOverloads constructor(
|
||||
dataList.add(AutoExplorationEntity("前方路口行人/非机动车分析",6000L))
|
||||
dataList.add(AutoExplorationEntity("路侧视频分析",8000L))
|
||||
automaticExplorationAdapter?.setData(dataList)
|
||||
|
||||
//每出现一次自动探查,增加相应的服务次数
|
||||
//车辆服务次数
|
||||
AutopilotSummaryInfo.vehicleServiceNum += 31
|
||||
//道路信息提醒次数
|
||||
AutopilotSummaryInfo.infoTipNum += 9
|
||||
//车辆行为提醒次数
|
||||
AutopilotSummaryInfo.vehicleTipNum += 13
|
||||
//弱势参与者提醒次数
|
||||
AutopilotSummaryInfo.vulnerableTipNum += 4
|
||||
//消除安全风险隐患次数
|
||||
AutopilotSummaryInfo.dangerNum += 24
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
/**
|
||||
* 融合红绿灯变灯提示
|
||||
@@ -33,7 +34,6 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
private var tvPromptContent: TextView ?= null
|
||||
private var tvTrafficNum: TypefaceTextView ?= null
|
||||
private var tvTrafficNumDecimal: TypefaceTextView ?= null
|
||||
private val randomList = ArrayList<Float>()
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TrafficLightPromptView)
|
||||
@@ -53,16 +53,6 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
tvTrafficNum = findViewById(R.id.tvTrafficNum)
|
||||
tvTrafficNumDecimal = findViewById(R.id.tvTrafficNumDecimal)
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
|
||||
randomList.add(0.99f)
|
||||
randomList.add(0.72f)
|
||||
randomList.add(0.44f)
|
||||
randomList.add(0.21f)
|
||||
randomList.add(0.06f)
|
||||
|
||||
// tvPromptContent?.text = "请准备出发"
|
||||
// tvTrafficNum?.text = "12"
|
||||
// tvTrafficNumDecimal?.text = ".56"
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -70,6 +60,12 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
UiThreadHandler.post{
|
||||
this@TrafficLightPromptView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,8 +73,10 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
* @param currentState 当前灯态
|
||||
* @param currentDuration 当前灯态倒计时
|
||||
*/
|
||||
override fun onShowTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Int) {
|
||||
super.onShowTrafficLightPrompt(currentState, currentDuration)
|
||||
override fun onShowTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Float,
|
||||
nextState: TrafficLightEnum, nextDuration: Float,
|
||||
nextTwoState: TrafficLightEnum, nextTwoDuration: Float) {
|
||||
super.onShowTrafficLightPrompt(currentState, currentDuration,nextState, nextDuration, nextTwoState, nextTwoDuration)
|
||||
ThreadUtils.runOnUiThread {
|
||||
when(currentState){
|
||||
TrafficLightEnum.GREEN->{
|
||||
@@ -115,7 +113,49 @@ class TrafficLightPromptView @JvmOverloads constructor(
|
||||
this@TrafficLightPromptView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
tvTrafficNum?.text = currentDuration.toString()
|
||||
if(currentDuration>0 && currentDuration<5){
|
||||
tvTrafficNum?.text = "${currentDuration.toInt()}."
|
||||
tvTrafficNumDecimal?.text = (currentDuration*100 - currentDuration.toInt()*100).toInt().toString()
|
||||
}else{
|
||||
tvTrafficNum?.text = "0."
|
||||
tvTrafficNumDecimal?.text = "0"
|
||||
this@TrafficLightPromptView.visibility = View.GONE
|
||||
}
|
||||
when(nextState){
|
||||
TrafficLightEnum.GREEN->{
|
||||
if(user == 0){
|
||||
//司机端提示
|
||||
tvPromptTitle?.text = "即将绿灯"
|
||||
tvPromptContent?.text = "请准备出发"
|
||||
}else{
|
||||
//乘客端提示
|
||||
tvPromptContent?.text = "即将绿灯,请准备出发"
|
||||
}
|
||||
}
|
||||
TrafficLightEnum.RED->{
|
||||
if(user == 0){
|
||||
//司机端提示
|
||||
tvPromptTitle?.text = "即将红灯"
|
||||
tvPromptContent?.text = "请减速慢行"
|
||||
}else{
|
||||
//乘客端提示
|
||||
tvPromptContent?.text = "即将红灯,请减速慢行"
|
||||
}
|
||||
}
|
||||
TrafficLightEnum.YELLOW->{
|
||||
if(user == 0){
|
||||
//司机端提示
|
||||
tvPromptTitle?.text = "即将黄灯"
|
||||
tvPromptContent?.text = "请减速慢行"
|
||||
}else{
|
||||
//乘客端提示
|
||||
tvPromptContent?.text = "即将红灯,请减速慢行"
|
||||
}
|
||||
}
|
||||
TrafficLightEnum.BLACK->{
|
||||
this@TrafficLightPromptView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
@@ -12,14 +12,8 @@ import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightBg
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightNum
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightPointer
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightProportion
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightScale
|
||||
import kotlinx.android.synthetic.main.hmi_view_fusion_traffic_light.view.fusionTrafficLightState
|
||||
|
||||
/**
|
||||
* 融合红绿灯View
|
||||
* 鹰眼6.5.0版本需求
|
||||
@@ -41,6 +35,12 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
private var maxYellowDuration = 0 //黄灯最长时间
|
||||
private var maxRedDuration = 0 //红灯最长时间
|
||||
|
||||
private var fusionTrafficLightNum: TypefaceTextView ?=null //融合红绿灯倒计时
|
||||
private var fusionTrafficLightState: ImageView ?= null //融合红绿灯灯态
|
||||
private var fusionTrafficLightScale: ImageView ?= null //融合红绿灯刻度
|
||||
private var fusionTrafficLightPointer: ImageView ?= null //融合红绿灯指针
|
||||
private var fusionTrafficLightProportion: ProportionChartView ?= null //占比进度条
|
||||
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.FusionTrafficLightView)
|
||||
@@ -50,13 +50,17 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light, this, true)
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
if(user == 0){
|
||||
fusionTrafficLightBg.setBackgroundResource(R.drawable.bg_fusion_traffic_light)
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light, this, true)
|
||||
}else{
|
||||
fusionTrafficLightBg.setBackgroundResource(R.drawable.bg_fusion_traffic_light_p)
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light_p, this, true)
|
||||
}
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
fusionTrafficLightNum = findViewById(R.id.fusionTrafficLightNum)
|
||||
fusionTrafficLightState = findViewById(R.id.fusionTrafficLightState)
|
||||
fusionTrafficLightScale = findViewById(R.id.fusionTrafficLightScale)
|
||||
fusionTrafficLightPointer = findViewById(R.id.fusionTrafficLightPointer)
|
||||
fusionTrafficLightProportion = findViewById(R.id.fusionTrafficLightProportion)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -69,7 +73,6 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
*/
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
Log.i("xuxinchao","disableTrafficLight 关闭红绿灯预警展示")
|
||||
UiThreadHandler.post{
|
||||
mCurrentLightId = TrafficLightEnum.BLACK
|
||||
this@FusionTrafficLightView.visibility = GONE
|
||||
@@ -94,116 +97,128 @@ class FusionTrafficLightView @JvmOverloads constructor(
|
||||
) {
|
||||
super.showFusionTrafficLight(currentState, currentDuration, nextState,
|
||||
nextDuration, nextTwoState, nextTwoDuration, lightSource)
|
||||
//如果当前红绿灯视图为隐藏状态则设置为显示状态
|
||||
if(this@FusionTrafficLightView.visibility == View.GONE){
|
||||
this@FusionTrafficLightView.visibility = View.VISIBLE
|
||||
//首次展示,需要将当前、下一、下二灯态的时间占比绘制出来,只绘制一次
|
||||
val proportionList = ArrayList<Int>()
|
||||
//按照绿、黄、红的顺序将灯态时间添加到数组
|
||||
when (currentState) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
//如果当前红绿灯视图为隐藏状态则设置为显示状态
|
||||
if(this@FusionTrafficLightView.visibility == View.GONE){
|
||||
this@FusionTrafficLightView.visibility = View.VISIBLE
|
||||
//首次展示,需要将当前、下一、下二灯态的时间占比绘制出来,只绘制一次
|
||||
val proportionList = ArrayList<Int>(3)
|
||||
proportionList.add(0)
|
||||
proportionList.add(0)
|
||||
proportionList.add(0)
|
||||
//按照绿、黄、红的顺序将灯态时间添加到数组
|
||||
when (currentState) {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,currentDuration)
|
||||
maxGreenDuration = currentDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,currentDuration)
|
||||
maxYellowDuration = if(currentDuration < 3){
|
||||
3
|
||||
}else{
|
||||
currentDuration
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,currentDuration)
|
||||
maxRedDuration = currentDuration
|
||||
}
|
||||
}
|
||||
when(nextState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextDuration)
|
||||
maxGreenDuration = nextDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextDuration)
|
||||
maxYellowDuration = if(nextDuration<3){
|
||||
3
|
||||
}else{
|
||||
nextDuration
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,nextDuration)
|
||||
maxRedDuration = nextDuration
|
||||
}
|
||||
}
|
||||
when(nextTwoState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextTwoDuration)
|
||||
maxGreenDuration = nextTwoDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextTwoDuration)
|
||||
maxYellowDuration = if(nextTwoDuration<3){
|
||||
3
|
||||
}else{
|
||||
nextTwoDuration
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,nextTwoDuration)
|
||||
maxRedDuration = nextTwoDuration
|
||||
}
|
||||
}
|
||||
fusionTrafficLightProportion?.updateProportion(proportionList)
|
||||
totalDuration = maxGreenDuration + maxYellowDuration + maxRedDuration
|
||||
}
|
||||
//根据当前灯态设置转盘、刻度、指针背景
|
||||
when(currentState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,currentDuration)
|
||||
maxGreenDuration = currentDuration
|
||||
fusionTrafficLightState?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green))
|
||||
fusionTrafficLightScale?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_scale))
|
||||
fusionTrafficLightPointer?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_pointer))
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,currentDuration)
|
||||
maxYellowDuration = currentDuration
|
||||
fusionTrafficLightState?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow))
|
||||
fusionTrafficLightScale?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_scale))
|
||||
fusionTrafficLightPointer?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_pointer))
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,currentDuration)
|
||||
maxRedDuration = currentDuration
|
||||
fusionTrafficLightState?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red))
|
||||
fusionTrafficLightScale?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_scale))
|
||||
fusionTrafficLightPointer?.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_pointer))
|
||||
}
|
||||
}
|
||||
when(nextState){
|
||||
//更新当前灯态倒计时时间
|
||||
if(currentDuration>0){
|
||||
fusionTrafficLightNum?.text = currentDuration.toString()
|
||||
}else{
|
||||
fusionTrafficLightNum?.text = "0"
|
||||
}
|
||||
//当时间为1开头时时间视觉上看不是左右居中对齐,需要做便宜操作
|
||||
if(currentDuration.toString().startsWith("1")){
|
||||
val numLayoutParams = fusionTrafficLightNum?.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 6
|
||||
fusionTrafficLightNum?.layoutParams = numLayoutParams
|
||||
}else{
|
||||
val numLayoutParams = fusionTrafficLightNum?.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 0
|
||||
fusionTrafficLightNum?.layoutParams = numLayoutParams
|
||||
}
|
||||
|
||||
//更新指针指向
|
||||
val pointerLayoutParams = fusionTrafficLightPointer?.layoutParams as LayoutParams
|
||||
val currentAngle = when (currentState) {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextDuration)
|
||||
maxGreenDuration = nextDuration
|
||||
360f*(maxGreenDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextDuration)
|
||||
maxYellowDuration = nextDuration
|
||||
360f*(maxGreenDuration+maxYellowDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
else -> {
|
||||
proportionList.add(2,nextDuration)
|
||||
maxRedDuration = nextDuration
|
||||
360f*(maxGreenDuration+maxYellowDuration+maxRedDuration-currentDuration)/totalDuration
|
||||
}
|
||||
}
|
||||
when(nextTwoState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
proportionList.add(0,nextTwoDuration)
|
||||
maxGreenDuration = nextTwoDuration
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
proportionList.add(1,nextTwoDuration)
|
||||
maxYellowDuration = nextTwoDuration
|
||||
}
|
||||
else -> {
|
||||
proportionList.add(2,nextTwoDuration)
|
||||
maxRedDuration = nextTwoDuration
|
||||
}
|
||||
}
|
||||
fusionTrafficLightProportion.updateProportion(proportionList)
|
||||
totalDuration = maxGreenDuration + maxYellowDuration + maxRedDuration
|
||||
Log.i("xuxinchao","totalDuration="+totalDuration)
|
||||
Log.i("xuxinchao","maxGreenDuration="+maxGreenDuration)
|
||||
Log.i("xuxinchao","maxYellowDuration="+maxYellowDuration)
|
||||
Log.i("xuxinchao","maxRedDuration="+maxRedDuration)
|
||||
}
|
||||
//根据当前灯态设置转盘、刻度、指针背景
|
||||
when(currentState){
|
||||
TrafficLightEnum.GREEN -> {
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_green_pointer))
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_yellow_pointer))
|
||||
}
|
||||
else -> {
|
||||
fusionTrafficLightState.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red))
|
||||
fusionTrafficLightScale.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_scale))
|
||||
fusionTrafficLightPointer.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_light_red_pointer))
|
||||
}
|
||||
}
|
||||
//更新当前灯态倒计时时间
|
||||
if(currentDuration>0){
|
||||
fusionTrafficLightNum.text = currentDuration.toString()
|
||||
}else{
|
||||
fusionTrafficLightNum.text = "0"
|
||||
}
|
||||
//当时间为1开头时时间视觉上看不是左右居中对齐,需要做便宜操作
|
||||
if(currentDuration.toString().startsWith("1")){
|
||||
val numLayoutParams = fusionTrafficLightNum.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 10
|
||||
fusionTrafficLightNum.layoutParams = numLayoutParams
|
||||
}else{
|
||||
val numLayoutParams = fusionTrafficLightNum.layoutParams as LayoutParams
|
||||
numLayoutParams.rightMargin = 0
|
||||
fusionTrafficLightNum.layoutParams = numLayoutParams
|
||||
pointerLayoutParams.circleAngle = currentAngle
|
||||
fusionTrafficLightPointer?.rotation = currentAngle
|
||||
fusionTrafficLightPointer?.layoutParams = pointerLayoutParams
|
||||
}
|
||||
|
||||
//更新指针指向
|
||||
val pointerLayoutParams = fusionTrafficLightPointer.layoutParams as LayoutParams
|
||||
var currentAngle = 0f
|
||||
currentAngle = when (currentState) {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
360f*(maxGreenDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
360f*(maxGreenDuration+maxYellowDuration-currentDuration)/totalDuration
|
||||
}
|
||||
|
||||
else -> {
|
||||
360f*(maxGreenDuration+maxYellowDuration+maxRedDuration-currentDuration)/totalDuration
|
||||
}
|
||||
}
|
||||
pointerLayoutParams.circleAngle = currentAngle
|
||||
fusionTrafficLightPointer.rotation = currentAngle
|
||||
fusionTrafficLightPointer.layoutParams = pointerLayoutParams
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,6 +56,14 @@ class ItinerarySummaryDialog(context: Context, isDriver: Boolean, theme: Int) :
|
||||
//关闭Dialog按钮
|
||||
ivSummaryClose = findViewById(R.id.ivSummaryClose)
|
||||
ivSummaryClose?.setOnClickListener {
|
||||
//对本次服务记录清零
|
||||
AutopilotSummaryInfo.intersectionServicesNum = 0
|
||||
AutopilotSummaryInfo.lightServicesNum = 0
|
||||
AutopilotSummaryInfo.infoTipNum = 0
|
||||
AutopilotSummaryInfo.vehicleTipNum = 0
|
||||
AutopilotSummaryInfo.vulnerableTipNum = 0
|
||||
AutopilotSummaryInfo.dangerNum = 0
|
||||
//关闭弹窗
|
||||
dismiss()
|
||||
}
|
||||
//小智总结
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.SweepGradient;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
@@ -132,7 +131,6 @@ public class ProportionChartView extends View {
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
Log.i("xuxinchao","onDraw canvas");
|
||||
drawRingView(canvas);
|
||||
}
|
||||
|
||||
@@ -140,7 +138,6 @@ public class ProportionChartView extends View {
|
||||
* 画Ring
|
||||
*/
|
||||
private void drawRingView(Canvas canvas){
|
||||
Log.i("xuxinchao","drawRingView 画Ring");
|
||||
float sweepAngle = 0f;
|
||||
float startAngle = -90f;
|
||||
//矩形坐标
|
||||
@@ -176,7 +173,7 @@ public class ProportionChartView extends View {
|
||||
}
|
||||
mRingPaint.setShader(sweepGradient);
|
||||
//画圆环
|
||||
canvas.drawArc(mRectF, startAngle, sweepAngle - 2, false, mRingPaint);
|
||||
canvas.drawArc(mRectF, startAngle, sweepAngle, false, mRingPaint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,12 +79,11 @@ class RomaTaxiView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun romaViewStatus(status: Boolean) {
|
||||
Log.i("emArrow","romaViewStatus:$status")
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(status){
|
||||
this.visibility = View.VISIBLE
|
||||
} else {
|
||||
// this.visibility = View.GONE
|
||||
this.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class WifiStateView @JvmOverloads constructor(
|
||||
wifiHandler = WifiHandler(this)
|
||||
val wifiInfo = wifiManager!!.connectionInfo
|
||||
wifiName = wifiInfo.ssid.replace("\"","")
|
||||
Log.i("emArrow", "init wifiName: $wifiName")
|
||||
// Log.i("emArrow", "init wifiName: $wifiName")
|
||||
}
|
||||
|
||||
private val wifiStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
@@ -105,7 +105,7 @@ class WifiStateView @JvmOverloads constructor(
|
||||
}
|
||||
val wifiInfo = wifiManager!!.connectionInfo
|
||||
wifiName = wifiInfo.ssid.replace("\"","")
|
||||
Log.i("emArrow", "wifiName: $wifiName")
|
||||
// Log.i("emArrow", "wifiName: $wifiName")
|
||||
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
<solid android:color="#43D1A6" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
<gradient
|
||||
android:startColor="#68E0BB"
|
||||
android:endColor="#b072ECC3"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size android:width="@dimen/dp_90" android:height="@dimen/dp_90" />
|
||||
<solid android:color="#FFFFFF" />
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size android:width="@dimen/dp_90" android:height="@dimen/dp_90" />
|
||||
<gradient
|
||||
android:startColor="#BADDFFF3"
|
||||
android:endColor="#FFFFFF"
|
||||
android:angle="-45"/>
|
||||
</shape>
|
||||
@@ -3,9 +3,9 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fusionTrafficLightBg"
|
||||
android:layout_width="@dimen/dp_250"
|
||||
android:layout_height="@dimen/dp_250"
|
||||
android:background="@drawable/bg_fusion_traffic_light_p"
|
||||
android:layout_width="@dimen/dp_200"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:background="@drawable/bg_fusion_traffic_light"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
@@ -51,15 +51,15 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_55"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_69"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ProportionChartView
|
||||
android:id="@+id/fusionTrafficLightProportion"
|
||||
android:layout_width="@dimen/dp_170"
|
||||
android:layout_height="@dimen/dp_170"
|
||||
android:layout_width="@dimen/dp_180"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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/fusionTrafficLightBg"
|
||||
android:layout_width="@dimen/dp_250"
|
||||
android:layout_height="@dimen/dp_250"
|
||||
android:background="@drawable/bg_fusion_traffic_light_p"
|
||||
>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ProportionChartView
|
||||
android:id="@+id/fusionTrafficLightProportion"
|
||||
android:layout_width="@dimen/dp_180"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fusionTrafficLightState"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_147"
|
||||
app:layout_constraintTop_toTopOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintLeft_toLeftOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintRight_toRightOf="@id/fusionTrafficLightProportion"
|
||||
android:src="@drawable/icon_light_green"
|
||||
android:contentDescription="@string/fusion_traffic_light_state"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fusionTrafficLightScale"
|
||||
android:layout_width="@dimen/dp_148"
|
||||
android:layout_height="@dimen/dp_148"
|
||||
app:layout_constraintTop_toTopOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintLeft_toLeftOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintRight_toRightOf="@id/fusionTrafficLightProportion"
|
||||
android:src="@drawable/icon_light_green_scale"
|
||||
android:contentDescription="@string/fusion_traffic_light_scale"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fusionTrafficLightPointer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintCircle="@id/fusionTrafficLightState"
|
||||
app:layout_constraintCircleRadius="@dimen/dp_60"
|
||||
android:src="@drawable/icon_light_green_pointer"
|
||||
android:contentDescription="@string/fusion_traffic_light_pointer"
|
||||
tools:ignore="MissingConstraints"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
android:id="@+id/fusionTrafficLightNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintLeft_toLeftOf="@id/fusionTrafficLightProportion"
|
||||
app:layout_constraintRight_toRightOf="@id/fusionTrafficLightProportion"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_69"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:background="@drawable/bg_green_wave_driver"
|
||||
tools:layout_height="wrap_content"
|
||||
tools:layout_width="wrap_content"
|
||||
tools:parentTag="android.widget.LinearLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:background="@drawable/bg_white_circle_driver"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:textColor="#43D1AB"
|
||||
android:textSize="@dimen/sp_34"
|
||||
tools:text="56" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="km/h"
|
||||
android:textColor="#43D1A6"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/wave_rv"
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_129"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recommend_speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="建议车速45-60km/h" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recommend_cross"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#b0ffffff"
|
||||
android:textSize="@dimen/dp_20"
|
||||
tools:text="可丝滑通过2个路口" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</merge>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="android.widget.LinearLayout"
|
||||
tools:layout_width="wrap_content"
|
||||
tools:layout_height="wrap_content"
|
||||
tools:gravity="center_vertical"
|
||||
tools:background="@drawable/bg_green_wave_passenger">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/dp_108"
|
||||
android:layout_height="@dimen/dp_108"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_white_circle_passenger"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_marginStart="@dimen/dp_34"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:layout_marginBottom="@dimen/dp_24"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_49"
|
||||
android:textColor="#0F664B"
|
||||
android:layout_marginBottom="-5dp"
|
||||
tools:text="56"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:textColor="#0F664B"
|
||||
android:text="km/h" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/wave_rv"
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_155"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_29"
|
||||
android:layout_centerVertical="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recommend_speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_33"
|
||||
android:textColor="#004A35"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
tools:text="建议车速45-60km/h" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recommend_cross"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_22"
|
||||
android:textColor="#004A35"
|
||||
tools:text="可丝滑通过2个路口" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</merge>
|
||||
@@ -15,7 +15,6 @@
|
||||
android:layout_marginLeft="@dimen/dp_150"
|
||||
android:textSize="@dimen/sp_30"
|
||||
android:textColor="@color/white"
|
||||
android:text="即将绿灯"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -27,7 +26,6 @@
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:textSize="@dimen/sp_21"
|
||||
android:textColor="@color/white"
|
||||
android:text="请准备出发"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
@@ -37,8 +35,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:textSize="@dimen/sp_40"
|
||||
android:text=".99"
|
||||
android:textSize="@dimen/sp_48"
|
||||
android:textColor="@color/light_prompt_red"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
@@ -47,10 +44,11 @@
|
||||
android:id="@+id/tvTrafficNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvTrafficNumDecimal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvTrafficNumDecimal"
|
||||
android:layout_marginTop="@dimen/dp_26"
|
||||
android:layout_marginRight="@dimen/dp_2"
|
||||
android:textSize="@dimen/sp_90"
|
||||
android:text="3"
|
||||
android:textColor="@color/light_prompt_red"
|
||||
app:textType="DS_DIGIB_2"
|
||||
/>
|
||||
|
||||
@@ -13,33 +13,31 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textSize="@dimen/sp_32"
|
||||
android:textColor="@color/light_prompt_content"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:text="即将红灯,请减速慢行"
|
||||
android:layout_marginTop="@dimen/dp_55"
|
||||
android:layout_marginStart="@dimen/dp_70"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
android:id="@+id/tvTrafficNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvPromptContent"
|
||||
android:textSize="@dimen/sp_76"
|
||||
android:text="2"
|
||||
android:layout_marginLeft="@dimen/dp_25"
|
||||
android:textSize="@dimen/sp_90"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
|
||||
android:id="@+id/tvTrafficNumDecimal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvTrafficNum"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvTrafficNum"
|
||||
android:textSize="@dimen/sp_30"
|
||||
android:text=".99"
|
||||
android:layout_marginLeft="@dimen/dp_2"
|
||||
android:textSize="@dimen/sp_48"
|
||||
app:textType="DS_DIGIB_2"
|
||||
android:gravity="bottom"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -37,8 +37,8 @@ class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
|
||||
CallerVisualAngleManager.init()
|
||||
}
|
||||
|
||||
override fun trigger(romaStatus: Boolean) {
|
||||
romaManager.trigger(romaStatus)
|
||||
override fun trigger(roamStatus: Boolean) {
|
||||
romaManager.trigger(roamStatus)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -32,21 +32,15 @@ class AiCloudIdentifyDataManager {
|
||||
})
|
||||
}
|
||||
|
||||
fun trigger(romaStatus: Boolean, startDis: Int, endDis: Int) {
|
||||
requestRangeOfIdentify(romaStatus, startDis, endDis)
|
||||
fun trigger(romaStatus: Boolean, startDis: Int, endDis: Int, lat: Double, lon: Double) {
|
||||
requestRangeOfIdentify(romaStatus, startDis, endDis, lat, lon)
|
||||
}
|
||||
|
||||
fun requestRangeOfIdentify(
|
||||
romaStatus: Boolean,
|
||||
startDis: Int,
|
||||
endDis: Int
|
||||
romaStatus: Boolean, startDis: Int, endDis: Int, lat: Double, lon: Double
|
||||
) {
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().gnssInfo
|
||||
aiCloudIdentifyNetWorkModel.requestIdentifyRange(
|
||||
romaStatus,
|
||||
startDis, endDis,
|
||||
loc.longitude,
|
||||
loc.latitude,
|
||||
romaStatus, startDis, endDis, lon, lat,
|
||||
{
|
||||
CallerMapAiCloudDataManager.invokeResponse(romaStatus)
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.business.ai
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.Log
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -51,7 +52,7 @@ class RomaManager() : IMoGoPlanningRottingListener,
|
||||
IMoGoAutopilotStatusListener, IMoGoRomaListener, IMoGoAiCloudIdentifyDataListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AiCloudIdentifyData"
|
||||
private const val TAG = "RomaManager"
|
||||
|
||||
private const val H_ERROR_CLOUD = 1
|
||||
private const val H_ERROR_MAP = 2
|
||||
@@ -116,13 +117,17 @@ class RomaManager() : IMoGoPlanningRottingListener,
|
||||
true
|
||||
}
|
||||
|
||||
fun trigger(romaStatus: Boolean) {
|
||||
if (CallerMapIdentifyManager.roma.first != TAG && CallerMapIdentifyManager.roma.second) {
|
||||
fun trigger(roamStatus: Boolean) {
|
||||
if (CallerMapIdentifyManager.roam.first.isNotEmpty()
|
||||
&& CallerMapIdentifyManager.roam.first!= TAG
|
||||
&& CallerMapIdentifyManager.roam.second) {
|
||||
ToastUtils.showLong("正在展示路口漫游,请稍后重试")
|
||||
Log.e("emArrow", "正在展示路口漫游,请稍后重试")
|
||||
CallerMapRomaListener.invokeMapRoma(false)
|
||||
return
|
||||
}
|
||||
// 乘客司机屏屏各自单独控制漫游
|
||||
if (romaStatus) {
|
||||
if (roamStatus) {
|
||||
// 开启roma,当前非漫游,开启
|
||||
MapRomaTrace.log(
|
||||
"",
|
||||
@@ -140,7 +145,7 @@ class RomaManager() : IMoGoPlanningRottingListener,
|
||||
}
|
||||
|
||||
private fun openRoma() {
|
||||
CallerMapIdentifyManager.roma = Pair(TAG, true)
|
||||
CallerMapIdentifyManager.roam = Pair(TAG, true)
|
||||
CallerMapUIServiceManager.getMapUIController()?.visualAngleLock(true)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setScrollGesturesEnable(false)
|
||||
updateLongSightLevel(true)
|
||||
@@ -149,7 +154,7 @@ class RomaManager() : IMoGoPlanningRottingListener,
|
||||
|
||||
@Synchronized
|
||||
private fun closeRoma(manual: Boolean = true) {
|
||||
CallerMapIdentifyManager.roma = Pair("", false)
|
||||
CallerMapIdentifyManager.roam = Pair("", false)
|
||||
CallerMapUIServiceManager.getMapUIController()?.visualAngleLock(false)
|
||||
CallerMapUIServiceManager.getMapUIController()?.setScrollGesturesEnable(true)
|
||||
updateLongSightLevel(false)
|
||||
@@ -192,7 +197,7 @@ class RomaManager() : IMoGoPlanningRottingListener,
|
||||
"cityCode" to CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode
|
||||
), !dataReceive
|
||||
)
|
||||
aiCloudIdentifyDataManager.trigger(dataReceive, START_METRE, END_METRE)
|
||||
aiCloudIdentifyDataManager.trigger(dataReceive, START_METRE, END_METRE,loc.latitude,loc.longitude)
|
||||
}
|
||||
|
||||
override fun response(requestStatus: Boolean, errorMsg: String?) {
|
||||
|
||||
@@ -8,13 +8,12 @@ import android.util.Log
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.api.map.roma.IMoGoAiCloudIdentifyDataListener
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager
|
||||
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.aiCloudIdentifyDataManager
|
||||
import com.mogo.eagle.core.function.business.ai.RomaManager
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapAiCloudDataManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
||||
import com.mogo.map.MogoMap.Companion.MAP_ROAM
|
||||
import com.mogo.map.MogoMapView
|
||||
@@ -24,23 +23,19 @@ import mogo.yycp.api.proto.SocketDownData
|
||||
|
||||
|
||||
class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs),
|
||||
LifecycleObserver, IMoGoMapRoadListener , IMoGoAiCloudIdentifyDataListener {
|
||||
LifecycleObserver, IMoGoMapRoadListener, IMoGoAiCloudIdentifyDataListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MapRoamView"
|
||||
}
|
||||
|
||||
override fun onCreate(bundle: Bundle?) {
|
||||
super.onCreate(bundle)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
initMapView()
|
||||
}
|
||||
|
||||
private fun initMapView() {
|
||||
map?.uiController?.showMyLocation(false)
|
||||
getUI()?.showMyLocation(false)
|
||||
map?.uiSettings?.let {
|
||||
it.setAllGesturesEnabled(false)
|
||||
//设置指南针是否可见。
|
||||
@@ -58,18 +53,6 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
|
||||
return MAP_ROAM
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun getUI(): IMogoMapUIController? {
|
||||
return map?.uiController
|
||||
}
|
||||
@@ -83,25 +66,28 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
|
||||
|
||||
fun openRoam() {
|
||||
this.onResume()
|
||||
CallerMapAiCloudDataManager.addListener(TAG, this)
|
||||
getUI()?.setVisible(true)
|
||||
CallerMapAiCloudDataManager.addListener(RoadCrossRoamView.TAG, this)
|
||||
// 更新地图视角 - 高视角
|
||||
getUI()?.changeMapVisualAngle(VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP, null)
|
||||
// 更新路口位置
|
||||
val latLng = CallerMapRoadListenerManager.getStopLineLatLng()
|
||||
Log.i("emArrow","$TAG 开始漫游 latLng:${latLng.toString()}")
|
||||
latLng?.let {
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val curLat = loc.latitude
|
||||
val curLng = loc.longitude
|
||||
loc.latitude = latLng.first
|
||||
loc.longitude = latLng.second
|
||||
setExtraGPSData(loc)
|
||||
val dis = CoordinateUtils.calculateLineDistance(curLat, curLng, latLng.first, latLng.second)
|
||||
Log.i("emArrow", "$TAG 开始漫游 latLng:$latLng , curLat:$curLat , curLng:$curLng , dis:$dis")
|
||||
// 开始漫游
|
||||
aiCloudIdentifyDataManager.trigger(true, 1, 300, latLng.first, latLng.second)
|
||||
}
|
||||
// 开始漫游
|
||||
aiCloudIdentifyDataManager.trigger(true, 1, 300)
|
||||
}
|
||||
|
||||
|
||||
override fun response(requestStatus: Boolean, errorMsg: String?) {
|
||||
|
||||
Log.e("emArrow","road map response:$requestStatus , errorMsg:${errorMsg?:""}")
|
||||
}
|
||||
|
||||
override fun onAiIdentifyData(obj: SocketDownData.SocketDownDataProto?) {
|
||||
@@ -116,17 +102,16 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
|
||||
}
|
||||
}
|
||||
|
||||
fun closeRoam(){
|
||||
this.onPause()
|
||||
fun closeRoam() {
|
||||
// 结束漫游
|
||||
aiCloudIdentifyDataManager.trigger(false, 1, 300)
|
||||
CallerMapAiCloudDataManager.removeListener(TAG)
|
||||
val latLng = CallerMapRoadListenerManager.getStopLineLatLng()
|
||||
latLng?.let {
|
||||
aiCloudIdentifyDataManager.trigger(false, 1, 300, it.first, it.second)
|
||||
}
|
||||
CallerMapAiCloudDataManager.removeListener(RoadCrossRoamView.TAG)
|
||||
MapIdentifySubscriber.instance.clearAiCloudRoma(MAP_ROAM)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
super.onDestroy()
|
||||
this.onPause()
|
||||
getUI()?.setVisible(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -48,7 +47,6 @@ class RoadCrossRoamListAdapter(private val mContext: Context, private val lightM
|
||||
|
||||
val r0 = Random.nextInt(0,3)
|
||||
val r1 = Random.nextInt(1,9)
|
||||
Log.i("emArrow","random:${r0 * 1000L + r1 * 100L}")
|
||||
// 模拟加载完成
|
||||
holder.itemView.postDelayed({
|
||||
holder.progressBar.visibility = View.GONE
|
||||
|
||||
@@ -36,7 +36,7 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener{
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RoadCrossRoamView"
|
||||
const val TAG = "RoadCrossRoamView"
|
||||
}
|
||||
|
||||
private var showState by Delegates.observable(false) { _, oldV, newV ->
|
||||
@@ -91,19 +91,23 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
super.onStopLineInfo(info)
|
||||
if(info.distance == 0.0){
|
||||
Log.i("emArrow", "showState return , distance is zero")
|
||||
return
|
||||
}
|
||||
showState = info.distance < 200 && info.distance > 100
|
||||
Log.i("emArrow", "showState $showState , distance:${info.distance}")
|
||||
// Log.i("emArrow", "showState $showState , distance:${info.distance}")
|
||||
}
|
||||
|
||||
private fun attachView() {
|
||||
// 处于漫游模式下不做处理
|
||||
if (CallerMapIdentifyManager.roma.second) {
|
||||
if (CallerMapIdentifyManager.roma.first != TAG) {
|
||||
if (CallerMapIdentifyManager.roam.second) {
|
||||
if (CallerMapIdentifyManager.roam.first != TAG) {
|
||||
ToastUtils.showLong("正在漫游中,不展示路口漫游")
|
||||
}
|
||||
return
|
||||
}
|
||||
CallerMapIdentifyManager.roma = Pair(TAG, true)
|
||||
CallerMapIdentifyManager.roam = Pair(TAG, true)
|
||||
this.visibility = View.VISIBLE
|
||||
ivZhiRoadRoamView.visibility = View.VISIBLE
|
||||
mapRoamView.visibility = View.VISIBLE
|
||||
@@ -145,7 +149,7 @@ class RoadCrossRoamView @JvmOverloads constructor(
|
||||
}
|
||||
mapRoamView.closeRoam()
|
||||
mapRoamView.visibility = View.GONE
|
||||
CallerMapIdentifyManager.roma = Pair("", false)
|
||||
CallerMapIdentifyManager.roam = Pair("", false)
|
||||
lvRoadCrossRoamTip.adapter = null
|
||||
animator?.cancel()
|
||||
if (lightMode) {
|
||||
|
||||
Reference in New Issue
Block a user