diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerOperationStatusResponse.java b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/BusPassengerOperationStatusResponse.java similarity index 100% rename from OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerOperationStatusResponse.java rename to OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/BusPassengerOperationStatusResponse.java diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerQueryLineRequest.java b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/BusPassengerQueryLineRequest.java similarity index 100% rename from OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerQueryLineRequest.java rename to OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/BusPassengerQueryLineRequest.java diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2RoutesResponse.java b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/PM2RoutesResponse.java similarity index 92% rename from OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2RoutesResponse.java rename to OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/PM2RoutesResponse.java index 06d25677a8..32306a33c1 100644 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2RoutesResponse.java +++ b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/bean/PM2RoutesResponse.java @@ -1,4 +1,4 @@ -package com.mogo.och.bus.passenger.passenger.bean; +package com.mogo.och.bus.passenger.bean; import com.mogo.eagle.core.data.BaseData; import com.mogo.och.data.bean.BusRoutesResult; diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/BusPassengerServiceManager.kt b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/BusPassengerServiceManager.kt similarity index 95% rename from OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/BusPassengerServiceManager.kt rename to OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/BusPassengerServiceManager.kt index 8d92a70a56..626fe265ae 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/BusPassengerServiceManager.kt +++ b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/BusPassengerServiceManager.kt @@ -2,7 +2,7 @@ package com.mogo.och.bus.passenger.network import android.content.Context import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken -import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse +import com.mogo.och.bus.passenger.bean.PM2RoutesResponse import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.debug.DebugConfig import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest @@ -31,7 +31,7 @@ object BusPassengerServiceManager { * 获取Bus司机端的sn * @return */ - val driverAppSn: String + public val driverAppSn: String get() { val serverToken = getServerToken() if (serverToken != driverSnCache && serverToken.isNotEmpty()) { @@ -47,7 +47,7 @@ object BusPassengerServiceManager { */ @JvmStatic fun queryDriverSiteByCoordinate( - context: Context, callback: OchCommonServiceCallback? + context: Context, callback: OchCommonServiceCallback? ) { if (DebugConfig.getProjectFlavor().contains("saas")){ mBusPassengerSaasServiceApi.queryDriverSiteByCoordinate( diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/PassengerSAASServiceApi.java b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/PassengerSAASServiceApi.java similarity index 82% rename from OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/PassengerSAASServiceApi.java rename to OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/PassengerSAASServiceApi.java index 1810e79298..577a72524c 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/PassengerSAASServiceApi.java +++ b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/PassengerSAASServiceApi.java @@ -2,7 +2,7 @@ package com.mogo.och.bus.passenger.network; import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse; import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest; -import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse; +import com.mogo.och.bus.passenger.bean.PM2RoutesResponse; import io.reactivex.Observable; import retrofit2.http.Body; @@ -17,7 +17,7 @@ import retrofit2.http.Query; * * Bus乘客端接口定义 */ -interface PassengerSAASServiceApi { +public interface PassengerSAASServiceApi { /** * 查询bus司机端绑定路线 * @return 接口返回数据 @@ -25,7 +25,7 @@ interface PassengerSAASServiceApi { @Headers( {"Content-Type:application/json;charset=UTF-8"} ) // @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" ) @GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" ) - Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); + Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); /** * 查询司机端的登陆状态 diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/PassengerServiceApi.java b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/PassengerServiceApi.java similarity index 81% rename from OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/PassengerServiceApi.java rename to OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/PassengerServiceApi.java index b1c16037d0..00b312ee2d 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/PassengerServiceApi.java +++ b/OCH/bus/passenger/src/main/java/com/mogo/och/bus/passenger/network/PassengerServiceApi.java @@ -2,7 +2,7 @@ package com.mogo.och.bus.passenger.network; import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse; import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest; -import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse; +import com.mogo.och.bus.passenger.bean.PM2RoutesResponse; import io.reactivex.Observable; import retrofit2.http.Body; @@ -17,14 +17,14 @@ import retrofit2.http.Query; * * Bus乘客端接口定义 */ -interface PassengerServiceApi { +public interface PassengerServiceApi { /** * 查询bus司机端绑定路线 * @return 接口返回数据 */ @Headers( {"Content-Type:application/json;charset=UTF-8"} ) @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" ) - Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request); + Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request); /** * 查询司机端的登陆状态 diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerRoutesResponse.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerRoutesResponse.java deleted file mode 100644 index 01163fd6c5..0000000000 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerRoutesResponse.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mogo.och.bus.passenger.bean; - -import com.mogo.eagle.core.data.BaseData; - -/** - * 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息 - * - * @author tongchenfei - */ -public class BusPassengerRoutesResponse extends BaseData { - private BusPassengerRoutesResult data; - - public BusPassengerRoutesResult getResult() { - return data; - } - - public void setResult(BusPassengerRoutesResult data) { - this.data = data; - } - - @Override - public String toString() { - return "OchBusRoutesResponse{" + - "data=" + data + - '}'; - } - -} diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerRoutesResult.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerRoutesResult.java deleted file mode 100644 index fa4a2ae0be..0000000000 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerRoutesResult.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.mogo.och.bus.passenger.bean; - -import java.util.List; -import java.util.Objects; - -/** - * 网约车小巴路线接口返回接口数据封装 - * - * @author tongchenfei - */ -public class BusPassengerRoutesResult { - private List sites; - private int lineId; - private String name; //线路名称 - private int lineType; //线路类型,0:环形 - private String description; - private int status; - private String runningDur; //运营时间 - private long taskTime; //线路时间班次 - - public List getSites() { - return sites; - } - - public int getLineId() { - return lineId; - } - - public String getName() { - return name; - } - - public int getLineType() { - return lineType; - } - - public String getDescription() { - return description; - } - - public int getStatus() { - return status; - } - - public String getRunningDur() { - return runningDur; - } - - public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“” - public String csvFileMd5 = ""; //轨迹文件md5,默认“” - public String txtFileUrl = ""; //打点文件下载的cos url,默认“” - public String txtFileMd5 = ""; //轨迹文件md5,默认“” - public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖 - public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题 - public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“” - public String csvFileMd5DPQP = ""; //轨迹文件md5,默认“” - public String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“” - public String txtFileMd5DPQP = ""; //轨迹文件md5,默认“” - public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖 - - @Override - public String toString() { - return "BusPassengerRoutesResult{" + - "sites=" + sites + - ", lineId=" + lineId + - ", name='" + name + '\'' + - ", lineType=" + lineType + - ", description='" + description + '\'' + - ", status=" + status + - ", runningDur='" + runningDur + '\'' + - ", taskTime=" + taskTime + - ", csvFileUrl='" + csvFileUrl + '\'' + - ", csvFileMd5='" + csvFileMd5 + '\'' + - ", txtFileUrl='" + txtFileUrl + '\'' + - ", txtFileMd5='" + txtFileMd5 + '\'' + - ", contrailSaveTime=" + contrailSaveTime + - ", carModel='" + carModel + '\'' + - ", csvFileUrlDPQP='" + csvFileUrlDPQP + '\'' + - ", csvFileMd5DPQP='" + csvFileMd5DPQP + '\'' + - ", txtFileUrlDPQP='" + txtFileUrlDPQP + '\'' + - ", txtFileMd5DPQP='" + txtFileMd5DPQP + '\'' + - ", contrailSaveTimeDPQP=" + contrailSaveTimeDPQP + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BusPassengerRoutesResult that = (BusPassengerRoutesResult) o; - return lineId == that.lineId - && lineType == that.lineType - && status == that.status - && sites.equals(that.sites) - && name.equals(that.name) - && runningDur.equals(that.runningDur); - } - - @Override - public int hashCode() { - return Objects.hash(sites, lineId, name, lineType, description, status, runningDur); - } -} diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerStation.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerStation.java deleted file mode 100644 index 401bcd9dd1..0000000000 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/bean/BusPassengerStation.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.mogo.och.bus.passenger.bean; - -import java.util.Objects; - -/** - * 单个网约车小巴车站信息 - * - * @author wangmingjun - */ -public class BusPassengerStation { - - private String name; - private String description; - private String cityCode; - private double lon; //高精坐标 - private double lat; //高精坐标 - private double gcjLon; //高德坐标 - private double gcjLat; //高德坐标 - private int businessType; //站点类型,9:taxi,10:bus - private int status; - private int siteId; - private int seq; - private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站 - private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠 - private boolean leaving; - - public void setName(String name) { - this.name = name; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setCityCode(String cityCode) { - this.cityCode = cityCode; - } - - public void setLon(double lon) { - this.lon = lon; - } - - public void setLat(double lat) { - this.lat = lat; - } - - public void setBusinessType(int businessType) { - this.businessType = businessType; - } - - public void setStatus(int status) { - this.status = status; - } - - public void setSiteId(int siteId) { - this.siteId = siteId; - } - - public void setSeq(int seq) { - this.seq = seq; - } - - public void setDrivingStatus(int drivingStatus) { - this.drivingStatus = drivingStatus; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getCityCode() { - return cityCode; - } - - public double getGcjLon() { - return gcjLon; - } - - public double getGcjLat() { - return gcjLat; - } - - public int getBusinessType() { - return businessType; - } - - public int getStatus() { - return status; - } - - public int getSiteId() { - return siteId; - } - - public int getSeq() { - return seq; - } - - public int getDrivingStatus() { - return drivingStatus; - } - - public double getLon() { - return lon; - } - - public double getLat() { - return lat; - } - - public void setIfStop(int ifStop) { - this.ifStop = ifStop; - } - - public int getIfStop() { - return ifStop; - } - - public void setLeaving(boolean leaving) { - this.leaving = leaving; - } - - public boolean isLeaving() { - return leaving; - } - - @Override - public String toString() { - return "OchBusStation{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", cityCode='" + cityCode + '\'' + - ", lon=" + lon + - ", lat=" + lat + - ", businessType=" + businessType + - ", status=" + status + - ", siteId=" + siteId + - ", seq=" + seq + - ", drivingStatus=" + drivingStatus + - ", ifStop=" + ifStop + - ", leaving=" + leaving + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BusPassengerStation that = (BusPassengerStation) o; - return Double.compare(that.lon, lon) == 0 - && Double.compare(that.lat, lat) == 0 - && Double.compare(that.gcjLon, gcjLon) == 0 - && Double.compare(that.gcjLat, gcjLat) == 0 - && businessType == that.businessType - && status == that.status - && siteId == that.siteId - && seq == that.seq - && drivingStatus == that.drivingStatus - && ifStop == that.ifStop - && leaving == that.leaving - && Objects.equals(name, that.name) - && Objects.equals(cityCode, that.cityCode); - } - - @Override - public int hashCode() { - return Objects.hash(name, description, cityCode, lon, lat, gcjLon, gcjLat, businessType, status, siteId, seq, drivingStatus, ifStop, leaving); - } -} diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerADASStatusCallback.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerADASStatusCallback.java index 4dbf53010c..ce58b08413 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerADASStatusCallback.java +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerADASStatusCallback.java @@ -6,8 +6,6 @@ package com.mogo.och.bus.passenger.callback; * Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等) */ public interface IBusPassengerADASStatusCallback { - // 自动驾驶触发的已到达目的地:暂未用到 - void onAutopilotArriveEnd(); // 自动驾驶可用状态 void onAutopilotEnable(); diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerAutopilotPlanningCallback.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerAutopilotPlanningCallback.java index 7f07057f98..3a09bc436d 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerAutopilotPlanningCallback.java +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerAutopilotPlanningCallback.java @@ -11,5 +11,4 @@ import java.util.List; public interface IBusPassengerAutopilotPlanningCallback { void routeResult(List routeArrivied, List routeArriving, MogoLocation location); void routePlanningToNextStationChanged(long meters, long timeInSecond); - void updateTotalDistance(); } diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerRouteLineInfoCallback.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerRouteLineInfoCallback.java index b7d348a2b2..caf252a64e 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerRouteLineInfoCallback.java +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/callback/IBusPassengerRouteLineInfoCallback.java @@ -1,6 +1,6 @@ package com.mogo.och.bus.passenger.callback; -import com.mogo.och.bus.passenger.bean.BusPassengerStation; +import com.mogo.och.data.bean.BusStationBean; import java.util.List; @@ -10,7 +10,7 @@ import java.util.List; */ public interface IBusPassengerRouteLineInfoCallback { void updateLineInfo(String lineName, String lineDurTime); - void updateStationsInfo(List stations, int currentStationIndex, boolean isArrived); + void updateStationsInfo(List stations, int currentStationIndex, boolean isArrived); void showNoTaskView(); void hideNoTaskView(); } diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/model/BusPassengerModel.kt b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/model/BusPassengerModel.kt index 1e8c2ea0fa..1fd3869bda 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/model/BusPassengerModel.kt +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/model/BusPassengerModel.kt @@ -38,12 +38,9 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.bus.passenger.R import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse -import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse -import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult -import com.mogo.och.bus.passenger.bean.BusPassengerStation +import com.mogo.och.bus.passenger.bean.PM2RoutesResponse import com.mogo.och.bus.passenger.callback.* import com.mogo.och.bus.passenger.constant.BusPassengerConst -import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager import com.mogo.och.bus.passenger.network.BusPassengerServiceManager import com.mogo.och.bus.passenger.network.BusPassengerServiceManager.driverAppSn import com.mogo.och.common.module.bean.dpmsg.AppConnectMsg @@ -61,14 +58,14 @@ import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceM import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.addTrajectoryListener import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.setStationPoint import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.suspendCalculate -import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.calculateRouteSumLength -import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations -import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.getArrivedPointIndexNew +import com.mogo.och.common.module.manager.loopmanager.BizLoopManager +import com.mogo.och.common.module.manager.loopmanager.LoopInfo import com.mogo.och.common.module.utils.DateTimeUtil import com.mogo.och.common.module.utils.PinYinUtil -import mogo.telematics.pad.MessagePad +import com.mogo.och.data.bean.BusRoutesResult +import com.mogo.och.data.bean.BusStationBean +import io.reactivex.schedulers.Schedulers import mogo.telematics.pad.MessagePad.ArrivalNotification -import mogo.telematics.pad.MessagePad.GlobalPathResp import java.util.concurrent.ConcurrentHashMap /** @@ -78,24 +75,21 @@ import java.util.concurrent.ConcurrentHashMap object BusPassengerModel { private val TAG = BusPassengerModel::class.java.simpleName + private val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE" private const val MSG_QUERY_BUS_P_STATION = 1001 - private val mRoutePoints: MutableList = ArrayList() - private var mContext: Context? = null - private var mADASStatusCallback //Model->Presenter:自动驾驶状态相关 - : IBusPassengerADASStatusCallback? = null - private var mAutopilotPlanningCallback //Model->Presenter:自动驾驶线路规划 - : IBusPassengerAutopilotPlanningCallback? = null + private var mADASStatusCallback: IBusPassengerADASStatusCallback? = + null//Model->Presenter:自动驾驶状态相关 + private var mAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback? = + null//Model->Presenter:自动驾驶线路规划 private val mControllerStatusCallbackMap: MutableMap = ConcurrentHashMap() - private var mDriverStatusCallback //出车收车状态 - : IBusPassegerDriverStatusCallback? = null - private var mRouteLineInfoCallback // bus路线信息更新 - : IBusPassengerRouteLineInfoCallback? = null + private var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null//出车收车状态 + private var mRouteLineInfoCallback: IBusPassengerRouteLineInfoCallback? = null// bus路线信息更新 private var mLocation: MogoLocation? = null - private var routesResult: BusPassengerRoutesResult? = null - var mStations: MutableList = ArrayList() + private var routesResult: BusRoutesResult? = null + var mStations: MutableList = ArrayList() private var mNextStationIndex = 0 // 要到达站的index private val mTwoStationsRouts: MutableList = ArrayList() private val handler = Handler(Looper.getMainLooper(), Handler.Callback { msg -> @@ -113,7 +107,10 @@ object BusPassengerModel { mContext = context.applicationContext initListeners() queryDriverOperationStatus() - startOrStopOrderLoop(true) + BizLoopManager.setLoopFunction( + TAG_LOOP_QUERY_BIND_LINE, + LoopInfo(2, ::queryDriverSiteByCoordinate, scheduler = Schedulers.io()) + ) } fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) { @@ -163,10 +160,10 @@ object BusPassengerModel { }) } - fun queryDriverSiteByCoordinate() { + private fun queryDriverSiteByCoordinate() { BusPassengerServiceManager.queryDriverSiteByCoordinate( - mContext!!, object : OchCommonServiceCallback { - override fun onSuccess(data: BusPassengerRoutesResponse) { + mContext!!, object : OchCommonServiceCallback { + override fun onSuccess(data: PM2RoutesResponse) { if (data.result == null) { d(M_BUS_P + TAG, "order = queryDriverSiteByCoordinate = null") if (routesResult != null) { @@ -175,7 +172,6 @@ object BusPassengerModel { } cleanStation("queryDriverSiteByCoordinate") mRouteLineInfoCallback?.showNoTaskView() - mRoutePoints.clear() return } if (routesResult != null && data.result.equals(routesResult)) { @@ -207,7 +203,7 @@ object BusPassengerModel { }) } - private fun updatePassengerRouteInfo(result: BusPassengerRoutesResult) { + private fun updatePassengerRouteInfo(result: BusRoutesResult) { if (mRouteLineInfoCallback != null) { d( M_BUS_P + TAG, @@ -255,7 +251,7 @@ object BusPassengerModel { } private fun updateAutopilotControlParameters( - busRoutesResult: BusPassengerRoutesResult, + busRoutesResult: BusRoutesResult, leaveIndex: Int ) { val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex) @@ -273,7 +269,7 @@ object BusPassengerModel { } private fun initAutopilotControlParameters( - busRoutesResult: BusPassengerRoutesResult, + busRoutesResult: BusRoutesResult, leaveIndex: Int ): AutopilotControlParameters? { if (busRoutesResult.sites == null) { @@ -311,7 +307,7 @@ object BusPassengerModel { fun release() { releaseListeners() cleanStation("release") - startOrStopOrderLoop(false) + BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE) } fun setMoGoAutopilotPlanningListener(moGoAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback?) { @@ -348,9 +344,6 @@ object BusPassengerModel { // 定位监听 addListener(TAG, 10, mMapLocationListener) - //2021.11.1 自动驾驶路线规划接口 - CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener) - //监听司机端消息 CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener) startLoopAbnormalFactors(mContext!!) @@ -370,7 +363,6 @@ object BusPassengerModel { MogoAiCloudSocketManager.getInstance(mContext) .unregisterLifecycleListener(10010) CallerAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener) - CallerPlanningRottingListenerManager.removeListener(moGoAutopilotPlanningListener) CallerTelematicListenerManager.removeListener(TAG) stopLoopAbnormalFactors() } @@ -513,86 +505,12 @@ object BusPassengerModel { ) { arriveAtEnd = true } - -// if (DebugConfig.isDebug()) { - // ToastUtils.showShort("到达目的地") -// } - mADASStatusCallback?.onAutopilotArriveEnd() } } - private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener = - object : IMoGoPlanningRottingListener { - override fun onAutopilotRotting(globalPathResp: GlobalPathResp?) { - globalPathResp?.wayPointsList?.let { - if (it.size > 0) { - d(M_BUS_P + TAG, "收到轨迹:${it.size}--第一个点${it[0]}--最后一个点:${it.last()}") - updateRoutePoints(it) - } - } - } - } - - fun updateRoutePoints(routePoints: List) { - mRoutePoints.clear() - val latLngModels: List = - coordinateConverterWgsToGcjLocations(mContext, routePoints) - mRoutePoints.addAll(latLngModels) - calculateTwoStationsRoute() - } - - private fun calculateTwoStationsRoute() { - //找出前往站对应的轨迹点,拿出两站点的集合 - d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size) - if (mRoutePoints.size > 0) { - if (mStations.size > 1) { //两个站点及以上要计算两个站点间的轨迹路线 - if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex - 1 >= 0) { - mTwoStationsRouts.clear() - val stationNext = mStations[mNextStationIndex] - val stationCur = mStations[mNextStationIndex - 1] - //当前站在轨迹中对应的点 - val currentRouteIndex = getArrivedPointIndexNew( - 0, mRoutePoints, stationCur.gcjLon, stationCur.gcjLat - ) - //要前往的站在轨迹中对应的点 - val nextRouteIndex = getArrivedPointIndexNew( - currentRouteIndex, mRoutePoints, stationNext.gcjLon, stationNext.gcjLat - ) - d( - M_BUS_P + TAG, - "轨迹排查==currentRouteIndex = " + currentRouteIndex - + ", nextRouteIndex = " + nextRouteIndex - ) - if (currentRouteIndex < nextRouteIndex) { //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示 - mTwoStationsRouts.addAll( - mRoutePoints.subList( - currentRouteIndex, - nextRouteIndex + 1 - ) - ) - } - } - } - if (mTwoStationsRouts.size > 0) { - val sumLength = calculateRouteSumLength(mTwoStationsRouts) - SharedPrefsMgr.getInstance() - .putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS, sumLength.toInt()) - mAutopilotPlanningCallback?.updateTotalDistance() - } - } - } - - private fun startOrStopOrderLoop(start: Boolean) { - d(M_BUS_P + TAG, "startOrStopOrderLoop() $start") - if (start) { - BusPassengerModelLoopManager.getInstance().startQueryDriverLineLoop() - } else { - BusPassengerModelLoopManager.getInstance().stopQueryDriverLineLoop() - } - } private fun setTrajectoryStation( - startStationInfo: BusPassengerStation, - endStationInfo: BusPassengerStation, + startStationInfo: BusStationBean, + endStationInfo: BusStationBean, lineId: Int ) { val startStation = MogoLocation() diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/BusPassengerModelLoopManager.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/BusPassengerModelLoopManager.java deleted file mode 100644 index f10f9537c9..0000000000 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/network/BusPassengerModelLoopManager.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.mogo.och.bus.passenger.network; - -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; -import com.mogo.och.bus.passenger.model.BusPassengerModel; - -import java.util.concurrent.TimeUnit; - -import io.reactivex.Observable; -import io.reactivex.ObservableEmitter; -import io.reactivex.ObservableOnSubscribe; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.CompositeDisposable; -import io.reactivex.disposables.Disposable; -import io.reactivex.functions.Consumer; -import io.reactivex.schedulers.Schedulers; - -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P; -import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_DELAY; -import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_LINE_2S; -import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_LINE_1S; - -/** - * Created on 2021/11/22 - * - * 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等) - */ -public class BusPassengerModelLoopManager { - - private static final String TAG = BusPassengerModelLoopManager.class.getSimpleName(); - - private static final class SingletonHolder { - private static final BusPassengerModelLoopManager INSTANCE = new BusPassengerModelLoopManager(); - } - - public static BusPassengerModelLoopManager getInstance() { - return SingletonHolder.INSTANCE; - } - - private Disposable mQueryLineDisposable; //心跳轮询 - - public void startQueryDriverLineLoop() { - if (mQueryLineDisposable != null && !mQueryLineDisposable.isDisposed()) { - return; - } - CallerLogger.i(M_BUS_P + TAG, "startQueryDriverLineLoop()"); - mQueryLineDisposable = Observable.interval(LOOP_DELAY, - LOOP_LINE_2S, TimeUnit.MILLISECONDS) - .map((aLong -> aLong + 1)) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(aLong -> BusPassengerModel.INSTANCE.queryDriverSiteByCoordinate()); - } - - public void stopQueryDriverLineLoop() { - if (mQueryLineDisposable != null) { - CallerLogger.i(M_BUS_P + TAG, "stopQueryDriverLineLoop()"); - mQueryLineDisposable.dispose(); - mQueryLineDisposable = null; - } - } - -} diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/presenter/BaseBusPassengerPresenter.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/presenter/BaseBusPassengerPresenter.java index f16f4c521d..e0b8add9a9 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/presenter/BaseBusPassengerPresenter.java +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/presenter/BaseBusPassengerPresenter.java @@ -14,7 +14,6 @@ import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.och.bus.passenger.bean.BusPassengerStation; import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback; import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback; import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback; @@ -80,12 +79,6 @@ public class BaseBusPassengerPresenter extends Presenter mView.onAutopilotStatusChanged( @@ -137,7 +130,7 @@ public class BaseBusPassengerPresenter extends Presenter stations, int currentStationIndex, boolean isArrived) { + public void updateStationsInfo(List stations, int currentStationIndex, boolean isArrived) { runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived)); } @@ -161,8 +154,4 @@ public class BaseBusPassengerPresenter extends Presenter mView.updateRoutePlanningToNextStation(meters, timeInSecond)); } - @Override - public void updateTotalDistance() { -// runOnUIThread(() -> mView.setProgressBarMax()); - } } diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.kt b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.kt deleted file mode 100644 index ba29d8b746..0000000000 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.kt +++ /dev/null @@ -1,334 +0,0 @@ -package com.mogo.och.bus.passenger.ui - -import android.content.Context -import android.os.Bundle -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import android.widget.RelativeLayout -import com.amap.api.maps.AMap -import com.amap.api.maps.CameraUpdateFactory -import com.amap.api.maps.TextureMapView -import com.amap.api.maps.model.BitmapDescriptor -import com.amap.api.maps.model.BitmapDescriptorFactory -import com.amap.api.maps.model.CameraPosition -import com.amap.api.maps.model.CustomMapStyleOptions -import com.amap.api.maps.model.LatLng -import com.amap.api.maps.model.LatLngBounds -import com.amap.api.maps.model.Marker -import com.amap.api.maps.model.MarkerOptions -import com.amap.api.maps.model.Polyline -import com.amap.api.maps.model.PolylineOptions -import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P -import com.mogo.och.bus.passenger.R -import com.mogo.och.bus.passenger.utils.BusPassengerMapAssetStyleUtil - -/** - * 乘客屏小地图 - */ -class BusPassengerMapDirectionView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener, - IBusPassengerMapDirectionView, AMap.OnCameraChangeListener { - - companion object { - //小地图名称 - const val TAG = "BusPassengerMapDirectionView" - } - - private lateinit var mAMapNaviView: TextureMapView - private lateinit var mAMap: AMap - private var mPolyline: Polyline? = null - private val mLineMarkers: MutableList = ArrayList() - private lateinit var mCarMarker: Marker - - private val mLineStationLatLng: MutableList = ArrayList() //站点坐标数据 - var textureList: MutableList = ArrayList() - var texIndexList: MutableList = ArrayList() - private var mArrivedRes: BitmapDescriptor? = null - private var mUnArrivedRes: BitmapDescriptor? = null - - private val routeArrived: MutableList = ArrayList() - private val routeArriving: MutableList = ArrayList() - private var location: MogoLocation? = null - - init { - try { - initView(context) - } catch (e: Exception) { - e.printStackTrace() - } - } - - private fun initView(context: Context) { - d(M_BUS_P + TAG, "initView") - val smpView = LayoutInflater.from(context).inflate(R.layout.bus_p_map_view, this) - mAMapNaviView = smpView.findViewById(R.id.bus_p_line_amap_view) as TextureMapView - initAMapView() - - // 注册定位监听 - CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 1, this) - } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - // 注册定位监听 - CallerChassisLocationGCJ02ListenerManager.removeListener(TAG) - } - - private fun initAMapView() { - mAMap = mAMapNaviView.map - // 设置导航地图模式,aMap是地图控制器对象。 - mAMap.mapType = AMap.MAP_TYPE_NIGHT - - // 关闭显示实时路况图层,aMap是地图控制器对象。 - mAMap.isTrafficEnabled = false - - // 设置 锚点 图标 - mCarMarker = mAMap.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_car)).anchor(0.5f, 0.5f)) - mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_arrived) - mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_un_arrive) - - // 加载自定义样式 - val customMapStyleOptions = CustomMapStyleOptions() - .setEnable(true) - .setStyleData( - BusPassengerMapAssetStyleUtil.getAssetsStyle( - context, "map_style.data" - ) - ) - .setStyleExtraData( - BusPassengerMapAssetStyleUtil.getAssetsExtraStyle( - context, "map_style_extra.data" - ) - ) - // 设置自定义样式 - mAMap.setCustomMapStyle(customMapStyleOptions) - - // 设置地图的样式 - mAMap.uiSettings.apply { - isZoomControlsEnabled = false // 地图缩放级别的交换按钮 - setAllGesturesEnabled(true) // 所有手势 - isMyLocationButtonEnabled = false // 显示默认的定位按钮 - setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可 - } - - mAMap.setOnMapLoadedListener { - d(M_BUS_P + TAG, "smp---onMapLoaded") - // 加载自定义样式 - val options = CustomMapStyleOptions() - .setEnable(true) - .setStyleData( - BusPassengerMapAssetStyleUtil.getAssetsStyle( - context, "map_style.data" - ) - ) - .setStyleExtraData( - BusPassengerMapAssetStyleUtil.getAssetsExtraStyle( - context, "map_style_extra.data" - ) - ) - // 设置自定义样式 - mAMap.setCustomMapStyle(options) - mAMapNaviView.map.setPointToCenter( - mAMapNaviView.width / 2, - mAMapNaviView.height / 2 - ) - } - - //设置地图状态的监听接口 - mAMap.setOnCameraChangeListener(this) - } - -// override fun onInterceptTouchEvent(ev: MotionEvent): Boolean { -// return true -// } - - override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { - if (mogoLocation == null) { - return - } - val currentLatLng = LatLng(mogoLocation.latitude, mogoLocation.longitude) - - //更新车辆位置 - mCarMarker.rotateAngle = (360 - mogoLocation.heading).toFloat() - mCarMarker.position = currentLatLng - mCarMarker.setToTop() - try { - //圈定地图显示范围 - val boundsBuilder = LatLngBounds.Builder() - routeArrived.forEach { - boundsBuilder.include(it) - } - routeArriving.forEach { - boundsBuilder.include(it) - } - mLineStationLatLng.forEach { - boundsBuilder.include(it) - } - boundsBuilder.include(currentLatLng) - mAMap.moveCamera( - CameraUpdateFactory.newLatLngBoundsRect( - boundsBuilder.build(), - 100, - 100, - 100, - 100 - ) - ) - } catch (e: Exception) { - e.printStackTrace() - } - } - - override fun drawablePolyline() { - if (routeArrived.isEmpty() && routeArriving.isEmpty()) { - d(SceneConstant.M_TAXI + TAG, "没有点") - return - } - try { - texIndexList.clear() - val allPoints = ArrayList(routeArrived) - for (i in routeArrived.indices) { - if (routeArrived.size > 1 && i < routeArrived.size - 1) { - texIndexList.add(0) - } - } - texIndexList.add(0) - location?.let { - allPoints.add(LatLng(it.latitude, it.longitude)) - } - allPoints.addAll(routeArriving) - for (ignored in routeArrived) { - texIndexList.add(1) - } - mPolyline?.let { - it.points = allPoints - it.options.customTextureIndex = texIndexList - return - } - if(textureList.isEmpty()) { - textureList.add(mArrivedRes) - textureList.add(mUnArrivedRes) - } - //设置线段纹理 - val polylineOptions = PolylineOptions().apply { - addAll(allPoints) - isUseTexture = true - width(15f) - lineCapType(PolylineOptions.LineCapType.LineCapRound) - customTextureList = textureList - customTextureIndex = texIndexList - } - - // 绘制线 - mPolyline = mAMap.addPolyline(polylineOptions) - } catch (e: Exception) { - e.printStackTrace() - } - } - - override fun clearPolyline() { - mPolyline?.remove() - mPolyline = null - } - - override fun setLineMarker() {} - - fun clearCoordinatesLatLng() { - textureList.clear() - texIndexList.clear() - routeArrived.clear() - routeArriving.clear() - mLineStationLatLng.clear() - d(M_BUS_P + TAG, " mCoordinatesLatLng.clear ") - } - - fun onCreateView(savedInstanceState: Bundle?) { - mAMapNaviView.onCreate(savedInstanceState) - } - - fun onResume() { - mAMapNaviView.onResume() - } - - fun onPause() { - mAMapNaviView.onPause() - } - - fun onDestroy() { - mAMapNaviView.onDestroy() - } - - fun setCoordinatesLatLng( - routeArrived: List, - routeArriving: List, - location: MogoLocation? - ) { - this.routeArrived.clear() - this.routeArrived.addAll(routeArrived) - this.routeArriving.clear() - this.routeArriving.addAll(routeArriving) - this.location = location - } - - fun clearLineMarkers() { - for (i in mLineMarkers.indices) { - mLineMarkers[i].isVisible = false - mLineMarkers[i].remove() - } - mLineMarkers.clear() - } - - fun setLinePointMarkerAndDraw(mLineStationsList: List, currentIndex: Int) { - clearLineMarkers() - mLineStationLatLng.clear() - mLineStationLatLng.addAll(mLineStationsList) - if (mLineStationsList.isNotEmpty()) { - // 起点marker, 终点marker, 过站marker, 未过站marker - val size = mLineStationsList.size - val mStartMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_start_point)) - ) - val mEndMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_end_point)) - ) - mStartMarker.position = mLineStationsList[0] - mLineMarkers.add(0, mStartMarker) - for (i in mLineStationsList.indices) { - if (currentIndex <= i && i < size - 1 && i > 0) { //未到达 - val unArrivedMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_unarrived_point)) - ) - unArrivedMarker.position = mLineStationsList[i] - mLineMarkers.add(i, unArrivedMarker) - } else if (i in 1 until currentIndex) { - val arrivedMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrived_point)) - ) - arrivedMarker.position = mLineStationsList[i] - mLineMarkers.add(i, arrivedMarker) - } - } - mEndMarker.position = mLineStationsList[size - 1] - mLineMarkers.add(size - 1, mEndMarker) - } - } - - override fun onCameraChange(cameraPosition: CameraPosition) { - } - - override fun onCameraChangeFinish(cameraPosition: CameraPosition) {} - -} \ No newline at end of file diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java index e576d70bc2..2c4f6750f7 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java @@ -16,21 +16,20 @@ import androidx.recyclerview.widget.RecyclerView; import com.amap.api.maps.model.LatLng; import com.elegant.utils.UiThreadHandler; -import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.hmi.ui.widget.DriverMonitorView; import com.mogo.commons.storage.SharedPrefsMgr; import com.mogo.och.bus.passenger.R; -import com.mogo.och.bus.passenger.adapter.BusPassengerLineStationsAdapter; -import com.mogo.och.bus.passenger.bean.BusPassengerStation; +import com.mogo.och.bus.passenger.ui.adapter.BusPassengerLineStationsAdapter; import com.mogo.och.bus.passenger.constant.BusPassengerConst; import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter; import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager; -import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils; import com.mogo.och.common.module.utils.NumberFormatUtil; import com.mogo.och.common.module.wigets.MarqueeTextView; import com.mogo.och.common.module.wigets.OCHGradientTextView; +import com.mogo.och.data.bean.BusStationBean; +import com.mogo.och.common.module.wigets.mapdirectionview.MapDirectionView; import java.util.ArrayList; import java.util.List; @@ -44,14 +43,14 @@ public class BusPassengerRouteFragment extends public static final String TAG = "BusPassengerRouteFragment"; - private final List mStationsList = new ArrayList<>(); + private final List mStationsList = new ArrayList<>(); private OCHGradientTextView mSpeedTv; private ConstraintLayout mNoLineInfoView; private MarqueeTextView mLineName; private Group mRouteInfoView; private RecyclerView mStationsListRv; - private BusPassengerMapDirectionView mMapDirectionView; + private MapDirectionView mMapDirectionView; private BusPassengerLineStationsAdapter mAdapter; private TextView emptyTv; private AppCompatImageView mAutopilotIv; @@ -129,17 +128,6 @@ public class BusPassengerRouteFragment extends } }); - //测试 - if (DebugConfig.isDebug()){ - mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - BPRouteDataTestUtils.converToRouteData(); - return false; - } - }); - } - mapAndLiveVideoView = findViewById(R.id.mapAndLiveVideoView); initLiveView(); @@ -324,7 +312,7 @@ public class BusPassengerRouteFragment extends * @param currentStationIndex * @param isArrived 是否到站并离开,true 到达当前站 currentStationIndex 未离开, false 正在前往此站 currentStationIndex */ - public void updateStationsInfo(List stations, int currentStationIndex, boolean isArrived) { + public void updateStationsInfo(List stations, int currentStationIndex, boolean isArrived) { updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived); mStationsList.clear(); mStationsList.addAll(stations); @@ -345,7 +333,7 @@ public class BusPassengerRouteFragment extends } } - private void updateWayPointList(List stations,int currentStationIndex) { + private void updateWayPointList(List stations,int currentStationIndex) { List mLineStationsList = new ArrayList<>(); for (int i = 0; i< stations.size(); i++) {//站点集合 LatLng latLng = new LatLng(stations.get(i).getGcjLat(),stations.get(i).getGcjLon());// lat,lon diff --git a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/adapter/BusPassengerLineStationsAdapter.java b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/adapter/BusPassengerLineStationsAdapter.java similarity index 95% rename from OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/adapter/BusPassengerLineStationsAdapter.java rename to OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/adapter/BusPassengerLineStationsAdapter.java index 2e50c6ddc0..cf4298c31a 100644 --- a/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/adapter/BusPassengerLineStationsAdapter.java +++ b/OCH/bus/passenger/src/main/java/jinlv/com/mogo/och/bus/passenger/ui/adapter/BusPassengerLineStationsAdapter.java @@ -1,4 +1,4 @@ -package com.mogo.och.bus.passenger.adapter; +package com.mogo.och.bus.passenger.ui.adapter; import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_ARRIVING; import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_LEAVING; @@ -16,9 +16,9 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.mogo.och.bus.passenger.R; -import com.mogo.och.bus.passenger.bean.BusPassengerStation; import com.mogo.och.common.module.utils.BlinkAnimationUtil; import com.mogo.och.common.module.wigets.MarqueeTextView; +import com.mogo.och.data.bean.BusStationBean; import java.util.List; @@ -29,9 +29,9 @@ import java.util.List; public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter { private Context mContext; - private List mStations; + private List mStations; - public BusPassengerLineStationsAdapter(Context context, List stations){ + public BusPassengerLineStationsAdapter(Context context, List stations){ this.mContext = context; this.mStations = stations; } @@ -46,7 +46,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter list = new ArrayList<>(); - - try { - JSONObject jsonObject = new JSONObject(jsonStr); - JSONArray jsonElements = jsonObject.getJSONArray("models"); - for (int i = 0; i < jsonElements.length(); i++) { - JSONObject s = jsonElements.getJSONObject(i); - MessagePad.Location.Builder builder = MessagePad.Location.newBuilder(); - builder.setLatitude(s.getDouble("latitude_")); - builder.setLongitude(s.getDouble("longitude_")); - list.add(builder.build()); - } - BusPassengerModel.INSTANCE.updateRoutePoints(list); - } catch (JSONException e) { - e.printStackTrace(); - } - } -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2OperationStatusResponse.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2OperationStatusResponse.java deleted file mode 100644 index 315ca0568e..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2OperationStatusResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.bean; - -import com.mogo.eagle.core.data.BaseData; - -/** - * @author congtaowang - * @since 2021/3/22 - * - * 小巴车运营状态返回参数 - */ -public class PM2OperationStatusResponse extends BaseData { - - public Result data; - - public static class Result { - private String sn; //司机屏sn - private String phone; //司机手机号 - public String plateNumber; //车牌号 - public int driverStatus;//0:已收车,1:已出车 - } -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2QueryLineRequest.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2QueryLineRequest.java deleted file mode 100644 index ed7d4835c6..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2QueryLineRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.bean; - -public -/** - * @author congtaowang - * @since 2021/3/22 - * - * 根据车机行驶线路站点信息 - */ -class PM2QueryLineRequest { - - private String sn; - public PM2QueryLineRequest(String sn) { - this.sn = sn; - } -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2RoutesResult.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2RoutesResult.java deleted file mode 100644 index 89e77ee2f1..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2RoutesResult.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.bean; - -import java.util.List; -import java.util.Objects; - -/** - * 网约车小巴路线接口返回接口数据封装 - * - * @author tongchenfei - */ -public class PM2RoutesResult { - private List sites; - private int lineId; - private String name; //线路名称 - private int lineType; //线路类型,0:环形 - private String description; - private int status; - private String runningDur; //运营时间 - private long taskTime; //线路时间班次 - - public List getSites() { - return sites; - } - - public int getLineId() { - return lineId; - } - - public String getName() { - return name; - } - - public int getLineType() { - return lineType; - } - - public String getDescription() { - return description; - } - - public int getStatus() { - return status; - } - - public String getRunningDur() { - return runningDur; - } - - @Override - public String toString() { - return "BusPassengerRoutesResult{" + - "sites=" + sites + - ", lineId=" + lineId + - ", name='" + name + '\'' + - ", lineType=" + lineType + - ", description='" + description + '\'' + - ", status=" + status + - ", runningDur='" + runningDur + '\'' + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - PM2RoutesResult that = (PM2RoutesResult) o; - return lineId == that.lineId - && lineType == that.lineType - && status == that.status - && sites.equals(that.sites) - && name.equals(that.name) - && runningDur.equals(that.runningDur); - } - - @Override - public int hashCode() { - return Objects.hash(sites, lineId, name, lineType, description, status, runningDur); - } -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2Station.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2Station.java deleted file mode 100644 index 78881be174..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/bean/PM2Station.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.bean; - -import java.util.Objects; - -/** - * 单个网约车小巴车站信息 - * - * @author wangmingjun - */ -public class PM2Station { - - private String name; - private String description; - private String cityCode; - private double lon; //高精坐标 - private double lat; //高精坐标 - private double gcjLon; //高德坐标 - private double gcjLat; //高德坐标 - private int businessType; //站点类型,9:taxi,10:bus - private int status; - private int siteId; - private int seq; - private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站 - private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠 - private boolean leaving; - - public void setName(String name) { - this.name = name; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setCityCode(String cityCode) { - this.cityCode = cityCode; - } - - public void setLon(double lon) { - this.lon = lon; - } - - public void setLat(double lat) { - this.lat = lat; - } - - public void setBusinessType(int businessType) { - this.businessType = businessType; - } - - public void setStatus(int status) { - this.status = status; - } - - public void setSiteId(int siteId) { - this.siteId = siteId; - } - - public void setSeq(int seq) { - this.seq = seq; - } - - public void setDrivingStatus(int drivingStatus) { - this.drivingStatus = drivingStatus; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getCityCode() { - return cityCode; - } - - public double getGcjLon() { - return gcjLon; - } - - public double getGcjLat() { - return gcjLat; - } - - public int getBusinessType() { - return businessType; - } - - public int getStatus() { - return status; - } - - public int getSiteId() { - return siteId; - } - - public int getSeq() { - return seq; - } - - public int getDrivingStatus() { - return drivingStatus; - } - - public double getLon() { - return lon; - } - - public double getLat() { - return lat; - } - - public void setIfStop(int ifStop) { - this.ifStop = ifStop; - } - - public int getIfStop() { - return ifStop; - } - - public void setLeaving(boolean leaving) { - this.leaving = leaving; - } - - public boolean isLeaving() { - return leaving; - } - - @Override - public String toString() { - return "OchBusStation{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", cityCode='" + cityCode + '\'' + - ", lon=" + lon + - ", lat=" + lat + - ", businessType=" + businessType + - ", status=" + status + - ", siteId=" + siteId + - ", seq=" + seq + - ", drivingStatus=" + drivingStatus + - ", ifStop=" + ifStop + - ", leaving=" + leaving + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - PM2Station that = (PM2Station) o; - return Double.compare(that.lon, lon) == 0 - && Double.compare(that.lat, lat) == 0 - && Double.compare(that.gcjLon, gcjLon) == 0 - && Double.compare(that.gcjLat, gcjLat) == 0 - && businessType == that.businessType - && status == that.status - && siteId == that.siteId - && seq == that.seq - && drivingStatus == that.drivingStatus - && ifStop == that.ifStop - && leaving == that.leaving - && Objects.equals(name, that.name) - && Objects.equals(cityCode, that.cityCode); - } - - @Override - public int hashCode() { - return Objects.hash(name, description, cityCode, lon, lat, gcjLon, gcjLat, businessType, status, siteId, seq, drivingStatus, ifStop, leaving); - } -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2DrivingModel.kt b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2DrivingModel.kt index 3eff2a3f93..f055443186 100644 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2DrivingModel.kt +++ b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2DrivingModel.kt @@ -16,40 +16,36 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener -import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.sendMsgToServer import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d import com.mogo.eagle.core.utilcode.mogo.logger.Logger -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant -import com.mogo.eagle.core.utilcode.util.CoordinateUtils +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.NetworkUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.bus.passenger.R +import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse import com.mogo.och.bus.passenger.constant.BusPassengerConst import com.mogo.och.bus.passenger.passenger.callback.AutoPilotStatusCallback import com.mogo.och.bus.passenger.passenger.callback.DrivingInfoCallback -import com.mogo.och.bus.passenger.passenger.model.PM2ServiceManager.driverAppSn -import com.mogo.och.bus.passenger.passenger.network.PM2ModelLoopManager import com.mogo.och.common.module.bean.dpmsg.* import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.pushAppOperationalMsgBox import com.mogo.och.common.module.biz.constant.OchCommonConst import com.mogo.och.common.module.biz.network.OchCommonServiceCallback -import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil import com.mogo.och.common.module.utils.DateTimeUtil -import com.mogo.och.common.module.utils.RxUtils import com.mogo.och.data.bean.BusRoutesResult import com.mogo.och.data.bean.BusStationBean import com.mogo.och.data.bean.BusTransferData -import io.reactivex.disposables.Disposable -import mogo.telematics.pad.MessagePad -import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse -import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse +import com.mogo.och.bus.passenger.bean.PM2RoutesResponse +import com.mogo.och.bus.passenger.network.BusPassengerServiceManager +import com.mogo.och.common.module.manager.distancemamager.IDistanceListener +import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager +import com.mogo.och.common.module.manager.loopmanager.BizLoopManager +import com.mogo.och.common.module.manager.loopmanager.LoopInfo import kotlin.math.abs /** @@ -64,23 +60,14 @@ class PM2DrivingModel private constructor() { private var mRoutePoints = mutableListOf() private var routesResult: BusRoutesResult? = null - private var mCurrentAutoStatus = -1 - var mStations = mutableListOf() private var mNextStationIndex = 0 // A-B要到达站的index private var isGoingToNextStation = false //是否前往下一站过程中 - private var mTwoStationsRouts = mutableListOf() - private var mPreRouteIndex = 0 - private var mWipePreIndex = 0 - private var mDrivingInfoCallback: DrivingInfoCallback? = null //行程信息 private var mAutoStatusCallback: AutoPilotStatusCallback? = null //自动驾驶状态 - private var operationStatus: PM2OperationStatusResponse.Result? = null - - @Volatile - private var globalPathTruncation: Disposable? = null + private var operationStatus: BusPassengerOperationStatusResponse.Result? = null private val handler = Handler(Handler.Callback { msg -> if (msg.what == MSG_QUERY_BUS_P_STATION) { @@ -92,18 +79,22 @@ class PM2DrivingModel private constructor() { companion object { val TAG = PM2DrivingModel::class.java.simpleName + val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE" const val MSG_QUERY_BUS_P_STATION = 1001 val INSTANCE: PM2DrivingModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { PM2DrivingModel() } } - fun init(context : Context){ + fun init(context: Context) { mContext = context initListener() queryDriverByLocalDriver() queryDriverOperationStatus() - startOrStopOrderLoop(true) + BizLoopManager.setLoopFunction( + TAG_LOOP_QUERY_BIND_LINE, + LoopInfo(2, ::queryDriverSiteByCoordinate) + ) } private fun queryDriverByLocalDriver() { @@ -117,17 +108,16 @@ class PM2DrivingModel private constructor() { CallerAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener) // 定位监听 - CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10,mMapLocationListener) + CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10, mMapLocationListener) //司乘屏通信监听 - CallerTelematicListenerManager.addListener(TAG,mReceivedMsgListener) - - //自动驾驶轨迹监听 - CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener) + CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener) //网络监听 - IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener) + IntentManager.getInstance() + .registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener) + TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener) } private fun sendMsgToServer(msg: String) { @@ -137,7 +127,7 @@ class PM2DrivingModel private constructor() { ) } - fun releaseListener(){ + fun releaseListener() { //自动驾驶状态监听 CallerAutoPilotStatusListenerManager.removeListener(TAG) @@ -146,64 +136,67 @@ class PM2DrivingModel private constructor() { CallerTelematicListenerManager.removeListener(TAG) - //自动驾驶轨迹监听 - CallerPlanningRottingListenerManager.removeListener(TAG) + TrajectoryAndDistanceManager.removeListener(TAG) + + BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE) + + cleanStation("release") } - fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){ + fun setDrivingInfoCallback(drivingInfoCallback: DrivingInfoCallback?) { mDrivingInfoCallback = drivingInfoCallback } - fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?){ + fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?) { mAutoStatusCallback = autoPilotStatusCallback } private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ -> - if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) { - if (NetworkUtils.isConnected(mContext)) { - queryDriverOperationStatus() - } + if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) { + if (NetworkUtils.isConnected(mContext)) { + queryDriverOperationStatus() } } + } private val mReceivedMsgListener: IReceivedMsgListener = - object : IReceivedMsgListener{ + object : IReceivedMsgListener { @RequiresApi(Build.VERSION_CODES.O) override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息 - if (OchCommonConst.BUSINESS_STRING == type){ + if (OchCommonConst.BUSINESS_STRING == type) { val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java) Logger.d( - SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg) + M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg) ) if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) { val msg = GsonUtils.fromJson(String(byteArray), AppConnectMsg::class.java) - if (msg != null && msg.isPlay){ //播报 + if (msg != null && msg.isPlay) { //播报 speakTTS(msg.msg) } if (msg != null && msg.isViewShow) { //消息盒子显示内容 - pushAppOperationalMsgBox( - DateTimeUtil.getCurrentTimeStamp(),msg.msg) + pushAppOperationalMsgBox( + DateTimeUtil.getCurrentTimeStamp(), msg.msg + ) } - }else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) { + } else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) { val msg = GsonUtils.fromJson(String(byteArray), TaskDetailsMsg::class.java) - Logger.d( - SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg) - ) + Logger.d(M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg)) if (msg == null || msg.msg?.isEmpty() == true) { updateLocalOrder() return } val result = GsonUtils.fromJson(msg.msg, BusTransferData::class.java) mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1) - if (result != null && result.routesResult == null){ + if (result != null && result.routesResult == null) { updateLocalOrder() } if (routesResult == null || - (result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)) { + (result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion) + ) { routesResult = result.routesResult updatePassengerRouteInfo(routesResult!!) } @@ -216,34 +209,51 @@ class PM2DrivingModel private constructor() { @RequiresApi(Build.VERSION_CODES.O) private fun speakTTS(msg: String) { - var mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager - var mAudioAttributes = AudioAttributes.Builder() - .setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途 - .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型 - .build() - var mAudioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型 - .setAudioAttributes(mAudioAttributes) //设置声音属性 - .setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取 + val mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager + val mAudioAttributes = AudioAttributes.Builder() + .setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途 + .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型 .build() + val mAudioFocusRequest = + AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型 + .setAudioAttributes(mAudioAttributes) //设置声音属性 + .setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取 + .build() mAudioManager.requestAudioFocus(mAudioFocusRequest) //抢占焦点 - AIAssist.getInstance(mContext).speakTTSVoiceWithLevel(msg,AIAssist.LEVEL0,object : IMogoVoiceCmdCallBack{ - override fun onSpeakEnd(speakText: String?) { - mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest) - } + AIAssist.getInstance(mContext) + .speakTTSVoiceWithLevel(msg, AIAssist.LEVEL0, object : IMogoVoiceCmdCallBack { + override fun onSpeakEnd(speakText: String?) { + mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest) + } - override fun onSpeakError(speakText: String?, errorMsg: String?) { - mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest) - } + override fun onSpeakError(speakText: String?, errorMsg: String?) { + mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest) + } - override fun onSpeakSelectTimeOut(speakText: String?) { - mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest) + override fun onSpeakSelectTimeOut(speakText: String?) { + mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest) + } + }) + } + + private val trajectoryListener: IDistanceListener = object : IDistanceListener { + override fun distanceCallback(distance: Float) { + val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒 + d(M_BUS_P + TAG, "轨迹排查==lastSumLength = $distance") + if (routesResult != null) { + for (site in routesResult!!.sites) { + if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) { + return + } + } } - }) + mDrivingInfoCallback?.updateRemainMT(distance.toLong(), lastTime.toLong()) + } } private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener = - object : IMoGoChassisLocationGCJ02Listener{ + object : IMoGoChassisLocationGCJ02Listener { override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { if (null == mogoLocation) return mLocation = mogoLocation @@ -251,45 +261,6 @@ class PM2DrivingModel private constructor() { } } - private val moGoAutopilotPlanningListener = object : IMoGoPlanningRottingListener{ - - @Synchronized - override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { - d(SceneConstant.M_BUS_P + TAG, "och-rotting==globalPathResp = " + GsonUtils.toJson(globalPathResp)) - globalPathResp?.let { - d(SceneConstant.M_BUS_P + TAG, "och-rotting==wayPointsSize = " + it.wayPointsList.size) - - if (globalPathTruncation != null && !globalPathTruncation!!.isDisposed) { - d(SceneConstant.M_BUS_P + TAG, "1s内不可以接受轨迹") - return@let - } - - globalPathTruncation = RxUtils.createSubscribe(1_000) { - d(SceneConstant.M_BUS_P + TAG, "可以接受轨迹") - } - d(SceneConstant.M_BUS_P + TAG, "接受轨迹中") - it.wayPointsList?.let {list-> - updateRoutePoints(list) - } - } - } - - } - - @Synchronized - fun updateRoutePoints(routePoints: List) { - mRoutePoints.clear() - val latLngModels = CoordinateCalculateRouteUtil - .coordinateConverterWgsToGcjLocations(mContext, routePoints) - d(SceneConstant.M_BUS_P + TAG, "och-rotting==latLngModels = " + latLngModels.size) - mRoutePoints.addAll(latLngModels) - - if (isGoingToNextStation){ - mTwoStationsRouts.clear() - startRemainRouteInfo() - } - } - private fun updateSpeed(mogoLocation: MogoLocation) { // km/h val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt() @@ -302,17 +273,18 @@ class PM2DrivingModel private constructor() { override fun onAutopilotStatusResponse(state: Int) { super.onAutopilotStatusResponse(state) - d(SceneConstant.M_BUS_P+ TAG, "onAutopilotStatusResponse ===== $state") - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){ + d(M_BUS_P + TAG, "onAutopilotStatusResponse ===== $state") + if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) { //美化模式下且行程中 if (FunctionBuildConfig.isDemoMode && - mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1 - && isGoingToNextStation){ + mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1 + && isGoingToNextStation + ) { mAutoStatusCallback?.updateAutoStatus(true) - }else{//非美化模式下 + } else {//非美化模式下 mAutoStatusCallback?.updateAutoStatus(false) } - }else{//自驾状态 2 + } else {//自驾状态 2 mAutoStatusCallback?.updateAutoStatus(true) } } @@ -328,22 +300,21 @@ class PM2DrivingModel private constructor() { private fun queryDriverOperationStatus() { mContext?.let { - PM2ServiceManager.queryDriverOperationStatus( + BusPassengerServiceManager.queryDriverOperationStatus( it, - object : OchCommonServiceCallback { - override fun onSuccess(data: PM2OperationStatusResponse?) { + object : OchCommonServiceCallback { + override fun onSuccess(data: BusPassengerOperationStatusResponse?) { if (data?.data == null) return if (data.data.driverStatus != operationStatus?.driverStatus || data.data.plateNumber != operationStatus?.plateNumber ) { d( - SceneConstant.M_BUS_P + TAG, + M_BUS_P + TAG, "queryDriverOperationStatus ===== 车牌或者登陆状态有变更" ) mDrivingInfoCallback?.changeOperationStatus(data.data.driverStatus == 1) } - operationStatus = data.data as PM2OperationStatusResponse.Result -// mDrivingInfoCallback?.updatePlateNumber(data.data.plateNumber) + operationStatus = data.data as BusPassengerOperationStatusResponse.Result } override fun onError() { @@ -352,7 +323,6 @@ class PM2DrivingModel private constructor() { } else { ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip)) } -// queryDriverOperationDelay() queryDriverByLocalDriver() } @@ -364,9 +334,9 @@ class PM2DrivingModel private constructor() { } } - fun queryDriverSiteByCoordinate(){ + private fun queryDriverSiteByCoordinate() { mContext?.let { - PM2ServiceManager.queryDriverSiteByCoordinate(it, + BusPassengerServiceManager.queryDriverSiteByCoordinate(it, object : OchCommonServiceCallback { override fun onSuccess(data: PM2RoutesResponse?) { @@ -374,19 +344,13 @@ class PM2DrivingModel private constructor() { if (routesResult != null) { routesResult = null updateLocalOrder() - d( - SceneConstant.M_BUS_P + TAG, - "queryDriverSiteByCoordinate= result is null" - ) + d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= result is null") return } return } if (data.result != null && data.result.equals(routesResult)) { - d( - SceneConstant.M_BUS_P + TAG, - "queryDriverSiteByCoordinate= not update" - ) + d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= not update") return } @@ -403,26 +367,22 @@ class PM2DrivingModel private constructor() { } override fun onError() { - d( - SceneConstant.M_BUS_P + TAG, - "queryDriverSiteByCoordinate = onError =" - + ", sn = " + driverAppSn - ) + d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = onError = sn = " + BusPassengerServiceManager.driverAppSn) queryDriverByLocalDriver() } override fun onFail(code: Int, msg: String?) { - d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg) + d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg) if (code == 1003) { queryDriverOperationDelay() + cleanStation("queryDriverSiteByCoordinate 1003") } - if (driverAppSn.isEmpty()) { + if (BusPassengerServiceManager.driverAppSn.isEmpty()) { return } if (code == 1003) { routesResult = null isGoingToNextStation = false - startOrStopCalculateRouteInfo(false) return } } @@ -431,208 +391,91 @@ class PM2DrivingModel private constructor() { } } - private fun updateLocalOrder(){ + private fun updateLocalOrder() { mRoutePoints.clear() routesResult = null mNextStationIndex = 0 + cleanStation("queryDriverSiteByCoordinate") isGoingToNextStation = false - startOrStopCalculateRouteInfo(false) mDrivingInfoCallback?.showNoTaskView(true) } - private fun updatePassengerRouteInfo(result: BusRoutesResult) { + private fun updatePassengerRouteInfo(result: BusRoutesResult?) { if (result == null) { updateLocalOrder() return } - if (routesResult != null && routesResult!!.lineId != result.lineId){ - d(SceneConstant.M_BUS_P+ TAG, "lineId change= clearCustomPolyline") + if (routesResult != null && routesResult!!.lineId != result.lineId) { + d(M_BUS_P + TAG, "lineId change= clearCustomPolyline") mDrivingInfoCallback?.clearCustomPolyline() } - d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= update") + d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= update") routesResult = result mDrivingInfoCallback?.updateLine(result.name, result.runningDur) - if (result.sites != null) { - mDrivingInfoCallback?.showNoTaskView(false) - val stations: List = result.sites - mStations.clear() - mStations.addAll(stations) - mDrivingInfoCallback?.updateLineStations(mStations) - for (i in stations.indices) { - val station: BusStationBean = stations[i] - if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED - && station.isLeaving && i + 1 < stations.size) { - mDrivingInfoCallback?.updateStationsInfo(stations as MutableList, i + 1, false) - d(SceneConstant.M_BUS_P+ TAG,"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i") -// if (mNextStationIndex != i + 1) { - d(SceneConstant.M_BUS_P+ TAG,"och-rotting--start ") - mTwoStationsRouts.clear() - startRemainRouteInfo() -// } - isGoingToNextStation = true - mNextStationIndex = i + 1 - return - } else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { - d(SceneConstant.M_BUS_P+ TAG,"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i") - d(SceneConstant.M_BUS_P+ TAG,"och-rotting--arrived ") - mPreRouteIndex = 0 - isGoingToNextStation = false - startOrStopCalculateRouteInfo(false) - mDrivingInfoCallback?.updateStationsInfo(stations as MutableList, i, true) - return - }else{ -// d(SceneConstant.M_BUS_P+TAG,"och-rotting--BusStationBean = " + GsonUtils.toJson(station)) - } - } - } - - } - - fun loopRouteAndWipe(){ - if (mRoutePoints != null && mRoutePoints.size > 0 && mLocation != null) { - val haveArrivedIndex = CoordinateCalculateRouteUtil - .getArrivedPointIndexNew( - mWipePreIndex, - mRoutePoints, - mLocation!! - ) - mWipePreIndex = haveArrivedIndex - d(SceneConstant.M_BUS_P + TAG, - "thread = " + Thread.currentThread().name + " haveArrivedIndex== " + haveArrivedIndex - ) -// if (mAutopilotPlanningCallback != null) { -// val routePoints = CoordinateCalculateRouteUtil -// .coordinateConverterLocationToLatLng(mContext, mRoutePoints) -// mAutopilotPlanningCallback.routeResult(routePoints, haveArrivedIndex) -// } - } - } - - private fun startRemainRouteInfo() { - //开启实时计算剩余距离,剩余时间,预计时间 - startOrStopCalculateRouteInfo(true) - } - - fun dynamicCalculateRouteInfo(){ - //计算当前位置和下一站的剩余点集合 - //计算剩余点总里程和时间 - d(SceneConstant.M_BUS_P + TAG, "och-rotting==mTwoStationsRouts.size() = " + mTwoStationsRouts.size) - //计算当前位置和下一站的剩余点集合 - //计算剩余点总里程和时间 - if (mTwoStationsRouts.size == 0) { - calculateTwoStationsRoute() - } - - if (mTwoStationsRouts.size > 0 && mLocation != null) { - val lastPointsMap = CoordinateCalculateRouteUtil - .getRemainPointListByCompareNew(mPreRouteIndex, mTwoStationsRouts, mLocation!!) - for (index in lastPointsMap.keys) { - mPreRouteIndex = index - break - } - for (lastPoints in lastPointsMap.values) { - d(SceneConstant.M_BUS_P + TAG, "och-rotting==lastPoints.size() = " + lastPoints.size) - var lastSumLength = 0f - lastSumLength = if (lastPoints.size == 1) { //只是最后一个点,计算当前位置和最后一个点的距离 - if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex >= 0) { - val stationNext: BusStationBean = mStations[mNextStationIndex] - CoordinateUtils.calculateLineDistance( - stationNext.gcjLon, stationNext.gcjLat, - mLocation!!.longitude, mLocation!!.latitude - ) - } else { - CoordinateUtils.calculateLineDistance( - lastPoints[0].longitude, lastPoints[0].latitude, - mLocation!!.longitude, mLocation!!.latitude - ) + if (result.sites != null) { + mDrivingInfoCallback?.showNoTaskView(false) + val stations: List = result.sites + mStations.clear() + mStations.addAll(stations) + mDrivingInfoCallback?.updateLineStations(mStations) + for (i in stations.indices) { + val station: BusStationBean = stations[i] + if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED + && station.isLeaving && i + 1 < stations.size + ) { + mDrivingInfoCallback?.updateStationsInfo( + stations as MutableList, + i + 1, + false + ) + d(M_BUS_P + TAG, "och-rotting--mNextStationIndex = $mNextStationIndex , i = $i") + d(M_BUS_P + TAG, "och-rotting--start ") + isGoingToNextStation = true + mNextStationIndex = i + 1 + val startStation = mStations[i] + val endStation = mStations[i + 1] + setTrajectoryStation(startStation, endStation, result.lineId) + return + } else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { + d(M_BUS_P + TAG, "och-rotting--mNextStationIndex = $mNextStationIndex , i = $i") + d(M_BUS_P + TAG, "och-rotting--arrived ") + if (i == stations.size - 1) { + cleanStation("updatePassengerRouteInfo最后一个站点") } + isGoingToNextStation = false + mDrivingInfoCallback?.updateStationsInfo( + stations as MutableList, + i, + true + ) + return } else { - CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints) - } - val lastTime = lastSumLength / BusPassengerConst.SHUTTLE_AVERAGE_SPEED * 3.6 //秒 - d(SceneConstant.M_BUS_P + TAG, "och-rotting==lastSumLength = $lastSumLength") - mDrivingInfoCallback?.updateRemainMT( - lastSumLength.toLong(), - lastTime.toLong() - ) - } - } - } - - private fun calculateTwoStationsRoute() { - //找出前往站对应的轨迹点,拿出两站点的集合 - d(SceneConstant.M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size) - if (mRoutePoints.size > 0) { - if (mStations.size > 1) { //两个站点及以上要计算两个站点间的轨迹路线 - if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex - 1 >= 0) { - mTwoStationsRouts.clear() - val stationNext: BusStationBean = mStations[mNextStationIndex] - val stationCur: BusStationBean = mStations[mNextStationIndex - 1] - //当前站在轨迹中对应的点 - val currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew( - 0, mRoutePoints, stationCur.gcjLon, stationCur.gcjLat - ) - //要前往的站在轨迹中对应的点 - val nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew( - currentRouteIndex, - mRoutePoints, - stationNext.gcjLon, - stationNext.gcjLat - ) - - d(SceneConstant.M_BUS_P + TAG, "och-rotting==currentRouteIndex = " + currentRouteIndex - + ", nextRouteIndex = " + nextRouteIndex) - - if (currentRouteIndex < nextRouteIndex) { //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示 - mTwoStationsRouts.addAll( - mRoutePoints.subList( - currentRouteIndex, - nextRouteIndex + 1 - ) - ) - } } } } + } - /** - * 开始轮询计算剩余里程和时间 - * @param isStart - */ - fun startOrStopCalculateRouteInfo(isStart: Boolean) { - d(SceneConstant.M_BUS_P+ TAG, "startOrStopCalculateRouteInfo() $isStart") - if (isStart) { - PM2ModelLoopManager.startCalculateRouteInfoLoop() - } else { - mTwoStationsRouts.clear() - PM2ModelLoopManager.stopCalculateRouteInfLoop() - } + private fun setTrajectoryStation( + startStationInfo: BusStationBean, + endStationInfo: BusStationBean, + lineId: Int + ) { + val startStation = MogoLocation() + startStation.longitude = startStationInfo.gcjLon + startStation.latitude = startStationInfo.gcjLat + val endStation = MogoLocation() + endStation.longitude = endStationInfo.gcjLon + endStation.latitude = endStationInfo.gcjLat + TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong()) } - /** - * 实时轨迹擦除 - * @param isStart - */ - private fun startOrStopRouteAndWipe(isStart: Boolean) { - if (isStart) { - PM2ModelLoopManager.startOrStopRouteAndWipe() - } else { - mWipePreIndex = 0 - PM2ModelLoopManager.stopOrStopRouteAndWipe() - } - } - - private fun startOrStopOrderLoop(start: Boolean) { - d(SceneConstant.M_BUS_P + TAG, "startOrStopOrderLoop() $start") - if (start) { - PM2ModelLoopManager.startQueryDriverLineLoop() - } else { - PM2ModelLoopManager.stopQueryDriverLineLoop() - } + private fun cleanStation(type: String) { + d(M_BUS_P + TAG, "清理站点:$type") + TrajectoryAndDistanceManager.setStationPoint(null, null, -1L) } } \ No newline at end of file diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2ServiceManager.kt b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2ServiceManager.kt deleted file mode 100644 index 1288b4a06e..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/model/PM2ServiceManager.kt +++ /dev/null @@ -1,108 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.model - -import android.content.Context -import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.network.MoGoRetrofitFactory -import com.mogo.commons.storage.SharedPrefsMgr -import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest -import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse -import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse -import com.mogo.och.bus.passenger.passenger.network.PassengerSAASServiceApi -import com.mogo.och.bus.passenger.passenger.network.PassengerServiceApi -import com.mogo.och.common.module.biz.constant.OchCommonConst -import com.mogo.och.common.module.biz.network.OchCommonServiceCallback -import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl -import com.mogo.och.common.module.biz.network.interceptor.transformTry - -/** - * Created on 2022/3/31 - */ -object PM2ServiceManager { - - private var mBusPassengerSaasServiceApi = - MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerSAASServiceApi::class.java) - - private var mBusPassengerServiceApi = - MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerServiceApi::class.java) - - - private var driverSnCache = "" - /** - * 获取Bus司机端的sn - * @return - */ - public val driverAppSn: String - get(){ - val serverToken = getServerToken() - if (serverToken != driverSnCache && serverToken.isNotEmpty()) { - driverSnCache = serverToken - } - return driverSnCache - } - - /** - * 查询绑定行驶的小巴车路线 - * @param context - * @param callback - */ - @JvmStatic - fun queryDriverSiteByCoordinate( - context: Context, callback: OchCommonServiceCallback? - ) { - if (DebugConfig.getProjectFlavor().contains("saas")){ - mBusPassengerSaasServiceApi.queryDriverSiteByCoordinate( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - SharedPrefsMgr.getInstance().token, - driverAppSn - ).transformTry() - .subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate")) - }else{ - mBusPassengerServiceApi.queryDriverSiteByCoordinate( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - SharedPrefsMgr.getInstance().token, - BusPassengerQueryLineRequest( - driverAppSn - ) - ).transformTry() - .subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate")) - } - }//2023-12-07 10:13:32 - - /** - * 查询司机端出车收车状态,以及车牌号 - * @param context - * @param callback - */ - @JvmStatic - fun queryDriverOperationStatus( - context: Context, - callback: OchCommonServiceCallback? - ) { - mBusPassengerServiceApi.queryDriverOperationStatus( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - SharedPrefsMgr.getInstance().token, - driverAppSn - ) - .transformTry() - .subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus=sn =$driverAppSn")) - if (DebugConfig.getProjectFlavor().contains("saas")){ - mBusPassengerSaasServiceApi.queryDriverOperationStatus( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - SharedPrefsMgr.getInstance().token, - driverAppSn - ) - .transformTry() - .subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus")) - }else{ - mBusPassengerServiceApi.queryDriverOperationStatus( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - SharedPrefsMgr.getInstance().token, - driverAppSn - ) - .transformTry() - .subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus")) - } - } -} \ No newline at end of file diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PM2ModelLoopManager.kt b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PM2ModelLoopManager.kt deleted file mode 100644 index adede242a0..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PM2ModelLoopManager.kt +++ /dev/null @@ -1,127 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.network - -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant -import com.mogo.och.bus.passenger.constant.BusPassengerConst -import com.mogo.och.bus.passenger.passenger.model.PM2DrivingModel -import io.reactivex.Observable -import io.reactivex.ObservableOnSubscribe -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.CompositeDisposable -import io.reactivex.disposables.Disposable -import io.reactivex.schedulers.Schedulers -import java.util.concurrent.TimeUnit - -/** - * @author: wangmingjun - * @date: 2023/2/1 - */ -object PM2ModelLoopManager { - - private val TAG: String = PM2ModelLoopManager::class.java.getSimpleName() - - private var mQueryLineDisposable: Disposable? = null //心跳轮询 - private var mRouteWipeDisposable: CompositeDisposable? = null //估计擦除 - private var mCalculateRouteDisposable: CompositeDisposable? = null //每隔2s计算一次剩余里程和时间 - - - fun startOrStopRouteAndWipe() { - i(SceneConstant.M_BUS_P + TAG, "startOrStopRouteWipe()") - if (mRouteWipeDisposable != null) return - if (mRouteWipeDisposable == null) { - mRouteWipeDisposable = CompositeDisposable() - } - val disposable = startLoopRouteAndWipe() - .doOnSubscribe { } - .doOnError { } - .delay( - BusPassengerConst.LOOP_LINE_1S, - TimeUnit.MILLISECONDS, - true - ) // 设置delayError为true,表示出现错误的时候也需要延迟5s进行通知,达到无论是请求正常还是请求失败,都是5s后重新订阅,即重新请求。 - .subscribeOn(Schedulers.io()) - .repeat() // repeat保证请求成功后能够重新订阅。 - .retry() // retry保证请求失败后能重新订阅 - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { } - mRouteWipeDisposable!!.add(disposable) - } - - fun stopOrStopRouteAndWipe() { - if (mRouteWipeDisposable != null) { - mRouteWipeDisposable!!.dispose() - mRouteWipeDisposable = null - } - } - - fun startQueryDriverLineLoop() { - if (mQueryLineDisposable != null && !mQueryLineDisposable!!.isDisposed) { - return - } - i(SceneConstant.M_BUS_P + TAG, "startQueryDriverLineLoop()") - mQueryLineDisposable = Observable.interval( - BusPassengerConst.LOOP_DELAY, - BusPassengerConst.LOOP_LINE_2S, TimeUnit.MILLISECONDS - ) - .map { aLong: Long -> aLong + 1 } - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { aLong: Long? -> - PM2DrivingModel.INSTANCE.queryDriverSiteByCoordinate() - } - } - - fun stopQueryDriverLineLoop() { - if (mQueryLineDisposable != null) { - i(SceneConstant.M_BUS_P + TAG, "stopQueryDriverLineLoop()") - mQueryLineDisposable!!.dispose() - mQueryLineDisposable = null - } - } - - fun startCalculateRouteInfoLoop() { - i(SceneConstant.M_BUS_P + TAG, "startCalculateRouteInfoLoop()") - if (mCalculateRouteDisposable != null) return - if (mCalculateRouteDisposable == null) { - mCalculateRouteDisposable = CompositeDisposable() - } - val disposable = startLoopCalculateRouteInfo() - .doOnSubscribe { } - .doOnError { } - .delay( - BusPassengerConst.LOOP_LINE_2S, - TimeUnit.MILLISECONDS, - true - ) // 设置delayError为true,表示出现错误的时候也需要延迟5s进行通知,达到无论是请求正常还是请求失败,都是5s后重新订阅,即重新请求。 - .subscribeOn(Schedulers.io()) - .repeat() // repeat保证请求成功后能够重新订阅。 - .retry() // retry保证请求失败后能重新订阅 - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { } - mCalculateRouteDisposable!!.add(disposable) - } - - fun stopCalculateRouteInfLoop() { - if (mCalculateRouteDisposable != null) { - i(SceneConstant.M_BUS_P + TAG, "stopCalculateRouteInfLoop()") - mCalculateRouteDisposable!!.dispose() - mCalculateRouteDisposable = null - } - } - - private fun startLoopRouteAndWipe(): Observable { - return Observable.create(ObservableOnSubscribe { emitter -> - if (emitter.isDisposed) return@ObservableOnSubscribe - PM2DrivingModel.INSTANCE.loopRouteAndWipe() - emitter.onComplete() - }) - } - - private fun startLoopCalculateRouteInfo(): Observable { - return Observable.create(ObservableOnSubscribe { emitter -> - if (emitter.isDisposed) return@ObservableOnSubscribe - PM2DrivingModel.INSTANCE.dynamicCalculateRouteInfo() - emitter.onComplete() - }) - } -} \ No newline at end of file diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PM2ServiceApi.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PM2ServiceApi.java deleted file mode 100644 index 1b2b778829..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PM2ServiceApi.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.network; - -import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse; -import com.mogo.och.bus.passenger.passenger.bean.PM2QueryLineRequest; -import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse; - -import io.reactivex.Observable; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Headers; -import retrofit2.http.POST; -import retrofit2.http.Query; - -/** - * Created on 2022/3/31 - * - * Bus乘客端接口定义 - */ -public interface PM2ServiceApi { - /** - * 查询bus司机端绑定路线 - * @return 接口返回数据 - */ - @Headers( {"Content-Type:application/json;charset=UTF-8"} ) - @POST( "/och-shuttle-cabin/api/business/v1/passenger/lineDataWithDriver/query" ) - Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body PM2QueryLineRequest request); - - /** - * 查询司机端的登陆状态 - * @param sn - * @return - */ - @Headers({"Content-type:application/json;charset=UTF-8"}) -// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query") - @GET("/och-shuttle-cabin/api/business/v1/passenger/loginStatus") - Observable queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); - - -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PassengerSAASServiceApi.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PassengerSAASServiceApi.java deleted file mode 100644 index b19cb287f2..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PassengerSAASServiceApi.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.network; - -import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse; -import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse; - -import io.reactivex.Observable; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Headers; -import retrofit2.http.Query; - -/** - * Created on 2022/3/31 - * - * Bus乘客端接口定义 - */ -public interface PassengerSAASServiceApi { - /** - * 查询bus司机端绑定路线 - * @return 接口返回数据 - */ - @Headers( {"Content-Type:application/json;charset=UTF-8"} ) -// @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" ) - @GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" ) - Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); - - /** - * 查询司机端的登陆状态 - * @param sn - * @return - */ - @Headers({"Content-type:application/json;charset=UTF-8"}) -// @GET("/autopilot-car-hailing/operation/v1/driver/bus/passenger/loginStatus") - @GET("/och-bus-cabin/api/business/v1/loginStatus") - Observable queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); - - -} diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PassengerServiceApi.java b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PassengerServiceApi.java deleted file mode 100644 index 836f4fd22f..0000000000 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/network/PassengerServiceApi.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mogo.och.bus.passenger.passenger.network; - -import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest; -import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse; -import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse; - -import io.reactivex.Observable; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Headers; -import retrofit2.http.POST; -import retrofit2.http.Query; - -/** - * Created on 2022/3/31 - * - * Bus乘客端接口定义 - */ -public interface PassengerServiceApi { - /** - * 查询bus司机端绑定路线 - * @return 接口返回数据 - */ - @Headers( {"Content-Type:application/json;charset=UTF-8"} ) - @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" ) - Observable queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request); - - /** - * 查询司机端的登陆状态 - * @param sn - * @return - */ - @Headers({"Content-type:application/json;charset=UTF-8"}) -// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query") - @GET("/autopilot-car-hailing/operation/v1/driver/bus/passenger/loginStatus") - Observable queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); - - -} diff --git a/OCH/bus/passenger/src/main/res/jinlv/layout/bus_p_route_fragment.xml b/OCH/bus/passenger/src/main/res/jinlv/layout/bus_p_route_fragment.xml index a92d7350f4..74027efd21 100644 --- a/OCH/bus/passenger/src/main/res/jinlv/layout/bus_p_route_fragment.xml +++ b/OCH/bus/passenger/src/main/res/jinlv/layout/bus_p_route_fragment.xml @@ -277,7 +277,7 @@ - = ArrayList() + private lateinit var mCarMarker: Marker + // 除了开始站点和结束站点的中间站点 用来设置图标和地图范围圈定 private val mLineStationLatLng: MutableList = ArrayList() //站点坐标数据 var textureList: MutableList = ArrayList() var texIndexList: MutableList = ArrayList() private var mArrivedRes: BitmapDescriptor? = null private var mUnArrivedRes: BitmapDescriptor? = null + private var mStartStationPoint: BitmapDescriptor? = null + private var mEndStationPoint: BitmapDescriptor? = null + + private var mArrivedStationPoint: BitmapDescriptor? = null + private var mUArrivedStationPoint: BitmapDescriptor? = null + + private val routeArrived: MutableList = ArrayList() private val routeArriving: MutableList = ArrayList() private var location: MogoLocation? = null init { try { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapDirectionView) + mapStylePath = typedArray.getString(R.styleable.MapDirectionView_mapStylePath) + mapStyleExtraPath = typedArray.getString(R.styleable.MapDirectionView_mapStyleExtraPath) + carDrawable = typedArray.getResourceId(R.styleable.MapDirectionView_carDrawable, -1) + compassDrawable = typedArray.getResourceId(R.styleable.MapDirectionView_compassDrawable, -1) + startPointDrawable = + typedArray.getResourceId(R.styleable.MapDirectionView_startPointDrawable, -1) + endPointDrawable = + typedArray.getResourceId(R.styleable.MapDirectionView_endPointDrawable, -1) + arrivedDrawable = typedArray.getResourceId(R.styleable.MapDirectionView_arrivedDrawable, -1) + unArrivedDrawable = + typedArray.getResourceId(R.styleable.MapDirectionView_unArrivedDrawable, -1) + resetDrawableMarginRight = typedArray.getResourceId( + R.styleable.MapDirectionView_resetDrawableMarginRight, + AutoSizeUtils.dp2px(context, 40f) + ) + resetDrawableMarginBottom = typedArray.getResourceId( + R.styleable.MapDirectionView_resetDrawableMarginBottom, + AutoSizeUtils.dp2px(context, 40f) + ) + leftPadding = typedArray.getInt(R.styleable.MapDirectionView_leftPadding, 100) + topPadding = typedArray.getInt(R.styleable.MapDirectionView_topPadding, 100) + rightPadding = typedArray.getInt(R.styleable.MapDirectionView_rightPadding, 100) + bottomPadding = typedArray.getInt(R.styleable.MapDirectionView_bottomPadding, 100) + typedArray.recycle() initView(context) } catch (e: Exception) { e.printStackTrace() @@ -96,25 +147,27 @@ class BusPassengerMapDirectionView @JvmOverloads constructor( // 设置 锚点 图标 mCarMarker = mAMap.addMarker( - MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_car)) + MarkerOptions().icon( + BitmapDescriptorFactory.fromResource(if (carDrawable != -1) carDrawable else R.drawable.common_map_car)) .anchor(0.5f, 0.5f) ) - mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_arrow_arrived) - mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_arrow_un_arrive) + mArrivedRes = BitmapDescriptorFactory.fromResource(if (arrivedDrawable != -1) arrivedDrawable else R.drawable.taxi_map_arrow_arrived) + mUnArrivedRes = BitmapDescriptorFactory.fromResource(if (unArrivedDrawable != -1) unArrivedDrawable else R.drawable.taxi_map_arrow_un_arrive) + mStartStationPoint = BitmapDescriptorFactory.fromResource(if (startPointDrawable != -1) startPointDrawable else R.drawable.common_map_start_point) + mEndStationPoint = BitmapDescriptorFactory.fromResource(if (endPointDrawable != -1) endPointDrawable else R.drawable.common_map_end_point) + + mArrivedStationPoint = BitmapDescriptorFactory.fromResource(if (endPointDrawable != -1) endPointDrawable else R.drawable.common_map_arrived_point) + mUArrivedStationPoint = BitmapDescriptorFactory.fromResource(if (endPointDrawable != -1) endPointDrawable else R.drawable.common_map_unarrived_point) // 加载自定义样式 - val customMapStyleOptions = CustomMapStyleOptions() - .setEnable(true) - .setStyleData( - BusPassengerMapAssetStyleUtil.getAssetsStyle( - context, "map_style.data" - ) - ) - .setStyleExtraData( - BusPassengerMapAssetStyleUtil.getAssetsExtraStyle( - context, "map_style_extra.data" - ) - ) + val customMapStyleOptions = CustomMapStyleOptions().setEnable(true) + + if (!mapStylePath.isNullOrEmpty() && !mapStyleExtraPath.isNullOrEmpty()) { + customMapStyleOptions.styleData = + MapAssetStyleUtils.getAssetsStyle(context, mapStylePath) + customMapStyleOptions.styleExtraData = + MapAssetStyleUtils.getAssetsExtraStyle(context, mapStyleExtraPath) + } // 设置自定义样式 mAMap.setCustomMapStyle(customMapStyleOptions) @@ -129,18 +182,13 @@ class BusPassengerMapDirectionView @JvmOverloads constructor( mAMap.setOnMapLoadedListener { d(SceneConstant.M_BUS_P + TAG, "smp---onMapLoaded") // 加载自定义样式 - val options = CustomMapStyleOptions() - .setEnable(true) - .setStyleData( - BusPassengerMapAssetStyleUtil.getAssetsStyle( - context, "map_style.data" - ) - ) - .setStyleExtraData( - BusPassengerMapAssetStyleUtil.getAssetsExtraStyle( - context, "map_style_extra.data" - ) - ) + val options = CustomMapStyleOptions().setEnable(true) + if (!mapStylePath.isNullOrEmpty() && !mapStyleExtraPath.isNullOrEmpty()) { + options.styleData = + MapAssetStyleUtils.getAssetsStyle(context, mapStylePath) + options.styleExtraData = + MapAssetStyleUtils.getAssetsExtraStyle(context, mapStyleExtraPath) + } // 设置自定义样式 mAMap.setCustomMapStyle(options) mAMapNaviView.map.setPointToCenter( @@ -307,6 +355,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor( mLineMarkers.clear() } + // 设置站点 fun setLinePointMarkerAndDraw(mLineStationsList: List, currentIndex: Int) { clearLineMarkers() mLineStationLatLng.clear() @@ -316,27 +365,18 @@ class BusPassengerMapDirectionView @JvmOverloads constructor( val size = mLineStationsList.size val mStartMarker = mAMap.addMarker( MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_start_point)) - ) - val mEndMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_end_point)) + .icon(mStartStationPoint) ) + val mEndMarker = mAMap.addMarker(MarkerOptions().icon(mEndStationPoint)) mStartMarker.position = mLineStationsList[0] mLineMarkers.add(0, mStartMarker) for (i in mLineStationsList.indices) { if (currentIndex <= i && i < size - 1 && i > 0) { //未到达 - val unArrivedMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_unarrived_point)) - ) + val unArrivedMarker = mAMap.addMarker(MarkerOptions().icon(mUArrivedStationPoint)) unArrivedMarker.position = mLineStationsList[i] mLineMarkers.add(i, unArrivedMarker) } else if (i in 1 until currentIndex) { - val arrivedMarker = mAMap.addMarker( - MarkerOptions() - .icon(BitmapDescriptorFactory.fromResource(R.drawable.shuttle_p_jl_map_arrived_point)) - ) + val arrivedMarker = mAMap.addMarker(MarkerOptions().icon(mArrivedStationPoint)) arrivedMarker.position = mLineStationsList[i] mLineMarkers.add(i, arrivedMarker) } diff --git a/OCH/shuttle/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/mapdirectionview/MapDirectionViewModel.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/mapdirectionview/MapDirectionViewModel.kt similarity index 100% rename from OCH/shuttle/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/mapdirectionview/MapDirectionViewModel.kt rename to OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/mapdirectionview/MapDirectionViewModel.kt diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_map_arrived_point.png b/OCH/common/common/src/main/res/drawable-nodpi/common_map_arrived_point.png new file mode 100644 index 0000000000..ac317649b4 Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_map_arrived_point.png differ diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_map_car.png b/OCH/common/common/src/main/res/drawable-nodpi/common_map_car.png new file mode 100644 index 0000000000..702f10f265 Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_map_car.png differ diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_map_end_point.png b/OCH/common/common/src/main/res/drawable-nodpi/common_map_end_point.png new file mode 100644 index 0000000000..39262e5ecb Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_map_end_point.png differ diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_map_start_point.png b/OCH/common/common/src/main/res/drawable-nodpi/common_map_start_point.png new file mode 100644 index 0000000000..b2e4c69ada Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_map_start_point.png differ diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_map_unarrived_point.png b/OCH/common/common/src/main/res/drawable-nodpi/common_map_unarrived_point.png new file mode 100644 index 0000000000..ec6081f5a3 Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_map_unarrived_point.png differ diff --git a/OCH/common/common/src/main/res/layout/shuttle_p_jl_map_view.xml b/OCH/common/common/src/main/res/layout/shuttle_p_jl_map_view.xml new file mode 100644 index 0000000000..d9fadd6ef5 --- /dev/null +++ b/OCH/common/common/src/main/res/layout/shuttle_p_jl_map_view.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/OCH/common/common/src/main/res/values/attrs.xml b/OCH/common/common/src/main/res/values/attrs.xml index a500f7ca79..88181d340e 100644 --- a/OCH/common/common/src/main/res/values/attrs.xml +++ b/OCH/common/common/src/main/res/values/attrs.xml @@ -61,4 +61,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/shuttle/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/BusPassengerRouteFragment.java b/OCH/shuttle/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/BusPassengerRouteFragment.java index c43544112c..f6dd5f98bf 100644 --- a/OCH/shuttle/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/BusPassengerRouteFragment.java +++ b/OCH/shuttle/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/BusPassengerRouteFragment.java @@ -23,7 +23,7 @@ import com.mogo.och.shuttle.passenger.ui.adapter.BusPassengerLineStationsAdapter import com.mogo.och.shuttle.passenger.constant.BusPassengerConst; import com.mogo.och.shuttle.passenger.presenter.BaseBusPassengerPresenter; import com.mogo.och.shuttle.passenger.ui.layoutmanager.CenterLayoutManager; -import com.mogo.och.shuttle.passenger.ui.mapdirectionview.BusPassengerMapDirectionView; +import com.mogo.och.common.module.wigets.mapdirectionview.MapDirectionView; import com.mogo.och.common.module.utils.NumberFormatUtil; import com.mogo.och.common.module.wigets.MarqueeTextView; import com.mogo.och.common.module.wigets.OCHGradientTextView; @@ -48,7 +48,7 @@ public class BusPassengerRouteFragment extends private MarqueeTextView mLineName; private Group mRouteInfoView; private RecyclerView mStationsListRv; - private BusPassengerMapDirectionView mMapDirectionView; + private MapDirectionView mMapDirectionView; private BusPassengerLineStationsAdapter mAdapter; private TextView emptyTv; private AppCompatImageView mAutopilotIv; @@ -157,7 +157,6 @@ public class BusPassengerRouteFragment extends @Override public void run() { mMapDirectionView.clearLineMarkers(); - } }); } diff --git a/OCH/shuttle/passenger/src/main/res/jinlv/layout/shuttle_p_jl_route_fragment.xml b/OCH/shuttle/passenger/src/main/res/jinlv/layout/shuttle_p_jl_route_fragment.xml index 6b44d9a4cb..561c1c73b3 100644 --- a/OCH/shuttle/passenger/src/main/res/jinlv/layout/shuttle_p_jl_route_fragment.xml +++ b/OCH/shuttle/passenger/src/main/res/jinlv/layout/shuttle_p_jl_route_fragment.xml @@ -265,7 +265,7 @@ -