[sweeper-cloud]在接收贴边数据处增加逻辑处理,防止在任务结束后,还绘制贴边数据
This commit is contained in:
@@ -186,6 +186,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
getCurrentView().setData(taskInfo, getCurrentPosition())
|
||||
setShowCurrentTaskPanelView(true)
|
||||
addTaskData()
|
||||
mPresenter?.isHasTaskInfo(true)
|
||||
} else {//云端下发的任务信息需要弹窗接取
|
||||
if (taskInfo.isPop) {//是否需要弹窗确认
|
||||
receivedTaskInfoDialog()
|
||||
@@ -194,6 +195,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
setShowCurrentTaskPanelView(true)
|
||||
getCurrentView().setData(taskInfo)
|
||||
addTaskData()
|
||||
mPresenter?.isHasTaskInfo(true)
|
||||
//延时2秒再上报确认接取任务,防止时间太短跟收到任务指令冲突
|
||||
UiThreadHandler.postDelayed({ mPresenter?.sendSweeperStartTaskResp(taskInfo.taskId, SweeperTask.StartTaskCode.MANUAL_CONFIRM) }, 2000)
|
||||
}
|
||||
@@ -303,7 +305,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
}
|
||||
|
||||
/**
|
||||
* 大任务/子任务正常结束弹窗
|
||||
* 大任务结束弹窗
|
||||
*/
|
||||
private fun sweeperCloudTaskNormalEndDialog(): SweeperCloudDialog? {
|
||||
return createSweeperTaskNormalEndDialog(context, object : SweeperCloudDialogClickListener {
|
||||
@@ -375,6 +377,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
*/
|
||||
private fun resetTaskInfoPanel() {
|
||||
setShowCurrentTaskPanelView(false)
|
||||
mPresenter?.isHasTaskInfo(false)
|
||||
mTaskInfo = null
|
||||
mCurrentSubTaskInfo = null
|
||||
mSubMutableList = null
|
||||
@@ -521,6 +524,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
getCurrentView().setData(it)
|
||||
mLoadingDialog.showLoading()
|
||||
addTaskData()
|
||||
mPresenter?.isHasTaskInfo(true)
|
||||
}
|
||||
|
||||
override fun onRefuseOrEnd() {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
ArrayList<SweeperRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();//全路径信息
|
||||
private SweeperTask.TaskModel mSubTaskType = SweeperTask.TaskModel.DEFAULT_MODEL; //1自动驾驶 2.人工驾驶 0:无效值
|
||||
private int mCurrentLineId = 0; //当前路线id
|
||||
private int mLineId = 0;//上一次存储的路线id
|
||||
private int mLineId = -1;//上一次存储的路线id
|
||||
//自动驾驶状态
|
||||
private int mAutopilotState = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
//当前子任务id
|
||||
@@ -99,6 +99,8 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
|
||||
private String latitude;//纬度
|
||||
|
||||
private boolean isHasTaskInfo=false;//判断是否有任务数据
|
||||
|
||||
//用于对应messageType和reqNo绑定在一起,保证请求的reqNo和响应的reqNo一致
|
||||
private HashMap<Integer, String> msgTypeAndReqNo = new HashMap<>();
|
||||
|
||||
@@ -188,6 +190,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList() != null && routeList.getWayPointsList().size() > 0) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,"onAutopilotRotting: "+printMessage(routeList));
|
||||
if (mCurrentLineId != mLineId) {//判断是否同一条路线
|
||||
mLineId = mCurrentLineId;
|
||||
points.addAll(coordinateConverterWgsToGcjList(mContext, routeList.getWayPointsList()));
|
||||
@@ -212,8 +215,16 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
public void clearRouteList() {
|
||||
points.clear();
|
||||
mSubTaskType = SweeperTask.TaskModel.UNRECOGNIZED;
|
||||
mCurrentLineId=0;
|
||||
mLineId=-1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有任务数据
|
||||
*/
|
||||
public void isHasTaskInfo(boolean isHasTaskInfo){
|
||||
this.isHasTaskInfo=isHasTaskInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动开始状态
|
||||
@@ -398,12 +409,16 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
if (roboSweeperTaskIndex == null) {
|
||||
return;
|
||||
}
|
||||
//没有任务数据时,不处理贴边
|
||||
if (!isHasTaskInfo){
|
||||
return;
|
||||
}
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mWeltDataCurrentTimeMillis <= WELT_DATA_INTERVAL_MILLIS) {
|
||||
return;
|
||||
}
|
||||
mWeltDataCurrentTimeMillis = current;
|
||||
//CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianTaskIndexData:" + printMessage(roboSweeperTaskIndex));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianTaskIndexData:" + printMessage(roboSweeperTaskIndex));
|
||||
handleWeltData(roboSweeperTaskIndex);
|
||||
|
||||
}
|
||||
|
||||
@@ -109,6 +109,12 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
SweeperTaskModel.getInstance().setSubtask(subTaskId, subTaskType, currentLineId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有任务数据
|
||||
*/
|
||||
public void isHasTaskInfo(boolean isHasTaskInfo){
|
||||
SweeperTaskModel.getInstance().isHasTaskInfo(isHasTaskInfo);
|
||||
}
|
||||
/**
|
||||
* 获取当前正在执行的任务
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.och.sweepercloud.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class FontAdaptionTextView extends TextView {
|
||||
public FontAdaptionTextView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FontAdaptionTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FontAdaptionTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
if (getMeasuredWidth() != 0) {
|
||||
|
||||
//判断View字体行数
|
||||
if (getLayout().getLineCount() > 1) {
|
||||
//获取view内部间隔
|
||||
int l = getPaddingLeft();
|
||||
int r = getPaddingRight();
|
||||
float pp = 0;
|
||||
//计算字符串长度
|
||||
for (int i = 0; i < getLayout().getLineCount(); i++) {
|
||||
pp = pp + l + r + getLayout().getLineWidth(i);
|
||||
}
|
||||
|
||||
//计算view的宽度与字符串长度的比例
|
||||
float f = getMeasuredWidth() / pp;
|
||||
//获取缩放后的字体高度
|
||||
float s = getTextSize() * f;
|
||||
//设置控件字体大小
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import kotlinx.android.synthetic.main.sweeper_traffic_light_view.view.*
|
||||
@@ -56,6 +58,7 @@ class SweeperTrafficLightView @JvmOverloads constructor(
|
||||
override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) {
|
||||
mCurrentLightId = checkLightId
|
||||
updateTrafficLightIcon(checkLightId)
|
||||
CallerLogger.d(SceneConstant.M_SWEEPER + TAG,lightSource.name)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.mogo.och.sweepercloud.database.bean.WeltDataBean
|
||||
import com.mogo.och.sweepercloud.util.SweeperMapAssetStyleUtil
|
||||
import kotlinx.android.synthetic.main.sweeper_welt_map_overview.view.*
|
||||
|
||||
|
||||
/**
|
||||
* 作业任务全览图
|
||||
*/
|
||||
@@ -302,7 +303,7 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
|
||||
}
|
||||
|
||||
private fun setDistance(distance: String) {
|
||||
taskWeltDistanceTv.text = "贴边:${distance}"
|
||||
taskWeltDistanceTv.text="贴边:${distance}"
|
||||
}
|
||||
|
||||
fun setProgress(progress: String?) {
|
||||
@@ -319,7 +320,6 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onCreateView(savedInstanceState: Bundle?) {
|
||||
sweeperTextureMapView.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<TextView
|
||||
android:id="@+id/sweeper_cloud_right"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="134dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_shape_right_bottom_round"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/sweeperTextureMapView"
|
||||
android:layout_width="match_parent"
|
||||
@@ -32,7 +31,7 @@
|
||||
<TextView
|
||||
android:id="@+id/taskProgressTv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:text="进度:60%"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -47,10 +46,10 @@
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<TextView
|
||||
<com.mogo.och.sweepercloud.view.FontAdaptionTextView
|
||||
android:id="@+id/taskWeltDistanceTv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:text="贴边:--cm"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user