[清扫车]列表按钮样式和防指连续点击
This commit is contained in:
@@ -2,6 +2,7 @@ package com.mogo.och.sweeper.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@@ -43,6 +44,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
@@ -54,7 +56,7 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseSweeperTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener,
|
||||
View.OnClickListener, IWeltMapSwitchToSmallCallback {
|
||||
View.OnClickListener, IWeltMapSwitchToSmallCallback,View.OnTouchListener {
|
||||
|
||||
private static final String TAG = "BaseSweeperTabFragment";
|
||||
//地图放大缩小
|
||||
@@ -99,6 +101,11 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
|
||||
private View panelView;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mapBizView = findViewById(R.id.mapBizView);
|
||||
@@ -235,6 +242,13 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
view.setOnTouchListener(this);
|
||||
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, this);
|
||||
mCloseNavIcon.setOnClickListener(this);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
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.ClickUtils
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.sweeper.R
|
||||
import com.mogo.och.sweeper.bean.SubInfo
|
||||
@@ -23,7 +24,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_current_task_info.view.*
|
||||
import kotlinx.android.synthetic.main.sweeper_no_data_common_view.*
|
||||
@@ -47,6 +47,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
private var mMainTask: SweeperMainTaskBean? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var mSubInfo: SubInfo? = null
|
||||
private var isFinished:Boolean=true
|
||||
|
||||
//当前经纬度
|
||||
override fun getTagName(): String {
|
||||
@@ -64,14 +65,16 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
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)
|
||||
}
|
||||
if (ClickUtils.isFastClick()){//防止重复点击
|
||||
if(mSubTaskType.code==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code){
|
||||
manualDriving(mSubInfo)
|
||||
}else{
|
||||
//开始执行任务
|
||||
mSubInfo?.apply {
|
||||
presenter?.startTask(isFirstSubTask(), isLastSubTask(), taskId, mSubTaskType, taskStatus)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,6 +259,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
}
|
||||
when (typeEnum.code) {
|
||||
TaskStatusEnum.END_SUBTASK.code -> {//子任务结束
|
||||
isFinished=false
|
||||
mCurrentSubPosition++
|
||||
setSubTaskData()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "END_SUBTASK mCurrentSubPosition:$mCurrentSubPosition")
|
||||
@@ -290,7 +294,9 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
TaskStatusEnum.START_SUBTASK.code -> { //子任务开始
|
||||
setTaskBtn(true)
|
||||
sweeper_current_task_view.setTaskStatus(2)
|
||||
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
|
||||
if (mSubTaskType==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE){
|
||||
sweeper_current_task_view.setCurrentData(mCurrentSubPosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,13 +497,12 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
|
||||
//模拟结束子任务
|
||||
override fun debugEndSubTask() {
|
||||
// mSubInfo?.let {
|
||||
// mPresenter?.onArriveTaskEnd(null)
|
||||
// }
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
while (true) {
|
||||
onSweeperFutianCleanSystemState(SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData())
|
||||
delay(500)
|
||||
lifecycleScope.launch(Dispatchers.IO){
|
||||
while (isFinished){
|
||||
mSubInfo?.let {
|
||||
mPresenter?.onArriveTaskEnd(null)
|
||||
}
|
||||
delay(100)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.sweeper.R
|
||||
@@ -42,15 +43,17 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
LayoutInflater.from(context).inflate(R.layout.sweeper_current_task_info, this)
|
||||
setEnableClickBtn(false)
|
||||
tvStartAuto.setOnClickListener {
|
||||
if (mSubTaskStatus==1){
|
||||
ToastUtils.showLong("任务未开始无轨迹,无法启动自驾")
|
||||
return@setOnClickListener
|
||||
if (ClickUtils.isFastClick()){//防止重复点击
|
||||
if (mSubTaskStatus==1){
|
||||
ToastUtils.showLong("任务未开始无轨迹,无法启动自驾")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (mSubTaskType==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE){
|
||||
ToastUtils.showLong("人工子任务无轨迹,无法启动自驾")
|
||||
return@setOnClickListener
|
||||
}
|
||||
presenter?.startAutopilot()
|
||||
}
|
||||
if (mSubTaskType==SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE){
|
||||
ToastUtils.showLong("人工子任务无轨迹,无法启动自驾")
|
||||
return@setOnClickListener
|
||||
}
|
||||
presenter?.startAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -170,18 +170,6 @@ class WeltSmallMapView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
|
||||
endMarker?.position = endPoint
|
||||
mLineMarkers.add(endMarker)
|
||||
}
|
||||
|
||||
private fun runOnUIThread(executor: Runnable?) {
|
||||
if (executor == null) {
|
||||
return
|
||||
}
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(executor)
|
||||
} else {
|
||||
executor.run()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有标记和路线
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="false" android:drawable="@drawable/sweeper_task_list_not_selected"/>
|
||||
<item android:state_selected="true" android:drawable="@drawable/sweeper_task_list_selected"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#254e7d" />
|
||||
<corners
|
||||
android:bottomRightRadius="30dp" android:bottomLeftRadius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
|
||||
<corners android:bottomRightRadius="30dp" android:bottomLeftRadius="@dimen/dp_30"/>
|
||||
<gradient android:angle="180" android:endColor="#004DFF" android:startColor="#20AAFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -103,7 +103,7 @@
|
||||
android:id="@+id/tvTaskConfirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_116"
|
||||
android:background="@drawable/sweeper_task_btn"
|
||||
android:background="@drawable/sweeper_task_list_btn"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
android:id="@+id/sweeper_root_View"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_72">
|
||||
android:layout_marginTop="@dimen/dp_72"
|
||||
android:clickable="true">
|
||||
|
||||
<com.mogo.eagle.core.function.view.MapBizView
|
||||
android:id="@+id/mapBizView"
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
<ImageView
|
||||
android:id="@+id/sweeperSwitchToBig"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:src="@drawable/sweeper_full_screen_icon"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_20"/>
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:padding="@dimen/dp_10"/>
|
||||
<TextView
|
||||
android:id="@+id/taskProgressTv"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user