[2.11.0/1.6.0] 1、bus司机端增加语音播报 2、bus司机端+乘客屏增加到站或即将到站动画
This commit is contained in:
@@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -55,6 +56,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到达未离开
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
}else {
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
|
||||
@@ -74,20 +76,24 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_grey);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
|
||||
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
|
||||
} else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//刚到站未离开的
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_grey);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING && preStation.isLeaving()){//即将到站
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_green);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING &&
|
||||
(preStation.getDrivingStatus() == STATION_STATUS_ARRIVING
|
||||
|| preStation.getDrivingStatus() == STATION_STATUS_STOPPED)){ //未到站的并且前面也是未到站或者刚到站的
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_blue);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_blue);
|
||||
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +201,18 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
public void clearMapMarkers() {
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearLineMarkers();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void setLineMarkers(List<LatLng> list) {
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@@ -222,6 +234,8 @@ public class BusPassengerRouteFragment extends
|
||||
mNoLineInfoView.setVisibility(View.VISIBLE);
|
||||
mRouteInfoView.setVisibility(View.GONE);
|
||||
updateArrivedStation(null,0,true);
|
||||
clearPolyline();
|
||||
clearMapMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +243,9 @@ public class BusPassengerRouteFragment extends
|
||||
if (mNoLineInfoView.getVisibility() == View.GONE){
|
||||
mNoLineInfoView.setVisibility(View.VISIBLE);
|
||||
mRouteInfoView.setVisibility(View.GONE);
|
||||
updateArrivedStation(null,0,true);
|
||||
clearPolyline();
|
||||
clearMapMarkers();
|
||||
}
|
||||
emptyTv.setText(getString(R.string.bus_p_no_task));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
app:layout_constraintRight_toLeftOf="@+id/bus_p_tag"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_arrow_bg"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bus_p_point_gray"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_station"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_circle"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -34,7 +42,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginLeft="12px"
|
||||
android:layout_marginLeft="8px"
|
||||
android:src="@drawable/bus_p_line_blue"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/bus_p_circle"
|
||||
app:layout_constraintRight_toRightOf="@+id/bus_p_circle"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/26
|
||||
*/
|
||||
public interface IPassengerCallback {
|
||||
void playPassenger(WriteOffPassenger passenger);
|
||||
}
|
||||
@@ -81,5 +81,7 @@ class BusConst {
|
||||
const val LOOP_PASSENGER_2S = 2 * 1000L
|
||||
const val LOOP_PASSENGER_1S = 1 * 1000L
|
||||
const val LOOP_DELAY_500 = 500L
|
||||
|
||||
const val DELAY_10S = 10 * 1000L
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.BusOrderModel;
|
||||
import com.mogo.och.bus.util.BDRouteDataTestUtils;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
@@ -328,6 +329,9 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
});
|
||||
}
|
||||
|
||||
public void playDI(){
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(getContext(), R.raw.bus_di);
|
||||
}
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog;
|
||||
|
||||
@@ -149,6 +150,13 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
showOrHideSwitchLineBtn(true);
|
||||
hideStationsPanel();
|
||||
hideSlidePanel();
|
||||
resetStationBlinkAnim();
|
||||
}
|
||||
|
||||
private void resetStationBlinkAnim() {
|
||||
firstStationItem.setStationPointBg(2);
|
||||
secondStationItem.setStationPointBg(2);
|
||||
thirdStationItem.setStationPointBg(2);
|
||||
}
|
||||
|
||||
public void updateBusTaskStatus(String lineName, String lineTime,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.model;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.och.bus.constant.BusConst.DELAY_10S;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
@@ -29,6 +30,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
@@ -37,9 +39,9 @@ import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IPassengerCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
@@ -97,13 +99,12 @@ public class BusOrderModel {
|
||||
private static final long QUERY_BUS_STATION_DELAY = 5000;
|
||||
|
||||
private IRefreshBusStationsCallback refreshBusStationsCallback;
|
||||
private ISlidePannelHideCallback slidePannelHideCallback;
|
||||
private ISlidePannelHideCallback slidePanelHideCallback;
|
||||
private IBusControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private IPassengerCallback mPassengerCallback; //乘客核销回调
|
||||
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();//全路径信息
|
||||
|
||||
private boolean hadQueryLeaveAwayPassager = false;
|
||||
|
||||
private volatile boolean isArrivedStation = false;
|
||||
|
||||
private LoginService loginService;
|
||||
@@ -191,17 +192,18 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"Undeliverable exception");
|
||||
}
|
||||
});
|
||||
|
||||
//2021/10/20 轮询小巴车订单,暂时用来播报 2022/9/23 乘客上车和下车的播报都去除,增加核销的乘客播报
|
||||
// startLoopBusOrders();
|
||||
}
|
||||
|
||||
public void setRefreshBusStationsCallback(IRefreshBusStationsCallback callback){
|
||||
this.refreshBusStationsCallback = callback;
|
||||
}
|
||||
|
||||
public void setSlidePannelHideCallback(ISlidePannelHideCallback callback){
|
||||
this.slidePannelHideCallback = callback;
|
||||
public void setPassengerCallback(IPassengerCallback callback){
|
||||
this.mPassengerCallback = callback;
|
||||
}
|
||||
|
||||
public void setSlidePanelHideCallback(ISlidePannelHideCallback callback){
|
||||
this.slidePanelHideCallback = callback;
|
||||
}
|
||||
|
||||
public void setControllerStatusCallback(IBusControllerStatusCallback callback) {
|
||||
@@ -271,59 +273,6 @@ public class BusOrderModel {
|
||||
updateOrderRoute();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 轮询bus待服务订单
|
||||
// */
|
||||
// private void startLoopBusOrders() {
|
||||
// if (mBusOrdersDisposable != null && !mBusOrdersDisposable.isDisposed()) {
|
||||
// return;
|
||||
// }
|
||||
// mBusOrdersDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
// BusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
// .map((aLong -> aLong + 1))
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(aLong -> queryBusOrders());
|
||||
// }
|
||||
|
||||
// private void queryBusOrders() {
|
||||
// BusServiceManager.getInstance().queryBusOrders(mContext, new IBusServiceCallback<BusOrdersResponse>() {
|
||||
// @Override
|
||||
// public void onSuccess(BusOrdersResponse o) {
|
||||
// if (o.data != null && o.data.orders != null && o.data.orders.size() > 0) {
|
||||
// CallerLogger.INSTANCE.d( M_BUS + TAG, "获取到bus订单数据: " + o.data.orders.toString() );
|
||||
// List<BusOrderBean> busOrders = o.data.orders;
|
||||
// for (int i = 0; i < busOrders.size(); i++) {
|
||||
// BusOrderBean order = busOrders.get(i);
|
||||
// if (order == null) return;
|
||||
// if (TextUtils.isEmpty(order.getPassengerPhone())) return;
|
||||
// if (prevBusOrderNos.contains(order.getOrderNo())) continue;
|
||||
// try {
|
||||
// String tailNum = null;
|
||||
// try {
|
||||
// tailNum = order.getPassengerPhone().substring(order.getPassengerPhone().length() - 4);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// tailNum = order.getPassengerPhone();
|
||||
// }
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "TTS:" + tailNum);
|
||||
// AIAssist.getInstance(mContext).speakTTSVoice("接到新订单,尾号 " + tailNum
|
||||
// + " 上车站点为 " + order.getStartStationName());
|
||||
// prevBusOrderNos.add(order.getOrderNo());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(String failMsg) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public void release(){
|
||||
if (mBusOrdersDisposable != null) {
|
||||
mBusOrdersDisposable.dispose();
|
||||
@@ -535,7 +484,7 @@ public class BusOrderModel {
|
||||
}
|
||||
isGoingToNextStation = true;
|
||||
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
|
||||
// AIAssist.getInstance( mContext ).speakTTSVoice( "欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,11 +566,8 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "size = " + passenger.passengerSize+
|
||||
" time = "+passenger.writeOffTime);
|
||||
prePassengerWriteOffTime = passenger.writeOffTime;
|
||||
int passengerNum = passenger.passengerSize;
|
||||
if (passengerNum > 1){ //多人播报 "x人"
|
||||
AIAssist.getInstance(mContext).speakTTSVoice(passengerNum + "人");
|
||||
}else { //是 1 播放 "滴"
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(mContext, R.raw.bus_di);
|
||||
if (mPassengerCallback != null){
|
||||
mPassengerCallback.playPassenger(passenger);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -677,6 +623,11 @@ public class BusOrderModel {
|
||||
*/
|
||||
public void leaveStation(boolean isRestart){
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"leaveStation-backgroundCurrentStationIndex = "+backgroundCurrentStationIndex);
|
||||
String nextStationName = "";
|
||||
if (backgroundCurrentStationIndex < stationList.size() - 1){
|
||||
nextStationName = stationList.get(backgroundCurrentStationIndex + 1).getName();
|
||||
}
|
||||
String finalNextStationName = nextStationName;
|
||||
BusServiceManager.getInstance().leaveStation(mContext,
|
||||
stationList.get(backgroundCurrentStationIndex).getSeq(),
|
||||
stationList.get(backgroundCurrentStationIndex).getSiteId(),
|
||||
@@ -690,6 +641,7 @@ public class BusOrderModel {
|
||||
leaveStationSuccess(isRestart);
|
||||
queryBusRoutes();
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
leaveTTSTips(finalNextStationName);
|
||||
}
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
@@ -702,30 +654,23 @@ public class BusOrderModel {
|
||||
});
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 查询到站下车乘客
|
||||
// */
|
||||
// private void queryStationLeaveAwayPassengers() {
|
||||
// CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
|
||||
//
|
||||
// BusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
|
||||
// , stationList.get(backgroundCurrentStationIndex +1).getSeq(), stationList.get(backgroundCurrentStationIndex+1).getSiteId()
|
||||
// , new IBusServiceCallback<QueryLeaveAwayPassengersResponse>() {
|
||||
// @Override
|
||||
// public void onSuccess(QueryLeaveAwayPassengersResponse o) {
|
||||
// hadQueryLeaveAwayPassager = true;
|
||||
// arriveSiteStation(false);
|
||||
// playLeavePassengersMsg( o );
|
||||
// queryBusOrders();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(String failMsg) {
|
||||
// hadQueryLeaveAwayPassager = true;
|
||||
// arriveSiteStation(false);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//车站10s后播报
|
||||
private void leaveTTSTips(String nextStation) {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ttsTips(String.format(mContext
|
||||
.getString(R.string.bus_leave_station_tip),
|
||||
nextStation));
|
||||
}
|
||||
},DELAY_10S);
|
||||
}
|
||||
|
||||
private void ttsTips(String notice) {
|
||||
UiThreadHandler.post(() ->{
|
||||
AIAssist.getInstance(mContext).speakTTSVoice(notice);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭美化模式
|
||||
@@ -803,8 +748,8 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)");
|
||||
}
|
||||
|
||||
if ( currentStation.isLeaving() && slidePannelHideCallback != null) {
|
||||
slidePannelHideCallback.hideSlidePanel();
|
||||
if ( currentStation.isLeaving() && slidePanelHideCallback != null) {
|
||||
slidePanelHideCallback.hideSlidePanel();
|
||||
}
|
||||
|
||||
//更新bus路线面板
|
||||
@@ -835,49 +780,6 @@ public class BusOrderModel {
|
||||
autoDriveToNextStation(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 播报下车乘客信息
|
||||
*
|
||||
* @param awayPassengersResponse
|
||||
*/
|
||||
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex="
|
||||
+ String.valueOf(backgroundCurrentStationIndex + 1));
|
||||
|
||||
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) {
|
||||
return;
|
||||
}
|
||||
String station = stationList.get( backgroundCurrentStationIndex+1 ).getName();
|
||||
StringBuilder builder = new StringBuilder( "已到达" );
|
||||
builder.append( station );
|
||||
if ( !station.endsWith( "站" ) ) {
|
||||
builder.append( "站" );
|
||||
}
|
||||
if ( awayPassengersResponse == null || awayPassengersResponse.data == null
|
||||
|| awayPassengersResponse.data.orders == null || awayPassengersResponse.data.orders.isEmpty() ) {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息为null");
|
||||
} else {
|
||||
builder.append( ",请尾号为 " );
|
||||
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : awayPassengersResponse.data.orders ) {
|
||||
if ( leaveAwayPassenger == null ) {
|
||||
continue;
|
||||
}
|
||||
String tailNum = null;
|
||||
try {
|
||||
tailNum = leaveAwayPassenger.passengerPhone.substring(leaveAwayPassenger.passengerPhone.length() - 4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tailNum = leaveAwayPassenger.passengerPhone;
|
||||
}
|
||||
builder.append( tailNum ).append( "。" );
|
||||
}
|
||||
builder.append( "的乘客下车" );
|
||||
}
|
||||
builder.append(",带好随身物品,下车请注意安全");
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "TTS:" + builder.toString());
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( builder.toString() );
|
||||
}
|
||||
|
||||
/**
|
||||
* 行程结束
|
||||
*/
|
||||
@@ -889,7 +791,6 @@ public class BusOrderModel {
|
||||
}
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "单程结束====" );
|
||||
CallerAutoPilotManager.INSTANCE.cancelAutoPilot();
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "感谢您体验'蘑菇车联'无人驾驶小巴车,请您携带好随身物品,我们下次再见" );
|
||||
|
||||
endTask();
|
||||
}
|
||||
@@ -909,6 +810,7 @@ public class BusOrderModel {
|
||||
backgroundCurrentStationIndex = 0;
|
||||
queryBusRoutes();// 重新获取任务
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
ttsTips(mContext.getString(R.string.bus_end_task_tip));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,11 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IPassengerCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.fragment.BusFragment;
|
||||
@@ -25,6 +28,7 @@ import com.mogo.och.bus.model.BusOrderModel;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
import com.zhidao.socket.utils.LoginStatusUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -43,7 +47,7 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
public class BusPresenter extends Presenter<BusFragment>
|
||||
implements IRefreshBusStationsCallback, ISlidePannelHideCallback
|
||||
, IMoGoAutopilotStatusListener, IBusControllerStatusCallback, ILoginCallback {
|
||||
, IMoGoAutopilotStatusListener, IBusControllerStatusCallback, ILoginCallback, IPassengerCallback {
|
||||
|
||||
private static final String TAG = "BusPresenter";
|
||||
|
||||
@@ -75,14 +79,16 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
|
||||
public void initModelListener() {
|
||||
BusOrderModel.getInstance().setRefreshBusStationsCallback(this);
|
||||
BusOrderModel.getInstance().setSlidePannelHideCallback(this);
|
||||
BusOrderModel.getInstance().setSlidePanelHideCallback(this);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(this);
|
||||
BusOrderModel.getInstance().setPassengerCallback(this);
|
||||
}
|
||||
|
||||
public void releaseListener() {
|
||||
BusOrderModel.getInstance().setRefreshBusStationsCallback(null);
|
||||
BusOrderModel.getInstance().setSlidePannelHideCallback(null);
|
||||
BusOrderModel.getInstance().setSlidePanelHideCallback(null);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
BusOrderModel.getInstance().setPassengerCallback(null);
|
||||
}
|
||||
|
||||
public void queryBusRoutes() {
|
||||
@@ -112,20 +118,6 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
BusOrderModel.getInstance().logout();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void refreshBusStations(String lineName,List<BusStationBean> stationList
|
||||
// , int currentStation, int nextStation, boolean isArrived) {
|
||||
// mStationList.clear();
|
||||
// mStationList.addAll(stationList);
|
||||
// mCurrentStation = currentStation;
|
||||
//// functionDemoModeChange();
|
||||
// CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
// if (mView != null) {
|
||||
// runOnUIThread(() -> mView.refreshBusStations(lineName,
|
||||
// stationList, currentStation, nextStation, isArrived));
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateBusTaskStatus(String lineName,String lineTime,
|
||||
List<BusStationBean> stationList,
|
||||
@@ -328,4 +320,14 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void loginFail(boolean isLogin) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playPassenger(WriteOffPassenger passenger) {
|
||||
int passengerNum = passenger.passengerSize;
|
||||
if (passengerNum > 1){ //多人播报 "x人"
|
||||
mView.showNotice(passengerNum + "人");
|
||||
}else { //是 1 播放 "滴"
|
||||
mView.playDI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil
|
||||
import kotlinx.android.synthetic.main.bus_stations_common_item.view.*
|
||||
|
||||
/**
|
||||
@@ -31,9 +32,18 @@ class BusStationCommonItem @JvmOverloads constructor(
|
||||
|
||||
fun setStationPointBg(type: Int){ // 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
when(type){
|
||||
0 -> busCircleIv.setImageResource(R.drawable.icon_point_grey_bus)
|
||||
1 -> busCircleIv.setImageResource(R.drawable.icon_point_green_bus)
|
||||
2 -> busCircleIv.setImageResource(R.drawable.icon_point_blue_bus)
|
||||
0 -> {
|
||||
busCircleIv.setImageResource(R.drawable.icon_point_grey_bus)
|
||||
BlinkAnimationUtil.clearAnimation(busCircleIv)
|
||||
}
|
||||
1 -> {
|
||||
busCircleIv.setImageResource(R.drawable.icon_point_green_bus)
|
||||
BlinkAnimationUtil.setAnimation(busCircleIv)
|
||||
}
|
||||
2 -> {
|
||||
busCircleIv.setImageResource(R.drawable.icon_point_blue_bus)
|
||||
BlinkAnimationUtil.clearAnimation(busCircleIv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
app:layout_constraintRight_toRightOf="@+id/busTagTxt"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/busCircleIv_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_point_grey_bus"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/busStationNameTv"/>
|
||||
<ImageView
|
||||
android:id="@+id/busCircleIv"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -39,4 +39,6 @@
|
||||
<string name="bus_dialog_cancel">取消</string>
|
||||
|
||||
<string name="bus_no_task_tip">暂无任务</string>
|
||||
<string name="bus_leave_station_tip">车辆起步,请扶稳坐好,前方到站是%1$s,请下车的乘客做好准备。</string>
|
||||
<string name="bus_end_task_tip">感谢您体验\'蘑菇车联\'无人驾驶小巴车,请您携带好随身物品,我们下次再见。</string>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/23
|
||||
*/
|
||||
public class BlinkAnimationUtil {
|
||||
|
||||
//实现图片闪烁效果
|
||||
public static void setAnimation(ImageView imageView) {
|
||||
AnimatorSet animationSet = new AnimatorSet();
|
||||
|
||||
ObjectAnimator valueAnimator = ObjectAnimator.ofFloat(imageView, "alpha",0f, 1.0f);
|
||||
ObjectAnimator valueAnimatorDisappare = ObjectAnimator.ofFloat(imageView, "alpha",1.0f, 0f);
|
||||
valueAnimator.setDuration(1000);
|
||||
valueAnimatorDisappare.setDuration(800);
|
||||
|
||||
valueAnimator.setRepeatCount(-1);
|
||||
valueAnimatorDisappare.setRepeatCount(-1);
|
||||
|
||||
animationSet.playTogether(valueAnimatorDisappare, valueAnimator);
|
||||
animationSet.start();
|
||||
|
||||
}
|
||||
|
||||
//消除动画
|
||||
public static void clearAnimation(ImageView imageView){
|
||||
if (imageView.getAnimation() != null){
|
||||
imageView.getAnimation().cancel();
|
||||
}
|
||||
imageView.clearAnimation();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user