From e73cbd18b0ccc5f60fbaa182d72420b67a0d741c Mon Sep 17 00:00:00 2001 From: bxb Date: Fri, 13 Jan 2023 17:44:33 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=B8=85=E6=89=AB=E8=BD=A6=E4=B8=AD=E5=8E=9F=E6=9C=89=E7=9A=84?= =?UTF-8?q?bus=E9=80=BB=E8=BE=91=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/BaseSweeperTabFragment.java | 350 +----------------- .../och/sweeper/fragment/SweeperFragment.java | 345 +---------------- .../sweeper/presenter/SweeperPresenter.java | 142 +------ 3 files changed, 37 insertions(+), 800 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java index 628d8ba6f8..a436daedfd 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java @@ -1,24 +1,15 @@ package com.mogo.och.sweeper.fragment; -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS; -import static com.mogo.och.sweeper.constant.SweeperConst.TIMER_START_AUTOPILOT_INTERVAL; - import android.animation.ObjectAnimator; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; -import android.view.animation.LinearInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.constraintlayout.widget.Group; - import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.mvp.IView; @@ -28,30 +19,31 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig; import com.mogo.eagle.core.data.constants.DataTypes; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.map.MogoMapUIController; import com.mogo.map.MogoMarkerManager; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.uicontroller.VisualAngleMode; import com.mogo.module.common.MogoApisHandler; import com.mogo.och.sweeper.R; -import com.mogo.och.sweeper.bean.SweeperRoutesResult; import com.mogo.och.sweeper.constant.SweeperConst; -import com.mogo.och.sweeper.model.SweeperOrderModel; import com.mogo.och.sweeper.ui.SweeperOperatePanelView; import com.mogo.och.sweeper.view.SweeperTrafficDataView; -import com.mogo.och.sweeper.util.BDRouteDataTestUtils; -import com.mogo.och.sweeper.view.SlidePanelView; +import com.mogo.och.sweeper.view.SweeperWorkModeView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.constraintlayout.widget.Group; import mogo.telematics.pad.MessagePad; import record_cache.RecordPanelOuterClass; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS; + /** * 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况 *

@@ -59,25 +51,19 @@ import record_cache.RecordPanelOuterClass; * * @author tongchenfei */ -public abstract class BaseSweeperTabFragment> extends MvpFragment implements IMogoMapListener, IMoGoAutopilotRecordListener { +public abstract class BaseSweeperTabFragment> extends MvpFragment implements IMogoMapListener{ private static final String TAG = "BaseOchFragment"; - protected SlidePanelView slidePanelView; - private RelativeLayout ctvAutopilotStatus; - private ImageView ctvAutopilotStatusIv; - private TextView ctvAutopilotStatusTv; - protected TextView tvOperationStatus; protected RelativeLayout mSettingBtn; protected RelativeLayout mBadcaseBtn; protected RelativeLayout mAICollectBtn; - public boolean isOperationStatus;//false-收车,true-出车 - private FrameLayout flStationPanelContainer; + private FrameLayout flTaskListPanelContainer; private Group groupTestPanel; //清扫车车辆基本信息 速度 档位 转向灯 红绿灯等 private SweeperTrafficDataView mTrafficDataView; //清扫车模式展示 - private ConstraintLayout mClWorkMode; + private SweeperWorkModeView mClWorkMode; //清扫车模式选择面板 private SweeperOperatePanelView mOperatePanel; @@ -86,21 +72,8 @@ public abstract class BaseSweeperTabFragment { - // 此处做一个代理,处理一下共有情况 - if (getSlidePanelOnEndListener() != null) { - getSlidePanelOnEndListener().moveToEnd(); - } - }; - @Override protected int getLayoutId() { return R.layout.sweeper_base_fragment; @@ -111,17 +84,9 @@ public abstract class BaseSweeperTabFragment { - if (mOperatePanel.getVisibility()==View.VISIBLE){ + if (mOperatePanel.getVisibility() == View.VISIBLE) { mOperatePanel.setVisibility(View.GONE); - }else{ + } else { mOperatePanel.setVisibility(View.VISIBLE); } }); @@ -164,15 +129,6 @@ public abstract class BaseSweeperTabFragment debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) @@ -187,18 +143,6 @@ public abstract class BaseSweeperTabFragment debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) ); - - // 模拟 自动驾驶网约车回调数据 - findViewById(R.id.btnAutopilotArrive).setOnClickListener(view -> - debugArrivedStation() - ); - - findViewById(R.id.btnAutopilotRoute).setOnClickListener(view -> debugArrivedRoute()); - - tvOperationStatus.setOnClickListener(view -> { - onChangeOperationStatus(); - }); - mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout); mSettingBtn.setOnClickListener(v -> { // TODO: 2021/12/9 @@ -207,17 +151,8 @@ public abstract class BaseSweeperTabFragment { // onShow() -// return mBadcaseBtn; }, -// () -> { // onHide() -// return null; }); - if (mBadcaseBtn != null) { CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn); - if (!HmiBuildConfig.isShowBadCaseView) { - CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this); - } } mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl); @@ -236,10 +171,6 @@ public abstract class BaseSweeperTabFragment { - slidePanelView.setText(text); - slidePanelView.setVisibility(View.VISIBLE); - }); - } - } - - /** - * 隐藏滑动按钮 - */ - public void hideSlidePanel() { - getActivity().runOnUiThread(() -> { - slidePanelView.setVisibility(View.GONE); - }); - } - - /** - * 改变自动驾驶状态 - * - * @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中 - */ - public void onAutopilotStatusChanged(int autopilotStatus) { - getActivity().runOnUiThread(() -> { - changeAutopilotBtnView(autopilotStatus, isAnimateRunning); - }); - } - - public void setAutopilotBtnStatus(int autopilotStatus) { - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE - == autopilotStatus) {//0不可用 - ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.sweeper_autopilot_text_color_disable)); - ctvAutopilotStatusTv.setText(getResources().getString(R.string.sweeper_loading_autopilot_runnig_tv)); - ctvAutopilotStatusIv.setImageResource(R.drawable.sweeper_disable_autopilot_icon); - ctvAutopilotStatus.setSelected(false); - ctvAutopilotStatus.setFocusableInTouchMode(true); - - } else { - ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.sweeper_autopilot_text_color_normal)); - ctvAutopilotStatusTv.setText(getResources().getString(R.string.sweeper_loading_autopilot_runnig_tv)); - ctvAutopilotStatusIv.setImageResource(R.drawable.sweeper_ic_autopilot); - ctvAutopilotStatus.setFocusableInTouchMode(true); - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) {//1可用 - ctvAutopilotStatus.setSelected(false); - } else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) { - ctvAutopilotStatus.setSelected(true); - } - } - } - - public void updateAutopilotStatus(int autopilotStatus) { - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING - == autopilotStatus) {//2 running - ctvAutopilotStatusIv.setImageResource(R.drawable.sweeper_right_autopilot_icon); - ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.sweeper_autopilot_text_color_normal)); - ctvAutopilotStatusTv.setText(getResources().getString(R.string.sweeper_loading_autopilot_success_tv)); - ctvAutopilotStatus.setSelected(false); - ctvAutopilotStatus.setFocusableInTouchMode(false); - } else { - ctvAutopilotStatusIv.setImageResource(R.drawable.sweeper_wrong_autopilot_icon); - ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.sweeper_autopilot_text_color_normal)); - ctvAutopilotStatusTv.setText(getResources().getString(R.string.sweeper_loading_autopilot_failure_tv)); - ctvAutopilotStatus.setFocusableInTouchMode(false); - ctvAutopilotStatus.setSelected(false); - } - UiThreadHandler.postDelayed(new Runnable() { - @Override - public void run() { - setAutopilotBtnStatus(autopilotStatus); - } - }, 1000); - } - - private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) { - CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChangeChangeAutopilotBtnView: " - + autopilotStatus + "isAnimateRunning = " + isAnimateRunning); - if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING - != autopilotStatus) { - // 主动开启自动驾驶中,不为2(为0、1)则继续loading - return; - } - if (isAnimateRunning) { - stopAutopilotAnimation(); - updateAutopilotStatus(autopilotStatus); - } else { - setAutopilotBtnStatus(autopilotStatus); - } - - } - - /** - * 隐藏【自动驾驶】按钮 - */ - public void hideAutopilotBiz() { - getActivity().runOnUiThread(() -> { -// ctvAutopilotStatus.setVisibility(View.GONE); -// slidePanelView.setVisibility(View.GONE); - }); - } - - /** - * 展示【自动驾驶】按钮 - */ - public void showAutopilotBiz() { - getActivity().runOnUiThread(() -> { - ctvAutopilotStatus.setVisibility(View.VISIBLE); - }); - } - - public void hidPanel() { - getActivity().runOnUiThread(() -> { - flStationPanelContainer.setVisibility(View.GONE); - }); - } - - public void showPanel() { - getActivity().runOnUiThread(() -> { - flStationPanelContainer.setVisibility(View.VISIBLE); - }); - } - public View getPanelView() { return panelView; } - public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() { - return null; - } - /** - * 获取站点面板view,在{@link #initViews()}时候添加到container中 + * 清扫车任务列表面板view,在{@link #initViews()}时候添加到container中 * * @return 站点面板view */ @@ -435,54 +212,6 @@ public abstract class BaseSweeperTabFragment - * START - */ - private View busTestBar; - private TextView lineIdTV; - private TextView trajMd5TV; - private TextView stopMd5TV; - private TextView trajMd5DPQPTV; - private TextView stopMd5DPQPTV; - - public void showHideTestBar() { - if (busTestBar == null) { - busTestBar = findViewById(R.id.module_mogo_och_sweeper_test_bar); - lineIdTV = findViewById(R.id.sweeper_test_bar_current_line_id); - trajMd5TV = findViewById(R.id.sweeper_test_bar_current_traj_md5); - stopMd5TV = findViewById(R.id.sweeper_test_bar_current_stop_md5); - trajMd5DPQPTV = findViewById(R.id.sweeper_test_bar_current_traj_md5_dpqp); - stopMd5DPQPTV = findViewById(R.id.sweeper_test_bar_current_stop_md5_dpqp); - } - - if (busTestBar.getVisibility() == View.VISIBLE) { - busTestBar.setVisibility(View.GONE); - } else { - SweeperRoutesResult routesResult = SweeperOrderModel.getInstance().getBusRoutesResult(); - lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId()))); - trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5)); - stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5)); - trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP)); - stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP)); - busTestBar.setVisibility(View.VISIBLE); - } - } - - public void updateSweeperTestBarInfo() { - if (busTestBar != null && busTestBar.getVisibility() == View.VISIBLE) { - SweeperRoutesResult routesResult = SweeperOrderModel.getInstance().getBusRoutesResult(); - lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId()))); - trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5)); - stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5)); - trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP)); - stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP)); - } - } - /** - * END - */ } diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java index e47c57a817..93628d902e 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java @@ -1,58 +1,19 @@ package com.mogo.och.sweeper.fragment; -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS; - -import android.content.Intent; import android.view.View; -import android.widget.TextView; + +import com.mogo.och.sweeper.R; +import com.mogo.och.sweeper.presenter.SweeperPresenter; import androidx.annotation.NonNull; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.debug.DebugConfig; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.map.CenterLine; -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; -import com.mogo.eagle.core.function.call.map.CallerHDMapManager; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.eagle.core.utilcode.util.ToastUtils; -import com.mogo.map.MogoMarkerManager; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.och.sweeper.R; -import com.mogo.och.sweeper.bean.SweeperStationBean; -import com.mogo.och.sweeper.constant.SweeperConst; -import com.mogo.och.sweeper.presenter.SweeperPresenter; -import com.mogo.och.sweeper.ui.SweeperSwitchLineActivity; -import com.mogo.och.sweeper.view.SlidePanelView; -import com.mogo.och.common.module.utils.OCHThreadPoolManager; - -import java.util.List; - /** * 网约车小巴界面 * * @author tongchenfei */ -public class SweeperFragment extends BaseSweeperTabFragment - implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener { - private static final String TAG = "SweeperFragment"; - - private TextView mCurrentStationName; - private TextView mNextStationName; - private TextView mCurrentTag; - private TextView mNextTag; - private TextView mSwitchLine; //切换路线 - private TextView mLineName; - private int mCurrentStation = 0; - - private View mSweepers; - - private SweeperStationBean startStation = null; - private SweeperStationBean endStation = null; - +public class SweeperFragment extends BaseSweeperTabFragment { @Override public String getTagName() { return "SweepersFragment"; @@ -61,51 +22,6 @@ public class SweeperFragment extends BaseSweeperTabFragment { - ToastUtils.showShort("重置了车站状态"); - mPresenter.querySweepersRoutes(); - }); - - //debug下调用测试面板 - mCurrentStationName.setOnLongClickListener(v -> { - debugTestBar(); - showHideTestBar(); - return true; - }); - } - - CallerLogger.INSTANCE.d(M_BUS + TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()); - // 初始化的时候设置 UI 按钮状态 - switch (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) { - case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE: - hideAutopilotBiz(); - break; - case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE: - showAutopilotBiz(); - onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE); - break; - case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING: - showAutopilotBiz(); - onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING); - break; - default: - break; - } - mSwitchLine.setOnClickListener(this); - } - - @Override - protected void debugArrivedStation() { - mPresenter.onAutopilotArriveAtStation(null); } @NonNull @@ -119,131 +35,6 @@ public class SweeperFragment extends BaseSweeperTabFragment stationList - , int currentStation, int nextStation, boolean isArrived) { - mCurrentStation = currentStation; - if (getActivity() == null) { - return; - } - getActivity().runOnUiThread(() -> { - if (stationList == null) { - // 获取小巴数据失败 - return; - } - - // 渲染小巴路线数据 - renderCurrentStationStatus(lineName,stationList, currentStation, nextStation, isArrived); - }); - } - - /** - * 重新刷新站点信息 isArrived 是否到站 - */ - private void renderCurrentStationStatus(String lineName, List stationList, int currentStation - , int nextStation, boolean isArrived) { - CallerLogger.INSTANCE.d(M_BUS + "MapMaker ", "currentStation=" + currentStation + ",nextStation=" + nextStation + "isArrived=" + isArrived); - String currentStationName = null; - String nextStationName = null; - - boolean isArriveEndStation = false; - boolean isArriveAtStation = false; - boolean isArriveAtStartStation = false; - - mLineName.setText(lineName); - - // 获取当前站点的名称 - currentStationName = stationList.get(currentStation).getName(); - - startStation = stationList.get(0); - endStation = stationList.get(stationList.size() - 1); - - // 是否到达起点 - if (currentStation == 0) { - isArriveAtStartStation = true; - mCurrentTag.setText(getResources().getString(R.string.sweeper_arrive_to_end_start)); - - setOrRemoveMapMaker(true, SweeperConst.SWEEPER_START_MAP_MAKER, startStation.getLat() - , startStation.getLon(),R.raw.star_marker); - setOrRemoveMapMaker(true, SweeperConst.SWEEPER_END_MAP_MAKER, endStation.getLat() - , endStation.getLon(),R.raw.end_marker); - } else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点 - isArriveAtStation = true; - mCurrentTag.setText(getResources().getString(R.string.sweeper_arrive_to_current_tag)); - mNextTag.setText(getResources().getString(R.string.sweeper_arrive_to_next_tag)); - - setOrRemoveMapMaker(false, SweeperConst.SWEEPER_START_MAP_MAKER, startStation.getLat() - , startStation.getLon(),R.raw.star_marker); - setOrRemoveMapMaker(true, SweeperConst.SWEEPER_END_MAP_MAKER, endStation.getLat() - , endStation.getLon(),R.raw.end_marker); - } else if (currentStation == stationList.size() - 1) {// 是否到达终点 - isArriveEndStation = true; - nextStationName = "--"; - mNextTag.setText(getResources().getString(R.string.sweeper_arrive_to_end_end)); - - setOrRemoveMapMaker(false, SweeperConst.SWEEPER_START_MAP_MAKER, startStation.getLat() - , startStation.getLon(),R.raw.star_marker); - - if (isArrived) { - setOrRemoveMapMaker(false, SweeperConst.SWEEPER_END_MAP_MAKER, endStation.getLat() - , endStation.getLon(),R.raw.end_marker); - } else { - setOrRemoveMapMaker(true, SweeperConst.SWEEPER_END_MAP_MAKER, endStation.getLat() - , endStation.getLon(),R.raw.end_marker); - } - } - - // 获取下一站点名称 - if (nextStation > currentStation && nextStation <= stationList.size() - 1) { - nextStationName = stationList.get(nextStation).getName(); - } - - // 是否到达终点 - if ( nextStation == stationList.size() - 1 || nextStation == -1) { - mNextTag.setText(getResources().getString(R.string.sweeper_arrive_to_end_end)); - }else { - mNextTag.setText(getResources().getString(R.string.sweeper_arrive_to_next_tag)); - } - - if (currentStation == 0 && isArrived){ - showOrHideSwitchLineBtn(true); - }else { - showOrHideSwitchLineBtn(false); - } - - // 重置滑动按钮文字 - if (isArriveEndStation) { - showSlidePanle("单程结束"); - } else if (isArriveAtStartStation) { - showSlidePanle("滑动出发"); - } else if (isArriveAtStation) { - showSlidePanle("滑动出发"); - } - - mCurrentStationName.setText(currentStationName); - mNextStationName.setText(nextStationName); - updateSweeperTestBarInfo(); - } - - private void showOrHideSwitchLineBtn(boolean isShow) { - if (isShow){ - mSwitchLine.setVisibility(View.VISIBLE); - }else { - mSwitchLine.setVisibility(View.GONE); - } - } - - public void hideOchSweeper() { -// tvNotice.setVisibility(View.GONE); - } - @Override public int getStationPanelViewId() { return R.layout.fragment_och_sweeper; @@ -260,68 +51,6 @@ public class SweeperFragment extends BaseSweeperTabFragment } public void initModelListener() { - SweeperOrderModel.getInstance().setCarOperationStatusCallback(this); - SweeperOrderModel.getInstance().setRefreshBusStationsCallback(this); - SweeperOrderModel.getInstance().setSlidePannelHideCallback(this); SweeperOrderModel.getInstance().setControllerStatusCallback(this); } @@ -102,133 +89,27 @@ public class SweeperPresenter extends Presenter } public void restartAutopilot() { -// if (SweeperOrderModel.getInstance().isGoingToNextStation()){ currentAutopilotStatus = -1; SweeperOrderModel.getInstance().restartAutopilot(); isRestartAutopilot = true; -// } } public void onChangeOperationStatus() { SweeperOrderModel.getInstance().onChangeOperationStatus(); } - - @Override - public void changeOperationStatus(boolean changeStatus) { - if (mView != null) { - runOnUIThread(() -> mView.changeOperationStatus(changeStatus)); - } - } - - @Override - public void refreshBusStations(String lineName,List stationList - , int currentStation, int nextStation, boolean isArrived) { - mStationList.clear(); - mStationList.addAll(stationList); - mCurrentStation = currentStation; -// functionDemoModeChange(); - CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation); - if (mView != null) { - runOnUIThread(() -> mView.refreshSweeperStations(lineName, - stationList, currentStation, nextStation, isArrived)); - } - } - - private void functionDemoModeChange() { -// CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel ="," functionDemoModeChange ="+mCurrentStation); - if (FunctionBuildConfig.isDemoMode - && ((mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1) - || ((mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1) - && SweeperOrderModel.getInstance().isGoingToNextStation()))) { - runOnUIThread(() -> mView.onAutopilotStatusChanged( - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)); - } - } - - @Override - public void hideSlidePanel() { - if (mView != null) { - runOnUIThread(() -> mView.hideSlidePanel()); - } - } - - @Override - public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) { - SweeperOrderModel.getInstance().onArriveAt(arrivalNotification); - } - - @Override - public void onAutopilotSNRequest() { - - } - @Override public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) { if (autopilotStatusInfo == null) return; int state = autopilotStatusInfo.getState(); -// CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus); switch (state) { case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE: - if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) { - if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->1语音提示 -// AIAssist.getInstance( getContext() ).speakTTSVoice( "已进入人工驾驶模式" ); - } - currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE; - // 设置UI【自动驾驶】按钮是否展示 - runOnUIThread(() -> mView.onAutopilotEnableChange(true)); - if (SweeperOrderModel.getInstance().isGoingToNextStation()) { - runOnUIThread(() -> mView.hideSlidePanel()); - } - if (FunctionBuildConfig.isDemoMode - && ( - (mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1) - || ( - (mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1) - && SweeperOrderModel.getInstance().isGoingToNextStation() - ) - ) - ) { - CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能"); - return; - } - // 改变UI自动驾驶状态 - runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus)); - } break; case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING: - if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { - currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING; - // 改变UI自动驾驶状态 - runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus)); - SweeperOrderModel.getInstance().triggerStartServiceEvent( - isRestartAutopilot, true); - } + break; case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE: - if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) { - if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->0语音提示 -// AIAssist.getInstance( getContext() ).speakTTSVoice( "自动驾驶已停止,请人工接管" ); - } - currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE; - if (FunctionBuildConfig.isDemoMode - && ( - (mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1) - || ( - (mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1) - && SweeperOrderModel.getInstance().isGoingToNextStation() - ) - ) - ) { - CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能"); - return; - } - runOnUIThread(() -> { - mView.onAutopilotStatusChanged(currentAutopilotStatus); - }); - } break; default: - runOnUIThread(() -> mView.onAutopilotEnableChange(false)); break; } } @@ -247,8 +128,7 @@ public class SweeperPresenter extends Presenter @Override public void startOpenAutopilot() { - //非美化模式下启动动画 - runOnUIThread(() -> mView.startAutopilotAnimation()); + } private void runOnUIThread(Runnable executor) { @@ -286,4 +166,14 @@ public class SweeperPresenter extends Presenter public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) { } + + @Override + public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) { + + } + + @Override + public void onAutopilotSNRequest() { + + } }