[清扫车]当前任务显示逻辑修改

This commit is contained in:
bxb
2023-03-03 09:24:00 +08:00
parent af6fce2ae6
commit 88ea22caf9
5 changed files with 46 additions and 16 deletions

View File

@@ -25,6 +25,7 @@ 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_current_task_info.view.*
import kotlinx.android.synthetic.main.sweeper_no_data_common_view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
@@ -62,6 +63,17 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mAdapter?.setOnTaskItemClickListener(onTaskItemClickListener)
initListener()
sweeper_cl_work_mode.setTrafficDataView(trafficDataView)
sweeper_current_task_view.readyTaskBtn.setOnClickListener{
if(mSubTaskType.code==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code){
manualDriving(mSubInfo)
}else{
//开始执行任务
mSubInfo?.apply {
presenter?.startTask(isFirstSubTask(), isLastSubTask(), taskId, mSubTaskType, taskStatus)
}
}
}
}
override fun createPresenter(): SweeperPresenter {
@@ -225,8 +237,6 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mSubInfo?.let { subInfo ->
presenter?.getSubTaskDetail(isFirstSubTask(), isLastSubTask(), subInfo.taskId, mSubTaskType, false)//加载子任务详情包括轨迹信息
}
} else {
manualDriving(mSubInfo)
}
mMainTask = SweeperMainTaskBean(it.taskId, it.taskName, 0, it.taskStartTime)
clearAllMarkerAndPolyline()
@@ -255,6 +265,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mSubInfo?.apply {
presenter?.getSubTaskDetail(isFirstSubTask(), isLastSubTask(), taskId, mSubTaskType, true)
}
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
} else {
manualDriving(mSubInfo)
}
@@ -271,17 +282,15 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
mSubInfo?.apply {
presenter?.getSubTaskDetail(isFirstSubTask(), isLastSubTask(), taskId, mSubTaskType, true)
}
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
} else {
manualDriving(mSubInfo)
}
}
TaskStatusEnum.START_SUBTASK.code -> { //子任务开始
setTaskBtn(true)
setShowTaskListPanelView(false)
sweeper_cl_work_mode.visibility = View.VISIBLE
setShowCurrentTaskPanelView(true)
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
sweeper_current_task_view.setTaskStatus(2)
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
}
}

View File

@@ -326,7 +326,9 @@ public class SweeperTaskModel {
public boolean getSubWorking() {
return mIsSubTaskWorking;
}
public void setWorking(Boolean isWorking){
this.mIsSubTaskWorking=isWorking;
}
/**
* 关闭美化模式
*/
@@ -344,6 +346,7 @@ public class SweeperTaskModel {
public void startBeautificationMode() {
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;//是否强制绘制引导线
CallerAutoPilotControlManager.INSTANCE.setIPCDemoMode(true);//是否自动启动自驾
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "美化模式-ignore置为true");
}
/**
@@ -615,7 +618,7 @@ public class SweeperTaskModel {
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
SweeperTaskModel.getInstance().startBeautificationMode();
}
startAutopilot(false);
//ÏstartAutopilot(false);
} else {
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;//是否强制绘制引导线

View File

@@ -24,6 +24,11 @@ object SweeperServiceManager {
*/
@JvmStatic
fun getCurrentTask(context: Context, callback: OchCommonServiceCallback<BaseResponse<SweeperSubTaskBean>>?) {
val map= hashMapOf<String,String>()
map["serviceAppId"] = MoGoAiCloudClientConfig.getInstance().serviceAppId
map["token"] = MoGoAiCloudClientConfig.getInstance().token
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
d(SceneConstant.M_SWEEPER + TAG, "getCurrentTask" + GsonUtil.jsonFromObject(map))
mService.getCurrentTask(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
@@ -38,6 +43,11 @@ object SweeperServiceManager {
*/
@JvmStatic
fun getMainTaskList(context: Context, callback: OchCommonServiceCallback<BaseResponse<MutableList<SweeperMainTaskBean>>>?) {
val map= hashMapOf<String,String>()
map["serviceAppId"] = MoGoAiCloudClientConfig.getInstance().serviceAppId
map["token"] = MoGoAiCloudClientConfig.getInstance().token
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
d(SceneConstant.M_SWEEPER + TAG, "getMainTaskList" + GsonUtil.jsonFromObject(map))
mService.getMainTaskList(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
@@ -54,7 +64,7 @@ object SweeperServiceManager {
val map= hashMapOf<String,String>()
map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn
map["taskId"] = taskId.toString()
d(SceneConstant.M_SWEEPER + TAG, "getSubTaskDetail" + GsonUtil.jsonFromObject(map))
d(SceneConstant.M_SWEEPER + TAG, "getSubTaskList" + GsonUtil.jsonFromObject(map))
mService.getSubTaskList(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,

View File

@@ -191,7 +191,9 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
this.mSubTaskId = subTaskId;
SweeperTaskModel.getInstance().setSubtask(isFirstSubtask, isLastSubtask, subTaskId);
}
public void setWorking(boolean isWorking){
SweeperTaskModel.getInstance().setWorking(isWorking);
}
/**
* 测试使用
*

View File

@@ -41,10 +41,6 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_current_task_info, this)
setEnableClickBtn(false)
readyTaskBtn.setOnClickListener {
//开始执行任务
startSubTask()
}
tvStartAuto.setOnClickListener {
if (mSubTaskStatus==1){
ToastUtils.showLong("任务未开始无轨迹,无法启动自驾")
@@ -103,6 +99,7 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
fun setEnableClickBtn(isWorking: Boolean) {
readyTaskBtn.isSelected = !isWorking
readyTaskBtn.isClickable=!isWorking
presenter?.setWorking(isWorking)
if (isWorking) {
tvTaskState.text = "正在作业"
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_working)
@@ -120,18 +117,22 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
tvStartAuto.isSelected = false
tvStartAuto.isClickable = false
tvStartAuto.text="不可自动驾驶"
}
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
tvStartAuto.isSelected = true
tvStartAuto.isClickable = true
tvStartAuto.text="人工驾驶"
}
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
tvStartAuto.isSelected = true
tvStartAuto.isClickable = true
tvStartAuto.text="自动驾驶"
}
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
tvStartAuto.isSelected = false
tvStartAuto.isClickable = false
tvStartAuto.text="平行驾驶"
}
}
}
@@ -186,13 +187,18 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
} else if (it.size == 2) {
if (mCurrentPosition == 0) {
preSubTask.setData(it[mCurrentPosition], isSelect = true)
currentSubTask.setData(it[1], isSelect = true)
currentSubTask.setData(it[1], isLastTask = true)
} else {
preSubTask.setData(it[mCurrentPosition - 1])
currentSubTask.setData(it[mCurrentPosition], isSelect = true, isLastTask = true)
}
lastSubTask.visibility = View.INVISIBLE
preSubTask.visibility=View.VISIBLE
currentSubTask.visibility=View.VISIBLE
lastSubTask.visibility=View.GONE
} else {
preSubTask.visibility=View.VISIBLE
currentSubTask.visibility=View.VISIBLE
lastSubTask.visibility=View.VISIBLE
//当前正在执行的任务是第一个子任务
if (mCurrentPosition == 0) {
preSubTask.setData(it[mCurrentPosition], isSelect = true)