Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0

# Conflicts:
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficLightView.kt
This commit is contained in:
donghongyu
2023-02-01 19:41:41 +08:00
206 changed files with 3587 additions and 2293 deletions

View File

@@ -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);

View File

@@ -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);
}
}
}

View File

@@ -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()
}
}
}

View File

@@ -29,6 +29,9 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
@@ -77,6 +80,11 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private ImageView mSwitchMapModeImage;
private LinearLayout mSwitchMapModeLayout;
//消息盒子
private DriverMsgBoxButtonView viewDriverMsgBoxButton;
private DriverMsgBoxListView viewDriverMsgBoxList;
private DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
private ObjectAnimator autopilotLoadingAnimator;
public boolean isAnimateRunning = false;
@@ -194,6 +202,22 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
if (mAICollectBtn != null) {
CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn);
}
//消息盒子
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton);
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
viewDriverMsgBoxButton.setClickListener(show -> {
if(show){
viewDriverMsgBoxList.setVisibility(View.VISIBLE);
viewDriverMsgBoxList.notifyData();
viewDriverMsgBoxBubble.setVisibility(View.GONE);
viewDriverMsgBoxBubble.isShowData(false);
}else{
viewDriverMsgBoxList.setVisibility(View.GONE);
viewDriverMsgBoxBubble.setVisibility(View.VISIBLE);
viewDriverMsgBoxBubble.isShowData(true);
}
});
}
@Nullable

View File

@@ -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;
}
});
}
}

View File

@@ -56,6 +56,7 @@
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="40dp"
app:layout_constraintRight_toLeftOf="@id/viewTrafficLightVr"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="SpeakableTextPresentCheck"
@@ -63,6 +64,7 @@
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
@@ -77,6 +79,35 @@
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
tools:visibility="visible"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
/>
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/viewTrafficLightVr"

View File

@@ -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>

View File

@@ -2,21 +2,32 @@ package com.mogo.och.sweeper.view
import android.content.Context
import android.util.AttributeSet
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
import android.widget.TextView
import android.view.LayoutInflater
import android.widget.ImageView
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
* 清扫车红绿灯view-
*
* Created on 2022/3/29
*/
class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
IViewTrafficLight(context, attrs, defStyleAttr) {
private var mLightIconIV: ImageView? = null
private var mLightTimeTV: TextView? = null
private var mCurrentLightId = 0
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)
@@ -24,8 +35,16 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs
private fun 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)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerTrafficLightListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerTrafficLightListenerManager.removeListener(TAG)
}
/**
@@ -34,8 +53,7 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs
* @param checkLightId 0-都是默认1-红2-黄3-绿
* @param lightSource 1:云端下发2:自车感知
*/
override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) {
super.showWarningTrafficLight(checkLightId, lightSource)
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
mCurrentLightId = checkLightId
updateTrafficLightIcon(checkLightId)
}
@@ -43,11 +61,10 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs
/**
* 关闭红绿灯预警展示,并重制灯态
*/
override fun disableWarningTrafficLight() {
super.disableWarningTrafficLight()
override fun disableTrafficLight() {
UiThreadHandler.post {
mCurrentLightId = 0
mLightIconIV!!.setImageResource(R.drawable.sweeper_light_gay_nor)
mCurrentLightId = TrafficLightEnum.BLACK
this@SweeperTrafficLightView.visibility = GONE
}
}
@@ -57,44 +74,40 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs
* @param greenNum 绿灯倒计时
*/
override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum)
when (mCurrentLightId) {
1 -> changeCountdownRed(redNum)
2 -> changeCountdownYellow(yellowNum)
3 -> changeCountdownGreen(greenNum)
else -> UiThreadHandler.post { mLightTimeTV!!.text = "" }
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) {
super.changeCountdownRed(redNum)
UiThreadHandler.post {
if (redNum > 0) {
mLightTimeTV!!.text = redNum.toString()
sweeper_traffic_light_time_tv.text = redNum.toString()
} else {
mLightTimeTV!!.text = ""
sweeper_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownGreen(greenNum: Int) {
super.changeCountdownGreen(greenNum)
UiThreadHandler.post {
if (greenNum > 0) {
mLightTimeTV!!.text = greenNum.toString()
sweeper_traffic_light_time_tv.text = greenNum.toString()
} else {
mLightTimeTV!!.text = ""
sweeper_traffic_light_time_tv.text = ""
}
}
}
override fun changeCountdownYellow(yellowNum: Int) {
super.changeCountdownYellow(yellowNum)
UiThreadHandler.post {
if (yellowNum > 0) {
mLightTimeTV!!.text = yellowNum.toString()
sweeper_traffic_light_time_tv.text = yellowNum.toString()
} else {
mLightTimeTV!!.text = ""
sweeper_traffic_light_time_tv.text = ""
}
}
}
@@ -104,13 +117,22 @@ class SweeperTrafficLightView @JvmOverloads constructor(context: Context?, attrs
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private fun updateTrafficLightIcon(lightId: Int) {
private fun updateTrafficLightIcon(lightId: TrafficLightEnum) {
UiThreadHandler.post {
when (lightId) {
1 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_red_nor)
2 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_lightyellow_nor)
3 -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_green_nor)
else -> mLightIconIV!!.setImageResource(R.drawable.sweeper_light_gay_nor)
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
}
}
}

View File

@@ -8,7 +8,7 @@ import com.mogo.och.taxi.passenger.mulprocess.ICallback;
interface ILeftMenuService {
/**
* 向主进程传选中的item
* Pass the selected item to the main process
*/
void transmissionIndex(int index);

View File

@@ -26,6 +26,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.msgbox.MsgBoxBean;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener;
@@ -607,6 +608,26 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
};
private final IMsgBoxEventListener iMsgBoxEventListener = new IMsgBoxEventListener() {
@Override
public void onBubbleReportClickEvent(@NonNull MsgBoxBean msgBoxBean) {
}
@Override
public void onBubbleV2XClickEvent(@NonNull MsgBoxBean msgBoxBean) {
}
@Override
public void onBubbleOperationClickEvent(@NonNull MsgBoxBean msgBoxBean) {
}
@Override
public void onUpdateTipEvent(boolean isShow) {
}
@Override
public void onSummaryClickEvent() {
if (mCurrentOCHOrder == null){

View File

@@ -15,12 +15,13 @@ 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;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxListView;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
@@ -55,12 +56,15 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
private ImageView mAutopilotImage;
private ImageView mMapswitchBtn;
private TaxiPassengerTrafficLightView mTrafficLightView;
private WeakReference<TaxiPassengerArrivedView> mArrivedEndView;
private WeakReference<TaxiPassengerCheckView> mArrivedCheckView;
private WeakReference<TaxiPassengerStartAutopilotView> mStartAutopilotView;
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
//消息盒子
private PassengerMsgBoxButtonView viewPassengerMsgBoxButton;
private PassengerMsgBoxBubbleView viewPassengerMsgBoxBubble;
private PassengerMsgBoxListView viewPassengerMsgBoxList;
private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -87,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();
@@ -100,6 +100,22 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
switchVRFlatMode(MogoStatusManager.getInstance().isVrMode());
//预加载视频进程
EmptyService.Companion.startService(getContext());
//消息盒子
viewPassengerMsgBoxButton = findViewById(R.id.viewPassengerMsgBoxButton);
viewPassengerMsgBoxBubble = findViewById(R.id.viewPassengerMsgBoxBubble);
viewPassengerMsgBoxList = findViewById(R.id.viewPassengerMsgBoxList);
viewPassengerMsgBoxButton.setClickListener(show -> {
if(show){
viewPassengerMsgBoxList.setVisibility(View.VISIBLE);
viewPassengerMsgBoxBubble.setVisibility(View.GONE);
viewPassengerMsgBoxBubble.isShowData(false);
}else{
viewPassengerMsgBoxList.setVisibility(View.GONE);
viewPassengerMsgBoxBubble.setVisibility(View.VISIBLE);
viewPassengerMsgBoxBubble.isShowData(true);
}
});
}
private void updateSwitchMapIcon() {

View File

@@ -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);
}
}
}

View File

@@ -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()
}
}
}

View File

@@ -50,6 +50,36 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<!--消息盒子-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxButtonView
android:id="@+id/viewPassengerMsgBoxButton"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginStart="320dp"
android:layout_marginBottom="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView
android:id="@+id/viewPassengerMsgBoxBubble"
android:layout_width="650dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintLeft_toLeftOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintRight_toRightOf="@id/viewPassengerMsgBoxButton" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxListView
android:id="@+id/viewPassengerMsgBoxList"
android:layout_width="650dp"
android:layout_height="750dp"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintLeft_toLeftOf="@id/viewPassengerMsgBoxButton"
app:layout_constraintRight_toRightOf="@id/viewPassengerMsgBoxButton" />
<ImageView
android:id="@+id/iv_temp"
android:layout_width="300dp"

View File

@@ -32,6 +32,9 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
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.map.CallerSmpManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -74,6 +77,11 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
protected RelativeLayout mSettingBtn;
protected LinearLayout mBadcaseBtn;
protected LinearLayout mAICollectBtn;
//消息盒子
protected DriverMsgBoxButtonView driverMsgBoxButtonView;
protected DriverMsgBoxListView viewDriverMsgBoxList;
protected DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
protected TaxiAmapNaviFragment ochAmapNaviFragment = null;
protected TaxiRottingNaviFragment taxiRottingNaviFragment = null;
// protected TaxiTrafficLightView mTrafficLightView;
@@ -153,7 +161,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
mAnimFlowIv = findViewById(R.id.anim_flow_iv);
mAutopilotTv = findViewById(R.id.module_och_autopilot_tv);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
driverMsgBoxButtonView = findViewById(R.id.viewDriverMsgBoxButton);
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
// mTrafficLightView = findViewById(R.id.taxi_traffic_light_view);
// CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
@@ -267,6 +277,19 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
showAmapNaviToStationFragment(false);
showRottingToStationFragment(false);
});
driverMsgBoxButtonView.setClickListener(show -> {
if(show){
viewDriverMsgBoxList.setVisibility(View.VISIBLE);
viewDriverMsgBoxList.notifyData();
viewDriverMsgBoxBubble.setVisibility(View.GONE);
viewDriverMsgBoxBubble.isShowData(false);
}else{
viewDriverMsgBoxList.setVisibility(View.GONE);
viewDriverMsgBoxBubble.setVisibility(View.VISIBLE);
viewDriverMsgBoxBubble.isShowData(true);
}
});
}
protected void onChangeOperationStatus() {

View File

@@ -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;
}
});
}
}

View File

@@ -121,6 +121,7 @@
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
@@ -135,6 +136,35 @@
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
tools:visibility="visible"/>
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
/>
<!--消息盒子打开视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
android:id="@+id/viewDriverMsgBoxList"
android:layout_width="864dp"
android:layout_height="746dp"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--消息盒子气泡视图-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
android:id="@+id/viewDriverMsgBoxBubble"
android:layout_width="864dp"
android:layout_height="wrap_content"
android:layout_marginEnd="40dp"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
<!--红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/viewTrafficLightVr"