增加隐藏式debug入口
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* 重置车站状态请求参数
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusResetRequest {
|
||||
private String sn;
|
||||
private int siteId;
|
||||
|
||||
public OchBusResetRequest(String sn, int siteId) {
|
||||
this.sn = sn;
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.presenter.OchBusPresenter;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -49,91 +50,101 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
rvStationList.setAdapter(adapter);
|
||||
rvStationList.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
tvStationNotice.setOnClickListener(view -> {
|
||||
// todo debug code
|
||||
List<OchBusStation> stationList = new ArrayList<>();
|
||||
OchBusStation station;
|
||||
switch (stationSizeLevel) {
|
||||
case 2:
|
||||
stationSizeLevel++;
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第一站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第二站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
break;
|
||||
case 3:
|
||||
stationSizeLevel++;
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第一站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第二站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第三站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
break;
|
||||
case 4:
|
||||
stationSizeLevel++;
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第一站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第二站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第三站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第四站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
break;
|
||||
default:
|
||||
stationSizeLevel = 2;
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第一站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第二站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第三站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第四站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第五站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第五站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
station = new OchBusStation();
|
||||
station.setSiteName("第五站");
|
||||
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
stationList.add(station);
|
||||
break;
|
||||
}
|
||||
refreshBusStations(stationList);
|
||||
tvStationName.setOnLongClickListener(view -> {
|
||||
TipToast.shortTip("重置了车站状态");
|
||||
mPresenter.debugResetStationStatus();
|
||||
return true;
|
||||
});
|
||||
|
||||
tvStationNotice.setOnLongClickListener(view -> {
|
||||
getActivity().finish();
|
||||
return true;
|
||||
});
|
||||
// tvStationNotice.setOnClickListener(view -> {
|
||||
// // todo debug code
|
||||
// List<OchBusStation> stationList = new ArrayList<>();
|
||||
// OchBusStation station;
|
||||
// switch (stationSizeLevel) {
|
||||
// case 2:
|
||||
// stationSizeLevel++;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// case 3:
|
||||
// stationSizeLevel++;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第三站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// case 4:
|
||||
// stationSizeLevel++;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第三站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第四站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// default:
|
||||
// stationSizeLevel = 2;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第三站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第四站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第五站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第五站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第五站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// }
|
||||
// refreshBusStations(stationList);
|
||||
// });
|
||||
|
||||
Logger.d(TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus());
|
||||
switch (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
|
||||
@@ -211,12 +222,7 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
int currPos = -1;
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation station = stationList.get(i);
|
||||
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING) {
|
||||
tvStationName.setText(station.getSiteName());
|
||||
tvStationNotice.setText("下一站");
|
||||
currPos = i;
|
||||
break;
|
||||
} else if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) {
|
||||
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) {
|
||||
currPos = i;
|
||||
tvStationNotice.setText("当前车站");
|
||||
tvStationName.setText(station.getSiteName());
|
||||
@@ -232,6 +238,11 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
showSlidePanle("乘客已上车,准备出发");
|
||||
}
|
||||
break;
|
||||
}else if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING) {
|
||||
tvStationName.setText(station.getSiteName());
|
||||
tvStationNotice.setText("下一站");
|
||||
currPos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,13 @@ public interface IOchBusApiService {
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1")
|
||||
Observable<BaseData> leaveStation(@Body RequestBody requestBody);
|
||||
|
||||
/**
|
||||
* 调试用重置接口
|
||||
* @param requestBody 请求参数{"siteId":1,"sn":"F803EB2046PZD00229"}
|
||||
* @return 返回值是重置后的车站列表
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1")
|
||||
Observable<OchBusRoutesResponse> debugResetStationStatus(@Body RequestBody requestBody);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.och.bus.bean.OchBusLeaveStationRequest;
|
||||
import com.mogo.och.bus.bean.OchBusResetRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
@@ -137,6 +138,59 @@ public class OchBusPresenter extends Presenter<OchBusFragment> implements IMogoA
|
||||
}
|
||||
}
|
||||
|
||||
public void debugResetStationStatus(){
|
||||
OchBusResetRequest request = new OchBusResetRequest(Utils.getSn(), 1);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.debugResetStationStatus(requestBody)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<OchBusRoutesResponse>(RequestOptions.create(getContext())) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "获取到小巴路线数据: " + o);
|
||||
isGoingToNextStation = false;
|
||||
if (mView != null && o.getResult() != null && o.getResult().getSite() != null) {
|
||||
stationList.clear();
|
||||
stationList.addAll(o.getResult().getSite());
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation s = stationList.get(i);
|
||||
if (s.getIsCurrentSite() == STATION_STATUS_LEAVING) {
|
||||
// 服务端只记录了leaving状态,没有记录arriving状态,此处端上自己增加一个arriving状态
|
||||
isGoingToNextStation = true;
|
||||
currentStationIndex = i;
|
||||
if (i < stationList.size() - 1) {
|
||||
// 将其下一站置为arriving状态
|
||||
stationList.get(i + 1).setIsCurrentSite(STATION_STATUS_ARRIVING);
|
||||
}
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
}
|
||||
refreshCurrentStation();
|
||||
mView.refreshBusStations(stationList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "获取小巴路线图失败");
|
||||
// 重复请求小巴路线,直至成功
|
||||
requeryBusStation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.e(TAG, "获取小巴路线失败 code: " + code + " msg: " + message);
|
||||
// 重复请求小巴路线,直至成功
|
||||
requeryBusStation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void autoDriveToNextStation() {
|
||||
if (currentStationIndex >= stationList.size() - 1) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.view.MotionEvent;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* 强制拦截所有touch时间的约束布局
|
||||
*
|
||||
@@ -26,6 +28,10 @@ public class NoTouchConstraintLayout extends ConstraintLayout {
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
return true;
|
||||
if(DebugConfig.isDebug()){
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,9 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
public void showNotice(String notice) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
tvNotice.setText(notice);
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE) {
|
||||
return;
|
||||
}
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
|
||||
tvNoticeContainer.setVisibility(View.VISIBLE);
|
||||
fivNoticeHead.setVisibility(View.VISIBLE);
|
||||
|
||||
Reference in New Issue
Block a user