[Taxi Passenger v1.1.0] taxi/taxi-p 需求开发(全路径转换成高德坐标系传给后台等);UI调整
@@ -5,7 +5,7 @@ package com.mogo.och.taxi.passenger.callback;
|
||||
* @date: 2021/12/3
|
||||
*/
|
||||
public interface IOCHTaxiPassengerNaviChangedCallback {
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentNaviDistAndTimeChanged(int meters, int timeInSecond);
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒) 、当前路的名称
|
||||
void onCurrentNaviDistAndTimeChanged(int meters, int timeInSecond, String currentRoadName);
|
||||
void reInitNaviAmap(boolean isPlay,boolean isRestart);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public interface IOCHTaxiPassengerOrderStatusCallback {
|
||||
void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order);
|
||||
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentOrderDistToEndChanged(int meters, int timeInSecond);
|
||||
void onCurrentOrderDistToEndChanged(int meters, int timeInSecond, String currentRoadName);
|
||||
|
||||
}
|
||||
|
||||
@@ -37,5 +37,8 @@ class TaxiPassengerConst {
|
||||
|
||||
// 订单信息
|
||||
const val SP_KEY_OCH_TAXI_ORDER = "SP_KEY_OCH_TAXI_ORDER"
|
||||
|
||||
// 订单总里程
|
||||
const val SP_KEY_ORDER_SUM_DIS = "SP_KEY_ORDER_SUM_DIS"
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.text.TextUtils;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -12,10 +12,8 @@ import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
@@ -29,8 +27,10 @@ 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;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerADASStatusCallback;
|
||||
@@ -43,6 +43,7 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerUtils;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -51,7 +52,9 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -83,6 +86,12 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
private volatile List<TaxiPassengerOrderQueryRespBean.Result> mInServiceList = Collections.emptyList(); //进行中订单
|
||||
private volatile List<TaxiPassengerOrderQueryRespBean.Result> mWaitServiceList = Collections.emptyList(); //待服务订单
|
||||
|
||||
public void setmTtsLessThan200Tip(int ttsLessThan200Tip) {
|
||||
this.mTtsLessThan200Tip = ttsLessThan200Tip;
|
||||
}
|
||||
|
||||
private volatile int mTtsLessThan200Tip = 0;//离终点200米提示播报
|
||||
|
||||
private IOCHTaxiPassengerADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关
|
||||
private IOCHTaxiPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter:自动驾驶线路规划
|
||||
|
||||
@@ -312,22 +321,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
});
|
||||
}
|
||||
|
||||
// 车机端上传心跳数据(只在出车状态时上传)
|
||||
// public void runCarHeartbeat() {
|
||||
// TaxiPassengerServiceManager.getInstance().runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
// new TaxiPassengerServiceCallback<BaseData>() {
|
||||
// @Override
|
||||
// public void onSuccess(BaseData data) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(int code, String msg) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 获取当前订单
|
||||
public TaxiPassengerOrderQueryRespBean.Result getCurrentOCHOrder() {
|
||||
return mCurrentOCHOrder;
|
||||
@@ -580,25 +573,51 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* 导航订单起点到终点 获得剩余时间,里程,预计到达时间
|
||||
*/
|
||||
public void naviOrderStartToEnd() {
|
||||
NaviLatLng startNaviLatLng = new NaviLatLng(mLongitude,mLatitude);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(mCurrentOCHOrder.endSiteGcjPoint.get(1), mCurrentOCHOrder.endSiteGcjPoint.get(0));
|
||||
TaxiPassengerNaviToDestinationModel.getInstance(mContext).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
TaxiPassengerNaviToDestinationModel.getInstance(mContext).setOCHTaciNaviChangedCallback(this);
|
||||
TaxiPassengerNaviToDestinationModel.getInstance(mContext).destroyAmaNavi();
|
||||
if (mCurrentOCHOrder != null){
|
||||
NaviLatLng startNaviLatLng = new NaviLatLng(mLatitude,mLongitude);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(mCurrentOCHOrder.endSiteGcjPoint.get(1),mCurrentOCHOrder.endSiteGcjPoint.get(0));
|
||||
TaxiPassengerNaviToDestinationModel.getInstance(mContext).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
TaxiPassengerNaviToDestinationModel.getInstance(mContext).setOCHTaciNaviChangedCallback(this);
|
||||
}
|
||||
// else {
|
||||
// NaviLatLng startNaviLatLng = new NaviLatLng(40.200478,116.741377);
|
||||
// NaviLatLng endNaviLatLng = new NaviLatLng(40.200863,116.732574);
|
||||
// TaxiPassengerNaviToDestinationModel.getInstance(mContext).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
// TaxiPassengerNaviToDestinationModel.getInstance(mContext).setOCHTaciNaviChangedCallback(this);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentNaviDistAndTimeChanged(int meters, int timeInSecond) {
|
||||
public void onCurrentNaviDistAndTimeChanged(int meters, int timeInSecond, String currentRoadName) {
|
||||
if (mTtsLessThan200Tip == 0 && meters <= 200){
|
||||
mTtsLessThan200Tip = 1;
|
||||
runOnUIThread(() -> {
|
||||
AIAssist.getInstance(mContext).speakTTSVoice(mContext.getString(R.string.taxi_p_arrive_end_tts_200));
|
||||
});
|
||||
}
|
||||
for (IOCHTaxiPassengerOrderStatusCallback callback :mOrderStatusCallbackMap.values()){
|
||||
callback.onCurrentOrderDistToEndChanged(meters,timeInSecond);
|
||||
callback.onCurrentOrderDistToEndChanged(meters,timeInSecond,currentRoadName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reInitNaviAmap(boolean isPlay, boolean isRestart) {
|
||||
naviOrderStartToEnd();
|
||||
}
|
||||
|
||||
private void runOnUIThread(Runnable executor) {
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(executor);
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.och.taxi.passenger.model;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
@@ -23,9 +22,11 @@ import com.amap.api.navi.model.AimLessModeStat;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerNaviChangedCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.utils.PermissionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -37,6 +38,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @date: 2021/12/6
|
||||
*/
|
||||
public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
|
||||
private final String TAG = TaxiPassengerNaviToDestinationModel.class.getSimpleName();
|
||||
|
||||
private static Context mContext;
|
||||
private AMapNavi mAMapNavi = null;
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
@@ -45,6 +49,13 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
private IOCHTaxiPassengerNaviChangedCallback mNaviChangedCallback;
|
||||
private AtomicInteger errorCount = new AtomicInteger(0);
|
||||
private boolean isPlay;
|
||||
|
||||
private volatile int mFirstcalculateDriveRoute = 0;
|
||||
public void setFirstcalculateDriveRoute(int firstcalculateDriveRoute) {
|
||||
this.mFirstcalculateDriveRoute = firstcalculateDriveRoute;
|
||||
}
|
||||
|
||||
|
||||
public static TaxiPassengerNaviToDestinationModel getInstance(Context context) {
|
||||
mContext = context;
|
||||
return SingletonHolder.INSTANCE;
|
||||
@@ -63,6 +74,14 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
mAMapNavi.stopSpeak();
|
||||
sList.add(startLatLng);
|
||||
eList.add(endLatLng);
|
||||
int strategy = 0;
|
||||
try {
|
||||
//再次强调,最后一个参数为true时代表多路径,否则代表单路径
|
||||
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -84,6 +103,8 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
mAMapNavi.destroy();
|
||||
mAMapNavi = null;
|
||||
mNaviChangedCallback = null;
|
||||
sList.clear();
|
||||
eList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,38 +119,27 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
//初始化成功
|
||||
/**
|
||||
* 方法: int strategy=mAMapNavi.strategyConvert(congestion, avoidhightspeed, cost, hightspeed, multipleroute); 参数:
|
||||
*
|
||||
* @congestion 躲避拥堵
|
||||
* @avoidhightspeed 不走高速
|
||||
* @cost 避免收费
|
||||
* @hightspeed 高速优先
|
||||
* @multipleroute 多路径
|
||||
*
|
||||
* 说明: 以上参数都是boolean类型,其中multipleroute参数表示是否多条路线,如果为true则此策略会算出多条路线。
|
||||
* 注意: 不走高速与高速优先不能同时为true 高速优先与避免收费不能同时为true
|
||||
*/
|
||||
int strategy = 0;
|
||||
try {
|
||||
//再次强调,最后一个参数为true时代表多路径,否则代表单路径
|
||||
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
|
||||
}
|
||||
@Override
|
||||
public void onCalculateRouteSuccess(int[] ints) {
|
||||
//多路径算路成功回调
|
||||
Logger.d(TAG,"onCalculateRouteSuccess");
|
||||
mAMapNavi.startNavi(NaviType.GPS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(NaviInfo naviinfo) {
|
||||
//导航过程中的信息更新,请看NaviInfo的具体说明
|
||||
Logger.d(TAG,"naviinfo = "+naviinfo.getPathRetainDistance()+" ,"+naviinfo.getPathRetainTime()
|
||||
+" ,"+naviinfo.getCurrentRoadName());
|
||||
|
||||
if (mFirstcalculateDriveRoute == 0 && SharedPrefsMgr.getInstance(mContext).getInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,0) == 0){
|
||||
mFirstcalculateDriveRoute = 1;
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,naviinfo.getPathRetainDistance());
|
||||
}
|
||||
if (null != mNaviChangedCallback){
|
||||
mNaviChangedCallback.onCurrentNaviDistAndTimeChanged(naviinfo.getPathRetainDistance(),naviinfo.getPathRetainTime());// 米、秒
|
||||
mNaviChangedCallback.onCurrentNaviDistAndTimeChanged(naviinfo.getPathRetainDistance()
|
||||
,naviinfo.getPathRetainTime(),naviinfo.getCurrentRoadName());// 米、秒
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,14 +159,12 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
}
|
||||
if (!NetworkUtils.isConnected(mContext) || result.getErrorCode() == 2){
|
||||
TipToast.longTip("网络异常,请重试");
|
||||
if (mNaviChangedCallback != null){
|
||||
mNaviChangedCallback.reInitNaviAmap(isPlay,false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!PermissionUtil.isLocServiceEnable(mContext) || !PermissionUtil.checkPermission(mContext,new String[]{Manifest.permission.ACCESS_FINE_LOCATION})){
|
||||
TipToast.longTip("请开启车机定位后重试");
|
||||
if (mNaviChangedCallback != null){
|
||||
mNaviChangedCallback.reInitNaviAmap(isPlay,false);
|
||||
}
|
||||
@@ -167,8 +175,8 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
|
||||
// }else if (result.getErrorCode() == 6){
|
||||
// TipToast.longTip("终点坐标错误");
|
||||
// }
|
||||
Log.i("dm", "路线计算失败:错误码=" + result.getErrorCode() + ",Error Message= " + result.getErrorDetail());
|
||||
Log.i("dm", "错误码详细链接见:http://lbs.amap.com/api/android-navi-sdk/guide/tools/errorcode/");
|
||||
Logger.i(TAG, "路线计算失败:错误码=" + result.getErrorCode() + ",Error Message= " + result.getErrorDetail());
|
||||
Logger.i(TAG, "错误码详细链接见:http://lbs.amap.com/api/android-navi-sdk/guide/tools/errorcode/");
|
||||
}
|
||||
@Override
|
||||
public void onStartNavi(int type) {
|
||||
|
||||
@@ -9,15 +9,20 @@ 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.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
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.IOCHTaxiPassengerADASStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerNaviToDestinationModel;
|
||||
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment;
|
||||
|
||||
/**
|
||||
@@ -118,26 +123,49 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
Log.d(TAG,"order = "+order.toString());
|
||||
if (mCurrentPassengerOrder == null){
|
||||
mCurrentPassengerOrder = order; //当前无订单
|
||||
updateOrderView(mCurrentPassengerOrder);
|
||||
updateOrderView(order);
|
||||
}else if (mCurrentPassengerOrder.orderStatus != order.orderStatus) {
|
||||
mCurrentPassengerOrder = order;
|
||||
updateOrderView(order);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond, String currentRoadName) {
|
||||
|
||||
}
|
||||
|
||||
private void updateOrderView(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == order.orderStatus){
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
recoverNaviInfo();
|
||||
return;
|
||||
}
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStartStation.getCode() == order.orderStatus
|
||||
|| TaxiPassengerOrderStatusEnum.OnTheWayToEndStation.getCode() == order.orderStatus){
|
||||
mView.showOrHideServingOrderFragment(true);
|
||||
return;
|
||||
}
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtEndStation.getCode() == order.orderStatus){
|
||||
recoverNaviInfo();
|
||||
runOnUIThread(() ->{
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(getContext().getString(R.string.taxi_p_arrive_end_tts));
|
||||
});
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
mView.showOrHideArrivedEndLayout(true,order.endSiteAddr);
|
||||
return;
|
||||
}
|
||||
if (TaxiPassengerOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){
|
||||
mView.showOrHideArrivedEndLayout(false,"");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond) {
|
||||
|
||||
/**
|
||||
* 订单结束或者取消的时候, 刷新导航标识位以及缓存的数据
|
||||
*/
|
||||
public void recoverNaviInfo(){
|
||||
SharedPrefsMgr.getInstance(getContext()).remove(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS);
|
||||
TaxiPassengerNaviToDestinationModel.getInstance(getContext()).setFirstcalculateDriveRoute(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,16 +8,21 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
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.ITaxiPassengerVeloctityCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.ui.TaxiPassengerServingOrderFragment;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
@@ -76,13 +81,18 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
||||
mView.updateOrderStatusView(order);
|
||||
}else if (mCurrentPassengerOrder.orderStatus != order.orderStatus) {
|
||||
mView.updateOrderStatusView(order);
|
||||
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == mCurrentPassengerOrder.orderStatus
|
||||
|| TaxiPassengerOrderStatusEnum.ArriveAtStartStation.getCode() == mCurrentPassengerOrder.orderStatus){
|
||||
TaxiPassengerModel.getInstance().setmTtsLessThan200Tip(0);
|
||||
}
|
||||
mCurrentPassengerOrder = order;
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond) {
|
||||
mView.onCurrentOrderDistToEndChanged(meters,timeInSecond);
|
||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond, String currentRoadName) {
|
||||
mView.onCurrentOrderDistToEndChanged(meters,timeInSecond,currentRoadName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,8 +5,10 @@ import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -41,6 +43,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
private TaxiPassengerTrafficLightView mTrafficLightView;
|
||||
private TaxiPassengerV2XNotificationView mV2XNotificationView;
|
||||
|
||||
private ConstraintLayout mArrivedEndCL;
|
||||
private TextView mArrivedEndStation;
|
||||
|
||||
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
@@ -68,6 +73,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
mV2XNotificationView = new TaxiPassengerV2XNotificationView(getContext());
|
||||
CallerHmiManager.INSTANCE.setProxyNotificationView(mV2XNotificationView);
|
||||
|
||||
mArrivedEndCL = findViewById(R.id.taxi_p_arrive_end_bg);
|
||||
mArrivedEndStation = findViewById(R.id.arrived_end_station);
|
||||
|
||||
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
|
||||
mMapswitchBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -103,7 +111,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
*/
|
||||
private void hideEagleConfig() {
|
||||
//隐藏小地图
|
||||
CallerSmpManager.hidePanel();
|
||||
CallerSmpManager.INSTANCE.hidePanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,4 +231,17 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
}
|
||||
transaction.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示或者隐藏到达乘客站点的洁面
|
||||
* @param isShow
|
||||
*/
|
||||
public void showOrHideArrivedEndLayout(boolean isShow, String arrivedEndStation){
|
||||
if (isShow){
|
||||
mArrivedEndCL.setVisibility(View.VISIBLE);
|
||||
mArrivedEndStation.setText(arrivedEndStation);
|
||||
}else {
|
||||
mArrivedEndCL.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,19 +17,24 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
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.ITaxiPassengerMapViewCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerNaviToDestinationModel;
|
||||
import com.mogo.och.taxi.passenger.presenter.TaxiPassengerServingOrderPresenter;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerUtils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -62,8 +67,11 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
private RotateAnimation rotateAnimation;
|
||||
|
||||
private SeekBar mProgressSeekBar;
|
||||
private TextView mProgessDes;
|
||||
|
||||
private int mLimitingVelocity;// 返回的道路限速值
|
||||
private TaxiPassengerCardView mSpeedLayoutBg;
|
||||
|
||||
private int mLimitingVelocity = 0;// 返回的道路限速值
|
||||
|
||||
public static TaxiPassengerServingOrderFragment newInstance() {
|
||||
|
||||
@@ -99,23 +107,203 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
|
||||
mMapArrowIcon = findViewById(R.id.taxi_p_arrow_nor);
|
||||
mProgressSeekBar = findViewById(R.id.taxi_p_seekbar);
|
||||
mProgessDes = findViewById(R.id.taxi_p_progress_des);
|
||||
|
||||
mSpeedLayoutBg = findViewById(R.id.taxi_p_speed_bg);
|
||||
|
||||
mTPOrderStatus.setOnLongClickListener(new View.OnLongClickListener() { //测试用
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
String listStr = "{\"models\":[{\n" +
|
||||
"\t\t\"lat\": 40.19927810144466,\n" +
|
||||
"\t\t\"lon\": 116.73527259387767\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19927836356079,\n" +
|
||||
"\t\t\"lon\": 116.73513114732762\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19927759500293,\n" +
|
||||
"\t\t\"lon\": 116.73497660879111\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.199264819842284,\n" +
|
||||
"\t\t\"lon\": 116.73480063747202\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1992510141554,\n" +
|
||||
"\t\t\"lon\": 116.73463922037767\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.199245872804,\n" +
|
||||
"\t\t\"lon\": 116.73445960685193\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924673374912,\n" +
|
||||
"\t\t\"lon\": 116.73427704009703\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924747108264,\n" +
|
||||
"\t\t\"lon\": 116.7340707102972\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924828745573,\n" +
|
||||
"\t\t\"lon\": 116.73385916927226\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924941093133,\n" +
|
||||
"\t\t\"lon\": 116.73364048294795\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924939253381,\n" +
|
||||
"\t\t\"lon\": 116.73340837408566\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924949105934,\n" +
|
||||
"\t\t\"lon\": 116.73317368725336\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19925040039033,\n" +
|
||||
"\t\t\"lon\": 116.73296532811216\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1992515355653,\n" +
|
||||
"\t\t\"lon\": 116.73277787366743\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1992512720328,\n" +
|
||||
"\t\t\"lon\": 116.73263377253741\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.199205174954606,\n" +
|
||||
"\t\t\"lon\": 116.73249773114644\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1991015743076,\n" +
|
||||
"\t\t\"lon\": 116.7324219601283\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.198971862686285,\n" +
|
||||
"\t\t\"lon\": 116.73239393296355\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19883883071582,\n" +
|
||||
"\t\t\"lon\": 116.73237676435652\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19870171355796,\n" +
|
||||
"\t\t\"lon\": 116.73236052150362\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1985491853193,\n" +
|
||||
"\t\t\"lon\": 116.73234157857011\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1983890047355,\n" +
|
||||
"\t\t\"lon\": 116.73232167996464\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1982209877466,\n" +
|
||||
"\t\t\"lon\": 116.73230101645792\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.198037574138326,\n" +
|
||||
"\t\t\"lon\": 116.73227735486083\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19787327856243,\n" +
|
||||
"\t\t\"lon\": 116.73225676816314\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19771917207499,\n" +
|
||||
"\t\t\"lon\": 116.73223814728027\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197548305175935,\n" +
|
||||
"\t\t\"lon\": 116.73221624705808\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19739568979691,\n" +
|
||||
"\t\t\"lon\": 116.73219618210774\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19724703821575,\n" +
|
||||
"\t\t\"lon\": 116.73217598293311\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1970956560885,\n" +
|
||||
"\t\t\"lon\": 116.73215773721505\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19697703483188,\n" +
|
||||
"\t\t\"lon\": 116.73214337172284\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19687000725696,\n" +
|
||||
"\t\t\"lon\": 116.73210037067965\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.196833449601726,\n" +
|
||||
"\t\t\"lon\": 116.73196646708011\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19685833847804,\n" +
|
||||
"\t\t\"lon\": 116.73181315361103\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.196889170203264,\n" +
|
||||
"\t\t\"lon\": 116.73164355747393\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19692242860347,\n" +
|
||||
"\t\t\"lon\": 116.7314555399657\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19696431701069,\n" +
|
||||
"\t\t\"lon\": 116.7312261834129\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19700025925464,\n" +
|
||||
"\t\t\"lon\": 116.73102774016093\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19703414798773,\n" +
|
||||
"\t\t\"lon\": 116.73084270562073\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19707287604138,\n" +
|
||||
"\t\t\"lon\": 116.73062835248406\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19710951629977,\n" +
|
||||
"\t\t\"lon\": 116.73041744082339\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19714593807105,\n" +
|
||||
"\t\t\"lon\": 116.73021414314803\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197183297026285,\n" +
|
||||
"\t\t\"lon\": 116.7300057066447\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1972247359487,\n" +
|
||||
"\t\t\"lon\": 116.7297751515664\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19726518822745,\n" +
|
||||
"\t\t\"lon\": 116.72954958923812\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19730538240706,\n" +
|
||||
"\t\t\"lon\": 116.72932440756041\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19734272112662,\n" +
|
||||
"\t\t\"lon\": 116.72911631453036\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197379191549075,\n" +
|
||||
"\t\t\"lon\": 116.72890982812105\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197417565369314,\n" +
|
||||
"\t\t\"lon\": 116.72869447869044\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19746052080799,\n" +
|
||||
"\t\t\"lon\": 116.72845641541247\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19750040582118,\n" +
|
||||
"\t\t\"lon\": 116.72823569991117\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19753999704064,\n" +
|
||||
"\t\t\"lon\": 116.72801998373052\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19757796882569,\n" +
|
||||
"\t\t\"lon\": 116.72781280504363\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197617062364586,\n" +
|
||||
"\t\t\"lon\": 116.72759949431683\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19765391602761,\n" +
|
||||
"\t\t\"lon\": 116.72739776789756\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19768973009218,\n" +
|
||||
"\t\t\"lon\": 116.72719980764646\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197726191028785,\n" +
|
||||
"\t\t\"lon\": 116.72699719861669\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19776233489642,\n" +
|
||||
"\t\t\"lon\": 116.72679516155276\n" +
|
||||
"\t}]}\n";
|
||||
List<MessagePad.Location> list = new ArrayList<>();
|
||||
for (int i = 0; i < 200; i++) {
|
||||
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
AutopilotRouteInfo.RouteModels routeModels = new AutopilotRouteInfo.RouteModels();
|
||||
if (i <= 100) {
|
||||
builder.setLatitude(40.199248903658166);
|
||||
builder.setLongitude(116.73435586102245 + i * 0.0001);
|
||||
} else {
|
||||
builder.setLatitude(40.199248903658166 + i * 0.0001);
|
||||
builder.setLongitude(116.73435586102245 + 100 * 0.0001);
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(listStr);
|
||||
JSONArray jsonElements = jsonObject.getJSONArray("models");
|
||||
for (int i = 0; i < jsonElements.length(); i++){
|
||||
JSONObject s = jsonElements.getJSONObject(i);
|
||||
MessagePad.Location.Builder routeModels = MessagePad.Location.newBuilder();
|
||||
routeModels.setLatitude(s.getDouble("lat"));
|
||||
routeModels.setLongitude(s.getDouble("lon"));
|
||||
list.add(routeModels.build());
|
||||
}
|
||||
list.add(builder.build());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mPresenter.routeResult(list);
|
||||
return true;
|
||||
}
|
||||
@@ -142,7 +330,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
*/
|
||||
private void setSeekBarMax() {
|
||||
//计算订单起点和终点距离
|
||||
int maxInt = TaxiPassengerModel.getInstance().calculateOrderDistanceSum();
|
||||
int maxInt = SharedPrefsMgr.getInstance(getContext()).getInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,0);
|
||||
Logger.d(TAG, "maxInt = " + maxInt);
|
||||
mProgressSeekBar.setMax(maxInt);
|
||||
}
|
||||
@@ -151,9 +339,10 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
* 行驶进度值更新
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
private void updateDriveProcessLoading(int progressLoading) {
|
||||
private void updateDriveProcessLoading(int progressLoading,String currentRoadName) {
|
||||
mProgessDes.setText(currentRoadName);
|
||||
mProgressSeekBar.setProgress(
|
||||
TaxiPassengerModel.getInstance().calculateOrderDistanceSum() - progressLoading
|
||||
SharedPrefsMgr.getInstance(getContext()).getInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,0) - progressLoading
|
||||
, true);
|
||||
}
|
||||
|
||||
@@ -234,24 +423,32 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEndStation.getCode() == order.orderStatus) {
|
||||
mTPOrderStatus.setText(R.string.taxi_p_start_to_end);
|
||||
setSeekBarMax();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 剩余里程,剩余时间,当前定位点所在道路
|
||||
* @param meters
|
||||
* @param timeInSecond
|
||||
* @param currentRoadName
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond) {
|
||||
Calendar calendarArrive = TaxiPassengerUtils.formatLongToCalendar(System.currentTimeMillis() + timeInSecond);
|
||||
String arriveTime = TaxiPassengerUtils.formatCalendarToString(calendarArrive, TaxiPassengerUtils.TAXI_HH_mm);
|
||||
public void onCurrentOrderDistToEndChanged(int meters, int timeInSecond, String currentRoadName) {
|
||||
DecimalFormat fnum = new DecimalFormat("##0.00");
|
||||
String remainDis = fnum.format((float) meters / 1000);
|
||||
int remainTime = (int) timeInSecond / 60;
|
||||
Calendar beforeTime = Calendar.getInstance();
|
||||
beforeTime.add(Calendar.MINUTE,remainTime);
|
||||
String arriveTime = TaxiPassengerUtils.formatCalendarToString(beforeTime,TaxiPassengerUtils.TAXI_HH_mm);
|
||||
updateOrderDisAndTimeView(remainDis, remainTime, arriveTime);
|
||||
updateDriveProcessLoading(meters);
|
||||
updateDriveProcessLoading(meters,currentRoadName);
|
||||
}
|
||||
|
||||
private void updateOrderDisAndTimeView(String remainDis, int remainTime, String arriveTime) {
|
||||
mTPOrderRemainDis.setText(remainDis);
|
||||
mTPOrderRemainTime.setText(remainTime);
|
||||
mTPOrderRemainTime.setText(String.valueOf(remainTime));
|
||||
mTPOrderRemainArriveTime.setText(arriveTime);
|
||||
}
|
||||
|
||||
@@ -270,10 +467,13 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
*/
|
||||
private void updateSpeedView(float newSpeed) {
|
||||
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
|
||||
Logger.d(TAG,"mLimitingVelocity = "+mLimitingVelocity);
|
||||
if (speed < mLimitingVelocity) {
|
||||
mTPSpeedTv.setText(getSpeedTextStyle(String.valueOf(speed), true));
|
||||
mSpeedLayoutBg.setBackgroundResource(R.drawable.taxi_p_speed_light_green_bg);
|
||||
} else {
|
||||
mTPSpeedTv.setText(getSpeedTextStyle(String.valueOf(speed), false));
|
||||
mSpeedLayoutBg.setBackgroundResource(R.drawable.taxi_p_speed_light_red_bg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,6 +488,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
if (isNormal) {
|
||||
return TaxiPassengerUtils.getGradientFontSpan(content
|
||||
, 0xFFCEEEFF, 0xFFA1DAFF);
|
||||
|
||||
} else {//超速
|
||||
return TaxiPassengerUtils.getGradientFontSpan(content
|
||||
, 0xFFFE2505, 0xFFFF6F62);
|
||||
|
||||
|
After Width: | Height: | Size: 941 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 941 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:bottomRightRadius="40px"
|
||||
android:bottomLeftRadius="40px"/>
|
||||
<gradient
|
||||
android:startColor="#26263A5B"
|
||||
android:endColor="#80263A5B"/>
|
||||
</shape>
|
||||
@@ -1,28 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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="20dp"/>
|
||||
<solid android:color="#576F6F6F" />
|
||||
<solid android:color="#00e2e2e2" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 第二进度条的背景色 -->
|
||||
<!--<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape android:shape="rectangle" >
|
||||
<solid android:color="#98E3D9" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>-->
|
||||
<!-- <item android:id="@+android:id/background" android:drawable="@drawable/bar_dn" /> -->
|
||||
<!-- 可拖动的进度条颜色 -->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="20dp"/>
|
||||
<solid android:color="#FC82B7F6" />
|
||||
<solid android:color="#84D4FF" /> <!-- #3FA5FF #84D4FF 渐变-->
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
@@ -8,11 +8,22 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/taxi_p_order_panel_width"
|
||||
android:layout_height="@dimen/taxi_p_order_panel_height"
|
||||
android:layout_marginTop="@dimen/dp_72"
|
||||
android:layout_marginTop="@dimen/dp_55"
|
||||
android:background="@drawable/taxi_passenger_order_bg"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerCardView
|
||||
android:id="@+id/taxi_p_speed_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:taxi_right_top_radius="@dimen/dp_40"
|
||||
app:taxi_left_top_radius="@dimen/dp_40"
|
||||
android:background="@drawable/taxi_p_speed_light_green_bg"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/taxi_p_order_stations"
|
||||
android:layout_width="match_parent"
|
||||
@@ -116,6 +127,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#84D4FF"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="42px"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -128,6 +140,7 @@
|
||||
android:layout_toRightOf="@+id/taxi_p_order_remain_distance"
|
||||
android:text="KM"
|
||||
android:textColor="#FFFFFF"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="20px" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -139,6 +152,7 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:text="距离"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#8FB3EF"
|
||||
android:textSize="20px" />
|
||||
|
||||
@@ -165,6 +179,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="#84D4FF"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="42px"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -177,6 +192,7 @@
|
||||
android:layout_toRightOf="@+id/taxi_p_order_remain_time"
|
||||
android:text="分钟"
|
||||
android:textColor="#FFFFFF"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="20px" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -188,6 +204,7 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:text="剩余"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#8FB3EF"
|
||||
android:textSize="20px" />
|
||||
|
||||
@@ -207,6 +224,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="0"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#84D4FF"
|
||||
android:textSize="42px"
|
||||
android:textStyle="bold" />
|
||||
@@ -219,6 +237,7 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:text="到达"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="#8FB3EF"
|
||||
android:textSize="20px" />
|
||||
|
||||
@@ -235,25 +254,43 @@
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/taxi_p_seekbar"
|
||||
android:layout_width="248px"
|
||||
android:layout_height="6px"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:thumbOffset="0dp"
|
||||
android:focusable="true"
|
||||
style="@style/CustomSeekbarStyle"
|
||||
android:layout_marginBottom="36px"
|
||||
android:layout_marginLeft="34px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:thumb="@drawable/taxi_p_arrow_nor"/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/taxi_p_progress_des"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/taxi_p_seekbar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/taxi_p_seekbar"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/taxi_p_progress_des_size"
|
||||
android:textStyle="italic"
|
||||
android:typeface="monospace"
|
||||
android:layout_marginBottom="@dimen/dp_15"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/taxi_p_arrow_nor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="44px"
|
||||
android:layout_marginBottom="30px"
|
||||
android:layout_marginRight="@dimen/dp_44"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:src="@drawable/taxi_p_arrow_nor"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_124"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:background="@drawable/taxi_p_map_bottom_shape"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -269,12 +306,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_28"
|
||||
android:shadowColor="#D1193D66"
|
||||
android:shadowColor="@color/taxi_p_speed_color"
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:includeFontPadding="false"
|
||||
android:text="0"
|
||||
android:textSize="120px"
|
||||
android:textSize="@dimen/taxi_p_speed_size"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
@@ -283,6 +321,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_12"
|
||||
android:text="KM/h"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="26px" />
|
||||
|
||||
|
||||
@@ -113,4 +113,55 @@
|
||||
android:layout_marginRight="@dimen/taxi_p_traffic_light_layout_margin_right"
|
||||
android:layout_marginTop="@dimen/taxi_p_traffic_light_layout_margin_top"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/taxi_p_arrive_end_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/taxi_p_arrive_end_panel_bg"
|
||||
android:visibility="gone">
|
||||
<TextView
|
||||
android:id="@+id/arrived_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_190"
|
||||
android:layout_marginLeft="@dimen/dp_88"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/taxi_p_arrived_title"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/taxi_p_arrived_end_tv_size"/>
|
||||
<TextView
|
||||
android:id="@+id/arrived_end_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
app:layout_constraintTop_toTopOf="@+id/arrived_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/arrived_title"
|
||||
app:layout_constraintLeft_toRightOf="@+id/arrived_title"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:textSize="@dimen/taxi_p_arrived_end_tv_size"
|
||||
android:includeFontPadding="false"
|
||||
android:textStyle="bold"/>
|
||||
<TextView
|
||||
android:id="@+id/arrived_end_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/arrived_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/arrived_title"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:textColor="@color/taxi_p_arrive_end_tip_color"
|
||||
android:textSize="@dimen/taxi_p_arrived_end_tip_size"
|
||||
android:text="@string/taxi_p_arrived_end_tips"/>
|
||||
<View
|
||||
android:layout_width="@dimen/dp_18"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/taxi_p_arrive_end_bg_line_color"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/arrived_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/arrived_end_tip"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,8 +3,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:taxi_right_bottom_radius="40px"
|
||||
app:taxi_left_bottom_radius="40px">
|
||||
app:taxi_right_bottom_radius="@dimen/dp_40"
|
||||
app:taxi_left_bottom_radius="@dimen/dp_40">
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/taxi_p_order_amap_view"
|
||||
|
||||
@@ -47,4 +47,10 @@
|
||||
<dimen name="taxi_p_v2x_notification_icon_size">120px</dimen>
|
||||
<dimen name="taxi_p_v2x_notification_text_size">39px</dimen>
|
||||
<dimen name="taxi_p_v2x_notification_text_margin_left">20px</dimen>
|
||||
|
||||
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
|
||||
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
|
||||
|
||||
<dimen name="taxi_p_speed_size">120px</dimen>
|
||||
<dimen name="taxi_p_progress_des_size">28px</dimen>
|
||||
</resources>
|
||||
@@ -24,6 +24,12 @@
|
||||
<dimen name="module_mogo_och_operation_status_bg_width">120px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_bg_height">120px</dimen>
|
||||
|
||||
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
|
||||
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
|
||||
|
||||
<dimen name="taxi_p_speed_size">120px</dimen>
|
||||
<dimen name="taxi_p_progress_des_size">28px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_operation_status_padding">83px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_order_m_t">40px</dimen>
|
||||
|
||||
@@ -25,4 +25,9 @@
|
||||
<color name="taxi_p_traffic_light_yellow_color_down">#FF9B00</color>
|
||||
|
||||
<color name="taxi_p_v2x_notification_bg_color">#80000000</color>
|
||||
|
||||
<color name="taxi_p_arrive_end_bg_line_color">#F8B70A</color>
|
||||
<color name="taxi_p_arrive_end_tip_color">#C6D9FA</color>
|
||||
|
||||
<color name="taxi_p_speed_color">#D1193D66</color>
|
||||
</resources>
|
||||
@@ -108,4 +108,10 @@
|
||||
<dimen name="taxi_p_v2x_notification_icon_size">120px</dimen>
|
||||
<dimen name="taxi_p_v2x_notification_text_size">39px</dimen>
|
||||
<dimen name="taxi_p_v2x_notification_text_margin_left">20px</dimen>
|
||||
|
||||
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
|
||||
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
|
||||
|
||||
<dimen name="taxi_p_speed_size">120px</dimen>
|
||||
<dimen name="taxi_p_progress_des_size">28px</dimen>
|
||||
</resources>
|
||||
@@ -20,4 +20,8 @@
|
||||
<string name="module_och_taxi_order_server_end">服务完成</string>
|
||||
<string name="taxi_p_arrive_to_start">准备出发</string>
|
||||
<string name="taxi_p_start_to_end">正在前往目的地</string>
|
||||
<string name="taxi_p_arrive_end_tts_200">即将到达目的地,请您收好好随声物品,准备下车</string>
|
||||
<string name="taxi_p_arrive_end_tts">已达到目的地,请从右侧下车,感谢乘坐蘑菇车联无人驾驶车</string>
|
||||
<string name="taxi_p_arrived_title">已到达</string>
|
||||
<string name="taxi_p_arrived_end_tips">感谢您使用蘑菇车联自动驾驶出行服务,期待下次与您相遇</string>
|
||||
</resources>
|
||||
@@ -10,4 +10,13 @@
|
||||
<style name="och_speed_style2">
|
||||
<item name="android:textSize">32px</item>
|
||||
</style>
|
||||
|
||||
<!--自定义seekbarstyle-->
|
||||
<style name="CustomSeekbarStyle" >
|
||||
<item name="android:height">20px</item>
|
||||
<item name="android:width">248px</item>
|
||||
<item name="android:indeterminateOnly">false</item>
|
||||
<item name="android:progressDrawable">@drawable/taxi_p_seekbar_calculator_layer</item>
|
||||
<item name="android:thumb">@drawable/taxi_p_seekbar_point_icon</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -8,6 +8,8 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -1047,7 +1049,6 @@ public class MogoOCHTaxiModelNew {
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||
// mAutopilotPlanningCallback.routeResult(routeList.getModels());
|
||||
updateOrderRoute(routeList.getWayPointsList());
|
||||
}
|
||||
}
|
||||
@@ -1065,14 +1066,7 @@ public class MogoOCHTaxiModelNew {
|
||||
*/
|
||||
public void updateOrderRoute(List<MessagePad.Location> models) {
|
||||
|
||||
List<OrderRouteUpdateReqBean.Result> points = new ArrayList<>();
|
||||
|
||||
for (int i =0; i < models.size(); i++){
|
||||
OrderRouteUpdateReqBean.Result point = new OrderRouteUpdateReqBean.Result();
|
||||
point.latitude = models.get(i).getLatitude();
|
||||
point.longitude = models.get(i).getLongitude();
|
||||
points.add(point);
|
||||
}
|
||||
List<OrderRouteUpdateReqBean.Result> points = CoordinateConverterFrom84ForList(mContext,models);
|
||||
|
||||
OCHTaxiServiceManagerNew.getInstance().updateOrderRoute(mContext, mCurrentOCHOrder.orderNo
|
||||
, points, new OCHTaxiServiceCallback<BaseData>() {
|
||||
@@ -1088,5 +1082,25 @@ public class MogoOCHTaxiModelNew {
|
||||
});
|
||||
}
|
||||
|
||||
private List<OrderRouteUpdateReqBean.Result> CoordinateConverterFrom84ForList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<OrderRouteUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
|
||||
OrderRouteUpdateReqBean.Result result = new OrderRouteUpdateReqBean.Result();
|
||||
result.latitude = mogoLatLng.latitude;
|
||||
result.longitude = mogoLatLng.longitude;
|
||||
points.add(result);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
private LatLng CoordinateConverterFrom84(Context mContext, MessagePad.Location mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.getLatitude(), mogoLatLng.getLongitude()));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
@@ -10,8 +11,11 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.taxi.R;
|
||||
@@ -22,6 +26,10 @@ import com.mogo.och.taxi.model.MogoOCHTaxiModelNew;
|
||||
import com.mogo.och.taxi.presenter.OCHTaxiPresenter;
|
||||
import com.mogo.och.taxi.utils.PinYinUtil;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -317,21 +325,224 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment<OCHTaxiFragment, OCH
|
||||
MogoOCHTaxiModelNew.getInstance().setOnTheWayToEndStation();
|
||||
});
|
||||
findViewById(R.id.test_bar_send_route).setOnClickListener(v -> {
|
||||
|
||||
String listStr = "{\"models\":[{\n" +
|
||||
"\t\t\"lat\": 40.19927810144466,\n" +
|
||||
"\t\t\"lon\": 116.73527259387767\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19927836356079,\n" +
|
||||
"\t\t\"lon\": 116.73513114732762\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19927759500293,\n" +
|
||||
"\t\t\"lon\": 116.73497660879111\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.199264819842284,\n" +
|
||||
"\t\t\"lon\": 116.73480063747202\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1992510141554,\n" +
|
||||
"\t\t\"lon\": 116.73463922037767\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.199245872804,\n" +
|
||||
"\t\t\"lon\": 116.73445960685193\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924673374912,\n" +
|
||||
"\t\t\"lon\": 116.73427704009703\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924747108264,\n" +
|
||||
"\t\t\"lon\": 116.7340707102972\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924828745573,\n" +
|
||||
"\t\t\"lon\": 116.73385916927226\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924941093133,\n" +
|
||||
"\t\t\"lon\": 116.73364048294795\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924939253381,\n" +
|
||||
"\t\t\"lon\": 116.73340837408566\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19924949105934,\n" +
|
||||
"\t\t\"lon\": 116.73317368725336\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19925040039033,\n" +
|
||||
"\t\t\"lon\": 116.73296532811216\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1992515355653,\n" +
|
||||
"\t\t\"lon\": 116.73277787366743\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1992512720328,\n" +
|
||||
"\t\t\"lon\": 116.73263377253741\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.199205174954606,\n" +
|
||||
"\t\t\"lon\": 116.73249773114644\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1991015743076,\n" +
|
||||
"\t\t\"lon\": 116.7324219601283\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.198971862686285,\n" +
|
||||
"\t\t\"lon\": 116.73239393296355\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19883883071582,\n" +
|
||||
"\t\t\"lon\": 116.73237676435652\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19870171355796,\n" +
|
||||
"\t\t\"lon\": 116.73236052150362\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1985491853193,\n" +
|
||||
"\t\t\"lon\": 116.73234157857011\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1983890047355,\n" +
|
||||
"\t\t\"lon\": 116.73232167996464\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1982209877466,\n" +
|
||||
"\t\t\"lon\": 116.73230101645792\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.198037574138326,\n" +
|
||||
"\t\t\"lon\": 116.73227735486083\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19787327856243,\n" +
|
||||
"\t\t\"lon\": 116.73225676816314\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19771917207499,\n" +
|
||||
"\t\t\"lon\": 116.73223814728027\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197548305175935,\n" +
|
||||
"\t\t\"lon\": 116.73221624705808\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19739568979691,\n" +
|
||||
"\t\t\"lon\": 116.73219618210774\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19724703821575,\n" +
|
||||
"\t\t\"lon\": 116.73217598293311\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1970956560885,\n" +
|
||||
"\t\t\"lon\": 116.73215773721505\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19697703483188,\n" +
|
||||
"\t\t\"lon\": 116.73214337172284\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19687000725696,\n" +
|
||||
"\t\t\"lon\": 116.73210037067965\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.196833449601726,\n" +
|
||||
"\t\t\"lon\": 116.73196646708011\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19685833847804,\n" +
|
||||
"\t\t\"lon\": 116.73181315361103\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.196889170203264,\n" +
|
||||
"\t\t\"lon\": 116.73164355747393\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19692242860347,\n" +
|
||||
"\t\t\"lon\": 116.7314555399657\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19696431701069,\n" +
|
||||
"\t\t\"lon\": 116.7312261834129\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19700025925464,\n" +
|
||||
"\t\t\"lon\": 116.73102774016093\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19703414798773,\n" +
|
||||
"\t\t\"lon\": 116.73084270562073\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19707287604138,\n" +
|
||||
"\t\t\"lon\": 116.73062835248406\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19710951629977,\n" +
|
||||
"\t\t\"lon\": 116.73041744082339\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19714593807105,\n" +
|
||||
"\t\t\"lon\": 116.73021414314803\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197183297026285,\n" +
|
||||
"\t\t\"lon\": 116.7300057066447\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.1972247359487,\n" +
|
||||
"\t\t\"lon\": 116.7297751515664\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19726518822745,\n" +
|
||||
"\t\t\"lon\": 116.72954958923812\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19730538240706,\n" +
|
||||
"\t\t\"lon\": 116.72932440756041\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19734272112662,\n" +
|
||||
"\t\t\"lon\": 116.72911631453036\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197379191549075,\n" +
|
||||
"\t\t\"lon\": 116.72890982812105\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197417565369314,\n" +
|
||||
"\t\t\"lon\": 116.72869447869044\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19746052080799,\n" +
|
||||
"\t\t\"lon\": 116.72845641541247\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19750040582118,\n" +
|
||||
"\t\t\"lon\": 116.72823569991117\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19753999704064,\n" +
|
||||
"\t\t\"lon\": 116.72801998373052\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19757796882569,\n" +
|
||||
"\t\t\"lon\": 116.72781280504363\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197617062364586,\n" +
|
||||
"\t\t\"lon\": 116.72759949431683\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19765391602761,\n" +
|
||||
"\t\t\"lon\": 116.72739776789756\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19768973009218,\n" +
|
||||
"\t\t\"lon\": 116.72719980764646\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.197726191028785,\n" +
|
||||
"\t\t\"lon\": 116.72699719861669\n" +
|
||||
"\t}, {\n" +
|
||||
"\t\t\"lat\": 40.19776233489642,\n" +
|
||||
"\t\t\"lon\": 116.72679516155276\n" +
|
||||
"\t}]}\n";
|
||||
|
||||
|
||||
List<MessagePad.Location> list = new ArrayList<>();
|
||||
for (int i = 0; i < 200 ; i++){
|
||||
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
if (i <= 100){
|
||||
builder.setLatitude(40.199248903658166);
|
||||
builder.setLongitude(116.73435586102245 + i * 0.0001);
|
||||
}else {
|
||||
builder.setLatitude(40.199248903658166 + i * 0.0001);
|
||||
builder.setLongitude(116.73435586102245 + 100 * 0.0001);
|
||||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(listStr);
|
||||
JSONArray jsonElements = jsonObject.getJSONArray("models");
|
||||
for (int i = 0; i < jsonElements.length(); i++){
|
||||
JSONObject s = jsonElements.getJSONObject(i);
|
||||
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
builder.setLatitude(s.getDouble("lat"));
|
||||
builder.setLongitude(s.getDouble("lon"));
|
||||
list.add(builder.build());
|
||||
}
|
||||
list.add(builder.build());
|
||||
List<MessagePad.Location> list1 = CoordinateConverterFrom84ForList(getContext(),list);
|
||||
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list1);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list);
|
||||
});
|
||||
}
|
||||
|
||||
public List<MessagePad.Location> CoordinateConverterFrom84ForList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<MessagePad.Location> list = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
|
||||
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
builder.setLatitude(mogoLatLng.latitude);
|
||||
builder.setLongitude(mogoLatLng.longitude);
|
||||
list.add(builder.build());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public LatLng CoordinateConverterFrom84(Context mContext, MessagePad.Location mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.getLatitude(), mogoLatLng.getLongitude()));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
public void clickTestBar(){
|
||||
View testBar = findViewById(R.id.module_och_taxi_order_status_change_test_bar);
|
||||
if (testBar.getVisibility() == View.VISIBLE) {
|
||||
|
||||