[8.2.2][feat]新增B2美化呈现UI开发
This commit is contained in:
@@ -94,4 +94,8 @@ public class LanSocketManagerJava implements IReceivedMsgListener {
|
|||||||
public void onFusionColor(boolean fusionColor) {
|
public void onFusionColor(boolean fusionColor) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onB2DemoMode(boolean isB2DemoMode) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,18 @@ import android.content.Context
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.appcompat.widget.AppCompatTextView
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||||
|
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||||
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||||
|
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
import com.mogo.och.shuttle.weaknet.passenger.R
|
||||||
import com.mogo.och.shuttle.weaknet.passenger.callback.ICommonCallback
|
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.model.CommonModel
|
||||||
|
|
||||||
class StatusView : AppCompatTextView, ICommonCallback {
|
class StatusView : AppCompatTextView, ICommonCallback, IReceivedMsgListener {
|
||||||
|
|
||||||
private val TAG = "ItineraryView"
|
private val TAG = "ItineraryView"
|
||||||
|
|
||||||
@@ -17,31 +23,94 @@ class StatusView : AppCompatTextView, ICommonCallback {
|
|||||||
|
|
||||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
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) : super(
|
||||||
|
context,
|
||||||
|
attributeSet,
|
||||||
|
defStyleAttr
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow()
|
||||||
|
CallerTelematicListenerManager.addListener(TAG, this)
|
||||||
|
CommonModel.setRouteLineInfoCallback(TAG, this)
|
||||||
|
updateAutoIconState(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow()
|
||||||
|
CallerTelematicListenerManager.removeListener(TAG)
|
||||||
|
CommonModel.setRouteLineInfoCallback(TAG, null)
|
||||||
|
}
|
||||||
|
|
||||||
private fun initView() {
|
private fun initView() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
|
||||||
super.onVisibilityAggregated(isVisible)
|
override fun onB2DemoMode(isB2DemoMode: Boolean) {
|
||||||
if(isVisible){
|
super.onB2DemoMode(isB2DemoMode)
|
||||||
CommonModel.setRouteLineInfoCallback(TAG,this)
|
updateAutoIconState(1)
|
||||||
}else{
|
}
|
||||||
CommonModel.setRouteLineInfoCallback(TAG,null)
|
|
||||||
|
//美化模式状态变更回调
|
||||||
|
override fun onDemoMode(isDemoMode: Boolean) {
|
||||||
|
super.onDemoMode(isDemoMode)
|
||||||
|
updateAutoIconState(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateInOrderStatus(inOrder: Boolean) {
|
||||||
|
super.updateInOrderStatus(inOrder)
|
||||||
|
updateAutoIconState(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
//自动驾驶状态变更
|
||||||
|
override fun updateAutoStatus(state: Int) {
|
||||||
|
updateAutoIconState(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getStateIcon(source: Int): Int {
|
||||||
|
// 平行驾驶状态下
|
||||||
|
val sourceStr = when (source) {
|
||||||
|
0 -> "View初始化"
|
||||||
|
1 -> "B2美化模式状态变更"
|
||||||
|
2 -> "美化模式状态变更"
|
||||||
|
3 -> "订单状态变更"
|
||||||
|
4 -> "自动驾驶状态变更"
|
||||||
|
else -> "错误"
|
||||||
|
}
|
||||||
|
val autopilotState = CallerAutoPilotStatusListenerManager.getState()
|
||||||
|
CallerLogger.i(
|
||||||
|
TAG,
|
||||||
|
"数据刷新来源=$sourceStr 自动驾驶状态=${autopilotState} 订单状态=${CommonModel.inOrder} 美化模式状态=${FunctionBuildConfig.isDemoMode} B2美化模式状态=${FunctionBuildConfig.isB2DemoMode} "
|
||||||
|
)
|
||||||
|
if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING == autopilotState) {
|
||||||
|
return R.drawable.m2_status_parallel
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理非平行驾驶状态的情况
|
||||||
|
return when {
|
||||||
|
// 无订单的情况
|
||||||
|
!CommonModel.inOrder -> {
|
||||||
|
R.drawable.m2_status_basic
|
||||||
|
}
|
||||||
|
// 有订单,且美化状态和b2美化状态任意开着
|
||||||
|
CommonModel.inOrder && (FunctionBuildConfig.isDemoMode || FunctionBuildConfig.isB2DemoMode) -> {
|
||||||
|
R.drawable.m2_status_order_auto
|
||||||
|
}
|
||||||
|
// 有订单,且美化状态和b2美化状态都关着
|
||||||
|
CommonModel.inOrder && !FunctionBuildConfig.isDemoMode && !FunctionBuildConfig.isB2DemoMode -> {
|
||||||
|
if (autopilotState == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) R.drawable.m2_status_order_auto else R.drawable.m2_status_basic
|
||||||
|
}
|
||||||
|
// 覆盖所有可能的情况
|
||||||
|
else -> R.drawable.m2_status_basic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateAutoStatus(isAutoPilot: Boolean) {
|
private fun updateAutoIconState(source: Int) {
|
||||||
BizLoopManager.runInMainThread {
|
BizLoopManager.runInMainThread {
|
||||||
context?.let {
|
context?.let {
|
||||||
if (isAutoPilot) {
|
setTextColor(ContextCompat.getColor(it, R.color.common_FFFFFF))
|
||||||
setTextColor(ContextCompat.getColor(it, R.color.common_FFFFFF))
|
background = ContextCompat.getDrawable(it, getStateIcon(source))
|
||||||
background = ContextCompat.getDrawable(it, R.drawable.m2_autopilot_status_in)
|
|
||||||
} else {
|
|
||||||
setTextColor(ContextCompat.getColor(it, R.color.common_284F7E))
|
|
||||||
background = ContextCompat.getDrawable(it, R.drawable.m2_autopilot_status_out)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public interface ICommonCallback {
|
|||||||
*/
|
*/
|
||||||
default void updateAutoStatus(boolean isOpen){}
|
default void updateAutoStatus(boolean isOpen){}
|
||||||
|
|
||||||
|
default void updateAutoStatus(int state){}
|
||||||
|
default void updateInOrderStatus(boolean inOrder){}
|
||||||
default void updateLineStations(List<BusStationBean> stations){}
|
default void updateLineStations(List<BusStationBean> stations){}
|
||||||
|
|
||||||
default void clearCustomPolyline(){}
|
default void clearCustomPolyline(){}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ object CommonModel {
|
|||||||
private val TAG: String = SceneConstant.M_BUS_P+CommonModel::class.java.simpleName
|
private val TAG: String = SceneConstant.M_BUS_P+CommonModel::class.java.simpleName
|
||||||
|
|
||||||
var mContext: Context? = null
|
var mContext: Context? = null
|
||||||
|
var inOrder = false
|
||||||
|
|
||||||
private var mCommonCallbackList = mutableMapOf<String,ICommonCallback>()
|
private var mCommonCallbackList = mutableMapOf<String,ICommonCallback>()
|
||||||
|
|
||||||
@@ -140,12 +140,12 @@ object CommonModel {
|
|||||||
|
|
||||||
override fun onAutopilotStatusResponse(state: Int) {
|
override fun onAutopilotStatusResponse(state: Int) {
|
||||||
d(TAG, "onAutopilotStatusResponse ===== $state")
|
d(TAG, "onAutopilotStatusResponse ===== $state")
|
||||||
|
mCommonCallbackList.forEach {
|
||||||
|
it.value.updateAutoStatus(state)
|
||||||
|
}
|
||||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||||
//美化模式下且行程中
|
//美化模式下且行程中
|
||||||
if (FunctionBuildConfig.isDemoMode &&
|
if (FunctionBuildConfig.isDemoMode && inOrder()) {
|
||||||
mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1
|
|
||||||
&& isGoingToNextStation
|
|
||||||
){
|
|
||||||
mCommonCallbackList.forEach {
|
mCommonCallbackList.forEach {
|
||||||
it.value.updateAutoStatus(true)
|
it.value.updateAutoStatus(true)
|
||||||
}
|
}
|
||||||
@@ -232,6 +232,21 @@ object CommonModel {
|
|||||||
mCommonCallbackList.forEach {
|
mCommonCallbackList.forEach {
|
||||||
it.value.showNoTaskView(true)
|
it.value.showNoTaskView(true)
|
||||||
}
|
}
|
||||||
|
dispatchInOrder()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun dispatchInOrder() {
|
||||||
|
val newValue = inOrder()
|
||||||
|
if (inOrder != newValue) {
|
||||||
|
inOrder = newValue
|
||||||
|
mCommonCallbackList.forEach {
|
||||||
|
it.value.updateInOrderStatus(newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun inOrder(): Boolean {
|
||||||
|
return mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1 && isGoingToNextStation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -278,6 +293,7 @@ object CommonModel {
|
|||||||
val endStation = mStations[i + 1]
|
val endStation = mStations[i + 1]
|
||||||
startStationVideo(endStation)
|
startStationVideo(endStation)
|
||||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||||
|
dispatchInOrder()
|
||||||
return
|
return
|
||||||
} else if (!station.isLeaving) {
|
} else if (!station.isLeaving) {
|
||||||
if (i == stations.size - 1) {
|
if (i == stations.size - 1) {
|
||||||
@@ -288,6 +304,7 @@ object CommonModel {
|
|||||||
mCommonCallbackList.forEach {
|
mCommonCallbackList.forEach {
|
||||||
it.value.updateStationsInfo(stations, i, true)
|
it.value.updateStationsInfo(stations, i, true)
|
||||||
}
|
}
|
||||||
|
dispatchInOrder()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -24,10 +24,10 @@
|
|||||||
|
|
||||||
<com.mogo.och.shuttle.weaknet.passenger.ui.line.autopilot.status.StatusView
|
<com.mogo.och.shuttle.weaknet.passenger.ui.line.autopilot.status.StatusView
|
||||||
android:id="@+id/auto_tv"
|
android:id="@+id/auto_tv"
|
||||||
android:background="@drawable/m2_autopilot_status_out"
|
android:background="@drawable/m2_status_basic"
|
||||||
android:text="@string/m2_autopilot_status"
|
android:text="@string/m2_autopilot_status"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/common_284F7E"
|
android:textColor="@color/common_ffffffff"
|
||||||
android:textSize="@dimen/dp_26"
|
android:textSize="@dimen/dp_26"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginBottom="@dimen/dp_3"
|
android:layout_marginBottom="@dimen/dp_3"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
android:id="@+id/turn_light_layout"
|
android:id="@+id/turn_light_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/m2_autopilot_status_out"
|
android:background="@drawable/m2_turn_light_bg"
|
||||||
android:layout_gravity="top|center_horizontal"
|
android:layout_gravity="top|center_horizontal"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|||||||
@@ -388,10 +388,11 @@ class TeleMsgHandler : IMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TelematicConstant.CONTROL_B2_PRETTIFY_SWITCH -> {
|
TelematicConstant.CONTROL_B2_PRETTIFY_SWITCH -> {
|
||||||
CallerTelematicListenerManager.invokeReceivedMsg(
|
val value = when (String(it.body)) {
|
||||||
TelematicConstant.CONTROL_B2_PRETTIFY_SWITCH,
|
"1" -> true
|
||||||
it.body
|
else -> false
|
||||||
)
|
}
|
||||||
|
CallerTelematicListenerManager.dispatchB2DemoMode(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
TelematicConstant.SHOW_TRAFFIC_LIGHT -> {
|
TelematicConstant.SHOW_TRAFFIC_LIGHT -> {
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ object FunctionBuildConfig {
|
|||||||
@JvmField
|
@JvmField
|
||||||
var isDemoMode = false
|
var isDemoMode = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B2专用美化模式状态
|
||||||
|
* 目前仅用于自动驾驶状态UI变更
|
||||||
|
*/
|
||||||
|
@Volatile
|
||||||
|
@JvmField
|
||||||
|
var isB2DemoMode = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 6.2.6版本增加接管提醒开关
|
* 6.2.6版本增加接管提醒开关
|
||||||
* 控制掉自驾、接管类的消息是否展示(包括系统信息接管提醒、fm紧急停车提醒、平行驾驶接管提醒)
|
* 控制掉自驾、接管类的消息是否展示(包括系统信息接管提醒、fm紧急停车提醒、平行驾驶接管提醒)
|
||||||
|
|||||||
@@ -7,5 +7,7 @@ interface IReceivedMsgListener {
|
|||||||
|
|
||||||
fun onDemoMode(isDemoMode: Boolean) {}
|
fun onDemoMode(isDemoMode: Boolean) {}
|
||||||
|
|
||||||
|
fun onB2DemoMode(isB2DemoMode: Boolean) {}
|
||||||
|
|
||||||
fun onFusionColor(fusionColor: Boolean){}
|
fun onFusionColor(fusionColor: Boolean){}
|
||||||
}
|
}
|
||||||
@@ -58,6 +58,21 @@ object CallerTelematicListenerManager: CallerBase<IReceivedMsgListener>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun dispatchB2DemoMode(isB2DemoMode: Boolean) {
|
||||||
|
if (isB2DemoMode != FunctionBuildConfig.isB2DemoMode) {
|
||||||
|
FunctionBuildConfig.isB2DemoMode = isB2DemoMode
|
||||||
|
M_LISTENERS.forEach {
|
||||||
|
val listener = it.value
|
||||||
|
try {
|
||||||
|
listener.onB2DemoMode(isB2DemoMode)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
Log.e(TAG, "转发B2美化模式出现异常:${e.message}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun dispatchFusionColor(fusionColor: Boolean) {
|
fun dispatchFusionColor(fusionColor: Boolean) {
|
||||||
if (fusionColor != FunctionBuildConfig.isFusionColor) {
|
if (fusionColor != FunctionBuildConfig.isFusionColor) {
|
||||||
// FunctionBuildConfig.isFusionColor = fusionColor
|
// FunctionBuildConfig.isFusionColor = fusionColor
|
||||||
|
|||||||
Reference in New Issue
Block a user