Merge branch 'release_robotaxi-d_240227_6.3.0.2' into 'master'
[Publish] V6.3.0 See merge request SCA/L4HA/AndroidApp/MoGoEagleEye!863
@@ -24,6 +24,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
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.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
import com.mogo.map.overlay.core.Level;
|
||||
@@ -150,12 +151,12 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
|
||||
@Override
|
||||
protected void onArriveStation() {
|
||||
mPresenter.onAutopilotArriveAtStation(null);
|
||||
mPresenter.arriveStation(null,"点击进站触发进站操作");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void debugArrivedStation() {
|
||||
mPresenter.onAutopilotArriveAtStation(null);
|
||||
mPresenter.arriveStation(null,"点击debug进站按钮触发进站操作");
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -529,7 +530,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
}
|
||||
if ((int)mSwitchLine.getTag() == 0){//切换路线
|
||||
Intent intent = new Intent(getContext(), BusSwitchLineActivity.class);
|
||||
startActivity(intent);
|
||||
ActivityUtils.startActivity(intent);
|
||||
}else {//结束任务
|
||||
OCHCommitDialog.Builder builder = new OCHCommitDialog.Builder();
|
||||
OCHCommitDialog closeLineConfirmDialog = builder
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.net.OrderServiceManager;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -118,9 +119,11 @@ public class BusLineModel {
|
||||
}
|
||||
|
||||
public void commitSwitchLineId(int taskId,int lineId){
|
||||
OchChainLogManager.writeChainLog("选择线路","taskId:"+taskId+"--lineId:"+lineId,true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
OrderServiceManager.switchLine(mContext,taskId, new OchCommonServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
OchChainLogManager.writeChainLog("选择线路成功","taskId:"+taskId+"--lineId:"+lineId,true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
SharedPrefsMgr.getInstance().putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onChangeLineIdSuccess();
|
||||
@@ -130,6 +133,7 @@ public class BusLineModel {
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
OchChainLogManager.writeChainLog("选择线路失败","taskId:"+taskId+"--lineId:"+lineId,true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -26,20 +25,20 @@ 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.call.autopilot.CallerAutoPilotControlManager;
|
||||
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.CallerTelematicManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
@@ -55,6 +54,8 @@ import com.mogo.och.bus.presenter.BusModelLoopManager;
|
||||
import com.mogo.och.bus.util.BusAnalyticsManager;
|
||||
import com.mogo.och.bus.util.BusSendTripInfoManager;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.bus.util.BusVoiceManager;
|
||||
import com.mogo.och.common.module.bean.dpmsg.AppConnectMsg;
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager;
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.data.OCHOperationalMessage;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
@@ -63,15 +64,18 @@ import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.trajectory.ITrajectoryListListener;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.trajectory.TrajectoryManager;
|
||||
import com.mogo.och.common.module.manager.distancemamager.ITrajectoryListener;
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.MultiRequestLimitChecker;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
import com.mogo.och.common.module.voice.VoiceManager;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -81,7 +85,6 @@ import java.util.List;
|
||||
|
||||
import io.reactivex.exceptions.UndeliverableException;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -115,8 +118,6 @@ public class OrderModel {
|
||||
private IPassengerCallback mPassengerCallback; //乘客核销回调
|
||||
private IBusADASStatusCallback mADASStatusCallback;
|
||||
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();//全路径信息
|
||||
|
||||
private volatile boolean isArrivedStation = false;
|
||||
|
||||
//0: 代表没有启动过 1代表是启动第一次,当>=1 代表是重试 每次到站/路线结束清空置为0
|
||||
@@ -150,12 +151,11 @@ public class OrderModel {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
loginService = (LoginService) ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation();
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG,10, mMapLocationListener);
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG,5, mMapLocationListener);
|
||||
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
TrajectoryManager.INSTANCE.addTrajectoryListListenerr(TAG,iTrajectoryListener);
|
||||
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
|
||||
@@ -267,36 +267,22 @@ public class OrderModel {
|
||||
private final ITrajectoryListener trajectoryListener = (routeArrivied, routeArriving, location) -> {
|
||||
|
||||
};
|
||||
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener() {
|
||||
|
||||
|
||||
private final ITrajectoryListListener iTrajectoryListener = new ITrajectoryListListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0) {
|
||||
points.clear();
|
||||
points.addAll(coordinateConverterWgsToGcjList(mContext, routeList.getWayPointsList()));
|
||||
updateOrderRoute();
|
||||
}
|
||||
public void trajectoryCallback(@NonNull List<MogoLocation> trajectoryList) {
|
||||
updateOrderRoute(trajectoryList);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public static List<BusRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(mContext, m);
|
||||
BusRoutePlanningUpdateReqBean.Result result = new BusRoutePlanningUpdateReqBean.Result();
|
||||
result.latitude = mogoLatLng.latitude;
|
||||
result.longitude = mogoLatLng.longitude;
|
||||
points.add(result);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报订单全路径规划数据
|
||||
*/
|
||||
public void updateOrderRoute() {
|
||||
if (!isGoingToNextStation || backgroundCurrentStationIndex + 1 >= stationList.size() || points.size() == 0) {
|
||||
public void updateOrderRoute(List<MogoLocation> trajectoryList) {
|
||||
if (!isGoingToNextStation || backgroundCurrentStationIndex + 1 >= stationList.size() || trajectoryList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -304,7 +290,7 @@ public class OrderModel {
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
|
||||
OrderServiceManager.updateOrderRoute(mContext, currentLineId, currentStation.getSiteId()
|
||||
, nextStation.getSiteId(), points, new OchCommonServiceCallback<BaseData>() {
|
||||
, nextStation.getSiteId(), trajectoryList, new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
|
||||
@@ -313,18 +299,12 @@ public class OrderModel {
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (isGoingToNextStation) {//重试
|
||||
updateOrderRoute();
|
||||
updateOrderRoute(trajectoryList);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void debugUpdateOrderRoute(List<MessagePad.Location> list) {
|
||||
points.clear();
|
||||
points.addAll(coordinateConverterWgsToGcjList(mContext, list));
|
||||
updateOrderRoute();
|
||||
}
|
||||
|
||||
public void release() {
|
||||
|
||||
startOrStopOrderLoop(false);
|
||||
@@ -334,8 +314,7 @@ public class OrderModel {
|
||||
// 注销定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.removeListener(TAG);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
TrajectoryManager.INSTANCE.addTrajectoryListListenerr(TAG,null);
|
||||
loginService = null;
|
||||
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null);
|
||||
@@ -383,13 +362,19 @@ public class OrderModel {
|
||||
@Override
|
||||
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
|
||||
if (null == gnssInfo) return;
|
||||
Logger.d(TAG, "onChassisLocationGCJ02");
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.onCarLocationChanged(gnssInfo);
|
||||
}
|
||||
|
||||
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||
if (isGoingToNextStation && !isArrivedStation) {
|
||||
judgeArrivedStation(gnssInfo);
|
||||
OCHThreadPoolManager.getsInstance().locationExecute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
judgeArrivedStation(gnssInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -426,7 +411,7 @@ public class OrderModel {
|
||||
//3、刚过站且过站距离在15m内, 提交到站
|
||||
if (stationAngle > 90 && distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE){
|
||||
CallerLogger.d(M_BUS + TAG, "judgeArrivedStation() = 刚过站且在15m内");
|
||||
onArriveAt(null); //无自动驾驶到站信息传null
|
||||
onArriveAt(null,"兜底:根据定位计算到站"); //无自动驾驶到站信息传null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,7 +679,9 @@ public class OrderModel {
|
||||
/**
|
||||
* 到站后重置站点状态
|
||||
*/
|
||||
private void arriveSiteStation() {
|
||||
private void arriveSiteStation(String changeInfo) {
|
||||
OchChainLogManager.writeChainLog("触发进站", changeInfo,
|
||||
true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) { //到站短时间内调用多次
|
||||
CallerLogger.e( M_BUS + TAG, "数组越界" );
|
||||
return;
|
||||
@@ -705,6 +692,13 @@ public class OrderModel {
|
||||
String departureStopName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
CallerLogger.d(M_BUS + TAG, "arriveSiteStation-currentStationIndex = " + arrivedStationIndex);
|
||||
|
||||
String requestId = MultiRequestLimitChecker.Companion.generateRequestId(TAG + "-arriveSiteStation"
|
||||
, String.valueOf(stationList.get(arrivedStationIndex).getSiteId())
|
||||
, String.valueOf(currentTaskId));
|
||||
if (!MultiRequestLimitChecker.Companion.getInstance().canMakeRequest(requestId, 5)) {
|
||||
CallerLogger.d(M_BUS + TAG, "arriveSiteStation-MultiRequestLimitChecker: 超过最大请求数,本次请求return");
|
||||
return;
|
||||
}
|
||||
OrderServiceManager.arriveSiteStation(mContext,
|
||||
stationList.get(arrivedStationIndex).getSeq(),
|
||||
stationList.get(arrivedStationIndex).getSiteId(),
|
||||
@@ -713,6 +707,7 @@ public class OrderModel {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.d(M_BUS + TAG, "行程日志-arriveSiteStation success");
|
||||
MultiRequestLimitChecker.Companion.getInstance().decreaseRequestCount(requestId);
|
||||
if (o != null && o.code == 0){
|
||||
queryBusRoutes();
|
||||
isArrivedStation = true;
|
||||
@@ -726,6 +721,7 @@ public class OrderModel {
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
MultiRequestLimitChecker.Companion.getInstance().decreaseRequestCount(requestId);
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
@@ -735,6 +731,7 @@ public class OrderModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
MultiRequestLimitChecker.Companion.getInstance().decreaseRequestCount(requestId);
|
||||
if (ToastUtilsOch.isCustomFastClick(5000)) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
@@ -758,7 +755,7 @@ public class OrderModel {
|
||||
, arriveStation
|
||||
, isLastStop);
|
||||
}
|
||||
VoiceManager.INSTANCE.arrivedStationBus(arriveStation,arriveStationKr);
|
||||
BusVoiceManager.INSTANCE.arrivedStationBus(arriveStation,arriveStationKr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -783,6 +780,10 @@ public class OrderModel {
|
||||
MogoLocation currentStationPoint = new MogoLocation();
|
||||
currentStationPoint.setLongitude(busStationBean.getGcjLon());
|
||||
currentStationPoint.setLatitude(busStationBean.getGcjLat());
|
||||
String changeInfo = "taskId:" + currentTaskId + "--lineId:" + currentLineId +
|
||||
"--currentStationName:"+currentStationName+"--finalNextStationName:"+finalNextStationName;
|
||||
OchChainLogManager.writeChainLog("滑动出发", changeInfo,
|
||||
true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
OrderServiceManager.leaveStation(mContext,
|
||||
busStationBean.getSeq(),
|
||||
busStationBean.getSiteId(),
|
||||
@@ -790,6 +791,8 @@ public class OrderModel {
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
OchChainLogManager.writeChainLog("滑动出发成功", changeInfo,
|
||||
true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
isArrivedStation = false;
|
||||
CallerLogger.d(M_BUS + TAG, "行程日志-离站成功开往下一站====");
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
@@ -824,7 +827,7 @@ public class OrderModel {
|
||||
//车站10s后播报
|
||||
private void leaveTTSTips(String nextStation,String nextStationKr) {
|
||||
|
||||
UiThreadHandler.postDelayed(() -> VoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr),DELAY_10S);
|
||||
UiThreadHandler.postDelayed(() -> BusVoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr),DELAY_10S);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -971,8 +974,7 @@ public class OrderModel {
|
||||
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),
|
||||
tips,OCHSocketMessageManager.OPERATION_SYSTEM);
|
||||
//语音提示
|
||||
VoiceNotice.showNotice(tips);
|
||||
BusVoiceManager.INSTANCE.leafTime(tips);
|
||||
}
|
||||
|
||||
Runnable tip1Runnable = () -> {
|
||||
@@ -1084,7 +1086,7 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
private void ttsEndTask() {
|
||||
VoiceManager.INSTANCE.endOrderBus();
|
||||
BusVoiceManager.INSTANCE.endOrderBus();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1092,7 +1094,7 @@ public class OrderModel {
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
public void onArriveAt(MessagePad.ArrivalNotification data) {
|
||||
public void onArriveAt(ArrivedStation data,String type) {
|
||||
if (backgroundCurrentStationIndex + 1 > stationList.size() - 1) {
|
||||
CallerLogger.e(M_BUS + TAG, "行程日志-到站异常,取消后续操作结束");
|
||||
return;
|
||||
@@ -1125,7 +1127,7 @@ public class OrderModel {
|
||||
CallerLogger.d(M_BUS + TAG, "行程日志-当前==backgroundCurrentStationIndex="
|
||||
+ backgroundCurrentStationIndex);
|
||||
|
||||
arriveSiteStation();
|
||||
arriveSiteStation(type);
|
||||
}
|
||||
|
||||
public boolean isGoingToNextStation() {
|
||||
@@ -1133,6 +1135,10 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
public void sendWriteOffNumToClient(String msg){
|
||||
AppConnectMsg passengerMsg = new AppConnectMsg(false,true,msg,-1);
|
||||
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(passengerMsg).getBytes());
|
||||
}
|
||||
|
||||
// 车机端上传心跳数据(只在出车状态时上传)
|
||||
@@ -1261,6 +1267,26 @@ public class OrderModel {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setStation(){
|
||||
BusStationBean busStationBean = stationList.get(backgroundCurrentStationIndex);
|
||||
String nextStationName = "";
|
||||
String nextStationNameKr = "";
|
||||
MogoLocation nextStationPoint = new MogoLocation();
|
||||
if (backgroundCurrentStationIndex < stationList.size() - 1) {
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
nextStationName = nextStation.getName();
|
||||
nextStationNameKr = nextStation.getNameKr();
|
||||
nextStationPoint.setLongitude(nextStation.getGcjLon());
|
||||
nextStationPoint.setLatitude(nextStation.getGcjLat());
|
||||
}
|
||||
final String currentStationName = busStationBean.getName();
|
||||
String finalNextStationName = nextStationName;
|
||||
String finalNextStationNameKr = nextStationNameKr;
|
||||
MogoLocation currentStationPoint = new MogoLocation();
|
||||
currentStationPoint.setLongitude(busStationBean.getGcjLon());
|
||||
currentStationPoint.setLatitude(busStationBean.getGcjLat());
|
||||
}
|
||||
|
||||
public void setTrajectoryStation(MogoLocation startStation,MogoLocation endStation,Long lineId){
|
||||
TrajectoryAndDistanceManager.INSTANCE.setStationPoint(startStation,endStation,lineId);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ 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.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.och.bus.bean.*
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
@@ -330,15 +331,22 @@ object OrderServiceManager {
|
||||
lineId: Int,
|
||||
startSiteId: Int,
|
||||
endSiteId: Int,
|
||||
points: List<BusRoutePlanningUpdateReqBean.Result?>?,
|
||||
points: List<MogoLocation>,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
val pointsResult = mutableListOf<BusRoutePlanningUpdateReqBean.Result>()
|
||||
points.forEach {
|
||||
val result = BusRoutePlanningUpdateReqBean.Result()
|
||||
result.latitude = it.latitude;
|
||||
result.longitude = it.longitude;
|
||||
pointsResult.add(result);
|
||||
}
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, pointsResult
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
@@ -348,7 +356,7 @@ object OrderServiceManager {
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
SharedPrefsMgr.getInstance().sn, lineId, startSiteId, endSiteId, pointsResult
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
|
||||
@@ -10,8 +10,6 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
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;
|
||||
@@ -28,11 +26,15 @@ import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.fragment.BusFragment;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.bus.util.BusVoiceManager;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.autopilot.OchAutoPilotStatusListenerManager;
|
||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -47,7 +49,7 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
public class BusPresenter extends Presenter<BusFragment>
|
||||
implements IRefreshBusStationsCallback, ISlidePannelHideCallback
|
||||
, IMoGoAutopilotStatusListener, IBusControllerStatusCallback, ILoginCallback, IPassengerCallback, IBusADASStatusCallback {
|
||||
, IBusControllerStatusCallback, ILoginCallback, IPassengerCallback, IBusADASStatusCallback, IOchAutopilotStatusListener {
|
||||
|
||||
private static final String TAG = "BusPresenter";
|
||||
|
||||
@@ -57,7 +59,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public BusPresenter(BusFragment view) {
|
||||
super(view);
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
OchAutoPilotStatusListenerManager.INSTANCE.addListener(TAG,this);
|
||||
OrderModel.getInstance().init();
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
@@ -149,13 +151,17 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
public void onAutopilotArriveAtStation(ArrivedStation arrivedStation) {
|
||||
CallerLogger.e( M_BUS + TAG, "行程日志-onAutopilotArriveAtStation arrive");
|
||||
OrderModel.getInstance().onArriveAt(arrivalNotification);
|
||||
arriveStation(arrivedStation,"底盘触发进站");
|
||||
}
|
||||
|
||||
public void arriveStation(ArrivedStation arrivedStation,String type){
|
||||
OrderModel.getInstance().onArriveAt(arrivedStation,type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
public void onAutopilotSNRequest(@NonNull MessagePad.BasicInfoReq basicInfoReq) {
|
||||
|
||||
}
|
||||
|
||||
@@ -242,7 +248,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
public void onAutopilotIpcConnectStatusChanged(@NonNull AdasConstants.IpcConnectionStatus status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -279,13 +285,12 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void playPassenger(WriteOffPassenger passenger) {
|
||||
int passengerNum = passenger.passengerSize;
|
||||
if (passengerNum > 1){ //多人播报 "x人" ---》x人核验通过
|
||||
VoiceNotice.showNotice(passengerNum+"人核验通过", AIAssist.LEVEL3);
|
||||
OrderModel.getInstance().sendWriteOffNumToClient(passengerNum+"人核验通过");
|
||||
}else { //是 1 播放 "滴" 2022.11.09 改为: "核验通过"
|
||||
// mView.playDI();
|
||||
VoiceNotice.showNotice("核验通过", AIAssist.LEVEL3);
|
||||
OrderModel.getInstance().sendWriteOffNumToClient("核验通过");
|
||||
}
|
||||
BusVoiceManager.INSTANCE.writeOffCount(passengerNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,4 +302,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSsmReceiveTimeout(boolean isTimeout) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public class BDRouteDataTestUtils {
|
||||
builder.setLongitude(s.getDouble("lon"));
|
||||
list.add(builder.build());
|
||||
}
|
||||
OrderModel.getInstance().debugUpdateOrderRoute(list);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.tts.base.LangTtsEntity
|
||||
import com.mogo.tts.base.LanguageType
|
||||
import java.util.ArrayList
|
||||
|
||||
object BusVoiceManager {
|
||||
|
||||
fun writeOffCount(successNum:Int){
|
||||
if(successNum<=1){
|
||||
VoiceNotice.showNotice("核验通过", AIAssist.LEVEL3);
|
||||
}else{
|
||||
VoiceNotice.showNotice("$successNum 人核验通过", AIAssist.LEVEL3);
|
||||
}
|
||||
}
|
||||
|
||||
fun arrivedStationBus(siteNameCN: String?, siteNameKR: String?) {
|
||||
if (AppIdentityModeUtils.isM2(FunctionBuildConfig.appIdentityMode)) {
|
||||
return
|
||||
}
|
||||
val context = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
siteNameCN?.let {
|
||||
val chineseTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_arrived_station_tip, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_arrived_station_english_tip, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val koreanTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_arrived_station_korean_tip, siteNameKR?:it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
}
|
||||
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1,null)
|
||||
}
|
||||
|
||||
fun leaveStationBus(siteNameCN: String?, siteNameKR: String?) {
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val context = AbsMogoApplication.getApp()
|
||||
siteNameCN?.let {
|
||||
val chineseTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_leave_station_tip, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_leave_station_english_tip, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
|
||||
val koreanTTS = LangTtsEntity(
|
||||
context.getString(R.string.bus_leave_station_korean_tip, siteNameKR ?: it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(koreanTTS)
|
||||
}
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1,null)
|
||||
}
|
||||
|
||||
fun endOrderBus() {
|
||||
val context = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(context.getString(R.string.bus_end_task_tip), LanguageType.CHINESE)
|
||||
val engTTS = LangTtsEntity(context.getString(R.string.bus_end_task_english_tip), LanguageType.ENGLISH)
|
||||
val koreanTTS = LangTtsEntity(context.getString(R.string.bus_end_task_korean_tip), LanguageType.KOREAN)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0,null)
|
||||
}
|
||||
|
||||
fun leafTime(tips: String) {
|
||||
//语音提示
|
||||
VoiceNotice.showNotice(tips);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,9 +22,12 @@ import android.view.animation.DecelerateInterpolator;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ConvertUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager;
|
||||
|
||||
import me.jessyan.autosize.AutoSizeConfig;
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils;
|
||||
@@ -130,9 +133,13 @@ public class SlidePanelView extends View {
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
textPaint.setShader(textGradient);
|
||||
textPaint.getFontMetrics(blockTextMetrics);
|
||||
decodeImage();
|
||||
}
|
||||
|
||||
private void decodeImage(){
|
||||
ThreadUtils.getCpuPool().execute(() -> {
|
||||
int size = AutoSizeUtils.dp2px(getContext(), 120);
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options(); //todo yakun 优化
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inDensity = (int) AutoSizeConfig.getInstance().getInitDensity();
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.bus_base_slide_block,opts);
|
||||
bmBlock = Bitmap.createScaledBitmap(bmBlock, size, size, true);
|
||||
@@ -269,13 +276,24 @@ 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);
|
||||
if (bmBlock != null) {
|
||||
if(bmBlock.getByteCount()>=5*1024*1024){
|
||||
OchChainLogManager.writeChainLog("崩溃兜底策略",
|
||||
"图片大小监听"+ ConvertUtils.byte2FitMemorySize(bmBlock.getByteCount()),true,OchChainLogManager.EVENT_KEY_INFE_ERROR);
|
||||
bmBlock.recycle();
|
||||
bmBlock = null;
|
||||
blockWidth = 0;
|
||||
decodeImage();
|
||||
}else {
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
CallerLogger.d(TAG,"图片大小监听"+ ConvertUtils.byte2FitMemorySize(bmBlock.getByteCount()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface OnSlidePanelMoveToEndListener {
|
||||
|
||||
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
@@ -40,8 +40,11 @@
|
||||
|
||||
<string name="bus_no_task_tip">暂无任务</string>
|
||||
|
||||
<string name="bus_before_tips_s">距离发车时间还有%1$s分钟</string>
|
||||
|
||||
<string name="bus_pingxing_driver">平行驾驶</string>
|
||||
|
||||
|
||||
<!-- region tts -->
|
||||
<string name="bus_arrived_station_tip">已到达%1$s,带好随身物品,下车请注意安全。</string>
|
||||
<string name="bus_arrived_station_english_tip">We are arriving at %1$s ,get off with your belongings</string>
|
||||
<string name="bus_arrived_station_korean_tip">%1$s 역에 도착했습니다 , 소지품 챙겨서 내리세요</string>
|
||||
@@ -53,10 +56,6 @@
|
||||
<string name="bus_end_task_tip">感谢您体验\'蘑菇车联\'自动驾驶小巴车,我们下次再见。</string>
|
||||
<string name="bus_end_task_english_tip">Thank you for experiencing the self-driving minibus. See you next time</string>
|
||||
<string name="bus_end_task_korean_tip">자율주행 버스를 체험해 주셔서 감사합니다. 다음에 또 뵙겠습니다</string>
|
||||
<!-- endregion -->
|
||||
|
||||
<string name="bus_before_tips_s">距离发车时间还有%1$s分钟</string>
|
||||
|
||||
<string name="bus_pingxing_driver">平行驾驶</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
package com.mogo.och.bus.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
@@ -2,7 +2,7 @@ package com.mogo.och.bus.passenger.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
|
||||
@@ -31,7 +31,7 @@ object BusPassengerServiceManager {
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
val driverAppSn: String
|
||||
public val driverAppSn: String
|
||||
get() {
|
||||
val serverToken = getServerToken()
|
||||
if (serverToken != driverSnCache && serverToken.isNotEmpty()) {
|
||||
@@ -47,7 +47,7 @@ object BusPassengerServiceManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverSiteByCoordinate(
|
||||
context: Context, callback: OchCommonServiceCallback<BusPassengerRoutesResponse>?
|
||||
context: Context, callback: OchCommonServiceCallback<PM2RoutesResponse>?
|
||||
) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mBusPassengerSaasServiceApi.queryDriverSiteByCoordinate(
|
||||
@@ -2,7 +2,7 @@ package com.mogo.och.bus.passenger.network;
|
||||
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -17,7 +17,7 @@ import retrofit2.http.Query;
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
interface PassengerSAASServiceApi {
|
||||
public interface PassengerSAASServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
@@ -25,7 +25,7 @@ interface PassengerSAASServiceApi {
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
||||
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
|
||||
Observable<BusPassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
@@ -2,7 +2,7 @@ package com.mogo.och.bus.passenger.network;
|
||||
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -17,14 +17,14 @@ import retrofit2.http.Query;
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
interface PassengerServiceApi {
|
||||
public interface PassengerServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
||||
Observable<BusPassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
|
||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusPassengerRoutesResponse extends BaseData {
|
||||
private BusPassengerRoutesResult data;
|
||||
|
||||
public BusPassengerRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(BusPassengerRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusPassengerRoutesResult {
|
||||
private List<BusPassengerStation> 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<BusPassengerStation> getSites() {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getLineType() {
|
||||
return lineType;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getRunningDur() {
|
||||
return runningDur;
|
||||
}
|
||||
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusPassengerRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", runningDur='" + runningDur + '\'' +
|
||||
", taskTime=" + taskTime +
|
||||
", csvFileUrl='" + csvFileUrl + '\'' +
|
||||
", csvFileMd5='" + csvFileMd5 + '\'' +
|
||||
", txtFileUrl='" + txtFileUrl + '\'' +
|
||||
", txtFileMd5='" + txtFileMd5 + '\'' +
|
||||
", contrailSaveTime=" + contrailSaveTime +
|
||||
", carModel='" + carModel + '\'' +
|
||||
", csvFileUrlDPQP='" + csvFileUrlDPQP + '\'' +
|
||||
", csvFileMd5DPQP='" + csvFileMd5DPQP + '\'' +
|
||||
", txtFileUrlDPQP='" + txtFileUrlDPQP + '\'' +
|
||||
", txtFileMd5DPQP='" + txtFileMd5DPQP + '\'' +
|
||||
", contrailSaveTimeDPQP=" + contrailSaveTimeDPQP +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
BusPassengerRoutesResult that = (BusPassengerRoutesResult) o;
|
||||
return lineId == that.lineId
|
||||
&& lineType == that.lineType
|
||||
&& status == that.status
|
||||
&& sites.equals(that.sites)
|
||||
&& name.equals(that.name)
|
||||
&& runningDur.equals(that.runningDur);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sites, lineId, name, lineType, description, status, runningDur);
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.bean;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author wangmingjun
|
||||
*/
|
||||
public class BusPassengerStation {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String cityCode;
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private double gcjLon; //高德坐标
|
||||
private double gcjLat; //高德坐标
|
||||
private int businessType; //站点类型,9:taxi,10:bus
|
||||
private int status;
|
||||
private int siteId;
|
||||
private int seq;
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
|
||||
private boolean leaving;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setBusinessType(int businessType) {
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setIfStop(int ifStop) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusStation{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", businessType=" + businessType +
|
||||
", status=" + status +
|
||||
", siteId=" + siteId +
|
||||
", seq=" + seq +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", ifStop=" + ifStop +
|
||||
", leaving=" + leaving +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
BusPassengerStation that = (BusPassengerStation) o;
|
||||
return Double.compare(that.lon, lon) == 0
|
||||
&& Double.compare(that.lat, lat) == 0
|
||||
&& Double.compare(that.gcjLon, gcjLon) == 0
|
||||
&& Double.compare(that.gcjLat, gcjLat) == 0
|
||||
&& businessType == that.businessType
|
||||
&& status == that.status
|
||||
&& siteId == that.siteId
|
||||
&& seq == that.seq
|
||||
&& drivingStatus == that.drivingStatus
|
||||
&& ifStop == that.ifStop
|
||||
&& leaving == that.leaving
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(cityCode, that.cityCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, description, cityCode, lon, lat, gcjLon, gcjLat, businessType, status, siteId, seq, drivingStatus, ifStop, leaving);
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,6 @@ package com.mogo.och.bus.passenger.callback;
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface IBusPassengerADASStatusCallback {
|
||||
// 自动驾驶触发的已到达目的地:暂未用到
|
||||
void onAutopilotArriveEnd();
|
||||
|
||||
// 自动驾驶可用状态
|
||||
void onAutopilotEnable();
|
||||
|
||||
@@ -11,5 +11,4 @@ import java.util.List;
|
||||
public interface IBusPassengerAutopilotPlanningCallback {
|
||||
void routeResult(List<LatLng> routeArrivied, List<LatLng> routeArriving, MogoLocation location);
|
||||
void routePlanningToNextStationChanged(long meters, long timeInSecond);
|
||||
void updateTotalDistance();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface IBusPassengerRouteLineInfoCallback {
|
||||
void updateLineInfo(String lineName, String lineDurTime);
|
||||
void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex, boolean isArrived);
|
||||
void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived);
|
||||
void showNoTaskView();
|
||||
void hideNoTaskView();
|
||||
}
|
||||
|
||||
@@ -38,12 +38,9 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.callback.*
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager.driverAppSn
|
||||
import com.mogo.och.common.module.bean.dpmsg.AppConnectMsg
|
||||
@@ -61,14 +58,15 @@ import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceM
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.addTrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.setStationPoint
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.suspendCalculate
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.calculateRouteSumLength
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.getArrivedPointIndexNew
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad.ArrivalNotification
|
||||
import mogo.telematics.pad.MessagePad.GlobalPathResp
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
@@ -78,24 +76,21 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
object BusPassengerModel {
|
||||
|
||||
private val TAG = BusPassengerModel::class.java.simpleName
|
||||
private val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE"
|
||||
private const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
|
||||
private val mRoutePoints: MutableList<MogoLocation> = ArrayList()
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var mADASStatusCallback //Model->Presenter:自动驾驶状态相关
|
||||
: IBusPassengerADASStatusCallback? = null
|
||||
private var mAutopilotPlanningCallback //Model->Presenter:自动驾驶线路规划
|
||||
: IBusPassengerAutopilotPlanningCallback? = null
|
||||
private var mADASStatusCallback: IBusPassengerADASStatusCallback? =
|
||||
null//Model->Presenter:自动驾驶状态相关
|
||||
private var mAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback? =
|
||||
null//Model->Presenter:自动驾驶线路规划
|
||||
private val mControllerStatusCallbackMap: MutableMap<String, IBusPassengerControllerStatusCallback> =
|
||||
ConcurrentHashMap()
|
||||
private var mDriverStatusCallback //出车收车状态
|
||||
: IBusPassegerDriverStatusCallback? = null
|
||||
private var mRouteLineInfoCallback // bus路线信息更新
|
||||
: IBusPassengerRouteLineInfoCallback? = null
|
||||
private var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null//出车收车状态
|
||||
private var mRouteLineInfoCallback: IBusPassengerRouteLineInfoCallback? = null// bus路线信息更新
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var routesResult: BusPassengerRoutesResult? = null
|
||||
var mStations: MutableList<BusPassengerStation> = ArrayList()
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
var mStations: MutableList<BusStationBean> = ArrayList()
|
||||
private var mNextStationIndex = 0 // 要到达站的index
|
||||
private val mTwoStationsRouts: MutableList<MogoLocation> = ArrayList()
|
||||
private val handler = Handler(Looper.getMainLooper(), Handler.Callback { msg ->
|
||||
@@ -113,7 +108,10 @@ object BusPassengerModel {
|
||||
mContext = context.applicationContext
|
||||
initListeners()
|
||||
queryDriverOperationStatus()
|
||||
startOrStopOrderLoop(true)
|
||||
BizLoopManager.setLoopFunction(
|
||||
TAG_LOOP_QUERY_BIND_LINE,
|
||||
LoopInfo(2, ::queryDriverSiteByCoordinate, scheduler = Schedulers.io())
|
||||
)
|
||||
}
|
||||
|
||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
||||
@@ -163,10 +161,10 @@ object BusPassengerModel {
|
||||
})
|
||||
}
|
||||
|
||||
fun queryDriverSiteByCoordinate() {
|
||||
private fun queryDriverSiteByCoordinate() {
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(
|
||||
mContext!!, object : OchCommonServiceCallback<BusPassengerRoutesResponse> {
|
||||
override fun onSuccess(data: BusPassengerRoutesResponse) {
|
||||
mContext!!, object : OchCommonServiceCallback<PM2RoutesResponse> {
|
||||
override fun onSuccess(data: PM2RoutesResponse) {
|
||||
if (data.result == null) {
|
||||
d(M_BUS_P + TAG, "order = queryDriverSiteByCoordinate = null")
|
||||
if (routesResult != null) {
|
||||
@@ -175,7 +173,6 @@ object BusPassengerModel {
|
||||
}
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
mRouteLineInfoCallback?.showNoTaskView()
|
||||
mRoutePoints.clear()
|
||||
return
|
||||
}
|
||||
if (routesResult != null && data.result.equals(routesResult)) {
|
||||
@@ -207,7 +204,7 @@ object BusPassengerModel {
|
||||
})
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusPassengerRoutesResult) {
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult) {
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
d(
|
||||
M_BUS_P + TAG,
|
||||
@@ -255,7 +252,7 @@ object BusPassengerModel {
|
||||
}
|
||||
|
||||
private fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusPassengerRoutesResult,
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
@@ -273,7 +270,7 @@ object BusPassengerModel {
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(
|
||||
busRoutesResult: BusPassengerRoutesResult,
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
): AutopilotControlParameters? {
|
||||
if (busRoutesResult.sites == null) {
|
||||
@@ -311,7 +308,7 @@ object BusPassengerModel {
|
||||
fun release() {
|
||||
releaseListeners()
|
||||
cleanStation("release")
|
||||
startOrStopOrderLoop(false)
|
||||
BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE)
|
||||
}
|
||||
|
||||
fun setMoGoAutopilotPlanningListener(moGoAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback?) {
|
||||
@@ -346,10 +343,7 @@ object BusPassengerModel {
|
||||
mMogoStatusChangedListener
|
||||
)
|
||||
// 定位监听
|
||||
addListener(TAG, 10, mMapLocationListener)
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
addListener(TAG, 3, mMapLocationListener)
|
||||
|
||||
//监听司机端消息
|
||||
CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener)
|
||||
@@ -370,7 +364,6 @@ object BusPassengerModel {
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener)
|
||||
CallerPlanningRottingListenerManager.removeListener(moGoAutopilotPlanningListener)
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
stopLoopAbnormalFactors()
|
||||
}
|
||||
@@ -474,8 +467,10 @@ object BusPassengerModel {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
mLocation = mogoLocation
|
||||
for (callback in mControllerStatusCallbackMap.values) {
|
||||
callback.onCarLocationChanged(mogoLocation)
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
for (callback in mControllerStatusCallbackMap.values) {
|
||||
callback.onCarLocationChanged(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,86 +508,12 @@ object BusPassengerModel {
|
||||
) {
|
||||
arriveAtEnd = true
|
||||
}
|
||||
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// ToastUtils.showShort("到达目的地")
|
||||
// }
|
||||
mADASStatusCallback?.onAutopilotArriveEnd()
|
||||
}
|
||||
}
|
||||
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
|
||||
object : IMoGoPlanningRottingListener {
|
||||
override fun onAutopilotRotting(globalPathResp: GlobalPathResp?) {
|
||||
globalPathResp?.wayPointsList?.let {
|
||||
if (it.size > 0) {
|
||||
d(M_BUS_P + TAG, "收到轨迹:${it.size}--第一个点${it[0]}--最后一个点:${it.last()}")
|
||||
updateRoutePoints(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateRoutePoints(routePoints: List<MessagePad.Location>) {
|
||||
mRoutePoints.clear()
|
||||
val latLngModels: List<MogoLocation> =
|
||||
coordinateConverterWgsToGcjLocations(mContext, routePoints)
|
||||
mRoutePoints.addAll(latLngModels)
|
||||
calculateTwoStationsRoute()
|
||||
}
|
||||
|
||||
private fun calculateTwoStationsRoute() {
|
||||
//找出前往站对应的轨迹点,拿出两站点的集合
|
||||
d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size)
|
||||
if (mRoutePoints.size > 0) {
|
||||
if (mStations.size > 1) { //两个站点及以上要计算两个站点间的轨迹路线
|
||||
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex - 1 >= 0) {
|
||||
mTwoStationsRouts.clear()
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
val stationCur = mStations[mNextStationIndex - 1]
|
||||
//当前站在轨迹中对应的点
|
||||
val currentRouteIndex = getArrivedPointIndexNew(
|
||||
0, mRoutePoints, stationCur.gcjLon, stationCur.gcjLat
|
||||
)
|
||||
//要前往的站在轨迹中对应的点
|
||||
val nextRouteIndex = getArrivedPointIndexNew(
|
||||
currentRouteIndex, mRoutePoints, stationNext.gcjLon, stationNext.gcjLat
|
||||
)
|
||||
d(
|
||||
M_BUS_P + TAG,
|
||||
"轨迹排查==currentRouteIndex = " + currentRouteIndex
|
||||
+ ", nextRouteIndex = " + nextRouteIndex
|
||||
)
|
||||
if (currentRouteIndex < nextRouteIndex) { //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示
|
||||
mTwoStationsRouts.addAll(
|
||||
mRoutePoints.subList(
|
||||
currentRouteIndex,
|
||||
nextRouteIndex + 1
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mTwoStationsRouts.size > 0) {
|
||||
val sumLength = calculateRouteSumLength(mTwoStationsRouts)
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS, sumLength.toInt())
|
||||
mAutopilotPlanningCallback?.updateTotalDistance()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun startOrStopOrderLoop(start: Boolean) {
|
||||
d(M_BUS_P + TAG, "startOrStopOrderLoop() $start")
|
||||
if (start) {
|
||||
BusPassengerModelLoopManager.getInstance().startQueryDriverLineLoop()
|
||||
} else {
|
||||
BusPassengerModelLoopManager.getInstance().stopQueryDriverLineLoop()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusPassengerStation,
|
||||
endStationInfo: BusPassengerStation,
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
val startStation = MogoLocation()
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.network;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.passenger.model.BusPassengerModel;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_DELAY;
|
||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_LINE_2S;
|
||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_LINE_1S;
|
||||
|
||||
/**
|
||||
* Created on 2021/11/22
|
||||
*
|
||||
* 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等)
|
||||
*/
|
||||
public class BusPassengerModelLoopManager {
|
||||
|
||||
private static final String TAG = BusPassengerModelLoopManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerModelLoopManager INSTANCE = new BusPassengerModelLoopManager();
|
||||
}
|
||||
|
||||
public static BusPassengerModelLoopManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Disposable mQueryLineDisposable; //心跳轮询
|
||||
|
||||
public void startQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null && !mQueryLineDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.i(M_BUS_P + TAG, "startQueryDriverLineLoop()");
|
||||
mQueryLineDisposable = Observable.interval(LOOP_DELAY,
|
||||
LOOP_LINE_2S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> BusPassengerModel.INSTANCE.queryDriverSiteByCoordinate());
|
||||
}
|
||||
|
||||
public void stopQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null) {
|
||||
CallerLogger.i(M_BUS_P + TAG, "stopQueryDriverLineLoop()");
|
||||
mQueryLineDisposable.dispose();
|
||||
mQueryLineDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
@@ -80,12 +79,6 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
// mView.showOverviewFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
@@ -137,7 +130,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex, boolean isArrived) {
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived));
|
||||
}
|
||||
|
||||
@@ -161,8 +154,4 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
runOnUIThread(() -> mView.updateRoutePlanningToNextStation(meters, timeInSecond));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTotalDistance() {
|
||||
// runOnUIThread(() -> mView.setProgressBarMax());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,19 @@ package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import android.annotation.*
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
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.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import kotlinx.android.synthetic.main.p_bus_view_status_bar.view.tv_bus_b1_p_version
|
||||
import kotlinx.coroutines.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -38,6 +35,8 @@ class BusPStatusBarView @JvmOverloads constructor(
|
||||
setBackgroundResource(R.drawable.bg_status_bar)
|
||||
isClickable = true
|
||||
isFocusable = true
|
||||
|
||||
tv_bus_b1_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,334 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import com.amap.api.maps.AMap
|
||||
import com.amap.api.maps.CameraUpdateFactory
|
||||
import com.amap.api.maps.TextureMapView
|
||||
import com.amap.api.maps.model.BitmapDescriptor
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory
|
||||
import com.amap.api.maps.model.CameraPosition
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.amap.api.maps.model.LatLngBounds
|
||||
import com.amap.api.maps.model.Marker
|
||||
import com.amap.api.maps.model.MarkerOptions
|
||||
import com.amap.api.maps.model.Polyline
|
||||
import com.amap.api.maps.model.PolylineOptions
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.utils.BusPassengerMapAssetStyleUtil
|
||||
|
||||
/**
|
||||
* 乘客屏小地图
|
||||
*/
|
||||
class BusPassengerMapDirectionView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
|
||||
IBusPassengerMapDirectionView, AMap.OnCameraChangeListener {
|
||||
|
||||
companion object {
|
||||
//小地图名称
|
||||
const val TAG = "BusPassengerMapDirectionView"
|
||||
}
|
||||
|
||||
private lateinit var mAMapNaviView: TextureMapView
|
||||
private lateinit var mAMap: AMap
|
||||
private var mPolyline: Polyline? = null
|
||||
private val mLineMarkers: MutableList<Marker> = ArrayList()
|
||||
private lateinit var mCarMarker: Marker
|
||||
|
||||
private val mLineStationLatLng: MutableList<LatLng> = ArrayList() //站点坐标数据
|
||||
var textureList: MutableList<BitmapDescriptor?> = ArrayList()
|
||||
var texIndexList: MutableList<Int> = ArrayList()
|
||||
private var mArrivedRes: BitmapDescriptor? = null
|
||||
private var mUnArrivedRes: BitmapDescriptor? = null
|
||||
|
||||
private val routeArrived: MutableList<LatLng> = ArrayList()
|
||||
private val routeArriving: MutableList<LatLng> = ArrayList()
|
||||
private var location: MogoLocation? = null
|
||||
|
||||
init {
|
||||
try {
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
d(M_BUS_P + TAG, "initView")
|
||||
val smpView = LayoutInflater.from(context).inflate(R.layout.bus_p_map_view, this)
|
||||
mAMapNaviView = smpView.findViewById<View>(R.id.bus_p_line_amap_view) as TextureMapView
|
||||
initAMapView()
|
||||
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
private fun initAMapView() {
|
||||
mAMap = mAMapNaviView.map
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.mapType = AMap.MAP_TYPE_NIGHT
|
||||
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.isTrafficEnabled = false
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_car)).anchor(0.5f, 0.5f))
|
||||
mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_arrived)
|
||||
mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_un_arrive)
|
||||
|
||||
// 加载自定义样式
|
||||
val customMapStyleOptions = CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(
|
||||
BusPassengerMapAssetStyleUtil.getAssetsStyle(
|
||||
context, "map_style.data"
|
||||
)
|
||||
)
|
||||
.setStyleExtraData(
|
||||
BusPassengerMapAssetStyleUtil.getAssetsExtraStyle(
|
||||
context, "map_style_extra.data"
|
||||
)
|
||||
)
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions)
|
||||
|
||||
// 设置地图的样式
|
||||
mAMap.uiSettings.apply {
|
||||
isZoomControlsEnabled = false // 地图缩放级别的交换按钮
|
||||
setAllGesturesEnabled(true) // 所有手势
|
||||
isMyLocationButtonEnabled = false // 显示默认的定位按钮
|
||||
setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
}
|
||||
|
||||
mAMap.setOnMapLoadedListener {
|
||||
d(M_BUS_P + TAG, "smp---onMapLoaded")
|
||||
// 加载自定义样式
|
||||
val options = CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(
|
||||
BusPassengerMapAssetStyleUtil.getAssetsStyle(
|
||||
context, "map_style.data"
|
||||
)
|
||||
)
|
||||
.setStyleExtraData(
|
||||
BusPassengerMapAssetStyleUtil.getAssetsExtraStyle(
|
||||
context, "map_style_extra.data"
|
||||
)
|
||||
)
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(options)
|
||||
mAMapNaviView.map.setPointToCenter(
|
||||
mAMapNaviView.width / 2,
|
||||
mAMapNaviView.height / 2
|
||||
)
|
||||
}
|
||||
|
||||
//设置地图状态的监听接口
|
||||
mAMap.setOnCameraChangeListener(this)
|
||||
}
|
||||
|
||||
// override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
// return true
|
||||
// }
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (mogoLocation == null) {
|
||||
return
|
||||
}
|
||||
val currentLatLng = LatLng(mogoLocation.latitude, mogoLocation.longitude)
|
||||
|
||||
//更新车辆位置
|
||||
mCarMarker.rotateAngle = (360 - mogoLocation.heading).toFloat()
|
||||
mCarMarker.position = currentLatLng
|
||||
mCarMarker.setToTop()
|
||||
try {
|
||||
//圈定地图显示范围
|
||||
val boundsBuilder = LatLngBounds.Builder()
|
||||
routeArrived.forEach {
|
||||
boundsBuilder.include(it)
|
||||
}
|
||||
routeArriving.forEach {
|
||||
boundsBuilder.include(it)
|
||||
}
|
||||
mLineStationLatLng.forEach {
|
||||
boundsBuilder.include(it)
|
||||
}
|
||||
boundsBuilder.include(currentLatLng)
|
||||
mAMap.moveCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect(
|
||||
boundsBuilder.build(),
|
||||
100,
|
||||
100,
|
||||
100,
|
||||
100
|
||||
)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun drawablePolyline() {
|
||||
if (routeArrived.isEmpty() && routeArriving.isEmpty()) {
|
||||
d(SceneConstant.M_TAXI + TAG, "没有点")
|
||||
return
|
||||
}
|
||||
try {
|
||||
texIndexList.clear()
|
||||
val allPoints = ArrayList(routeArrived)
|
||||
for (i in routeArrived.indices) {
|
||||
if (routeArrived.size > 1 && i < routeArrived.size - 1) {
|
||||
texIndexList.add(0)
|
||||
}
|
||||
}
|
||||
texIndexList.add(0)
|
||||
location?.let {
|
||||
allPoints.add(LatLng(it.latitude, it.longitude))
|
||||
}
|
||||
allPoints.addAll(routeArriving)
|
||||
for (ignored in routeArrived) {
|
||||
texIndexList.add(1)
|
||||
}
|
||||
mPolyline?.let {
|
||||
it.points = allPoints
|
||||
it.options.customTextureIndex = texIndexList
|
||||
return
|
||||
}
|
||||
if(textureList.isEmpty()) {
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
}
|
||||
//设置线段纹理
|
||||
val polylineOptions = PolylineOptions().apply {
|
||||
addAll(allPoints)
|
||||
isUseTexture = true
|
||||
width(15f)
|
||||
lineCapType(PolylineOptions.LineCapType.LineCapRound)
|
||||
customTextureList = textureList
|
||||
customTextureIndex = texIndexList
|
||||
}
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun clearPolyline() {
|
||||
mPolyline?.remove()
|
||||
mPolyline = null
|
||||
}
|
||||
|
||||
override fun setLineMarker() {}
|
||||
|
||||
fun clearCoordinatesLatLng() {
|
||||
textureList.clear()
|
||||
texIndexList.clear()
|
||||
routeArrived.clear()
|
||||
routeArriving.clear()
|
||||
mLineStationLatLng.clear()
|
||||
d(M_BUS_P + TAG, " mCoordinatesLatLng.clear ")
|
||||
}
|
||||
|
||||
fun onCreateView(savedInstanceState: Bundle?) {
|
||||
mAMapNaviView.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
mAMapNaviView.onResume()
|
||||
}
|
||||
|
||||
fun onPause() {
|
||||
mAMapNaviView.onPause()
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
mAMapNaviView.onDestroy()
|
||||
}
|
||||
|
||||
fun setCoordinatesLatLng(
|
||||
routeArrived: List<LatLng>,
|
||||
routeArriving: List<LatLng>,
|
||||
location: MogoLocation?
|
||||
) {
|
||||
this.routeArrived.clear()
|
||||
this.routeArrived.addAll(routeArrived)
|
||||
this.routeArriving.clear()
|
||||
this.routeArriving.addAll(routeArriving)
|
||||
this.location = location
|
||||
}
|
||||
|
||||
fun clearLineMarkers() {
|
||||
for (i in mLineMarkers.indices) {
|
||||
mLineMarkers[i].isVisible = false
|
||||
mLineMarkers[i].remove()
|
||||
}
|
||||
mLineMarkers.clear()
|
||||
}
|
||||
|
||||
fun setLinePointMarkerAndDraw(mLineStationsList: List<LatLng>, currentIndex: Int) {
|
||||
clearLineMarkers()
|
||||
mLineStationLatLng.clear()
|
||||
mLineStationLatLng.addAll(mLineStationsList)
|
||||
if (mLineStationsList.isNotEmpty()) {
|
||||
// 起点marker, 终点marker, 过站marker, 未过站marker
|
||||
val size = mLineStationsList.size
|
||||
val mStartMarker = mAMap.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_start_point))
|
||||
)
|
||||
val mEndMarker = mAMap.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_end_point))
|
||||
)
|
||||
mStartMarker.position = mLineStationsList[0]
|
||||
mLineMarkers.add(0, mStartMarker)
|
||||
for (i in mLineStationsList.indices) {
|
||||
if (currentIndex <= i && i < size - 1 && i > 0) { //未到达
|
||||
val unArrivedMarker = mAMap.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_unarrived_point))
|
||||
)
|
||||
unArrivedMarker.position = mLineStationsList[i]
|
||||
mLineMarkers.add(i, unArrivedMarker)
|
||||
} else if (i in 1 until currentIndex) {
|
||||
val arrivedMarker = mAMap.addMarker(
|
||||
MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrived_point))
|
||||
)
|
||||
arrivedMarker.position = mLineStationsList[i]
|
||||
mLineMarkers.add(i, arrivedMarker)
|
||||
}
|
||||
}
|
||||
mEndMarker.position = mLineStationsList[size - 1]
|
||||
mLineMarkers.add(size - 1, mEndMarker)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCameraChange(cameraPosition: CameraPosition) {
|
||||
}
|
||||
|
||||
override fun onCameraChangeFinish(cameraPosition: CameraPosition) {}
|
||||
|
||||
}
|
||||
@@ -16,21 +16,20 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DriverMonitorView;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.adapter.BusPassengerLineStationsAdapter;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.bus.passenger.ui.adapter.BusPassengerLineStationsAdapter;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
|
||||
import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager;
|
||||
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.common.module.wigets.mapdirectionview.MapDirectionView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -44,14 +43,14 @@ public class BusPassengerRouteFragment extends
|
||||
|
||||
public static final String TAG = "BusPassengerRouteFragment";
|
||||
|
||||
private final List<BusPassengerStation> mStationsList = new ArrayList<>();
|
||||
private final List<BusStationBean> mStationsList = new ArrayList<>();
|
||||
|
||||
private OCHGradientTextView mSpeedTv;
|
||||
private ConstraintLayout mNoLineInfoView;
|
||||
private MarqueeTextView mLineName;
|
||||
private Group mRouteInfoView;
|
||||
private RecyclerView mStationsListRv;
|
||||
private BusPassengerMapDirectionView mMapDirectionView;
|
||||
private MapDirectionView mMapDirectionView;
|
||||
private BusPassengerLineStationsAdapter mAdapter;
|
||||
private TextView emptyTv;
|
||||
private AppCompatImageView mAutopilotIv;
|
||||
@@ -129,17 +128,6 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
});
|
||||
|
||||
//测试
|
||||
if (DebugConfig.isDebug()){
|
||||
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
BPRouteDataTestUtils.converToRouteData();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mapAndLiveVideoView = findViewById(R.id.mapAndLiveVideoView);
|
||||
|
||||
initLiveView();
|
||||
@@ -324,7 +312,7 @@ public class BusPassengerRouteFragment extends
|
||||
* @param currentStationIndex
|
||||
* @param isArrived 是否到站并离开,true 到达当前站 currentStationIndex 未离开, false 正在前往此站 currentStationIndex
|
||||
*/
|
||||
public void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex, boolean isArrived) {
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived);
|
||||
mStationsList.clear();
|
||||
mStationsList.addAll(stations);
|
||||
@@ -345,7 +333,7 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWayPointList(List<BusPassengerStation> stations,int currentStationIndex) {
|
||||
private void updateWayPointList(List<BusStationBean> stations,int currentStationIndex) {
|
||||
List<LatLng> mLineStationsList = new ArrayList<>();
|
||||
for (int i = 0; i< stations.size(); i++) {//站点集合
|
||||
LatLng latLng = new LatLng(stations.get(i).getGcjLat(),stations.get(i).getGcjLon());// lat,lon
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.adapter;
|
||||
package com.mogo.och.bus.passenger.ui.adapter;
|
||||
|
||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_LEAVING;
|
||||
@@ -16,9 +16,9 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,9 +29,9 @@ import java.util.List;
|
||||
public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<BusPassengerStation> mStations;
|
||||
private List<BusStationBean> mStations;
|
||||
|
||||
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
|
||||
public BusPassengerLineStationsAdapter(Context context, List<BusStationBean> stations){
|
||||
this.mContext = context;
|
||||
this.mStations = stations;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
BusPassengerStation station = mStations.get(position);
|
||||
BusStationBean station = mStations.get(position);
|
||||
StationViewHolder viewHolder = (StationViewHolder)holder;
|
||||
viewHolder.stationName.setText(station.getName());
|
||||
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
|
||||
@@ -68,7 +68,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
}else{
|
||||
viewHolder.curArrowBg.setVisibility(View.VISIBLE);
|
||||
viewHolder.curArrowBottomBg.setVisibility(View.VISIBLE);
|
||||
BusPassengerStation preStation = mStations.get(position -1);
|
||||
BusStationBean preStation = mStations.get(position -1);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_LEAVING ||
|
||||
(station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_clock_992D3E5F));
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态返回参数
|
||||
*/
|
||||
public class PM2OperationStatusResponse extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
private String sn; //司机屏sn
|
||||
private String phone; //司机手机号
|
||||
public String plateNumber; //车牌号
|
||||
public int driverStatus;//0:已收车,1:已出车
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 根据车机行驶线路站点信息
|
||||
*/
|
||||
class PM2QueryLineRequest {
|
||||
|
||||
private String sn;
|
||||
public PM2QueryLineRequest(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class PM2RoutesResult {
|
||||
private List<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);
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.bean;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author wangmingjun
|
||||
*/
|
||||
public class PM2Station {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String cityCode;
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private double gcjLon; //高德坐标
|
||||
private double gcjLat; //高德坐标
|
||||
private int businessType; //站点类型,9:taxi,10:bus
|
||||
private int status;
|
||||
private int siteId;
|
||||
private int seq;
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
|
||||
private boolean leaving;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setBusinessType(int businessType) {
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setIfStop(int ifStop) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusStation{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", businessType=" + businessType +
|
||||
", status=" + status +
|
||||
", siteId=" + siteId +
|
||||
", seq=" + seq +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", ifStop=" + ifStop +
|
||||
", leaving=" + leaving +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PM2Station that = (PM2Station) o;
|
||||
return Double.compare(that.lon, lon) == 0
|
||||
&& Double.compare(that.lat, lat) == 0
|
||||
&& Double.compare(that.gcjLon, gcjLon) == 0
|
||||
&& Double.compare(that.gcjLat, gcjLat) == 0
|
||||
&& businessType == that.businessType
|
||||
&& status == that.status
|
||||
&& siteId == that.siteId
|
||||
&& seq == that.seq
|
||||
&& drivingStatus == that.drivingStatus
|
||||
&& ifStop == that.ifStop
|
||||
&& leaving == that.leaving
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(cityCode, that.cityCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, description, cityCode, lon, lat, gcjLon, gcjLat, businessType, status, siteId, seq, drivingStatus, ifStop, leaving);
|
||||
}
|
||||
}
|
||||
@@ -16,40 +16,37 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.sendMsgToServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.passenger.callback.AutoPilotStatusCallback
|
||||
import com.mogo.och.bus.passenger.passenger.callback.DrivingInfoCallback
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2ServiceManager.driverAppSn
|
||||
import com.mogo.och.bus.passenger.passenger.network.PM2ModelLoopManager
|
||||
import com.mogo.och.common.module.bean.dpmsg.*
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.pushAppOperationalMsgBox
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import io.reactivex.disposables.Disposable
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
|
||||
import com.mogo.och.common.module.manager.distancemamager.IDistanceListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
@@ -64,23 +61,14 @@ class PM2DrivingModel private constructor() {
|
||||
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 var operationStatus: BusPassengerOperationStatusResponse.Result? = null
|
||||
|
||||
private val handler = Handler(Handler.Callback { msg ->
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
@@ -92,18 +80,22 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
companion object {
|
||||
val TAG = PM2DrivingModel::class.java.simpleName
|
||||
val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE"
|
||||
const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
val INSTANCE: PM2DrivingModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
PM2DrivingModel()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context : Context){
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
initListener()
|
||||
queryDriverByLocalDriver()
|
||||
queryDriverOperationStatus()
|
||||
startOrStopOrderLoop(true)
|
||||
BizLoopManager.setLoopFunction(
|
||||
TAG_LOOP_QUERY_BIND_LINE,
|
||||
LoopInfo(2, ::queryDriverSiteByCoordinate)
|
||||
)
|
||||
}
|
||||
|
||||
private fun queryDriverByLocalDriver() {
|
||||
@@ -117,17 +109,16 @@ class PM2DrivingModel private constructor() {
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
|
||||
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10,mMapLocationListener)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 3, mMapLocationListener)
|
||||
|
||||
//司乘屏通信监听
|
||||
CallerTelematicListenerManager.addListener(TAG,mReceivedMsgListener)
|
||||
|
||||
//自动驾驶轨迹监听
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener)
|
||||
|
||||
//网络监听
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
IntentManager.getInstance()
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
}
|
||||
|
||||
private fun sendMsgToServer(msg: String) {
|
||||
@@ -137,7 +128,7 @@ class PM2DrivingModel private constructor() {
|
||||
)
|
||||
}
|
||||
|
||||
fun releaseListener(){
|
||||
fun releaseListener() {
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
|
||||
@@ -146,64 +137,67 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
|
||||
//自动驾驶轨迹监听
|
||||
CallerPlanningRottingListenerManager.removeListener(TAG)
|
||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||
|
||||
BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE)
|
||||
|
||||
cleanStation("release")
|
||||
}
|
||||
|
||||
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){
|
||||
fun setDrivingInfoCallback(drivingInfoCallback: DrivingInfoCallback?) {
|
||||
mDrivingInfoCallback = drivingInfoCallback
|
||||
}
|
||||
|
||||
fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?){
|
||||
fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?) {
|
||||
mAutoStatusCallback = autoPilotStatusCallback
|
||||
}
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mReceivedMsgListener: IReceivedMsgListener =
|
||||
object : IReceivedMsgListener{
|
||||
object : IReceivedMsgListener {
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息
|
||||
if (OchCommonConst.BUSINESS_STRING == type){
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
|
||||
Logger.d(
|
||||
SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg)
|
||||
M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg)
|
||||
)
|
||||
|
||||
if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), AppConnectMsg::class.java)
|
||||
|
||||
if (msg != null && msg.isPlay){ //播报
|
||||
if (msg != null && msg.isPlay) { //播报
|
||||
speakTTS(msg.msg)
|
||||
}
|
||||
|
||||
if (msg != null && msg.isViewShow) { //消息盒子显示内容
|
||||
pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),msg.msg)
|
||||
pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(), msg.msg
|
||||
)
|
||||
}
|
||||
}else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) {
|
||||
} else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), TaskDetailsMsg::class.java)
|
||||
Logger.d(
|
||||
SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg)
|
||||
)
|
||||
Logger.d(M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg))
|
||||
if (msg == null || msg.msg?.isEmpty() == true) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(msg.msg, BusTransferData::class.java)
|
||||
mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1)
|
||||
if (result != null && result.routesResult == null){
|
||||
if (result != null && result.routesResult == null) {
|
||||
updateLocalOrder()
|
||||
}
|
||||
|
||||
if (routesResult == null ||
|
||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)) {
|
||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)
|
||||
) {
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult!!)
|
||||
}
|
||||
@@ -216,80 +210,60 @@ class PM2DrivingModel private constructor() {
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun speakTTS(msg: String) {
|
||||
|
||||
var mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
var mAudioAttributes = AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型
|
||||
.build()
|
||||
var mAudioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型
|
||||
.setAudioAttributes(mAudioAttributes) //设置声音属性
|
||||
.setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取
|
||||
val mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
val mAudioAttributes = AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型
|
||||
.build()
|
||||
val mAudioFocusRequest =
|
||||
AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型
|
||||
.setAudioAttributes(mAudioAttributes) //设置声音属性
|
||||
.setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取
|
||||
.build()
|
||||
mAudioManager.requestAudioFocus(mAudioFocusRequest) //抢占焦点
|
||||
|
||||
AIAssist.getInstance(mContext).speakTTSVoiceWithLevel(msg,AIAssist.LEVEL0,object : IMogoVoiceCmdCallBack{
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
AIAssist.getInstance(mContext)
|
||||
.speakTTSVoiceWithLevel(msg, AIAssist.LEVEL0, object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakError(speakText: String?, errorMsg: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
override fun onSpeakError(speakText: String?, errorMsg: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(M_BUS_P + TAG, "轨迹排查==lastSumLength = $distance")
|
||||
if (routesResult != null) {
|
||||
for (site in routesResult!!.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
mDrivingInfoCallback?.updateRemainMT(distance.toLong(), lastTime.toLong())
|
||||
}
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener{
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
mLocation = mogoLocation
|
||||
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)
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
updateSpeed(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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()
|
||||
@@ -302,17 +276,18 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
d(SceneConstant.M_BUS_P+ TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||
d(M_BUS_P + TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) {
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation){
|
||||
mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation
|
||||
) {
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}else{//非美化模式下
|
||||
} else {//非美化模式下
|
||||
mAutoStatusCallback?.updateAutoStatus(false)
|
||||
}
|
||||
}else{//自驾状态 2
|
||||
} else {//自驾状态 2
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}
|
||||
}
|
||||
@@ -328,22 +303,21 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
mContext?.let {
|
||||
PM2ServiceManager.queryDriverOperationStatus(
|
||||
BusPassengerServiceManager.queryDriverOperationStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<PM2OperationStatusResponse> {
|
||||
override fun onSuccess(data: PM2OperationStatusResponse?) {
|
||||
object : OchCommonServiceCallback<BusPassengerOperationStatusResponse> {
|
||||
override fun onSuccess(data: BusPassengerOperationStatusResponse?) {
|
||||
if (data?.data == null) return
|
||||
if (data.data.driverStatus != operationStatus?.driverStatus
|
||||
|| data.data.plateNumber != operationStatus?.plateNumber
|
||||
) {
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
M_BUS_P + TAG,
|
||||
"queryDriverOperationStatus ===== 车牌或者登陆状态有变更"
|
||||
)
|
||||
mDrivingInfoCallback?.changeOperationStatus(data.data.driverStatus == 1)
|
||||
}
|
||||
operationStatus = data.data as PM2OperationStatusResponse.Result
|
||||
// mDrivingInfoCallback?.updatePlateNumber(data.data.plateNumber)
|
||||
operationStatus = data.data as BusPassengerOperationStatusResponse.Result
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
@@ -352,7 +326,6 @@ class PM2DrivingModel private constructor() {
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
// queryDriverOperationDelay()
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
@@ -364,9 +337,9 @@ class PM2DrivingModel private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
fun queryDriverSiteByCoordinate(){
|
||||
private fun queryDriverSiteByCoordinate() {
|
||||
mContext?.let {
|
||||
PM2ServiceManager.queryDriverSiteByCoordinate(it,
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PM2RoutesResponse> {
|
||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
||||
|
||||
@@ -374,19 +347,13 @@ class PM2DrivingModel private constructor() {
|
||||
if (routesResult != null) {
|
||||
routesResult = null
|
||||
updateLocalOrder()
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate= result is null"
|
||||
)
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= result is null")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
if (data.result != null && data.result.equals(routesResult)) {
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate= not update"
|
||||
)
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= not update")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -403,26 +370,22 @@ class PM2DrivingModel private constructor() {
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate = onError ="
|
||||
+ ", sn = " + driverAppSn
|
||||
)
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = onError = sn = " + BusPassengerServiceManager.driverAppSn)
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
if (code == 1003) {
|
||||
queryDriverOperationDelay()
|
||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
||||
}
|
||||
if (driverAppSn.isEmpty()) {
|
||||
if (BusPassengerServiceManager.driverAppSn.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
routesResult = null
|
||||
isGoingToNextStation = false
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -431,208 +394,91 @@ class PM2DrivingModel private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLocalOrder(){
|
||||
private fun updateLocalOrder() {
|
||||
mRoutePoints.clear()
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
isGoingToNextStation = false
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
mDrivingInfoCallback?.showNoTaskView(true)
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult) {
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
||||
|
||||
if (result == null) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId){
|
||||
d(SceneConstant.M_BUS_P+ TAG, "lineId change= clearCustomPolyline")
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId) {
|
||||
d(M_BUS_P + TAG, "lineId change= clearCustomPolyline")
|
||||
mDrivingInfoCallback?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
d(SceneConstant.M_BUS_P+ TAG, "queryDriverSiteByCoordinate= update")
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= update")
|
||||
routesResult = result
|
||||
|
||||
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
|
||||
if (result.sites != null) {
|
||||
mDrivingInfoCallback?.showNoTaskView(false)
|
||||
val stations: List<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
|
||||
)
|
||||
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(M_BUS_P + TAG, "och-rotting--mNextStationIndex = $mNextStationIndex , i = $i")
|
||||
d(M_BUS_P + TAG, "och-rotting--start ")
|
||||
isGoingToNextStation = true
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
d(M_BUS_P + TAG, "och-rotting--mNextStationIndex = $mNextStationIndex , i = $i")
|
||||
d(M_BUS_P + TAG, "och-rotting--arrived ")
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
mDrivingInfoCallback?.updateStationsInfo(
|
||||
stations as MutableList<BusStationBean>,
|
||||
i,
|
||||
true
|
||||
)
|
||||
return
|
||||
} else {
|
||||
CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints)
|
||||
}
|
||||
val lastTime = lastSumLength / BusPassengerConst.SHUTTLE_AVERAGE_SPEED * 3.6 //秒
|
||||
d(SceneConstant.M_BUS_P + TAG, "och-rotting==lastSumLength = $lastSumLength")
|
||||
mDrivingInfoCallback?.updateRemainMT(
|
||||
lastSumLength.toLong(),
|
||||
lastTime.toLong()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun calculateTwoStationsRoute() {
|
||||
//找出前往站对应的轨迹点,拿出两站点的集合
|
||||
d(SceneConstant.M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size)
|
||||
if (mRoutePoints.size > 0) {
|
||||
if (mStations.size > 1) { //两个站点及以上要计算两个站点间的轨迹路线
|
||||
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex - 1 >= 0) {
|
||||
mTwoStationsRouts.clear()
|
||||
val stationNext: BusStationBean = mStations[mNextStationIndex]
|
||||
val stationCur: BusStationBean = mStations[mNextStationIndex - 1]
|
||||
//当前站在轨迹中对应的点
|
||||
val currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(
|
||||
0, mRoutePoints, stationCur.gcjLon, stationCur.gcjLat
|
||||
)
|
||||
//要前往的站在轨迹中对应的点
|
||||
val nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(
|
||||
currentRouteIndex,
|
||||
mRoutePoints,
|
||||
stationNext.gcjLon,
|
||||
stationNext.gcjLat
|
||||
)
|
||||
|
||||
d(SceneConstant.M_BUS_P + TAG, "och-rotting==currentRouteIndex = " + currentRouteIndex
|
||||
+ ", nextRouteIndex = " + nextRouteIndex)
|
||||
|
||||
if (currentRouteIndex < nextRouteIndex) { //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示
|
||||
mTwoStationsRouts.addAll(
|
||||
mRoutePoints.subList(
|
||||
currentRouteIndex,
|
||||
nextRouteIndex + 1
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始轮询计算剩余里程和时间
|
||||
* @param isStart
|
||||
*/
|
||||
fun startOrStopCalculateRouteInfo(isStart: Boolean) {
|
||||
d(SceneConstant.M_BUS_P+ TAG, "startOrStopCalculateRouteInfo() $isStart")
|
||||
if (isStart) {
|
||||
PM2ModelLoopManager.startCalculateRouteInfoLoop()
|
||||
} else {
|
||||
mTwoStationsRouts.clear()
|
||||
PM2ModelLoopManager.stopCalculateRouteInfLoop()
|
||||
}
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = startStationInfo.gcjLon
|
||||
startStation.latitude = startStationInfo.gcjLat
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = endStationInfo.gcjLon
|
||||
endStation.latitude = endStationInfo.gcjLat
|
||||
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时轨迹擦除
|
||||
* @param isStart
|
||||
*/
|
||||
private fun startOrStopRouteAndWipe(isStart: Boolean) {
|
||||
if (isStart) {
|
||||
PM2ModelLoopManager.startOrStopRouteAndWipe()
|
||||
} else {
|
||||
mWipePreIndex = 0
|
||||
PM2ModelLoopManager.stopOrStopRouteAndWipe()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startOrStopOrderLoop(start: Boolean) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "startOrStopOrderLoop() $start")
|
||||
if (start) {
|
||||
PM2ModelLoopManager.startQueryDriverLineLoop()
|
||||
} else {
|
||||
PM2ModelLoopManager.stopQueryDriverLineLoop()
|
||||
}
|
||||
private fun cleanStation(type: String) {
|
||||
d(M_BUS_P + TAG, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.model
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.passenger.network.PassengerSAASServiceApi
|
||||
import com.mogo.och.bus.passenger.passenger.network.PassengerServiceApi
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
object PM2ServiceManager {
|
||||
|
||||
private var mBusPassengerSaasServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerSAASServiceApi::class.java)
|
||||
|
||||
private var mBusPassengerServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerServiceApi::class.java)
|
||||
|
||||
|
||||
private var driverSnCache = ""
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
public val driverAppSn: String
|
||||
get(){
|
||||
val serverToken = getServerToken()
|
||||
if (serverToken != driverSnCache && serverToken.isNotEmpty()) {
|
||||
driverSnCache = serverToken
|
||||
}
|
||||
return driverSnCache
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定行驶的小巴车路线
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverSiteByCoordinate(
|
||||
context: Context, callback: OchCommonServiceCallback<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,127 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.network
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2DrivingModel
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/1
|
||||
*/
|
||||
object PM2ModelLoopManager {
|
||||
|
||||
private val TAG: String = PM2ModelLoopManager::class.java.getSimpleName()
|
||||
|
||||
private var mQueryLineDisposable: Disposable? = null //心跳轮询
|
||||
private var mRouteWipeDisposable: CompositeDisposable? = null //估计擦除
|
||||
private var mCalculateRouteDisposable: CompositeDisposable? = null //每隔2s计算一次剩余里程和时间
|
||||
|
||||
|
||||
fun startOrStopRouteAndWipe() {
|
||||
i(SceneConstant.M_BUS_P + TAG, "startOrStopRouteWipe()")
|
||||
if (mRouteWipeDisposable != null) return
|
||||
if (mRouteWipeDisposable == null) {
|
||||
mRouteWipeDisposable = CompositeDisposable()
|
||||
}
|
||||
val disposable = startLoopRouteAndWipe()
|
||||
.doOnSubscribe { }
|
||||
.doOnError { }
|
||||
.delay(
|
||||
BusPassengerConst.LOOP_LINE_1S,
|
||||
TimeUnit.MILLISECONDS,
|
||||
true
|
||||
) // 设置delayError为true,表示出现错误的时候也需要延迟5s进行通知,达到无论是请求正常还是请求失败,都是5s后重新订阅,即重新请求。
|
||||
.subscribeOn(Schedulers.io())
|
||||
.repeat() // repeat保证请求成功后能够重新订阅。
|
||||
.retry() // retry保证请求失败后能重新订阅
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { }
|
||||
mRouteWipeDisposable!!.add(disposable)
|
||||
}
|
||||
|
||||
fun stopOrStopRouteAndWipe() {
|
||||
if (mRouteWipeDisposable != null) {
|
||||
mRouteWipeDisposable!!.dispose()
|
||||
mRouteWipeDisposable = null
|
||||
}
|
||||
}
|
||||
|
||||
fun startQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null && !mQueryLineDisposable!!.isDisposed) {
|
||||
return
|
||||
}
|
||||
i(SceneConstant.M_BUS_P + TAG, "startQueryDriverLineLoop()")
|
||||
mQueryLineDisposable = Observable.interval(
|
||||
BusPassengerConst.LOOP_DELAY,
|
||||
BusPassengerConst.LOOP_LINE_2S, TimeUnit.MILLISECONDS
|
||||
)
|
||||
.map { aLong: Long -> aLong + 1 }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { aLong: Long? ->
|
||||
PM2DrivingModel.INSTANCE.queryDriverSiteByCoordinate()
|
||||
}
|
||||
}
|
||||
|
||||
fun stopQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null) {
|
||||
i(SceneConstant.M_BUS_P + TAG, "stopQueryDriverLineLoop()")
|
||||
mQueryLineDisposable!!.dispose()
|
||||
mQueryLineDisposable = null
|
||||
}
|
||||
}
|
||||
|
||||
fun startCalculateRouteInfoLoop() {
|
||||
i(SceneConstant.M_BUS_P + TAG, "startCalculateRouteInfoLoop()")
|
||||
if (mCalculateRouteDisposable != null) return
|
||||
if (mCalculateRouteDisposable == null) {
|
||||
mCalculateRouteDisposable = CompositeDisposable()
|
||||
}
|
||||
val disposable = startLoopCalculateRouteInfo()
|
||||
.doOnSubscribe { }
|
||||
.doOnError { }
|
||||
.delay(
|
||||
BusPassengerConst.LOOP_LINE_2S,
|
||||
TimeUnit.MILLISECONDS,
|
||||
true
|
||||
) // 设置delayError为true,表示出现错误的时候也需要延迟5s进行通知,达到无论是请求正常还是请求失败,都是5s后重新订阅,即重新请求。
|
||||
.subscribeOn(Schedulers.io())
|
||||
.repeat() // repeat保证请求成功后能够重新订阅。
|
||||
.retry() // retry保证请求失败后能重新订阅
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { }
|
||||
mCalculateRouteDisposable!!.add(disposable)
|
||||
}
|
||||
|
||||
fun stopCalculateRouteInfLoop() {
|
||||
if (mCalculateRouteDisposable != null) {
|
||||
i(SceneConstant.M_BUS_P + TAG, "stopCalculateRouteInfLoop()")
|
||||
mCalculateRouteDisposable!!.dispose()
|
||||
mCalculateRouteDisposable = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun startLoopRouteAndWipe(): Observable<Int?> {
|
||||
return Observable.create(ObservableOnSubscribe { emitter ->
|
||||
if (emitter.isDisposed) return@ObservableOnSubscribe
|
||||
PM2DrivingModel.INSTANCE.loopRouteAndWipe()
|
||||
emitter.onComplete()
|
||||
})
|
||||
}
|
||||
|
||||
private fun startLoopCalculateRouteInfo(): Observable<Int?> {
|
||||
return Observable.create(ObservableOnSubscribe { emitter ->
|
||||
if (emitter.isDisposed) return@ObservableOnSubscribe
|
||||
PM2DrivingModel.INSTANCE.dynamicCalculateRouteInfo()
|
||||
emitter.onComplete()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.network;
|
||||
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2QueryLineRequest;
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
public interface PM2ServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/och-shuttle-cabin/api/business/v1/passenger/lineDataWithDriver/query" )
|
||||
Observable<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);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.network;
|
||||
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
public interface PassengerSAASServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
||||
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
|
||||
Observable<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);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.network;
|
||||
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2OperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.passenger.bean.PM2RoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
public interface PassengerServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
||||
Observable<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);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.mogo.och.bus.passenger.passenger.ui
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2Presenter
|
||||
import com.mogo.och.common.module.wigets.media.MediaPlayerFragment
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_fragment.tv_bug_b2_p_version
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -27,7 +29,7 @@ class PM2BaseFragment :
|
||||
override fun initViews() {
|
||||
//横竖屏
|
||||
// setScreenDirection()
|
||||
|
||||
tv_bug_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
||||
//隐藏小地图
|
||||
initFragment()
|
||||
}
|
||||
|
||||
@@ -277,10 +277,12 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.BusPassengerMapDirectionView
|
||||
<com.mogo.och.common.module.wigets.mapdirectionview.MapDirectionView
|
||||
android:id="@+id/busPLineMapView"
|
||||
android:layout_width="@dimen/bus_p_route_info_panel_width"
|
||||
android:layout_height="@dimen/bus_p_route_line_map_view_height"
|
||||
app:arrivedDrawable="@drawable/bus_p_map_arrow_arrived"
|
||||
app:unArrivedDrawable="@drawable/bus_p_map_arrow_un_arrive"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
|
||||
@@ -1,48 +1,57 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
|
||||
android:background="@drawable/bg_status_bar"
|
||||
tools:ignore="MissingDefaultResource"
|
||||
android:background="@drawable/bg_status_bar">
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status_bar_logo"
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bus_p_status_bar_logo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/status_bar_logo"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--魔方连接状态 蓝牙-->
|
||||
<com.mogo.och.bus.passenger.ui.BusPBlueToothView
|
||||
android:id="@+id/blueToothView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:src="@drawable/bus_p_blue_tooth_open"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40" />
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
android:src="@drawable/bus_p_blue_tooth_open"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/wifiStateView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status_bar_logo"
|
||||
<TextView
|
||||
android:id="@+id/tv_bus_b1_p_version"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:src="@drawable/bus_p_status_bar_logo"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_25"/>
|
||||
|
||||
|
||||
app:layout_constraintStart_toEndOf="@+id/blueToothView"
|
||||
android:layout_marginStart="@dimen/dp_37"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:textColor="@color/bus_p_m2_color_17417B"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</merge>
|
||||
@@ -137,7 +137,7 @@
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
|
||||
<com.mogo.och.common.module.wigets.ZhiView
|
||||
<com.mogo.och.common.module.manager.xiaozhimanager.ZhiView
|
||||
android:id="@+id/zv_msg_pop_bottom"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_240"
|
||||
@@ -146,6 +146,17 @@
|
||||
app:layout_constraintBottom_toTopOf="@+id/video_fragment"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bug_b2_p_version"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/video_fragment"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:textColor="@color/bus_p_m2_color_80FFFFFF"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<!-- 16 9 -->
|
||||
<!-- 1000 562.5 -->
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="bus_p_m2_white_color">#FFFFFF</color>
|
||||
<color name="bus_p_m2_speed_tv_color">#0B1E38</color>
|
||||
<color name="bus_p_m2_button_un_auto_bg_color">#BBDAFB</color>
|
||||
<color name="bus_p_m2_line_name_tv_color">#0B1E38</color>
|
||||
<color name="bus_p_m2_line_during_tv_color">#5D7199</color>
|
||||
<color name="bus_p_m2_pnc_bg_color">#A5D8FF</color>
|
||||
<color name="bus_p_m2_power_tv_color">#1B2546</color>
|
||||
<color name="bus_p_m2_next_tv_color">#23355D</color>
|
||||
<color name="bus_p_m2_dashed_line_color">#8895B7</color>
|
||||
|
||||
|
||||
<color name="bus_p_m2_color_c8efff">#C8EFFF</color>
|
||||
<color name="bus_p_m2_color_203555">#203555</color>
|
||||
<color name="bus_p_m2_color_17417B">#17417B</color>
|
||||
<color name="bus_p_m2_color_2d3e5f">#2D3E5F</color>
|
||||
<color name="bus_p_m2_color_34A61F">#34A61F</color>
|
||||
<color name="bus_p_m2_color_aeedb8">#AEEDB8</color>
|
||||
<color name="bus_p_m2_color_43cefe">#43CEFE</color>
|
||||
<color name="bus_p_m2_color_1466fb">#1466FB</color>
|
||||
<color name="bus_p_m2_color_7094ad">#7094AD</color>
|
||||
|
||||
<color name="bus_p_m2_color_99afc9e7">#99AFC9E7</color>
|
||||
<color name="bus_p_m2_color_6617417B">#6617417B</color>
|
||||
</resources>
|
||||
@@ -1,5 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="bus_p_m2_white_color">#FFFFFF</color>
|
||||
<color name="bus_p_m2_speed_tv_color">#0B1E38</color>
|
||||
<color name="bus_p_m2_button_un_auto_bg_color">#BBDAFB</color>
|
||||
<color name="bus_p_m2_line_name_tv_color">#0B1E38</color>
|
||||
<color name="bus_p_m2_line_during_tv_color">#5D7199</color>
|
||||
<color name="bus_p_m2_pnc_bg_color">#A5D8FF</color>
|
||||
<color name="bus_p_m2_power_tv_color">#1B2546</color>
|
||||
<color name="bus_p_m2_next_tv_color">#23355D</color>
|
||||
<color name="bus_p_m2_dashed_line_color">#8895B7</color>
|
||||
|
||||
|
||||
<color name="bus_p_m2_color_c8efff">#C8EFFF</color>
|
||||
<color name="bus_p_m2_color_203555">#203555</color>
|
||||
<color name="bus_p_m2_color_17417B">#17417B</color>
|
||||
<color name="bus_p_m2_color_2d3e5f">#2D3E5F</color>
|
||||
<color name="bus_p_m2_color_34A61F">#34A61F</color>
|
||||
<color name="bus_p_m2_color_aeedb8">#AEEDB8</color>
|
||||
<color name="bus_p_m2_color_43cefe">#43CEFE</color>
|
||||
<color name="bus_p_m2_color_1466fb">#1466FB</color>
|
||||
<color name="bus_p_m2_color_7094ad">#7094AD</color>
|
||||
|
||||
<color name="bus_p_m2_color_99afc9e7">#99AFC9E7</color>
|
||||
<color name="bus_p_m2_color_6617417B">#6617417B</color>
|
||||
<color name="bus_p_m2_color_80FFFFFF">#80FFFFFF</color>
|
||||
<color name="bus_p_speed_txt_color">#5D7199</color>
|
||||
<color name="bus_p_traffic_light_bg_color">#CCE9EFFC</color>
|
||||
<color name="bus_p_traffic_light_bg_stroke">#C7D2E1</color>
|
||||
@@ -112,7 +112,7 @@ class DriverM1Model {
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10, mMapLocationListener)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, mMapLocationListener)
|
||||
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener)
|
||||
@@ -365,7 +365,9 @@ class DriverM1Model {
|
||||
|
||||
//是否到站的围栏判断 自动驾驶还未触发到站
|
||||
if (!isArrivedStation) {
|
||||
judgeArrivedStation(gnssInfo)
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
judgeArrivedStation(gnssInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,11 @@ import android.view.View
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import com.magic.mogo.och.charter.R
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ConvertUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager
|
||||
import me.jessyan.autosize.AutoSizeConfig
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -93,6 +96,9 @@ class SlidePanelView @JvmOverloads constructor(
|
||||
textGradient!!.setLocalMatrix(gradientMatrix)
|
||||
textPaint.shader = textGradient
|
||||
textPaint.getFontMetrics(blockTextMetrics)
|
||||
decodeImage()
|
||||
}
|
||||
fun decodeImage(){
|
||||
ThreadUtils.getIoPool().execute {
|
||||
val size = AutoSizeUtils.dp2px(context, 120f)
|
||||
val opts = BitmapFactory.Options()
|
||||
@@ -227,13 +233,24 @@ class SlidePanelView @JvmOverloads constructor(
|
||||
)
|
||||
canvas.restore()
|
||||
// 画滑块
|
||||
|
||||
canvas.drawBitmap(
|
||||
bmBlock!!,
|
||||
(BLOCK_START_X + blockOffset).toFloat(),
|
||||
BLOCK_START_Y.toFloat(),
|
||||
blockPaint
|
||||
)
|
||||
bmBlock?.let {
|
||||
if(it.byteCount >=5*1024*1024){
|
||||
OchChainLogManager.writeChainLog("崩溃兜底策略",
|
||||
"图片大小监听"+ ConvertUtils.byte2FitMemorySize(it.byteCount.toLong()),true,OchChainLogManager.EVENT_KEY_INFE_ERROR);
|
||||
it.recycle();
|
||||
bmBlock = null;
|
||||
blockWidth = 0;
|
||||
decodeImage();
|
||||
}else {
|
||||
// 画滑块
|
||||
canvas.drawBitmap(
|
||||
bmBlock!!,
|
||||
(BLOCK_START_X + blockOffset).toFloat(),
|
||||
BLOCK_START_Y.toFloat(),
|
||||
blockPaint
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class CarStatusViewModel: ViewModel(), IMoGoAutopilotStatusListener,
|
||||
|
||||
fun setAutopilotStatusCallback(viewCallback:ICarStatusCallback){
|
||||
this.viewCallback = viewCallback
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(DriverM1Model.TAG, 10, this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(DriverM1Model.TAG, 3, this)
|
||||
}
|
||||
|
||||
interface ICarStatusCallback{
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.mogo.och.charter.passenger.callback.*
|
||||
import com.mogo.och.charter.passenger.constant.CharterPassengerConst
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.charter.passenger.net.BusPassengerServiceManager
|
||||
import com.mogo.och.charter.passenger.utils.CharterVoiceManager
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.och.charter.passenger.utils.VoiceFocusManager
|
||||
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg
|
||||
@@ -49,7 +50,6 @@ import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.common.module.voice.VoiceManager
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.disposables.Disposable
|
||||
@@ -578,7 +578,7 @@ object CharterPassengerModel {
|
||||
AbsMogoApplication.getApp()
|
||||
.getString(R.string.charter_p_end_order_15min), 2
|
||||
)
|
||||
VoiceManager.surplus15min(VoiceFocusManager.getVoiceCmdCallBack())
|
||||
CharterVoiceManager.surplus15min(VoiceFocusManager.getVoiceCmdCallBack())
|
||||
d(M_BUS_P + TAG, "倒计时15分钟${it.orderNo}")
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putBoolean("${it.orderNo}$min5Speak", true)
|
||||
@@ -980,7 +980,7 @@ object CharterPassengerModel {
|
||||
if (order != null && lineId != null && siteId != null) {
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"到站成功:${order.siteName}")
|
||||
BeautifyManager.notifyViewChange(BeautifyManager.ChangeTypeEnum.ARRIVED_DEST)
|
||||
VoiceManager.arrivedStation(
|
||||
CharterVoiceManager.arrivedStation(
|
||||
order.siteName!!,
|
||||
order.siteNameKr ?: "",
|
||||
VoiceFocusManager.getVoiceCmdCallBack()
|
||||
@@ -1119,7 +1119,7 @@ object CharterPassengerModel {
|
||||
|
||||
fun leaveStation() {
|
||||
orderInfo?.siteName?.let { cn ->
|
||||
VoiceManager.leaveStation(
|
||||
CharterVoiceManager.leaveStation(
|
||||
cn,
|
||||
orderInfo?.siteNameKr ?: "",
|
||||
VoiceFocusManager.getVoiceCmdCallBack()
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.mogo.och.charter.passenger.model
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.TAG
|
||||
import com.mogo.och.common.module.manager.auditionmanager.AuditionManager
|
||||
import com.mogo.och.common.module.manager.auditionmanager.PlayState
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
object MusicModel : IMoGoAutopilotStatusListener, IOrderStatusChangeListener {
|
||||
init {
|
||||
CharterPassengerModel.setStatusChangeListener(TAG,this)
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private var stopMusicDisposable: Disposable? = null
|
||||
|
||||
private const val startMusicWithOrderKey = "STARTMUSICWITHORDER"
|
||||
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if(state==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
val string = SharedPrefsMgr.getInstance().getString(startMusicWithOrderKey)
|
||||
if (string == null) {
|
||||
CharterPassengerModel.getCurrentOrderInfo()?.let {
|
||||
RxUtils.disposeSubscribe(stopMusicDisposable)
|
||||
SharedPrefsMgr.getInstance().putString(startMusicWithOrderKey, it.orderNo)
|
||||
AuditionManager.musicList.forEach {music->
|
||||
if(music.state==PlayState.Pause){
|
||||
AuditionManager.toggle(music)
|
||||
return
|
||||
}
|
||||
}
|
||||
if(!AuditionManager.isPlaying()) {
|
||||
AuditionManager.playFirst()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CharterPassengerModel.getCurrentOrderInfo()?.let {
|
||||
if (it.orderNo != string) {
|
||||
RxUtils.disposeSubscribe(stopMusicDisposable)
|
||||
SharedPrefsMgr.getInstance().putString(startMusicWithOrderKey, it.orderNo)
|
||||
AuditionManager.musicList.forEach {music->
|
||||
if(music.state==PlayState.Pause){
|
||||
AuditionManager.toggle(music)
|
||||
return
|
||||
}
|
||||
}
|
||||
if(!AuditionManager.isPlaying()) {
|
||||
AuditionManager.playFirst()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun load() {
|
||||
|
||||
}
|
||||
|
||||
override fun onStatusChange(currentStatus: OrderStatusEnum) {
|
||||
when (currentStatus) {
|
||||
OrderStatusEnum.NoOrderUse -> {
|
||||
CharterPassengerModel.getCurrentOrderInfo()?.let {
|
||||
RxUtils.disposeSubscribe(stopMusicDisposable)
|
||||
stopMusicDisposable = RxUtils.createSubscribe(60_000) {
|
||||
AuditionManager.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
else ->{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_selectline
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_softcontrol
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_video
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mcv_play_music
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.omvOverMap
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxBubble
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxButton
|
||||
@@ -140,6 +141,7 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
BottomBar.SelectView.SETTING -> showBizView(softControl = true)
|
||||
BottomBar.SelectView.LINE -> showBizView(selectLine = true)
|
||||
BottomBar.SelectView.VIDEO -> showBizView(showVideo = true)
|
||||
BottomBar.SelectView.MUSIC -> showBizView(showMusic = true)
|
||||
else -> {
|
||||
showBizView()
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_80ffffff)
|
||||
@@ -178,7 +180,8 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
orderinfo: Boolean = false,
|
||||
softControl: Boolean = false,
|
||||
selectLine: Boolean = false,
|
||||
showVideo: Boolean = false
|
||||
showVideo: Boolean = false,
|
||||
showMusic: Boolean = false
|
||||
) {
|
||||
if (orderinfo) {
|
||||
biz_orderinfo.visibility = View.VISIBLE
|
||||
@@ -204,6 +207,12 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
} else {
|
||||
biz_video.visibility = View.GONE
|
||||
}
|
||||
if(showMusic) {
|
||||
mcv_play_music.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_40ffffff)
|
||||
}else{
|
||||
mcv_play_music.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
fun setCarModel(rawInfo: Int) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.och.charter.passenger.R
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.aciv_center_image
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_close_door
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_line
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_music
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_open_door
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_setting
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_bar.view.actv_stop_site
|
||||
@@ -40,6 +41,10 @@ class BottomBar @JvmOverloads constructor(
|
||||
actv_line.onClick {
|
||||
setCheckIndex(SelectView.LINE)
|
||||
}
|
||||
actv_music.onClick {
|
||||
|
||||
setCheckIndex(SelectView.MUSIC)
|
||||
}
|
||||
}
|
||||
fun setCheckChangeListener(overMapViewApply:ApplyClickLintener){
|
||||
this.overMapViewApply = overMapViewApply
|
||||
@@ -79,11 +84,16 @@ class BottomBar @JvmOverloads constructor(
|
||||
}else{
|
||||
actv_line.setCheckItem(false)
|
||||
}
|
||||
if(checkIndex == SelectView.MUSIC){
|
||||
actv_music.setCheckItem(true)
|
||||
}else{
|
||||
actv_music.setCheckItem(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum class SelectView{
|
||||
NONE,ORDERINFO,SETTING,LINE,VIDEO
|
||||
NONE,ORDERINFO,SETTING,LINE,VIDEO,MUSIC
|
||||
}
|
||||
|
||||
interface ApplyClickLintener{
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.mogo.och.charter.passenger.ui.bottom.impl
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.auditionmanager.AuditionManager
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import com.mogo.och.common.module.manager.auditionmanager.PlayState
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_music.view.aciv_center_image
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_music.view.actv_title
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_music.view.aciv_playing
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_music.view.aciv_playing_bg
|
||||
import kotlinx.android.synthetic.main.charter_p_bottom_music.view.default_info
|
||||
|
||||
open class MusicCheckView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), AuditionManager.MusicDataChangeListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "StopSiteView"
|
||||
}
|
||||
|
||||
private var backageViewId: Int = -1
|
||||
private var bottomTitle: String = ""
|
||||
private var selectedDrawable: Int = -1
|
||||
private var normalDrawable: Int = -1
|
||||
private var backageView: View? = null
|
||||
|
||||
private var isCheck = false
|
||||
|
||||
private var animator:ObjectAnimator?=null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_bottom_music, this, true)
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
try {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.CharterPBottomSelectView)
|
||||
backageViewId = typedArray.getResourceId(R.styleable.CharterPBottomSelectView_charterPBackageViewId, -1)
|
||||
bottomTitle = typedArray.getString(R.styleable.CharterPBottomSelectView_charterPBottomTitle) ?: ""
|
||||
selectedDrawable = typedArray.getResourceId(R.styleable.CharterPBottomSelectView_charterPselectedDrawable, -1)
|
||||
normalDrawable = typedArray.getResourceId(R.styleable.CharterPBottomSelectView_charterPnormalDrawable, -1)
|
||||
typedArray.recycle()
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
if (selectedDrawable > 0) {
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
}
|
||||
actv_title.text = bottomTitle
|
||||
}
|
||||
|
||||
fun setCheckItem(isCheck: Boolean) {
|
||||
if (isCheck != this.isCheck) {
|
||||
this.isCheck = isCheck
|
||||
notifiBackageView()
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifiBackageView() {
|
||||
if (isCheck) {
|
||||
default_info.visibility = View.VISIBLE
|
||||
aciv_playing.visibility = View.GONE
|
||||
aciv_playing_bg.visibility = View.GONE
|
||||
backageView?.visibility = View.VISIBLE
|
||||
aciv_center_image.setImageResource(selectedDrawable)
|
||||
actv_title.setTextColor(context.getColor(android.R.color.white))
|
||||
endAnimal()
|
||||
} else {
|
||||
backageView?.visibility = View.GONE
|
||||
actv_title.setTextColor(context.getColor(R.color.charter_p_090f28))
|
||||
aciv_center_image.setImageResource(normalDrawable)
|
||||
|
||||
if(AuditionManager.isPlaying()){
|
||||
default_info.visibility = View.GONE
|
||||
aciv_playing.visibility = View.VISIBLE
|
||||
aciv_playing_bg.visibility = View.VISIBLE
|
||||
AuditionManager.musicDataPlaying?.let {
|
||||
Glide.with(context)
|
||||
.load(it.coverHeadImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.charter_p_music_bg_relax_head))
|
||||
.into(object : SimpleTarget<Drawable>() {
|
||||
override fun onResourceReady(
|
||||
resource: Drawable,
|
||||
transition: Transition<in Drawable>?
|
||||
) {
|
||||
aciv_playing.background = resource
|
||||
}
|
||||
})
|
||||
startAnimal()
|
||||
}
|
||||
}else{
|
||||
default_info.visibility = View.VISIBLE
|
||||
aciv_playing.visibility = View.GONE
|
||||
aciv_playing_bg.visibility = View.GONE
|
||||
endAnimal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAnimal(){
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
animator = null
|
||||
}
|
||||
animator = ObjectAnimator.ofFloat(aciv_playing, "rotation", 0f, 360f)
|
||||
aciv_playing.pivotX = (aciv_playing.width / 2).toFloat()
|
||||
aciv_playing.pivotY = (aciv_playing.height / 2).toFloat()
|
||||
animator?.duration = 3000
|
||||
animator?.repeatCount = -1
|
||||
animator?.repeatMode = ValueAnimator.RESTART
|
||||
animator?.interpolator = LinearInterpolator()
|
||||
animator?.start()
|
||||
}
|
||||
|
||||
private fun endAnimal(){
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
aciv_center_image.rotation = 0f
|
||||
animator = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
parent?.let {
|
||||
if (parent is ConstraintLayout) {
|
||||
if (backageViewId > 0) {
|
||||
backageView = (parent as ConstraintLayout).findViewById(backageViewId)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isCheck) {
|
||||
backageView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateState(oldData: MusicData?, musicData: MusicData) {
|
||||
if(musicData.state== PlayState.Playing){
|
||||
Glide.with(context)
|
||||
.load(musicData.coverHeadImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.charter_p_music_bg_relax_head))
|
||||
.into(object : SimpleTarget<Drawable>() {
|
||||
override fun onResourceReady(
|
||||
resource: Drawable,
|
||||
transition: Transition<in Drawable>?
|
||||
) {
|
||||
aciv_playing.background = resource
|
||||
}
|
||||
})
|
||||
}else{
|
||||
default_info.visibility = View.VISIBLE
|
||||
aciv_playing.visibility = View.GONE
|
||||
aciv_playing_bg.visibility = View.GONE
|
||||
endAnimal()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.presenter.BusPassengerCarUseAndNoOrderPresenter
|
||||
import com.mogo.och.charter.passenger.utils.CharterVoiceManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorManager
|
||||
import com.mogo.och.common.module.voice.VoiceManager
|
||||
import kotlinx.android.synthetic.main.charter_p_order_end.iv_end_order_closedoor
|
||||
import kotlinx.android.synthetic.main.charter_p_order_end.iv_end_order_opendoor
|
||||
|
||||
@@ -154,7 +154,7 @@ class M1CarUserNoOrderFragment :
|
||||
CallerLogger.d(M_BUS_P + TAG, "已经添加正在移除")
|
||||
}
|
||||
m1CarUserNoOrderFragment.show(parentFragmentManager, TAG)
|
||||
VoiceManager.endOrder()
|
||||
CharterVoiceManager.endOrder()
|
||||
CallerLogger.d(M_BUS_P + TAG, "展示开关门")
|
||||
} else {
|
||||
CallerLogger.d(M_BUS_P + TAG, "dialog 1s内执行一次")
|
||||
|
||||
@@ -24,7 +24,7 @@ class ItineraryViewModel : ViewModel(), IMoGoChassisLocationGCJ02Listener, IDist
|
||||
private var viewCallback: ItineraryViewCallback? = null
|
||||
|
||||
init {
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 4, this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 3, this)
|
||||
CharterPassengerModel.setStationDistanceListener(TAG, this)
|
||||
CharterPassengerModel.setStatusChangeListener(TAG, this)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.och.charter.passenger.ui.music
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.ui.music.list.MusicListView
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import kotlinx.android.synthetic.main.charter_p_music.view.mlv_list
|
||||
import kotlinx.android.synthetic.main.charter_p_music.view.mpv_music_info
|
||||
|
||||
|
||||
class MusicControlView : ConstraintLayout, MusicControlViewModel.MusicCallback {
|
||||
|
||||
private val TAG = "MusicControlView"
|
||||
|
||||
private var viewModel: MusicControlViewModel? = null
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context, attributeSet, defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_music, this, true)
|
||||
|
||||
mlv_list.setCheckItemListener(object : MusicListView.CheckListener{
|
||||
override fun checkItem(musicData: MusicData) {
|
||||
mpv_music_info.setData(musicData)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicControlViewModel::class.java)
|
||||
}
|
||||
viewModel?.setViewCallback(this)
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.och.charter.passenger.ui.music
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.och.charter.passenger.model.MusicModel
|
||||
|
||||
class MusicControlViewModel : ViewModel() {
|
||||
|
||||
private val TAG = MusicControlViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: MusicCallback? = null
|
||||
|
||||
|
||||
init {
|
||||
MusicModel.load()
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
fun setViewCallback(viewCallback: MusicCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
|
||||
interface MusicCallback {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.list
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import com.mogo.och.common.module.manager.auditionmanager.PlayState
|
||||
import me.jessyan.autosize.AutoSizeCompat
|
||||
|
||||
/**
|
||||
* Created by adityagohad on 06/06/17.
|
||||
*/
|
||||
class MusicListItemAdapter(
|
||||
private val context: Context,
|
||||
private val dataList: MutableList<MusicData>,
|
||||
private val clickListener: ClickListener
|
||||
) : RecyclerView.Adapter<MusicListItemAdapter.TextVH>() {
|
||||
|
||||
private val TAG = "MusicListItemAdapter"
|
||||
|
||||
val gradientDrawable = GradientDrawable().also {
|
||||
it.shape = GradientDrawable.RECTANGLE
|
||||
val firstColor = ContextCompat.getColor(context, android.R.color.transparent)
|
||||
val setondColor = ContextCompat.getColor(context, R.color.charter_p_4DFFFFFF)
|
||||
val thirdColor = ContextCompat.getColor(context, R.color.charter_p_4DFFFFFF)
|
||||
val fourceColor = ContextCompat.getColor(context, R.color.charter_p_4DFFFFFF)
|
||||
val fifthColor = ContextCompat.getColor(context, android.R.color.transparent)
|
||||
|
||||
it.orientation = GradientDrawable.Orientation.LEFT_RIGHT
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
it.setColors(intArrayOf(firstColor, setondColor, thirdColor, fourceColor,fifthColor),
|
||||
floatArrayOf(0.0f,0.3f,0.6f,0.9f,1f)
|
||||
)
|
||||
}else{
|
||||
it.colors = intArrayOf(firstColor, setondColor, thirdColor, fourceColor)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
|
||||
val view: View
|
||||
val inflater = LayoutInflater.from(context)
|
||||
view = inflater.inflate(R.layout.charter_p_music_list_item, parent, false)
|
||||
return TextVH(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: TextVH, position: Int) {
|
||||
val musicData = dataList[position]
|
||||
AutoSizeCompat.autoConvertDensityOfGlobal(holder.itemView.resources)
|
||||
holder.musicName.text = musicData.songName
|
||||
holder.itemView.setOnClickListener {
|
||||
dataList.forEachIndexed { index, musicData4Loop ->
|
||||
if(musicData4Loop.select==true){
|
||||
musicData4Loop.select = false
|
||||
notifyItemChanged(index)
|
||||
CallerLogger.d(TAG,"index:${index}----music${musicData4Loop.songName}")
|
||||
return@forEachIndexed
|
||||
}
|
||||
}
|
||||
musicData.select = true
|
||||
notifyItemChanged(position)
|
||||
CallerLogger.d(TAG,"position:${position}----music${musicData.songName}")
|
||||
clickListener.clickItem(musicData,position)
|
||||
}
|
||||
if(musicData.tag.size>0){
|
||||
holder.tvTag.text = musicData.tag.first()
|
||||
}
|
||||
|
||||
if(musicData.select==true){
|
||||
holder.itemView.background = gradientDrawable
|
||||
holder.musicName.setTypeface(null,Typeface.BOLD)
|
||||
}else{
|
||||
holder.itemView.background = null
|
||||
holder.musicName.setTypeface(null,Typeface.NORMAL)
|
||||
}
|
||||
|
||||
if (musicData.state==PlayState.Playing) {
|
||||
holder.musicPlayState.visibility = View.VISIBLE
|
||||
}else{
|
||||
holder.musicPlayState.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return dataList.size
|
||||
}
|
||||
|
||||
fun setNewData(data: MutableList<MusicData>) {
|
||||
dataList.clear()
|
||||
dataList.addAll(data)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun addOneData(musicData: MusicData){
|
||||
dataList.add(musicData)
|
||||
notifyItemInserted(dataList.size)
|
||||
}
|
||||
|
||||
fun upDateMusicData(oldData: MusicData?,musicData: MusicData) {
|
||||
dataList.forEachIndexed { index, musicDataIn ->
|
||||
if (musicDataIn.id==musicData.id) {
|
||||
musicDataIn.state = musicData.state
|
||||
notifyItemChanged(index,0)
|
||||
}
|
||||
if(oldData?.id==musicDataIn.id){
|
||||
notifyItemChanged(index,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setSelect(nextMusicData: MusicData, preMusicData: MusicData?) {
|
||||
dataList.forEachIndexed { index, musicDataIn ->
|
||||
if(musicDataIn.id==nextMusicData.id){
|
||||
musicDataIn.select = true
|
||||
notifyItemChanged(index,0)
|
||||
}
|
||||
if(musicDataIn.id == preMusicData?.id){
|
||||
musicDataIn.select = false
|
||||
notifyItemChanged(index,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class TextVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var musicName: TextView
|
||||
var tvTag: TextView
|
||||
var musicPlayState: ImageView
|
||||
|
||||
init {
|
||||
musicName = itemView.findViewById(R.id.tv_song_name)
|
||||
tvTag = itemView.findViewById(R.id.tv_tag)
|
||||
musicPlayState = itemView.findViewById(R.id.iv_music_playing)
|
||||
}
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun clickItem(musicData: MusicData,position: Int)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.list
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import kotlinx.android.synthetic.main.charter_p_music_list.view.rv_music_list
|
||||
|
||||
class MusicListView : ConstraintLayout, MusicListViewModel.IMusicListViewCaLillback,
|
||||
MusicListItemAdapter.ClickListener {
|
||||
|
||||
private val TAG = "MusicListView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private val dataList = mutableListOf<MusicData>()
|
||||
private lateinit var lineAdapter: MusicListItemAdapter
|
||||
private var checkListener: CheckListener?=null
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_music_list, this, true)
|
||||
rv_music_list.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
lineAdapter = MusicListItemAdapter(context,dataList,this)
|
||||
rv_music_list.adapter = lineAdapter
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
val viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicListViewModel::class.java)
|
||||
}
|
||||
CallerLogger.d(TAG,viewModel.toString())
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun addAllData(data: MutableList<MusicData>) {
|
||||
lineAdapter.setNewData(data)
|
||||
}
|
||||
|
||||
override fun addOneData(it: MusicData) {
|
||||
lineAdapter.addOneData(it)
|
||||
}
|
||||
|
||||
override fun updateMusicData(oldData: MusicData?,musicData: MusicData) {
|
||||
lineAdapter.upDateMusicData(oldData,musicData)
|
||||
CallerLogger.d(TAG,"${Thread.currentThread().name}----更新数据${oldData}-----${musicData}")
|
||||
}
|
||||
|
||||
override fun upDateSelectMusic(nextMusicData: MusicData, preMusicData: MusicData?) {
|
||||
lineAdapter.setSelect(nextMusicData,preMusicData)
|
||||
}
|
||||
|
||||
override fun clickItem(musicData: MusicData,position: Int) {
|
||||
// 通知主页面去显示详情
|
||||
this.checkListener?.checkItem(musicData)
|
||||
}
|
||||
|
||||
fun setCheckItemListener(checkListener: CheckListener) {
|
||||
this.checkListener = checkListener
|
||||
}
|
||||
|
||||
interface CheckListener {
|
||||
fun checkItem(musicData: MusicData)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.list
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.auditionmanager.AuditionManager
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
|
||||
class MusicListViewModel : ViewModel(),
|
||||
AuditionManager.MusicDataChangeListener {
|
||||
|
||||
private val TAG = MusicListViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IMusicListViewCaLillback? = null
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IMusicListViewCaLillback) {
|
||||
this.viewCallback = viewCallback
|
||||
viewCallback.addAllData(AuditionManager.musicList)
|
||||
CallerLogger.d(TAG,"初始化音乐${AuditionManager.musicList.size}")
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
interface IMusicListViewCaLillback {
|
||||
fun addAllData(data:MutableList<MusicData>)
|
||||
fun addOneData(it: MusicData)
|
||||
fun updateMusicData(oldData: MusicData?,musicData: MusicData)
|
||||
fun upDateSelectMusic(nextMusicData: MusicData, preMusicData: MusicData?)
|
||||
}
|
||||
|
||||
override fun addOneData(it: MusicData) {
|
||||
CallerLogger.d(TAG,"添加音乐:${it.songName}--${it.path}")
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.addOneData(it)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun updateState(oldData: MusicData?,musicData: MusicData) {
|
||||
UiThreadHandler.post({
|
||||
viewCallback?.updateMusicData(oldData, musicData)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onMusicCompletion(musicData: MusicData) {
|
||||
super.onMusicCompletion(musicData)
|
||||
UiThreadHandler.post({
|
||||
viewCallback?.updateMusicData(musicData, musicData)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
fun selectMusic(currentMusicData: MusicData, preMusicData: MusicData?) {
|
||||
UiThreadHandler.post({
|
||||
viewCallback?.upDateSelectMusic(currentMusicData,preMusicData)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.playing
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.SeekBar
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.ui.music.list.MusicListViewModel
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
import com.mogo.och.common.module.manager.auditionmanager.PlayState
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_music_cover
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_music_cover_bg
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_show_next
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_show_pre
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.iv_toggle
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.sb_musuc_progess
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_music_name
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_playing_during
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_playing_time
|
||||
import kotlinx.android.synthetic.main.charter_p_music_playing.view.tv_tag
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
|
||||
class MusicPlayingView : ConstraintLayout, MusicPlayingViewModel.IMusicPlayingViewCallback {
|
||||
|
||||
private val TAG = "MusicPlayingView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private var viewModel: MusicPlayingViewModel?=null
|
||||
private var viewListModel: MusicListViewModel?=null
|
||||
|
||||
private var animator:ObjectAnimator?=null
|
||||
|
||||
private var isSeekBarTouch = false
|
||||
private val centerWidth = AutoSizeUtils.dp2px(context,70.2f)
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_p_music_playing, this, true)
|
||||
|
||||
setOnClickListener {
|
||||
CallerLogger.d(TAG,"-----------")
|
||||
}
|
||||
iv_toggle.setOnClickListener {
|
||||
viewModel?.toggle()
|
||||
}
|
||||
iv_show_pre.setOnClickListener {
|
||||
viewModel?.showPreMusic()
|
||||
}
|
||||
iv_show_next.setOnClickListener {
|
||||
viewModel?.showNextMusic()
|
||||
}
|
||||
sb_musuc_progess.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
||||
var seekToProgress = 0
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
if(isSeekBarTouch) {
|
||||
CallerLogger.d(TAG, "progress:${progress}----fromUser:${fromUser}")
|
||||
seekToProgress = progress
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
||||
isSeekBarTouch = true
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
isSeekBarTouch = false
|
||||
viewModel?.seekTo(seekToProgress)
|
||||
seekToProgress = 0
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicPlayingViewModel::class.java)
|
||||
}
|
||||
viewListModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(MusicListViewModel::class.java)
|
||||
}
|
||||
CallerLogger.d("MusicListView",viewListModel.toString())
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
if(isVisible){
|
||||
viewModel?.showData()
|
||||
}
|
||||
}
|
||||
|
||||
fun setData(musicData: MusicData) {
|
||||
viewModel?.setClickMusicData(musicData)
|
||||
}
|
||||
|
||||
override fun setViewData(musicData: MusicData){
|
||||
tv_music_name.text = musicData.songName
|
||||
tv_tag.text = musicData.tag.first()
|
||||
tv_playing_time.text = DateTimeUtil.second2Time(0)
|
||||
tv_playing_during.text = TimeTransformUtils.stringForTime(musicData.duration.toInt())
|
||||
if(musicData.state==PlayState.Playing){
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_pause)
|
||||
startAnimal()
|
||||
}else{
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_play)
|
||||
endAnimal()
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
sb_musuc_progess.setProgress(0,true)
|
||||
}else{
|
||||
sb_musuc_progess.progress=0.toInt()
|
||||
}
|
||||
|
||||
Glide.with(context)
|
||||
.load(musicData.coverHeadImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.charter_p_music_bg_relax_head))
|
||||
.into(iv_music_cover)
|
||||
Glide.with(context)
|
||||
.load(musicData.coverBottomImageUrl)
|
||||
.apply(RequestOptions().placeholder(R.drawable.charter_p_music_bg_relax_bottom))
|
||||
.into(iv_music_cover_bg)
|
||||
}
|
||||
|
||||
private fun startAnimal(){
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
animator = null
|
||||
}
|
||||
animator = ObjectAnimator.ofFloat(iv_music_cover, "rotation", 0f, 360f)
|
||||
iv_music_cover.pivotX = (centerWidth).toFloat()
|
||||
iv_music_cover.pivotY = (centerWidth).toFloat()
|
||||
animator?.duration = 3000
|
||||
animator?.repeatCount = -1
|
||||
animator?.repeatMode = ValueAnimator.RESTART
|
||||
animator?.interpolator = LinearInterpolator()
|
||||
animator?.start()
|
||||
}
|
||||
private fun endAnimal(){
|
||||
if(animator!=null){
|
||||
animator?.cancel()
|
||||
animator = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun setPlayOrpause(it: MusicData) {
|
||||
if(it.state==PlayState.Playing){
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_pause)
|
||||
startAnimal()
|
||||
}else{
|
||||
iv_toggle.setImageResource(R.drawable.charter_p_music_play)
|
||||
endAnimal()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setProgress(currentPlay: Long, duration: Long) {
|
||||
if(isSeekBarTouch){
|
||||
|
||||
}else{
|
||||
sb_musuc_progess.max = duration.toInt()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
sb_musuc_progess.setProgress(currentPlay.toInt(),true)
|
||||
}else{
|
||||
sb_musuc_progess.progress=currentPlay.toInt()
|
||||
}
|
||||
}
|
||||
|
||||
tv_playing_time.text = TimeTransformUtils.stringForTime(currentPlay.toInt())
|
||||
tv_playing_during.text = TimeTransformUtils.stringForTime(duration.toInt())
|
||||
}
|
||||
|
||||
override fun setSelect(currentMusicData: MusicData,preMusicData: MusicData?) {
|
||||
viewListModel?.selectMusic(currentMusicData,preMusicData)
|
||||
}
|
||||
|
||||
fun listenerPlaying(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.mogo.och.charter.passenger.ui.music.playing
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.manager.auditionmanager.AuditionManager
|
||||
import com.mogo.och.common.module.manager.auditionmanager.MusicData
|
||||
|
||||
class MusicPlayingViewModel : ViewModel(), AuditionManager.MusicDataChangeListener {
|
||||
|
||||
private val TAG = MusicPlayingViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IMusicPlayingViewCallback? = null
|
||||
|
||||
private var checkMusicData:MusicData?=null
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IMusicPlayingViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
AuditionManager.addDataChangeListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
fun setMusicData(musicData: MusicData) {
|
||||
this.checkMusicData = musicData
|
||||
this.viewCallback?.setViewData(musicData)
|
||||
}
|
||||
|
||||
fun showData() {
|
||||
if(checkMusicData!=null){
|
||||
setMusicData(this.checkMusicData!!)
|
||||
}else{
|
||||
val musicList = AuditionManager.musicList
|
||||
if(musicList.size>0){
|
||||
val first = musicList.first()
|
||||
setMusicData(first)
|
||||
viewCallback?.setSelect(first,null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun toggle() {
|
||||
checkMusicData?.let {
|
||||
CallerLogger.d(TAG,"toggle:${it.songName}")
|
||||
AuditionManager.toggle(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun showPreMusic() {
|
||||
checkMusicData?.let {
|
||||
val playing = AuditionManager.isPlaying()
|
||||
val nextMusicData = AuditionManager.getPreMusicData(it)
|
||||
val preTempMusic = checkMusicData
|
||||
setMusicData(nextMusicData)
|
||||
viewCallback?.setSelect(nextMusicData,preTempMusic)
|
||||
if(playing){
|
||||
AuditionManager.play(nextMusicData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun showNextMusic() {
|
||||
checkMusicData?.let {
|
||||
val playing = AuditionManager.isPlaying()
|
||||
val nextMusicData = AuditionManager.getNextMusicData(it)
|
||||
val preTempMusic = checkMusicData
|
||||
setMusicData(nextMusicData)
|
||||
viewCallback?.setSelect(nextMusicData,preTempMusic)
|
||||
if(playing){
|
||||
AuditionManager.play(nextMusicData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface IMusicPlayingViewCallback {
|
||||
fun setViewData(musicData: MusicData)
|
||||
fun setPlayOrpause(it: MusicData)
|
||||
fun setProgress(currentPlay: Long, duration: Long)
|
||||
fun setSelect(currentMusicData: MusicData,preMusicData: MusicData?)
|
||||
}
|
||||
|
||||
override fun updateState(oldData:MusicData?,musicData: MusicData) {
|
||||
checkMusicData?.let {
|
||||
if(it.id==musicData.id){
|
||||
it.state = musicData.state
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setPlayOrpause(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun updatePlayCurrent(currentPlay: Long, duration: Long, musicData: MusicData){
|
||||
checkMusicData?.let {
|
||||
if(it.id==musicData.id){
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setProgress(currentPlay, duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMusicCompletion(musicData: MusicData) {
|
||||
super.onMusicCompletion(musicData)
|
||||
checkMusicData?.let {
|
||||
if(it.id==musicData.id){
|
||||
it.state = musicData.state
|
||||
UiThreadHandler.post {
|
||||
viewCallback?.setPlayOrpause(it)
|
||||
}
|
||||
}
|
||||
val nextMusicData = AuditionManager.getNextMusicData(it)
|
||||
val preTempMusic = checkMusicData
|
||||
setMusicData(nextMusicData)
|
||||
viewCallback?.setSelect(nextMusicData,preTempMusic)
|
||||
AuditionManager.play(nextMusicData)
|
||||
}
|
||||
}
|
||||
|
||||
fun seekTo(progress: Int) {
|
||||
AuditionManager.seekTo(progress)
|
||||
}
|
||||
|
||||
fun setClickMusicData(musicData: MusicData) {
|
||||
CallerLogger.d(TAG,"setClickMusicData:${musicData.songName}")
|
||||
setMusicData(musicData)
|
||||
val playing = AuditionManager.isPlaying()
|
||||
if(playing){
|
||||
AuditionManager.play(musicData)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,13 @@ import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.app.ActivityCompat
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.utils.FullVideoUtils
|
||||
import com.mogo.och.common.module.manager.audiofocusmanager.AudioFocusManager
|
||||
import com.mogo.och.common.module.wigets.media.MediaItem
|
||||
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
@@ -40,6 +42,7 @@ import java.lang.reflect.Constructor
|
||||
*/
|
||||
class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
|
||||
private val TAG = "ConsultVideoPlayer"
|
||||
private lateinit var start: ImageView
|
||||
lateinit var coverImage: ImageView
|
||||
private lateinit var currentTimeTextView: TextView
|
||||
@@ -128,6 +131,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
start.setImageResource(R.drawable.charter_p_function_video_player_pause_small)
|
||||
}
|
||||
showOrHideStartPlayButton(false)
|
||||
AudioFocusManager.setVideoFocusChange(true)
|
||||
}
|
||||
else -> {
|
||||
if(isIfCurrentIsFullscreen){
|
||||
@@ -136,6 +140,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
start.setImageResource(R.drawable.charter_p_function_video_player_start_small)
|
||||
}
|
||||
showOrHideStartPlayButton(true)
|
||||
AudioFocusManager.setVideoFocusChange(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,6 +191,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
forceChange: Boolean
|
||||
) {
|
||||
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
CallerLogger.d(TAG,"setProgressAndTime¥${progress}-${secProgress}-${currentTime}")
|
||||
//时间显示
|
||||
currentTimeTextView.text = TimeTransformUtils.stringForTimeWithHours(currentTime)
|
||||
totalTimeTextView.text = TimeTransformUtils.stringForTimeWithHours(totalTime)
|
||||
@@ -247,6 +253,8 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
override fun onCompletion() {
|
||||
CallerLogger.d(TAG,"onCompletion")
|
||||
AudioFocusManager.setVideoFocusChange(false)
|
||||
start.setImageResource(R.drawable.charter_p_function_video_player_start_small)
|
||||
}
|
||||
|
||||
@@ -268,6 +276,8 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
|
||||
|
||||
override fun onError(what: Int, extra: Int) {
|
||||
super.onError(what, extra)
|
||||
CallerLogger.d(TAG,"onError--${what}--${extra}")
|
||||
AudioFocusManager.setVideoFocusChange(false)
|
||||
mThumbImageViewLayout?.visibility = View.VISIBLE
|
||||
ToastCharterUtils.showToastLong("哎呀,出错了,看看其他视频吧")
|
||||
currentTime = -1
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.mogo.och.charter.passenger.utils
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.tts.base.IMogoTTSCallback
|
||||
import com.mogo.tts.base.LangTtsEntity
|
||||
import com.mogo.tts.base.LanguageType
|
||||
import java.util.ArrayList
|
||||
|
||||
object CharterVoiceManager {
|
||||
|
||||
fun arrivedStation(siteNameCN: String?, siteNameKR: String?,callBack: IMogoTTSCallback?=null) {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
siteNameCN?.let {
|
||||
val chineseTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.charter_arrived_station_zh, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.charter_arrived_station_en, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val koreanTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.charter_arrived_station_ko, siteNameKR?:it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
}
|
||||
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1,callBack)
|
||||
}
|
||||
|
||||
fun leaveStation(siteNameCN: String?, siteNameKR: String?,callBack: IMogoTTSCallback?=null) {
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
siteNameCN?.let {
|
||||
val chineseTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.charter_leave_station_zh, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.charter_leave_station_en, it),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
|
||||
val koreanTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.charter_leave_station_ko, siteNameKR ?: it),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(koreanTTS)
|
||||
}
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1,callBack)
|
||||
}
|
||||
|
||||
fun surplus15min(callBack: IMogoTTSCallback?=null) {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(contenxt.getString(R.string.charter_surplus15_order_zh), LanguageType.CHINESE)
|
||||
val engTTS = LangTtsEntity(contenxt.getString(R.string.charter_surplus15_order_en), LanguageType.ENGLISH)
|
||||
val koreanTTS = LangTtsEntity(contenxt.getString(R.string.charter_surplus15_order_ko), LanguageType.KOREAN)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0,callBack)
|
||||
}
|
||||
fun endOrder(){
|
||||
endOrder(null)
|
||||
}
|
||||
fun endOrder(callBack: IMogoTTSCallback?=null) {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(contenxt.getString(R.string.charter_end_order_zh), LanguageType.CHINESE)
|
||||
val engTTS = LangTtsEntity(contenxt.getString(R.string.charter_end_order_en), LanguageType.ENGLISH)
|
||||
val koreanTTS = LangTtsEntity(contenxt.getString(R.string.charter_end_order_ko), LanguageType.KOREAN)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0,callBack)
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 760 B After Width: | Height: | Size: 826 B |
|
After Width: | Height: | Size: 341 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 872 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1008 B |
|
After Width: | Height: | Size: 17 KiB |
@@ -4,6 +4,6 @@
|
||||
android:drawable="@drawable/charter_p_function_light_check_select" android:gravity="center"
|
||||
android:left="@dimen/dp_31"
|
||||
android:top="@dimen/dp_2"
|
||||
android:width="@dimen/dp_28"
|
||||
android:height="@dimen/dp_28"/>
|
||||
android:width="@dimen/dp_36"
|
||||
android:height="@dimen/dp_36"/>
|
||||
</layer-list >
|
||||
@@ -4,6 +4,6 @@
|
||||
android:drawable="@drawable/charter_p_function_light_check_selected"
|
||||
android:left="@dimen/dp_31"
|
||||
android:top="@dimen/dp_2"
|
||||
android:width="@dimen/dp_28"
|
||||
android:height="@dimen/dp_28"/>
|
||||
android:width="@dimen/dp_36"
|
||||
android:height="@dimen/dp_36"/>
|
||||
</layer-list >
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient android:startColor="@color/charter_p_4D6A83A5" android:centerColor="@color/charter_p_6A83A5" android:endColor="@color/charter_p_4D6A83A5" android:angle="-45"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient android:startColor="@color/charter_p_80FFFFFF" android:endColor="@android:color/transparent" android:angle="90"/>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_30" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_16_5"/>
|
||||
<stroke android:width="@dimen/dp_1" android:color="@color/charter_p_425877"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/charter_p_1A488ED0" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/charter_p_1A488ED0" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="5dp"/>
|
||||
<solid android:color="@color/charter_p_598CFF" />
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 普通无焦点状态 -拖动按钮 -->
|
||||
<item android:drawable="@drawable/charter_p_music_thumb" android:state_focused="false" android:state_pressed="false"/>
|
||||
<!-- 有焦点状态 -->
|
||||
<item android:drawable="@drawable/charter_p_music_thumb" android:state_focused="true" android:state_pressed="false"/>
|
||||
<!-- 有焦点 -->
|
||||
<item android:drawable="@drawable/charter_p_music_thumb" android:state_focused="true"/>
|
||||
|
||||
<item android:drawable="@drawable/charter_p_music_thumb"/>
|
||||
|
||||
</selector>
|
||||
@@ -13,16 +13,17 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_width="@dimen/dp_489"
|
||||
android:layout_width="@dimen/dp_430"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_stop_site_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_stop_site"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_stop_site"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
|
||||
@@ -36,16 +37,17 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_close_door"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_close_door_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_close_door"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_close_door"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.impl.CloseDoorView
|
||||
@@ -58,16 +60,17 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_open_door"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_open_door_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_open_door"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_open_door"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.impl.OpenDoorView
|
||||
@@ -80,37 +83,64 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_close_door"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<View
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_open_door"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/cl_order_time_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/cl_order_time"
|
||||
app:layout_constraintEnd_toEndOf="@+id/cl_order_time"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomOrderInfoView
|
||||
android:id="@+id/cl_order_time"
|
||||
app:charterPBackageViewId="@+id/cl_order_time_press"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_music"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_170"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_music_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_music"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_music"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.impl.MusicCheckView
|
||||
android:id="@+id/actv_music"
|
||||
app:charterPBackageViewId="@+id/actv_music_press"
|
||||
app:charterPselectedDrawable="@drawable/charter_p_bottom_music_press"
|
||||
app:charterPnormalDrawable="@drawable/charter_p_bottom_music_normal"
|
||||
app:charterPBottomTitle="音乐"
|
||||
app:charterPBottomClick="false"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_setting"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_175"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_setting_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_setting"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_setting"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomCheckView
|
||||
@@ -120,20 +150,20 @@
|
||||
app:charterPnormalDrawable="@drawable/charter_p_bottom_softsettiing_normal"
|
||||
app:charterPBottomTitle="设置"
|
||||
app:charterPBottomClick="false"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_order_time"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_line"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actv_line_press"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@drawable/charter_p_bottom_bar_select_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_line"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_line"
|
||||
android:layout_width="@dimen/dp_359"
|
||||
android:layout_width="@dimen/dp_193"
|
||||
android:layout_height="@dimen/dp_107"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomCheckView
|
||||
@@ -143,11 +173,10 @@
|
||||
app:charterPnormalDrawable="@drawable/charter_p_bottom_line_normal"
|
||||
app:charterPBottomTitle="线路"
|
||||
app:charterPBottomClick="false"
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_setting"
|
||||
app:layout_constraintEnd_toStartOf="@+id/aciv_center_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_176"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</merge>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_489"
|
||||
android:layout_width="@dimen/dp_430"
|
||||
android:layout_height="@dimen/dp_107"
|
||||
android:background="@drawable/charter_p_bottom_center_normal"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_107"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_center_image"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="-10dp"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_title"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_center_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_center_image"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_9"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:text="靠边停车"
|
||||
android:textColor="@color/charter_p_090f28"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/default_info"
|
||||
app:constraint_referenced_ids="aciv_center_image,actv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_playing_bg"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/charter_p_play_music_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="@dimen/dp_103"
|
||||
android:layout_height="@dimen/dp_103"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_playing"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"/>
|
||||
</merge>
|
||||
@@ -12,6 +12,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="-10dp"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"/>
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_center_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_center_image"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_4_5"
|
||||
android:layout_marginBottom="@dimen/dp_9"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:text="靠边停车"
|
||||
android:textColor="@color/charter_p_090f28"
|
||||
|
||||
@@ -59,13 +59,6 @@
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.mogo.och.common.module.wigets.ZhiView
|
||||
android:id="@+id/zv_msg_pop_bottom"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_240"
|
||||
android:layout_marginBottom="-20dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!--消息盒子气泡视图-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxBubbleView
|
||||
@@ -121,6 +114,13 @@
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.music.MusicControlView
|
||||
android:id="@+id/mcv_play_music"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<!--底部导航栏-->
|
||||
<com.mogo.och.charter.passenger.ui.bottom.BottomBar
|
||||
android:id="@+id/bb_boorombar"
|
||||
@@ -130,6 +130,13 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.mogo.och.common.module.manager.xiaozhimanager.ZhiView
|
||||
android:id="@+id/zv_msg_pop_bottom"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_240"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!--调试面板-->
|
||||
<com.mogo.och.charter.passenger.ui.debugview.DebugView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:background="@drawable/charter_p_function_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_870"
|
||||
android:layout_height="@dimen/dp_509"
|
||||
android:clickable="true"
|
||||
android:layout_marginBottom="@dimen/dp_110"
|
||||
android:paddingStart="@dimen/dp_35"
|
||||
android:paddingEnd="@dimen/dp_35"
|
||||
android:paddingTop="@dimen/dp_30"
|
||||
android:paddingBottom="@dimen/dp_40"
|
||||
android:background="@drawable/charter_p_music_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.music.list.MusicListView
|
||||
android:id="@+id/mlv_list"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_width="@dimen/dp_339"
|
||||
android:layout_height="@dimen/dp_440"/>
|
||||
|
||||
<com.mogo.och.charter.passenger.ui.music.playing.MusicPlayingView
|
||||
android:id="@+id/mpv_music_info"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_460"
|
||||
android:layout_height="@dimen/dp_440"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/mlv_list"
|
||||
android:src="@drawable/charter_p_music_split"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="@dimen/dp_439"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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"
|
||||
android:layout_width="@dimen/dp_339"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_music_title"
|
||||
android:text="音乐列表"
|
||||
android:textColor="@color/charter_p_253A5A"
|
||||
android:textSize="@dimen/dp_18"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_45"
|
||||
android:layout_marginTop="@dimen/dp_35"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_music_list"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_74"
|
||||
android:paddingTop="@dimen/dp_15"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
</merge>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_51"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_song_name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="@color/charter_p_303C52"
|
||||
android:layout_marginStart="@dimen/dp_45"
|
||||
android:text="音乐名称"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_playing"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_song_name"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_song_name"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_song_name"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:src="@drawable/charter_p_music_list_playing"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/dp_20"
|
||||
android:layout_height="@dimen/dp_16"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tag"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="@color/charter_p_425877"
|
||||
android:textSize="@dimen/dp_11"
|
||||
android:background="@drawable/charter_p_music_list_tag_bg"
|
||||
android:paddingStart="@dimen/dp_4"
|
||||
android:paddingEnd="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_43"
|
||||
android:text="轻柔"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?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"
|
||||
android:layout_width="@dimen/dp_460"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_cover_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/charter_p_music_bg_relax_bottom"
|
||||
android:layout_width="@dimen/dp_197"
|
||||
android:layout_height="@dimen/dp_242"/>
|
||||
|
||||
<ImageView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_45"
|
||||
android:src="@drawable/charter_p_music_bg_middle"
|
||||
android:layout_width="187dp"
|
||||
android:layout_height="162dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_music_cover"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="53.5dp"
|
||||
android:src="@drawable/charter_p_music_bg_relax_head"
|
||||
android:layout_width="@dimen/dp_140_4"
|
||||
android:layout_height="@dimen/dp_140_4"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_music_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_music_cover"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:textSize="@dimen/dp_21"
|
||||
android:textStyle="bold"
|
||||
tools:text="Current"
|
||||
android:textColor="@color/charter_p_303C52"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_author"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_tag"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_music_name"
|
||||
android:textSize="@dimen/dp_17"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
tools:text="Kokia"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_tag"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_author"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:paddingStart="@dimen/dp_10"
|
||||
android:paddingEnd="@dimen/dp_10"
|
||||
android:background="@drawable/charter_p_music_list_tag_bg"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/tv_author"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
tools:text="轻柔"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<SeekBar
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
android:id="@+id/sb_musuc_progess"
|
||||
android:splitTrack="false"
|
||||
android:thumb="@drawable/charter_p_music_seekbar_thumb"
|
||||
android:duplicateParentState="true"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_author"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:progressDrawable="@drawable/charter_p_music_seekbar_style"
|
||||
android:paddingTop="@dimen/dp_15"
|
||||
android:paddingBottom="@dimen/dp_15"
|
||||
android:layout_width="@dimen/dp_270"
|
||||
android:layout_height="@dimen/dp_34"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_playing_time"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:includeFontPadding="false"
|
||||
app:layout_constraintTop_toTopOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintEnd_toStartOf="@+id/sb_musuc_progess"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:gravity="end"
|
||||
tools:text="02:34"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_playing_during"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:includeFontPadding="false"
|
||||
app:layout_constraintTop_toTopOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sb_musuc_progess"
|
||||
app:layout_constraintStart_toEndOf="@+id/sb_musuc_progess"
|
||||
android:textColor="@color/charter_p_576887"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
tools:text="05:56"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_toggle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_29"
|
||||
android:src="@drawable/charter_p_music_play"
|
||||
android:layout_width="@dimen/dp_78"
|
||||
android:layout_height="@dimen/dp_78"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_show_pre"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_toggle"
|
||||
android:layout_marginTop="@dimen/dp_19"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iv_toggle"
|
||||
android:src="@drawable/charter_p_music_pre"
|
||||
android:layout_marginEnd="@dimen/dp_33"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_show_next"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_toggle"
|
||||
android:layout_marginTop="@dimen/dp_19"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_toggle"
|
||||
android:src="@drawable/charter_p_music_next"
|
||||
android:layout_marginStart="@dimen/dp_33"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"/>
|
||||
</merge>
|
||||
@@ -10,10 +10,9 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_936"
|
||||
android:layout_height="@dimen/dp_500"
|
||||
android:layout_marginStart="@dimen/dp_286"
|
||||
android:background="@drawable/charter_p_select_line_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/lsv_line_site"
|
||||
|
||||