From a633c3cc4a9434f9f47f711044fe24a2bdb27f59 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Fri, 26 Mar 2021 16:52:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=BE=E7=A4=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 - .../java/com/mogo/och/bus/OchBusProvider.java | 14 - .../och/bus/adapter/OchBusStationAdapter.java | 2 +- .../bus/bean/OchBusArriveAtStationMsg.java | 15 + .../bean/OchBusOperationStatusRequest.java | 32 + .../bean/OchBusOperationStatusResponse.java | 24 + .../com/mogo/och/bus/bean/OchBusOrder.java | 227 + .../com/mogo/och/bus/bean/OchBusStation.java | 8 + .../bus/bean/OchBusStationsChangedMsg.java | 15 + .../QueryOchBusOperationStatusRequest.java | 19 + .../och/bus/bean/UpdateSiteStatusRequest.java | 23 + .../mogo/och/bus/constant/OchBusConst.java | 9 +- .../mogo/och/bus/fragment/OchBusFragment.java | 312 +- .../mogo/och/bus/net/IOchBusApiService.java | 58 +- .../och/bus/presenter/OchBusOrderModel.java | 156 + .../och/bus/presenter/OchBusPresenter.java | 527 +- .../module_och_bus_dot_line.png | Bin 0 -> 323 bytes .../module_och_bus_panel_anchor_bkg.xml | 5 + .../res/drawable/module_och_bus_panel_bkg.xml | 10 +- .../src/main/res/layout/fragment_och_bus.xml | 181 +- .../src/main/res/values/dimens.xml | 27 +- .../java/com/mogo/och/BaseOchFragment.java | 23 +- .../module_mogo_och_autopilot_status_bg.xml | 10 +- .../module_mogo_och_operation_status_bg.xml | 10 + .../layout/module_mogo_och_base_fragment.xml | 123 +- OCH/mogo-och/src/main/res/values/colors.xml | 2 +- OCH/mogo-och/src/main/res/values/dimens.xml | 10 +- libraries/map-custom/build.gradle | 2 +- .../mogo/map/impl/custom/AMapViewWrapper.java | 1 - .../drawer/AdasRecognizedResultDrawer.java | 13 +- .../mogo/module/common/drawer/BaseDrawer.java | 52 +- .../common/drawer/SnapshotSetDataDrawer.java | 6 +- .../src/main/res/raw/bus.n3d | Bin 0 -> 148378 bytes .../src/main/res/raw/othercar.n3d | Bin 182402 -> 193668 bytes .../src/main/res/raw/othercar2.n3d | Bin 639056 -> 0 bytes .../src/main/assets/LocParse.java | 150 + .../src/main/assets/adas2.txt | 1 - .../src/main/assets/adas3-2.txt | 1 - .../src/main/assets/adas3.txt | 1 - .../src/main/assets/adas4-2.txt | 1 - .../src/main/assets/adas4-4.txt | 1 - .../src/main/assets/adas4.txt | 1 - .../src/main/assets/adas5-2.txt | 1 - .../src/main/assets/adas5-4.txt | 1 - .../src/main/assets/adas5.txt | 1 - .../src/main/assets/adas6.txt | 1 - .../src/main/assets/loc.csv | 15415 ++++++++++++++++ .../src/main/assets/loc3.txt | 1 - .../src/main/assets/loc5.txt | 1 - .../src/main/assets/snapshot2.txt | 4232 ----- .../service/intent/MockIntentHandler.java | 400 +- 51 files changed, 16933 insertions(+), 5193 deletions(-) create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusArriveAtStationMsg.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusRequest.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusResponse.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOrder.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStationsChangedMsg.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/QueryOchBusOperationStatusRequest.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/UpdateSiteStatusRequest.java create mode 100644 OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java create mode 100644 OCH/mogo-och-bus/src/main/res/drawable-xhdpi/module_och_bus_dot_line.png create mode 100644 OCH/mogo-och-bus/src/main/res/drawable/module_och_bus_panel_anchor_bkg.xml create mode 100644 OCH/mogo-och/src/main/res/drawable/module_mogo_och_operation_status_bg.xml create mode 100644 modules/mogo-module-common/src/main/res/raw/bus.n3d delete mode 100644 modules/mogo-module-common/src/main/res/raw/othercar2.n3d create mode 100644 modules/mogo-module-service/src/main/assets/LocParse.java delete mode 100644 modules/mogo-module-service/src/main/assets/adas2.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas3-2.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas3.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas4-2.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas4-4.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas4.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas5-2.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas5-4.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas5.txt delete mode 100644 modules/mogo-module-service/src/main/assets/adas6.txt create mode 100644 modules/mogo-module-service/src/main/assets/loc.csv delete mode 100644 modules/mogo-module-service/src/main/assets/loc3.txt delete mode 100644 modules/mogo-module-service/src/main/assets/loc5.txt delete mode 100644 modules/mogo-module-service/src/main/assets/snapshot2.txt diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 4ff10f68a5..83405b8de1 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -91,7 +91,6 @@ diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/OchBusProvider.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/OchBusProvider.java index ff5094b200..794743c9b9 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/OchBusProvider.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/OchBusProvider.java @@ -54,7 +54,6 @@ public class OchBusProvider implements IMogoOCH { public void init(Context context) { MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.VR_MODE, statusChangedListener); MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.TOP_VIEW, statusChangedListener); - MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).registerOnMessageListener(401017, messageListener); } private void showFragment() { @@ -92,17 +91,4 @@ public class OchBusProvider implements IMogoOCH { } }; - private final IMogoOnMessageListener> messageListener = new IMogoOnMessageListener>() { - @Override - public Class> target() { - return null; - } - - @Override - public void onMsgReceived(List obj) { - // 刷新列表 - busFragment.getPresenter().getStationListFromSocket(obj); - } - }; - } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java index 2657c8cf4c..9c1d54a25f 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/adapter/OchBusStationAdapter.java @@ -37,7 +37,7 @@ public class OchBusStationAdapter extends RecyclerView.Adapter + * 小巴达到站点,推送需要下车的乘客列表 + */ +class OchBusArriveAtStationMsg { + + +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusRequest.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusRequest.java new file mode 100644 index 0000000000..9b7e13a392 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusRequest.java @@ -0,0 +1,32 @@ +package com.mogo.och.bus.bean; + +import com.mogo.commons.network.Utils; +import com.mogo.utils.network.utils.Util; + +public +/** + * @author congtaowang + * @since 2021/3/22 + * + * 小巴车运营状态请求参数 + */ +class OchBusOperationStatusRequest { + + public String sn; + // 0 - 关闭、1 - 启动 + public String status; + + public OchBusOperationStatusRequest() { + this.sn = Utils.getSn(); + } + + public OchBusOperationStatusRequest shutdown() { + status = "0"; + return this; + } + + public OchBusOperationStatusRequest launch() { + status = "1"; + return this; + } +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusResponse.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusResponse.java new file mode 100644 index 0000000000..be3839aaa8 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOperationStatusResponse.java @@ -0,0 +1,24 @@ +package com.mogo.och.bus.bean; + +import com.mogo.commons.data.BaseData; + +public +/** + * @author congtaowang + * @since 2021/3/22 + * + * 小巴车运营状态请求参数 + */ +class OchBusOperationStatusResponse extends BaseData { + + public Result result; + + public static class Result { + public String id; + public String sn; + public String areaCode; + public String plateNumber; + public int status; + + } +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOrder.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOrder.java new file mode 100644 index 0000000000..d1ba24ee9f --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusOrder.java @@ -0,0 +1,227 @@ +package com.mogo.och.bus.bean; + +import java.util.List; + +public +/** + * @author congtaowang + * @since 2021/3/23 + *

+ * 小巴订单 + */ +class OchBusOrder { + + /** + * _id : bf014b186a0d417e8086f324e5cbcd1d + * orderNo : XB20210324000002 + * orderType : 10 + * userName : 星期一 + * userPhone : 15555555555 + * startStationId : 1 + * startStation : 万集东门站 + * startStationCoordinate : [116.7354579447,40.1974932972] + * endStationId : 2 + * endStation : 顺密路口站 + * endStationCoordinate : [116.7215386924,40.194019209] + * orderDispatchType : 1 + * carNum : 京NB007 + * sn : F803BB2037EZD00088 + * orderStartTime : Mar 24, 2021 12:51:51 PM + * orderEndTime : Mar 24, 2021 1:38:13 PM + * cityCode : 010 + * areaCode : 1001 + * createTime : Mar 24, 2021 12:51:51 PM + * updateTime : Mar 24, 2021 1:38:13 PM + * travelDistance : 1.2 + */ + + private String _id; + private String orderNo; + private int orderType; + private String userName; + private String userPhone; + private int startStationId; + private String startStation; + private int endStationId; + private String endStation; + private int orderDispatchType; + private String carNum; + private String sn; + private String orderStartTime; + private String orderEndTime; + private String cityCode; + private String areaCode; + private String createTime; + private String updateTime; + private double travelDistance; + private List< Double > startStationCoordinate; + private List< Double > endStationCoordinate; + + public String get_id() { + return _id; + } + + public void set_id( String _id ) { + this._id = _id; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo( String orderNo ) { + this.orderNo = orderNo; + } + + public int getOrderType() { + return orderType; + } + + public void setOrderType( int orderType ) { + this.orderType = orderType; + } + + public String getUserName() { + return userName; + } + + public void setUserName( String userName ) { + this.userName = userName; + } + + public String getUserPhone() { + return userPhone; + } + + public void setUserPhone( String userPhone ) { + this.userPhone = userPhone; + } + + public int getStartStationId() { + return startStationId; + } + + public void setStartStationId( int startStationId ) { + this.startStationId = startStationId; + } + + public String getStartStation() { + return startStation; + } + + public void setStartStation( String startStation ) { + this.startStation = startStation; + } + + public int getEndStationId() { + return endStationId; + } + + public void setEndStationId( int endStationId ) { + this.endStationId = endStationId; + } + + public String getEndStation() { + return endStation; + } + + public void setEndStation( String endStation ) { + this.endStation = endStation; + } + + public int getOrderDispatchType() { + return orderDispatchType; + } + + public void setOrderDispatchType( int orderDispatchType ) { + this.orderDispatchType = orderDispatchType; + } + + public String getCarNum() { + return carNum; + } + + public void setCarNum( String carNum ) { + this.carNum = carNum; + } + + public String getSn() { + return sn; + } + + public void setSn( String sn ) { + this.sn = sn; + } + + public String getOrderStartTime() { + return orderStartTime; + } + + public void setOrderStartTime( String orderStartTime ) { + this.orderStartTime = orderStartTime; + } + + public String getOrderEndTime() { + return orderEndTime; + } + + public void setOrderEndTime( String orderEndTime ) { + this.orderEndTime = orderEndTime; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode( String cityCode ) { + this.cityCode = cityCode; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode( String areaCode ) { + this.areaCode = areaCode; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime( String createTime ) { + this.createTime = createTime; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime( String updateTime ) { + this.updateTime = updateTime; + } + + public double getTravelDistance() { + return travelDistance; + } + + public void setTravelDistance( double travelDistance ) { + this.travelDistance = travelDistance; + } + + public List< Double > getStartStationCoordinate() { + return startStationCoordinate; + } + + public void setStartStationCoordinate( List< Double > startStationCoordinate ) { + this.startStationCoordinate = startStationCoordinate; + } + + public List< Double > getEndStationCoordinate() { + return endStationCoordinate; + } + + public void setEndStationCoordinate( List< Double > endStationCoordinate ) { + this.endStationCoordinate = endStationCoordinate; + } +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStation.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStation.java index 93ad0ffc05..096c8ca1d0 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStation.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStation.java @@ -19,7 +19,15 @@ public class OchBusStation { private int isCurrentSite; private int siteColor; private String peoples; + private int ifStop; // 是否需要停靠、1需要、0不需要 + public int getIfStop() { + return ifStop; + } + + public void setIfStop( int ifStop ) { + this.ifStop = ifStop; + } public int getLineId() { return lineId; diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStationsChangedMsg.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStationsChangedMsg.java new file mode 100644 index 0000000000..6c188a1be7 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/OchBusStationsChangedMsg.java @@ -0,0 +1,15 @@ +package com.mogo.och.bus.bean; + +import java.util.List; + +public +/** + * @author congtaowang + * @since 2021/3/25 + * + * 小巴站点信息变更:停靠状态等 + */ +class OchBusStationsChangedMsg { + + public List< OchBusStation > data; +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/QueryOchBusOperationStatusRequest.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/QueryOchBusOperationStatusRequest.java new file mode 100644 index 0000000000..0a368413f1 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/QueryOchBusOperationStatusRequest.java @@ -0,0 +1,19 @@ +package com.mogo.och.bus.bean; + +import com.mogo.commons.network.Utils; + +public +/** + * @author congtaowang + * @since 2021/3/22 + * + * 小巴车运营状态请求参数 + */ +class QueryOchBusOperationStatusRequest { + + public String sn; + + public QueryOchBusOperationStatusRequest() { + this.sn = Utils.getSn(); + } +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/UpdateSiteStatusRequest.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/UpdateSiteStatusRequest.java new file mode 100644 index 0000000000..20e36265cf --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/bean/UpdateSiteStatusRequest.java @@ -0,0 +1,23 @@ +package com.mogo.och.bus.bean; + +import com.mogo.commons.network.Utils; + +public +/** + * @author congtaowang + * @since 2021/3/22 + * + * 小巴车运营状态请求参数 + */ +class UpdateSiteStatusRequest { + + public String sn; + // 0 - 关闭、1 - 启动 + public int siteId; + + public UpdateSiteStatusRequest( int siteId ) { + this.sn = Utils.getSn(); + this.siteId = siteId; + } + +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java index 5cdb132677..175572c36c 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/constant/OchBusConst.java @@ -6,11 +6,12 @@ package com.mogo.och.bus.constant; * @author tongchenfei */ public class OchBusConst { + // 无状态 public static final int STATION_STATUS_IDLE = 0; - public static final int STATION_STATUS_STOPED = 1; + // 到站 + public static final int STATION_STATUS_STOPPED = 1; + // 离开某一站 public static final int STATION_STATUS_LEAVING = 2; - /** - * 服务端没有记录此状态,由本地直接维护此状态,方便使用 - */ + // 下一站 public static final int STATION_STATUS_ARRIVING = 3; } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java index 979e45642b..60d3a32e3d 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java @@ -1,5 +1,6 @@ package com.mogo.och.bus.fragment; +import android.view.View; import android.view.ViewGroup; import android.widget.TextView; @@ -7,6 +8,7 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.mogo.commons.debug.DebugConfig; import com.mogo.module.common.MogoApisHandler; import com.mogo.och.BaseOchFragment; import com.mogo.och.bus.R; @@ -19,7 +21,6 @@ import com.mogo.service.adas.IMogoAdasOCHCallback; import com.mogo.utils.TipToast; import com.mogo.utils.logger.Logger; -import java.util.ArrayList; import java.util.List; @@ -28,135 +29,55 @@ import java.util.List; * * @author tongchenfei */ -public class OchBusFragment extends BaseOchFragment implements SlidePanelView.OnSlidePanelMoveToEndListener { +public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPresenter > implements SlidePanelView.OnSlidePanelMoveToEndListener { private static final String TAG = "OchBusFragment"; - private TextView tvStationNotice; - private TextView tvStationName; - private RecyclerView rvStationList; + private TextView mCurrentStationName; + private TextView mStartStationFlag; + private TextView mNextStationName; + private TextView mEndStationFlag; - private OchBusStationAdapter adapter; + private View mBus; - private int stationSizeLevel = 2; +// private OchBusStationAdapter adapter; @Override protected void initViews() { super.initViews(); - tvStationNotice = findViewById(R.id.module_mogo_och_bus_current_station_notice); - tvStationName = findViewById(R.id.module_mogo_och_bus_current_station_name); - rvStationList = findViewById(R.id.module_mogo_och_bus_rv_station_list); + mBus = findViewById( R.id.module_och_bus_tag ); + mCurrentStationName = findViewById( R.id.module_och_bus_current_station ); + mStartStationFlag = findViewById( R.id.module_och_bus_start_station_tag ); + mNextStationName = findViewById( R.id.module_och_bus_order_end_station ); + mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag ); - adapter = new OchBusStationAdapter(getContext()); - rvStationList.setAdapter(adapter); - rvStationList.setLayoutManager(new LinearLayoutManager(getContext())); +// adapter = new OchBusStationAdapter( getContext() ); +// rvStationList.setAdapter( adapter ); +// rvStationList.setLayoutManager( new LinearLayoutManager( getContext() ) ); - tvStationName.setOnLongClickListener(view -> { - TipToast.shortTip("重置了车站状态"); - mPresenter.debugResetStationStatus(); - return true; - }); + if ( DebugConfig.isDebug() ) { + mBus.setOnClickListener( view -> { + TipToast.shortTip( "重置了车站状态" ); + mPresenter.debugResetStationStatus(); + } ); - tvStationNotice.setOnLongClickListener(view -> { - getActivity().finish(); - return true; - }); -// tvStationNotice.setOnClickListener(view -> { -// // todo debug code -// List stationList = new ArrayList<>(); -// OchBusStation station; -// switch (stationSizeLevel) { -// case 2: -// stationSizeLevel++; -// station = new OchBusStation(); -// station.setSiteName("第一站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第二站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// break; -// case 3: -// stationSizeLevel++; -// station = new OchBusStation(); -// station.setSiteName("第一站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第二站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第三站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// break; -// case 4: -// stationSizeLevel++; -// station = new OchBusStation(); -// station.setSiteName("第一站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第二站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第三站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第四站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// break; -// default: -// stationSizeLevel = 2; -// station = new OchBusStation(); -// station.setSiteName("第一站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第二站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第三站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第四站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第五站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第五站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// station = new OchBusStation(); -// station.setSiteName("第五站"); -// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE); -// stationList.add(station); -// break; -// } -// refreshBusStations(stationList); -// }); + mBus.setOnLongClickListener( view -> { + getActivity().finish(); + return true; + } ); + } - Logger.d(TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()); - switch (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()) { + Logger.d( TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() ); + switch ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() ) { case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE: hideAutopilotBiz(); break; case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE: showAutopilotBiz(); - onAutopilotStatusChanged(false); + onAutopilotStatusChanged( false ); break; case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING: showAutopilotBiz(); - onAutopilotStatusChanged(true); + onAutopilotStatusChanged( true ); break; default: break; @@ -166,27 +87,12 @@ public class OchBusFragment extends BaseOchFragment stationList) { - if (getActivity() == null) { + public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ) { + if ( getActivity() == null ) { return; } - getActivity().runOnUiThread(() -> { - if (stationList == null) { + getActivity().runOnUiThread( () -> { + if ( stationList == null ) { // 获取小巴数据失败 return; } - // 根据车站数量,调整面板高度,分为2,3,>3 - ViewGroup.LayoutParams params = rvStationList.getLayoutParams(); - switch (stationList.size()) { - case 2: - params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_two_station_list_height); - break; - case 3: - params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_three_station_list_height); - break; - default: - params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_station_list_height); - break; - } - rvStationList.setLayoutParams(params); - // 渲染小巴路线数据 - adapter.refreshStationList(stationList); - int currPos = -1; - for (int i = 0; i < stationList.size(); i++) { - OchBusStation station = stationList.get(i); - if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) { - currPos = i; - tvStationNotice.setText("当前车站"); - tvStationName.setText(station.getSiteName()); - if (i == stationList.size() - 1) { - showNotice("行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!"); - tvStationNotice.setText("终点"); - showSlidePanle("单程结束"); - } else if (i == 0) { - hideNotice(); - showSlidePanle("准备出发"); - } else { - showNotice("行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!"); - showSlidePanle("乘客已上车,准备出发"); - } - break; - }else if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING) { - tvStationName.setText(station.getSiteName()); - tvStationNotice.setText("下一站"); - currPos = i; - break; - } - } - // smoothMove - if (stationList.size() < 5) { - //数量太少,不进行smooth move - return; - } - int moveTo = currPos + 1; - if (currPos < 3) { - moveTo = 0; - } - if (currPos >= stationList.size() - 3) { - moveTo = stationList.size() - 1; - } - if (moveTo >= stationList.size()) { - moveTo = stationList.size() - 1; - } - rvStationList.smoothScrollToPosition(moveTo); - }); + // 渲染小巴路线数据 + renderCurrentStationStatus( stationList, currentStation, nextStation ); + } ); } + /** + * 重新刷新站点信息 + */ + private void renderCurrentStationStatus( List< OchBusStation > stationList, int currentStation, int nextStation ) { + + String currentStationName = null; + String nextStationName = null; + int startStationFlagVisibility = View.INVISIBLE; + int endStationFlagVisibility = View.INVISIBLE; + + boolean isArriveEndStation = false; + boolean isArriveAtStation = false; + boolean isArriveAtStartStation = false; + + for ( OchBusStation ochBusStation : stationList ) { + int index = stationList.indexOf( ochBusStation ); + switch ( ochBusStation.getIsCurrentSite() ) { + case OchBusConst.STATION_STATUS_STOPPED: + isArriveEndStation = index == stationList.size() - 1; + isArriveAtStation = true; + case OchBusConst.STATION_STATUS_LEAVING: + break; + case OchBusConst.STATION_STATUS_ARRIVING: + break; + } + } + + if ( currentStation == 0 ) { + startStationFlagVisibility = View.VISIBLE; + isArriveAtStartStation = true; + } + + if ( nextStation == stationList.size() - 1 ) { + endStationFlagVisibility = View.VISIBLE; + } + + currentStationName = stationList.get( currentStation ).getSiteName(); + + if ( nextStation < stationList.size() ) { + nextStationName = stationList.get( nextStation ).getSiteName(); + } + + if ( isArriveEndStation ) { + showNotice( "行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!" ); + showSlidePanle( "单程结束" ); + } else if ( isArriveAtStartStation ) { + showSlidePanle( "准备出发" ); + } else if ( isArriveAtStation ) { + showNotice( "行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!" ); + showSlidePanle( "乘客已上车,准备出发" ); + } + + mCurrentStationName.setText( currentStationName ); + mNextStationName.setText( nextStationName ); + mStartStationFlag.setVisibility( startStationFlagVisibility ); + mEndStationFlag.setVisibility( endStationFlagVisibility ); + } + + public void hideOchBus() { // tvNotice.setVisibility(View.GONE); } - private void queryStationListIfNecessary() { - if (adapter.getItemCount() == 0) { - mPresenter.queryBusRoutes(); - } - } - @Override public int getStationPanelViewId() { return R.layout.fragment_och_bus; @@ -283,7 +186,7 @@ public class OchBusFragment extends BaseOchFragment + * wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072 */ public interface IOchBusApiService { /** * 根据车机坐标获取所在区域全部站点信息 - *

- * wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072 * * @param requestBody 请求参数 * @return 接口返回数据 */ - @Headers({"Content-Type:application/json;charset=UTF-8"}) - @POST("/yycp-onlinecar-hailing/onlineCarHailing/site/querySiteByCoordinate/v1") - Observable querySiteByCoordinate(@Body RequestBody requestBody); + @Headers( {"Content-Type:application/json;charset=UTF-8"} ) + @POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/querySiteByCoordinate/v1" ) + Observable< OchBusRoutesResponse > querySiteByCoordinate( @Body RequestBody requestBody ); /** * 公交车驶离车站时,通知服务端 + * * @param requestBody 请求参数 {"sn":"","siteId":"车站id"} * @return 无返回值 */ - @Headers({"Content-Type:application/json;charset=UTF-8"}) - @POST("/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1") - Observable leaveStation(@Body RequestBody requestBody); + @Headers( {"Content-Type:application/json;charset=UTF-8"} ) + @POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1" ) + Observable< BaseData > leaveStation( @Body RequestBody requestBody ); /** * 调试用重置接口 + * * @param requestBody 请求参数{"siteId":1,"sn":"F803EB2046PZD00229"} * @return 返回值是重置后的车站列表 */ - @Headers({"Content-Type:application/json;charset=UTF-8"}) - @POST("/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1") - Observable debugResetStationStatus(@Body RequestBody requestBody); + @Headers( {"Content-Type:application/json;charset=UTF-8"} ) + @POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1" ) + Observable< OchBusRoutesResponse > debugResetStationStatus( @Body RequestBody requestBody ); + + /** + * 修改小巴运营状态 + * + * @param request + * @return + */ + @Headers( {"Content-type:application/json;charset=UTF-8"} ) + @POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/updateBusStatus/v1" ) + Observable< BaseData > changeOperationStatus( @Body OchBusOperationStatusRequest request ); + + /** + * 查询小巴运营状态 + * + * @param request + * @return + */ + @Headers( {"Content-type:application/json;charset=UTF-8"} ) + @POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/queryBusStatus/v1" ) + Observable< OchBusOperationStatusResponse > queryOperationStatus( @Body QueryOchBusOperationStatusRequest request ); + + /** + * 更新到站信息 + * + * @param request + * @return + */ + @Headers( {"Content-type:application/json;charset=UTF-8"} ) + @POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteDynamic/v1" ) + Observable< OchBusRoutesResponse > updateSiteStation( @Body UpdateSiteStatusRequest request ); } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java new file mode 100644 index 0000000000..2a54899375 --- /dev/null +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java @@ -0,0 +1,156 @@ +package com.mogo.och.bus.presenter; + +import android.content.Context; +import android.os.Looper; + +import com.mogo.commons.AbsMogoApplication; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.och.bus.bean.OchBusArriveAtStationMsg; +import com.mogo.och.bus.bean.OchBusOrder; +import com.mogo.och.bus.bean.OchBusStation; +import com.mogo.och.bus.bean.OchBusStationsChangedMsg; +import com.mogo.service.connection.IMogoOnMessageListener; +import com.mogo.utils.UiThreadHandler; + +import java.util.List; + +public +/** + * @author congtaowang + * @since 2021/3/23 + * + * 小巴订单管理 + */ +class OchBusOrderModel { + + private static volatile OchBusOrderModel sInstance; + + public static OchBusOrderModel getInstance() { + if ( sInstance == null ) { + synchronized ( OchBusOrderModel.class ) { + if ( sInstance == null ) { + sInstance = new OchBusOrderModel(); + } + } + } + return sInstance; + } + + public void init() { + mContext = AbsMogoApplication.getApp(); + MogoApisHandler.getInstance().getApis().getSocketManagerApi( mContext ).registerOnMessageListener( 401021, mOnOrderListener ); + MogoApisHandler.getInstance().getApis().getSocketManagerApi( mContext ).registerOnMessageListener( 401020, mOnBusStationsChangedMsg ); + } + + private Object readResolve() { + // 阻止反序列化,必须实现 Serializable 接口 + return sInstance; + } + + private Context mContext; + + /** + * 小巴订单 + *

+ * 1. 新订单 + */ + private IMogoOnMessageListener< OchBusOrder > mOnOrderListener = new IMogoOnMessageListener< OchBusOrder >() { + @Override + public Class< OchBusOrder > target() { + return OchBusOrder.class; + } + + @Override + public void onMsgReceived( OchBusOrder obj ) { + if ( obj == null ) { + return; + } + runOnUiThread( () -> { + if ( mOnBusOrderChangedListener != null ) { + mOnBusOrderChangedListener.onBusOrderChanged( obj ); + } + } ); + } + }; + + /** + * 小巴达到站点,推送需要下车的乘客列表 + */ + private IMogoOnMessageListener< OchBusArriveAtStationMsg > mOnBusArriveAtStationMsg = new IMogoOnMessageListener< OchBusArriveAtStationMsg >() { + @Override + public Class< OchBusArriveAtStationMsg > target() { + return OchBusArriveAtStationMsg.class; + } + + @Override + public void onMsgReceived( OchBusArriveAtStationMsg obj ) { + onArriveAtStation(); + } + }; + + /** + * 站点信息变更推送 + */ + private IMogoOnMessageListener< OchBusStationsChangedMsg > mOnBusStationsChangedMsg = new IMogoOnMessageListener< OchBusStationsChangedMsg >() { + @Override + public Class< OchBusStationsChangedMsg > target() { + return OchBusStationsChangedMsg.class; + } + + @Override + public void onMsgReceived( OchBusStationsChangedMsg obj ) { + if ( obj == null ) { + return; + } + runOnUiThread( () -> { + if ( mOnBusStationsChangedListener != null ) { + mOnBusStationsChangedListener.onBusStationsChanged( obj.data ); + } + } ); + } + }; + + private OnBusStationsChangedListener mOnBusStationsChangedListener; + private OnBusOrderChangedListener mOnBusOrderChangedListener; + + private OchBusOrderModel() { + + } + + /** + * 小巴到站 + */ + public void onArriveAtStation() { + + } + + public void setOnBusStationsChangedListener( OnBusStationsChangedListener onBusStationsChangedListener ) { + this.mOnBusStationsChangedListener = onBusStationsChangedListener; + } + + public void setOnBusOrderChangedListener( OnBusOrderChangedListener mOnBusOrderChangedListener ) { + this.mOnBusOrderChangedListener = mOnBusOrderChangedListener; + } + + /** + * 站点信息 + */ + public interface OnBusStationsChangedListener { + void onBusStationsChanged( List< OchBusStation > data ); + } + + /** + * 站点信息 + */ + public interface OnBusOrderChangedListener { + void onBusOrderChanged( OchBusOrder order ); + } + + private void runOnUiThread( Runnable runnable ) { + if ( Looper.myLooper() == Looper.getMainLooper() ) { + runnable.run(); + } else { + UiThreadHandler.postDelayed( runnable, 0 ); + } + } +} diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java index 70965978e2..effc503f7b 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java @@ -2,19 +2,29 @@ package com.mogo.och.bus.presenter; import android.os.Handler; import android.os.Message; +import android.text.TextUtils; + +import androidx.annotation.NonNull; +import androidx.lifecycle.LifecycleOwner; import com.mogo.commons.data.BaseData; import com.mogo.commons.mvp.Presenter; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; +import com.mogo.commons.voice.AIAssist; import com.mogo.map.location.MogoLocation; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.constants.HostConst; import com.mogo.och.bus.bean.OchBusLeaveStationRequest; +import com.mogo.och.bus.bean.OchBusOperationStatusRequest; +import com.mogo.och.bus.bean.OchBusOperationStatusResponse; +import com.mogo.och.bus.bean.OchBusOrder; import com.mogo.och.bus.bean.OchBusResetRequest; import com.mogo.och.bus.bean.OchBusRoutesRequest; import com.mogo.och.bus.bean.OchBusRoutesResponse; import com.mogo.och.bus.bean.OchBusStation; +import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest; +import com.mogo.och.bus.bean.UpdateSiteStatusRequest; import com.mogo.och.bus.fragment.OchBusFragment; import com.mogo.och.bus.net.IOchBusApiService; import com.mogo.service.adas.IMogoAdasOCHCallback; @@ -35,309 +45,464 @@ import okhttp3.RequestBody; import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_ARRIVING; import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_IDLE; import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_LEAVING; -import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPED; +import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPPED; /** * 网约车小巴 * * @author tongchenfei */ -public class OchBusPresenter extends Presenter implements IMogoAdasOCHCallback, Handler.Callback { +public class OchBusPresenter extends Presenter< OchBusFragment > implements IMogoAdasOCHCallback, + Handler.Callback, + OchBusOrderModel.OnBusStationsChangedListener, + OchBusOrderModel.OnBusOrderChangedListener { private static final String TAG = "OchBusPresenter"; - private static final int VEHICAL_TYPE = 10; - private static final int MSG_REQUERY_BUS_STATION = 1001; - private static final long REQUERY_BUS_STATION_DELAY = 5000; + + // 运营类型 + private static final int VEHICLE_TYPE = 10; + private static final int MSG_QUERY_BUS_STATION = 1001; + private static final long QUERY_BUS_STATION_DELAY = 5000; /** * 用来表示是否正在开往下一站 */ private boolean isGoingToNextStation = false; - public OchBusPresenter(OchBusFragment view) { - super(view); - MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback(this); + private IOchBusApiService mService; + + /** + * 运营状态 + */ + private boolean mIsWorking = false; + + public OchBusPresenter( OchBusFragment view ) { + super( view ); + mService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( IOchBusApiService.class, HostConst.OCH_DOMAIN ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback( this ); + OchBusOrderModel.getInstance().init(); + OchBusOrderModel.getInstance().setOnBusStationsChangedListener( this ); + OchBusOrderModel.getInstance().setOnBusOrderChangedListener( this ); } - private final Handler handler = new Handler(this); + private final Handler handler = new Handler( this ); - private final List stationList = new ArrayList<>(); + private final List< OchBusStation > stationList = new ArrayList<>(); private int currentStationIndex = 0; + @Override + public void onCreate( @NonNull LifecycleOwner owner ) { + super.onCreate( owner ); + queryOperationStatus(); + queryBusRoutes(); + } + + /** + * 查询小巴路线 + */ public void queryBusRoutes() { - double lat = 0; - double lon = 0; - MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(getContext()).getLastKnowLocation(); - if (lastLocation != null) { - lat = lastLocation.getLatitude(); - lon = lastLocation.getLongitude(); + double lat = 40.1974932972; + double lon = 116.7354579447; + MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( getContext() ).getLastKnowLocation(); + if ( lastLocation != null ) { +// lat = lastLocation.getLatitude(); +// lon = lastLocation.getLongitude(); } - OchBusRoutesRequest request = new OchBusRoutesRequest(Utils.getSn(), lat, lon); - RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request)); - MogoApisHandler.getInstance().getApis().getNetworkApi() - .create(IOchBusApiService.class, HostConst.OCH_DOMAIN) - .querySiteByCoordinate(requestBody) - .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + OchBusRoutesRequest request = new OchBusRoutesRequest( Utils.getSn(), lat, lon ); + RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) ); + mService.querySiteByCoordinate( requestBody ) + .subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) { @Override - public void onSuccess(OchBusRoutesResponse o) { - super.onSuccess(o); - Logger.d(TAG, "获取到小巴路线数据: " + o); - if (mView != null && o.getResult() != null && o.getResult().getSite() != null) { - stationList.clear(); - stationList.addAll(o.getResult().getSite()); - for (int i = 0; i < stationList.size(); i++) { - OchBusStation s = stationList.get(i); - if (s.getIsCurrentSite() == STATION_STATUS_LEAVING) { - // 服务端只记录了leaving状态,没有记录arriving状态,此处端上自己增加一个arriving状态 - isGoingToNextStation = true; - currentStationIndex = i; - if (i < stationList.size() - 1) { - // 将其下一站置为arriving状态 - stationList.get(i + 1).setIsCurrentSite(STATION_STATUS_ARRIVING); - } - mView.hideSlidePanel(); - } - } - refreshCurrentStation(); - mView.refreshBusStations(stationList); + public void onSuccess( OchBusRoutesResponse o ) { + super.onSuccess( o ); + if ( o == null + || o.getResult() == null + || o.getResult().getSite() == null + || o.getResult().getSite().isEmpty() ) { + return; } + Logger.d( TAG, "获取到小巴路线数据: " + o ); + renderBusStationsStatus( o.getResult().getSite() ); } @Override - public void onError(Throwable e) { - super.onError(e); - Logger.e(TAG, e, "获取小巴路线图失败"); + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "获取小巴路线图失败" ); // 重复请求小巴路线,直至成功 - requeryBusStation(); + queryBusStationDelay(); } @Override - public void onError(String message, int code) { - super.onError(message, code); - Logger.e(TAG, "获取小巴路线失败 code: " + code + " msg: " + message); + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message ); // 重复请求小巴路线,直至成功 - requeryBusStation(); + queryBusStationDelay(); } - }); + } ); } - public void getStationListFromSocket(List stations) { - // 接收长连接消息好像没啥用 + /** + * 渲染站点信息 + * + * @param site + */ + private void renderBusStationsStatus( List< OchBusStation > site ) { + stationList.clear(); + stationList.addAll( site ); + for ( int i = 0; i < stationList.size(); i++ ) { + OchBusStation s = stationList.get( i ); + if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING ) { + isGoingToNextStation = true; + mView.hideSlidePanel(); + } + + if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING + || s.getIsCurrentSite() == STATION_STATUS_STOPPED ) { + currentStationIndex = i; + } + } + + mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() ); } - private void requeryBusStation() { - handler.sendEmptyMessageDelayed(MSG_REQUERY_BUS_STATION, REQUERY_BUS_STATION_DELAY); + /** + * 根据订单状态、获取下一站靠站的的站点 + * + * @return -1 当前已是最后一个站点 + */ + private int getNextStopStation() { + if ( currentStationIndex >= stationList.size() - 1 ) { + return -1; + } + int nextStationIndex = currentStationIndex + 1; + for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) { + if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) { + break; + } + } + return nextStationIndex; + } + + private void queryBusStationDelay() { + handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY ); } public void restartAutopilot() { - Logger.d(TAG, "重启自动驾驶===" + isGoingToNextStation); - if (isGoingToNextStation) { + Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation ); + if ( isGoingToNextStation ) { autoDriveToNextStation(); } } - public void debugResetStationStatus(){ - OchBusResetRequest request = new OchBusResetRequest(Utils.getSn(), 1); - RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request)); - MogoApisHandler.getInstance().getApis().getNetworkApi() - .create(IOchBusApiService.class, HostConst.OCH_DOMAIN) - .debugResetStationStatus(requestBody) - .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + /** + * 测试 + */ + public void debugResetStationStatus() { + OchBusResetRequest request = new OchBusResetRequest( Utils.getSn(), 1 ); + RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) ); + mService.debugResetStationStatus( requestBody ) + .subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) { @Override - public void onSuccess(OchBusRoutesResponse o) { - super.onSuccess(o); - Logger.d(TAG, "获取到小巴路线数据: " + o); + public void onSuccess( OchBusRoutesResponse o ) { + super.onSuccess( o ); + Logger.d( TAG, "获取到小巴路线数据: " + o ); isGoingToNextStation = false; - if (mView != null && o.getResult() != null && o.getResult().getSite() != null) { - stationList.clear(); - stationList.addAll(o.getResult().getSite()); - for (int i = 0; i < stationList.size(); i++) { - OchBusStation s = stationList.get(i); - if (s.getIsCurrentSite() == STATION_STATUS_LEAVING) { - // 服务端只记录了leaving状态,没有记录arriving状态,此处端上自己增加一个arriving状态 - isGoingToNextStation = true; - currentStationIndex = i; - if (i < stationList.size() - 1) { - // 将其下一站置为arriving状态 - stationList.get(i + 1).setIsCurrentSite(STATION_STATUS_ARRIVING); - } - mView.hideSlidePanel(); - } - } - refreshCurrentStation(); - mView.refreshBusStations(stationList); + if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) { + return; } + renderBusStationsStatus( o.getResult().getSite() ); } @Override - public void onError(Throwable e) { - super.onError(e); - Logger.e(TAG, e, "获取小巴路线图失败"); + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "获取小巴路线图失败" ); // 重复请求小巴路线,直至成功 - requeryBusStation(); + queryBusStationDelay(); } @Override - public void onError(String message, int code) { - super.onError(message, code); - Logger.e(TAG, "获取小巴路线失败 code: " + code + " msg: " + message); + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message ); // 重复请求小巴路线,直至成功 - requeryBusStation(); + queryBusStationDelay(); } - }); + } ); } + /** + * 开启自动驾驶到下一站 + */ public void autoDriveToNextStation() { - if (currentStationIndex >= stationList.size() - 1) { + if ( currentStationIndex >= stationList.size() - 1 ) { // 当前站是最后一站,结束当前行程 travelOver(); return; } - OchBusStation currentStation = stationList.get(currentStationIndex); - OchBusStation nextStation = stationList.get(currentStationIndex + 1); - currentStation.setIsCurrentSite(STATION_STATUS_LEAVING); - nextStation.setIsCurrentSite(STATION_STATUS_ARRIVING); - RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters(); - currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(currentStation.getLat(), currentStation.getLon()); - currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(nextStation.getLat(), nextStation.getLon()); - currentAutopilot.vehicleType = VEHICAL_TYPE; - Logger.d(TAG, "开启自动驾驶====" + currentAutopilot); - MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot); + OchBusStation currentStation = stationList.get( currentStationIndex ); - if (mView != null) { - mView.refreshBusStations(stationList); + int nextStationIndex = getNextStopStation(); + + OchBusStation nextStation = stationList.get( nextStationIndex ); + currentStation.setIsCurrentSite( STATION_STATUS_LEAVING ); + nextStation.setIsCurrentSite( STATION_STATUS_ARRIVING ); + + RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters(); + currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() ); + currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() ); + currentAutopilot.vehicleType = VEHICLE_TYPE; + Logger.d( TAG, "开启自动驾驶====" + currentAutopilot ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( currentAutopilot ); + + if ( mView != null ) { + mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() ); } mView.hideSlidePanel(); mView.hideNotice(); - if (isGoingToNextStation) { + if ( isGoingToNextStation ) { // 为了避免恢复自动驾驶时重复的接口请求 return; } isGoingToNextStation = true; - RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId()))); - MogoApisHandler.getInstance().getApis().getNetworkApi() - .create(IOchBusApiService.class, HostConst.OCH_DOMAIN) - .leaveStation(request).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + AIAssist.getInstance( getContext() ).speakTTSVoice( "欢迎乘坐蘑菇智行无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" ); + RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( Utils.getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) ); + mService.leaveStation( request ).subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) { @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); + public void onSuccess( BaseData o ) { + super.onSuccess( o ); } @Override - public void onError(String message, int code) { - super.onError(message, code); - Logger.d(TAG, "leave station error: " + message); + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.d( TAG, "leave station error: " + message ); } @Override - public void onError(Throwable e) { - super.onError(e); - Logger.e(TAG, e, "leave station exception"); + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "leave station exception" ); } - }); - } - - private void refreshCurrentStation() { - currentStationIndex = 0; - for (OchBusStation station : stationList) { - // 如果数据表发生更新,获取当前所在车站 - if (station.getIsCurrentSite() == STATION_STATUS_STOPED || station.getIsCurrentSite() == STATION_STATUS_LEAVING) { - // 处于停靠或驶离时,是当前车站 - break; - } - currentStationIndex++; - } + } ); } @Override - public void onArriveAt(AdasOCHData data) { - if (currentStationIndex >= stationList.size() - 1) { - Logger.e(TAG,"到站异常,取消后续操作"); + public void onArriveAt( AdasOCHData data ) { + if ( currentStationIndex >= stationList.size() - 1 ) { + Logger.e( TAG, "到站异常,取消后续操作" ); return; } - Logger.d(TAG, "到站===="); - // 当前站改为IDLE,下一站改为STATION_STATUS_STOPED,currentStationIndex增加1 + Logger.d( TAG, "到站====" ); isGoingToNextStation = false; - stationList.get(currentStationIndex++).setIsCurrentSite(STATION_STATUS_IDLE); - stationList.get(currentStationIndex).setIsCurrentSite(STATION_STATUS_STOPED); - if (mView != null) { - mView.refreshBusStations(stationList); - } + // 到达站点后,更新站点状态 + currentStationIndex = getNextStopStation(); + mService.updateSiteStation( new UpdateSiteStatusRequest( stationList.get( currentStationIndex ).getSiteId() ) ) + .subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) { + @Override + public void onSuccess( OchBusRoutesResponse o ) { + super.onSuccess( o ); + if ( o.getResult() == null && o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) { + return; + } + renderBusStationsStatus( o.getResult().getSite() ); + } + + @Override + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.d( TAG, "leave station error: " + message ); + } + + @Override + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "leave station exception" ); + } + } ); + +// stationList.get( nextStation ).setIsCurrentSite( STATION_STATUS_STOPPED ); +// stationList.get( currentStationIndex ).setIsCurrentSite( STATION_STATUS_IDLE ); +// if ( mView != null ) { +// mView.refreshBusStations( stationList, currentStationIndex, nextStation ); +// } } + /** + * 行程结束 + */ private void travelOver() { - if (currentStationIndex >= stationList.size()) { - Logger.e(TAG, "travel over index out of station list"); + if ( currentStationIndex >= stationList.size() ) { + Logger.e( TAG, "travel over index out of station list" ); return; } - Logger.d(TAG, "单程结束===="); + Logger.d( TAG, "单程结束====" ); MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot(); - RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId()))); - MogoApisHandler.getInstance().getApis().getNetworkApi() - .create(IOchBusApiService.class, HostConst.OCH_DOMAIN) - .leaveStation(request).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + AIAssist.getInstance( getContext() ).speakTTSVoice( "感谢您体验蘑菇出行无人驾驶小巴车,请您携带好随身物品,我们下次再见" ); + RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( Utils.getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) ); + mService.leaveStation( request ).subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) { @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); + public void onSuccess( BaseData o ) { + super.onSuccess( o ); // 始发站改为Stoped,其他站改为Idle - Logger.d(TAG, "单程真的结束了===="); - stationList.get(currentStationIndex).setIsCurrentSite(STATION_STATUS_IDLE); + Logger.d( TAG, "单程真的结束了====" ); + stationList.get( currentStationIndex ).setIsCurrentSite( STATION_STATUS_IDLE ); currentStationIndex = 0; - stationList.get(currentStationIndex).setIsCurrentSite(STATION_STATUS_STOPED); - if (mView != null) { - mView.refreshBusStations(stationList); + stationList.get( currentStationIndex ).setIsCurrentSite( STATION_STATUS_STOPPED ); + stationList.get( currentStationIndex++ ).setIsCurrentSite( STATION_STATUS_ARRIVING ); + if ( mView != null ) { + mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() ); } } @Override - public void onError(String message, int code) { - super.onError(message, code); - Logger.d(TAG, "leave station error: " + message); + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.d( TAG, "leave station error: " + message ); } @Override - public void onError(Throwable e) { - super.onError(e); - Logger.e(TAG, e, "leave station exception"); + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "leave station exception" ); } - }); + } ); } @Override - public void onStateChanged(int state, String reason) { - Logger.d(TAG, "onStateChange: " + state); - switch (state) { + public void onStateChanged( int state, String reason ) { + Logger.d( TAG, "onStateChange: " + state ); + switch ( state ) { case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE: - mView.onAutopilotEnableChange(true); - mView.onAutopilotStatusChanged(false); - if (isGoingToNextStation) { + mView.onAutopilotEnableChange( true ); + mView.onAutopilotStatusChanged( false ); + if ( isGoingToNextStation ) { mView.hideSlidePanel(); } break; case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING: - mView.onAutopilotStatusChanged(true); + mView.onAutopilotStatusChanged( true ); break; default: - mView.onAutopilotEnableChange(false); + mView.onAutopilotEnableChange( false ); break; } } @Override - public boolean handleMessage(Message msg) { - if (msg.what == MSG_REQUERY_BUS_STATION) { + public boolean handleMessage( Message msg ) { + if ( msg.what == MSG_QUERY_BUS_STATION ) { queryBusRoutes(); return true; } return false; } + + public boolean isWorking() { + return mIsWorking; + } + + /** + * 修改小巴运营状态 + */ + public void onChangeOperationStatus() { + mService.changeOperationStatus( isWorking() ? new OchBusOperationStatusRequest().shutdown() : new OchBusOperationStatusRequest().launch() ) + .subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) { + @Override + public void onSuccess( BaseData o ) { + super.onSuccess( o ); + mIsWorking = !mIsWorking; + if ( mIsWorking ) { + if ( stationList != null && stationList.size() > 0 ) { + AIAssist.getInstance( getContext() ).speakTTSVoice( "车辆已整备完毕,请前往" + stationList.get( 0 ).getSiteName() + "站点" ); + } + } + if ( mView != null ) { + mView.changeOperationStatus( isWorking() ); + } + } + + @Override + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.d( TAG, "leave station error: " + message ); + } + + @Override + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "leave station exception" ); + } + } ); + } + + /** + * 查询运营状态 + */ + public void queryOperationStatus() { + mService.queryOperationStatus( new QueryOchBusOperationStatusRequest() ) + .subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< OchBusOperationStatusResponse >( RequestOptions.create( getContext() ) ) { + @Override + public void onSuccess( OchBusOperationStatusResponse o ) { + super.onSuccess( o ); + if ( o.result != null ) { + mIsWorking = o.result.status == 1; + } + if ( mView != null ) { + mView.changeOperationStatus( isWorking() ); + } + } + + @Override + public void onError( String message, int code ) { + super.onError( message, code ); + Logger.d( TAG, "leave station error: " + message ); + } + + @Override + public void onError( Throwable e ) { + super.onError( e ); + Logger.e( TAG, e, "leave station exception" ); + } + } ); + } + + + @Override + public void onBusStationsChanged( List< OchBusStation > data ) { + renderBusStationsStatus( data ); + } + + @Override + public void onBusOrderChanged( OchBusOrder order ) { + if ( order == null ) { + return; + } + if ( TextUtils.isEmpty( order.getUserPhone() ) ) { + return; + } + try { + String tailNum = order.getUserPhone().substring( order.getUserPhone().length() - 4 ); + AIAssist.getInstance( getContext() ).speakTTSVoice( "接到新订单,尾号" + tailNum + "上车站点为" + order.getStartStation() ); + } catch ( Exception e ) { + e.printStackTrace(); + } + } } diff --git a/OCH/mogo-och-bus/src/main/res/drawable-xhdpi/module_och_bus_dot_line.png b/OCH/mogo-och-bus/src/main/res/drawable-xhdpi/module_och_bus_dot_line.png new file mode 100644 index 0000000000000000000000000000000000000000..186001352c82bb9ad01ac4c1556c3b1e0f551dda GIT binary patch literal 323 zcmeAS@N?(olHy`uVBq!ia0vp^Oh9bI!3HFKj%EJ@QjEnx?oJHr&dIz4a$Hg)JkxxA z8MJ_G4hF{dOa>N^5+IfWVg?501&j>LK$;OGwtxvP%d~(Q&b9$5{LHz_7f7x3ba4#P z5KZ1%-o0L#n{r)6q;u;dN8?mF!s!=Ufy&zF_GaV6H`Z{09(KZ z{)h<*2Vd+jo~eJrZ$sGx&jRMihI2|Q + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/drawable/module_och_bus_panel_bkg.xml b/OCH/mogo-och-bus/src/main/res/drawable/module_och_bus_panel_bkg.xml index 389e5b539f..204c5fc692 100644 --- a/OCH/mogo-och-bus/src/main/res/drawable/module_och_bus_panel_bkg.xml +++ b/OCH/mogo-och-bus/src/main/res/drawable/module_och_bus_panel_bkg.xml @@ -3,10 +3,7 @@ - + - + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml index aa0e377783..b7a1745fbd 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml @@ -1,60 +1,143 @@ - - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="@dimen/module_och_bus_panel_width" + android:layout_height="@dimen/module_och_bus_panel_height" + android:background="@drawable/module_och_bus_panel_bkg" + android:orientation="vertical"> + android:layout_gravity="right" + android:layout_marginTop="16px" + android:layout_marginRight="16px" + android:background="@drawable/module_och_bus_panel_anchor_bkg" + android:paddingLeft="8px" + android:paddingTop="1px" + android:paddingRight="8px" + android:paddingBottom="1px" + android:text="小巴车" + android:textColor="#FFF" + android:textSize="16px" + android:textStyle="bold" /> - + android:layout_height="match_parent" + android:paddingLeft="@dimen/module_och_bus_order_status_stationInfo_paddingLeft" + android:paddingTop="@dimen/module_och_bus_order_status_stationInfo_paddingTop" + android:paddingRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight" + android:paddingBottom="@dimen/module_och_bus_order_status_stationInfo_paddingBottom"> - + - + - \ No newline at end of file + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus/src/main/res/values/dimens.xml b/OCH/mogo-och-bus/src/main/res/values/dimens.xml index 2e0c11b709..db034e5867 100644 --- a/OCH/mogo-och-bus/src/main/res/values/dimens.xml +++ b/OCH/mogo-och-bus/src/main/res/values/dimens.xml @@ -1,7 +1,7 @@ - 464px + 300px 348px 211px 276px @@ -29,4 +29,29 @@ 17px + 300px + 270px + 30px + 24px + 24px + 1px + 30px + 23px + 30px + 146px + 20px + 23px + 30px + 23px + 26px + 20px + 20px + 80px + 3px + 27px + 20px + 28px + 27px + + \ No newline at end of file diff --git a/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java b/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java index c39173fad8..a7df0f3a7e 100644 --- a/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java +++ b/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java @@ -35,6 +35,7 @@ public abstract class BaseOchFragment> e private View tvNoticeContainer; private TextView tvNotice; private CheckedTextView ctvAutopilotStatus; + protected TextView tvOperationStatus; private FrameLayout flStationPanelContainer; private FrameAnimImageView fivNoticeHead; @@ -60,6 +61,8 @@ public abstract class BaseOchFragment> e flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container); fivNoticeHead = findViewById(R.id.module_mogo_och_notice_head); + tvOperationStatus = findViewById( R.id.module_mogo_och_operation_status ); + panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer); slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener); fivNoticeHead.setAnimRes(sHappy1); @@ -68,8 +71,6 @@ public abstract class BaseOchFragment> e @Override public void onClickImpl(View v) { // 如果能自动驾驶,就自动驾驶,不能就提示 -// if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE) { -// } restartAutopilot(); } }); @@ -86,6 +87,14 @@ public abstract class BaseOchFragment> e findViewById(R.id.btnAutopilotRunning).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "Running")); findViewById(R.id.btnAutopilotArrive).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(-1, "Running")); + + tvOperationStatus.setOnClickListener( view -> { + onChangeOperationStatus(); + } ); + } + + protected void onChangeOperationStatus(){ + } private void checkCallView(boolean isShown) { @@ -102,9 +111,6 @@ public abstract class BaseOchFragment> e public void showSlidePanle(String text) { getActivity().runOnUiThread(() -> { slidePanelView.setText(text); - if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE) { - return; - } slidePanelView.setVisibility(View.VISIBLE); }); } @@ -118,9 +124,6 @@ public abstract class BaseOchFragment> e public void showNotice(String notice) { getActivity().runOnUiThread(() -> { tvNotice.setText(notice); - if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE) { - return; - } AIAssist.getInstance(getContext()).speakTTSVoice(notice); tvNoticeContainer.setVisibility(View.VISIBLE); fivNoticeHead.setVisibility(View.VISIBLE); @@ -149,8 +152,8 @@ public abstract class BaseOchFragment> e public void hideAutopilotBiz() { getActivity().runOnUiThread(() -> { - ctvAutopilotStatus.setVisibility(View.GONE); - slidePanelView.setVisibility(View.GONE); +// ctvAutopilotStatus.setVisibility(View.GONE); +// slidePanelView.setVisibility(View.GONE); }); } diff --git a/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml b/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml index 84b729bc63..85791d509e 100644 --- a/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml +++ b/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml @@ -1,10 +1,14 @@ - + + android:startColor="#FF405591" /> \ No newline at end of file diff --git a/OCH/mogo-och/src/main/res/drawable/module_mogo_och_operation_status_bg.xml b/OCH/mogo-och/src/main/res/drawable/module_mogo_och_operation_status_bg.xml new file mode 100644 index 0000000000..84b729bc63 --- /dev/null +++ b/OCH/mogo-och/src/main/res/drawable/module_mogo_och_operation_status_bg.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml index 3ce2aa886f..d628006b1b 100644 --- a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml +++ b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml @@ -1,34 +1,53 @@ - - + + + + @@ -43,84 +62,86 @@ + tools:visibility="visible"> + + android:textStyle="bold" /> + app:layout_constraintTop_toTopOf="@id/module_mogo_och_notice_container" />