[merge 6.2.6 to master]
@@ -45,11 +45,16 @@ android {
|
||||
|
||||
flavorDimensions "vehicle"
|
||||
productFlavors {
|
||||
|
||||
// 车型:金旅星辰、开沃 小巴业务
|
||||
jinlvvan {
|
||||
dimension "vehicle"
|
||||
buildConfigField 'int', 'NEW_TEST', '0'
|
||||
}
|
||||
// 车型:金旅m2 小巴业务
|
||||
m2 {
|
||||
dimension "vehicle"
|
||||
buildConfigField 'int', 'NEW_TEST', '1'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +73,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
compileOnly rootProject.ext.dependencies.recyclerviewadapterhelper
|
||||
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
implementation project(":OCH:common:common")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* 中止/结束任务请求
|
||||
@@ -10,7 +10,7 @@ public class BusCloseTaskRequest {
|
||||
private String sn;
|
||||
private int taskId;
|
||||
public BusCloseTaskRequest(int taskId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -15,7 +15,7 @@ class BusOperationStatusRequest {
|
||||
private double lat;
|
||||
private double lon;
|
||||
public BusOperationStatusRequest(double lon, double lat) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -12,6 +12,6 @@ public class BusQueryLineStationsRequest {
|
||||
|
||||
private String sn;
|
||||
public BusQueryLineStationsRequest() {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -11,7 +11,7 @@ public class BusResetDrivingLineRequest {
|
||||
public int taskId; //切换到的线路id
|
||||
|
||||
public BusResetDrivingLineRequest(int taskId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ class BusResetLineStatusRequest {
|
||||
|
||||
private String sn;
|
||||
public BusResetLineStatusRequest() {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -16,7 +16,7 @@ public class BusUpdateSiteStatusRequest {
|
||||
public int siteId;//站点id
|
||||
|
||||
public BusUpdateSiteStatusRequest(int taskId,int siteId,int seq) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.seq = seq;
|
||||
this.siteId = siteId;
|
||||
this.taskId = taskId;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,7 +15,7 @@ public class BusWriteOffPassengersQueryRequest {
|
||||
private int siteId;
|
||||
private long verificationTime;
|
||||
public BusWriteOffPassengersQueryRequest(int taskId, int siteId,long prePassengerTime) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
this.siteId = siteId;
|
||||
this.verificationTime = prePassengerTime;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* 查询下车乘客请求参数
|
||||
@@ -13,7 +13,7 @@ public class QueryLeaveAwayPassengersRequest {
|
||||
private int siteId; //站点id
|
||||
|
||||
public QueryLeaveAwayPassengersRequest(int seq, int siteId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.seq = seq;
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ class BusConst {
|
||||
const val EVENT_PARAM_START_NAME = "start_name"
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_LINE_ID = "line_id"
|
||||
const val EVENT_PARAM_MAP_ORIGINAL_DATA = "map_original_data" // 域控原始状态信息
|
||||
const val EVENT_PARAM_AUTOPILOT_STATE = "autopilot_state" //原始的自动驾驶状态
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.bus.util.BDRouteDataTestUtils;
|
||||
import com.mogo.och.bus.view.BizMapView;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
|
||||
@@ -71,7 +72,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
protected RelativeLayout mSettingBtn;
|
||||
protected RelativeLayout mBadcaseBtn;
|
||||
private FrameLayout flStationPanelContainer;
|
||||
private MapBizView mapBizView;
|
||||
private BizMapView mapBizView;
|
||||
private Group groupTestPanel;
|
||||
private TrafficDataView mTrafficDataView;
|
||||
// private BusTrafficLightView mTrafficLightView;
|
||||
|
||||
@@ -16,7 +16,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.temp.EventLogout;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -132,7 +132,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
}else if (eventLogout.getMessgae() == EventLogout.SHOW_QR_TYPE){ //显示二维码
|
||||
CallerLogger.d(M_BUS + TAG,"changeOverview Event qrcode");
|
||||
String qrUrl = String.format(FunctionBuildConfig.urlJson.getBindDriverQRUrl(),
|
||||
MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
SharedPrefsMgr.getInstance().getSn());
|
||||
Bitmap bmQr = QRUtilsKt.createQRCodeWithPicture(
|
||||
BitmapFactory.decodeResource(getResources(), R.drawable.icon_qr_center_logo)
|
||||
,qrUrl, AutoSizeUtils.dp2px(getContext(),340f),
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.och.bus.model;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.bus.R;
|
||||
@@ -121,7 +121,7 @@ public class BusLineModel {
|
||||
OrderServiceManager.switchLine(mContext,taskId, new OchCommonServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
SharedPrefsMgr.getInstance().putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onChangeLineIdSuccess();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.bus.bean.*
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
@@ -36,8 +37,8 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusRoutes(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusRoutes"))
|
||||
@@ -45,7 +46,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.queryBusRoutes(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusQueryLineStationsRequest()
|
||||
)
|
||||
.transformTry()
|
||||
@@ -70,7 +71,7 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.switchLine(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusResetDrivingLineRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -78,7 +79,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.switchLine(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusResetDrivingLineRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -98,7 +99,7 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.abortTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -106,7 +107,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.abortTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -125,7 +126,7 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.endTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -133,7 +134,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.endTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -160,7 +161,7 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.leaveStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -168,7 +169,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.leaveStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -191,7 +192,7 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.arriveSiteStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -199,7 +200,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.arriveSiteStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -223,7 +224,7 @@ object OrderServiceManager {
|
||||
) {
|
||||
M_SERVICE.queryStationLeaveAwayPassengers(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
QueryLeaveAwayPassengersRequest(seq, siteId)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -246,7 +247,7 @@ object OrderServiceManager {
|
||||
) {
|
||||
M_SERVICE.queryWriteOffPassengers(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusWriteOffPassengersQueryRequest(taskId, siteId, prePassengerTime)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -263,16 +264,16 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusOrders(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
|
||||
}else{
|
||||
M_SERVICE.queryBusOrders(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
|
||||
@@ -283,16 +284,16 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusLines(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}else{
|
||||
M_SERVICE.queryBusLines(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
@@ -308,7 +309,7 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusTaskByLineId(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
lineId
|
||||
)
|
||||
.transformTry()
|
||||
@@ -316,7 +317,7 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.queryBusTaskByLineId(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
lineId
|
||||
)
|
||||
.transformTry()
|
||||
@@ -335,9 +336,9 @@ object OrderServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -345,9 +346,9 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -372,9 +373,9 @@ object OrderServiceManager {
|
||||
}else{
|
||||
M_SERVICE.runCarHeartbeat(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lon, lat
|
||||
SharedPrefsMgr.getInstance().sn, lon, lat
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -12,6 +12,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
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
|
||||
@@ -46,14 +47,14 @@ object OchCommonServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mLoginSaasServiceApi.getPhoneCode(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
TaxiLoginSmsReqBean(phone)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getPhoneCode"))
|
||||
}else{
|
||||
mLoginServiceApi.getPhoneCode(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
TaxiLoginSmsReqBean(phone)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getPhoneCode"))
|
||||
@@ -71,18 +72,18 @@ object OchCommonServiceManager {
|
||||
location4Login: TaxiLoginReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<TaxiLoginRespBean>?
|
||||
) {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val sn = SharedPrefsMgr.getInstance().sn
|
||||
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mLoginSaasServiceApi.gotoLoginBycode4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
TaxiLoginReqBean(phone, code, sn, location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "gotoLoginBycode"))
|
||||
}else{
|
||||
mLoginServiceApi.gotoLoginBycode4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
TaxiLoginReqBean(phone, code, sn, location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "gotoLoginBycode"))
|
||||
}
|
||||
@@ -100,14 +101,14 @@ object OchCommonServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mLoginSaasServiceApi.logout4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().sn, location4Login)
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
TaxiLogoutReqBean(SharedPrefsMgr.getInstance().sn, location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "logout"))
|
||||
}else{
|
||||
mLoginServiceApi.logout4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().sn, location4Login)
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
TaxiLogoutReqBean(SharedPrefsMgr.getInstance().sn, location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "logout"))
|
||||
}
|
||||
}
|
||||
@@ -123,7 +124,7 @@ object OchCommonServiceManager {
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<DriverStatusQueryRespBean>?
|
||||
) {
|
||||
if (MoGoAiCloudClientConfig.getInstance().token.isEmpty()) {
|
||||
if (SharedPrefsMgr.getInstance().token.isEmpty()) {
|
||||
callback?.onFail(OchCommonConst.WAIT_TAKEN, "等待令牌中请稍等")
|
||||
MoGoAiCloudClient.getInstance().refreshToken()
|
||||
return
|
||||
@@ -131,15 +132,15 @@ object OchCommonServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mLoginSaasServiceApi.queryDriverServiceStatusAndLoginStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverServiceStatus"))
|
||||
}else{
|
||||
mLoginServiceApi.queryDriverServiceStatusAndLoginStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverServiceStatus"))
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.commons.mvp.MvpActivity
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.bus.presenter.BusLinePresenter
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse
|
||||
@@ -118,7 +118,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
showNoData(true)
|
||||
return
|
||||
}
|
||||
val lastCommitLineid = SharedPrefsMgr.getInstance(this).getInt(LASTCOMMITLINEID, -1)
|
||||
val lastCommitLineid = SharedPrefsMgr.getInstance().getInt(LASTCOMMITLINEID, -1)
|
||||
if (data.data != null && data.data.size > 0) {
|
||||
showNoData(false)
|
||||
mData.clear()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import android.text.TextUtils
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
@@ -42,8 +43,14 @@ object BusAnalyticsManager {
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_CODE] = failCode
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_MSG] = failMsg
|
||||
}
|
||||
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_MAP_ORIGINAL_DATA] =
|
||||
OCHAdasAbilityManager.getInstance().originalData
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_AUTOPILOT_STATE] =
|
||||
CallerAutoPilotStatusListenerManager.getState()
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_RESULT] =
|
||||
CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
|
||||
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
|
||||
clearStartAutopilotParams() //清空参数数据,防止误传
|
||||
}
|
||||
@@ -69,7 +76,7 @@ object BusAnalyticsManager {
|
||||
clearStartAutopilotParams() //清空参数数据,防止误传
|
||||
} else {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_SN] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_SN] = SharedPrefsMgr.getInstance().sn
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
@@ -95,7 +102,7 @@ object BusAnalyticsManager {
|
||||
) {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
val params = HashMap<String, Any>()
|
||||
params[BusConst.EVENT_PARAM_SN] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
params[BusConst.EVENT_PARAM_SN] = SharedPrefsMgr.getInstance().sn
|
||||
params[BusConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
params[BusConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
|
||||
params[BusConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.och.bus.view
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.view.MapBizView
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.och.bus.R
|
||||
|
||||
class BizMapView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private lateinit var mapBizView: MapBizView
|
||||
|
||||
init {
|
||||
if (AppIdentityModeUtils.isM2(FunctionBuildConfig.appIdentityMode)) {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_m2_bizmap_map, this, true)
|
||||
}else if(AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)){
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_jl_bizmap_map, this, true)
|
||||
}else{
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_jl_bizmap_map, this, true)
|
||||
}
|
||||
mapBizView = findViewById(R.id.bizMapView)
|
||||
}
|
||||
|
||||
fun getUI(): IMogoMapUIController? {
|
||||
return mapBizView.getUI()
|
||||
}
|
||||
|
||||
fun onCreate(bundle: Bundle?) {
|
||||
mapBizView.onCreate(bundle)
|
||||
}
|
||||
fun onResume() {
|
||||
mapBizView.onResume()
|
||||
}
|
||||
|
||||
fun onSaveInstanceState(outState: Bundle){
|
||||
mapBizView.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
fun onLowMemory() {
|
||||
mapBizView.onLowMemory()
|
||||
}
|
||||
|
||||
fun onPause() {
|
||||
mapBizView.onPause()
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
mapBizView.onDestroy()
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ import android.view.animation.DecelerateInterpolator;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
|
||||
import me.jessyan.autosize.AutoSizeConfig;
|
||||
@@ -128,12 +130,15 @@ public class SlidePanelView extends View {
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
textPaint.setShader(textGradient);
|
||||
textPaint.getFontMetrics(blockTextMetrics);
|
||||
int size = AutoSizeUtils.dp2px(getContext(), 120);
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options(); //todo yakun 优化
|
||||
opts.inDensity = (int) AutoSizeConfig.getInstance().getInitDensity();
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.bus_base_slide_block,opts);
|
||||
bmBlock = Bitmap.createScaledBitmap(bmBlock, size, size, true);
|
||||
blockWidth = bmBlock.getWidth();
|
||||
ThreadUtils.getCpuPool().execute(() -> {
|
||||
int size = AutoSizeUtils.dp2px(getContext(), 120);
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options(); //todo yakun 优化
|
||||
opts.inDensity = (int) AutoSizeConfig.getInstance().getInitDensity();
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.bus_base_slide_block,opts);
|
||||
bmBlock = Bitmap.createScaledBitmap(bmBlock, size, size, true);
|
||||
blockWidth = bmBlock.getWidth();
|
||||
UiThreadHandler.post(this::requestLayout,UiThreadHandler.MODE.QUEUE);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,14 +156,16 @@ public class SlidePanelView extends View {
|
||||
textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
}
|
||||
|
||||
if (widthMode == MeasureSpec.AT_MOST) {
|
||||
// 宽度根据图片大小,字符串长度,各种间隔确定
|
||||
// 高度根据图片大小和上下间隔确定
|
||||
textPaint.getTextBounds(blockText, 0, blockText.length(), textRect);
|
||||
widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + textMarginLeft + textMarginRight + textRect.width();
|
||||
heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight();
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
|
||||
if(bmBlock!=null) {
|
||||
if (widthMode == MeasureSpec.AT_MOST) {
|
||||
// 宽度根据图片大小,字符串长度,各种间隔确定
|
||||
// 高度根据图片大小和上下间隔确定
|
||||
textPaint.getTextBounds(blockText, 0, blockText.length(), textRect);
|
||||
widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + textMarginLeft + textMarginRight + textRect.width();
|
||||
heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight();
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
|
||||
}
|
||||
}
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
@@ -262,11 +269,13 @@ public class SlidePanelView extends View {
|
||||
// 画文字
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
if(bmBlock!=null) {
|
||||
canvas.save();
|
||||
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), (float) textOffset, textPaint);
|
||||
canvas.restore();
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnSlidePanelMoveToEndListener {
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_72">
|
||||
|
||||
<com.mogo.eagle.core.function.view.MapBizView
|
||||
<com.mogo.och.bus.view.BizMapView
|
||||
android:id="@+id/mapBizView"
|
||||
app:isWeatherEnable="false"
|
||||
app:locationIcon3DRes="@raw/xiaoba"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
14
OCH/bus/driver/src/main/res/layout/bus_jl_bizmap_map.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="FrameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.mogo.eagle.core.function.view.MapBizView
|
||||
android:id="@+id/bizMapView"
|
||||
app:isWeatherEnable="false"
|
||||
app:locationIcon3DRes="@raw/xiaoba"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</merge>
|
||||
14
OCH/bus/driver/src/main/res/layout/bus_m2_bizmap_map.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="FrameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<com.mogo.eagle.core.function.view.MapBizView
|
||||
android:id="@+id/bizMapView"
|
||||
app:isWeatherEnable="false"
|
||||
app:locationIcon3DRes="@raw/m2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</merge>
|
||||
@@ -44,6 +44,21 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs = [
|
||||
'src/main/res',
|
||||
'src/main/res/m2',
|
||||
'src/main/res/jinlv',
|
||||
]
|
||||
java.srcDirs = [
|
||||
'src/main/java',
|
||||
'src/main/java/m2',
|
||||
'src/main/java/jinlv',
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "vehicle"
|
||||
productFlavors {
|
||||
// 车型:金旅星辰、开沃 小巴业务
|
||||
@@ -51,6 +66,11 @@ android {
|
||||
dimension "vehicle"
|
||||
buildConfigField 'int', 'NEW_TEST', '0'
|
||||
}
|
||||
// 车型:金旅m1 小巴业务
|
||||
m2 {
|
||||
dimension "vehicle"
|
||||
buildConfigField 'int', 'NEW_TEST', '1'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +85,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
implementation project(":OCH:common:common")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
implementation project(':core:mogo-core-res')
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.mogo.och.bus.passenger;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
|
||||
import com.mogo.och.common.module.wigets.media.MediaPlayerActivity;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* 网约车-Bus-乘客端
|
||||
*
|
||||
* Created on 2022/3/29
|
||||
*/
|
||||
@Route(path = BusPassengerConst.PATH)
|
||||
public class MogoOCHBusPassenger implements IMogoOCH {
|
||||
private static final String TAG = MogoOCHBusPassenger.class.getSimpleName();
|
||||
|
||||
private FragmentActivity mActivity;
|
||||
private int mContainerId;
|
||||
private BusPassengerRouteFragment mPassengerFragment;
|
||||
|
||||
@Override
|
||||
public void createCoverage(FragmentActivity activity, int containerId) {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Fragment createCoverage(@Nullable FragmentActivity activity, @Nullable Integer containerId) {
|
||||
this.mActivity = activity;
|
||||
this.mContainerId = containerId;
|
||||
showFragment();
|
||||
|
||||
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode) && activity != null) {
|
||||
MultiDisplayUtils.INSTANCE.startActWithSecond(activity, MediaPlayerActivity.class);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
// 若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
|
||||
if (mActivity == null) return;
|
||||
mActivity.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入鹰眼模式,设置手势缩放地图失效
|
||||
*/
|
||||
private void stepIntoVrMode() {
|
||||
CallerLogger.d( M_BUS_P + TAG, "进入vr模式" );
|
||||
CallerMoGoUiSettingManager.INSTANCE.stepInDayMode();//白天模式 状态栏字体颜色变黑
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
FragmentManager supportFragmentManager = mActivity.getSupportFragmentManager();
|
||||
if(mPassengerFragment == null){
|
||||
CallerLogger.d(M_BUS_P + TAG, "准备add fragment======");
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(BusPassengerRouteFragment.TAG);
|
||||
if (fragmentByTag instanceof BusPassengerRouteFragment){
|
||||
mPassengerFragment = (BusPassengerRouteFragment)fragmentByTag;
|
||||
}else {
|
||||
mPassengerFragment = new BusPassengerRouteFragment();
|
||||
}
|
||||
if (!mPassengerFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(mContainerId, mPassengerFragment,BusPassengerRouteFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.d(M_BUS_P + TAG, "准备show fragment");
|
||||
supportFragmentManager.beginTransaction().show(mPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
if (mPassengerFragment != null){
|
||||
mActivity.getSupportFragmentManager().beginTransaction().hide(mPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
OCH/bus/passenger/src/m2/AndroidManifest.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mogo.och.bus.passenger">
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<application>
|
||||
<activity android:name="com.mogo.eagle.core.function.main.MainLauncherActivity"
|
||||
android:screenOrientation="portrait"
|
||||
tools:replace="android:screenOrientation"/>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -5,15 +5,17 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.stepInDayMode
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.ui.PM2BaseFragment
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment
|
||||
import com.mogo.och.bus.passenger.passenger.ui.PM2BaseFragment
|
||||
import com.mogo.och.common.module.wigets.media.MediaPlayerActivity
|
||||
|
||||
/**
|
||||
* 网约车-Bus-乘客端
|
||||
@@ -21,20 +23,20 @@ import com.mogo.och.bus.passenger.ui.PM2BaseFragment
|
||||
* Created on 2022/3/29
|
||||
*/
|
||||
@Route(path = BusPassengerConst.PATH)
|
||||
class MogoOCHBusPassenger : IMogoOCH, IMogoStatusChangedListener {
|
||||
class MogoOCHBusPassenger : IMoGoFunctionProvider {
|
||||
private var mActivity: FragmentActivity? = null
|
||||
private var mContainerId = 0
|
||||
private var mPM2Fragment: PM2BaseFragment? = null
|
||||
override fun createCoverage(activity: FragmentActivity, containerId: Int) {}
|
||||
private var mPM2Fragment: Fragment? = null
|
||||
|
||||
override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? {
|
||||
mActivity = activity
|
||||
mContainerId = containerId!!
|
||||
// if (MogoStatusManager.getInstance().isScreenCoverDismiss){
|
||||
showFragment()
|
||||
// }else{
|
||||
// MogoStatusManager.getInstance()
|
||||
// .registerStatusChangedListener("ochM2Passenger", StatusDescriptor.SCREEN_COVER, this)
|
||||
// }
|
||||
showFragment()
|
||||
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
|
||||
mActivity?.let {
|
||||
MultiDisplayUtils.startActWithSecond(it, MediaPlayerActivity::class.java)
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -63,12 +65,19 @@ class MogoOCHBusPassenger : IMogoOCH, IMogoStatusChangedListener {
|
||||
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备add fragment======")
|
||||
|
||||
var fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(PM2BaseFragment.TAG)
|
||||
val fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(PM2BaseFragment.TAG)
|
||||
|
||||
mPM2Fragment = if (fragmentByTag is PM2BaseFragment){
|
||||
mPM2Fragment = if (fragmentByTag is Fragment){
|
||||
fragmentByTag
|
||||
}else{
|
||||
PM2BaseFragment()
|
||||
if (AppIdentityModeUtils.isM2(FunctionBuildConfig.appIdentityMode)) {
|
||||
PM2BaseFragment()
|
||||
}else if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
|
||||
BusPassengerRouteFragment()
|
||||
}else{
|
||||
BusPassengerRouteFragment()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!mPM2Fragment?.isAdded!!){
|
||||
@@ -93,13 +102,4 @@ class MogoOCHBusPassenger : IMogoOCH, IMogoStatusChangedListener {
|
||||
private val TAG = MogoOCHBusPassenger::class.java.simpleName
|
||||
}
|
||||
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (descriptor == StatusDescriptor.SCREEN_COVER){
|
||||
if (isTrue){
|
||||
showFragment()
|
||||
}else{
|
||||
hideFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
@@ -69,8 +69,6 @@ import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.ArrivalNotification
|
||||
import mogo.telematics.pad.MessagePad.GlobalPathResp
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
@@ -576,7 +574,7 @@ object BusPassengerModel {
|
||||
}
|
||||
if (mTwoStationsRouts.size > 0) {
|
||||
val sumLength = calculateRouteSumLength(mTwoStationsRouts)
|
||||
SharedPrefsMgr.getInstance(mContext!!)
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS, sumLength.toInt())
|
||||
mAutopilotPlanningCallback?.updateTotalDistance()
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
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
|
||||
@@ -51,14 +52,14 @@ object BusPassengerServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mBusPassengerSaasServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
|
||||
}else{
|
||||
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusPassengerQueryLineRequest(
|
||||
driverAppSn
|
||||
)
|
||||
@@ -81,7 +82,7 @@ object BusPassengerServiceManager {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mBusPassengerSaasServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
)
|
||||
.transformTry()
|
||||
@@ -89,7 +90,7 @@ object BusPassengerServiceManager {
|
||||
}else{
|
||||
mBusPassengerServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
)
|
||||
.transformTry()
|
||||
@@ -7,7 +7,7 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.jinlvvan.p_bus_view_blue_tooth.view.*
|
||||
import kotlinx.android.synthetic.main.p_bus_view_blue_tooth.view.blueView
|
||||
|
||||
/**
|
||||
* 魔戒蓝牙控件
|
||||
@@ -20,7 +20,7 @@ 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.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
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;
|
||||
@@ -335,7 +335,7 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
|
||||
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
|
||||
SharedPrefsMgr.getInstance(getContext())
|
||||
SharedPrefsMgr.getInstance()
|
||||
.remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
|
||||
clearMapView();
|
||||
}
|
||||
@@ -10,7 +10,9 @@ import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListen
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.jinlvvan.bus_p_traffic_light_view.view.*
|
||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.bus_p_traffic_light_bg
|
||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.bus_p_traffic_light_iv
|
||||
import kotlinx.android.synthetic.main.bus_p_traffic_light_view.view.bus_p_traffic_light_time_tv
|
||||
|
||||
/**
|
||||
* bus乘客端:红绿灯view
|
||||
@@ -0,0 +1,21 @@
|
||||
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:已出车
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class PM2RoutesResponse extends BaseData {
|
||||
private BusRoutesResult data;
|
||||
|
||||
public BusRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(BusRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class PM2RoutesResult {
|
||||
private List<PM2Station> 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<PM2Station> 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.och.bus.passenger.passenger.callback
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/15
|
||||
*/
|
||||
interface ADASCallback {
|
||||
fun updateHDMapStations(stations: MutableList<MutableList<Double>>)
|
||||
fun removeHDMapStations()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.och.bus.passenger.passenger.callback
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/13
|
||||
*/
|
||||
interface AutoPilotStatusCallback {
|
||||
/**
|
||||
* false: 未开启自驾, true : 开启自驾
|
||||
*/
|
||||
fun updateAutoStatus(isOpen: Boolean)
|
||||
|
||||
fun updateAutoStatus(status: Int)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.och.bus.passenger.passenger.callback
|
||||
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/2
|
||||
*/
|
||||
interface DrivingInfoCallback {
|
||||
fun updateSpeed(speed: Int)
|
||||
fun updatePlateNumber(carNum: String)
|
||||
fun updateLine(lineName: String, lineDuring: String)
|
||||
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
|
||||
fun changeOperationStatus(loginStatus : Boolean)
|
||||
fun showNoTaskView(isTrue : Boolean)
|
||||
fun updateLineStations(stations: MutableList<BusStationBean>)
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean)
|
||||
fun clearCustomPolyline()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.bus.passenger.passenger.constant
|
||||
|
||||
/**
|
||||
* Created on 2021/12/6
|
||||
*/
|
||||
class M2Const {
|
||||
companion object {
|
||||
//站点UUID
|
||||
const val M2_MAP_STATION_MAKER = "m2_map_station_maker"
|
||||
|
||||
/**
|
||||
* Marker类型
|
||||
*/
|
||||
const val TYPE_MARKER_M2_LINE = "TYPE_MARKER_M2_LINE"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mogo.och.bus.passenger.passenger.model
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.bus.passenger.passenger.callback.ADASCallback
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/2
|
||||
*/
|
||||
class PM2ADASModel private constructor() {
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var mAdasCallback: ADASCallback? = null
|
||||
|
||||
companion object {
|
||||
val TAG = PM2ADASModel::class.java.simpleName
|
||||
val INSTANCE: PM2ADASModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
PM2ADASModel()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context : Context){
|
||||
this.mContext = context
|
||||
}
|
||||
|
||||
fun setAdasCallback(adasCallback: ADASCallback?){
|
||||
this.mAdasCallback = adasCallback
|
||||
}
|
||||
|
||||
fun updateHDMapStations(stations: MutableList<BusStationBean>){
|
||||
var stationsList = mutableListOf<MutableList<Double>>()
|
||||
for (i in stations.indices){
|
||||
var listLatLng = mutableListOf<Double>() // 0: long 1:lat
|
||||
listLatLng.add(stations[i].lon)
|
||||
listLatLng.add(stations[i].lat)
|
||||
stationsList.add(listLatLng)
|
||||
}
|
||||
mAdasCallback?.updateHDMapStations(stationsList)
|
||||
}
|
||||
|
||||
fun removeHDMapStations(){
|
||||
mAdasCallback?.removeHDMapStations()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,638 @@
|
||||
package com.mogo.och.bus.passenger.passenger.model
|
||||
|
||||
import android.content.Context
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
import android.net.ConnectivityManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
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.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.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 kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/1/31
|
||||
*/
|
||||
class PM2DrivingModel private constructor() {
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
|
||||
private var mRoutePoints = mutableListOf<MogoLocation>()
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
|
||||
private var mCurrentAutoStatus = -1
|
||||
|
||||
var mStations = mutableListOf<BusStationBean>()
|
||||
private var mNextStationIndex = 0 // A-B要到达站的index
|
||||
private var isGoingToNextStation = false //是否前往下一站过程中
|
||||
|
||||
private var mTwoStationsRouts = mutableListOf<MogoLocation>()
|
||||
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 val handler = Handler(Handler.Callback { msg ->
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
queryDriverOperationStatus()
|
||||
return@Callback true
|
||||
}
|
||||
false
|
||||
})
|
||||
|
||||
companion object {
|
||||
val TAG = PM2DrivingModel::class.java.simpleName
|
||||
const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
val INSTANCE: PM2DrivingModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
PM2DrivingModel()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context : Context){
|
||||
mContext = context
|
||||
initListener()
|
||||
queryDriverByLocalDriver()
|
||||
queryDriverOperationStatus()
|
||||
startOrStopOrderLoop(true)
|
||||
}
|
||||
|
||||
private fun queryDriverByLocalDriver() {
|
||||
//本地去请求司机端
|
||||
val msg = TaskDetailsMsg("task")
|
||||
sendMsgToServer(GsonUtils.toJson(msg))
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
|
||||
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10,mMapLocationListener)
|
||||
|
||||
//司乘屏通信监听
|
||||
CallerTelematicListenerManager.addListener(TAG,mReceivedMsgListener)
|
||||
|
||||
//自动驾驶轨迹监听
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
|
||||
//网络监听
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
|
||||
}
|
||||
|
||||
private fun sendMsgToServer(msg: String) {
|
||||
sendMsgToServer(
|
||||
OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(msg).toByteArray()
|
||||
)
|
||||
}
|
||||
|
||||
fun releaseListener(){
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
|
||||
//自动驾驶轨迹监听
|
||||
CallerPlanningRottingListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){
|
||||
mDrivingInfoCallback = drivingInfoCallback
|
||||
}
|
||||
|
||||
fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?){
|
||||
mAutoStatusCallback = autoPilotStatusCallback
|
||||
}
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mReceivedMsgListener: IReceivedMsgListener =
|
||||
object : IReceivedMsgListener{
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息
|
||||
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)
|
||||
)
|
||||
|
||||
if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), AppConnectMsg::class.java)
|
||||
|
||||
if (msg != null && msg.isPlay){ //播报
|
||||
speakTTS(msg.msg)
|
||||
}
|
||||
|
||||
if (msg != null && msg.isViewShow) { //消息盒子显示内容
|
||||
pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),msg.msg)
|
||||
}
|
||||
}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)
|
||||
)
|
||||
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){
|
||||
updateLocalOrder()
|
||||
}
|
||||
|
||||
if (routesResult == null ||
|
||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)) {
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult!!)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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来监听焦点的获取
|
||||
.build()
|
||||
mAudioManager.requestAudioFocus(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 onSpeakSelectTimeOut(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener{
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
mLocation = mogoLocation
|
||||
updateSpeed(mogoLocation)
|
||||
}
|
||||
}
|
||||
|
||||
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<MessagePad.Location>) {
|
||||
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()
|
||||
|
||||
mDrivingInfoCallback?.updateSpeed(speedKM)
|
||||
}
|
||||
|
||||
private val mAutoPilotStatusListener: IMoGoAutopilotStatusListener =
|
||||
object : IMoGoAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
d(SceneConstant.M_BUS_P+ TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation){
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}else{//非美化模式下
|
||||
mAutoStatusCallback?.updateAutoStatus(false)
|
||||
}
|
||||
}else{//自驾状态 2
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun queryDriverOperationDelay() {
|
||||
handler.sendEmptyMessageDelayed(
|
||||
MSG_QUERY_BUS_P_STATION,
|
||||
BusPassengerConst.QUERY_BUS_P_STATION_DELAY
|
||||
)
|
||||
}
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
mContext?.let {
|
||||
PM2ServiceManager.queryDriverOperationStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<PM2OperationStatusResponse> {
|
||||
override fun onSuccess(data: PM2OperationStatusResponse?) {
|
||||
if (data?.data == null) return
|
||||
if (data.data.driverStatus != operationStatus?.driverStatus
|
||||
|| data.data.plateNumber != operationStatus?.plateNumber
|
||||
) {
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverOperationStatus ===== 车牌或者登陆状态有变更"
|
||||
)
|
||||
mDrivingInfoCallback?.changeOperationStatus(data.data.driverStatus == 1)
|
||||
}
|
||||
operationStatus = data.data as PM2OperationStatusResponse.Result
|
||||
// mDrivingInfoCallback?.updatePlateNumber(data.data.plateNumber)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
// queryDriverOperationDelay()
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
//延迟3s再次查询
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun queryDriverSiteByCoordinate(){
|
||||
mContext?.let {
|
||||
PM2ServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PM2RoutesResponse> {
|
||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
||||
|
||||
if (data == null || data.result == null) {
|
||||
if (routesResult != null) {
|
||||
routesResult = null
|
||||
updateLocalOrder()
|
||||
d(
|
||||
SceneConstant.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"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null &&
|
||||
routesResult!!.writeVersion < data.result.writeVersion
|
||||
) {
|
||||
routesResult = data.result
|
||||
}
|
||||
|
||||
if (routesResult == null) {
|
||||
routesResult = data.result
|
||||
}
|
||||
updatePassengerRouteInfo(data.result)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate = onError ="
|
||||
+ ", sn = " + driverAppSn
|
||||
)
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
if (code == 1003) {
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
if (driverAppSn.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
routesResult = null
|
||||
isGoingToNextStation = false
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLocalOrder(){
|
||||
mRoutePoints.clear()
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
isGoingToNextStation = false
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
mDrivingInfoCallback?.showNoTaskView(true)
|
||||
}
|
||||
|
||||
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")
|
||||
mDrivingInfoCallback?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= update")
|
||||
routesResult = result
|
||||
|
||||
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
|
||||
if (result.sites != null) {
|
||||
mDrivingInfoCallback?.showNoTaskView(false)
|
||||
val stations: List<BusStationBean> = 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<BusStationBean>, 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<BusStationBean>, 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
|
||||
)
|
||||
}
|
||||
} 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()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时轨迹擦除
|
||||
* @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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
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<PM2RoutesResponse>?
|
||||
) {
|
||||
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<PM2OperationStatusResponse>?
|
||||
) {
|
||||
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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.mogo.och.bus.passenger.network
|
||||
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.model.PM2DrivingModel
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2DrivingModel
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -0,0 +1,40 @@
|
||||
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<PM2RoutesResponse> 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<PM2OperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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<PM2RoutesResponse> 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<PM2OperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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<PM2RoutesResponse> 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<PM2OperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.och.bus.passenger.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.bus.passenger.passenger.callback.ADASCallback
|
||||
import com.mogo.och.bus.passenger.passenger.constant.M2Const.Companion.M2_MAP_STATION_MAKER
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2ADASModel
|
||||
import com.mogo.och.bus.passenger.passenger.ui.PM2HPMapFragment
|
||||
|
||||
class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
Presenter<PM2HPMapFragment?>(view), ADASCallback {
|
||||
|
||||
init {
|
||||
PM2ADASModel.INSTANCE.init(context)
|
||||
initListener()
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
PM2ADASModel.INSTANCE.setAdasCallback(this)
|
||||
}
|
||||
|
||||
private fun removeListener() {
|
||||
PM2ADASModel.INSTANCE.setAdasCallback(null)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
removeListener()
|
||||
}
|
||||
|
||||
override fun updateHDMapStations(stations: MutableList<MutableList<Double>>) {
|
||||
for (i in stations.indices){
|
||||
mView?.setMapMaker(M2_MAP_STATION_MAKER+i,stations[i])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun removeHDMapStations() {
|
||||
mView?.removeMapMaker(M2_MAP_STATION_MAKER)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.mogo.och.bus.passenger.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
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.PM2ADASModel
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2DrivingModel
|
||||
import com.mogo.och.bus.passenger.passenger.ui.PM2DrivingInfoFragment
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
Presenter<PM2DrivingInfoFragment?>(view), DrivingInfoCallback, AutoPilotStatusCallback {
|
||||
|
||||
init {
|
||||
PM2DrivingModel.INSTANCE.init(context)
|
||||
PM2ADASModel.INSTANCE.init(context)
|
||||
initListener()
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
destroyListener()
|
||||
PM2DrivingModel.INSTANCE.releaseListener()
|
||||
}
|
||||
|
||||
private fun initListener(){
|
||||
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(this)
|
||||
PM2DrivingModel.INSTANCE.setAutoStatusCallback(this)
|
||||
}
|
||||
|
||||
private fun destroyListener(){
|
||||
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(null)
|
||||
PM2DrivingModel.INSTANCE.setAutoStatusCallback(null)
|
||||
}
|
||||
|
||||
override fun updateSpeed(speed: Int) {
|
||||
// CallerLogger.d(
|
||||
// SceneConstant.M_BUS_P + "speed = ",speed.toString()
|
||||
// )
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateSpeed(speed)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updatePlateNumber(carNum: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateCarPlateNum(carNum)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLine(lineName: String, lineDuring: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateTaskName(lineName)
|
||||
mView?.updateTaskDuringTime(lineDuring)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateRemainMT(meters: Long, timeInSecond: Long) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateRemainMT(meters, timeInSecond) //米,秒
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeOperationStatus(loginStatus: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.changeOperationStatus(loginStatus)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showNoTaskView(isTrue: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.showNoTaskView(!isTrue)
|
||||
}
|
||||
if (isTrue){
|
||||
PM2ADASModel.INSTANCE.removeHDMapStations()
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLineStations(stations: MutableList<BusStationBean>) {
|
||||
|
||||
val stationsList = mutableListOf<LatLng>()
|
||||
val stationsListPass = mutableListOf<LatLng>()
|
||||
var startStation: LatLng? = null
|
||||
var endStation: LatLng? = null
|
||||
|
||||
for (i in stations.indices){
|
||||
val station = stations[i]
|
||||
val latLng = LatLng(station.gcjLat,station.gcjLon)
|
||||
if(i==0){
|
||||
startStation = latLng
|
||||
continue
|
||||
}
|
||||
if(i==stations.size-1){
|
||||
endStation = latLng
|
||||
continue
|
||||
}
|
||||
if(station.drivingStatus==1){//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
stationsListPass.add(latLng)
|
||||
}else if(station.drivingStatus==2){
|
||||
if(station.isLeaving){
|
||||
stationsListPass.add(latLng)
|
||||
}else{
|
||||
stationsList.add(latLng)
|
||||
}
|
||||
}else{
|
||||
stationsList.add(latLng)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateLineStations(stationsList,stationsListPass,startStation,endStation)
|
||||
}
|
||||
PM2ADASModel.INSTANCE.updateHDMapStations(stations)
|
||||
}
|
||||
|
||||
override fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateStationsInfo(stations,i,isArrived)
|
||||
}
|
||||
}
|
||||
|
||||
override fun clearCustomPolyline() {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.clearCustomPolyline()
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateAutoStatus(isOpen: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateAutoStatus(isOpen)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateAutoStatus(status: Int) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.bus.passenger.passenger.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.bus.passenger.passenger.ui.PM2BaseFragment
|
||||
|
||||
class PM2Presenter(view: PM2BaseFragment?) :
|
||||
Presenter<PM2BaseFragment?>(view)
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mogo.och.bus.passenger.passenger.provider;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.och.bus.passenger.passenger.ui.widget.M2StatusBarView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IStatusViewLayout;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-06
|
||||
* <p>
|
||||
* 根据优先级控制显示 window view.
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_STATUS_VIEW_MANAGER )
|
||||
public class M2StatusViewManager implements IStatusViewLayout {
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getStatusView(Context context) {
|
||||
return new M2StatusBarView(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
package com.mogo.och.bus.passenger.passenger.ui
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.presenter.PM2Presenter
|
||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2Presenter
|
||||
import com.mogo.och.common.module.wigets.media.MediaPlayerFragment
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ class PM2BaseFragment :
|
||||
private var mediaFragment : MediaPlayerFragment? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.p_m2_fragment
|
||||
return R.layout.bus_p_m2_fragment
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
package com.mogo.och.bus.passenger.passenger.ui
|
||||
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.drawable.AnimationDrawable
|
||||
@@ -12,11 +12,25 @@ import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
|
||||
import com.mogo.eagle.core.function.view.SiteMarkerBean
|
||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.presenter.PM2DrivingPresenter
|
||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2DrivingPresenter
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil.*
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import kotlinx.android.synthetic.m2.p_m2_driving_info_fragment.*
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.auto_tv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.clg_distance_left_time
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.group_not_select_line
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.group_stationinfo
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.iv_animal_list
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.line_during_tv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.line_name_tv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.overMapView
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.speed_tv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.station_name_tv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_arrived_notice
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_distance
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_left_time
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.tv_next_station_title
|
||||
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.roundToInt
|
||||
@@ -28,10 +42,10 @@ import kotlin.math.roundToInt
|
||||
class PM2DrivingInfoFragment :
|
||||
MvpFragment<PM2DrivingInfoFragment?, PM2DrivingPresenter?>() {
|
||||
|
||||
val stationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.m2_map_staton_icon)
|
||||
val stationPassIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.m2_map_staton_arrived_icon)
|
||||
val startStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.m2_map_start_icon)
|
||||
val endStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.m2_map_end_icon)
|
||||
val stationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_staton_icon)
|
||||
val stationPassIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_staton_arrived_icon)
|
||||
val startStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_start_icon)
|
||||
val endStationIcon = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.bus_p_m2_map_end_icon)
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
@@ -39,7 +53,7 @@ class PM2DrivingInfoFragment :
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.p_m2_driving_info_fragment
|
||||
return R.layout.bus_p_m2_driving_info_fragment
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
@@ -52,12 +66,12 @@ class PM2DrivingInfoFragment :
|
||||
true
|
||||
}
|
||||
|
||||
line_name_tv.setTextColor(resources.getColor(R.color.m2_line_name_tv_color))
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.m2_line_name_tv_color))
|
||||
line_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_line_name_tv_color))
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_line_name_tv_color))
|
||||
speed_tv.setVertrial(true)
|
||||
val intArrayOf = intArrayOf(
|
||||
requireContext().resources.getColor(R.color.shuttle_color_43cefe),
|
||||
requireContext().resources.getColor(R.color.shuttle_color_1466fb)
|
||||
requireContext().resources.getColor(R.color.bus_p_m2_color_43cefe),
|
||||
requireContext().resources.getColor(R.color.bus_p_m2_color_1466fb)
|
||||
)
|
||||
speed_tv.setmColorList(intArrayOf)
|
||||
|
||||
@@ -150,7 +164,7 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
|
||||
private fun updateNoOrderUI() {
|
||||
line_name_tv.text = resources.getString(R.string.m2_p_not_select_line_content)
|
||||
line_name_tv.text = resources.getString(R.string.bus_p_m2_not_select_line_content)
|
||||
updateNoStationView()
|
||||
overMapView?.let {
|
||||
it.clearSiteMarkers()
|
||||
@@ -164,10 +178,10 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
}
|
||||
private fun updateNoStationView(){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.m2_next_tv_color))
|
||||
station_name_tv.text = resources.getString(R.string.m2_p_empty_tv)
|
||||
tv_distance.text = resources.getString(R.string.m2_p_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.m2_p_empty_remain_minute)
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_next_tv_color))
|
||||
station_name_tv.text = resources.getString(R.string.bus_p_m2_empty_tv)
|
||||
tv_distance.text = resources.getString(R.string.bus_p_m2_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.bus_p_m2_empty_remain_minute)
|
||||
noLineShow()
|
||||
}
|
||||
|
||||
@@ -177,11 +191,11 @@ class PM2DrivingInfoFragment :
|
||||
|
||||
fun updateAutoStatus(isAutoPilot: Boolean) {
|
||||
if (isAutoPilot){
|
||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.m2_p_white_color)) }
|
||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.auto_button_bg) }
|
||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.bus_p_m2_white_color)) }
|
||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bus_p_m2_auto_button_bg) }
|
||||
}else{
|
||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.shuttle_color_7094ad)) }
|
||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bg_p_m2_auto) }
|
||||
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.bus_p_m2_color_7094ad)) }
|
||||
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bus_p_m2_bg_p_m2_auto) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,16 +226,16 @@ class PM2DrivingInfoFragment :
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean){
|
||||
if (stations.size == 0) return
|
||||
if (0<= i && i<stations.size){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.m2_next_tv_color))
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_next_tv_color))
|
||||
station_name_tv.text = stations[i].name
|
||||
}
|
||||
if (isArrived){//到站
|
||||
tv_distance.text = resources.getString(R.string.m2_p_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.m2_p_empty_remain_minute)
|
||||
tv_next_station_title.text = resources.getString(R.string.m2_p_station_title_arrived_tv)
|
||||
tv_distance.text = resources.getString(R.string.bus_p_m2_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.bus_p_m2_empty_remain_minute)
|
||||
tv_next_station_title.text = resources.getString(R.string.bus_p_m2_station_title_arrived_tv)
|
||||
haveLineAndArrivedStation()
|
||||
}else{ //前往目的地中
|
||||
tv_next_station_title.text = resources.getString(R.string.shuttle_p_next_station_title)
|
||||
tv_next_station_title.text = resources.getString(R.string.bus_p_m2_next_station_title)
|
||||
haveLineAndArriveingStation()
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
package com.mogo.och.bus.passenger.passenger.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverlayManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.map.overlay.core.Level
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.mogo.map.MapDataWrapper
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.constant.M2Const.Companion.TYPE_MARKER_M2_LINE
|
||||
import com.mogo.och.bus.passenger.presenter.PM2ADASPresenter
|
||||
import com.mogo.och.bus.passenger.passenger.constant.M2Const.Companion.TYPE_MARKER_M2_LINE
|
||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2ADASPresenter
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import kotlinx.android.synthetic.m2.p_m2_hpmap_fragment.*
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_hpmap_fragment.mapBizView
|
||||
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ class PM2HPMapFragment :
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.p_m2_hpmap_fragment
|
||||
return R.layout.bus_p_m2_hpmap_fragment
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget
|
||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -7,7 +7,7 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.m2.p_m2_view_blue_tooth.view.*
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_view_blue_tooth.view.blueView
|
||||
|
||||
/**
|
||||
* 魔戒蓝牙控件
|
||||
@@ -20,15 +20,15 @@ class M2BlueToothView @JvmOverloads constructor(
|
||||
) : BlueToothView(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.p_m2_view_blue_tooth, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_p_m2_view_blue_tooth, this, true)
|
||||
}
|
||||
|
||||
override fun mofangStatus(status: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (status) {
|
||||
blueView.setImageResource(R.drawable.m2_blue_tooth_close)
|
||||
blueView.setImageResource(R.drawable.bus_p_m2_blue_tooth_close)
|
||||
} else {
|
||||
blueView.setImageResource(R.drawable.m2_blue_tooth_open)
|
||||
blueView.setImageResource(R.drawable.bus_p_m2_blue_tooth_open)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget
|
||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -10,7 +10,9 @@ import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListen
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.m2.m2_p_traffic_light_view.view.*
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_traffic_light_view.view.m2_p_traffic_light_bg
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_traffic_light_view.view.m2_p_traffic_light_iv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_traffic_light_view.view.m2_p_traffic_light_time_tv
|
||||
|
||||
/**
|
||||
* bus乘客端:红绿灯view
|
||||
@@ -34,7 +36,7 @@ class M2PTrafficLightView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun init(context: Context?) {
|
||||
LayoutInflater.from(context).inflate(R.layout.m2_p_traffic_light_view, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_p_m2_traffic_light_view, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
@@ -134,15 +136,15 @@ class M2PTrafficLightView @JvmOverloads constructor(
|
||||
UiThreadHandler.post {
|
||||
when (lightId) {
|
||||
TrafficLightEnum.RED -> {
|
||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.m2_light_red_nor)
|
||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_m2_light_red_nor)
|
||||
this@M2PTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.YELLOW -> {
|
||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.m2_light_yellow_nor)
|
||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_m2_light_yellow_nor)
|
||||
this@M2PTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
TrafficLightEnum.GREEN -> {
|
||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.m2_light_green_nor)
|
||||
m2_p_traffic_light_iv.setBackgroundResource(R.drawable.bus_p_m2_light_green_nor)
|
||||
this@M2PTrafficLightView.visibility = VISIBLE
|
||||
}
|
||||
else -> this@M2PTrafficLightView.visibility = GONE
|
||||
@@ -169,11 +171,11 @@ class M2PTrafficLightView @JvmOverloads constructor(
|
||||
val layoutParams = layoutParams
|
||||
if (layoutParams is MarginLayoutParams) {
|
||||
val lp = layoutParams
|
||||
lp.width = resources.getDimension(R.dimen.m2_p_light_width).toInt()
|
||||
lp.width = resources.getDimension(R.dimen.dp_60).toInt()
|
||||
setLayoutParams(lp)
|
||||
m2_p_traffic_light_time_tv.visibility = VISIBLE
|
||||
m2_p_traffic_light_bg.layoutParams.width =
|
||||
resources.getDimension(R.dimen.m2_p_light_width).toInt()
|
||||
resources.getDimension(R.dimen.dp_60).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget
|
||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
||||
|
||||
import android.annotation.*
|
||||
import android.content.Context
|
||||
@@ -18,7 +18,8 @@ import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.m2.p_m2_view_status_bar.view.*
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_view_status_bar.view.progress
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_view_status_bar.view.tv_power_cos
|
||||
import kotlinx.coroutines.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -39,7 +40,7 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
private var oldBmsSoc: Float = -1.0f
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.p_m2_view_status_bar, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_p_m2_view_status_bar, this, true)
|
||||
setBackgroundColor(Color.parseColor("#80FFFFFF"))
|
||||
isClickable = true
|
||||
isFocusable = true
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.mogo.och.bus.passenger.passenger.ui.widget
|
||||
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.AlphaAnimation
|
||||
import android.view.animation.Animation
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.common.module.manager.lightmanager.TurnLightManager
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.left_nor_image
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.left_select_image
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.right_nor_image
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.right_select_image
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_turn_light_status.view.turn_light_layout
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/13
|
||||
*/
|
||||
class M2TurnLightView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr),
|
||||
IMoGoTurnLightListener, TurnLightManager.TurnLightListener {
|
||||
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TurnLightViewStatus"
|
||||
}
|
||||
|
||||
private var isLeftLight: Boolean = false
|
||||
private var isRightLight: Boolean = false
|
||||
private var isDisappear: Boolean = false
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.bus_p_m2_turn_light_status, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerTurnLightListenerManager.addListener(TAG,this)
|
||||
|
||||
TurnLightManager.addTurnLightStatusChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun hideTurnLightView() {
|
||||
ThreadUtils.runOnUiThread{
|
||||
if (!isDisappear) {
|
||||
isDisappear = true
|
||||
isLeftLight = false
|
||||
isRightLight = false
|
||||
animationDisappear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun statusChange(newStatus: TurnLightManager.TurnLightStatus) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
setTurnLight(newStatus)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转向灯动画
|
||||
*/
|
||||
private fun setTurnLight(directionLight: TurnLightManager.TurnLightStatus) {
|
||||
if (!isAttachedToWindow) {
|
||||
return
|
||||
}
|
||||
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
|
||||
when (directionLight) {
|
||||
TurnLightManager.TurnLightStatus.TURN_LIGHT_LEFT -> { //左转向
|
||||
if (!isLeftLight) {
|
||||
isLeftLight = true
|
||||
isRightLight = false
|
||||
isDisappear = false
|
||||
showNormalAnimation()
|
||||
left_select_image.visibility = View.VISIBLE
|
||||
right_select_image.visibility = View.GONE
|
||||
right_select_image.clearAnimation()
|
||||
setAnimation(left_select_image)
|
||||
}
|
||||
}
|
||||
TurnLightManager.TurnLightStatus.TURN_LIGHT_RIGHT -> { //右转向
|
||||
if (!isRightLight) {
|
||||
isRightLight = true
|
||||
isLeftLight = false
|
||||
isDisappear = false
|
||||
showNormalAnimation()
|
||||
left_select_image.visibility = View.GONE
|
||||
right_select_image.visibility = View.VISIBLE
|
||||
left_select_image.clearAnimation()
|
||||
setAnimation(right_select_image)
|
||||
}
|
||||
}
|
||||
TurnLightManager.TurnLightStatus.TURN_LIGHT_NONE -> { //消失
|
||||
if (!isDisappear) {
|
||||
isDisappear = true
|
||||
isLeftLight = false
|
||||
isRightLight = false
|
||||
animationDisappear()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//显示背景
|
||||
private fun showNormalAnimation() {
|
||||
val appearAnimation = AlphaAnimation(0f, 1.0f)
|
||||
appearAnimation.duration = 300
|
||||
val appearAnimationImage = AlphaAnimation(0f, 1.0f)
|
||||
appearAnimation.duration = 500
|
||||
turn_light_layout.startAnimation(appearAnimation)
|
||||
left_nor_image.startAnimation(appearAnimationImage)
|
||||
right_nor_image.startAnimation(appearAnimationImage)
|
||||
|
||||
turn_light_layout.visibility = View.VISIBLE
|
||||
left_nor_image.visibility = View.VISIBLE
|
||||
right_nor_image.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
//消失动画,当转向等数据为空时候
|
||||
private fun animationDisappear() {
|
||||
left_select_image.visibility = View.GONE
|
||||
right_select_image.visibility = View.GONE
|
||||
left_select_image.clearAnimation()
|
||||
right_select_image.clearAnimation()
|
||||
|
||||
left_nor_image.clearAnimation()
|
||||
right_nor_image.clearAnimation()
|
||||
turn_light_layout.clearAnimation()
|
||||
|
||||
val disappearAnimationLeft = AlphaAnimation(1.0f, 0f)
|
||||
disappearAnimationLeft.duration = 300
|
||||
|
||||
val disappearAnimationBg = AlphaAnimation(1.0f, 0f)
|
||||
disappearAnimationBg.duration = 500
|
||||
|
||||
left_nor_image.startAnimation(disappearAnimationLeft)
|
||||
right_nor_image.startAnimation(disappearAnimationLeft)
|
||||
turn_light_layout.startAnimation(disappearAnimationBg)
|
||||
|
||||
disappearAnimationLeft.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationRepeat(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationStart(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
left_nor_image.visibility = View.GONE
|
||||
right_nor_image.visibility = View.GONE
|
||||
}
|
||||
})
|
||||
|
||||
disappearAnimationBg.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationRepeat(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationStart(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
turn_light_layout.visibility = View.GONE
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//实现图片闪烁效果
|
||||
private fun setAnimation(imageView: ImageView) {
|
||||
val animationSet = AnimatorSet()
|
||||
val valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha", 0f, 1.0f)
|
||||
val valueAnimatorDisappear = ObjectAnimator.ofFloat(imageView, "alpha", 1.0f, 0f)
|
||||
valueAnimator.duration = 1000
|
||||
valueAnimatorDisappear.duration = 800
|
||||
valueAnimator.repeatCount = -1
|
||||
valueAnimatorDisappear.repeatCount = -1
|
||||
animationSet.playTogether(valueAnimatorDisappear, valueAnimator)
|
||||
animationSet.start()
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |