[2.13.0-arch-opt] merge
@@ -44,8 +44,7 @@ public class BusPassengerRouteFragment extends
|
||||
|
||||
private final String TAG = "BusPassengerRouteFragment";
|
||||
|
||||
private BusPassengerTrafficLightView mTrafficLightView;
|
||||
private List<BusPassengerStation> mStationsList = new ArrayList<>();
|
||||
private final List<BusPassengerStation> mStationsList = new ArrayList<>();
|
||||
|
||||
private TextView mSpeedTv;
|
||||
private ConstraintLayout mNoLineInfoView;
|
||||
@@ -75,8 +74,6 @@ public class BusPassengerRouteFragment extends
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
mTrafficLightView = findViewById(R.id.bus_p_traffic_light_view);
|
||||
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
|
||||
|
||||
mSpeedTv = findViewById(R.id.bus_p_speed_tv);
|
||||
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* bus乘客端:红绿灯view
|
||||
*
|
||||
* Created on 2022/3/14
|
||||
*/
|
||||
public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private TextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
private ImageView mLightIconBG;
|
||||
|
||||
public BusPassengerTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public BusPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BusPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_p_traffic_light_view, this, true);
|
||||
mLightIconIV = findViewById(R.id.bus_p_traffic_light_iv);
|
||||
mLightTimeTV = findViewById(R.id.bus_p_traffic_light_time_tv);
|
||||
mLightIconBG = findViewById(R.id.bus_p_traffic_light_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
@Override
|
||||
public void showWarningTrafficLight(int checkLightId,int lightSource) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource);
|
||||
mCurrentLightId = checkLightId;
|
||||
updateTrafficLightIcon(checkLightId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
@Override
|
||||
public void disableWarningTrafficLight() {
|
||||
super.disableWarningTrafficLight();
|
||||
UiThreadHandler.post(() -> {
|
||||
mCurrentLightId = 0;
|
||||
BusPassengerTrafficLightView.this.setVisibility(GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
resetView();
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
break;
|
||||
case 2:
|
||||
changeCountdownYellow(yellowNum);
|
||||
break;
|
||||
case 3:
|
||||
changeCountdownGreen(greenNum);
|
||||
break;
|
||||
default:
|
||||
UiThreadHandler.post(() -> {
|
||||
mLightTimeTV.setText("");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private void updateTrafficLightIcon(int lightId) {
|
||||
UiThreadHandler.post(() -> {
|
||||
switch (lightId) {
|
||||
case 1:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_red_nor);
|
||||
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_yellow_nor);
|
||||
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_green_nor);
|
||||
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
default:
|
||||
BusPassengerTrafficLightView.this.setVisibility(GONE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCountdown() {
|
||||
super.disableCountdown();
|
||||
UiThreadHandler.post(() ->{
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams){
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.bus_p_traffic_light_icon_size);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(GONE);
|
||||
mLightIconBG.getLayoutParams().width = (int)getResources().getDimension(R.dimen.dp_90);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void resetView(){
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.bus_p_route_traffic_light_view_width);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(VISIBLE);
|
||||
mLightIconBG.getLayoutParams().width = (int) getResources().getDimension(R.dimen.bus_p_traffic_light_bg_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.*
|
||||
|
||||
/**
|
||||
* bus乘客端:红绿灯view
|
||||
*
|
||||
* Created on 2022/3/14
|
||||
*/
|
||||
class BusPassengerTrafficLightView @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusPassengerTrafficLightView"
|
||||
}
|
||||
|
||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
||||
|
||||
init {
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context?) {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_p_traffic_light_view, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
super.showTrafficLight(checkLightId, lightSource)
|
||||
mCurrentLightId = checkLightId
|
||||
updateTrafficLightIcon(checkLightId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
UiThreadHandler.post {
|
||||
mCurrentLightId = TrafficLightEnum.BLACK
|
||||
this@BusPassengerTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
|
||||
resetView()
|
||||
when (mCurrentLightId) {
|
||||
TrafficLightEnum.RED -> changeCountdownRed(redNum)
|
||||
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
|
||||
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
|
||||
else -> UiThreadHandler.post { bus_p_traffic_light_time_tv.text = "" }
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
super.changeCountdownRed(redNum)
|
||||
UiThreadHandler.post {
|
||||
if (redNum > 0) {
|
||||
resetView()
|
||||
bus_p_traffic_light_time_tv.text = redNum.toString()
|
||||
} else {
|
||||
disableTrafficLightCountDown()
|
||||
bus_p_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
super.changeCountdownGreen(greenNum)
|
||||
UiThreadHandler.post {
|
||||
if (greenNum > 0) {
|
||||
resetView()
|
||||
bus_p_traffic_light_time_tv.text = greenNum.toString()
|
||||
} else {
|
||||
disableTrafficLightCountDown()
|
||||
bus_p_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
super.changeCountdownYellow(yellowNum)
|
||||
UiThreadHandler.post {
|
||||
if (yellowNum > 0) {
|
||||
resetView()
|
||||
bus_p_traffic_light_time_tv.text = yellowNum.toString()
|
||||
} else {
|
||||
disableTrafficLightCountDown()
|
||||
bus_p_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
|
||||
UiThreadHandler.post {
|
||||
when (lightId) {
|
||||
TrafficLightEnum.RED -> {
|
||||
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_red_nor)
|
||||
this@BusPassengerTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_yellow_nor)
|
||||
this@BusPassengerTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.GREEN -> {
|
||||
bus_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_light_green_nor)
|
||||
this@BusPassengerTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
else -> this@BusPassengerTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun disableTrafficLightCountDown() {
|
||||
super.disableTrafficLightCountDown()
|
||||
UiThreadHandler.post {
|
||||
val layoutParams = layoutParams
|
||||
if (layoutParams is MarginLayoutParams) {
|
||||
val lp = layoutParams
|
||||
lp.width = resources.getDimension(R.dimen.bus_p_traffic_light_icon_size).toInt()
|
||||
setLayoutParams(lp)
|
||||
bus_p_traffic_light_time_tv.visibility = GONE
|
||||
bus_p_traffic_light_bg.layoutParams.width =
|
||||
resources.getDimension(R.dimen.dp_90).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetView() {
|
||||
val layoutParams = layoutParams
|
||||
if (layoutParams is MarginLayoutParams) {
|
||||
val lp = layoutParams
|
||||
lp.width = resources.getDimension(R.dimen.bus_p_route_traffic_light_view_width).toInt()
|
||||
setLayoutParams(lp)
|
||||
bus_p_traffic_light_time_tv.visibility = VISIBLE
|
||||
bus_p_traffic_light_bg.layoutParams.width =
|
||||
resources.getDimension(R.dimen.bus_p_traffic_light_bg_width).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.mogo.och.bus.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Bus司机端:红绿灯view
|
||||
*
|
||||
* Created on 2022/3/29
|
||||
*/
|
||||
public class BusTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public BusTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public BusTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BusTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_traffic_light_view, this, true);
|
||||
mLightIconIV = findViewById(R.id.bus_traffic_light_iv);
|
||||
mLightTimeTV = findViewById(R.id.bus_traffic_light_time_tv);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
@Override
|
||||
public void showWarningTrafficLight(int checkLightId,int lightSource) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource);
|
||||
mCurrentLightId = checkLightId;
|
||||
updateTrafficLightIcon(checkLightId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
@Override
|
||||
public void disableWarningTrafficLight() {
|
||||
super.disableWarningTrafficLight();
|
||||
UiThreadHandler.post(() -> {
|
||||
mCurrentLightId = 0;
|
||||
BusTrafficLightView.this.setVisibility(GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
break;
|
||||
case 2:
|
||||
changeCountdownYellow(yellowNum);
|
||||
break;
|
||||
case 3:
|
||||
changeCountdownGreen(greenNum);
|
||||
break;
|
||||
default:
|
||||
UiThreadHandler.post(() -> {
|
||||
mLightTimeTV.setText("");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_traffic_light_red_color_up),
|
||||
getResources().getColor(R.color.bus_traffic_light_red_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_traffic_light_green_color_up),
|
||||
getResources().getColor(R.color.bus_traffic_light_green_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_traffic_light_yellow_color_up),
|
||||
getResources().getColor(R.color.bus_traffic_light_yellow_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private void updateTrafficLightIcon(int lightId) {
|
||||
UiThreadHandler.post(() -> {
|
||||
switch (lightId) {
|
||||
case 1:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.bus_light_red_nor);
|
||||
BusTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.bus_lightyellow_nor);
|
||||
BusTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.bus_light_green_nor);
|
||||
BusTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
default:
|
||||
BusTrafficLightView.this.setVisibility(GONE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/bus_traffic_light_layout_width"
|
||||
android:layout_height="@dimen/bus_traffic_light_layout_height"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/bus_traffic_light_bg_width"
|
||||
android:layout_height="@dimen/bus_traffic_light_bg_height"
|
||||
android:background="@drawable/bg_bus_traffic_light_background"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginLeft="@dimen/bus_traffic_light_bg_margin_left"
|
||||
android:layout_marginTop="@dimen/bus_traffic_light_bg_margin_top"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_traffic_light_iv"
|
||||
android:layout_width="@dimen/bus_traffic_light_icon_size"
|
||||
android:layout_height="@dimen/bus_traffic_light_icon_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/bus_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/bus_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="@dimen/bus_traffic_light_time_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,158 +0,0 @@
|
||||
package com.mogo.och.sweeper.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.sweeper.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* 清扫车:红绿灯view-
|
||||
*
|
||||
* Created on 2022/3/29
|
||||
*/
|
||||
public class SweeperTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private TextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public SweeperTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public SweeperTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SweeperTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true);
|
||||
mLightIconIV = findViewById(R.id.sweeper_traffic_light_iv);
|
||||
mLightTimeTV = findViewById(R.id.sweeper_traffic_light_time_tv);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
@Override
|
||||
public void showWarningTrafficLight(int checkLightId,int lightSource) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource);
|
||||
mCurrentLightId = checkLightId;
|
||||
updateTrafficLightIcon(checkLightId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
@Override
|
||||
public void disableWarningTrafficLight() {
|
||||
super.disableWarningTrafficLight();
|
||||
UiThreadHandler.post(() -> {
|
||||
mCurrentLightId = 0;
|
||||
SweeperTrafficLightView.this.setVisibility(GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
break;
|
||||
case 2:
|
||||
changeCountdownYellow(yellowNum);
|
||||
break;
|
||||
case 3:
|
||||
changeCountdownGreen(greenNum);
|
||||
break;
|
||||
default:
|
||||
UiThreadHandler.post(() -> {
|
||||
mLightTimeTV.setText("");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private void updateTrafficLightIcon(int lightId) {
|
||||
UiThreadHandler.post(() -> {
|
||||
switch (lightId) {
|
||||
case 1:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_red_nor);
|
||||
SweeperTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.sweeper_lightyellow_nor);
|
||||
SweeperTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.sweeper_light_green_nor);
|
||||
SweeperTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
default:
|
||||
SweeperTrafficLightView.this.setVisibility(GONE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.mogo.och.sweeper.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.sweeper.R
|
||||
import kotlinx.android.synthetic.main.sweeper_traffic_light_view.view.*
|
||||
|
||||
/**
|
||||
* 清扫车:红绿灯view-
|
||||
*
|
||||
* Created on 2022/3/29
|
||||
*/
|
||||
class SweeperTrafficLightView @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SweeperTrafficLightView"
|
||||
}
|
||||
|
||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
||||
|
||||
init {
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context?) {
|
||||
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
mCurrentLightId = checkLightId
|
||||
updateTrafficLightIcon(checkLightId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableTrafficLight() {
|
||||
UiThreadHandler.post {
|
||||
mCurrentLightId = TrafficLightEnum.BLACK
|
||||
this@SweeperTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
when (mCurrentLightId) {
|
||||
TrafficLightEnum.RED -> changeCountdownRed(redNum)
|
||||
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
|
||||
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
|
||||
else -> UiThreadHandler.post { sweeper_traffic_light_time_tv.text = "" }
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (redNum > 0) {
|
||||
sweeper_traffic_light_time_tv.text = redNum.toString()
|
||||
} else {
|
||||
sweeper_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (greenNum > 0) {
|
||||
sweeper_traffic_light_time_tv.text = greenNum.toString()
|
||||
} else {
|
||||
sweeper_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (yellowNum > 0) {
|
||||
sweeper_traffic_light_time_tv.text = yellowNum.toString()
|
||||
} else {
|
||||
sweeper_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
|
||||
UiThreadHandler.post {
|
||||
when (lightId) {
|
||||
TrafficLightEnum.RED -> {
|
||||
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_red_nor)
|
||||
this@SweeperTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_lightyellow_nor)
|
||||
this@SweeperTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.GREEN -> {
|
||||
sweeper_traffic_light_iv.setBackgroundResource(R.drawable.sweeper_light_green_nor)
|
||||
this@SweeperTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
else -> this@SweeperTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,6 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy;
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewNotification;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
@@ -58,7 +56,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
|
||||
private ImageView mAutopilotImage;
|
||||
private ImageView mMapswitchBtn;
|
||||
private TaxiPassengerTrafficLightView mTrafficLightView;
|
||||
|
||||
private WeakReference<TaxiPassengerArrivedView> mArrivedEndView;
|
||||
private WeakReference<TaxiPassengerCheckView> mArrivedCheckView;
|
||||
@@ -94,10 +91,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
hideEagleConfig();
|
||||
|
||||
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
|
||||
|
||||
mTrafficLightView = findViewById(R.id.traffic_light_view);
|
||||
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
|
||||
|
||||
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
|
||||
updateSwitchMapIcon();
|
||||
initListener();
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Taxi乘客端:红绿灯view
|
||||
*
|
||||
* Created on 2022/3/14
|
||||
*/
|
||||
public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
private ImageView mLightIconBG;
|
||||
|
||||
public TaxiPassengerTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public TaxiPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaxiPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_traffic_light_view, this, true);
|
||||
mLightIconIV = findViewById(R.id.taxi_p_traffic_light_iv);
|
||||
mLightTimeTV = findViewById(R.id.taxi_p_traffic_light_time_tv);
|
||||
mLightIconBG = findViewById(R.id.taxi_p_traffic_light_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
@Override
|
||||
public void showWarningTrafficLight(int checkLightId,int lightSource) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource);
|
||||
mCurrentLightId = checkLightId;
|
||||
updateTrafficLightIcon(checkLightId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
@Override
|
||||
public void disableWarningTrafficLight() {
|
||||
super.disableWarningTrafficLight();
|
||||
UiThreadHandler.post(() -> {
|
||||
mCurrentLightId = 0;
|
||||
TaxiPassengerTrafficLightView.this.setVisibility(GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
resetView();
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
break;
|
||||
case 2:
|
||||
changeCountdownYellow(yellowNum);
|
||||
break;
|
||||
case 3:
|
||||
changeCountdownGreen(greenNum);
|
||||
break;
|
||||
default:
|
||||
UiThreadHandler.post(() -> {
|
||||
mLightTimeTV.setText("");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_red_color_up),
|
||||
getResources().getColor(R.color.taxi_p_traffic_light_red_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_green_color_up),
|
||||
getResources().getColor(R.color.taxi_p_traffic_light_green_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_up),
|
||||
getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private void updateTrafficLightIcon(int lightId) {
|
||||
UiThreadHandler.post(() -> {
|
||||
switch (lightId) {
|
||||
case 1:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.taxi_p_light_red_nor);
|
||||
TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.taxi_p_lightyellow_nor);
|
||||
TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.taxi_p_light_green_nor);
|
||||
TaxiPassengerTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
default:
|
||||
TaxiPassengerTrafficLightView.this.setVisibility(GONE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void disableCountdown() {
|
||||
super.disableCountdown();
|
||||
UiThreadHandler.post(() ->{
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams){
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_icon_size);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(GONE);
|
||||
mLightIconBG.getLayoutParams().width = (int)getResources().getDimension(R.dimen.dp_124);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void resetView(){
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_layout_width);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(VISIBLE);
|
||||
mLightIconBG.getLayoutParams().width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_bg_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.mogo.och.taxi.passenger.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import kotlinx.android.synthetic.main.taxi_p_traffic_light_view.view.*
|
||||
|
||||
/**
|
||||
* Taxi乘客端:红绿灯view
|
||||
*
|
||||
* Created on 2022/3/14
|
||||
*/
|
||||
class TaxiPassengerTrafficLightView @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TaxiPassengerTrafficLightView"
|
||||
}
|
||||
|
||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
||||
|
||||
init {
|
||||
init(context)
|
||||
}
|
||||
|
||||
private fun init(context: Context?) {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_traffic_light_view, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
super.showTrafficLight(checkLightId, lightSource)
|
||||
mCurrentLightId = checkLightId
|
||||
updateTrafficLightIcon(checkLightId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
UiThreadHandler.post {
|
||||
mCurrentLightId = TrafficLightEnum.BLACK
|
||||
this@TaxiPassengerTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
|
||||
resetView()
|
||||
when (mCurrentLightId) {
|
||||
TrafficLightEnum.RED -> changeCountdownRed(redNum)
|
||||
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
|
||||
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
|
||||
else -> UiThreadHandler.post { taxi_p_traffic_light_time_tv.text = "" }
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
super.changeCountdownRed(redNum)
|
||||
UiThreadHandler.post {
|
||||
if (redNum > 0) {
|
||||
resetView()
|
||||
taxi_p_traffic_light_time_tv.setVertrial(true)
|
||||
taxi_p_traffic_light_time_tv.setmColorList(
|
||||
intArrayOf(
|
||||
resources.getColor(R.color.taxi_p_traffic_light_red_color_up),
|
||||
resources.getColor(R.color.taxi_p_traffic_light_red_color_down)
|
||||
)
|
||||
)
|
||||
taxi_p_traffic_light_time_tv.text = redNum.toString()
|
||||
} else {
|
||||
disableTrafficLightCountDown()
|
||||
taxi_p_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
super.changeCountdownGreen(greenNum)
|
||||
UiThreadHandler.post {
|
||||
if (greenNum > 0) {
|
||||
resetView()
|
||||
taxi_p_traffic_light_time_tv.setVertrial(true)
|
||||
taxi_p_traffic_light_time_tv.setmColorList(
|
||||
intArrayOf(
|
||||
resources.getColor(R.color.taxi_p_traffic_light_green_color_up),
|
||||
resources.getColor(R.color.taxi_p_traffic_light_green_color_down)
|
||||
)
|
||||
)
|
||||
taxi_p_traffic_light_time_tv.text = greenNum.toString()
|
||||
} else {
|
||||
disableTrafficLightCountDown()
|
||||
taxi_p_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
super.changeCountdownYellow(yellowNum)
|
||||
UiThreadHandler.post {
|
||||
if (yellowNum > 0) {
|
||||
resetView()
|
||||
taxi_p_traffic_light_time_tv.setVertrial(true)
|
||||
taxi_p_traffic_light_time_tv.setmColorList(
|
||||
intArrayOf(
|
||||
resources.getColor(R.color.taxi_p_traffic_light_yellow_color_up),
|
||||
resources.getColor(R.color.taxi_p_traffic_light_yellow_color_down)
|
||||
)
|
||||
)
|
||||
taxi_p_traffic_light_time_tv.text = yellowNum.toString()
|
||||
} else {
|
||||
disableTrafficLightCountDown()
|
||||
taxi_p_traffic_light_time_tv.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
|
||||
UiThreadHandler.post {
|
||||
when (lightId) {
|
||||
TrafficLightEnum.RED -> {
|
||||
taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_light_red_nor)
|
||||
this@TaxiPassengerTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_lightyellow_nor)
|
||||
this@TaxiPassengerTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.GREEN -> {
|
||||
taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_light_green_nor)
|
||||
this@TaxiPassengerTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
else -> this@TaxiPassengerTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun disableTrafficLightCountDown() {
|
||||
super.disableTrafficLightCountDown()
|
||||
UiThreadHandler.post {
|
||||
val layoutParams = layoutParams
|
||||
if (layoutParams is MarginLayoutParams) {
|
||||
layoutParams.width =
|
||||
resources.getDimension(R.dimen.taxi_p_traffic_light_icon_size).toInt()
|
||||
setLayoutParams(layoutParams)
|
||||
taxi_p_traffic_light_time_tv.visibility = GONE
|
||||
taxi_p_traffic_light_bg.layoutParams.width =
|
||||
resources.getDimension(R.dimen.dp_124).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetView() {
|
||||
val layoutParams = layoutParams
|
||||
if (layoutParams is MarginLayoutParams) {
|
||||
val lp = layoutParams
|
||||
lp.width = resources.getDimension(R.dimen.taxi_p_traffic_light_layout_width).toInt()
|
||||
setLayoutParams(lp)
|
||||
taxi_p_traffic_light_time_tv.visibility = VISIBLE
|
||||
taxi_p_traffic_light_bg.layoutParams.width =
|
||||
resources.getDimension(R.dimen.taxi_p_traffic_light_bg_width).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.taxi">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Taxi司机端:红绿灯view
|
||||
*
|
||||
* Created on 2022/3/29
|
||||
*/
|
||||
public class TaxiTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public TaxiTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public TaxiTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaxiTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_traffic_light_view, this, true);
|
||||
mLightIconIV = findViewById(R.id.taxi_traffic_light_iv);
|
||||
mLightTimeTV = findViewById(R.id.taxi_traffic_light_time_tv);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
@Override
|
||||
public void showWarningTrafficLight(int checkLightId,int lightSource) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource);
|
||||
mCurrentLightId = checkLightId;
|
||||
updateTrafficLightIcon(checkLightId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
@Override
|
||||
public void disableWarningTrafficLight() {
|
||||
super.disableWarningTrafficLight();
|
||||
UiThreadHandler.post(() -> {
|
||||
mCurrentLightId = 0;
|
||||
TaxiTrafficLightView.this.setVisibility(GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
break;
|
||||
case 2:
|
||||
changeCountdownYellow(yellowNum);
|
||||
break;
|
||||
case 3:
|
||||
changeCountdownGreen(greenNum);
|
||||
break;
|
||||
default:
|
||||
UiThreadHandler.post(() -> {
|
||||
mLightTimeTV.setText("");
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_traffic_light_red_color_up),
|
||||
getResources().getColor(R.color.taxi_traffic_light_red_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_traffic_light_green_color_up),
|
||||
getResources().getColor(R.color.taxi_traffic_light_green_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_traffic_light_yellow_color_up),
|
||||
getResources().getColor(R.color.taxi_traffic_light_yellow_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新红绿灯icon
|
||||
*
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
private void updateTrafficLightIcon(int lightId) {
|
||||
UiThreadHandler.post(() -> {
|
||||
switch (lightId) {
|
||||
case 1:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.taxi_light_red_nor);
|
||||
TaxiTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 2:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.taxi_lightyellow_nor);
|
||||
TaxiTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
mLightIconIV.setBackgroundResource(R.drawable.taxi_light_green_nor);
|
||||
TaxiTrafficLightView.this.setVisibility(VISIBLE);
|
||||
break;
|
||||
default:
|
||||
TaxiTrafficLightView.this.setVisibility(GONE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -89,8 +89,6 @@ object ConfigStartUp {
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
|
||||
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
|
||||
// HmiBuildConfig.isShowBrakeLightView = false
|
||||
// HmiBuildConfig.isShowTurnLightView = false
|
||||
} else if (AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode)) {
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.huanwei
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mogo.eagle.function.biz.v2x.trafficlight
|
||||
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
|
||||
class TrafficLightHMIManager {
|
||||
|
||||
companion object {
|
||||
const val TAG = "TrafficLightHMIManager"
|
||||
|
||||
val INSTANCE: TrafficLightHMIManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TrafficLightHMIManager()
|
||||
}
|
||||
}
|
||||
|
||||
private var initView: Boolean = false
|
||||
|
||||
fun isWarningTrafficLightShow(): Boolean {
|
||||
return CallerHmiManager.isWarningTrafficLightShow()
|
||||
}
|
||||
|
||||
fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
|
||||
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
|
||||
currentTrafficLight?.let {
|
||||
if (!initView) {
|
||||
initView = true
|
||||
CallerHmiManager.showWarningTrafficLight(0,1)
|
||||
}
|
||||
callerHMIToChangeLight(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun callerHMIToChangeLight(trafficLightStatus: TrafficLightStatus) {
|
||||
val remain = if (trafficLightStatus.remain > 99) {
|
||||
99
|
||||
} else {
|
||||
trafficLightStatus.remain
|
||||
}
|
||||
when {
|
||||
trafficLightStatus.isGreen() || trafficLightStatus.isFlashGreen() -> {
|
||||
CallerHmiManager.showWarningTrafficLight(3,1)
|
||||
CallerHmiManager.changeCountdownGreen(remain)
|
||||
// CallerHmiManager.changeCountdownRed(-1)
|
||||
// CallerHmiManager.changeCountdownYellow(-1)
|
||||
}
|
||||
trafficLightStatus.isYellow() -> {
|
||||
CallerHmiManager.showWarningTrafficLight(2,1)
|
||||
CallerHmiManager.changeCountdownYellow(remain)
|
||||
// CallerHmiManager.changeCountdownGreen(-1)
|
||||
// CallerHmiManager.changeCountdownRed(-1)
|
||||
}
|
||||
trafficLightStatus.isRed() -> {
|
||||
CallerHmiManager.showWarningTrafficLight(1,1)
|
||||
CallerHmiManager.changeCountdownRed(remain)
|
||||
// CallerHmiManager.changeCountdownGreen(-1)
|
||||
// CallerHmiManager.changeCountdownYellow(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun hideTrafficLight() {
|
||||
initView = false
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,13 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Liste
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.TrafficLightHMIManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
|
||||
@@ -46,9 +45,8 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
|
||||
mThreadHandler =
|
||||
TrafficLightThreadHandler(Looper.getMainLooper(), {
|
||||
//第一次查询路口时,如果红绿灯显示,则隐藏掉
|
||||
if (firstLoopCrossRoad && TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
if (firstLoopCrossRoad) {
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus()
|
||||
}
|
||||
firstLoopCrossRoad = false
|
||||
mLocation?.let { it ->
|
||||
@@ -98,10 +96,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
|
||||
2_000L
|
||||
)
|
||||
}
|
||||
if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
}
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus()
|
||||
CallerTrafficLightListenerManager.invokeTrafficRequestError()
|
||||
|
||||
})
|
||||
@@ -137,8 +132,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener {
|
||||
trafficLightResult = null
|
||||
firstLoopCrossRoad = true
|
||||
mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT)
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,23 @@ package com.mogo.eagle.function.biz.v2x.trafficlight.core
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.TrafficLightHMIManager
|
||||
import perception.TrafficLightOuterClass
|
||||
import perception.TrafficLightOuterClass.TrafficLight
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 对多个红绿灯信号来源进行统一调度(AI云、工控机)
|
||||
* @description 对多个红绿灯信号来源进行统一调度(AI云、工控机、OBU)
|
||||
* @优先级:OBU,云,工控
|
||||
* @since: 2022/4/28
|
||||
*/
|
||||
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener,
|
||||
IMoGoObuTrafficLightListener {
|
||||
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "TrafficLightDispatcher"
|
||||
@@ -34,6 +32,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
|
||||
//是否有AI获取红绿灯灯态
|
||||
private var hasAiLightStatus: Boolean = false
|
||||
|
||||
//obu数据
|
||||
private var hasObuLightStatus: Boolean = false
|
||||
|
||||
@@ -41,14 +40,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
mContext = context
|
||||
//注册监听AI云获取红绿灯状态
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听AI云进入路口
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听红绿灯请求失败
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
//obu红绿灯数据
|
||||
CallerObuTrafficLightListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,27 +64,36 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
}
|
||||
if (light == null) {
|
||||
//隐藏红绿灯显示
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
} else {
|
||||
when (light.state) {
|
||||
TrafficLightOuterClass.LightState.STATE_RED -> {
|
||||
//红灯
|
||||
CallerHmiManager.showWarningTrafficLight(1, 2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
TrafficLightEnum.RED,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
CallerTrafficLightListenerManager.changeCountdownRed(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
|
||||
//黄灯
|
||||
CallerHmiManager.showWarningTrafficLight(2, 2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
TrafficLightEnum.YELLOW,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_GREEN -> {
|
||||
//绿灯
|
||||
CallerHmiManager.showWarningTrafficLight(3, 2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(
|
||||
TrafficLightEnum.GREEN,
|
||||
DataSourceType.TELEMATIC
|
||||
)
|
||||
CallerTrafficLightListenerManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_OFF -> {
|
||||
//黑灯,隐藏红绿灯显示
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
@@ -107,7 +109,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
*/
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
if (!hasObuLightStatus) {
|
||||
TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult)
|
||||
updateTrafficLight(trafficLightResult)
|
||||
hasAiLightStatus = true
|
||||
}
|
||||
}
|
||||
@@ -122,11 +124,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
hasAiLightStatus = false
|
||||
hasObuLightStatus = false
|
||||
}, 5000)
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
//如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理
|
||||
if(!hasObuLightStatus){
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,21 +134,41 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
*/
|
||||
override fun onTrafficRequestError() {
|
||||
hasAiLightStatus = false
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
if(!hasObuLightStatus){
|
||||
if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}
|
||||
}
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
* obu 红绿灯数据
|
||||
*/
|
||||
override fun onObuTrafficLight(light: Int) {
|
||||
super.onObuTrafficLight(light)
|
||||
override fun onObuTrafficLightStatus(light: TrafficLightEnum) {
|
||||
super.onObuTrafficLightStatus(light)
|
||||
hasObuLightStatus = true
|
||||
CallerHmiManager.showWarningTrafficLight(light, 3)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(light, DataSourceType.OBU)
|
||||
}
|
||||
|
||||
private fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
|
||||
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
|
||||
currentTrafficLight?.let {
|
||||
val remain = if (it.remain > 99) {
|
||||
99
|
||||
} else {
|
||||
it.remain
|
||||
}
|
||||
when {
|
||||
it.isGreen() || it.isFlashGreen() -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.AICLOUD)
|
||||
CallerTrafficLightListenerManager.changeCountdownGreen(remain)
|
||||
}
|
||||
it.isYellow() -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.AICLOUD)
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
|
||||
}
|
||||
it.isRed() -> {
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.AICLOUD)
|
||||
CallerTrafficLightListenerManager.changeCountdownRed(remain)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
@@ -157,10 +176,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
//取消注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
//取消注册监听红绿灯请求失败
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
//取消注册监听AI云进入路口
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
@@ -14,6 +15,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
@@ -511,7 +513,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗,当收不到信号的时候触发一次
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
isShowGreenWave = false
|
||||
isShowRunRedLight = false
|
||||
@@ -626,7 +628,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
|
||||
when (currentLight.light) {
|
||||
// 灯光不可用
|
||||
0 -> {
|
||||
CallerHmiManager.showWarningTrafficLight(0, 2)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.BLACK, DataSourceType.TELEMATIC)
|
||||
}
|
||||
|
||||
// 红灯
|
||||
@@ -636,9 +638,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
|
||||
isRedLight = true
|
||||
}
|
||||
isGreenLight = false
|
||||
CallerHmiManager.showWarningTrafficLight(1, 2)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.TELEMATIC)
|
||||
val red = currentLight.countDown / 10
|
||||
CallerHmiManager.changeCountdownRed(red)
|
||||
CallerTrafficLightListenerManager.changeCountdownRed(red)
|
||||
}
|
||||
|
||||
// 绿灯
|
||||
@@ -648,17 +650,17 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
|
||||
isGreenLight = true
|
||||
}
|
||||
isRedLight = false
|
||||
CallerHmiManager.showWarningTrafficLight(3, 2)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.TELEMATIC)
|
||||
val green = currentLight.countDown / 10
|
||||
CallerHmiManager.changeCountdownGreen(green)
|
||||
CallerTrafficLightListenerManager.changeCountdownGreen(green)
|
||||
}
|
||||
|
||||
// 黄灯
|
||||
7, 8 -> {
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
CallerHmiManager.showWarningTrafficLight(2, 2)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.TELEMATIC)
|
||||
val yellow = currentLight.countDown / 10
|
||||
CallerHmiManager.changeCountdownYellow(yellow)
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(yellow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Defa
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -909,7 +909,7 @@ private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
isShowGreenWave = false
|
||||
isShowRunRedLight = false
|
||||
@@ -1052,7 +1052,7 @@ private fun changeTrafficLightStatus(
|
||||
when (currentLight.light) {
|
||||
// 灯光不可用
|
||||
0 -> {
|
||||
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0)
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.BLACK)
|
||||
}
|
||||
// 红灯
|
||||
2, 3 -> {
|
||||
@@ -1062,9 +1062,8 @@ private fun changeTrafficLightStatus(
|
||||
}
|
||||
isGreenLight = false
|
||||
isYellowLight = false
|
||||
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1)
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.RED)
|
||||
val red = currentLight.countDown.toInt()
|
||||
CallerHmiManager.changeCountdownRed(red)
|
||||
}
|
||||
|
||||
// 绿灯
|
||||
@@ -1075,9 +1074,8 @@ private fun changeTrafficLightStatus(
|
||||
}
|
||||
isRedLight = false
|
||||
isYellowLight = false
|
||||
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3)
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.GREEN)
|
||||
val green = currentLight.countDown.toInt()
|
||||
CallerHmiManager.changeCountdownGreen(green)
|
||||
}
|
||||
|
||||
// 黄灯
|
||||
@@ -1088,9 +1086,8 @@ private fun changeTrafficLightStatus(
|
||||
isRedLight = false
|
||||
isGreenLight = false
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2)
|
||||
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.YELLOW)
|
||||
val yellow = currentLight.countDown.toInt()
|
||||
CallerHmiManager.changeCountdownYellow(yellow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.mogo.eagle.core.function.hmi.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
|
||||
/**
|
||||
@@ -57,11 +59,17 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
|
||||
* @param trafficLightCountDown 对应交通灯倒计时,如果倒计时为0,则disable
|
||||
*/
|
||||
private fun dispatchShowWaring(trafficLightCheckType: Int, trafficLightCountDown: Int) {
|
||||
CallerHmiManager.showWarningTrafficLight(trafficLightCheckType,1)
|
||||
val trafficLightType = when(trafficLightCheckType){
|
||||
1 -> TrafficLightEnum.RED
|
||||
2 -> TrafficLightEnum.YELLOW
|
||||
3 -> TrafficLightEnum.GREEN
|
||||
else -> TrafficLightEnum.BLACK
|
||||
}
|
||||
CallerTrafficLightListenerManager.showTrafficLight(trafficLightType,DataSourceType.DEFAULT)
|
||||
when(trafficLightCheckType){
|
||||
1 -> CallerHmiManager.changeCountdownRed(trafficLightCountDown)
|
||||
2 -> CallerHmiManager.changeCountdownYellow(trafficLightCountDown)
|
||||
3 -> CallerHmiManager.changeCountdownGreen(trafficLightCountDown)
|
||||
1 -> CallerTrafficLightListenerManager.changeCountdownRed(trafficLightCountDown)
|
||||
2 -> CallerTrafficLightListenerManager.changeCountdownYellow(trafficLightCountDown)
|
||||
3 -> CallerTrafficLightListenerManager.changeCountdownGreen(trafficLightCountDown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +77,6 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
|
||||
* 关闭交通灯
|
||||
*/
|
||||
private fun dispatchCloseWaring() {
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,6 @@ import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
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.autopilot.CallerAutoPilotManager
|
||||
@@ -78,17 +76,12 @@ import java.util.concurrent.atomic.AtomicReference
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
|
||||
class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
IMoGoHmiProvider,
|
||||
IMoGoHmiViewProxy,
|
||||
MoGoHmiContract.View {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MoGoHmiFragment"
|
||||
}
|
||||
|
||||
// HMI 视图控件代理
|
||||
// todo 需要统一数据源 红绿灯 View代理
|
||||
private var mViewTrafficLight: IViewTrafficLight? = null
|
||||
|
||||
private val lastSpeakJob by lazy { AtomicReference<Job>() }
|
||||
private var lastShowV2XJob: Job? = null
|
||||
|
||||
@@ -98,14 +91,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
|
||||
}
|
||||
|
||||
/** todo ----------------------------------------------**/
|
||||
/**
|
||||
* 设置 红绿灯 代理View
|
||||
*/
|
||||
override fun setProxyTrafficLightView(view: IViewTrafficLight) {
|
||||
mViewTrafficLight = view
|
||||
}
|
||||
|
||||
/**
|
||||
* ok
|
||||
* 工控机重启返回结果
|
||||
@@ -309,55 +294,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认不亮起,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) {
|
||||
mViewTrafficLight?.showWarningTrafficLight(checkLightId, lightSource)
|
||||
}
|
||||
|
||||
override fun isWarningTrafficLightShow(): Boolean {
|
||||
return mViewTrafficLight?.visibility == View.VISIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableWarningTrafficLight() {
|
||||
mViewTrafficLight?.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯倒计时
|
||||
*/
|
||||
override fun disableWarningTrafficLightCountDown() {
|
||||
mViewTrafficLight?.disableCountdown()
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
mViewTrafficLight?.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
mViewTrafficLight?.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
mViewTrafficLight?.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
mViewTrafficLight?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示指定方位上的红框预警
|
||||
* @param direction
|
||||
@@ -509,7 +445,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
"${SceneConstant.M_DEVA}${"TurnLight"}",
|
||||
"---showTurnLight = $light ---isLeftLight = $isLeftLight ---isRightLight = $isRightLight"
|
||||
)
|
||||
if (HmiBuildConfig.isShowTurnLightView) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (light == 1 || light == 2) {
|
||||
if (!isVisualAngleChanged) {
|
||||
@@ -557,7 +492,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var isBrake: Boolean = false
|
||||
@@ -566,7 +500,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
* 显示刹车效果
|
||||
*/
|
||||
override fun showBrakeLight(light: Int) {
|
||||
if (HmiBuildConfig.isShowBrakeLightView) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (light == 1) { //刹车灯亮
|
||||
if (!isBrake) {
|
||||
@@ -587,8 +520,8 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
}
|
||||
}
|
||||
brakeView.setBrakeLight(light)
|
||||
}
|
||||
}
|
||||
}
|
||||
/** todo----------------------------------------------- **/
|
||||
|
||||
@@ -658,14 +591,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun setTurnLightFunction(isOpen: Boolean) {
|
||||
HmiBuildConfig.isShowTurnLightView = isOpen
|
||||
}
|
||||
|
||||
override fun setBrakeLightFunction(isOpen: Boolean) {
|
||||
HmiBuildConfig.isShowBrakeLightView = isOpen
|
||||
}
|
||||
|
||||
override fun setSnBinding(isOpen: Boolean) {
|
||||
HmiBuildConfig.isShowSnBindingView = isOpen
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ class PncActionsView @JvmOverloads constructor(
|
||||
//如果是存在云端红绿灯数据条件下,设置云端数据
|
||||
if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number)
|
||||
&& mTrafficLightResult != null
|
||||
&& getWaitTrafficlightTime().isNotBlank()) {
|
||||
actions += ",预计${getWaitTrafficlightTime()}秒后通过"
|
||||
&& getWaitTrafficLightTime().isNotBlank()) {
|
||||
actions += ",预计${getWaitTrafficLightTime()}秒后通过"
|
||||
} else {
|
||||
mTrafficLightResult = null
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class PncActionsView @JvmOverloads constructor(
|
||||
mTrafficLightResult = trafficLightResult
|
||||
}
|
||||
|
||||
private fun getWaitTrafficlightTime(): String {
|
||||
private fun getWaitTrafficLightTime(): String {
|
||||
return if (mTrafficLightResult != null
|
||||
&& mTrafficLightResult!!.currentRoadTrafficLight() != null
|
||||
&& mTrafficLightResult!!.currentRoadTrafficLight()!!.isRed()
|
||||
|
||||
@@ -1048,29 +1048,6 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打开、关闭转向灯控制
|
||||
*/
|
||||
tbOpenLight.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) {
|
||||
CallerHmiManager.setTurnLightFunction(true)
|
||||
} else {
|
||||
CallerHmiManager.setTurnLightFunction(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开、关闭刹车控制
|
||||
*/
|
||||
tbOpenBrakeLight.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) {
|
||||
CallerHmiManager.setBrakeLightFunction(true)
|
||||
} else {
|
||||
CallerHmiManager.setBrakeLightFunction(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sn绑定控制
|
||||
*/
|
||||
@@ -1959,22 +1936,6 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 车辆转向灯 数据
|
||||
* @param lightSwitch
|
||||
*/
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆刹车灯 数据
|
||||
* @param brakeLight
|
||||
*/
|
||||
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆方向盘转向角回调
|
||||
* @param steering 方向盘转向角
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_sop_setting.view.*
|
||||
@@ -139,7 +140,7 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
HmiBuildConfig.isShowTrafficLightView = false
|
||||
} else {
|
||||
HmiBuildConfig.isShowTrafficLightView = true
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,17 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.TrafficLightView_TAG
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
@@ -23,13 +27,18 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : IViewTrafficLight(context, attrs, defStyleAttr), IViewControlListener {
|
||||
) : LinearLayout(context, attrs, defStyleAttr), IViewControlListener, IMoGoTrafficLightListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SingleTrafficLightView"
|
||||
}
|
||||
|
||||
private var mLightIconIV: ImageView? = null
|
||||
private var mLightIconBG: ImageView? = null
|
||||
private var mLightTimeTV: GradientTextView? = null
|
||||
private var mLightSourceTV: TextView? = null
|
||||
private var mLightSourceDivider: View? = null
|
||||
private var mCurrentLightId = 0
|
||||
private var mCurrentLightId = TrafficLightEnum.BLACK
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
@@ -40,6 +49,7 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
mLightSourceTV = findViewById(R.id.hmi_traffic_light_source)
|
||||
mLightSourceDivider = findViewById(R.id.hmi_traffic_light_divider)
|
||||
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
CallerHmiViewControlListenerManager.addListener(TrafficLightView_TAG, this)
|
||||
}
|
||||
|
||||
@@ -50,6 +60,7 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
CallerHmiViewControlListenerManager.removeListener(TrafficLightView_TAG)
|
||||
}
|
||||
|
||||
@@ -57,10 +68,10 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
* @param lightSource 1:云端下发;2:自车感知 3:OBU
|
||||
*/
|
||||
override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) {
|
||||
super.showWarningTrafficLight(checkLightId, lightSource)
|
||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
super.showTrafficLight(checkLightId, lightSource)
|
||||
mCurrentLightId = checkLightId
|
||||
if (!HmiBuildConfig.isShowTrafficLightView) {
|
||||
updateTrafficLightIcon(checkLightId, lightSource)
|
||||
@@ -70,16 +81,16 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableWarningTrafficLight() {
|
||||
super.disableWarningTrafficLight()
|
||||
override fun disableTrafficLight() {
|
||||
super.disableTrafficLight()
|
||||
UiThreadHandler.post {
|
||||
mCurrentLightId = 0
|
||||
mCurrentLightId = TrafficLightEnum.BLACK
|
||||
this@SingleTrafficLightView.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun disableCountdown() {
|
||||
super.disableCountdown()
|
||||
override fun disableTrafficLightCountDown() {
|
||||
super.disableTrafficLightCountDown()
|
||||
UiThreadHandler.post {
|
||||
// 小巴车的司机端需要展示红绿灯信号来源
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
@@ -118,9 +129,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
resetView()
|
||||
when (mCurrentLightId) {
|
||||
1 -> changeCountdownRed(redNum)
|
||||
2 -> changeCountdownYellow(yellowNum)
|
||||
3 -> changeCountdownGreen(greenNum)
|
||||
TrafficLightEnum.RED -> changeCountdownRed(redNum)
|
||||
TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum)
|
||||
TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum)
|
||||
else -> UiThreadHandler.post { mLightTimeTV!!.text = "" }
|
||||
}
|
||||
}
|
||||
@@ -140,7 +151,7 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
)
|
||||
mLightTimeTV!!.text = redNum.toString()
|
||||
} else {
|
||||
disableCountdown()
|
||||
disableTrafficLightCountDown()
|
||||
mLightTimeTV!!.text = ""
|
||||
}
|
||||
}
|
||||
@@ -160,7 +171,7 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
)
|
||||
mLightTimeTV!!.text = greenNum.toString()
|
||||
} else {
|
||||
disableCountdown()
|
||||
disableTrafficLightCountDown()
|
||||
mLightTimeTV!!.text = ""
|
||||
}
|
||||
}
|
||||
@@ -180,7 +191,7 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
)
|
||||
mLightTimeTV!!.text = yellowNum.toString()
|
||||
} else {
|
||||
disableCountdown()
|
||||
disableTrafficLightCountDown()
|
||||
mLightTimeTV!!.text = ""
|
||||
}
|
||||
}
|
||||
@@ -192,30 +203,33 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
* @param lightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
private fun updateTrafficLightIcon(lightId: Int, lightSource: Int) {
|
||||
private fun updateTrafficLightIcon(lightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
UiThreadHandler.post {
|
||||
when (lightId) {
|
||||
1 -> {
|
||||
TrafficLightEnum.RED -> {
|
||||
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_red_nor)
|
||||
this@SingleTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
2 -> {
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_nor)
|
||||
this@SingleTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
3 -> {
|
||||
TrafficLightEnum.GREEN -> {
|
||||
mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_nor)
|
||||
this@SingleTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
else -> this@SingleTrafficLightView.visibility = GONE
|
||||
}
|
||||
when (lightSource) {
|
||||
1 -> {
|
||||
DataSourceType.AICLOUD -> {
|
||||
mLightSourceTV!!.text = "云端下发"
|
||||
}
|
||||
2 -> {
|
||||
DataSourceType.TELEMATIC -> {
|
||||
mLightSourceTV!!.text = "自车感知"
|
||||
}
|
||||
DataSourceType.OBU -> {
|
||||
mLightSourceTV!!.text = "OBU"
|
||||
}
|
||||
else -> {
|
||||
mLightSourceTV!!.visibility = GONE
|
||||
}
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_traffic_light_vr.view.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/4 3:16 下午
|
||||
* 红绿灯控件
|
||||
*/
|
||||
class TrafficLightView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : IViewTrafficLight(context, attrs, defStyleAttr) {
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_traffic_light_vr, this, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
override fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) {
|
||||
UiThreadHandler.post {
|
||||
visibility = View.VISIBLE
|
||||
when (checkLightId) {
|
||||
0 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
1 -> {
|
||||
ctvRedTrafficLight.isChecked = true
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
2 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = true
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
3 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
override fun disableWarningTrafficLight() {
|
||||
UiThreadHandler.post {
|
||||
visibility = View.GONE
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
ctvRedTrafficLight.text = ""
|
||||
ctvYellowTrafficLight.text = ""
|
||||
ctvGreenTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
changeCountdownGreen(readNum)
|
||||
changeCountdownYellow(yellowNum)
|
||||
changeCountdownRed(greenNum)
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (greenNum > 0) {
|
||||
ctvGreenTrafficLight.text = "$greenNum"
|
||||
} else {
|
||||
ctvGreenTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (yellowNum > 0) {
|
||||
ctvYellowTrafficLight.text = "$yellowNum"
|
||||
} else {
|
||||
ctvYellowTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
UiThreadHandler.post {
|
||||
if (redNum > 0) {
|
||||
ctvRedTrafficLight.text = "$redNum"
|
||||
} else {
|
||||
ctvRedTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1286,30 +1286,6 @@
|
||||
android:textOn="显示「小地图」"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbOpenLight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="关闭「转向灯控制」"
|
||||
android:textOn="打开「转向灯控制」"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbOpenBrakeLight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="关闭「刹车控制」"
|
||||
android:textOn="打开「刹车控制」"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbOpenSnBinding"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/clTrafficLight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_waring_traffic_light_vr"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
tools:visibility="visible">
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/ctvRedTrafficLight"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
android:background="@drawable/icon_waring_traffic_light_red_vr"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="38dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:checked="true"
|
||||
tools:text="99" />
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/ctvYellowTrafficLight"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
android:layout_marginStart="90dp"
|
||||
android:background="@drawable/icon_waring_traffic_light_yellow_vr"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="38dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/ctvRedTrafficLight"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:checked="true"
|
||||
tools:text="99" />
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/ctvGreenTrafficLight"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
android:layout_marginStart="90dp"
|
||||
android:background="@drawable/icon_waring_traffic_light_green_vr"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="38dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/ctvYellowTrafficLight"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:checked="true"
|
||||
tools:text="99" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 5.5 KiB |
@@ -7,18 +7,6 @@ package com.mogo.eagle.core.data.config
|
||||
*/
|
||||
object HmiBuildConfig {
|
||||
|
||||
/**
|
||||
* 是否展示 转向灯ui
|
||||
*/
|
||||
@JvmField
|
||||
var isShowTurnLightView = true
|
||||
|
||||
/**
|
||||
* 是否展示 刹车ui
|
||||
*/
|
||||
@JvmField
|
||||
var isShowBrakeLightView = true
|
||||
|
||||
/**
|
||||
* 是否显示 限速UI
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.eagle.core.data.enums
|
||||
|
||||
enum class TrafficLightEnum {
|
||||
RED,GREEN,YELLOW,BLACK
|
||||
}
|
||||
@@ -11,7 +11,7 @@ interface IMoGoChassisLamplightListener {
|
||||
* 车辆转向灯 数据
|
||||
* @param lightSwitch
|
||||
*/
|
||||
fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?)
|
||||
fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?){}
|
||||
|
||||
/**
|
||||
* 车辆刹车灯 数据
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.eagle.core.function.api.hmi
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
|
||||
/**
|
||||
* 设置HMI中控件代理接口
|
||||
*/
|
||||
interface IMoGoHmiViewProxy {
|
||||
|
||||
/**
|
||||
* 设置 红绿灯 代理View
|
||||
* @param view
|
||||
*/
|
||||
fun setProxyTrafficLightView(view: IViewTrafficLight)
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
|
||||
/**
|
||||
* 定义红绿灯View具备的功能接口
|
||||
*/
|
||||
abstract class IViewTrafficLight(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) :
|
||||
LinearLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
open fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) {}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
open fun disableWarningTrafficLight() {}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
open fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {}
|
||||
|
||||
open fun changeCountdownGreen(greenNum: Int) {}
|
||||
|
||||
open fun changeCountdownYellow(yellowNum: Int) {}
|
||||
|
||||
open fun changeCountdownRed(redNum: Int) {}
|
||||
|
||||
/**
|
||||
* 隐藏倒计时
|
||||
*/
|
||||
open fun disableCountdown(){}
|
||||
}
|
||||
@@ -8,29 +8,18 @@ import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/2 7:36 下午
|
||||
*/
|
||||
interface IMoGoHmiProvider : IMoGoHmiViewProxy {
|
||||
interface IMoGoHmiProvider {
|
||||
|
||||
/**
|
||||
* 浓雾预警
|
||||
*/
|
||||
fun displayEffects()
|
||||
|
||||
/**
|
||||
* 控制转向灯
|
||||
*/
|
||||
fun setTurnLightFunction(isOpen: Boolean)
|
||||
|
||||
/**
|
||||
* 控制刹车功能
|
||||
*/
|
||||
fun setBrakeLightFunction(isOpen: Boolean)
|
||||
|
||||
/**
|
||||
* 控制sn绑定功能
|
||||
*/
|
||||
@@ -57,51 +46,6 @@ interface IMoGoHmiProvider : IMoGoHmiViewProxy {
|
||||
*/
|
||||
fun disableWarningV2X(tag: String?)
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知
|
||||
*/
|
||||
fun showWarningTrafficLight(checkLightId: Int,lightSource: Int)
|
||||
|
||||
/**
|
||||
* 红绿灯是否展示
|
||||
*/
|
||||
fun isWarningTrafficLightShow(): Boolean
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警
|
||||
*/
|
||||
fun disableWarningTrafficLight()
|
||||
|
||||
/**
|
||||
* 关闭红绿灯倒计时
|
||||
*/
|
||||
fun disableWarningTrafficLightCountDown()
|
||||
|
||||
/**
|
||||
* 修改红灯倒计时
|
||||
*/
|
||||
fun changeCountdownRed(redNum: Int)
|
||||
|
||||
/**
|
||||
* 修改黄灯倒计时
|
||||
*/
|
||||
fun changeCountdownYellow(yellowNum: Int)
|
||||
|
||||
/**
|
||||
* 修改绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownGreen(greenNum: Int)
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int)
|
||||
|
||||
/**
|
||||
* 展示指定方位上的红框预警
|
||||
* @param direction
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.eagle.core.function.api.obu
|
||||
|
||||
/**
|
||||
* OBU 灯态信息
|
||||
* @author lixiaopeng
|
||||
* @date 2022/1/30 10:28 下午
|
||||
*/
|
||||
interface IMoGoObuTrafficLightListener {
|
||||
/**
|
||||
* @param light 灯的信息
|
||||
*/
|
||||
fun onObuTrafficLight(light: Int){}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.mogo.eagle.core.function.api.trafficlight
|
||||
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
|
||||
interface IMoGoTrafficLightListener {
|
||||
|
||||
/**
|
||||
* 当前红绿灯状态,包含红绿灯灯态,倒计时秒数,灯态经纬度,时间戳,剩余时间
|
||||
* 当前云端红绿灯状态,包含红绿灯灯态,倒计时秒数,灯态经纬度,时间戳,剩余时间
|
||||
*/
|
||||
fun onTrafficLightStatus(trafficLightResult: TrafficLightResult)
|
||||
fun onTrafficLightStatus(trafficLightResult: TrafficLightResult){}
|
||||
|
||||
/**
|
||||
* 车辆进入路口回调
|
||||
@@ -17,10 +19,46 @@ interface IMoGoTrafficLightListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* 红绿灯接口请求失败
|
||||
* 云端红绿灯接口请求失败
|
||||
*/
|
||||
fun onTrafficRequestError(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* obu红绿灯状态
|
||||
*/
|
||||
fun onObuTrafficLightStatus(light: TrafficLightEnum){}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发 2:自车感知 3:OBU
|
||||
*/
|
||||
fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {}
|
||||
|
||||
fun changeCountdownGreen(greenNum: Int) {}
|
||||
|
||||
fun changeCountdownYellow(yellowNum: Int) {}
|
||||
|
||||
fun changeCountdownRed(redNum: Int) {}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
fun disableTrafficLight() {}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯计数
|
||||
*/
|
||||
fun disableTrafficLightCountDown() {}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
|
||||
@@ -32,20 +31,6 @@ object CallerHmiManager {
|
||||
waringProviderApi?.displayEffects()
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制转向灯功能
|
||||
*/
|
||||
fun setTurnLightFunction(isOpen: Boolean) {
|
||||
waringProviderApi?.setTurnLightFunction(isOpen)
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制刹车功能
|
||||
*/
|
||||
fun setBrakeLightFunction(isOpen: Boolean) {
|
||||
waringProviderApi?.setBrakeLightFunction(isOpen)
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制显示sn绑定弹框
|
||||
*/
|
||||
@@ -98,67 +83,6 @@ object CallerHmiManager {
|
||||
waringProviderApi?.disableWarningV2X(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
* @param lightSource 1:云端下发;2:自车感知;3:OBU
|
||||
*/
|
||||
fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) {
|
||||
waringProviderApi?.showWarningTrafficLight(checkLightId, lightSource)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警
|
||||
*/
|
||||
fun disableWarningTrafficLight() {
|
||||
waringProviderApi?.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
/**
|
||||
* 红绿灯是否展示
|
||||
*/
|
||||
fun isWarningTrafficLightShow(): Boolean {
|
||||
return waringProviderApi?.isWarningTrafficLightShow() ?: false
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯倒计时
|
||||
*/
|
||||
fun disableWarningTrafficLightCountDown() {
|
||||
waringProviderApi?.disableWarningTrafficLightCountDown()
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改红灯倒计时
|
||||
*/
|
||||
fun changeCountdownRed(redNum: Int) {
|
||||
waringProviderApi?.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改黄灯倒计时
|
||||
*/
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
waringProviderApi?.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownGreen(greenNum: Int) {
|
||||
waringProviderApi?.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
waringProviderApi?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示指定方位上的红框预警
|
||||
* @param direction
|
||||
@@ -279,14 +203,6 @@ object CallerHmiManager {
|
||||
waringProviderApi?.hideSmallFragment()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 红绿灯 代理View
|
||||
* @param view
|
||||
*/
|
||||
fun setProxyTrafficLightView(view: IViewTrafficLight) {
|
||||
waringProviderApi?.setProxyTrafficLightView(view)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示工控机监控上报数据
|
||||
* @param errorReportList 错误级别上报数据列表
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* OBU 红绿灯数据监听管理
|
||||
*/
|
||||
object CallerObuTrafficLightListenerManager : CallerBase<IMoGoObuTrafficLightListener>() {
|
||||
|
||||
var mLight: Int = 0
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuTrafficLightListener) {
|
||||
listener.onObuTrafficLight(mLight)
|
||||
}
|
||||
|
||||
fun invokeObuTrafficLight(light: Int) {
|
||||
this.mLight = light
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onObuTrafficLight(light)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.mogo.eagle.core.function.call.trafficlight
|
||||
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener>() {
|
||||
object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener>() {
|
||||
|
||||
private var trafficLightResult: TrafficLightResult? = null
|
||||
|
||||
@@ -17,7 +19,6 @@ object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener
|
||||
fun invokeTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
this.trafficLightResult = trafficLightResult
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onTrafficLightStatus(trafficLightResult)
|
||||
}
|
||||
@@ -30,15 +31,78 @@ object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeTrafficRequestError(){
|
||||
M_LISTENERS.forEach{
|
||||
fun invokeTrafficRequestError() {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onTrafficRequestError()
|
||||
}
|
||||
}
|
||||
|
||||
fun resetTrafficLightData() {
|
||||
fun invokeObuTrafficLightStatus(light: TrafficLightEnum) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onObuTrafficLightStatus(light)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置红绿灯状态并隐藏
|
||||
*/
|
||||
fun resetTrafficLightStatus(hideTrafficLight:Boolean = true) {
|
||||
trafficLightResult = null
|
||||
// 隐藏traffic light
|
||||
if(hideTrafficLight){
|
||||
disableTrafficLight()
|
||||
}
|
||||
}
|
||||
|
||||
fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.showTrafficLight(checkLightId, lightSource)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownGreen(greenNum: Int) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.changeCountdownGreen(greenNum)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownRed(redNum: Int) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.changeCountdownRed(redNum)
|
||||
}
|
||||
}
|
||||
|
||||
fun disableTrafficLight() {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.disableTrafficLight()
|
||||
}
|
||||
}
|
||||
|
||||
fun disableTrafficLightCountDown() {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.disableTrafficLightCountDown()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||