diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java index 842afe78a3..11464a6587 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BusFragment.java @@ -213,6 +213,12 @@ public class BusFragment extends BaseBusTabFragment mNextTag.setText(getResources().getString(R.string.bus_arrive_to_next_tag)); } + if (currentStation == 0 && isArrived){ + showOrHideSwitchLineBtn(true); + }else { + showOrHideSwitchLineBtn(false); + } + // 重置滑动按钮文字 if (isArriveEndStation) { showSlidePanle("单程结束"); @@ -227,6 +233,14 @@ public class BusFragment extends BaseBusTabFragment updateBusTestBarInfo(); } + private void showOrHideSwitchLineBtn(boolean isShow) { + if (isShow){ + mSwitchLine.setVisibility(View.VISIBLE); + }else { + mSwitchLine.setVisibility(View.INVISIBLE); + } + } + public void hideOchBus() { // tvNotice.setVisibility(View.GONE); } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java index f83ff80e55..9204438b22 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java @@ -11,6 +11,7 @@ import android.location.Location; import android.os.Handler; import android.os.Message; import android.text.TextUtils; +import android.util.Log; import androidx.annotation.NonNull; @@ -79,7 +80,6 @@ import mogo.telematics.pad.MessagePad; public class BusOrderModel { private final String TAG = BusOrderModel.class.getSimpleName(); private int currentLineId = -1; -// private int currentStationIndex = 0; //因为服务端和前台对于当前站不一致,所以设置两个current index, 一个用于前台展示, 一个用于服务端接口请求 private int backgroundCurrentStationIndex = 0;//A->B 此处值是A站点索引 /** * 运营状态、后端更具运营状态来判断车辆是否派单 @@ -539,13 +539,14 @@ public class BusOrderModel { * 到站后重置站点状态 */ private void arriveSiteStation(boolean isRestart) { - CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ backgroundCurrentStationIndex +1); int arrivedStationIndex = 0; if (!isRestart){ arrivedStationIndex = backgroundCurrentStationIndex + 1; } + CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex); + BusServiceManager.getInstance().arriveSiteStation(mContext - , stationList.get(backgroundCurrentStationIndex).getSeq(), stationList.get(arrivedStationIndex).getSiteId() + , stationList.get(arrivedStationIndex).getSeq(), stationList.get(arrivedStationIndex).getSiteId() , new IBusServiceCallback() { @Override public void onSuccess(BaseData o) { @@ -708,7 +709,7 @@ public class BusOrderModel { /** * 渲染站点信息 * 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站, - * 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理current index,不能直接渲染 + * 车机端展示 离开站为当前站点,前往站为下一站, 下一站到站后在置为当前站 * @param result */ private void renderBusStationsStatus(BusRoutesResult result) { @@ -720,6 +721,10 @@ public class BusOrderModel { stationList.addAll( site ); for ( int i = 0; i < stationList.size(); i++ ) { BusStationBean s = stationList.get( i ); + + CallerLogger.INSTANCE.d( M_BUS + "renderBusStationsStatus--", + "Index="+ i+" ,name = "+s.getName()+" ,"+s.isLeaving()+","+s.getDrivingStatus()); + // 是否正在开往下一站 if ( s.isLeaving()) { isGoingToNextStation = true; @@ -730,15 +735,19 @@ public class BusOrderModel { break; } } -// backgroundCurrentStationIndex = currentStationIndex; + BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex); - CallerLogger.INSTANCE.d( M_BUS + TAG, "渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex + + CallerLogger.INSTANCE.d( M_BUS + TAG, + "渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex +" isLeaving()="+currentStation.isLeaving()); + //当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态 // ,订单开始站下在始发站的状态流转有问题 if (backgroundCurrentStationIndex == 0 && !currentStation.isLeaving()){ arriveSiteStation(true); } + // 美化是否开始 if (FunctionBuildConfig.isDemoMode && (backgroundCurrentStationIndex >= 0 && backgroundCurrentStationIndex <= stationList.size()-1) @@ -747,18 +756,12 @@ public class BusOrderModel { CallerAutoPilotManager.INSTANCE.setDemoMode(true); CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)"); } + if (refreshBusStationsCallback != null){ -// if (currentStation.isLeaving()){//如果服务端的当前站是leaving状态,展示当前站需要+1 -// currentStationIndex ++; -// refreshBusStationsCallback.refreshBusStations(stationList -// , currentStationIndex, getNextStopStation(),false); -// }else{ -// refreshBusStationsCallback.refreshBusStations(stationList -// , currentStationIndex, getNextStopStation(),true); -// } refreshBusStationsCallback.refreshBusStations(result.getName(),stationList - , backgroundCurrentStationIndex, getNextStopStation(),true); + , backgroundCurrentStationIndex, getNextStopStation(),!currentStation.isLeaving()); } + if ( currentStation.isLeaving() && slidePannelHideCallback != null) { slidePannelHideCallback.hideSlidePanel(); } @@ -807,7 +810,8 @@ public class BusOrderModel { * @param awayPassengersResponse */ private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) { - CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex="+backgroundCurrentStationIndex+1); + CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex=" + + String.valueOf(backgroundCurrentStationIndex + 1)); if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) { return; @@ -859,7 +863,6 @@ public class BusOrderModel { * 行程结束 */ private void travelOver() { -// CallerLogger.INSTANCE.d( M_BUS + TAG, "行程结束"); if ( backgroundCurrentStationIndex >= stationList.size() ) { CallerLogger.INSTANCE.e( M_BUS + TAG, "travel over index out of station list" ); @@ -891,8 +894,7 @@ public class BusOrderModel { } CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex); isGoingToNextStation = false; - // 到达站点后,更新站点状态 -// currentStationIndex = getNextStopStation(); + queryStationLeaveAwayPassengers(); UiThreadHandler.postDelayed(new Runnable() {// 先查询下车乘客,再上报到站,便于后台筛查下车订单 @Override diff --git a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml index 9b7a9d4d36..6af29db03a 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml @@ -14,7 +14,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/dp_68" - android:layout_marginRight="@dimen/dp_196" + android:layout_marginRight="@dimen/dp_20" android:layout_marginTop="@dimen/dp_64" android:ellipsize="end" android:maxLines="1" @@ -22,7 +22,7 @@ android:textColor="#FFF" android:textSize="38px" android:textStyle="bold" - app:layout_constraintLeft_toRightOf="@+id/module_och_bus_tag" + app:layout_constraintRight_toLeftOf="@+id/module_och_bus_tag" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -83,7 +83,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="6px" - android:layout_marginRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight" + android:layout_marginRight="@dimen/dp_60" android:ellipsize="end" android:maxLines="2" android:text="--" @@ -110,7 +110,7 @@ android:id="@+id/module_och_bus_order_end_station" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight" + android:layout_marginRight="@dimen/dp_60" android:ellipsize="end" android:maxLines="2" android:text="--"