[Taxi Passenger v1.1.0] taxi/bus-d taxi-p 接口调整,需求开发
@@ -17,14 +17,14 @@ public class OchBusOrder {
|
||||
* endStationName string
|
||||
*/
|
||||
|
||||
private long orderNo;
|
||||
private String orderNo;
|
||||
private String passengerPhone;
|
||||
private int startStationId;//乘客上车点
|
||||
private String startStationName;
|
||||
private String endStationName;
|
||||
private int endStationId;//乘客下车点
|
||||
|
||||
public void setOrderNo(long orderNo) {
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class OchBusOrder {
|
||||
this.endStationId = endStationId;
|
||||
}
|
||||
|
||||
public long getOrderNo() {
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class QueryLeaveAwayPassengersResponse extends BaseData {
|
||||
|
||||
public static class LeaveAwayPassenger {
|
||||
/**
|
||||
* orderId: 订单id
|
||||
* orderNo: 订单no
|
||||
* orderStatus: 订单状态
|
||||
* orderType:订单类型:0及时,1预约
|
||||
* bookingTime:预计用车时间
|
||||
@@ -40,7 +40,7 @@ class QueryLeaveAwayPassengersResponse extends BaseData {
|
||||
* endSiteGcjPoint:
|
||||
*/
|
||||
//todo 目前是需要乘客电话来通知乘客下车 目前后台没有乘客信息userPhone
|
||||
public long orderNo;
|
||||
public String orderNo;
|
||||
public int orderStatus;
|
||||
public int orderType;
|
||||
public long bookingTime;
|
||||
|
||||
@@ -81,7 +81,8 @@ public interface IOchBusApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/autopilot-car-hailing/order/v2/bus/driving/siteArrivedOrders")
|
||||
// @POST("/autopilot-car-hailing/order/v2/bus/driving/siteArrivedOrders")
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/bus/driving/siteArrivedOrders")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/siteArrivedOrders")
|
||||
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers(@Header ("appId") String appId,@Header("ticket") String ticket,@Body QueryLeaveAwayPassengersRequest request);
|
||||
|
||||
@@ -119,7 +120,8 @@ public interface IOchBusApiService {
|
||||
Observable<OchBusOperationStatusResponse> queryOperationStatus(@Header ("appId") String appId,@Header("ticket") String ticket,@Query("sn") String sn);
|
||||
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@GET("/autopilot-car-hailing/order/v2/bus/servicingOrders/query")
|
||||
// @GET("/autopilot-car-hailing/order/v2/bus/servicingOrders/query")
|
||||
@GET("/autopilot-car-hailing/order/v2/driver/bus/servicingOrders/query")
|
||||
// @GET("/mock/268/autopilot-car-hailing/bus/api/servicingOrders/query")
|
||||
Observable<OchBusOrdersResponse> queryBusOrders(@Header ("appId") String appId,@Header("ticket") String ticket,@Query("sn") String sn);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class OchBusOrderModel {
|
||||
public double mLatitude = 0;
|
||||
private Context mContext;
|
||||
private Disposable mBusOrdersDisposable; //定时轮询小巴车订单
|
||||
private List<Long> prevBusOrderIds = new ArrayList<>();
|
||||
private List<String> prevBusOrderNos = new ArrayList<>();
|
||||
private final List< OchBusStation > stationList = new ArrayList<>();
|
||||
private OchBusRoutesResult ochBusRoutesResult = null;
|
||||
/**
|
||||
@@ -221,7 +221,7 @@ public class OchBusOrderModel {
|
||||
OchBusOrder order = busOrders.get(i);
|
||||
if (order == null) return;
|
||||
if (TextUtils.isEmpty(order.getPassengerPhone())) return;
|
||||
if (prevBusOrderIds.contains(order.getOrderNo())) continue;
|
||||
if (prevBusOrderNos.contains(order.getOrderNo())) continue;
|
||||
try {
|
||||
String tailNum = null;
|
||||
try {
|
||||
@@ -233,7 +233,7 @@ public class OchBusOrderModel {
|
||||
Logger.d(TAG, "TTS:" + tailNum);
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("接到新订单,尾号 " + tailNum
|
||||
+ " 上车站点为 " + order.getStartStationName());
|
||||
prevBusOrderIds.add(order.getOrderNo());
|
||||
prevBusOrderNos.add(order.getOrderNo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
BIN
OCH/mogo-och-taxi-passenger/src/main/assets/map_style.data
Executable file
BIN
OCH/mogo-och-taxi-passenger/src/main/assets/map_style_extra.data
Executable file
@@ -8,9 +8,9 @@ package com.mogo.och.taxi.passenger.bean;
|
||||
public class TaxiPassengerOrderQueryReqBean {
|
||||
|
||||
public String sn;
|
||||
public long orderNo;
|
||||
public String orderNo;
|
||||
|
||||
public TaxiPassengerOrderQueryReqBean(String sn, long orderNo) {
|
||||
public TaxiPassengerOrderQueryReqBean(String sn, String orderNo) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class TaxiPassengerOrderQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result implements Comparable<Result>{
|
||||
// 订单id
|
||||
public long orderNo;
|
||||
// 订单no
|
||||
public String orderNo;
|
||||
// 订单类型
|
||||
public int orderType; //1即时单 2预约单
|
||||
// 订单状态
|
||||
@@ -63,8 +63,8 @@ public class TaxiPassengerOrderQueryRespBean extends BaseData {
|
||||
|
||||
@Override
|
||||
public int compareTo(Result o) {
|
||||
long result = this.orderNo - o.orderNo;
|
||||
return result == 0 ? 0 : (result > 0 ? 1 : -1);
|
||||
boolean isEqual = this.orderNo.equals(o.orderNo);
|
||||
return isEqual ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/10
|
||||
*/
|
||||
public interface ITaxiPassengerMapViewCallback {
|
||||
void onCameraChange(float bearing);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/13
|
||||
*/
|
||||
public interface ITaxiPassengerVeloctityCallback {
|
||||
//限速
|
||||
void onLimitingVelocityChange(int limitingVelocity);
|
||||
}
|
||||
@@ -9,7 +9,8 @@ class TaxiPassengerConst {
|
||||
companion object {
|
||||
|
||||
private const val BASE_URL_OCH_DEV = "http://tech-dev.zhidaohulian.com"
|
||||
private const val BASE_URL_OCH_QA = "https://tech-qa.zhidaohulian.com"
|
||||
// private const val BASE_URL_OCH_QA = "https://tech-qa.zhidaohulian.com"
|
||||
private const val BASE_URL_OCH_QA = "http://tech-dev.zhidaohulian.com"
|
||||
private const val BASE_URL_OCH_RELEASE = "https://tech.zhidaohulian.com"
|
||||
|
||||
@JvmStatic
|
||||
|
||||
@@ -19,8 +19,10 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
@@ -33,6 +35,7 @@ import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerADASStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerVeloctityCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback;
|
||||
@@ -68,8 +71,6 @@ public class TaxiPassengerModel {
|
||||
|
||||
private Context mContext;
|
||||
private volatile int mPrevAPStatus = -1; //前一次自动驾驶状态值
|
||||
private volatile int mOCHCarStatus = -1; //出车/收车状态:1 出车;0 收车
|
||||
private volatile long mPrevOrderId = -1; //前一次的新到单id(当次和前一次orderId相同时,本次不再弹出)
|
||||
private volatile TaxiPassengerOrderQueryRespBean.Result mCurrentOCHOrder; //当前订单
|
||||
private volatile List<TaxiPassengerOrderQueryRespBean.Result> mInServiceList = Collections.emptyList(); //进行中订单
|
||||
private volatile List<TaxiPassengerOrderQueryRespBean.Result> mWaitServiceList = Collections.emptyList(); //待服务订单
|
||||
@@ -77,20 +78,24 @@ public class TaxiPassengerModel {
|
||||
private IOCHTaxiPassengerADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关
|
||||
private IOCHTaxiPassengerControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private IOCHTaxiPassengerOrderStatusCallback mOrderStatusCallback; //Model->Presenter:订单变更
|
||||
|
||||
private IOCHTaxiPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter:自动驾驶线路规划
|
||||
|
||||
private ITaxiPassengerVeloctityCallback mVeloctityCallback;//道路限速返回
|
||||
|
||||
private double mLongitude, mLatitude;
|
||||
|
||||
private TaxiPassengerModel() {
|
||||
}
|
||||
|
||||
public void setMoGoAutopilotPlanningListener(IOCHTaxiPassengerAutopilotPlanningCallback
|
||||
moGoAutopilotPlanningCallback) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback;
|
||||
}
|
||||
|
||||
public void setADASStatusCallback(IOCHTaxiPassengerADASStatusCallback callback) {
|
||||
this.mADASStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setControllerStatusCallback(IOCHTaxiPassengerControllerStatusCallback callback) {
|
||||
this.mControllerStatusCallback = callback;
|
||||
}
|
||||
@@ -99,6 +104,10 @@ public class TaxiPassengerModel {
|
||||
this.mOrderStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setVeloctityCallback(ITaxiPassengerVeloctityCallback callback){
|
||||
this.mVeloctityCallback = callback;
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
mContext = context.getApplicationContext();
|
||||
initListeners();
|
||||
@@ -110,14 +119,16 @@ public class TaxiPassengerModel {
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
apis.getLocationInfoApi().start();
|
||||
}
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopOrderLoop(mOCHCarStatus == 1);
|
||||
}
|
||||
}
|
||||
|
||||
// public void startOrStopOrderLoop(){
|
||||
// startOrStopOrderLoop(mOCHCarStatus == 1);
|
||||
// }
|
||||
/**
|
||||
* 订单轮询
|
||||
*/
|
||||
public void startOrStopOrderLoop(){
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopOrderLoop(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
startOrStopOrderLoop(false);
|
||||
@@ -148,6 +159,9 @@ public class TaxiPassengerModel {
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
|
||||
//增加限速监听
|
||||
CallLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
@@ -211,7 +225,7 @@ public class TaxiPassengerModel {
|
||||
//1.1.2. 当本地有currentOrder:
|
||||
//orderId不一致时:通过currentOrder.orderId查询订单状态,并通知ui更新
|
||||
//orderId一致且orderStatus不一致时:则更新currentOrder,并通知ui更新
|
||||
if (mCurrentOCHOrder.orderNo != data.data.servicing.get(0).orderNo) {
|
||||
if (!mCurrentOCHOrder.orderNo.equals(data.data.servicing.get(0).orderNo)) {
|
||||
queryCurOrderStatus();
|
||||
} else if (mCurrentOCHOrder.orderStatus != data.data.servicing.get(0).orderStatus) {
|
||||
updateNativeCurrentOrder(data.data.servicing.get(0));
|
||||
@@ -240,13 +254,13 @@ public class TaxiPassengerModel {
|
||||
if (mCurrentOCHOrder == null) {
|
||||
return;
|
||||
}
|
||||
final long orderId = mCurrentOCHOrder.orderNo;
|
||||
TaxiPassengerServiceManager.getInstance().queryOrderById(mContext, orderId,
|
||||
final String orderNo = mCurrentOCHOrder.orderNo;
|
||||
TaxiPassengerServiceManager.getInstance().queryOrderById(mContext, orderNo,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerOrderQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerOrderQueryRespBean data) {
|
||||
if (data != null && data.data != null
|
||||
&& mCurrentOCHOrder != null && mCurrentOCHOrder.orderNo == data.data.orderNo) {
|
||||
&& mCurrentOCHOrder != null && mCurrentOCHOrder.orderNo.equals(data.data.orderNo)) {
|
||||
if (data.data.orderStatus == TaxiPassengerOrderStatusEnum.Cancel.getCode()
|
||||
|| data.data.orderStatus == TaxiPassengerOrderStatusEnum.JourneyCompleted.getCode()
|
||||
|| data.data.orderStatus == TaxiPassengerOrderStatusEnum.None.getCode()) {
|
||||
@@ -346,7 +360,7 @@ public class TaxiPassengerModel {
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
startOrStopOrderLoop(mOCHCarStatus == 1);
|
||||
startOrStopOrderLoop(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -484,9 +498,9 @@ public class TaxiPassengerModel {
|
||||
if (DebugConfig.isDebug()) {
|
||||
// TipToast.shortTip("到达目的地");
|
||||
}
|
||||
// updateOCHOrderStatus(OrderStatusEnum.ArriveAtEndStation);
|
||||
}
|
||||
};
|
||||
|
||||
private IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){
|
||||
|
||||
@Override
|
||||
@@ -498,6 +512,20 @@ public class TaxiPassengerModel {
|
||||
public void onAutopilotRotting(AutopilotRouteInfo routeList) {
|
||||
if (null != routeList && routeList.getModels() != null){
|
||||
mAutopilotPlanningCallback.routeResult(routeList.getModels());
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 限速监听
|
||||
*/
|
||||
private LimitingVelocityListener limitingVelocityListener = new LimitingVelocityListener(){
|
||||
|
||||
@Override
|
||||
public void onLimitingVelocityChange(int limitingVelocity) {
|
||||
if (mVeloctityCallback != null){
|
||||
mVeloctityCallback.onLimitingVelocityChange(limitingVelocity);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ interface TaxiPassengerServiceApi {
|
||||
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* 通过orderNo查询订单信息(用于本地已经有orderNo时)
|
||||
* @param data
|
||||
* @return
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
|
||||
@@ -42,6 +42,15 @@ public class TaxiPassengerServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取司机端的sn
|
||||
* @return
|
||||
*/
|
||||
private String getDriverAppSn(){
|
||||
// return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
return "X2020211215MEGXQZJ";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单列表
|
||||
* @param context
|
||||
@@ -55,7 +64,7 @@ public class TaxiPassengerServiceManager {
|
||||
}
|
||||
mOCHTaxiServiceApi.queryOrdersInAndWaitService(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,CallerTelematicManager.INSTANCE.getServerToken()) //获取到司机端的sn
|
||||
,getDriverAppSn()) //获取到司机端的sn
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrdersInAndWaitService"));
|
||||
@@ -64,11 +73,11 @@ public class TaxiPassengerServiceManager {
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param context
|
||||
* @param orderId
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
*/
|
||||
public void queryOrderById(Context context, long orderId,
|
||||
public void queryOrderById(Context context, String orderNo,
|
||||
TaxiPassengerServiceCallback<TaxiPassengerOrderQueryRespBean> callback) {
|
||||
if ( mOCHTaxiServiceApi == null ) {
|
||||
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
@@ -76,8 +85,7 @@ public class TaxiPassengerServiceManager {
|
||||
}
|
||||
mOCHTaxiServiceApi.queryOrderById(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiPassengerOrderQueryReqBean(
|
||||
CallerTelematicManager.INSTANCE.getServerToken(), orderId)) //获取到司机端的sn
|
||||
,new TaxiPassengerOrderQueryReqBean(getDriverAppSn(), orderNo))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderById"));
|
||||
|
||||
@@ -9,26 +9,24 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerADASStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/4
|
||||
*/
|
||||
public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragment> implements IOCHTaxiPassengerADASStatusCallback, IOCHTaxiPassengerControllerStatusCallback , IOCHTaxiPassengerOrderStatusCallback, IOCHTaxiPassengerAutopilotPlanningCallback {
|
||||
public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragment> implements
|
||||
IOCHTaxiPassengerADASStatusCallback, IOCHTaxiPassengerControllerStatusCallback,
|
||||
IOCHTaxiPassengerOrderStatusCallback {
|
||||
|
||||
private static final String TAG = BaseTaxiPassengerPresenter.class.getSimpleName();
|
||||
|
||||
@@ -54,14 +52,12 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
|
||||
private void initListeners() {
|
||||
TaxiPassengerModel.getInstance().setADASStatusCallback(this);
|
||||
TaxiPassengerModel.getInstance().setMoGoAutopilotPlanningListener(this);
|
||||
TaxiPassengerModel.getInstance().setOrderStatusCallback(this);
|
||||
TaxiPassengerModel.getInstance().setControllerStatusCallback(this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
TaxiPassengerModel.getInstance().setADASStatusCallback(null);
|
||||
TaxiPassengerModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
TaxiPassengerModel.getInstance().setOrderStatusCallback(null);
|
||||
TaxiPassengerModel.getInstance().setControllerStatusCallback(null);
|
||||
}
|
||||
@@ -82,6 +78,10 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
return TaxiPassengerModel.getInstance().getCurOrderStatus();
|
||||
}
|
||||
|
||||
public void startOrStopOrderLoop(){
|
||||
TaxiPassengerModel.getInstance().startOrStopOrderLoop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
@@ -111,19 +111,20 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
public void onCarLocationChanged(Location location) {
|
||||
if (null != location){
|
||||
runOnUIThread(() -> mView.updateSpeedView(location.getSpeed()));
|
||||
mView.updateLocation(location.getLatitude(),location.getLongitude());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<AutopilotRouteInfo.RouteModels> models) {
|
||||
mView.routeResult(models);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
Log.d(TAG,"order = "+order.toString());
|
||||
mView.updateCurrentOrderStatusChanged(order);
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStartStation.getCode() == order.orderStatus){
|
||||
mView.showOrHideServingOrderFragment(true);
|
||||
return;
|
||||
}
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEndStation.getCode() == order.orderStatus){
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/6/24 11:33 上午
|
||||
*/
|
||||
public interface ITaxiPassengerMapDirectionView {
|
||||
|
||||
/**
|
||||
* 绘制路径线
|
||||
*/
|
||||
void drawablePolyline();
|
||||
|
||||
/**
|
||||
* 清除路径线
|
||||
*/
|
||||
void clearPolyline();
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.mogo.commons.mvp.BaseFragment;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerMapViewCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerVeloctityCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/8
|
||||
*/
|
||||
public class ITaxiPassengerServingOrderFragment extends BaseFragment implements IOCHTaxiPassengerAutopilotPlanningCallback, IOCHTaxiPassengerOrderStatusCallback, IOCHTaxiPassengerControllerStatusCallback, ITaxiPassengerMapViewCallback, ITaxiPassengerVeloctityCallback {
|
||||
|
||||
private final String TAG = ITaxiPassengerServingOrderFragment.class.getSimpleName();
|
||||
|
||||
private TextView mTPSpeedTv;
|
||||
|
||||
private TextView mTPOrderStatus;
|
||||
private TextView mTPOrderStartStation;
|
||||
private TextView mTPOrderEndStation;
|
||||
private TextView mTPOrderRemainDis;
|
||||
private TextView mTPOrderRemainTime;
|
||||
private TextView mTPOrderRemainArriveTime;
|
||||
private ImageView mMapArrowIcon;
|
||||
|
||||
private TaxiPassengerMapDirectionView mMapDirectionView;
|
||||
private float lastBearing = 0;
|
||||
private RotateAnimation rotateAnimation;
|
||||
|
||||
private SeekBar mProgressSeekBar;
|
||||
|
||||
private int mLimitingVelocity;// 返回的道路限速值
|
||||
|
||||
public static ITaxiPassengerServingOrderFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
ITaxiPassengerServingOrderFragment fragment = new ITaxiPassengerServingOrderFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_p_activity_serving_order_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return "TaxiPassengerServingOrderFragment";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
mTPSpeedTv = findViewById(R.id.taxi_p_speed_tv);
|
||||
mTPSpeedTv.setText(getSpeedTextStyle("0",true));
|
||||
|
||||
mTPOrderStatus = findViewById(R.id.taxi_p_order_status_tv);
|
||||
mTPOrderStartStation = findViewById(R.id.taxi_p_order_status_start_station_tv);
|
||||
mTPOrderEndStation = findViewById(R.id.taxi_p_order_status_end_station_tv);
|
||||
mTPOrderRemainDis = findViewById(R.id.taxi_p_order_remain_distance);
|
||||
mTPOrderRemainTime = findViewById(R.id.taxi_p_order_remain_time);
|
||||
mTPOrderRemainArriveTime = findViewById(R.id.taxi_p_order_remain_arrive_time);
|
||||
|
||||
mMapArrowIcon = findViewById(R.id.taxi_p_arrow_nor);
|
||||
mProgressSeekBar = findViewById(R.id.taxi_p_seekbar);
|
||||
|
||||
mTPOrderStatus.setOnLongClickListener(new View.OnLongClickListener() { //测试用
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
List<AutopilotRouteInfo.RouteModels> list = new ArrayList<>();
|
||||
for (int i = 0; i < 200 ; i++){
|
||||
AutopilotRouteInfo.RouteModels routeModels = new AutopilotRouteInfo.RouteModels();
|
||||
if (i <= 100){
|
||||
routeModels.setLat(40.199248903658166);
|
||||
routeModels.setLon(116.73435586102245 + i * 0.0001);
|
||||
}else {
|
||||
routeModels.setLat(40.199248903658166 + i * 0.0001);
|
||||
routeModels.setLon(116.73435586102245 + 100 * 0.0001);
|
||||
}
|
||||
list.add(routeModels);
|
||||
}
|
||||
routeResult(list);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mMapDirectionView = findViewById(R.id.taxi_p_order_map_view);
|
||||
mMapDirectionView.onCreateView(savedInstanceState);
|
||||
mMapDirectionView.setTaxiPassengerMapViewCallback(this);
|
||||
|
||||
initListener();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置进度条最大值为 起点终点首次规划出的值
|
||||
* @param maxInt
|
||||
*/
|
||||
private void setSeekBarMax(int maxInt){
|
||||
mProgressSeekBar.setMax(maxInt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 行驶进度值更新
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
private void updateDriveProcessLoading(int progressLoading){
|
||||
mProgressSeekBar.setProgress(progressLoading, true);
|
||||
// mProgressSeekBar.setMax(55);
|
||||
// mProgressSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
// @Override
|
||||
// public void onProgressChanged(SeekBar bar, int i, boolean b) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStartTrackingTouch(SeekBar bar) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStopTrackingTouch(SeekBar bar) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
TaxiPassengerModel.getInstance().setMoGoAutopilotPlanningListener(this);
|
||||
TaxiPassengerModel.getInstance().setOrderStatusCallback(this);
|
||||
TaxiPassengerModel.getInstance().setControllerStatusCallback(this);
|
||||
TaxiPassengerModel.getInstance().setVeloctityCallback(this);
|
||||
}
|
||||
|
||||
public void releaseListener(){
|
||||
TaxiPassengerModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
TaxiPassengerModel.getInstance().setOrderStatusCallback(null);
|
||||
TaxiPassengerModel.getInstance().setControllerStatusCallback(null);
|
||||
TaxiPassengerModel.getInstance().setVeloctityCallback(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.onDestroy();
|
||||
}
|
||||
releaseListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<AutopilotRouteInfo.RouteModels> models) {
|
||||
if (models == null) return;
|
||||
|
||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
||||
for (AutopilotRouteInfo.RouteModels routeModel : models) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
|
||||
}
|
||||
Log.d(TAG, "routeResult:" + latLngList.size());
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制
|
||||
* @param coordinates
|
||||
*/
|
||||
private void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.convert(coordinates);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void clearPolyline(){
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearPolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
updateOrderStatusView(order);
|
||||
}
|
||||
|
||||
private void updateOrderStatusView(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
mTPOrderStartStation.setText(order.startSiteAddr);
|
||||
mTPOrderEndStation.setText(order.endSiteAddr);
|
||||
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStartStation.getCode() == order.orderStatus){
|
||||
mTPOrderStatus.setText(getString(R.string.taxi_p_arrive_to_start));
|
||||
return;
|
||||
}
|
||||
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEndStation.getCode() == order.orderStatus){
|
||||
mTPOrderStatus.setText(R.string.taxi_p_start_to_end);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
|
||||
Calendar calendarArrive = TaxiPassengerUtils.formatLongToCalendar(System.currentTimeMillis() + timeInSecond);
|
||||
String arriveTime = TaxiPassengerUtils.formatCalendarToString(calendarArrive, TaxiPassengerUtils.TAXI_HH_mm);
|
||||
DecimalFormat fnum = new DecimalFormat("##0.00");
|
||||
String remainDis = fnum.format((float) meters / 1000);
|
||||
int remainTime = (int) timeInSecond / 60;
|
||||
updateOrderDisAndTimeView(remainDis,remainTime,arriveTime);
|
||||
}
|
||||
|
||||
private void updateOrderDisAndTimeView(String remainDis, int remainTime, String arriveTime) {
|
||||
mTPOrderRemainDis.setText(remainDis);
|
||||
mTPOrderRemainTime.setText(remainTime);
|
||||
mTPOrderRemainArriveTime.setText(arriveTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
if (null != location){
|
||||
runOnUIThread(() -> updateSpeedView(location.getSpeed()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLimitingVelocityChange(int limitingVelocity) {
|
||||
mLimitingVelocity = limitingVelocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新速度
|
||||
* @param newSpeed
|
||||
*/
|
||||
private void updateSpeedView(float newSpeed) {
|
||||
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
|
||||
if (speed < mLimitingVelocity ){
|
||||
mTPSpeedTv.setText(getSpeedTextStyle(String.valueOf(speed),true));
|
||||
}else {
|
||||
mTPSpeedTv.setText(getSpeedTextStyle(String.valueOf(speed), false));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置速度的颜色
|
||||
* @param content
|
||||
* @param isNormal 正常状态 true, 超速状态
|
||||
* @return
|
||||
*/
|
||||
private SpannableStringBuilder getSpeedTextStyle(String content,boolean isNormal){
|
||||
if (isNormal){
|
||||
return TaxiPassengerUtils.getGradientFontSpan(content
|
||||
, 0xFFCEEEFF ,0xFFA1DAFF);
|
||||
}else {//超速
|
||||
return TaxiPassengerUtils.getGradientFontSpan(content
|
||||
,0xFFCEEEFF ,0xFFA1DAFF);//todo 换成报警颜色
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange(float bearing) {
|
||||
startIvCompass(bearing);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置指南针旋转
|
||||
* @param bearing
|
||||
*/
|
||||
private void startIvCompass(float bearing) {
|
||||
bearing = 360 - bearing;
|
||||
Log.d(TAG, "startIvCompass: " + bearing);
|
||||
rotateAnimation = new RotateAnimation(lastBearing, bearing, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
|
||||
rotateAnimation.setFillAfter(true);
|
||||
|
||||
mMapArrowIcon.startAnimation(rotateAnimation);
|
||||
lastBearing = bearing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Shader;
|
||||
import android.text.style.ReplacementSpan;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* 文字渐变
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/8
|
||||
*/
|
||||
public class LinearGradientFontSpan extends ReplacementSpan {
|
||||
|
||||
private int mStartColor;
|
||||
private int mEndColor;
|
||||
private int mSize;
|
||||
private Shader.TileMode mDirection;
|
||||
|
||||
public LinearGradientFontSpan(int startColor, int endColor, Shader.TileMode direction){
|
||||
this.mStartColor = startColor;
|
||||
this.mEndColor = endColor;
|
||||
this.mDirection = direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize(@NonNull Paint paint, CharSequence text, int start, int end
|
||||
, @Nullable Paint.FontMetricsInt fm) {
|
||||
|
||||
mSize = (int) paint.measureText(text,start,end);
|
||||
|
||||
//字体高度设置 需要
|
||||
Paint.FontMetricsInt metricsInt = paint.getFontMetricsInt();
|
||||
if (fm != null){
|
||||
fm.top = metricsInt.top;
|
||||
fm.ascent = metricsInt.ascent;
|
||||
fm.descent = metricsInt.descent;
|
||||
fm.bottom = metricsInt.bottom;
|
||||
}
|
||||
return mSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x,
|
||||
int top, int y, int bottom, @NonNull Paint paint) {
|
||||
LinearGradient linearGradient = new LinearGradient(0,0,0,paint.descent() - paint.ascent(),mStartColor,mEndColor
|
||||
, mDirection);//渐变方向
|
||||
|
||||
paint.setShader(linearGradient);
|
||||
|
||||
canvas.drawText(text,start,end,x,y,paint);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,28 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.presenter.BaseTaxiPassengerPresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
@@ -48,20 +34,17 @@ import java.util.List;
|
||||
public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFragment, BaseTaxiPassengerPresenter> implements IMogoMapListener, TaxiPassengerTaxiView {
|
||||
|
||||
static final String TAG = "BaseOchFragment";
|
||||
private LinearLayout ctvAutopilotStatus;
|
||||
|
||||
private FrameLayout flNaviPanelContainer;
|
||||
private Group groupTestPanel;
|
||||
private TextView mSpeedView;
|
||||
private ImageView mAutopilotImage;
|
||||
private TextView mAutopilotTv;
|
||||
private LinearLayout mMapswitchBtn;
|
||||
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
|
||||
private ImageView mMapswitchBtn;
|
||||
private TextView mLightCountdown;
|
||||
private ImageView mLightIcon;
|
||||
|
||||
protected ITaxiPassengerServingOrderFragment ochServingOrderFragment = null;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
protected double mCurLatitude = 0.0;
|
||||
protected double mCurLongitude = 0.0;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_p_base_fragment;
|
||||
@@ -74,39 +57,30 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
//隐藏小地图
|
||||
CallerSmpManager.hidePanel();
|
||||
|
||||
groupTestPanel = findViewById(R.id.groupTestPanel);
|
||||
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
|
||||
ctvAutopilotStatus.setBackground(getResources().getDrawable(R.drawable.taxi_autopilot_bg_selector));
|
||||
hideEagleConfig();
|
||||
|
||||
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
|
||||
mAutopilotTv = findViewById(R.id.module_och_autopilot_tv);
|
||||
mSpeedView = findViewById(R.id.module_mogo_och_speed_tv);
|
||||
flNaviPanelContainer = findViewById(R.id.module_mogo_och_navi_panel_container);
|
||||
|
||||
if (DebugConfig.isDebug()) {
|
||||
mSpeedView.setLongClickable(true);
|
||||
mSpeedView.setOnLongClickListener(v -> {
|
||||
Log.d(TAG,"长按显示状态工具栏");
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("oper", 52);
|
||||
MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
mLightCountdown = findViewById(R.id.taxi_p_light_countdown_tv);
|
||||
mLightIcon = findViewById(R.id.taxi_p_light_iv);
|
||||
|
||||
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_layout);
|
||||
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
|
||||
mMapswitchBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//视角切换
|
||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.getCurrentMapVisualAngle().isLongSight()) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMarkerManager(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
}
|
||||
@@ -115,23 +89,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
|
||||
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
|
||||
// 模拟 站点下发工控
|
||||
findViewById(R.id.btnAutopilotControl).setOnClickListener(view ->
|
||||
{
|
||||
// Logger.d("lianglihui","模拟 站点下发工控");
|
||||
AutopilotControlParameters currentAutopilot = new AutopilotControlParameters();
|
||||
currentAutopilot.isSpeakVoice = true;
|
||||
// 万集东门站
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.194795425,116.724476409);
|
||||
// 市政府前街18号
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1939540844,116.720067);
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d(TAG, "模拟 订单站点下发:" + currentAutopilot);
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(currentAutopilot);
|
||||
}
|
||||
);
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()){
|
||||
switchVRFlatMode(true);
|
||||
}else {
|
||||
@@ -139,6 +96,25 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏鹰眼原有控件
|
||||
*/
|
||||
private void hideEagleConfig() {
|
||||
//隐藏小地图
|
||||
CallerSmpManager.hidePanel();
|
||||
//是否显示 限速UI
|
||||
HmiBuildConfig.INSTANCE.isShowLimitingVelocityView = false;
|
||||
//是否显示 红绿等
|
||||
HmiBuildConfig.INSTANCE.isShowTrafficLightView = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mPresenter.startOrStopOrderLoop();
|
||||
// showOrHideServingOrderFragment(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* VR mode 转换
|
||||
* @param isVRMode
|
||||
@@ -168,7 +144,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
return;
|
||||
}
|
||||
// 3. 其他过程直接更新
|
||||
startOrStopLoadingAnim(false);
|
||||
AutopilotStatusAnimchanged(status);
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == mPrevAPStatus) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
|
||||
@@ -183,99 +158,28 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
});
|
||||
}
|
||||
|
||||
private AnimationDrawable animationDrawable;
|
||||
public void AutopilotStatusAnimchanged(int status) {
|
||||
// mAutopilotTv.setText(isInAutopilot?"自动驾驶":"开启自动驾驶");
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
mAutopilotTv.setText("自动驾驶");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot);
|
||||
if (animationDrawable == null) {
|
||||
ctvAutopilotStatus.setBackground(getResources().getDrawable(R.drawable.anmi_flow));
|
||||
animationDrawable = (AnimationDrawable) ctvAutopilotStatus.getBackground();
|
||||
}
|
||||
if (animationDrawable.isRunning()) {
|
||||
return;
|
||||
}
|
||||
animationDrawable.selectDrawable(0);
|
||||
animationDrawable.start();
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_p_auto_nor);
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status){
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
mAutopilotTv.setText("自动驾驶");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot);
|
||||
if (animationDrawable != null){
|
||||
animationDrawable.selectDrawable(0);
|
||||
animationDrawable.stop();
|
||||
}
|
||||
ctvAutopilotStatus.setBackground(getResources().getDrawable(R.drawable.taxi_autopilot_bg_selector));
|
||||
animationDrawable = null;
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_p_un_auto_nor);
|
||||
} else {
|
||||
ctvAutopilotStatus.setClickable(false);
|
||||
mAutopilotTv.setText("自动驾驶");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_disable));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_disable);
|
||||
if (animationDrawable != null){
|
||||
animationDrawable.selectDrawable(0);
|
||||
animationDrawable.stop();
|
||||
}
|
||||
ctvAutopilotStatus.setBackground(getResources().getDrawable(R.drawable.taxi_ic_autopilot_bg));
|
||||
animationDrawable = null;
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_p_un_auto_nor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void startAutopilotDone(boolean success) {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator.end();
|
||||
mAutopilotImage.clearAnimation();
|
||||
autopilotLoadingAnimator = null;
|
||||
}
|
||||
if (success) {
|
||||
mAutopilotTv.setText("成功");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_success);
|
||||
} else {
|
||||
mAutopilotTv.setText("失败");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_failed);
|
||||
}
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startOrStopLoadingAnim(false);
|
||||
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
}
|
||||
}, 1000L);
|
||||
}
|
||||
|
||||
private boolean isStarting = false;
|
||||
private ObjectAnimator autopilotLoadingAnimator;
|
||||
public void startOrStopLoadingAnim(boolean start) {
|
||||
if (start) {
|
||||
isStarting = true;
|
||||
mAutopilotTv.setText("启动中");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_loading);
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator = ObjectAnimator.ofFloat(mAutopilotImage,
|
||||
"rotation", 0f, 360f);
|
||||
}
|
||||
autopilotLoadingAnimator.setInterpolator(new LinearInterpolator());
|
||||
autopilotLoadingAnimator.setRepeatCount(-1);//无限循环
|
||||
autopilotLoadingAnimator.setStartDelay(100);
|
||||
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
|
||||
autopilotLoadingAnimator.start();//动画开始
|
||||
} else {
|
||||
isStarting = false;
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator.end();
|
||||
mAutopilotImage.clearAnimation();
|
||||
autopilotLoadingAnimator = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -294,17 +198,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
*/
|
||||
public void updateSpeedView(float newSpeed){
|
||||
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
|
||||
mSpeedView.setText(String.valueOf(speed));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前定位信息
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
*/
|
||||
public void updateLocation(double latitude,double longitude){
|
||||
this.mCurLatitude = latitude;
|
||||
this.mCurLongitude = longitude;
|
||||
// mSpeedView.setText(String.valueOf(speed));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -313,42 +207,31 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机全局路径数据更新
|
||||
* @param models
|
||||
* 显示或隐藏订单信息
|
||||
* @param isShow
|
||||
*/
|
||||
public void routeResult(List<AutopilotRouteInfo.RouteModels> models){
|
||||
//todo 绘制路径规划
|
||||
}
|
||||
public void showOrHideServingOrderFragment(boolean isShow){
|
||||
|
||||
/**
|
||||
* 更新订单信息
|
||||
* @param order
|
||||
*/
|
||||
public void updateCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order){
|
||||
//todo 当到达乘客上车点时,展示信息
|
||||
|
||||
}
|
||||
|
||||
private void showServingOrderFragment(){
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
|
||||
ochServingOrderFragment = new TaxiPassengerServingOrderFragment().newInstance();
|
||||
if (ochServingOrderFragment.isAdded()){
|
||||
return;
|
||||
if (isShow){
|
||||
if(ochServingOrderFragment == null){
|
||||
ochServingOrderFragment = new ITaxiPassengerServingOrderFragment().newInstance();
|
||||
}
|
||||
if (ochServingOrderFragment.isAdded()){
|
||||
transaction.show(ochServingOrderFragment);
|
||||
return;
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochServingOrderFragment)
|
||||
.show(ochServingOrderFragment);
|
||||
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
if (ochServingOrderFragment != null){
|
||||
transaction.hide(ochServingOrderFragment);
|
||||
}
|
||||
flNaviPanelContainer.setVisibility(View.GONE);
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochServingOrderFragment).show(ochServingOrderFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void hideServingOrderFragment(){
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
if (ochServingOrderFragment != null){
|
||||
ochServingOrderFragment.onDestroy();
|
||||
transaction.remove(ochServingOrderFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
ochServingOrderFragment = null;
|
||||
}
|
||||
flNaviPanelContainer.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
*/
|
||||
public class TaxiPassengerCardView extends CardView {
|
||||
|
||||
private int defaultRadius = 0;
|
||||
private float tlRadiu;
|
||||
private float trRadiu;
|
||||
private float brRadiu;
|
||||
private float blRadiu;
|
||||
public TaxiPassengerCardView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaxiPassengerCardView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.materialCardViewStyle);
|
||||
}
|
||||
|
||||
public TaxiPassengerCardView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setRadius(0);
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.TaxiPassengerRoundCorner);
|
||||
|
||||
tlRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_left_top_radius, defaultRadius);
|
||||
trRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_right_top_radius, defaultRadius);
|
||||
brRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_right_bottom_radius, defaultRadius);
|
||||
blRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_left_bottom_radius, defaultRadius);
|
||||
setBackground(new ColorDrawable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
Path path = new Path();
|
||||
RectF rectF = getRectF();
|
||||
float[] readius = {tlRadiu,tlRadiu,trRadiu,trRadiu,brRadiu,brRadiu,blRadiu,blRadiu};
|
||||
path.addRoundRect(rectF,readius,Path.Direction.CW);
|
||||
canvas.clipPath(path, Region.Op.INTERSECT);
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
private RectF getRectF() {
|
||||
Rect rect = new Rect();
|
||||
getDrawingRect(rect);
|
||||
RectF rectF = new RectF(rect);
|
||||
return rectF;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
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.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerMapViewCallback;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerMapAssetStyleUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 乘客屏小地图
|
||||
*/
|
||||
public class TaxiPassengerMapDirectionView
|
||||
extends RelativeLayout
|
||||
implements IMoGoMapLocationListener, ITaxiPassengerMapDirectionView, AMap.OnCameraChangeListener {
|
||||
|
||||
//小地图名称
|
||||
public static final String TAG = "TPMapDirectionView";
|
||||
|
||||
private TextureMapView mAMapNaviView;
|
||||
private AMap mAMap;
|
||||
private Marker mCarMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 13;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
|
||||
private List<Integer> colorList = new ArrayList<>();
|
||||
|
||||
private ITaxiPassengerMapViewCallback mITaxiPassengerMapViewCallback;
|
||||
|
||||
public TaxiPassengerMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaxiPassengerMapDirectionView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaxiPassengerMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
try {
|
||||
initView(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setTaxiPassengerMapViewCallback(ITaxiPassengerMapViewCallback ITaxiPassengerMapViewCallback){
|
||||
this.mITaxiPassengerMapViewCallback = ITaxiPassengerMapViewCallback;
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
Logger.d(TAG, "initView");
|
||||
|
||||
mContext = context;
|
||||
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.taxi_p_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.taxi_p_order_amap_view);
|
||||
|
||||
initAMapView();
|
||||
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
private void initAMapView() {
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(false);
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_car))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_view_dir_end)));
|
||||
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiPassengerMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
|
||||
.setStyleExtraData(TaxiPassengerMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(mCameraUpdate);
|
||||
|
||||
// 设置地图的样式
|
||||
UiSettings uiSettings = mAMap.getUiSettings();
|
||||
uiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
|
||||
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
Logger.d(TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiPassengerMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
|
||||
.setStyleExtraData(TaxiPassengerMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
}
|
||||
});
|
||||
|
||||
//设置地图状态的监听接口
|
||||
mAMap.setOnCameraChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@Nullable MogoLocation location) {
|
||||
Logger.d(TAG, "onCarLocationChanged2 :" + location.getLatitude()+":"+location.getLongitude());
|
||||
if (location == null){
|
||||
return;
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
|
||||
//更新车辆位置
|
||||
if (mCarMarker != null) {
|
||||
Log.d(TAG, "location.getBearing() = " + location.getBearing());
|
||||
mCarMarker.setRotateAngle(360 - location.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
mCarMarker.setToTop();
|
||||
}
|
||||
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
//圈定地图显示范围
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
//存放经纬度
|
||||
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
|
||||
boundsBuilder.include(currentLatLng);
|
||||
boundsBuilder.include(endLatLng);
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(), 100));
|
||||
|
||||
// cameraPosition = new CameraPosition.Builder().bearing(location.getBearing()).build();
|
||||
// mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawablePolyline() {
|
||||
clearPolyline();
|
||||
if (mAMap != null) {
|
||||
|
||||
addRouteColorList();
|
||||
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
|
||||
LatLng startLatLng = mCoordinatesLatLng.get(0);
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
|
||||
mStartMarker.setPosition(startLatLng);
|
||||
mEndMarker.setPosition(endLatLng);
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
|
||||
//设置线段纹理
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
polylineOptions.addAll(mCoordinatesLatLng);
|
||||
polylineOptions.colorValues(colorList); // 1FC3FF -> 57ABFF
|
||||
polylineOptions.useGradient(true);
|
||||
polylineOptions.width(9);
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加画线颜色值
|
||||
*/
|
||||
private void addRouteColorList() {
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
|
||||
if (i <= mCoordinatesLatLng.size()/2){
|
||||
colorList.add(Color.argb(255, 31, 195, 255));//start
|
||||
}else {
|
||||
colorList.add(Color.argb(255, 87, 171, 255));//end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LatLng CoordinateConverterFrom84(Context mContext, MogoLatLng mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MogoLatLng m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
// mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void convert(List<MogoLatLng> coordinates) {
|
||||
mCoordinatesLatLng.clear();
|
||||
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext, coordinates);
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition cameraPosition) {
|
||||
mITaxiPassengerMapViewCallback.onCameraChange(cameraPosition.bearing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish(CameraPosition cameraPosition) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/3
|
||||
*/
|
||||
class TaxiPassengerServingOrderFragment : BaseFragment() {
|
||||
|
||||
private val TAG = "TaxiPassengerServingOrderFragment"
|
||||
|
||||
fun newInstance(): TaxiPassengerServingOrderFragment{
|
||||
val args = Bundle()
|
||||
|
||||
val fragment = TaxiPassengerServingOrderFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
|
||||
init {
|
||||
// TODO: 2022/3/3
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
if (MogoApisHandler.getInstance()
|
||||
.apis
|
||||
.statusManagerApi
|
||||
.isVrMode) {
|
||||
switchVRFlatMode(true)
|
||||
} else {
|
||||
switchVRFlatMode(false)
|
||||
}
|
||||
}
|
||||
|
||||
fun switchVRFlatMode(isVRMode: Boolean) {
|
||||
if (mRootView != null) {
|
||||
mRootView.visibility = if (isVRMode) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机返回的全局路径数据
|
||||
*/
|
||||
fun routeResult(models: List<AutopilotRouteInfo.RouteModels>?) {
|
||||
if (models == null) return
|
||||
val latLngList: MutableList<MogoLatLng> = ArrayList()
|
||||
for (routeModel in models) {
|
||||
latLngList.add(MogoLatLng(routeModel.lat, routeModel.lon))
|
||||
}
|
||||
Log.e(TAG, "routeResult:" + latLngList.size)
|
||||
// if (latLngList.size() > 0) {
|
||||
// drawablePolyline(latLngList);
|
||||
// } else {
|
||||
// clearPolyline();
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.och.taxi.passenger.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/18/20 5:37 PM
|
||||
*/
|
||||
public class TaxiPassengerMapAssetStyleUtil {
|
||||
|
||||
public static byte[] getAssetsStyle(Context context,String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. small_map_style.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] getAssetsExtraStyle(Context context, String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. small_map_style_extra.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.mogo.och.taxi.passenger.utils;
|
||||
|
||||
import android.graphics.Shader;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.och.taxi.passenger.ui.LinearGradientFontSpan;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
@@ -9,7 +14,7 @@ import java.util.Calendar;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/8/20
|
||||
*/
|
||||
public class OchTaxiUtils {
|
||||
public class TaxiPassengerUtils {
|
||||
|
||||
public static final String TAXI_HH_mm = "HH:mm";
|
||||
public static final String TAXI_MM_dd = "MM-dd";
|
||||
@@ -30,8 +35,8 @@ public class OchTaxiUtils {
|
||||
|
||||
public static boolean compareDateIsCurrentDay(Calendar targetCalendar){
|
||||
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
|
||||
String currentDay = formatCalendarToString(currentCale,OchTaxiUtils.TAXI_yyyy_MM_dd);
|
||||
if (currentDay.equals(formatCalendarToString(targetCalendar,OchTaxiUtils.TAXI_yyyy_MM_dd))){
|
||||
String currentDay = formatCalendarToString(currentCale, TaxiPassengerUtils.TAXI_yyyy_MM_dd);
|
||||
if (currentDay.equals(formatCalendarToString(targetCalendar, TaxiPassengerUtils.TAXI_yyyy_MM_dd))){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
@@ -90,4 +95,18 @@ public class OchTaxiUtils {
|
||||
int minute = (int)(seconds % 3600)/60;
|
||||
return String.valueOf(minute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置textview 文字渐变
|
||||
* @param content
|
||||
* @param startColor
|
||||
* @param endColor
|
||||
* @return
|
||||
*/
|
||||
public static SpannableStringBuilder getGradientFontSpan(String content, int startColor, int endColor){
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(content);
|
||||
LinearGradientFontSpan span = new LinearGradientFontSpan(startColor,endColor, Shader.TileMode.REPEAT);
|
||||
builder.setSpan(span,0,builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 1004 B |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 1004 B |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 51 KiB |