清扫车左上状态UI布局修改

This commit is contained in:
bxb
2023-01-09 18:49:47 +08:00
parent 240a4bb09f
commit 639a528246
21 changed files with 450 additions and 18 deletions

View File

@@ -20,7 +20,6 @@ import androidx.constraintlayout.widget.Group;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
@@ -32,10 +31,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
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;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMapUIController;
import com.mogo.map.MogoMarkerManager;
@@ -46,6 +43,7 @@ import com.mogo.och.sweeper.R;
import com.mogo.och.sweeper.bean.SweeperRoutesResult;
import com.mogo.och.sweeper.constant.SweeperConst;
import com.mogo.och.sweeper.model.SweeperOrderModel;
import com.mogo.och.sweeper.view.SweeperTrafficDataView;
import com.mogo.och.sweeper.util.BDRouteDataTestUtils;
import com.mogo.och.sweeper.view.SlidePanelView;
@@ -76,7 +74,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
private Group groupTestPanel;
private FrameLayout flSpeed;
// private BusArcView mouduleArc;
private TrafficDataView mTrafficDataView;
private SweeperTrafficDataView mTrafficDataView;
private ImageView mUpgradeTipIv;
// private BusTrafficLightView mTrafficLightView;
@@ -122,7 +120,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
flSpeed = (FrameLayout) findViewById(R.id.fl_speed);
mTrafficDataView = (TrafficDataView) findViewById(R.id.sweeper_arc);
mTrafficDataView = findViewById(R.id.sweeper_arc);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);

View File

@@ -0,0 +1,33 @@
package com.mogo.och.sweeper.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity;
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class SweeperLimitingVelocityView extends IViewLimitingVelocity {
private TextView limitingVelocity;
public SweeperLimitingVelocityView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SweeperLimitingVelocityView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context,attrs,0);
initView(context);
}
@Override
public void updateLimitingSpeed(int limitingSpeed) {
super.updateLimitingSpeed(limitingSpeed);
limitingVelocity.setText(String.valueOf(limitingSpeed));
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this);
limitingVelocity = findViewById(R.id.tvLimitingVelocity);
}
}

View File

@@ -0,0 +1,175 @@
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.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.och.sweeper.R;
import org.jetbrains.annotations.NotNull;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import chassis.Chassis;
import chassis.VehicleStateOuterClass;
public class SweeperTrafficDataView extends ConstraintLayout {
private static final String TAG = "SweeperTrafficDataView";
private TapPositionView tapPositionView;//方向盘
private ImageView speedImage;//速度图标
private TextView speedTextView;//速度值
private TurnSignalView sweeperTurnSignal;//转向灯
private SweeperLimitingVelocityView sweeperLimitingVelocity;//限速
public SweeperTrafficDataView(@NonNull Context context) {
super(context);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_data, this);
tapPositionView = findViewById(R.id.sweeperTrafficPosition);
speedImage = findViewById(R.id.sweeperSpeedImage);
speedTextView = findViewById(R.id.sweeperSpeedText);
sweeperTurnSignal = findViewById(R.id.sweeperTurnSignal);
sweeperLimitingVelocity = findViewById(R.id.sweeperLimitingVelocity);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
//增加限速监听
CallLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
CallerAutopilotVehicleStateListenerManager.INSTANCE.removeListener(mIMoGoAutopilotVehicleStateListener);
CallLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener);
}
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
@Override
public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) {
}
/**
* 车辆转向灯
* @param lightSwitch
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
//转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
if (lightSwitch.getNumber()==1){
sweeperTurnSignal.showLeftSignal();
}else if(lightSwitch.getNumber()==2){
sweeperTurnSignal.showRightSignal();
}else{
sweeperTurnSignal.showDirection();
}
}
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight);
}
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
if (Math.abs(steering) < 1) {
steering = 0;
}
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
ThreadUtils.runOnUiThread(() -> {
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
});
}
@Override
public void onAutopilotDataException(long timestamp) {
}
@Override
public void onAutopilotAcc(float carAcc) {
}
@Override
public void onAutopilotBrake(float brake) {
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
}
@Override
public void onAutopilotThrottle(float throttle) {
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
}
};
/**
* 限速监听
*/
private final LimitingVelocityListener limitingVelocityListener = new LimitingVelocityListener(){
@Override
public void onLimitingVelocityChange(int limitingVelocity) {
//设置限速
sweeperLimitingVelocity.updateLimitingSpeed(limitingVelocity);
}
};
/**
* 速度设置
*/
public void updateSpeedWithValue(int newSpeed) {
if (speedTextView != null) {
speedTextView.setText(String.valueOf(newSpeed));
}
if (speedImage != null) {
speedImage.setBackgroundResource(newSpeed > 60 ? R.drawable.sweeper_traffic_data_speed_warning :R.drawable.sweeper_bg_traffic_data_speed);
}
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.och.sweeper.ui;
package com.mogo.och.sweeper.view;
import android.content.Context;
import android.util.AttributeSet;
@@ -9,12 +9,11 @@ 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 com.mogo.och.common.module.wigets.OCHGradientTextView;
import org.jetbrains.annotations.Nullable;
/**
* 清扫车红绿灯view
* 清扫车红绿灯view-
*
* Created on 2022/3/29
*/

View File

@@ -0,0 +1,62 @@
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.LinearLayout;
import com.mogo.och.sweeper.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class TurnSignalView extends LinearLayout {
private ImageView turnLeftView;
private ImageView turnRightView;
public TurnSignalView(Context context) {
super(context);
}
public TurnSignalView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public TurnSignalView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public TurnSignalView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_turn_signal, this);
turnLeftView = findViewById(R.id.turnLeftView);
turnRightView = findViewById(R.id.turnRightView);
}
/**
* 展示左转向灯
*/
public void showLeftSignal(){
turnLeftView.setSelected(true);
turnRightView.setSelected(false);
}
/**
* 展示右转向灯
*/
public void showRightSignal(){
turnLeftView.setSelected(false);
turnRightView.setSelected(true);
}
/**
* 默认情况及其直行时
*/
public void showDirection(){
turnLeftView.setSelected(false);
turnRightView.setSelected(false);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="#E63F4C7D" />
<size
android:width="50dp"
android:height="50dp" />
</shape>
</item>
<item>
<shape
android:innerRadius="23dp"
android:shape="ring"
android:thickness="2dp"
android:useLevel="false">
<solid android:color="#F03232" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/turn_signal_left_select" android:state_selected="true" />
<item android:drawable="@drawable/turn_signal_left_nor" android:state_selected="false"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/turn_signal_right_select" android:state_selected="true" />
<item android:drawable="@drawable/turn_signal_right_nor" android:state_selected="false"/>
</selector>

View File

@@ -15,12 +15,12 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
android:id="@+id/sweeper_arc"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.sweeper.view.SweeperTrafficDataView
android:id="@+id/sweeper_arc"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</FrameLayout>
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tvLimitingVelocity"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:background="@drawable/sweeper_bg_waring_limiting_velocity"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_24"
/>
</LinearLayout>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_320"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/sweeper_bg_traffic_data"
android:paddingStart="@dimen/dp_47"
android:paddingTop="@dimen/dp_22">
<ImageView
android:id="@+id/sweeperSpeedImage"
android:layout_width="@dimen/dp_154"
android:layout_height="@dimen/dp_154"
android:background="@drawable/sweeper_bg_traffic_data_speed"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_22"
/>
<TextView
android:id="@+id/sweeperSpeedText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/sweeperSpeedImage"
app:layout_constraintRight_toRightOf="@+id/sweeperSpeedImage"
android:text="0"
android:gravity="center"
android:textSize="@dimen/dp_48"
android:layout_marginTop="@dimen/dp_38"
android:textColor="@color/white"
android:textStyle="bold"
/>
<TextView
android:id="@+id/sweeperKmText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="KM/H"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="@dimen/dp_23"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/sweeperSpeedImage"
app:layout_constraintRight_toRightOf="@+id/sweeperSpeedImage"
app:layout_constraintTop_toBottomOf="@+id/sweeperSpeedText"/>
<com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView
android:id="@+id/sweeperTrafficPosition"
android:layout_width="@dimen/dp_200"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_30"
app:defaultColor="@color/acc_default_txt_color"
app:layout_constraintLeft_toRightOf="@+id/sweeperSpeedImage"
app:layout_constraintTop_toTopOf="parent"
app:selectColor="@color/dark_mode_select_txt_color"
android:layout_marginTop="@dimen/dp_35"/>
<View
android:id="@+id/line1"
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_34"
app:layout_constraintStart_toEndOf="@+id/sweeperTrafficPosition"
app:layout_constraintTop_toTopOf="@+id/sweeperTrafficPosition"
app:layout_constraintBottom_toBottomOf="@+id/sweeperTrafficPosition"
android:layout_marginStart="@dimen/dp_30"
android:background="#414869"/>
<com.mogo.och.sweeper.view.SweeperLimitingVelocityView
android:id="@+id/sweeperLimitingVelocity"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
app:layout_constraintStart_toEndOf="@+id/line1"
app:layout_constraintTop_toTopOf="@+id/sweeperTrafficPosition"
app:layout_constraintBottom_toBottomOf="@+id/sweeperTrafficPosition"
android:layout_marginStart="@dimen/dp_30"
/>
<com.mogo.och.sweeper.view.TurnSignalView
android:id="@+id/sweeperTurnSignal"
android:layout_width="@dimen/dp_200"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/sweeperTrafficPosition"
app:layout_constraintLeft_toRightOf="@+id/sweeperSpeedImage"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30"/>
<View
android:id="@+id/line2"
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_34"
app:layout_constraintStart_toEndOf="@+id/sweeperTurnSignal"
app:layout_constraintTop_toTopOf="@+id/sweeperTurnSignal"
app:layout_constraintBottom_toBottomOf="@+id/sweeperTurnSignal"
android:layout_marginStart="@dimen/dp_30"
android:background="#414869"/>
<com.mogo.och.sweeper.view.SweeperTrafficLightView
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
app:layout_constraintStart_toEndOf="@+id/line2"
app:layout_constraintTop_toTopOf="@+id/sweeperTurnSignal"
app:layout_constraintBottom_toBottomOf="@+id/sweeperTurnSignal"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/sweeper_traffic_light_iv"
android:layout_width="@dimen/sweeper_traffic_light_icon_size"
android:layout_height="@dimen/sweeper_traffic_light_icon_size"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/sweeper_light_red_nor"/>
<TextView

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/turnLeftView"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:src="@drawable/turn_signal_left_selector"
android:layout_weight="1"/>
<ImageView
android:id="@+id/turnRightView"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:src="@drawable/turn_signal_right_selector"
android:layout_marginStart="@dimen/dp_20"
android:layout_weight="1"/>
</LinearLayout>

View File

@@ -145,7 +145,7 @@
<dimen name="sweeper_traffic_light_bg_height">120dp</dimen>
<dimen name="sweeper_traffic_light_bg_margin_left">15dp</dimen>
<dimen name="sweeper_traffic_light_bg_margin_top">17dp</dimen>
<dimen name="sweeper_traffic_light_icon_size">100dp</dimen>
<dimen name="sweeper_traffic_light_icon_size">140dp</dimen>
<dimen name="sweeper_traffic_light_time_view_width">130dp</dimen>
<dimen name="sweeper_traffic_light_time_size">60dp</dimen>