feat: 清扫车操作面板View 初版;

This commit is contained in:
aibingbing
2022-08-23 22:59:51 +08:00
parent cff7a5b2b5
commit 23c59f7256
14 changed files with 353 additions and 0 deletions

View File

@@ -72,6 +72,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
protected RelativeLayout mAICollectBtn;
public boolean isOperationStatus;//false-收车true-出车
private FrameLayout flStationPanelContainer;
private FrameLayout flSweepOperatePanelContatiner;//清扫车操作面板View的容器
private Group groupTestPanel;
private FrameLayout flSpeed;
// private BusArcView mouduleArc;
@@ -105,6 +106,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
}
private View panelView;
private View sweepOperatePanelView;
@Override
protected void initViews() {
@@ -114,6 +116,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
ctvAutopilotStatusIv = findViewById(R.id.sweeper_autopilot_btn_iv);
ctvAutopilotStatusTv = findViewById(R.id.sweeper_autopolot_btn_tv);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
flSweepOperatePanelContatiner = findViewById(R.id.module_mogo_och_sweeper_operate_panel);
// mTrafficLightView = findViewById(R.id.bus_traffic_light_view);
// CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
@@ -124,6 +127,7 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
mTrafficDataView = (TrafficDataView) findViewById(R.id.sweeper_arc);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
sweepOperatePanelView = LayoutInflater.from(getContext()).inflate(getSweepOperatePanelViewId(), flSweepOperatePanelContatiner);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
mSwitchMapModeLayout = findViewById(R.id.sweeper_switch_model_layout);
@@ -415,6 +419,12 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
*/
public abstract int getStationPanelViewId();
/**
* 获取清扫车操作面板layout id
* @return
*/
public abstract int getSweepOperatePanelViewId();
/**
* 重新开启自动驾驶
*/

View File

@@ -249,6 +249,11 @@ public class SweeperFragment extends BaseSweeperTabFragment<SweeperFragment, Swe
return R.layout.fragment_och_sweeper;
}
@Override
public int getSweepOperatePanelViewId() {
return R.layout.sweeper_operate_panel_view;
}
@Override
public void restartAutopilot() {
if (!isAnimateRunning) {

View File

@@ -0,0 +1,35 @@
package com.mogo.och.sweeper.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.och.sweeper.R;
/**
* 清扫车操作面板View
*/
public class SweeperOperatePanelView extends LinearLayout {
public SweeperOperatePanelView(Context context) {
super(context);
}
public SweeperOperatePanelView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public SweeperOperatePanelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SweeperOperatePanelView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_light_view, this, true);
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/sweeper_operate_panel_btn1_bg_close"/>
<corners android:radius="@dimen/sweeper_operate_panel_btn_bg_corner"/>
<stroke android:color="@color/sweeper_operate_panel_btn1_bg_stroke" android:width="1dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/sweeper_operate_panel_btn2_bg_default"/>
<corners android:radius="@dimen/sweeper_operate_panel_btn_bg_corner"/>
<stroke android:color="@color/sweeper_operate_panel_btn2_bg_stroke" android:width="1dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/sweeper_operate_panel_btn2_bg_disabled"/>
<corners android:radius="@dimen/sweeper_operate_panel_btn_bg_corner"/>
<stroke android:color="@color/sweeper_operate_panel_btn2_bg_stroke" android:width="1dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/sweeper_operate_panel_btn1_bg_open"/>
<corners android:radius="@dimen/sweeper_operate_panel_btn_bg_corner"/>
<stroke android:color="@color/sweeper_operate_panel_btn1_bg_stroke" android:width="1dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/sweeper_operate_panel_btn2_bg_pressed"/>
<corners android:radius="@dimen/sweeper_operate_panel_btn_bg_corner"/>
<stroke android:color="@color/sweeper_operate_panel_btn2_bg_stroke" android:width="1dp"/>
</shape>

View File

@@ -0,0 +1,4 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_sweeper_operate_panel_btn_close" android:state_selected="true"/>
<item android:drawable="@drawable/bg_sweeper_operate_panel_btn_open" />
</selector>

View File

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

View File

@@ -63,6 +63,17 @@
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
tools:visibility="visible" />
<FrameLayout
android:id="@+id/module_mogo_och_sweeper_operate_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginLeft="@dimen/dp_16"
app:layout_constraintLeft_toRightOf="@id/fl_speed"
app:layout_constraintTop_toTopOf="@id/fl_speed"
tools:background="#f00"
tools:visibility="visible" />
<include
android:id="@+id/module_mogo_och_sweeper_test_bar"
android:layout_width="wrap_content"

View File

@@ -0,0 +1,235 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/hint_main_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="车辆准备"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/btn_main_switch_open_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn1_bg_selector"
android:text="open"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_main_switch"
app:layout_constraintLeft_toRightOf="@id/hint_main_switch"/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/main_switch_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="hint_main_switch, btn_main_switch_open_close" />
<TextView
android:id="@+id/hint_operate_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="作业模式"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginTop="@dimen/dp_32"
app:layout_constraintTop_toBottomOf="@id/main_switch_barrier"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/btn_operate_mode_pure_sweep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="纯扫"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginLeft="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_operate_mode"
app:layout_constraintLeft_toRightOf="@id/hint_operate_mode"/>
<TextView
android:id="@+id/btn_operate_mode_pure_wash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="纯洗"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_operate_mode"
app:layout_constraintLeft_toRightOf="@id/btn_operate_mode_pure_sweep"/>
<TextView
android:id="@+id/btn_operate_mode_sweep_wash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="洗扫"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginTop="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toBottomOf="@id/btn_operate_mode_pure_sweep"
app:layout_constraintLeft_toLeftOf="@id/btn_operate_mode_pure_sweep"/>
<TextView
android:id="@+id/btn_operate_mode_pure_absorption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="洗吸"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/btn_operate_mode_sweep_wash"
app:layout_constraintLeft_toRightOf="@id/btn_operate_mode_sweep_wash"/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/operate_mode_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="hint_operate_mode, btn_operate_mode_pure_sweep, btn_operate_mode_pure_wash, btn_operate_mode_sweep_wash, btn_operate_mode_pure_absorption" />
<TextView
android:id="@+id/hint_clean_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="清扫方向"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginTop="@dimen/dp_32"
app:layout_constraintTop_toBottomOf="@id/operate_mode_barrier"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/btn_clean_direction_left_side"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="左侧"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_clean_direction"
app:layout_constraintLeft_toRightOf="@id/hint_clean_direction"/>
<TextView
android:id="@+id/btn_clean_direction_right_side"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="右侧"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_clean_direction"
app:layout_constraintLeft_toRightOf="@id/btn_clean_direction_left_side"/>
<TextView
android:id="@+id/btn_clean_direction_both_side"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="两侧"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginTop="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toBottomOf="@id/btn_clean_direction_left_side"
app:layout_constraintLeft_toLeftOf="@id/btn_clean_direction_left_side"/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/clean_direction_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="hint_clean_direction, btn_clean_direction_left_side, btn_clean_direction_right_side, btn_clean_direction_both_side" />
<TextView
android:id="@+id/hint_work_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="作业强度"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginTop="@dimen/dp_32"
app:layout_constraintTop_toBottomOf="@id/clean_direction_barrier"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/btn_work_level_normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="普通"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_work_level"
app:layout_constraintLeft_toRightOf="@id/hint_work_level"/>
<TextView
android:id="@+id/btn_work_level_hard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:text="强力"
android:textColor="#000000"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginStart="@dimen/dp_32"
android:paddingStart="@dimen/dp_20"
android:paddingEnd="@dimen/dp_20"
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_6"
app:layout_constraintTop_toTopOf="@id/hint_work_level"
app:layout_constraintLeft_toRightOf="@id/btn_work_level_normal"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -44,4 +44,13 @@
<color name="sweeper_traffic_light_green_color_down">#FF006D43</color>
<color name="sweeper_traffic_light_yellow_color_up">#FFFFE198</color>
<color name="sweeper_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="sweeper_operate_panel_btn1_bg_open">#7DE261</color>
<color name="sweeper_operate_panel_btn1_bg_close">#f00</color>
<color name="sweeper_operate_panel_btn1_bg_stroke">#BF30334C</color>
<color name="sweeper_operate_panel_btn2_bg_default">#ffffff</color>
<color name="sweeper_operate_panel_btn2_bg_pressed">#1FA7FF</color>
<color name="sweeper_operate_panel_btn2_bg_disabled">#50000000</color>
<color name="sweeper_operate_panel_btn2_bg_stroke">#BF30334C</color>
</resources>

View File

@@ -151,4 +151,7 @@
<dimen name="sweeper_traffic_light_icon_size">154px</dimen>
<dimen name="sweeper_traffic_light_time_view_width">130px</dimen>
<dimen name="sweeper_traffic_light_time_size">60px</dimen>
<dimen name="sweeper_operate_panel_btn_bg_corner">16px</dimen>
<dimen name="sweeper_operate_panel_btn_text_size">36px</dimen>
</resources>