From b42d06310767ca7bd713019e4579bc0440a5cddc Mon Sep 17 00:00:00 2001 From: lianglihui Date: Wed, 7 Jul 2021 14:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BA=A6=E8=BD=A6=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=89=A9=E4=BD=99=E9=87=8C=E7=A8=8B=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=80=BB=E8=BE=91=20=E6=A0=B9=E6=8D=AE=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E4=BF=AE=E6=94=B9tts=E8=AF=AD?= =?UTF-8?q?=E9=9F=B3=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/taxi/MogoOCHTaxiModel.java | 11 +++ .../mogo/och/taxi/OCHTaxiOrderResponse.java | 3 +- .../com/mogo/och/taxi/ui/OCHTaxiFragment.java | 82 ++++++++++--------- .../src/main/res/values/strings.xml | 2 +- 4 files changed, 57 insertions(+), 41 deletions(-) diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java index 4be0a3c8d3..eadc1b4e44 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java @@ -807,6 +807,17 @@ class MogoOCHTaxiModel { return mCurrentOCHOrder; } + public void calculateTravelDistance(Location carLocation){ + if (mCurrentOCHOrder.drivingRoutes != null && mCurrentOCHOrder.drivingRoutes.size()>0){ + OCHTaxiOrderResponse.OCHTaxiStation endStationOCHLocation = mCurrentOCHOrder.drivingRoutes.get(1); + double distance = CoordinateUtils.calculateLineDistance( + endStationOCHLocation.lon, endStationOCHLocation.lat, + carLocation.getLongitude(), carLocation.getLatitude()); + Logger.e("lianglihui","剩余里程:"+distance); + mCurrentOCHOrder.decreaseTravelDistance(distance); + } + } + /** * 结束自动驾驶 */ diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/OCHTaxiOrderResponse.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/OCHTaxiOrderResponse.java index f969f4e47a..cc5f998d67 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/OCHTaxiOrderResponse.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/OCHTaxiOrderResponse.java @@ -33,7 +33,8 @@ class OCHTaxiOrderResponse implements Parcelable { * @param distance */ public void decreaseTravelDistance( double distance ) { - travelDistance -= ( ( float ) distance / 1000f ); +// travelDistance -= ( ( float ) distance / 1000f ); + travelDistance = distance; if ( travelDistance < 0 ) { travelDistance = 0; } diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java index a7006b800e..895b7a9438 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java @@ -170,6 +170,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i } } + private boolean isSpeakedEndingNotice = false; /** * 初始化订单信息 */ @@ -180,7 +181,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i slidePanelView.setVisibility( View.VISIBLE ); slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_end_station ) ); mOrderStatus.setText( R.string.module_och_taxi_arrive_at_end_station2 ); - showNotice( getString( R.string.module_och_taxi_order_complete_1) ); + SpeakNoticeOnce(); } else if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) { Logger.d( TAG, "已经去往终点" ); slidePanelView.setVisibility( View.GONE ); @@ -188,15 +189,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i } else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) { Logger.d( TAG, "已经达到起点" ); mOrderStatus.setText( R.string.module_och_taxi_waiting ); -// if ( MogoOCHTaxiModel.getInstance().isUserArriveAtStartStation() ) { -// Logger.d( TAG, "乘客已上车" ); -// slidePanelView.setVisibility( View.VISIBLE ); -//// if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE ) { -//// } else { -//// slidePanelView.setVisibility( View.GONE ); -//// } -// slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) ); -// } slidePanelView.setVisibility( View.VISIBLE ); slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) ); } else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) { @@ -206,6 +198,13 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i } } + public synchronized void SpeakNoticeOnce(){ + if (!isSpeakedEndingNotice){ + isSpeakedEndingNotice = true; + showNotice( getString( R.string.module_och_taxi_order_complete_1) ); + } + } + /** * 更新订单基本信息 */ @@ -378,17 +377,17 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i calculateTravelDistance( location ); } ); - //坐标转换 - MogoLocation loc = new MogoLocation(); - loc.setTime(loc.getTime()); - loc.setAccuracy(location.getAccuracy()); - loc.setSpeed(location.getSpeed()); - loc.setLongitude(location.getLongitude()); - loc.setLatitude(location.getLatitude()); - loc.setAltitude(location.getAltitude()); - loc.setBearing(location.getBearing()); - loc.setProvider(location.getProvider()); - mogoLocation = loc; +// //坐标转换 +// MogoLocation loc = new MogoLocation(); +// loc.setTime(loc.getTime()); +// loc.setAccuracy(location.getAccuracy()); +// loc.setSpeed(location.getSpeed()); +// loc.setLongitude(location.getLongitude()); +// loc.setLatitude(location.getLatitude()); +// loc.setAltitude(location.getAltitude()); +// loc.setBearing(location.getBearing()); +// loc.setProvider(location.getProvider()); +// mogoLocation = loc; } /** @@ -400,21 +399,26 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i if ( location == null ) { return; } - if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) { - return; - } - if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) { - return; - } +// if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) { +// return; +// } +// if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) { +// return; +// } if ( mLocation == null ) { mLocation = location; } - double distance = CoordinateUtils.calculateLineDistance( - location.getLongitude(), location.getLatitude(), - mLocation.getLongitude(), mLocation.getLatitude() - ); - if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) { - MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance ); +// double distance = CoordinateUtils.calculateLineDistance( +// location.getLongitude(), location.getLatitude(), +// mLocation.getLongitude(), mLocation.getLatitude() +// ); +// Logger.e("lianglihui","calculateTravelDistance:"+distance); + + if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() && + MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() && + !MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) { + MogoOCHTaxiModel.getInstance().calculateTravelDistance(location); +// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance ); updateOrderBaseStatusInfo(); } mLocation = location; @@ -451,6 +455,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i }else { getPanelView().setVisibility(View.VISIBLE); changeOperationViewVisible(View.INVISIBLE); + OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( this ); } updateOrderStatus(); }); @@ -460,11 +465,11 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i @Override public void routeResult(List routeList) { if (routeList == null ) return; - double distance = calculateTravelDistance(mogoLocation,routeList); - if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) { - MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance ); - updateOrderBaseStatusInfo(); - } +// double distance = calculateTravelDistance(mogoLocation,routeList); +// if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) { +// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance ); +// updateOrderBaseStatusInfo(); +// } // Logger.d("lianglihui","routeResult 剩余导航距离:"+distance); // if (routeList != null && routeList.size() >0){ // Logger.d("lianglihui","routeResult:"+routeList.size()); @@ -506,7 +511,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i public void onArriveAt(AdasOCHData data) { Logger.d( TAG, "行程结束"); MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot(); -// AIAssist.getInstance( getContext() ).speakTTSVoice( "即将到达目的地,请您携带好随身物品,安全下车。" ); } @Override diff --git a/OCH/mogo-och-taxi/src/main/res/values/strings.xml b/OCH/mogo-och-taxi/src/main/res/values/strings.xml index f4e8e0ce70..edb1423ef5 100644 --- a/OCH/mogo-och-taxi/src/main/res/values/strings.xml +++ b/OCH/mogo-och-taxi/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - 乘客已上车,准备出发 + 确认上车,行程开始 到达站点,乘客已下车 已到达上车站点,等待乘客上车 预计里程