[3.4.0]Taxi乘客屏转向灯+转向灯展示隐藏方法
This commit is contained in:
@@ -85,12 +85,23 @@
|
||||
android:id="@+id/traffic_light_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_95"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginRight="@dimen/taxi_p_traffic_light_layout_margin_right"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--转向灯-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.TurnLightViewStatus
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/traffic_light_view"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
app:user="taxi_p"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugViewTrigger
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.hmi.*
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerV2XWarningListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.lookaround.*
|
||||
@@ -38,6 +39,7 @@ import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.ToBindingCarDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.UpgradeAppDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.vehicle.TurnLightViewStatus
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
|
||||
import com.mogo.eagle.core.utilcode.floating.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||
@@ -373,4 +375,20 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
HmiBuildConfig.isShowTrafficLightView = true
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示转向灯
|
||||
*/
|
||||
override fun showTurnLightView() {
|
||||
HmiBuildConfig.isShowTurnLightView = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏转向灯
|
||||
*/
|
||||
override fun hideTurnLightView() {
|
||||
HmiBuildConfig.isShowTurnLightView = false
|
||||
CallerTurnLightListenerManager.invokeHideTurnLightView()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,8 +11,11 @@ import android.view.animation.Animation
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.Chassis
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
|
||||
@@ -27,7 +30,8 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener,
|
||||
IMoGoTurnLightListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TurnLightViewStatus"
|
||||
@@ -41,11 +45,21 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TurnLightView)
|
||||
val dayLight = typedArray.getBoolean(R.styleable.TurnLightView_day_light_mode, false)
|
||||
if (dayLight) {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.view_turn_light_status_daytime, this, true)
|
||||
} else {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
|
||||
val user = typedArray.getInt(R.styleable.TurnLightView_user,0)
|
||||
if(user!=0){
|
||||
when(user){
|
||||
1 ->{
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.view_turn_light_status_taxi_p, this, true)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (dayLight) {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.view_turn_light_status_daytime, this, true)
|
||||
} else {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
|
||||
}
|
||||
}
|
||||
visible = typedArray.getBoolean(R.styleable.TurnLightView_visible, false)
|
||||
if (visible) {
|
||||
@@ -59,18 +73,33 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
CallerTurnLightListenerManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun hideTurnLightView() {
|
||||
ThreadUtils.runOnUiThread{
|
||||
if (!isDisappear) {
|
||||
isDisappear = true
|
||||
isLeftLight = false
|
||||
isRightLight = false
|
||||
animationDisappear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
super.onAutopilotLightSwitchData(lightSwitch)
|
||||
lightSwitch?.let {
|
||||
ThreadUtils.runOnUiThread {
|
||||
setTurnLight(it)
|
||||
if(HmiBuildConfig.isShowTurnLightView){
|
||||
lightSwitch?.let {
|
||||
ThreadUtils.runOnUiThread {
|
||||
setTurnLight(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/turn_light_bg_taxi_p" />
|
||||
<corners android:radius="@dimen/turnlight_bg_corner" />
|
||||
</shape>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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/brakelight_width_daytime"
|
||||
android:layout_height="@dimen/brakelight_height_daytime"
|
||||
android:visibility="visible">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/turn_light_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/turn_light_background_taxi_p"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/left_nor_image"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_marginStart="@dimen/dp_35"
|
||||
android:src="@drawable/module_arrow_left_nor_taxi_p" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/right_nor_image"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_35"
|
||||
android:src="@drawable/module_arrow_right_nor_taxi_p" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/left_select_image"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_marginStart="@dimen/dp_35"
|
||||
android:src="@drawable/module_arrow_left_select_nor_taxi_p"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/right_select_image"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_35"
|
||||
android:src="@drawable/module_arrow_right_select_nor_taxi_p"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -72,6 +72,9 @@
|
||||
<declare-styleable name="TurnLightView">
|
||||
<attr name="day_light_mode" format="boolean"/>
|
||||
<attr name="visible" format="boolean"/>
|
||||
<attr name="user">
|
||||
<enum name="taxi_p" value="1" />
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PncActionsView">
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
<color name="turnlight_bg_color">#000000</color>
|
||||
<color name="brakelight_bg_color_daytime">#E6FFFFFF</color>
|
||||
<color name="turn_light_bg_taxi_p">#FFCEDCF7</color>
|
||||
|
||||
<color name="hmi_traffic_light_red_color_up">#FFFFA28B</color>
|
||||
<color name="hmi_traffic_light_red_color_down">#FFDA1100</color>
|
||||
|
||||
@@ -77,5 +77,11 @@ object HmiBuildConfig {
|
||||
@Volatile
|
||||
var isShowRunRedLightView = false
|
||||
|
||||
/**
|
||||
* 是否展示转向灯
|
||||
*/
|
||||
@JvmField
|
||||
@Volatile
|
||||
var isShowTurnLightView = true
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.eagle.core.function.api.datacenter.union
|
||||
|
||||
/**
|
||||
* 转向灯监听接口
|
||||
*/
|
||||
interface IMoGoTurnLightListener {
|
||||
|
||||
fun hideTurnLightView(){}
|
||||
}
|
||||
@@ -159,4 +159,14 @@ interface IMoGoHmiProvider :IProvider{
|
||||
* 隐藏红绿灯
|
||||
*/
|
||||
fun hideTrafficLightView()
|
||||
|
||||
/**
|
||||
* 展示转向灯
|
||||
*/
|
||||
fun showTurnLightView()
|
||||
|
||||
/**
|
||||
* 隐藏转向灯
|
||||
*/
|
||||
fun hideTurnLightView()
|
||||
}
|
||||
@@ -238,4 +238,18 @@ object CallerHmiManager {
|
||||
hmiProviderApi?.hideTrafficLightView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示转向灯
|
||||
*/
|
||||
fun showTurnLightView(){
|
||||
hmiProviderApi?.showTurnLightView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏转向灯
|
||||
*/
|
||||
fun hideTurnLightView(){
|
||||
hmiProviderApi?.hideTurnLightView()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.v2x
|
||||
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 转向灯事件管理
|
||||
*/
|
||||
object CallerTurnLightListenerManager: CallerBase<IMoGoTurnLightListener>() {
|
||||
|
||||
/**
|
||||
* 隐藏转向灯
|
||||
*/
|
||||
fun invokeHideTurnLightView(){
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.hideTurnLightView()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user