[清扫车]上装面板修改

This commit is contained in:
bxb
2023-02-14 18:07:11 +08:00
parent 1637c74630
commit cccf3bdb69
18 changed files with 727 additions and 518 deletions

View File

@@ -59,10 +59,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
private Group groupTestPanel;
//清扫车车辆基本信息 速度 档位 转向灯 红绿灯等
private SweeperTrafficDataView mTrafficDataView;
//清扫车模式展示
private SweeperWorkModeView mClWorkMode;
//当前任务面板
private SweeperCurrentTaskInfoView mCurrentTaskView;
//人工驾驶地图View组控制
private Group mGroupNaviPanel;
//人工驾驶地图Fragment
@@ -89,8 +85,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
panelView = LayoutInflater.from(getContext()).inflate(getTaskListPanelViewId(), flTaskListPanelContainer);
mSwitchMapModeLayout = findViewById(R.id.sweeper_switch_model_layout);
mSwitchMapModeImage = findViewById(R.id.sweeper_switch_model_icon);
mClWorkMode = findViewById(R.id.sweeper_cl_work_mode);
mCurrentTaskView = findViewById(R.id.sweeper_current_task_view);
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
@@ -170,51 +164,6 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
mCloseNavIcon.setOnClickListener(this);
mRefreshNavi.setOnClickListener(this);
}
/**
* 任务列表面板隐藏或显示
*
* @return
*/
public void setShowTaskListPanelView(boolean isShow) {
if (isShow) {
panelView.setVisibility(View.VISIBLE);
} else {
panelView.setVisibility(View.GONE);
}
}
/**
* 当前任务面板隐藏或显示
*
* @return
*/
public void setShowCurrentTaskPanelView(boolean isShow) {
if (isShow) {
mCurrentTaskView.setVisibility(View.VISIBLE);
} else {
mCurrentTaskView.setVisibility(View.GONE);
}
}
/**
* 清扫模式展示面板
*
* @return
*/
public SweeperWorkModeView getWorkModePanelView() {
return mClWorkMode;
}
/**
* 当前任务面板
*
* @return
*/
public SweeperCurrentTaskInfoView getCurrentTaskPanelView() {
return mCurrentTaskView;
}
/**
* 清扫车任务列表面板view在{@link #initViews()}时候添加到container中
*

View File

@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import chassis.ChassisStatesOuterClass
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.bean.SubInfo
@@ -17,7 +18,6 @@ import com.mogo.och.sweeper.ui.adapter.TaskListAdapter
import com.mogo.och.sweeper.ui.dialog.SweeperManualDrivingDialog
import com.mogo.och.sweeper.ui.dialog.SweeperNoTitleCommonDialog
import com.mogo.och.sweeper.ui.popwindow.MenuPopWindow
import com.mogo.och.sweeper.util.SweeperFutianCmdUtil
import kotlinx.android.synthetic.main.fragment_och_sweeper.*
import kotlinx.android.synthetic.main.sweeper_no_data_common_view.*
@@ -38,7 +38,6 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
private var mMainTask: SweeperMainTaskBean? = null
private var mLocation:MogoLocation?=null
private var mSubTaskDetailBean:SweeperSubTaskDetailBean?=null
//当前经纬度
override fun getTagName(): String {
return "SweepersFragment"
@@ -58,7 +57,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mMainMutableList?.add(SweeperMainTaskBean(9, "惠新西街南口地铁站公交站", 10, 1675848980000L))
mMainMutableList?.add(SweeperMainTaskBean(10, "惠新西街南口地铁站公交站", 10, 1675935380000L))
mSubMutableList = mutableListOf()
mSubMutableList?.add(SubInfo(1, "环球贸易中心", 1200, 1, 2, "1小时40分钟", 1))
mSubMutableList?.add(SubInfo(1, "环球贸易中心", 1200, 1, 1, "1小时40分钟", 1))
mSubMutableList?.add(SubInfo(2, "环球贸易中心", 2000, 1, 1, "10小时34分钟", 1))
mSubMutableList?.add(SubInfo(3, "环球贸易中心", 500, 1, 1, "10小时34分钟", 1))
mSubMutableList?.add(SubInfo(4, "环球贸易中心", 10, 1, 1, "10小时34分钟", 0))
@@ -68,7 +67,6 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mSubMutableList?.add(SubInfo(8, "环球贸易中心", 400, 1, 1, "10小时34分钟", 1))
mSubMutableList?.add(SubInfo(9, "惠新西街南口地铁站公交站", 200, 1, 1, "10小时34分钟", 1))
mSubMutableList?.add(SubInfo(10, "惠新西街南口地铁站公交站", 300, 1, 1, "10小时34分钟", 1))
mAdapter = context?.let { TaskListAdapter(it, mMainMutableList) }
val linearLayoutManager = LinearLayoutManager(context)
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
@@ -76,6 +74,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
rvTaskList?.adapter = mAdapter
mAdapter?.setOnTaskItemClickListener(onTaskItemClickListener)
initListener()
sweeper_cl_work_mode.setTrafficDataView(trafficDataView)
}
override fun createPresenter(): SweeperPresenter {
@@ -91,6 +90,30 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
return R.layout.fragment_och_sweeper
}
/**
* 任务列表面板隐藏或显示
*
* @return
*/
fun setShowTaskListPanelView(isShow: Boolean) {
if (isShow) {
sweeper_current_task_list_view.visibility = View.VISIBLE
} else {
sweeper_current_task_list_view.visibility = View.GONE
}
}
/**
* 当前任务面板隐藏或显示
*
* @return
*/
fun setShowCurrentTaskPanelView(isShow: Boolean) {
if (isShow) {
sweeper_current_task_view.visibility = View.VISIBLE
} else {
sweeper_current_task_view.visibility = View.GONE
}
}
/**
* VR模式切换
*
@@ -98,8 +121,8 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
*/
fun onVRModeChanged(isVRMode: Boolean) {
if (mRootView != null) {
mRootView.visibility = if (isVRMode) View.VISIBLE else View.GONE
}
mRootView.visibility = if (isVRMode) View.VISIBLE else View.GONE
}
}
fun hideOchSweeper() {}
@@ -110,8 +133,8 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
/**
* 根据自动驾驶状态更新按钮
*/
fun readyTaskBtn(text: String, isClick: Boolean, isTaskWorking: Boolean) {
currentTaskPanelView.setEnableClickBtn(text, isClick, isTaskWorking)
fun readyTaskBtn(isClick: Boolean, isPause: Boolean) {
sweeper_current_task_view.setEnableClickBtn(isClick, isPause)
}
/**
@@ -123,23 +146,18 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mCurrentSubPosition=0
mSubTaskBean = SweeperSubTaskBean(task.mainTaskId, task.mainTaskName, task.mainTaskStartTime, 1, mSubMutableList)
//获取当前子任务列表
presenter?.getSubTaskList(task.mainTaskId, mSubTaskBean)
//presenter?.getSubTaskList(task.mainTaskId, mSubTaskBean)
}
//mock 数据
setSubTaskData()
if (mSubTaskType == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE) {//如果是人工驾驶子任务,则弹窗
if (mSubTaskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code) {//如果是人工驾驶子任务,则弹窗
manualDriving(null)
} else {
setShowTaskListPanelView(false)
workModePanelView.visibility = View.VISIBLE
setShowCurrentTaskPanelView(true)
currentTaskPanelView.setData(workModePanelView, mSubTaskBean, mCurrentSubPosition, this, presenter)
workModePanelView.setSweeperFutianCleanSystemState(
mSubTaskType,
if (mCleanSystemState == null) SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData() else mCleanSystemState,
trafficDataView
)
sweeper_cl_work_mode.visibility = View.VISIBLE
sweeper_current_task_view.setData(sweeper_cl_work_mode, mSubTaskBean, mCurrentSubPosition, this, presenter)
}
}
}
@@ -154,17 +172,17 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
}
override fun onMenuItemClick(itemType: TaskStatusEnum) {
when (itemType) {
TaskStatusEnum.JUMP_OVER_SUBTASK -> {//跳过任务
when (itemType.code) {
TaskStatusEnum.JUMP_OVER_SUBTASK.code -> {//跳过任务
presenter?.subTaskSkip(mSubTaskId, mIsLastSubTask)
//mock
if (mSubTaskType == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE){//人工驾驶子任务
if (mSubTaskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code){//人工驾驶子任务
showAmapNaviToStationFragment(false)
}
mCurrentSubPosition++
currentTaskPanelView.setData(workModePanelView, mSubTaskBean, mCurrentSubPosition, this@SweeperFragment, presenter)
sweeper_current_task_view.setData(sweeper_cl_work_mode, mSubTaskBean, mCurrentSubPosition, this@SweeperFragment, presenter)
}
TaskStatusEnum.END_TASK -> {
TaskStatusEnum.END_TASK.code -> {
subTaskEnd()
}
}
@@ -172,7 +190,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
this.mCleanSystemState = cleanSystemState
workModePanelView.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState, trafficDataView)
sweeper_cl_work_mode.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState)
}
/**
* 设置当前主任务列表数据
@@ -180,7 +198,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
fun setMainTaskList(mainTaskBeanList: MutableList<SweeperMainTaskBean>?) {
setShowCurrentTaskPanelView(false)
setShowTaskListPanelView(true)
workModePanelView.visibility = View.GONE
sweeper_cl_work_mode.visibility = View.GONE
if (mainTaskBeanList != null && mainTaskBeanList.isNotEmpty()) {
noTaskDataView.visibility = View.GONE
sweeperListCl.visibility = View.VISIBLE
@@ -199,13 +217,13 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
this.mSubTaskBean?.let {
setShowCurrentTaskPanelView(true)
setShowTaskListPanelView(false)
workModePanelView.visibility = View.VISIBLE
sweeper_cl_work_mode.visibility = View.VISIBLE
mCurrentSubPosition = if (isWorkingSubTask){//如果是正在执行的子任务
it.sort - 1
}else{
0
}
currentTaskPanelView.setData(workModePanelView, it, mCurrentSubPosition, this, presenter)
sweeper_current_task_view.setData(sweeper_cl_work_mode, it, mCurrentSubPosition, this, presenter)
setSubTaskData()
presenter?.getSubTaskDetail(mSubTaskId, mSubTaskType)//加载子任务详情包括轨迹信息
}
@@ -218,39 +236,38 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
if (isLastSubTask) {
setShowCurrentTaskPanelView(false)
setShowTaskListPanelView(true)
workModePanelView.visibility = View.GONE
sweeper_cl_work_mode.visibility = View.GONE
return
}
when (typeEnum) {
TaskStatusEnum.END_SUBTASK -> {//子任务结束
when (typeEnum.code) {
TaskStatusEnum.END_SUBTASK.code -> {//子任务结束
mCurrentSubPosition++
setSubTaskData()
presenter?.getSubTaskDetail(mSubTaskId, mSubTaskType)
if (mSubTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE) {//自动驾驶子任务
if (mSubTaskType.code == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code) {//自动驾驶子任务
presenter?.startTask(mSubTaskId, mSubTaskType)
}
}
TaskStatusEnum.JUMP_OVER_SUBTASK -> { //子任务跳过
TaskStatusEnum.JUMP_OVER_SUBTASK.code -> { //子任务跳过
presenter?.subTaskEnd(mSubTaskId, mIsLastSubTask)
if (mSubTaskType == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE){//人工驾驶子任务
if (mSubTaskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code){//人工驾驶子任务
showAmapNaviToStationFragment(false)
}
}
TaskStatusEnum.START_SUBTASK -> { //子任务开始
if (mSubTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE) {//自动驾驶子任务
readyTaskBtn("暂停任务", true, true)
TaskStatusEnum.START_SUBTASK.code -> { //子任务开始
if (mSubTaskType.code == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code) {//自动驾驶子任务
readyTaskBtn(true, true)
}else{
readyTaskBtn("准备出发", false, false)
readyTaskBtn(false, false)
}
setShowTaskListPanelView(false)
workModePanelView.visibility = View.VISIBLE
sweeper_cl_work_mode.visibility = View.VISIBLE
setShowCurrentTaskPanelView(true)
currentTaskPanelView.setCurrentData(mCurrentSubPosition)
workModePanelView.setSweeperFutianCleanSystemState(
mSubTaskType,
if (mCleanSystemState == null) SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData() else mCleanSystemState,
trafficDataView
)
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
// sweeper_cl_work_mode.setSweeperFutianCleanSystemState(
// mSubTaskType,
// if (mCleanSystemState == null) SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData() else mCleanSystemState
// )
}
}
@@ -260,7 +277,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
* 子任务信息详情,包括轨迹文件
*/
fun setSubTakDetail(subTaskDetailBean: SweeperSubTaskDetailBean, subTaskTypeEnum: SubTaskTypeEnum) {
if (subTaskTypeEnum == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE) {//人工驾驶子任务
if (subTaskTypeEnum.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code) {//人工驾驶子任务
this.mSubTaskDetailBean=subTaskDetailBean
manualDriving(subTaskDetailBean)
}
@@ -273,7 +290,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
if (isSuccess) {
setShowCurrentTaskPanelView(false)
setShowTaskListPanelView(true)
workModePanelView.visibility = View.GONE
sweeper_cl_work_mode.visibility = View.GONE
}
}
@@ -285,7 +302,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mSubTaskId = it[mCurrentSubPosition].taskId
mSubTaskName=it[mCurrentSubPosition].taskName
mSubTaskType = if (it[mCurrentSubPosition].taskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code)
SubTaskTypeEnum.AUTOPILOT_SUBTYPE else SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE
SubTaskTypeEnum.AUTOPILOT_SUBTYPE else SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE
//设置当前子任务id
presenter?.setSubTaskId(mSubTaskId)
//设置是否是最后一个子任务
@@ -312,7 +329,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
//mock
setShowTaskListPanelView(true)
setShowCurrentTaskPanelView(false)
workModePanelView.visibility = View.GONE
sweeper_cl_work_mode.visibility = View.GONE
}
override fun cancel() {
@@ -338,14 +355,13 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
presenter?.startNaviToStation(true, 40.199247410363796, 116.73367125257714, 40.20070929640184, 116.73582650844378)
//mock
setShowTaskListPanelView(false)
workModePanelView.visibility = View.VISIBLE
sweeper_cl_work_mode.visibility = View.VISIBLE
setShowCurrentTaskPanelView(true)
currentTaskPanelView.setData(workModePanelView, mSubTaskBean, mCurrentSubPosition, this@SweeperFragment, presenter)
workModePanelView.setSweeperFutianCleanSystemState(
mSubTaskType,
if (mCleanSystemState == null) SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData() else mCleanSystemState,
trafficDataView
)
sweeper_current_task_view.setData(sweeper_cl_work_mode, mSubTaskBean, mCurrentSubPosition, this@SweeperFragment, presenter)
// sweeper_cl_work_mode.setSweeperFutianCleanSystemState(
// mSubTaskType,
// if (mCleanSystemState == null) SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData() else mCleanSystemState
// )
}
})
endConfirmDialog?.show()

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemL
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCleanSystemListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
@@ -26,6 +27,7 @@ import com.mogo.och.sweeper.constant.SubTaskTypeEnum;
import com.mogo.och.sweeper.constant.TaskStatusEnum;
import com.mogo.och.sweeper.fragment.SweeperFragment;
import com.mogo.och.sweeper.model.SweeperTaskModel;
import com.mogo.och.sweeper.util.SweeperFutianCmdUtil;
import com.mogo.och.sweeper.util.SweeperTrajectoryManager;
import org.jetbrains.annotations.NotNull;
@@ -41,6 +43,8 @@ import mogo_msg.MogoReportMsg;
import planning.RoboSweeperTaskIndexOuterClass;
import system_master.SystemStatusInfo;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
/**
* 网约车小巴
*
@@ -55,6 +59,10 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
private int mSubTaskId = 0;
//当前是否最后一个子任务
private boolean mIsLastSubtask = false;
// 底盘数据回调时间间隔
private static final long VEHICLE_STATE_INTERVAL_MILLIS = 500L;
// 当前时间戳
private long mCurrentTimeMillis;
public SweeperPresenter(SweeperFragment view) {
super(view);
@@ -95,9 +103,10 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotStatusResponse sate:"+autopilotStatusInfo.getState());
switch (autopilotStatusInfo.getState()) {
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
runOnUIThread(() -> mView.readyTaskBtn("准备出发", false, false));
runOnUIThread(() -> mView.readyTaskBtn(false, false));
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
if (SweeperTaskModel.getInstance().getSubWorking()) {
@@ -110,16 +119,16 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
SweeperTaskModel.getInstance().closeBeautificationMode();
}
}
runOnUIThread(() -> mView.readyTaskBtn("准备出发", true, false));
runOnUIThread(() -> mView.readyTaskBtn(true, false));
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING://自动驾驶中
if (SweeperTaskModel.getInstance().getSubWorking()) {
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
SweeperTaskModel.getInstance().startBeautificationMode();
}
runOnUIThread(() -> mView.readyTaskBtn("暂停任务", true, true));
runOnUIThread(() -> mView.readyTaskBtn( true, true));
} else {
runOnUIThread(() -> mView.readyTaskBtn("准备出发", true, false));
runOnUIThread(() -> mView.readyTaskBtn(true, false));
}
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING://平行驾驶
if (SweeperTaskModel.getInstance().getSubWorking()) {
@@ -133,7 +142,7 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
SweeperTaskModel.getInstance().closeBeautificationMode();
}
}
runOnUIThread(() -> mView.readyTaskBtn("准备出发", true, false));
runOnUIThread(() -> mView.readyTaskBtn(true, false));
break;
default:
break;
@@ -221,6 +230,57 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
@Override
public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
long current = System.currentTimeMillis();
if (current - mCurrentTimeMillis <= VEHICLE_STATE_INTERVAL_MILLIS) {
return;
}
mCurrentTimeMillis = current;
boolean clean_open_requirement = cleanSystemState.getSecuMotWorkSts();
// 洗扫
boolean clean_mode_wash_sweep = cleanSystemState.getSecuModWashSweepSts();
// 纯洗
boolean clean_mode_pure_wash = cleanSystemState.getSecuModWashSts();
// 纯吸
boolean clean_mode_pure_draw = cleanSystemState.getSecuWorkTonSts();
// 左侧
boolean clean_direction_left_side = cleanSystemState.getSecuWorkLeftSts();
// 右侧
boolean clean_direction_right_side = cleanSystemState.getSecuWorkRightSts();
// 两侧
boolean clean_direction_both_side = cleanSystemState.getSecuWorkOnBothsidesSts();
// 作业强度状态
boolean clean_intensity_standard = cleanSystemState.getSecuWorkStandSts();
boolean clean_intensity_strong = cleanSystemState.getSecuWorkStrongSts();
// 纯扫 模式判断不是另外其他3个模式同时有清扫方向说明开启了纯扫模式
boolean clean_mode_pure_sweep = SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("开关:")
.append(clean_open_requirement)
.append("\n")
.append("纯扫:")
.append(clean_mode_wash_sweep)
.append("纯洗:")
.append(clean_mode_pure_wash)
.append("纯吸:")
.append(clean_mode_pure_draw)
.append("纯扫:")
.append("\n")
.append(clean_mode_pure_sweep)
.append("左侧:")
.append(clean_direction_left_side)
.append("右侧:")
.append(clean_direction_right_side)
.append("两侧:")
.append("\n")
.append(clean_direction_both_side)
.append("标准:")
.append(clean_intensity_standard)
.append("强力:")
.append(clean_intensity_strong);
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCleanSystemState"+stringBuilder);
runOnUIThread(() -> mView.onSweeperFutianCleanSystemState(cleanSystemState));
}
@@ -257,10 +317,8 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
*/
public void startTask(int subTaskId, SubTaskTypeEnum subTaskType) {
if (SweeperTaskModel.getInstance().getSubWorking()) {//如果任务正在执行中,被人工接管后掉出自驾,则只重启自动驾驶
if (subTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE){
if (subTaskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE) {
SweeperTaskModel.getInstance().startAutopilot();
}else{
}
} else {
SweeperTaskModel.getInstance().subTaskStart(subTaskId, subTaskType);
@@ -324,8 +382,8 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
}
@Override
public void setSubTaskBean(SweeperSubTaskBean subTaskBean,boolean isWorkingSubTask) {
mView.setSubTaskBean(subTaskBean,isWorkingSubTask);
public void setSubTaskBean(SweeperSubTaskBean subTaskBean, boolean isWorkingSubTask) {
mView.setSubTaskBean(subTaskBean, isWorkingSubTask);
}
@Override

View File

@@ -10,6 +10,7 @@ import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_SWE
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_WASH;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_WASH_SWEEP;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
@@ -17,7 +18,10 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -32,6 +36,7 @@ import com.mogo.och.sweeper.R;
import com.mogo.och.sweeper.callback.CleaningModeStateCallback;
import com.mogo.och.sweeper.constant.OperateStateEnum;
import com.mogo.och.sweeper.util.SweeperFutianCmdUtil;
import com.mogo.och.sweeper.view.NoTouchConstraintLayout;
import java.util.Arrays;
import java.util.HashMap;
@@ -42,6 +47,8 @@ import chassis.SpecialVehicleTaskCmdOuterClass;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_CLOSE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_CLOSE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_WORK_CLOSE;
import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_WORK_OPEN;
/**
* 清扫车操作面板View
@@ -51,6 +58,7 @@ public class SweeperOperatePanelView extends LinearLayout {
private static final String TAG = "SweeperOperatePanelView";
private static final int CMD_EXECUTE_TIMEOUT_SECONDS = 30;
private static final int CMD_EXECUTE_MOCK_SUCCESS_SECONDS = 3;
private boolean isFirst = false;
CheckedTextView mBtnCleanWorkOpenClose;//开关
CheckedTextView mBtnCleanModePureSweep;//纯扫
@@ -62,9 +70,10 @@ public class SweeperOperatePanelView extends LinearLayout {
CheckedTextView mBtnCleanDirectionBothSide;//两侧
CheckedTextView mBtnCleanIntensityStandard;//普通
CheckedTextView mBtnCleanIntensityStrong;//强力
LinearLayout mLoadingContainer;//loading container
TextView mLoadingHintTop;//loading 提示-上面
TextView mLoadingHintBottom;//loading 提示-下面
FrameLayout mLoadingContainer;//loading container
TextView mLoadingHint;//loading 文本提示
ImageView mLoadingView;//loading 转圈动画
NoTouchConstraintLayout mWorkmodePanelRootView;
// 作业模式相关操作按钮的id
List<Integer> cleanModeBtnViewIds = Arrays.asList(
@@ -114,6 +123,10 @@ public class SweeperOperatePanelView extends LinearLayout {
private CleaningModeStateCallback cleaningModeStateCallback;
private OperateStateEnum operateStateEnum = OperateStateEnum.SYNCING_STATUS;
private ObjectAnimator objectAnimator;
private static ChassisStatesOuterClass.SweeperFuTianTaskSystemStates mCurrentCleanSystemState;//当前作业模式
public SweeperOperatePanelView(Context context) {
@@ -138,6 +151,7 @@ public class SweeperOperatePanelView extends LinearLayout {
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_operate_panel_view, this, true);
mBtnCleanWorkOpenClose = (CheckedTextView) findViewById(R.id.btn_clean_work_open_close);
mWorkmodePanelRootView = (NoTouchConstraintLayout) findViewById(R.id.work_mode_panel_root_view);
mBtnCleanModePureSweep = (CheckedTextView) findViewById(R.id.btn_clean_mode_pure_sweep);
mBtnCleanModePureWash = (CheckedTextView) findViewById(R.id.btn_clean_mode_pure_wash);
mBtnCleanModeSweepWash = (CheckedTextView) findViewById(R.id.btn_clean_mode_sweep_wash);
@@ -148,8 +162,8 @@ public class SweeperOperatePanelView extends LinearLayout {
mBtnCleanIntensityStandard = (CheckedTextView) findViewById(R.id.btn_clean_intensity_standard);
mBtnCleanIntensityStrong = (CheckedTextView) findViewById(R.id.btn_clean_intensity_strong);
mLoadingContainer = findViewById(R.id.loading_hint_container);
mLoadingHintTop = findViewById(R.id.loading_hint_top);
mLoadingHintBottom = findViewById(R.id.loading_hint_bottom);
mLoadingHint = findViewById(R.id.loading_hint);
mLoadingView = findViewById(R.id.loading_view);
initViewListener();
}
@@ -165,6 +179,7 @@ public class SweeperOperatePanelView extends LinearLayout {
setClickListener(mBtnCleanIntensityStandard, (v) -> onCleanIntensityBtnClick(v));
setClickListener(mBtnCleanIntensityStrong, (v) -> onCleanIntensityBtnClick(v));
}
/**
* 清扫任务开关按钮点击事件
*/
@@ -198,21 +213,19 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdSuccess() {
runOnUIThread(() -> {
if (isCloseAction) {
mBtnCleanWorkOpenClose.setText("打开");
mBtnCleanWorkOpenClose.setChecked(false);
toggleCleanModeBtnsStatus(false);
toggleCleanDirectionBtnsStatus(false);
toggleCleanIntensityBtnsStatus(false);
} else {
mBtnCleanWorkOpenClose.setText("关闭");
mBtnCleanWorkOpenClose.setChecked(true);
toggleCleanModeBtnsStatus(true);
}
hideLoadingMask();
showCmdExecuteSuccessToast();
});
if (isCloseAction) {
mBtnCleanWorkOpenClose.setText("打开");
mBtnCleanWorkOpenClose.setChecked(false);
toggleCleanModeBtnsStatus(false);
toggleCleanDirectionBtnsStatus(false);
toggleCleanIntensityBtnsStatus(false);
} else {
mBtnCleanWorkOpenClose.setText("关闭");
mBtnCleanWorkOpenClose.setChecked(true);
toggleCleanModeBtnsStatus(true);
}
hideLoadingMask();
showCmdExecuteSuccessToast();
}
@Override
@@ -222,17 +235,15 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdTimeout() {
//按钮样式恢复原样
runOnUIThread(() -> {
if (isCloseAction) {
mBtnCleanWorkOpenClose.setText("打开");
mBtnCleanWorkOpenClose.setChecked(true);
} else {
mBtnCleanWorkOpenClose.setText("关闭");
mBtnCleanWorkOpenClose.setChecked(false);
}
hideLoadingMask();
showCmdExecuteTimeoutToast();
});
if (isCloseAction) {
mBtnCleanWorkOpenClose.setText("关闭");
mBtnCleanWorkOpenClose.setChecked(true);
} else {
mBtnCleanWorkOpenClose.setText("打开");
mBtnCleanWorkOpenClose.setChecked(false);
}
hideLoadingMask();
showCmdExecuteTimeoutToast();
}
};
if (isCloseAction) {
@@ -328,25 +339,23 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdSuccess() {
runOnUIThread(() -> {
((CheckedTextView) currentClickView).setChecked(!isClickCurrentChoosedModeBtn);
toggleCleanModeBtnsByChoosedViewId(currentClickView.getId(), isClickCurrentChoosedModeBtn);
if (isClickCurrentChoosedModeBtn) {
((CheckedTextView) currentClickView).setChecked(!isClickCurrentChoosedModeBtn);
toggleCleanModeBtnsByChoosedViewId(currentClickView.getId(), isClickCurrentChoosedModeBtn);
if (isClickCurrentChoosedModeBtn) {
toggleCleanDirectionBtnsStatus(false);
toggleCleanIntensityBtnsStatus(false);
} else {
// 如果是纯吸,没有设置清扫方向,同时自动设置作业强度为标准
if (isPureAbsorptionClick) {
toggleCleanDirectionBtnsStatus(false);
toggleCleanIntensityBtnsStatus(false);
setCleanIntensityStandard();
} else {
// 如果是纯吸,没有设置清扫方向,同时自动设置作业强度为标准
if (isPureAbsorptionClick) {
toggleCleanDirectionBtnsStatus(false);
setCleanIntensityStandard();
} else {
toggleCleanDirectionBtnsStatus(true);
toggleCleanIntensityBtnsStatus(false);
}
toggleCleanDirectionBtnsStatus(true);
toggleCleanIntensityBtnsStatus(false);
}
hideLoadingMask();
showCmdExecuteSuccessToast();
});
}
hideLoadingMask();
showCmdExecuteSuccessToast();
}
@Override
@@ -355,11 +364,9 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdTimeout() {
runOnUIThread(() -> {
((CheckedTextView) currentClickView).setChecked(isClickCurrentChoosedModeBtn);
hideLoadingMask();
showCmdExecuteTimeoutToast();
});
((CheckedTextView) currentClickView).setChecked(isClickCurrentChoosedModeBtn);
hideLoadingMask();
showCmdExecuteTimeoutToast();
}
};
@@ -436,19 +443,17 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdSuccess() {
runOnUIThread(() -> {
((CheckedTextView) currentClickView).setChecked(!isClickCurrentChoosedDirectionBtn);
toggleCleanDirectionBtnsByChoosedViewId(currentClickView.getId(), isClickCurrentChoosedDirectionBtn);
if (isClickCurrentChoosedDirectionBtn) {
toggleCleanIntensityBtnsStatus(false);
} else {
toggleCleanIntensityBtnsStatus(true);
// 一并设置作业强度为标准
setCleanIntensityStandard();
}
hideLoadingMask();
showCmdExecuteSuccessToast();
});
((CheckedTextView) currentClickView).setChecked(!isClickCurrentChoosedDirectionBtn);
toggleCleanDirectionBtnsByChoosedViewId(currentClickView.getId(), isClickCurrentChoosedDirectionBtn);
if (isClickCurrentChoosedDirectionBtn) {
toggleCleanIntensityBtnsStatus(false);
} else {
toggleCleanIntensityBtnsStatus(true);
// 一并设置作业强度为标准
setCleanIntensityStandard();
}
hideLoadingMask();
showCmdExecuteSuccessToast();
}
@Override
@@ -457,11 +462,9 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdTimeout() {
runOnUIThread(() -> {
((CheckedTextView) currentClickView).setChecked(isClickCurrentChoosedDirectionBtn);
hideLoadingMask();
showCmdExecuteTimeoutToast();
});
((CheckedTextView) currentClickView).setChecked(isClickCurrentChoosedDirectionBtn);
hideLoadingMask();
showCmdExecuteTimeoutToast();
}
};
if (isClickCurrentChoosedDirectionBtn) {
@@ -526,16 +529,14 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdSuccess() {
runOnUIThread(() -> {
((CheckedTextView) currentClickView).setChecked(true);
if (isStandardBtnClick) {
setCleanIntensityStandard();
} else {
setCleanIntensityStrong();
}
hideLoadingMask();
showCmdExecuteSuccessToast();
});
((CheckedTextView) currentClickView).setChecked(true);
if (isStandardBtnClick) {
setCleanIntensityStandard();
} else {
setCleanIntensityStrong();
}
hideLoadingMask();
showCmdExecuteSuccessToast();
}
@Override
@@ -544,11 +545,9 @@ public class SweeperOperatePanelView extends LinearLayout {
@Override
public void onCmdTimeout() {
runOnUIThread(() -> {
((CheckedTextView) currentClickView).setChecked(false);
hideLoadingMask();
showCmdExecuteTimeoutToast();
});
((CheckedTextView) currentClickView).setChecked(false);
hideLoadingMask();
showCmdExecuteTimeoutToast();
}
};
int cmdValue = cleanIntensityBtnAndCmdValueMap.get(currentClickView.getId());
@@ -655,39 +654,29 @@ public class SweeperOperatePanelView extends LinearLayout {
* @param timeout
*/
private void showLoadingMask(int timeout) {
showLoadingMask("执行中,请稍后。。。", timeout);
}
/**
* 发送命令后等待时展示loading
*
* @param hint
* @param timeout
*/
private void showLoadingMask(String hint, int timeout) {
runOnUIThread(() -> {
mLoadingContainer.setVisibility(View.VISIBLE);
mLoadingHintTop.setText(hint);
mLoadingHintBottom.setText(
String.format(
getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout),
timeout
));
mLoadingHintBottom.setVisibility(timeout < 0 ? View.INVISIBLE : View.VISIBLE);
if (cleaningModeStateCallback != null && timeout > 0) {
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.STARTING_STATUS, mCurrentCleanSystemState, isSelectPureSweepMode);
}
});
mLoadingContainer.setVisibility(View.VISIBLE);
mWorkmodePanelRootView.setInterceptTouchEvent(true);
if (timeout < 0) {//状态同步中
mLoadingHint.setText("状态同步中,请稍后");
mLoadingView.setVisibility(View.GONE);
} else {
mLoadingHint.setText(timeout + "s");
mLoadingView.setVisibility(View.VISIBLE);
startRotation();
}
if (cleaningModeStateCallback != null && timeout > 0) {
operateStateEnum = OperateStateEnum.STARTING_STATUS;
cleaningModeStateCallback.cleaningModeState(operateStateEnum, mCurrentCleanSystemState, isSelectPureSweepMode);
}
}
/**
* 隐藏loading
*/
private void hideLoadingMask() {
runOnUIThread(() -> {
mSweeperOperateCmdHandler.removeMessages(MSG_CMD_EXECUTE_COUNT_DOWN);
mLoadingContainer.setVisibility(View.GONE);
});
mSweeperOperateCmdHandler.removeMessages(MSG_CMD_EXECUTE_COUNT_DOWN);
mLoadingContainer.setVisibility(View.GONE);
mWorkmodePanelRootView.setInterceptTouchEvent(false);
}
/**
@@ -696,13 +685,7 @@ public class SweeperOperatePanelView extends LinearLayout {
* @param timeout
*/
private void updateLoadingCountDown(int timeout) {
runOnUIThread(() -> {
mLoadingHintBottom.setText(
String.format(
getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout),
timeout
));
});
mLoadingHint.setText(timeout + "s");
}
/**
@@ -710,8 +693,11 @@ public class SweeperOperatePanelView extends LinearLayout {
*/
private void showCmdExecuteSuccessToast() {
if (cleaningModeStateCallback != null) {
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.SUCCESS_STATUS, mCurrentCleanSystemState, isSelectPureSweepMode);
operateStateEnum = OperateStateEnum.SUCCESS_STATUS;
cleaningModeStateCallback.cleaningModeState(operateStateEnum, mCurrentCleanSystemState, isSelectPureSweepMode);
}
//停止旋转动画
stopRotation();
ToastUtils.showLong("设备已响应,操作成功");
}
@@ -719,18 +705,15 @@ public class SweeperOperatePanelView extends LinearLayout {
* 命令执行超时toast
*/
private void showCmdExecuteTimeoutToast() {
if (cleaningModeStateCallback != null) {
operateStateEnum = OperateStateEnum.FAIL_STATUS;
cleaningModeStateCallback.cleaningModeState(operateStateEnum, mCurrentCleanSystemState, isSelectPureSweepMode);
}
//停止旋转动画
stopRotation();
ToastUtils.showLong("超时未响应,操作失败");
}
private void runOnUIThread(Runnable runnable) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
runnable.run();
}
});
}
private void setClickListener(View view, OnClickListener listener) {
view.setOnClickListener(new OnPreventFastClickListener() {
@Override
@@ -743,7 +726,6 @@ public class SweeperOperatePanelView extends LinearLayout {
public void setSweeperFutianCleanSystemState(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState,
CleaningModeStateCallback cleaningModeStateCallback) {
this.cleaningModeStateCallback = cleaningModeStateCallback;
onSyncVehicleStateCallBack(cleanSystemState);
// 有命令正在执行
if (mCurrentCmdRequestCallback != null) {
Log.d(TAG, "getSecuWorkLeftSts = " + cleanSystemState.getSecuWorkLeftSts());
@@ -752,17 +734,28 @@ public class SweeperOperatePanelView extends LinearLayout {
mCurrentCmdRequestCallback = null;
}
}
//正在上装中或者上装失败,则不更新面板内容
if (operateStateEnum == OperateStateEnum.STARTING_STATUS) {
return;
}
if (!isFirst) {
isFirst = true;
onSyncVehicleStateCallBack(cleanSystemState);
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
// 最终调试时需要打开
//syncVehicleStateAndRecoverOperatePanelStates();
// Mock VehicleState 数据回调
// UiThreadHandler.postDelayed(() -> {
// onSyncVehicleStateCallBack(SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData());
// }, 3000L);
/**
* 设置是否展示状态同步中
*
* @param operateState
*/
public void showSyncing(OperateStateEnum operateState) {
if (operateState == OperateStateEnum.SYNCING_STATUS) {
syncVehicleStateAndRecoverOperatePanelStates();
isFirst = false;
} else {
hideLoadingMask();
}
}
/**
@@ -770,7 +763,7 @@ public class SweeperOperatePanelView extends LinearLayout {
*/
private synchronized void syncVehicleStateAndRecoverOperatePanelStates() {
// show sync loading
showLoadingMask("状态同步中,请稍后", -1);
showLoadingMask(-1);
}
private synchronized void onSyncVehicleStateCallBack(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
@@ -879,7 +872,7 @@ public class SweeperOperatePanelView extends LinearLayout {
msg.obj = timeout;
mSweeperOperateCmdHandler.sendMessage(msg);
// Mock Cmd Success
mockCleanModeSuccess(fuTianCleanCmd);
//mockCleanModeSuccess(fuTianCleanCmd);
}
private void mockSendCmdSuccess() {
@@ -901,23 +894,6 @@ public class SweeperOperatePanelView extends LinearLayout {
+ "[clean_intensity_requirement = " + clean_intensity_requirement + "]"
);
}
/**
* 发送指令
*/
private void sendFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) {
//mock
mockCleanModeSuccess(fuTianTaskCmd);
CallerAutoPilotControlManager.INSTANCE.sendSweeperFuTianTaskCmd(fuTianTaskCmd);
// log发送命令
logSweeperCmdValue(fuTianTaskCmd);
}
/**
* 重置成功
*/
private void resetSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
onSyncVehicleStateCallBack(cleanSystemState);
}
private final static SweeperOperateCmdHandler mSweeperOperateCmdHandler = new SweeperOperateCmdHandler();
private static CmdRequestCallback mCurrentCmdRequestCallback;//发送命令后的回调
@@ -975,12 +951,62 @@ public class SweeperOperatePanelView extends LinearLayout {
void onCmdTimeout();
}
/**
* 开始旋转
*/
private void startRotation() {
if (objectAnimator == null) {
objectAnimator = ObjectAnimator.ofFloat(mLoadingView, "rotation", 0, 360f);
objectAnimator.setDuration(1500);
objectAnimator.setRepeatCount(-1);
objectAnimator.setInterpolator(new LinearInterpolator());
objectAnimator.start();
}
}
/**
* 停止旋转
*/
private void stopRotation() {
if (objectAnimator != null && objectAnimator.isRunning()) {
objectAnimator.end();
objectAnimator = null;
}
}
/**
* 模拟指令操作成功
*/
private void mockCleanModeSuccess(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) {
ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.Builder builder = ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.newBuilder();
chassis.SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd fuTianCleanCmd = fuTianTaskCmd.getRoboSweeperFutianCleanCmd();
if (fuTianCleanCmd.getCleanOpenRequirement() == CLEAN_WORK_OPEN) {//打开
builder.setSecuMotWorkSts(true);
builder.setSecuModWashSweepSts(false);
builder.setSecuModWashSts(false);
builder.setSecuWorkTonSts(false);
builder.setSecuWorkOnBothsidesSts(false);
builder.setSecuWorkLeftSts(false);
builder.setSecuWorkRightSts(false);
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
mCurrentCleanSystemState = builder.build();
mockSendCmdSuccess();
return;
} else if (fuTianCleanCmd.getCleanOpenRequirement() == CLEAN_WORK_CLOSE) {//关闭
builder.setSecuModWashSweepSts(false);
builder.setSecuModWashSts(false);
builder.setSecuWorkTonSts(false);
builder.setSecuWorkOnBothsidesSts(false);
builder.setSecuWorkLeftSts(false);
builder.setSecuWorkRightSts(false);
builder.setSecuWorkStandSts(true);
builder.setSecuWorkStrongSts(false);
builder.setSecuMotWorkSts(false);
mCurrentCleanSystemState = builder.build();
mockSendCmdSuccess();
return;
}
if (fuTianCleanCmd.getCleanModeRequirement() == CLEAN_MODE_PURE_SWEEP) {//纯扫
builder.setSecuModWashSweepSts(false);
builder.setSecuModWashSts(false);

View File

@@ -11,7 +11,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.bean.SweeperMainTaskBean
import com.mogo.och.sweeper.constant.SubTaskTypeEnum
class TaskListAdapter(
private val context: Context,

View File

@@ -6,32 +6,28 @@ import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import android.widget.TextView
import chassis.ChassisStatesOuterClass
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.callback.CleaningModeStateCallback
import com.mogo.och.sweeper.constant.OperateStateEnum
import com.mogo.och.sweeper.ui.SweeperOperatePanelView
/**
* 清扫车面板浮窗
*/
class SweeperOperatePanelPopWindow : PopupWindow {
class SweeperOperatePanelPopWindow : PopupWindow{
private var mOperatePanelView: SweeperOperatePanelView? = null
constructor(context: Context) : super(context) {
init(context)
}
private fun init(context: Context) {
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
mOperatePanelView = LayoutInflater.from(context).inflate(R.layout.sweeper_popwindow_operate_panel, null) as SweeperOperatePanelView?
width = ViewGroup.LayoutParams.WRAP_CONTENT
height = ViewGroup.LayoutParams.WRAP_CONTENT
contentView = mOperatePanelView
isFocusable = true
isOutsideTouchable = true
isTouchable=true
}
/**
@@ -43,4 +39,21 @@ class SweeperOperatePanelPopWindow : PopupWindow {
) {
mOperatePanelView?.setSweeperFutianCleanSystemState(cleanSystemState, cleaningModeStateCallback)
}
/**.
*
* 设置是否让popWindow消失
*/
fun setIsOutsideTouchable(isOutsideTouchable:Boolean){
this.isFocusable = isOutsideTouchable
this.isOutsideTouchable = isOutsideTouchable
this.isTouchable=isOutsideTouchable
}
/**
* 设置是否展示状态同步中
*/
fun showSyncing(operateState: OperateStateEnum){
mOperatePanelView?.showSyncing(operateState)
}
}

View File

@@ -7,8 +7,8 @@ import chassis.SpecialVehicleTaskCmdOuterClass;
* 清扫车-福田,构建业务命令数据的工具类
*/
public class SweeperFutianCmdUtil {
private static final int CLEAN_WORK_OPEN = 1; //清扫作业-开启
private static final int CLEAN_WORK_CLOSE = 2;//清扫作业-关闭
public static final int CLEAN_WORK_OPEN = 1; //清扫作业-开启
public static final int CLEAN_WORK_CLOSE = 2;//清扫作业-关闭
public static final int CLEAN_MODE_PURE_SWEEP = 1;//作业模式-纯扫
public static final int CLEAN_MODE_WASH_SWEEP = 2;//作业模式-洗扫
public static final int CLEAN_MODE_PURE_WASH = 3;//作业模式-纯洗

View File

@@ -6,14 +6,14 @@ import android.view.MotionEvent;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.debug.DebugConfig;
/**
* 强制拦截所有touch时间的约束布局
*
* @author tongchenfei
*/
public class NoTouchConstraintLayout extends ConstraintLayout {
private boolean interceptTouchEvent = false;
public NoTouchConstraintLayout(Context context) {
super(context);
}
@@ -28,10 +28,18 @@ public class NoTouchConstraintLayout extends ConstraintLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if(DebugConfig.isDebug()){
return super.onInterceptTouchEvent(ev);
}else {
if (interceptTouchEvent) {
return true;
}
return false;
}
/**
* 设置事件拦截
*
* @param interceptTouchEvent
*/
public void setInterceptTouchEvent(boolean interceptTouchEvent) {
this.interceptTouchEvent = interceptTouchEvent;
}
}

View File

@@ -0,0 +1,30 @@
package com.mogo.och.sweeper.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;
/**
* 强制拦截所有touch时间的约束布局
*
* @author tongchenfei
*/
public class NoTouchFrameLayout extends FrameLayout {
public NoTouchFrameLayout(Context context) {
super(context);
}
public NoTouchFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NoTouchFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
}

View File

@@ -77,8 +77,8 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
/**
* 设置准备就绪按钮时都可以点击
*/
fun setEnableClickBtn(text:String,isClick:Boolean,isTaskWorking:Boolean) {
if (mSubTaskType==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE){
fun setEnableClickBtn(isClick:Boolean,isPause:Boolean) {
if (mSubTaskType.code==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code){
tvTaskState.text="暂未准备"
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_not_ready)
readyTaskBtn.text="准备出发"
@@ -86,11 +86,15 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
readyTaskBtn.isSelected=false
isStartTask=false
}else{
readyTaskBtn.text=text
if (isPause){
readyTaskBtn.text="暂停任务"
}else{
readyTaskBtn.text="准备出发"
}
readyTaskBtn.isClickable=isClick
readyTaskBtn.isSelected=isClick
isStartTask=isTaskWorking
if (isTaskWorking){
isStartTask=isPause
if (isPause){
tvTaskState.text="正在作业"
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_working)
}else{

View File

@@ -1,5 +1,6 @@
package com.mogo.och.sweeper.view
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
@@ -17,8 +18,10 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemL
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.presenter.SweeperPresenter
import planning.RoboSweeperTaskIndexOuterClass
/**
@@ -47,6 +50,14 @@ class SweeperTrafficDataView : ConstraintLayout,
private val TAG = "SweeperTrafficDataView"
// 底盘数据回调时间间隔
private val VEHICLE_STATE_INTERVAL_MILLIS = 500L
// 当前时间戳
private var mCurrentTimeWaterMillis: Long = 0
private var mCurrentTimeBatteryMillis: Long = 0
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
@@ -68,24 +79,32 @@ class SweeperTrafficDataView : ConstraintLayout,
override fun onAttachedToWindow() {
super.onAttachedToWindow()
//电量
CallerBatteryManagementSystemListenerManager.addListener(TAG, this)
//转向灯
CallerChassisLamplightListenerManager.addListener(TAG, this)
//档位
CallerChassisGearStateListenerManager.addListener(TAG, this)
//清扫车相关数据接口
CallerSweeperFutianCleanSystemListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerBatteryManagementSystemListenerManager.removeListener(TAG )
CallerChassisSteeringStateListenerManager.removeListener(TAG)
CallerChassisLamplightListenerManager.removeListener(TAG)
CallerChassisGearStateListenerManager.removeListener(TAG)
CallerChassisThrottleStateListenerManager.removeListener(TAG)
CallerSweeperFutianCleanSystemListenerManager.removeListener(TAG)
}
override fun onSweeperFutianTaskIndexData(roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex) {}
override fun onSweeperFutianCleanSystemState(cleanSystemState: SweeperFuTianTaskSystemStates) {
val current = System.currentTimeMillis()
if (current - mCurrentTimeWaterMillis <=VEHICLE_STATE_INTERVAL_MILLIS) {
return
}
mCurrentTimeWaterMillis = current
d(SceneConstant.M_SWEEPER + TAG, "水位:${cleanSystemState.hasSecuCleanWaterTankLow()}")
if (cleanSystemState.hasSecuCleanWaterTankLow()) { //清水箱水位低不能清洗作业报警信号
ivBgWaterWarning?.visibility = VISIBLE
ivWater?.isSelected = true
@@ -95,24 +114,24 @@ class SweeperTrafficDataView : ConstraintLayout,
}
}
@SuppressLint("SetTextI18n")
override fun onBatteryManagementSystemStates(states: BMSSystemStates) {
tvBattery?.text = String.format("%s%", states.bmsSoc)
val current = System.currentTimeMillis()
if (current - mCurrentTimeBatteryMillis <=VEHICLE_STATE_INTERVAL_MILLIS) {
return
}
mCurrentTimeBatteryMillis = current
d(SceneConstant.M_SWEEPER + TAG, "电量:${states.bmsSoc}")
tvBattery?.text = "${states.bmsSoc*100}%"
}
/**
* 车辆转向灯
* @param lightSwitch
* @param directionLight
*/
override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) {
//转向灯状态 0是正常 1是左转 2是右转
if (lightSwitch != null) {
d(TAG, "车辆转向灯:$lightSwitch")
if (lightSwitch.number == 1) {
sweeperTurnSignal?.showLeftSignal()
} else if (lightSwitch.number == 2) {
sweeperTurnSignal?.showRightSignal()
} else {
sweeperTurnSignal?.showDirection()
}
sweeperTurnSignal?.setTurnLight(lightSwitch)
}
}

View File

@@ -6,6 +6,9 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.ChassisStatesOuterClass.SweeperFuTianTaskSystemStates
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.och.sweeper.R
import com.mogo.och.sweeper.callback.CleaningModeStateCallback
import com.mogo.och.sweeper.constant.OperateStateEnum
@@ -20,10 +23,12 @@ import kotlinx.android.synthetic.main.sweeper_work_mode.view.*
class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
private var isSelectPureSweepMode: Boolean = false
private val TAG = "SweeperWorkModeView"
//清扫模式选择面板
private var mOperatePanelPopWindow: SweeperOperatePanelPopWindow? = null
private var operateState: OperateStateEnum=OperateStateEnum.SYNCING_STATUS
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
@@ -35,24 +40,43 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_work_mode, this)
mOperatePanelPopWindow = SweeperOperatePanelPopWindow(context)
setShowOrHideCleanSystemState(OperateStateEnum.SYNCING_STATUS,null)
}
/**
* 设置view
*/
fun setTrafficDataView(trafficDataView: SweeperTrafficDataView){
//清扫模式选择面板打开关闭处理
ivOpenOperatePanel.setOnClickListener {
if (mOperatePanelPopWindow?.isShowing != true) {
mOperatePanelPopWindow?.showAsDropDown(
trafficDataView,
resources.getDimension(R.dimen.dp_600).toInt(),
0
)
UiThreadHandler.postDelayed({
d(SceneConstant.M_SWEEPER + TAG, "operateState"+operateState.code)
mOperatePanelPopWindow?.showSyncing(operateState)
},300)
} else {
mOperatePanelPopWindow?.dismiss()
}
}
}
/**
* 设置清扫模式面板
*/
fun setSweeperFutianCleanSystemState(taskType: SubTaskTypeEnum, cleanSystemState: SweeperFuTianTaskSystemStates?, trafficDataView: SweeperTrafficDataView) {
fun setSweeperFutianCleanSystemState(taskType: SubTaskTypeEnum, cleanSystemState: SweeperFuTianTaskSystemStates?) {
mOperatePanelPopWindow?.setCleanSystemState(cleanSystemState, this@SweeperWorkModeView)
//清扫模式选择面板打开关闭处理
ivOpenOperatePanel.setOnClickListener {
if (mOperatePanelPopWindow?.isShowing != true) {
mOperatePanelPopWindow?.showAsDropDown(
trafficDataView,
resources.getDimension(R.dimen.dp_600).toInt(),
0
)
} else {
mOperatePanelPopWindow?.dismiss()
}
if (this.operateState.code==OperateStateEnum.STARTING_STATUS.code){
return
}
//如果状态是同步中,在底盘首次回调时把状态强制修改成成功
if (this.operateState.code==OperateStateEnum.SYNCING_STATUS.code){
this.operateState=OperateStateEnum.SUCCESS_STATUS
d(SceneConstant.M_SWEEPER + TAG, "SystemState operateState"+operateState.code)
}
//清扫车暂未选择清扫模式或者任务类型是人工驾驶子任务,则暂无清扫模式
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState) || taskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code) {
@@ -65,32 +89,37 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
/**
* 设置清扫模式状态显示和隐藏
*/
fun setShowOrHideCleanSystemState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates?) {
private fun setShowOrHideCleanSystemState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates?) {
when (operateState.code) {
OperateStateEnum.SYNCING_STATUS.code -> {
groupWorkModelPanel?.visibility = View.GONE
tvNoDataDesc?.visibility = View.VISIBLE
tvNoDataDesc?.text = "状态同步中,请稍后"
mOperatePanelPopWindow?.setIsOutsideTouchable(true)
}
OperateStateEnum.FAIL_STATUS.code -> {
groupWorkModelPanel?.visibility = View.GONE
tvNoDataDesc?.visibility = View.VISIBLE
tvNoDataDesc?.text = "上装启动失败"
mOperatePanelPopWindow?.setIsOutsideTouchable(true)
}
OperateStateEnum.STARTING_STATUS.code -> {
groupWorkModelPanel?.visibility = View.GONE
tvNoDataDesc?.visibility = View.VISIBLE
tvNoDataDesc?.text = "上装启动中..."
mOperatePanelPopWindow?.setIsOutsideTouchable(false)
}
OperateStateEnum.NO_STATUS.code -> {
groupWorkModelPanel?.visibility = View.GONE
tvNoDataDesc?.visibility = View.VISIBLE
tvNoDataDesc?.text = "暂无"
mOperatePanelPopWindow?.setIsOutsideTouchable(true)
}
else -> {
groupWorkModelPanel?.visibility = View.VISIBLE
tvNoDataDesc?.visibility = View.GONE
setCleanModeData(cleanSystemState)
mOperatePanelPopWindow?.setIsOutsideTouchable(true)
}
}
@@ -98,6 +127,7 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
override fun cleaningModeState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates?, isSelectPureSweepMode: Boolean) {
this.isSelectPureSweepMode = isSelectPureSweepMode
this.operateState=operateState
setShowOrHideCleanSystemState(operateState, cleanSystemState)
}

View File

@@ -1,11 +1,20 @@
package com.mogo.och.sweeper.view
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import chassis.Chassis
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_turn_signal.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
class TurnSignalView : LinearLayout {
constructor(context: Context?) : super(context) {}
@@ -13,34 +22,58 @@ class TurnSignalView : LinearLayout {
initView(context)
}
private var init: Boolean = false
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {}
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_turn_signal, this)
init = true
}
/**
* 展示左转向灯
* 转向灯动画
*/
fun showLeftSignal() {
turnLeftView?.isSelected = true
turnRightView?.isSelected = false
fun setTurnLight(directionLight: Chassis.LightSwitch?) {
GlobalScope.launch(Dispatchers.Main) {
if (!init) {
return@launch
}
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
CallerVisualAngleManager.changeVisualAngle(CallerVisualAngleManager.Scene.Turning(true))
leftSelectImage.visibility = View.VISIBLE
rightSelectImage.visibility = View.GONE
rightSelectImage.clearAnimation()
setAnimation(leftSelectImage)
}
Chassis.LightSwitch.LIGHT_RIGHT -> { //右转向
CallerVisualAngleManager.changeVisualAngle(CallerVisualAngleManager.Scene.Turning(true))
leftSelectImage.visibility = View.GONE
rightSelectImage.visibility = View.VISIBLE
leftSelectImage.clearAnimation()
setAnimation(rightSelectImage)
}
else -> { //消失
CallerVisualAngleManager.changeVisualAngle(CallerVisualAngleManager.Scene.Turning(false))
leftSelectImage.clearAnimation()
rightSelectImage.clearAnimation()
}
}
}
}
/**
* 展示右转向灯
*/
fun showRightSignal() {
turnLeftView?.isSelected = false
turnRightView?.isSelected = true
}
/**
* 默认情况及其直行时
*/
fun showDirection() {
turnLeftView?.isSelected = false
turnRightView?.isSelected = false
//实现图片闪烁效果
private fun setAnimation(imageView: ImageView) {
val animationSet = AnimatorSet()
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1.0f)
val valueAnimatorDisappare = ObjectAnimator.ofFloat(imageView, "alpha", 1.0f, 0f)
valueAnimator.duration = 1000
valueAnimatorDisappare.duration = 800
valueAnimator.repeatCount = -1
valueAnimatorDisappare.repeatCount = -1
animationSet.playTogether(valueAnimatorDisappare, valueAnimator)
animationSet.start()
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,93 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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/module_och_sweeper_order_status_stationInfo"
android:layout_width="@dimen/dp_560"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/bg_shape_work_mode"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/sweeperListCl"
app:layout_constraintBottom_toBottomOf="parent"
android:orientation="vertical">
<!--清扫模式面板-->
<com.mogo.och.sweeper.view.SweeperWorkModeView
android:id="@+id/sweeper_cl_work_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_shape_work_mode"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sweeper_arc"
android:visibility="visible"/>
<!--清扫任务当前面板-->
<com.mogo.och.sweeper.view.SweeperCurrentTaskInfoView
android:id="@+id/sweeper_current_task_view"
app:layout_constraintTop_toBottomOf="@+id/sweeper_cl_work_mode"
android:layout_width="@dimen/dp_560"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/sweeper_switch_model_layout"
android:layout_marginTop="@dimen/dp_36"
android:visibility="visible"
android:layout_weight="1"
/>
<FrameLayout
android:id="@+id/sweeper_current_task_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/sweeperListLine"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_36"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/sweeperListTitle"
app:layout_constraintBottom_toBottomOf="@+id/sweeperListTitle"
android:background="@drawable/sweeper_list_left_top_line"/>
<TextView
android:id="@+id/sweeperListTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="@dimen/dp_38"
android:text="任务列表"
android:layout_marginTop="@dimen/dp_43"
/>
<ImageView
android:id="@+id/ivTaskRefresh"
android:layout_width="@dimen/dp_42"
android:layout_height="@dimen/dp_42"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/sweeperListTitle"
app:layout_constraintBottom_toBottomOf="@+id/sweeperListTitle"
android:layout_marginEnd="@dimen/dp_39"
android:src="@drawable/sweeper_refresh"
/>
<View
android:id="@+id/viewTaskListLine"
android:layout_height="match_parent"
android:visibility="gone"
android:background="@drawable/bg_shape_work_mode">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/sweeperListCl"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/sweeper_task_dividing_line1_selector"
app:layout_constraintTop_toBottomOf="@+id/sweeperListTitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_43"/>
<View
android:id="@+id/viewTaskListLine1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/sweeper_task_dividing_line2_selector"
app:layout_constraintTop_toBottomOf="@+id/viewTaskListLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
android:layout_height="match_parent">
<View
android:id="@+id/sweeperListLine"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_36"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/sweeperListTitle"
app:layout_constraintBottom_toBottomOf="@+id/sweeperListTitle"
android:background="@drawable/sweeper_list_left_top_line"/>
<TextView
android:id="@+id/sweeperListTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/dp_42"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="@dimen/dp_38"
android:text="任务列表"
android:layout_marginTop="@dimen/dp_43"
/>
<ImageView
android:id="@+id/ivTaskRefresh"
android:layout_width="@dimen/dp_42"
android:layout_height="@dimen/dp_42"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/sweeperListTitle"
app:layout_constraintBottom_toBottomOf="@+id/sweeperListTitle"
android:layout_marginEnd="@dimen/dp_39"
android:src="@drawable/sweeper_refresh"
/>
<View
android:id="@+id/viewTaskListLine"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/sweeper_task_dividing_line1_selector"
app:layout_constraintTop_toBottomOf="@+id/sweeperListTitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_43"/>
<View
android:id="@+id/viewTaskListLine1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/sweeper_task_dividing_line2_selector"
app:layout_constraintTop_toBottomOf="@+id/viewTaskListLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvTaskList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/dp_116"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/viewTaskListLine"
app:layout_constraintVertical_bias="0.0"
tools:itemCount="6"
tools:listitem="@layout/sweeper_item_task_info" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvTaskList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/dp_116"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/viewTaskListLine"
tools:itemCount="6"
tools:listitem="@layout/sweeper_item_task_info" />
<TextView
android:id="@+id/tvTaskConfirm"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_116"
android:background="@drawable/sweeper_task_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:text="确认"
android:textColor="@color/white"
android:gravity="center"
android:textSize="@dimen/dp_42"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/sweeper_no_data_common_view"
android:visibility="gone"/>
</FrameLayout>
<TextView
android:id="@+id/tvTaskConfirm"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_116"
android:background="@drawable/sweeper_task_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:text="确认"
android:textColor="@color/white"
android:gravity="center"
android:textSize="@dimen/dp_42"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/sweeper_no_data_common_view"
android:visibility="gone"/>
</FrameLayout>
</LinearLayout>

View File

@@ -86,29 +86,6 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--清扫模式面板-->
<com.mogo.och.sweeper.view.SweeperWorkModeView
android:id="@+id/sweeper_cl_work_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_41"
android:background="@drawable/bg_shape_work_mode"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sweeper_arc"
android:visibility="gone"/>
<!--清扫任务当前面板-->
<com.mogo.och.sweeper.view.SweeperCurrentTaskInfoView
android:id="@+id/sweeper_current_task_view"
app:layout_constraintTop_toBottomOf="@+id/sweeper_cl_work_mode"
android:layout_width="@dimen/dp_560"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/sweeper_switch_model_layout"
android:layout_marginStart="@dimen/dp_41"
android:layout_marginTop="@dimen/dp_36"
android:layout_marginBottom="@dimen/dp_30"
android:visibility="gone"
/>
<!--清扫任务列表面板-->
<FrameLayout
android:id="@+id/module_mogo_och_task_list_container"
@@ -119,7 +96,6 @@
app:layout_constraintTop_toBottomOf="@id/sweeper_arc"
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
app:layout_constraintBottom_toTopOf="@+id/sweeper_switch_model_layout"
android:visibility="visible"
android:layout_marginBottom="@dimen/dp_30"/>
<!--切换地图远近事件-->
<LinearLayout

View File

@@ -1,78 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.och.sweeper.view.NoTouchConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_957"
android:layout_height="@dimen/dp_758"
android:background="@drawable/bg_sweeper_operate_panel">
android:background="@drawable/bg_sweeper_operate_panel"
android:id="@+id/work_mode_panel_root_view">
<TextView
android:id="@+id/hint_clean_open"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_48"
android:gravity="top|center_horizontal"
android:layout_marginStart="@dimen/dp_90"
android:text="车辆准备"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
app:layout_constraintTop_toTopOf="parent" />
<CheckedTextView
android:id="@+id/btn_clean_work_open_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:gravity="center"
android:paddingStart="@dimen/dp_48"
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:layout_marginStart="@dimen/dp_90"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_17"
android:text="打开"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/hint_clean_open" />
<TextView
android:id="@+id/hint_clean_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:layout_marginTop="@dimen/dp_48"
android:gravity="top|center_horizontal"
android:paddingStart="@dimen/dp_90"
android:text="作业模式"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_clean_work_open_close"
android:paddingStart="@dimen/dp_90"
/>
app:layout_constraintTop_toBottomOf="@+id/btn_clean_work_open_close" />
<CheckedTextView
android:id="@+id/btn_clean_mode_pure_sweep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
android:layout_marginStart="@dimen/dp_90"
android:paddingStart="@dimen/dp_48"
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:text="纯扫"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_17"
/>
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode" />
<CheckedTextView
android:id="@+id/btn_clean_mode_pure_wash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_46"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -80,18 +82,18 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:text="纯洗"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode"
app:layout_constraintStart_toEndOf="@+id/btn_clean_mode_pure_sweep"
android:layout_marginTop="@dimen/dp_17"
android:layout_marginStart="@dimen/dp_46"/>
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode" />
<CheckedTextView
android:id="@+id/btn_clean_mode_sweep_wash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_46"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -99,18 +101,19 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:text="洗扫"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode"
app:layout_constraintStart_toEndOf="@+id/btn_clean_mode_pure_wash"
android:layout_marginTop="@dimen/dp_17"
android:layout_marginStart="@dimen/dp_46"/>
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode" />
<CheckedTextView
android:id="@+id/btn_clean_mode_pure_absorption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_46"
android:layout_marginTop="@dimen/dp_17"
android:layout_marginEnd="@dimen/dp_20"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -118,14 +121,11 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:text="纯吸"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
android:layout_marginTop="@dimen/dp_17"
android:layout_marginStart="@dimen/dp_46"
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode"
app:layout_constraintStart_toEndOf="@+id/btn_clean_mode_sweep_wash"
android:layout_marginEnd="@dimen/dp_20"/>
app:layout_constraintTop_toBottomOf="@id/hint_clean_mode" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/clean_mode_barrier"
@@ -138,11 +138,11 @@
android:id="@+id/hint_clean_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_48"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_48"
android:gravity="top|center_horizontal"
android:textColor="@color/white"
android:text="清扫方向"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/clean_mode_barrier" />
@@ -151,6 +151,8 @@
android:id="@+id/btn_clean_direction_left_side"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -158,19 +160,18 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:layout_marginStart="@dimen/dp_90"
android:textColor="@color/white"
android:text="左侧"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toBottomOf="@+id/hint_clean_direction"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_17"/>
app:layout_constraintTop_toBottomOf="@+id/hint_clean_direction" />
<CheckedTextView
android:id="@+id/btn_clean_direction_right_side"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_28"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -178,18 +179,18 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:text="右侧"
android:layout_marginTop="@dimen/dp_17"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintTop_toBottomOf="@+id/hint_clean_direction"
app:layout_constraintStart_toEndOf="@+id/btn_clean_direction_left_side"/>
app:layout_constraintStart_toEndOf="@+id/btn_clean_direction_left_side"
app:layout_constraintTop_toBottomOf="@+id/hint_clean_direction" />
<CheckedTextView
android:id="@+id/btn_clean_direction_both_side"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_28"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -197,9 +198,8 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:text="两侧"
android:layout_marginTop="@dimen/dp_17"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintStart_toEndOf="@+id/btn_clean_direction_right_side"
app:layout_constraintTop_toBottomOf="@id/hint_clean_direction" />
@@ -215,9 +215,9 @@
android:id="@+id/hint_clean_intensity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_48"
android:gravity="top|center_horizontal"
android:layout_marginStart="@dimen/dp_90"
android:text="作业强度"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
@@ -228,6 +228,8 @@
android:id="@+id/btn_clean_intensity_standard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -235,12 +237,10 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:layout_marginStart="@dimen/dp_90"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_17"
android:text="标准"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/hint_clean_intensity" />
<CheckedTextView
@@ -248,6 +248,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_28"
android:layout_marginTop="@dimen/dp_17"
android:background="@drawable/sweeper_operate_panel_btn2_bg_selector"
android:enabled="false"
android:gravity="center"
@@ -255,40 +256,43 @@
android:paddingTop="@dimen/dp_12"
android:paddingEnd="@dimen/dp_48"
android:paddingBottom="@dimen/dp_12"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_17"
android:text="强力"
android:textColor="@color/white"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size"
app:layout_constraintLeft_toRightOf="@id/btn_clean_intensity_standard"
app:layout_constraintTop_toBottomOf="@id/hint_clean_intensity" />
<LinearLayout
<FrameLayout
android:id="@+id/loading_hint_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#cc000000"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bg_sweeper_operate_panel"
app:tint="#88000000"
android:scaleType="fitXY"/>
<TextView
android:id="@+id/loading_hint_top"
android:id="@+id/loading_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="正在执行中,请稍后"
android:gravity="center"
android:layout_gravity="center"
android:text="30s"
android:textColor="#ffffff"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size" />
<TextView
android:id="@+id/loading_hint_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_28"
android:text="预计等待30秒"
android:textColor="#ffffff"
android:textSize="@dimen/sweeper_operate_panel_btn_text_size" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/loading_view"
android:layout_width="@dimen/dp_140"
android:layout_height="@dimen/dp_140"
android:layout_gravity="center"
android:src="@drawable/sweeper_loading_nor" />
</FrameLayout>
</com.mogo.och.sweeper.view.NoTouchConstraintLayout>

View File

@@ -1,18 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
android:layout_height="match_parent">
<ImageView
android:id="@+id/turnLeftView"
android:id="@+id/leftNorImage"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:src="@drawable/turn_signal_left_selector"
android:layout_weight="1"/>
android:layout_gravity="left|center_vertical"
android:src="@drawable/turn_signal_left_nor" />
<ImageView
android:id="@+id/turnRightView"
android:id="@+id/rightNorImage"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:src="@drawable/turn_signal_right_selector"
android:layout_weight="1"/>
</LinearLayout>
android:layout_gravity="right|center_vertical"
android:src="@drawable/turn_signal_right_nor" />
<ImageView
android:id="@+id/leftSelectImage"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_gravity="left|center_vertical"
android:layout_marginTop="2dp"
android:src="@drawable/turn_signal_left_select"
android:visibility="gone" />
<ImageView
android:id="@+id/rightSelectImage"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_gravity="right|center_vertical"
android:layout_marginTop="2dp"
android:src="@drawable/turn_signal_right_select"
android:visibility="gone" />
</FrameLayout>