merge
This commit is contained in:
yangyakun
2024-05-24 15:55:02 +08:00
418 changed files with 2610 additions and 6636 deletions

View File

@@ -2,14 +2,6 @@
package="com.mogo.och.bus">
<application>
<!--这里是为了测试增加的广播-->
<receiver android:name=".receiver.TestBusBroadcastReceiver">
<intent-filter>
<action android:name="com.bus.test_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:name=".ui.BusSwitchLineActivity"
android:theme="@style/SwitchLineDialogStyle"
android:launchMode="singleTask"

View File

@@ -6,7 +6,6 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.bus.fragment.BusFragment
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.biz.provider.CommonService
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
/**

View File

@@ -1,42 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.storage.SharedPrefsMgr;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车运营状态请求参数
*/
class BusOperationStatusRequest {
private String sn;
private double lat;
private double lon;
public BusOperationStatusRequest(double lon, double lat) {
this.sn = SharedPrefsMgr.getInstance().getSn();
this.lat = lat;
this.lon = lon;
}
public void setLat(double lat) {
this.lat = lat;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getSn() {
return sn;
}
public double getLat() {
return lat;
}
public double getLon() {
return lon;
}
}

View File

@@ -1,86 +0,0 @@
package com.mogo.och.bus.bean;
/**
* @author congtaowang
* @since 2021/3/23
* <p>
* 小巴订单
*/
public class BusOrderBean {
/**
* orderNo number
* passengerPhone string 下单用户电话
* startStationId integer 开始站点
* startStationName string
* endStationId integer 结束站点
* endStationName string
*/
private String orderNo;
private String passengerPhone;
private int startStationId;//乘客上车点
private String startStationName;
private String endStationName;
private int endStationId;//乘客下车点
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public void setPassengerPhone(String passengerPhone) {
this.passengerPhone = passengerPhone;
}
public void setStartStationId(int startStationId) {
this.startStationId = startStationId;
}
public void setStartStationName(String startStationName) {
this.startStationName = startStationName;
}
public void setEndStationName(String endStationName) {
this.endStationName = endStationName;
}
public void setEndStationId(int endStationId) {
this.endStationId = endStationId;
}
public String getOrderNo() {
return orderNo;
}
public String getPassengerPhone() {
return passengerPhone;
}
public int getStartStationId() {
return startStationId;
}
public String getStartStationName() {
return startStationName;
}
public String getEndStationName() {
return endStationName;
}
public int getEndStationId() {
return endStationId;
}
@Override
public String toString() {
return "BusOrderBean{" +
"orderNo=" + orderNo +
", passengerPhone='" + passengerPhone + '\'' +
", startStationId=" + startStationId +
", startStationName='" + startStationName + '\'' +
", endStationName='" + endStationName + '\'' +
", endStationId=" + endStationId +
'}';
}
}

View File

@@ -1,23 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.eagle.core.data.BaseData;
import java.util.List;
/**
* @author: wangmingjun
* @date: 2021/10/19
*/
public class BusOrdersResponse extends BaseData {
public Result data;
public static class Result{
public List<BusOrderBean> orders;
}
@Override
public String toString() {
return "BusOrdersResponse{" +
"data=" + data +
'}';
}
}

View File

@@ -1,13 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.eagle.core.data.BaseData;
import java.util.List;
/**
* @author: wangmingjun
* @date: 2021/10/19
*/
public class BusQueryWriteOffPassengersResponse extends BaseData {
public List<WriteOffPassenger> data;
}

View File

@@ -1,24 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.storage.SharedPrefsMgr;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车重置路线状态请求参数
*/
class BusResetLineStatusRequest {
private String sn;
public BusResetLineStatusRequest() {
this.sn = SharedPrefsMgr.getInstance().getSn();
}
public String getSn() {
return sn;
}
}

View File

@@ -1,30 +0,0 @@
package com.mogo.och.bus.bean;
import java.util.List;
/**
* Created by pangfan on 2021/8/19
*
* 订单状态更新请求数据结构
*/
public class BusRoutePlanningUpdateReqBean {
public String sn;
public int lineId;
public int startSiteId;
public int endSiteId;
public List<Result> points;
public static class Result {
public Double latitude;
public Double longitude;
}
public BusRoutePlanningUpdateReqBean(String sn, int lineId, int startSiteId
, int endSiteId, List<Result> points) {
this.sn = sn;
this.lineId = lineId;
this.startSiteId = startSiteId;
this.endSiteId = endSiteId;
this.points = points;
}
}

View File

@@ -1,173 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.storage.SharedPrefsMgr;
import com.mogo.eagle.core.data.BaseData;
import java.util.List;
/**
* 查询核销乘客
*/
public class BusWriteOffPassengersQueryRequest {
private String sn;
private int taskId;
private int siteId;
private long verificationTime;
public BusWriteOffPassengersQueryRequest(int taskId, int siteId,long prePassengerTime) {
this.sn = SharedPrefsMgr.getInstance().getSn();
this.taskId = taskId;
this.siteId = siteId;
this.verificationTime = prePassengerTime;
}
public String getSn() {
return sn;
}
/**
* @author: wangmingjun
* @date: 2021/10/19
*/
public static class BusOrdersResponse extends BaseData {
public com.mogo.och.bus.bean.BusOrdersResponse.Result data;
public static class Result{
public List<BusOrderBean> orders;
}
@Override
public String toString() {
return "BusOrdersResponse{" +
"data=" + data +
'}';
}
}
/**
* 网约车小巴路线接口请求响应结果
*
* @author tongchenfei
*/
public static class BusRoutesResponse extends BaseData {
private BusRoutesResult data;
public BusRoutesResult getResult() {
return data;
}
public void setResult(BusRoutesResult data) {
this.data = data;
}
@Override
public String toString() {
return "BusRoutesResponse{" +
"data=" + data +
'}';
}
}
/**
* 单个网约车小巴车站信息
*
* @author tongchenfei
*/
public static class BusStationBean {
private int siteId;
private String name;
private int seq;
private double gcjLon; //高德
private double gcjLat; //高德
private double lon; //高精坐标
private double lat; //高精坐标
private int drivingStatus;//行驶信息0初始值1已经过2当前站3未到站
private boolean leaving;
public int getSiteId() {
return siteId;
}
public String getName() {
return name;
}
public int getSeq() {
return seq;
}
public double getGcjLon() {
return gcjLon;
}
public double getGcjLat() {
return gcjLat;
}
public double getLon() {
return lon;
}
public double getLat() {
return lat;
}
public int getDrivingStatus() {
return drivingStatus;
}
public boolean isLeaving() {
return leaving;
}
public void setSiteId(int siteId) {
this.siteId = siteId;
}
public void setName(String name) {
this.name = name;
}
public void setSeq(int seq) {
this.seq = seq;
}
public void setGcjLon(double gcjLon) {
this.gcjLon = gcjLon;
}
public void setGcjLat(double gcjLat) {
this.gcjLat = gcjLat;
}
public void setLon(double lon) {
this.lon = lon;
}
public void setLat(double lat) {
this.lat = lat;
}
public void setDrivingStatus(int drivingStatus) {
this.drivingStatus = drivingStatus;
}
public void setLeaving(boolean leaving) {
this.leaving = leaving;
}
@Override
public String toString() {
return "BusStationBean{" +
"siteId=" + siteId +
", name='" + name + '\'' +
", seq=" + seq +
", gcjLon=" + gcjLon +
", gcjLat=" + gcjLat +
", lon=" + lon +
", lat=" + lat +
", drivingStatus=" + drivingStatus +
", leaving=" + leaving +
'}';
}
}
}

View File

@@ -1,36 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.commons.storage.SharedPrefsMgr;
/**
* 查询下车乘客请求参数
*
* @author tongchenfei
*/
public class QueryLeaveAwayPassengersRequest {
private String sn;
private int seq; //站点在线路中的序号
private int siteId; //站点id
public QueryLeaveAwayPassengersRequest(int seq, int siteId) {
this.sn = SharedPrefsMgr.getInstance().getSn();
this.seq = seq;
this.siteId = siteId;
}
public void setSeq(int seq) {
this.seq = seq;
}
public void setSiteId(int siteId) {
this.siteId = siteId;
}
public int getSeq() {
return seq;
}
public int getSiteId() {
return siteId;
}
}

View File

@@ -1,60 +0,0 @@
package com.mogo.och.bus.bean;
import com.mogo.eagle.core.data.BaseData;
import java.util.List;
public
/**
* @author congtaowang
* @since 2021/3/26
*
* 到站查询下车乘客
*/
class QueryLeaveAwayPassengersResponse extends BaseData {
public Result data;
public static class Result {
public List< LeaveAwayPassenger > orders;
}
public static class LeaveAwayPassenger {
/**
* orderNo: 订单no
* orderStatus: 订单状态
* orderType订单类型0及时1预约
* bookingTime预计用车时间
* businessType订单运营类型 9:taxi10:bus
* startSiteId 起点站点id
* userPhone: 乘客联系方式
* startSitePoint开始站点坐标
* startSiteAddr开始地址
* endSiteId结束站点id
* endSitePoint结束站点坐标
* carNumber车牌号
* createTime: 创建时间
* startTime开始时间
* startSiteGcjPoint高精坐标
* endSiteGcjPoint
*/
//todo 目前是需要乘客电话来通知乘客下车 目前后台没有乘客信息userPhone
public String orderNo;
public int orderStatus;
public int orderType;
public long bookingTime;
public int businessType;
public int startSiteId;
public String passengerPhone;
public List<Double> startSitePoint;
public String startSiteAddr;
public int endSiteId;
public List<Double> endSitePoint;
public String carNumber;
public long createTime;
public long startTime;
public List< Double > startSiteGcjPoint;
public List< Double > endSiteGcjPoint;
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.request;
import com.mogo.commons.storage.SharedPrefsMgr;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.request;
import com.mogo.commons.storage.SharedPrefsMgr;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.request;
import com.mogo.commons.storage.SharedPrefsMgr;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.shuttle.bean;
package com.mogo.och.bus.bean.request;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.request;
import com.mogo.commons.storage.SharedPrefsMgr;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.request;
import com.mogo.och.bus.constant.BusConst;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.response;
import com.mogo.eagle.core.data.BaseData;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.response;
import com.mogo.eagle.core.data.BaseData;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.response;
import com.mogo.eagle.core.data.BaseData;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.response;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.bus.bean.response;
/**
* 单个网约车小巴车站信息

View File

@@ -1,15 +1,11 @@
package com.mogo.och.bus.callback;
import com.mogo.eagle.core.data.map.MogoLocation;
/**
* Created on 2021/9/10
*
* Model->Presenter回调状态控制器监听accOn、adas ui show、voice ui show、push ui show、v2x ui show等等
*/
public interface IBusControllerStatusCallback {
// 自车定位
void onCarLocationChanged(MogoLocation location);
//开始开启自动驾驶
void startOpenAutopilot();
}

View File

@@ -1,7 +1,7 @@
package com.mogo.och.bus.callback;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
/**
* @author: wangmingjun

View File

@@ -1,6 +1,6 @@
package com.mogo.och.bus.callback;
import com.mogo.och.bus.bean.BusStationBean;
import com.mogo.och.bus.bean.response.BusStationBean;
import java.util.List;

View File

@@ -1,7 +1,5 @@
package com.mogo.och.bus.constant
import com.mogo.commons.debug.DebugConfig
/**
* Created on 2021/12/6
*/

View File

@@ -1,632 +0,0 @@
package com.mogo.och.bus.fragment;
import static com.mogo.och.bus.constant.BusConst.TIMER_START_AUTOPILOT_INTERVAL;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.function.smp.view.SmallMapView;
import com.mogo.eagle.core.function.view.MapBizView;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusRoutesResult;
import com.mogo.och.bus.model.OrderModel;
import com.mogo.och.bus.util.BDRouteDataTestUtils;
import com.mogo.och.bus.view.BizMapView;
import com.mogo.och.bus.view.SlidePanelView;
import com.mogo.och.common.module.utils.SoundPoolHelper;
import com.mogo.och.common.module.utils.ResourcesUtils;
import org.greenrobot.eventbus.EventBus;
import bag_manager.BagManagerOuterClass;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
/**
* 网约车基础Fragment主要负责布局通用界面处理站点面板和通话面板互斥情况
* <p>
* 部分业务放在了此处处理
*
* @author tongchenfei
*/
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener {
private static final String TAG = "BaseBusTabFragment";
protected SlidePanelView slidePanelView;
private RelativeLayout ctvAutopilotStatus;
private ImageView ctvAutopilotStatusIv;
private TextView ctvAutopilotStatusTv;
protected TextView tvArrived;
protected RelativeLayout mSettingBtn;
protected RelativeLayout mBadcaseBtn;
private FrameLayout flStationPanelContainer;
private BizMapView mapBizView;
private Group groupTestPanel;
// private TrafficDataView mTrafficDataView;
// private BusTrafficLightView mTrafficLightView;
//远景和中景的切换
private ImageView mSwitchMapModeImage;
private LinearLayout mSwitchMapModeLayout;
protected SmallMapView smallMapView;
//消息盒子
private DriverMsgBoxButtonView viewDriverMsgBoxButton;
private DriverMsgBoxListView viewDriverMsgBoxList;
private DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
private ObjectAnimator autopilotLoadingAnimator;
public boolean isAnimateRunning = false;
/**
* 滑动按钮触发的事件
*/
private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
// 此处做一个代理,处理一下共有情况
if (getSlidePanelOnEndListener() != null) {
getSlidePanelOnEndListener().moveToEnd();
}
};
@Override
protected int getLayoutId() {
return R.layout.bus_base_fragment;
}
@Override
protected void initViews() {
mapBizView = findViewById(R.id.mapBizView);
groupTestPanel = findViewById(R.id.groupTestPanel);
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
ctvAutopilotStatusIv = findViewById(R.id.bus_autopilot_btn_iv);
ctvAutopilotStatusTv = findViewById(R.id.bus_autopolot_btn_tv);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
// mTrafficLightView = findViewById(R.id.bus_traffic_light_view);
// CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
// tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
tvArrived = findViewById(R.id.module_mogo_och_arrived_tv);
// mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
FrameLayout flSpeed = findViewById(R.id.fl_speed);
if (flSpeed != null) {
CallerDevaToolsManager.INSTANCE.attachAutopilotBeforeLaunchView(flSpeed.getContext(), flSpeed);
}
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout);
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon);
updateSwitchMapIcon();
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
if(mapBizView != null){
IMogoMapUIController uiController = mapBizView.getUI();
if(uiController != null){
//切换地图的远近视图
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
uiController.setLockMode(true);
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
uiController.setLockMode(false);
uiController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
} else {
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
}
}
}
}
});
initListener();
setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(), CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(false, 0));
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
restartAutopilot();
}
});
// 模拟 不可自动驾驶目前场景是刚开机adas还未和工控机连接
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
);
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)
);
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
);
findViewById(R.id.btnAutopilotPingxing).setOnClickListener(view ->
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING)
);
// 模拟 自动驾驶网约车回调数据
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
debugArrivedStation()
);
findViewById(R.id.btnAutopilotRoute).setOnClickListener(view -> debugArrivedRoute());
tvArrived.setOnClickListener(view -> {
onArriveStation();
});
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
mSettingBtn.setOnClickListener(v -> {
CallerHmiManager.INSTANCE.showToolsView();
});
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.reportWorkOrder(mBadcaseBtn);
}
//消息盒子
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton);
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
viewDriverMsgBoxButton.setClickListener(show -> {
if (show) {
viewDriverMsgBoxList.setVisibility(View.VISIBLE);
viewDriverMsgBoxList.notifyData();
viewDriverMsgBoxBubble.setVisibility(View.GONE);
viewDriverMsgBoxBubble.isShowData(false);
} else {
viewDriverMsgBoxList.setVisibility(View.GONE);
viewDriverMsgBoxBubble.setVisibility(View.VISIBLE);
viewDriverMsgBoxBubble.isShowData(true);
}
});
smallMapView = findViewById(R.id.smallMapView);
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mapBizView.onCreate(savedInstanceState);
smallMapView.onCreateView(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
mapBizView.onResume();
smallMapView.onResume();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container
, @Nullable Bundle savedInstanceState) {
EventBus.getDefault().register(this);
return super.onCreateView(inflater, container, savedInstanceState);
}
protected abstract void onArriveStation();
private void updateSwitchMapIcon() {
if(mapBizView != null){
IMogoMapUIController uiController = mapBizView.getUI();
if(uiController != null){
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
} else {
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
}
}
}
}
private void debugArrivedRoute() {
BDRouteDataTestUtils.converToRouteData();
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
mapBizView.onSaveInstanceState(outState);
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapBizView.onLowMemory();
}
@Override
public void onPause() {
super.onPause();
mapBizView.onPause();
smallMapView.onPause();
}
@Override
public void onDestroyView() {
mapBizView.onDestroy();
if(smallMapView != null){
smallMapView.onDestroy();
}
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
EventBus.getDefault().unregister(this);
super.onDestroyView();
}
/**
* 测试到站
*/
protected abstract void debugArrivedStation();
private void initListener() {
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, this);
}
/**
* 展示滑动按钮
*
* @param text 指定的文字
*/
public void showSlidePanel(String text) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
slidePanelView.setText(text);
slidePanelView.setVisibility(View.VISIBLE);
}
},UiThreadHandler.MODE.QUEUE);
setArrivedClickable(false);
}
/**
* 设置进站按钮状态
*
* @param isClickable
*/
public void setArrivedClickable(boolean isClickable) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
tvArrived.setEnabled(isClickable);
if (isClickable) {
tvArrived.setTextColor(ResourcesUtils.getColor(R.color.bus_white));
} else {
tvArrived.setTextColor(ResourcesUtils.getColor(R.color.bus_arrived_btn_un_clickable_color));
}
}
},UiThreadHandler.MODE.QUEUE);
}
/**
* 隐藏滑动按钮
*/
public void hideSlidePanel() {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
slidePanelView.setVisibility(View.GONE);
}
},UiThreadHandler.MODE.QUEUE);
}
public void playDI() {
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(getContext(), R.raw.bus_di);
}
/**
* 改变自动驾驶状态
*
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
*/
public void onAutopilotStatusChanged(int autopilotStatus,boolean canStartAutopilt) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
changeAutopilotBtnView(autopilotStatus, isAnimateRunning,canStartAutopilt);
}
},UiThreadHandler.MODE.QUEUE);
}
public void setAutopilotBtnStatus(int autopilotStatus,boolean canStartAutopilt) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
== autopilotStatus) {//0不可用
ctvAutopilotStatusTv.setTextColor(AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_disable));
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg);
} else {
ctvAutopilotStatusTv.setTextColor(AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_ic_autopilot);
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv));
if(canStartAutopilt){
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg);
}else {
ctvAutopilotStatusTv.setTextColor(AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_disable));
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg);
}
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
ctvAutopilotStatusTv.setText(R.string.bus_loading_autopilot_runnig_tv);
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_2_status_bg);
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
== autopilotStatus) {
ctvAutopilotStatusTv.setText(R.string.bus_pingxing_driver);
ctvAutopilotStatus.setClickable(false);
ctvAutopilotStatus.setBackgroundResource(R.drawable.common_autopilot_pxjs);
}
}
}
public void updateAutopilotStatus(int autopilotStatus) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
== autopilotStatus) {//2 running
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon);
ctvAutopilotStatusTv.setTextColor(ResourcesUtils.getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_success_tv));
// ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus.setClickable(false);
} else {
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
ctvAutopilotStatusTv.setTextColor(ResourcesUtils.getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_failure_tv));
ctvAutopilotStatus.setClickable(false);
// ctvAutopilotStatus.setSelected(false);
}
UiThreadHandler.postDelayed(() -> setAutopilotBtnStatus(autopilotStatus,CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(false, 0)), 1000);
}
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning, boolean canStartAutopilt) {
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
!= autopilotStatus) {
// 主动开启自动驾驶中不为2为0、1则继续loading
return;
}
if (isAnimateRunning) {
stopAnimAndUpdateBtnStatus();
} else {
setAutopilotBtnStatus(autopilotStatus,canStartAutopilt);
}
}
public void stopAnimAndUpdateBtnStatus() {
stopAutopilotAnimation();
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
}
/**
* 隐藏【自动驾驶】按钮
*/
public void hideAutopilotBiz() {
}
/**
* 展示【自动驾驶】按钮
*/
public void showAutopilotBiz() {
}
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
return null;
}
/**
* 获取站点面板view在{@link #initViews()}时候添加到container中
*
* @return 站点面板view
*/
public abstract int getStationPanelViewId();
/**
* 重新开启自动驾驶
*/
public abstract void restartAutopilot();
/**
* 模拟自动驾驶返回状态
*
* @param status
*/
public abstract void debugAutoPilotStatus(int status);
/**
* 开启自动驾驶中间动画
*/
public void startAutopilotAnimation() {
isAnimateRunning = true;
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_tv));
ctvAutopilotStatusTv.setTextColor(ResourcesUtils.getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatus.setClickable(true);
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_loading_autopilot_icon);
if (autopilotLoadingAnimator == null) {
autopilotLoadingAnimator = ObjectAnimator.ofFloat(ctvAutopilotStatusIv, "rotation", 0f, 360f);
autopilotLoadingAnimator.setInterpolator(new LinearInterpolator());
autopilotLoadingAnimator.setRepeatCount(-1);//无限循环
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
}
autopilotLoadingAnimator.start();//动画开始
startingAutoApilotCountDown();
}
private void startingAutoApilotCountDown() {
//10s 若自动驾驶没有开启,则结束动画
UiThreadHandler.postDelayed(() -> { //未启动成功做处理
if (isAnimateRunning) {// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
stopAutopilotAnimation();
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
}
}, TIMER_START_AUTOPILOT_INTERVAL);
}
/**
* 停止自动驾驶中间动画
*/
protected void stopAutopilotAnimation() {
if (autopilotLoadingAnimator != null) {
autopilotLoadingAnimator.end();
ctvAutopilotStatusIv.clearAnimation();
autopilotLoadingAnimator = null;
isAnimateRunning = false;
}
}
// /**
// * 迈速表实时更新
// */
// public void updateSpeedView(float newSpeed) {
// int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
// if (mTrafficDataView != null) {
// mTrafficDataView.updateSpeedWithValue(speed);
// }
// }
@Override
public void onDestroy() {
super.onDestroy();
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().unregisterHostMapListener(TAG);
}
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
if (visualAngleMode.isMediumSight()) {
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
} else if (visualAngleMode.isLongSight()) {
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
} else if (visualAngleMode.isCloseSight()) {
mSwitchMapModeLayout.setVisibility(View.GONE);
}
}
/**
* bus调试面板打开关闭
*/
public void debugTestBar() {
if (groupTestPanel.getVisibility() == View.VISIBLE) {
groupTestPanel.setVisibility(View.GONE);
} else {
groupTestPanel.setVisibility(View.VISIBLE);
}
}
/**
* Bus调试信息线路、轨迹等信息
* <p>
* START
*/
private View busTestBar;
private TextView lineIdTV;
private TextView lineNameTV;
private TextView trajMd5TV;
private TextView stopMd5TV;
private TextView trajMd5DPQPTV;
private TextView stopMd5DPQPTV;
@SuppressLint("SetTextI18n")
public void showHideTestBar() {
if (busTestBar == null) {
busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar);
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id);
lineNameTV = findViewById(R.id.bus_test_bar_current_line_name);
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5);
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5);
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp);
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp);
}
if (busTestBar.getVisibility() == View.VISIBLE) {
busTestBar.setVisibility(View.GONE);
} else {
BusRoutesResult routesResult = OrderModel.getInstance().getBusRoutesResult();
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
lineNameTV.setText("lineName:" + (routesResult == null ? "" : routesResult.getName()));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
busTestBar.setVisibility(View.VISIBLE);
}
}
@SuppressLint("SetTextI18n")
public void updateBusTestBarInfo() {
if (busTestBar != null && busTestBar.getVisibility() == View.VISIBLE) {
BusRoutesResult routesResult = OrderModel.getInstance().getBusRoutesResult();
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
lineNameTV.setText("lineName:" + (routesResult == null ? "" : routesResult.getName()));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
}
}
}

View File

@@ -0,0 +1,440 @@
package com.mogo.och.bus.fragment
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.TextView
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.R
import com.mogo.och.bus.constant.BusConst
import com.mogo.och.bus.model.OrderModel
import com.mogo.och.bus.view.SlidePanelView
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.utils.ResourcesUtils.getColor
import com.mogo.och.common.module.utils.SoundPoolHelper
import kotlinx.android.synthetic.main.bus_base_fragment.bus_autopilot_btn_iv
import kotlinx.android.synthetic.main.bus_base_fragment.bus_autopolot_btn_tv
import kotlinx.android.synthetic.main.bus_base_fragment.fl_speed
import kotlinx.android.synthetic.main.bus_base_fragment.mapBizView
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_arrived_tv
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_autopilot_status
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_slide_panel
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_station_panel_container
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxBubble
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxButton
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxList
import org.greenrobot.eventbus.EventBus
/**
* 网约车基础Fragment主要负责布局通用界面处理站点面板和通话面板互斥情况
*
*
* 部分业务放在了此处处理
*
* @author tongchenfei
*/
abstract class BaseBusTabFragment<V : IView?, P : Presenter<V>?> : MvpFragment<V, P>() {
//启动自驾动画
private var autopilotLoadingAnimator: ObjectAnimator? = null
var isAnimateRunning = false
private val TAG = "BaseBusTabFragment"
/**
* 滑动按钮触发的事件
*/
private val onSlideToEndListener = SlidePanelView.OnSlidePanelMoveToEndListener {
// 此处做一个代理,处理一下共有情况
if (slidePanelOnEndListener != null) {
slidePanelOnEndListener!!.moveToEnd()
}
}
override fun getLayoutId(): Int {
return R.layout.bus_base_fragment
}
override fun initViews() {
attachAutopilotBeforeLaunchView(fl_speed.context, fl_speed)
LayoutInflater.from(context).inflate(stationPanelViewId, module_mogo_och_station_panel_container)
module_mogo_och_slide_panel!!.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
initListener()
setAutopilotBtnStatus(getState(), isCanStartAutopilot(false, 0))
module_mogo_och_autopilot_status!!.setOnClickListener(object : OnPreventFastClickListener() {
override fun onClickImpl(v: View) {
restartAutopilot()
}
})
module_mogo_och_arrived_tv.setOnClickListener { onArriveStation() }
//消息盒子
viewDriverMsgBoxButton!!.setClickListener(object :DriverMsgBoxButtonView.ClickListener{
override fun showMsgBoxList(show: Boolean) {
if (show) {
viewDriverMsgBoxList!!.visibility = View.VISIBLE
viewDriverMsgBoxList!!.notifyData()
viewDriverMsgBoxBubble!!.visibility = View.GONE
viewDriverMsgBoxBubble!!.isShowData(false)
} else {
viewDriverMsgBoxList!!.visibility = View.GONE
viewDriverMsgBoxBubble!!.visibility = View.VISIBLE
viewDriverMsgBoxBubble!!.isShowData(true)
}
}
})
}
override fun initViews(savedInstanceState: Bundle?) {
super.initViews(savedInstanceState)
mapBizView!!.onCreate(savedInstanceState)
smallMapView!!.onCreateView(savedInstanceState)
}
override fun onResume() {
super.onResume()
mapBizView!!.onResume()
smallMapView!!.onResume()
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
EventBus.getDefault().register(this)
return super.onCreateView(inflater, container, savedInstanceState)
}
protected abstract fun onArriveStation()
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mapBizView!!.onSaveInstanceState(outState)
}
override fun onLowMemory() {
super.onLowMemory()
mapBizView!!.onLowMemory()
}
override fun onPause() {
super.onPause()
mapBizView!!.onPause()
smallMapView!!.onPause()
}
override fun onDestroyView() {
mapBizView!!.onDestroy()
if (smallMapView != null) {
smallMapView!!.onDestroy()
}
EventBus.getDefault().unregister(this)
super.onDestroyView()
}
/**
* 测试到站
*/
protected abstract fun debugArrivedStation()
private fun initListener() {}
/**
* 展示滑动按钮
*
* @param text 指定的文字
*/
fun showSlidePanel(text: String?) {
UiThreadHandler.post({
module_mogo_och_slide_panel!!.setText(text)
module_mogo_och_slide_panel!!.visibility = View.VISIBLE
}, UiThreadHandler.MODE.QUEUE)
setArrivedClickable(false)
}
/**
* 设置进站按钮状态
*
* @param isClickable
*/
fun setArrivedClickable(isClickable: Boolean) {
UiThreadHandler.post({
module_mogo_och_arrived_tv!!.isEnabled = isClickable
if (isClickable) {
module_mogo_och_arrived_tv!!.setTextColor(getColor(R.color.bus_white))
} else {
module_mogo_och_arrived_tv!!.setTextColor(getColor(R.color.bus_arrived_btn_un_clickable_color))
}
}, UiThreadHandler.MODE.QUEUE)
}
/**
* 隐藏滑动按钮
*/
fun hideSlidePanel() {
UiThreadHandler.post(
{ module_mogo_och_slide_panel!!.visibility = View.GONE },
UiThreadHandler.MODE.QUEUE
)
}
fun playDI() {
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
}
/**
* 改变自动驾驶状态
*
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
*/
fun onAutopilotStatusChanged(autopilotStatus: Int, canStartAutopilt: Boolean) {
UiThreadHandler.post({
changeAutopilotBtnView(
autopilotStatus,
isAnimateRunning,
canStartAutopilt
)
}, UiThreadHandler.MODE.QUEUE)
}
fun setAutopilotBtnStatus(autopilotStatus: Int, canStartAutopilt: Boolean) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
== autopilotStatus
) { //0不可用
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
} else {
bus_autopolot_btn_tv!!.setTextColor(
AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_normal)
)
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_ic_autopilot)
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
if (canStartAutopilt) {
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
} else {
bus_autopolot_btn_tv!!.setTextColor(
AbsMogoApplication.getApp()
.getColor(R.color.bus_autopilot_text_color_disable)
)
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
}
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
bus_autopolot_btn_tv!!.setText(R.string.bus_loading_autopilot_runnig_tv)
module_mogo_och_autopilot_status!!.isClickable = true
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_2_status_bg)
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
== autopilotStatus
) {
bus_autopolot_btn_tv!!.setText(R.string.bus_pingxing_driver)
module_mogo_och_autopilot_status!!.isClickable = false
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_pxjs)
}
}
}
fun updateAutopilotStatus(autopilotStatus: Int) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
== autopilotStatus
) { //2 running
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_right_autopilot_icon)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_success_tv)
// ctvAutopilotStatus.setSelected(false);
module_mogo_och_autopilot_status!!.isClickable = false
} else {
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_wrong_autopilot_icon)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_failure_tv)
module_mogo_och_autopilot_status!!.isClickable = false
// ctvAutopilotStatus.setSelected(false);
}
UiThreadHandler.postDelayed({
setAutopilotBtnStatus(
autopilotStatus,
isCanStartAutopilot(false, 0)
)
}, 1000)
}
private fun changeAutopilotBtnView(
autopilotStatus: Int,
isAnimateRunning: Boolean,
canStartAutopilt: Boolean
) {
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
!= autopilotStatus
) {
// 主动开启自动驾驶中不为2为0、1则继续loading
return
}
if (isAnimateRunning) {
stopAnimAndUpdateBtnStatus()
} else {
setAutopilotBtnStatus(autopilotStatus, canStartAutopilt)
}
}
fun stopAnimAndUpdateBtnStatus() {
stopAutopilotAnimation()
updateAutopilotStatus(getState())
}
/**
* 隐藏【自动驾驶】按钮
*/
fun hideAutopilotBiz() {}
/**
* 展示【自动驾驶】按钮
*/
fun showAutopilotBiz() {}
open val slidePanelOnEndListener: SlidePanelView.OnSlidePanelMoveToEndListener?
get() = null
/**
* 获取站点面板view在[.initViews]时候添加到container中
*
* @return 站点面板view
*/
abstract val stationPanelViewId: Int
/**
* 重新开启自动驾驶
*/
abstract fun restartAutopilot()
/**
* 模拟自动驾驶返回状态
*
* @param status
*/
abstract fun debugAutoPilotStatus(status: Int)
/**
* 开启自动驾驶中间动画
*/
fun startAutopilotAnimation() {
isAnimateRunning = true
bus_autopolot_btn_tv!!.text =
ResourcesUtils.getString(R.string.bus_loading_autopilot_tv)
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
module_mogo_och_autopilot_status!!.isClickable = true
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_loading_autopilot_icon)
if (autopilotLoadingAnimator == null) {
autopilotLoadingAnimator =
ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f)
autopilotLoadingAnimator!!.interpolator = LinearInterpolator()
autopilotLoadingAnimator!!.repeatCount = -1 //无限循环
autopilotLoadingAnimator!!.setDuration(1000) //设置持续时间
}
autopilotLoadingAnimator!!.start() //动画开始
startingAutoApilotCountDown()
}
private fun startingAutoApilotCountDown() {
//10s 若自动驾驶没有开启,则结束动画
UiThreadHandler.postDelayed({ //未启动成功做处理
if (isAnimateRunning) { // 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
stopAutopilotAnimation()
updateAutopilotStatus(getState())
}
}, BusConst.TIMER_START_AUTOPILOT_INTERVAL)
}
/**
* 停止自动驾驶中间动画
*/
protected fun stopAutopilotAnimation() {
if (autopilotLoadingAnimator != null) {
autopilotLoadingAnimator!!.end()
bus_autopilot_btn_iv!!.clearAnimation()
autopilotLoadingAnimator = null
isAnimateRunning = false
}
}
override fun onDestroy() {
super.onDestroy()
}
/**
* Bus调试信息线路、轨迹等信息
*
*
* START
*/
private var busTestBar: View? = null
private var lineIdTV: TextView? = null
private var lineNameTV: TextView? = null
private var trajMd5TV: TextView? = null
private var stopMd5TV: TextView? = null
private var trajMd5DPQPTV: TextView? = null
private var stopMd5DPQPTV: TextView? = null
@SuppressLint("SetTextI18n")
fun showHideTestBar() {
if (busTestBar == null) {
busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar)
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id)
lineNameTV = findViewById(R.id.bus_test_bar_current_line_name)
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5)
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5)
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp)
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp)
}
if (busTestBar!!.visibility == View.VISIBLE) {
busTestBar!!.visibility = View.GONE
} else {
val routesResult = OrderModel.getInstance().busRoutesResult
lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
lineNameTV!!.text = "lineName:" + if (routesResult == null) "" else routesResult.name
trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
trajMd5DPQPTV!!.text =
"TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
stopMd5DPQPTV!!.text =
"SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
busTestBar!!.visibility = View.VISIBLE
}
}
@SuppressLint("SetTextI18n")
fun updateBusTestBarInfo() {
if (busTestBar != null && busTestBar!!.visibility == View.VISIBLE) {
val routesResult = OrderModel.getInstance().busRoutesResult
lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
lineNameTV!!.text = "lineName:" + if (routesResult == null) "" else routesResult.name
trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
trajMd5DPQPTV!!.text =
"TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
stopMd5DPQPTV!!.text =
"SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
}
}
}

View File

@@ -1,547 +0,0 @@
package com.mogo.och.bus.fragment;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import static com.mogo.map.MogoMap.DEFAULT;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import com.mogo.commons.storage.SharedPrefsMgr;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.temp.EventLogout;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.overlay.IMoGoOverlayManager;
import com.mogo.map.overlay.core.Level;
import com.mogo.map.overlay.point.Point;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusStationBean;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.presenter.BusPresenter;
import com.mogo.och.bus.ui.BusStationCommonItem;
import com.mogo.och.bus.ui.BusSwitchLineActivity;
import com.mogo.och.bus.view.SlidePanelView;
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
import com.mogo.och.common.module.utils.QRUtilsKt;
import com.mogo.och.common.module.utils.ResourcesUtils;
import com.mogo.och.common.module.wigets.BindQRCodeDialog;
import com.mogo.och.common.module.wigets.MarqueeTextView;
import com.mogo.och.common.module.wigets.OCHCommitDialog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import me.jessyan.autosize.utils.AutoSizeUtils;
/**
* 网约车小巴界面
*
* @author tongchenfei
*/
public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
public static final String TAG = "BusFragment";
private TextView mSwitchLine; //切换路线
private MarqueeTextView mLineName;
private TextView mTaskTime;
private Group groupStationsPanel;
private ConstraintLayout noDataView;
private BusStationBean startStation = null;
private BusStationBean endStation = null;
private BusStationCommonItem firstStationItem;
private BusStationCommonItem secondStationItem;
private BusStationCommonItem thirdStationItem;
@Override
public String getTagName() {
return "BusFragment";
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onDestroyView() {
if (mPresenter != null) {
mPresenter.onDestroy(this);
}
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
if(overlayManager!=null) {
overlayManager.removeAllLines();
overlayManager.removeAllPoints();
}
super.onDestroyView();
}
@Override
protected void initViews() {
super.initViews();
mSwitchLine = findViewById(R.id.switch_line_btn);
mSwitchLine.setTag(0);
mLineName = findViewById(R.id.module_och_bus_line_name);
firstStationItem = findViewById(R.id.bus_panel_first_station);
secondStationItem = findViewById(R.id.bus_panel_second_station);
thirdStationItem = findViewById(R.id.bus_panel_third_station);
mTaskTime = findViewById(R.id.bus_task_time_tv);
groupStationsPanel = findViewById(R.id.group_stations_panel);
noDataView = findViewById(R.id.no_line_data_view);
CallerLogger.d(M_BUS + TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getState());
// 初始化的时候设置 UI 按钮状态
showAutopilotBiz();
mSwitchLine.setOnClickListener(this);
mLineName.setOnLongClickListener(v -> {
showHideTestBar();
return false;
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void changeOverview(EventLogout eventLogout){
if (eventLogout.getMessgae() == EventLogout.LOGOUT_TYPE){
CallerLogger.d(M_BUS + TAG,"changeOverview Event消息去登出");
mPresenter.logout();
}else if (eventLogout.getMessgae() == EventLogout.SHOW_QR_TYPE){ //显示二维码
CallerLogger.d(M_BUS + TAG,"changeOverview Event qrcode");
String qrUrl = String.format(FunctionBuildConfig.urlJson.getBindDriverQRUrl(),
SharedPrefsMgr.getInstance().getSn());
Bitmap bmQr = QRUtilsKt.createQRCodeWithPicture(
BitmapFactory.decodeResource(getResources(), R.drawable.icon_qr_center_logo)
,qrUrl, AutoSizeUtils.dp2px(getContext(),340f),
AutoSizeUtils.dp2px(getContext(),340f),true);
if (bmQr != null){
BindQRCodeDialog.Builder builder = new BindQRCodeDialog.Builder();
builder.title(getString(R.string.bind_driver_qr_title))
.cancelStr(getString(R.string.qr_cancel))
.qrBm(bmQr).build(getContext()).show();
}else {
CallerLogger.d(M_BUS + TAG,"bmQr = null ");
}
}
}
@Override
protected void onArriveStation() {
mPresenter.arriveStation(null,"点击进站触发进站操作");
}
@Override
protected void debugArrivedStation() {
mPresenter.arriveStation(null,"点击debug进站按钮触发进站操作");
}
@NonNull
@Override
protected BusPresenter createPresenter() {
return new BusPresenter(this);
}
@Override
public void onResume() {
super.onResume();
}
public void hideStationsPanel(){
groupStationsPanel.setVisibility(View.GONE);
noDataView.setVisibility(View.VISIBLE);
}
public void showStationsPanel(){
groupStationsPanel.setVisibility(View.VISIBLE);
noDataView.setVisibility(View.GONE);
}
public void updateLineEmptyUI(){
setArrivedClickable(false);
showOrHideSwitchLineBtn(true);
hideStationsPanel();
hideSlidePanel();
resetStationBlinkAnim();
}
private void resetStationBlinkAnim() {
BlinkAnimationUtil.clearAnimation(firstStationItem.getCircleImageView());
BlinkAnimationUtil.clearAnimation(secondStationItem.getCircleImageView());
BlinkAnimationUtil.clearAnimation(thirdStationItem.getCircleImageView());
}
public void updateBusTaskStatus(String lineName, String lineTime,
List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived){
if (getActivity() == null) {
return;
}
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (stationList == null) {
// 获取小巴数据失败
return;
}
showStationsPanel();
showOrHideSwitchLineBtn(false);
mLineName.setText(lineName);
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
// 渲染小巴路线数据
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
}
},UiThreadHandler.MODE.QUEUE);
}
private void updateBusStationStatus(List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived) {
startStation = stationList.get(0);
endStation = stationList.get(stationList.size() - 1);
if (arrivingOrArrivedIndex == stationList.size() - 1 && isArrived){
//切换路线和结束路线按钮切换
showSlidePanel("单程结束");
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(),R.raw.end_marker);
}else if (arrivingOrArrivedIndex == 0 && isArrived){
showSlidePanel("滑动出发");
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER,
startStation.getLat(), startStation.getLon(),R.raw.star_marker);
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER,
endStation.getLat(), endStation.getLon(),R.raw.end_marker);
}else{
if (isArrived){
// 重置滑动按钮文字
showSlidePanel("滑动出发");
}
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(),R.raw.end_marker);
}
if (stationList.size() > 2){ //只有两个站点
updateMoreThanTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
}else {
updateTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
}
updateBusTestBarInfo();
}
/**
* 有两个以上站点的路线
* @param stationList
* @param arrivingOrArrivedIndex
* @param isArrived
*/
private void updateMoreThanTwoStationsUI(List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived) {
secondStationItem.setStationTag("");
secondStationItem.showOrHideStationArrowBg(true);
thirdStationItem.setStationTag("");
secondStationItem.setVisibility(View.VISIBLE);
thirdStationItem.showOrHideStationArrowBg(false);
if (arrivingOrArrivedIndex == 0 || arrivingOrArrivedIndex -1 == 0
|| (arrivingOrArrivedIndex -2 == 0 && stationList.size() == 3)){
firstStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start));
}else {
firstStationItem.setStationTag("");
}
if (arrivingOrArrivedIndex + 1 == stationList.size() - 1 || arrivingOrArrivedIndex == stationList.size() - 1
|| (arrivingOrArrivedIndex == 0 && arrivingOrArrivedIndex + 2 == stationList.size() - 1)){ //确认是否显示 "终"
thirdStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end));
}else {
thirdStationItem.setStationTag("");
}
//圆点: 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
if (arrivingOrArrivedIndex == 0 && isArrived){
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
secondStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
firstStationItem.setStationName(stationList.get(0).getName());
secondStationItem.setStationName(stationList.get(1).getName());
thirdStationItem.setStationName(stationList.get(2).getName());
firstStationItem.setStationPointBg(1);
secondStationItem.setStationPointBg(2);
thirdStationItem.setStationPointBg(2);
firstStationItem.setStationArrowBg(2);
secondStationItem.setStationArrowBg(2);
}else if (arrivingOrArrivedIndex == stationList.size() - 1){
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
secondStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -2).getName());
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
firstStationItem.setStationPointBg(0);
secondStationItem.setStationPointBg(0);
thirdStationItem.setStationPointBg(1);
firstStationItem.setStationArrowBg(0);
if (isArrived){
secondStationItem.setStationArrowBg(0);
}else {
secondStationItem.setStationArrowBg(1);
}
}else {
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
secondStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex + 1).getName());
firstStationItem.setStationPointBg(0);
secondStationItem.setStationPointBg(1);
thirdStationItem.setStationPointBg(2);
secondStationItem.setStationArrowBg(2);
if (isArrived){
firstStationItem.setStationArrowBg(0);
}else {
firstStationItem.setStationArrowBg(1);
}
}
}
/**
* 只有两个站点的路线
* @param stationList
* @param arrivingOrArrivedIndex
* @param isArrived
*/
private void updateTwoStationsUI(List<BusStationBean> stationList,
int arrivingOrArrivedIndex,
boolean isArrived) {
secondStationItem.setVisibility(View.GONE);
secondStationItem.showOrHideStationArrowBg(false);
thirdStationItem.showOrHideStationArrowBg(false);
firstStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start));
thirdStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end));
firstStationItem.setStationName(stationList.get(0).getName());
thirdStationItem.setStationName(stationList.get(1).getName());
//圆点: 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
if (arrivingOrArrivedIndex == 0 && isArrived){//到站
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
firstStationItem.setStationPointBg(1);
firstStationItem.setStationArrowBg(2);
thirdStationItem.setStationPointBg(0);
}else {
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
if (isArrived){ //到终点
firstStationItem.setStationPointBg(0);
firstStationItem.setStationArrowBg(0);
thirdStationItem.setStationPointBg(1);
}else { //到终点途中
firstStationItem.setStationPointBg(0);
firstStationItem.setStationArrowBg(1);
thirdStationItem.setStationPointBg(1);
}
}
}
private void showOrHideSwitchLineBtn(boolean isShow) {
if (isShow){//显示切换路线
mSwitchLine.setTag(0);
mSwitchLine.setText(ResourcesUtils.getString(R.string.bus_switch_line_btn));
}else {//显示结束路线
mSwitchLine.setTag(1);
mSwitchLine.setText(ResourcesUtils.getString(R.string.bus_close_line_btn));
}
}
public void hideOchBus() {
// tvNotice.setVisibility(View.GONE);
}
@Override
public int getStationPanelViewId() {
return R.layout.bug_fragment_och;
}
@Override
public void restartAutopilot() {
if (!isAnimateRunning) {
mPresenter.restartAutopilot();
}
}
@Override
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
return this;
}
@Override
public void moveToEnd() {
// 开启自动驾驶到下一站
if (isAnimateRunning){
stopAutopilotAnimation();
}
mPresenter.autoDriveToNextStation();
}
/**
* 设置自动驾驶可用状态
*/
public void onAutopilotEnableChange(boolean isEnable) {
if (isEnable) {
showAutopilotBiz();
} else {
hideAutopilotBiz();
}
}
public void clearBusStationsMarkers(){
CallerLogger.d(M_BUS + TAG,"clearBusStationsMarkers()");
if (null != startStation) {
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
}
if (null != endStation) {
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(),R.raw.end_marker);
}
//清除鹰眼右下角小地图轨迹
CallerLogger.d(SceneConstant.M_BUS, "clearBusStationsMarkers --------->");
smallMapView.clearPolyline();
}
/**
* 绘制地图起点终点
*
* @param isAdd
* @param uuid
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
if (isAdd) {
Runnable setMapMarkerRunnable = () -> {
CallerLogger.d(M_BUS + "setMapMaker= "+Thread.currentThread().getName(),
uuid + "=latitude=" + lat + ",longitude=" + longi);
Point.Options.Builder builder = new Point.Options.Builder(BusConst.TYPE_MARKER_BUS_ORDER, Level.MAP_MARKER)
.setId(uuid)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.isUseGps(true)
.controlAngle(false)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
if (overlayManager != null) {
overlayManager.showOrUpdatePoint(builder.build(), DEFAULT);
}
};
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
} else {
Runnable removeMapMarkerRunnable = () -> {
CallerLogger.d(M_BUS + "RemoveMapMaker="+Thread.currentThread().getName(),
uuid+"=latitude="+lat+",longitude="+longi);
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
if (overlayManager != null) {
overlayManager.removePoint(uuid);
}
};
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
}
}
@Override
public void debugAutoPilotStatus(int status) {
mPresenter.debugAutoPilotStatus(status);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.switch_line_btn) {//切换路线条件: 自动驾驶过程中点击则toast提示自动驾驶中不可切换路线
//本次行程未结束不支持切换路线。点击则toast提示当前行程未完成不可切换路线
if (CallerAutoPilotStatusListenerManager.INSTANCE.getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_switch_line_btn_warning1));
return;
}
if ((int)mSwitchLine.getTag() == 0){//切换路线
Intent intent = new Intent(getContext(), BusSwitchLineActivity.class);
ActivityUtils.startActivity(intent);
}else {//结束任务
OCHCommitDialog.Builder builder = new OCHCommitDialog.Builder();
OCHCommitDialog closeLineConfirmDialog = builder
.title(getString(R.string.bus_dialog_title))
.tips(getString(R.string.bus_dialog_tips))
.confirmStr(getString(R.string.bus_dialog_confirm))
.cancelStr(getString(R.string.bus_dialog_cancel))
.build(getContext());
closeLineConfirmDialog.setClickListener(new OCHCommitDialog.ClickListener() {
@Override
public void confirm() {
mPresenter.abortTask();
}
@Override
public void cancel() {
closeLineConfirmDialog.dismiss();
}
});
closeLineConfirmDialog.show();
}
}
}
}

View File

@@ -0,0 +1,512 @@
package com.mogo.och.bus.fragment
import android.content.Intent
import android.graphics.BitmapFactory
import android.os.Bundle
import android.view.View
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.temp.EventLogout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverlayManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ActivityUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.MogoMap
import com.mogo.map.overlay.core.Level
import com.mogo.map.overlay.point.Point
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.response.BusStationBean
import com.mogo.och.bus.constant.BusConst
import com.mogo.och.bus.presenter.BusPresenter
import com.mogo.och.bus.ui.BusSwitchLineActivity
import com.mogo.och.bus.view.SlidePanelView
import com.mogo.och.common.module.utils.BlinkAnimationUtil
import com.mogo.och.common.module.utils.OCHThreadPoolManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.utils.ResourcesUtils.getColor
import com.mogo.och.common.module.utils.createQRCodeWithPicture
import com.mogo.och.common.module.wigets.BindQRCodeDialog
import com.mogo.och.common.module.wigets.OCHCommitDialog
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_first_station
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_second_station
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_third_station
import kotlinx.android.synthetic.main.bug_fragment_och.bus_task_time_tv
import kotlinx.android.synthetic.main.bug_fragment_och.group_stations_panel
import kotlinx.android.synthetic.main.bug_fragment_och.module_och_bus_line_name
import kotlinx.android.synthetic.main.bug_fragment_och.switch_line_btn
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
import kotlinx.android.synthetic.main.bus_no_line_view.no_line_data_view
import me.jessyan.autosize.utils.AutoSizeUtils
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
/**
* 网约车小巴界面
*
* @author tongchenfei
*/
class BusFragment : BaseBusTabFragment<BusFragment?, BusPresenter?>(),
SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
private var startStation: BusStationBean? = null
private var endStation: BusStationBean? = null
override fun getTagName(): String {
return "BusFragment"
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
}
override fun onDestroyView() {
if (mPresenter != null) {
mPresenter!!.onDestroy(this)
}
val overlayManager = getOverlayManager()
if (overlayManager != null) {
overlayManager.removeAllLines()
overlayManager.removeAllPoints()
}
super.onDestroyView()
}
override fun initViews() {
super.initViews()
switch_line_btn!!.tag = 0
d(SceneConstant.M_BUS + TAG, "initView: " + getState())
// 初始化的时候设置 UI 按钮状态
showAutopilotBiz()
switch_line_btn!!.setOnClickListener(this)
module_och_bus_line_name!!.setOnLongClickListener { v: View? ->
showHideTestBar()
false
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun changeOverview(eventLogout: EventLogout) {
if (eventLogout.messgae == EventLogout.LOGOUT_TYPE) {
d(SceneConstant.M_BUS + TAG, "changeOverview Event消息去登出")
mPresenter!!.logout()
} else if (eventLogout.messgae == EventLogout.SHOW_QR_TYPE) { //显示二维码
d(SceneConstant.M_BUS + TAG, "changeOverview Event qrcode")
val qrUrl = String.format(
FunctionBuildConfig.urlJson.bindDriverQRUrl,
SharedPrefsMgr.getInstance().sn
)
val bmQr = createQRCodeWithPicture(
BitmapFactory.decodeResource(resources, R.drawable.icon_qr_center_logo),
qrUrl,
AutoSizeUtils.dp2px(context, 340f),
AutoSizeUtils.dp2px(context, 340f),
true
)
if (bmQr != null) {
context?.let {
val builder = BindQRCodeDialog.Builder()
builder.title(ResourcesUtils.getString(R.string.bind_driver_qr_title))
.cancelStr(ResourcesUtils.getString(R.string.qr_cancel))
.qrBm(bmQr).build(it)!!.show()
}
} else {
d(SceneConstant.M_BUS + TAG, "bmQr = null ")
}
}
}
override fun onArriveStation() {
mPresenter!!.arriveStation(null, "点击进站触发进站操作")
}
override fun debugArrivedStation() {
mPresenter!!.arriveStation(null, "点击debug进站按钮触发进站操作")
}
override val stationPanelViewId: Int
get() = R.layout.bug_fragment_och
override fun createPresenter(): BusPresenter {
return BusPresenter(this)
}
override fun onResume() {
super.onResume()
}
fun hideStationsPanel() {
group_stations_panel!!.visibility = View.GONE
no_line_data_view!!.visibility = View.VISIBLE
}
fun showStationsPanel() {
group_stations_panel!!.visibility = View.VISIBLE
no_line_data_view!!.visibility = View.GONE
}
fun updateLineEmptyUI() {
setArrivedClickable(false)
showOrHideSwitchLineBtn(true)
hideStationsPanel()
hideSlidePanel()
resetStationBlinkAnim()
}
private fun resetStationBlinkAnim() {
BlinkAnimationUtil.clearAnimation(bus_panel_first_station!!.getCircleImageView())
BlinkAnimationUtil.clearAnimation(bus_panel_second_station!!.getCircleImageView())
BlinkAnimationUtil.clearAnimation(bus_panel_third_station!!.getCircleImageView())
}
fun updateBusTaskStatus(
lineName: String?, lineTime: String,
stationList: List<BusStationBean>?,
arrivingOrArrivedIndex: Int,
isArrived: Boolean
) {
if (activity == null) {
return
}
UiThreadHandler.post(Runnable {
if (stationList == null) {
// 获取小巴数据失败
return@Runnable
}
showStationsPanel()
showOrHideSwitchLineBtn(false)
module_och_bus_line_name!!.text = lineName
bus_task_time_tv!!.text = ResourcesUtils.getString(R.string.bus_line_time_tag) + lineTime
// 渲染小巴路线数据
updateBusStationStatus(stationList, arrivingOrArrivedIndex, isArrived)
}, UiThreadHandler.MODE.QUEUE)
}
private fun updateBusStationStatus(
stationList: List<BusStationBean>,
arrivingOrArrivedIndex: Int,
isArrived: Boolean
) {
startStation = stationList[0]
endStation = stationList[stationList.size - 1]
if (arrivingOrArrivedIndex == stationList.size - 1 && isArrived) {
//切换路线和结束路线按钮切换
showSlidePanel("单程结束")
setOrRemoveMapMaker(
false,
BusConst.BUS_END_MAP_MAKER,
endStation!!.lat,
endStation!!.lon,
R.raw.end_marker
)
} else if (arrivingOrArrivedIndex == 0 && isArrived) {
showSlidePanel("滑动出发")
setOrRemoveMapMaker(
true, BusConst.BUS_START_MAP_MAKER,
startStation!!.lat, startStation!!.lon, R.raw.star_marker
)
setOrRemoveMapMaker(
true, BusConst.BUS_END_MAP_MAKER,
endStation!!.lat, endStation!!.lon, R.raw.end_marker
)
} else {
if (isArrived) {
// 重置滑动按钮文字
showSlidePanel("滑动出发")
}
setOrRemoveMapMaker(
false,
BusConst.BUS_START_MAP_MAKER,
startStation!!.lat,
startStation!!.lon,
R.raw.star_marker
)
setOrRemoveMapMaker(
true,
BusConst.BUS_END_MAP_MAKER,
endStation!!.lat,
endStation!!.lon,
R.raw.end_marker
)
}
if (stationList.size > 2) { //只有两个站点
updateMoreThanTwoStationsUI(stationList, arrivingOrArrivedIndex, isArrived)
} else {
updateTwoStationsUI(stationList, arrivingOrArrivedIndex, isArrived)
}
updateBusTestBarInfo()
}
/**
* 有两个以上站点的路线
* @param stationList
* @param arrivingOrArrivedIndex
* @param isArrived
*/
private fun updateMoreThanTwoStationsUI(
stationList: List<BusStationBean>,
arrivingOrArrivedIndex: Int,
isArrived: Boolean
) {
bus_panel_second_station!!.setStationTag("")
bus_panel_second_station!!.showOrHideStationArrowBg(true)
bus_panel_third_station!!.setStationTag("")
bus_panel_second_station!!.visibility = View.VISIBLE
bus_panel_third_station!!.showOrHideStationArrowBg(false)
if (arrivingOrArrivedIndex == 0 || arrivingOrArrivedIndex - 1 == 0 || arrivingOrArrivedIndex - 2 == 0 && stationList.size == 3) {
bus_panel_first_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start))
} else {
bus_panel_first_station!!.setStationTag("")
}
if (arrivingOrArrivedIndex + 1 == stationList.size - 1 || arrivingOrArrivedIndex == stationList.size - 1 || arrivingOrArrivedIndex == 0 && arrivingOrArrivedIndex + 2 == stationList.size - 1) { //确认是否显示 "终"
bus_panel_third_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end))
} else {
bus_panel_third_station!!.setStationTag("")
}
//圆点: 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
if (arrivingOrArrivedIndex == 0 && isArrived) {
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
bus_panel_first_station!!.setStationName(stationList[0].name)
bus_panel_second_station!!.setStationName(stationList[1].name)
bus_panel_third_station!!.setStationName(stationList[2].name)
bus_panel_first_station!!.setStationPointBg(1)
bus_panel_second_station!!.setStationPointBg(2)
bus_panel_third_station!!.setStationPointBg(2)
bus_panel_first_station!!.setStationArrowBg(2)
bus_panel_second_station!!.setStationArrowBg(2)
} else if (arrivingOrArrivedIndex == stationList.size - 1) {
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
bus_panel_first_station!!.setStationName(stationList[arrivingOrArrivedIndex - 2].name)
bus_panel_second_station!!.setStationName(stationList[arrivingOrArrivedIndex - 1].name)
bus_panel_third_station!!.setStationName(stationList[arrivingOrArrivedIndex].name)
bus_panel_first_station!!.setStationPointBg(0)
bus_panel_second_station!!.setStationPointBg(0)
bus_panel_third_station!!.setStationPointBg(1)
bus_panel_first_station!!.setStationArrowBg(0)
if (isArrived) {
bus_panel_second_station!!.setStationArrowBg(0)
} else {
bus_panel_second_station!!.setStationArrowBg(1)
}
} else {
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
bus_panel_first_station!!.setStationName(stationList[arrivingOrArrivedIndex - 1].name)
bus_panel_second_station!!.setStationName(stationList[arrivingOrArrivedIndex].name)
bus_panel_third_station!!.setStationName(stationList[arrivingOrArrivedIndex + 1].name)
bus_panel_first_station!!.setStationPointBg(0)
bus_panel_second_station!!.setStationPointBg(1)
bus_panel_third_station!!.setStationPointBg(2)
bus_panel_second_station!!.setStationArrowBg(2)
if (isArrived) {
bus_panel_first_station!!.setStationArrowBg(0)
} else {
bus_panel_first_station!!.setStationArrowBg(1)
}
}
}
/**
* 只有两个站点的路线
* @param stationList
* @param arrivingOrArrivedIndex
* @param isArrived
*/
private fun updateTwoStationsUI(
stationList: List<BusStationBean>,
arrivingOrArrivedIndex: Int,
isArrived: Boolean
) {
bus_panel_second_station!!.visibility = View.GONE
bus_panel_second_station!!.showOrHideStationArrowBg(false)
bus_panel_third_station!!.showOrHideStationArrowBg(false)
bus_panel_first_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start))
bus_panel_third_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end))
bus_panel_first_station!!.setStationName(stationList[0].name)
bus_panel_third_station!!.setStationName(stationList[1].name)
//圆点: 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
if (arrivingOrArrivedIndex == 0 && isArrived) { //到站
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
bus_panel_first_station!!.setStationPointBg(1)
bus_panel_first_station!!.setStationArrowBg(2)
bus_panel_third_station!!.setStationPointBg(0)
} else {
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
if (isArrived) { //到终点
bus_panel_first_station!!.setStationPointBg(0)
bus_panel_first_station!!.setStationArrowBg(0)
bus_panel_third_station!!.setStationPointBg(1)
} else { //到终点途中
bus_panel_first_station!!.setStationPointBg(0)
bus_panel_first_station!!.setStationArrowBg(1)
bus_panel_third_station!!.setStationPointBg(1)
}
}
}
private fun showOrHideSwitchLineBtn(isShow: Boolean) {
if (isShow) { //显示切换路线
switch_line_btn!!.tag = 0
switch_line_btn!!.text = ResourcesUtils.getString(R.string.bus_switch_line_btn)
} else { //显示结束路线
switch_line_btn!!.tag = 1
switch_line_btn!!.text = ResourcesUtils.getString(R.string.bus_close_line_btn)
}
}
override fun restartAutopilot() {
if (!isAnimateRunning) {
mPresenter!!.restartAutopilot()
}
}
override fun moveToEnd() {
// 开启自动驾驶到下一站
if (isAnimateRunning) {
stopAutopilotAnimation()
}
mPresenter!!.autoDriveToNextStation()
}
/**
* 设置自动驾驶可用状态
*/
fun onAutopilotEnableChange(isEnable: Boolean) {
if (isEnable) {
showAutopilotBiz()
} else {
hideAutopilotBiz()
}
}
fun clearBusStationsMarkers() {
d(SceneConstant.M_BUS + TAG, "clearBusStationsMarkers()")
if (null != startStation) {
setOrRemoveMapMaker(
false,
BusConst.BUS_START_MAP_MAKER,
startStation!!.lat,
startStation!!.lon,
R.raw.star_marker
)
}
if (null != endStation) {
setOrRemoveMapMaker(
false,
BusConst.BUS_END_MAP_MAKER,
endStation!!.lat,
endStation!!.lon,
R.raw.end_marker
)
}
//清除鹰眼右下角小地图轨迹
d(SceneConstant.M_BUS, "clearBusStationsMarkers --------->")
smallMapView.clearPolyline()
}
/**
* 绘制地图起点终点
*
* @param isAdd
* @param uuid
*/
private fun setOrRemoveMapMaker(
isAdd: Boolean,
uuid: String,
lat: Double,
longi: Double,
resourceId: Int
) {
if (isAdd) {
val setMapMarkerRunnable = Runnable {
d(
SceneConstant.M_BUS + "setMapMaker= " + Thread.currentThread().name,
"$uuid=latitude=$lat,longitude=$longi"
)
val builder =
Point.Options.Builder(BusConst.TYPE_MARKER_BUS_ORDER, Level.MAP_MARKER)
.setId(uuid)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.isUseGps(true)
.controlAngle(false)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi)
val overlayManager = getOverlayManager()
overlayManager?.showOrUpdatePoint(builder.build(), MogoMap.DEFAULT)
}
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable)
} else {
val removeMapMarkerRunnable = Runnable {
d(
SceneConstant.M_BUS + "RemoveMapMaker=" + Thread.currentThread().name,
"$uuid=latitude=$lat,longitude=$longi"
)
val overlayManager = getOverlayManager()
overlayManager?.removePoint(uuid)
}
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
}
}
override fun debugAutoPilotStatus(status: Int) {
mPresenter!!.debugAutoPilotStatus(status)
}
override fun onClick(v: View) {
if (v.id == R.id.switch_line_btn) { //切换路线条件: 自动驾驶过程中点击则toast提示自动驾驶中不可切换路线
//本次行程未结束不支持切换路线。点击则toast提示当前行程未完成不可切换路线
if (getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
) {
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_switch_line_btn_warning1))
return
}
if (switch_line_btn!!.tag as Int == 0) { //切换路线
val intent = Intent(context, BusSwitchLineActivity::class.java)
ActivityUtils.startActivity(intent)
} else { //结束任务
context?.let {
val builder = OCHCommitDialog.Builder()
val closeLineConfirmDialog = builder
.title(ResourcesUtils.getString(R.string.bus_dialog_title))
.tips(ResourcesUtils.getString(R.string.bus_dialog_tips))
.confirmStr(ResourcesUtils.getString(R.string.bus_dialog_confirm))
.cancelStr(ResourcesUtils.getString(R.string.bus_dialog_cancel))
.build(it)
closeLineConfirmDialog!!.setClickListener(object : OCHCommitDialog.ClickListener {
override fun confirm() {
mPresenter!!.abortTask()
}
override fun cancel() {
closeLineConfirmDialog.dismiss()
}
})
closeLineConfirmDialog.show()
}
}
}
}
override val slidePanelOnEndListener: SlidePanelView.OnSlidePanelMoveToEndListener
get() = this
companion object {
const val TAG = "BusFragment"
}
}

View File

@@ -7,9 +7,9 @@ import com.mogo.commons.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.BusRoutesResponse;
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
import com.mogo.och.bus.bean.response.BusRoutesResponse;
import com.mogo.och.bus.callback.IBusLinesCallback;
import com.mogo.och.bus.net.OrderServiceManager;
import com.mogo.och.bus.ui.BusSwitchLineActivity;

View File

@@ -6,7 +6,6 @@ import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_ARRIVING;
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@@ -15,9 +14,6 @@ import androidx.annotation.Nullable;
import com.elegant.network.utils.GsonUtil;
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
@@ -27,20 +23,17 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Liste
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager;
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.StringUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.R;
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.response.BusRoutesResponse;
import com.mogo.och.bus.bean.response.BusRoutesResult;
import com.mogo.och.bus.bean.response.BusStationBean;
import com.mogo.och.bus.bean.WriteOffPassenger;
import com.mogo.och.bus.callback.IBusADASStatusCallback;
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
@@ -59,7 +52,6 @@ import com.mogo.och.common.module.manager.socket.lan.LanSocketManager;
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg;
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager;
import com.mogo.och.common.module.manager.socket.cloud.data.OCHOperationalMessage;
import com.mogo.och.common.module.constant.OchCommonConst;
import com.mogo.och.common.module.biz.login.LoginStatusManager;
import com.mogo.och.common.module.network.OchCommonServiceCallback;
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
@@ -111,8 +103,6 @@ public class OrderModel {
private boolean isGoingToNextStation = false;
// 运营类型
private static final int VEHICLE_TYPE = 10;
private static final int MSG_QUERY_BUS_STATION = 1001;
private static final long QUERY_BUS_STATION_DELAY = 5000;
private IRefreshBusStationsCallback refreshBusStationsCallback;
private ISlidePannelHideCallback slidePanelHideCallback;
@@ -125,14 +115,6 @@ public class OrderModel {
//0: 代表没有启动过 1代表是启动第一次当>=1 代表是重试 每次到站/路线结束清空置为0
private volatile int firstStartAutopilot = 0;
private final Handler handler = new Handler(msg -> {
if (msg.what == MSG_QUERY_BUS_STATION) {
queryBusRoutes();
return true;
}
return false;
});
private OrderModel() {
}
@@ -305,7 +287,6 @@ public class OrderModel {
public void release() {
startOrStopOrderLoop(false);
//startOrStopQueryPassengerWriteOff(false);
// 注销定位监听
CallerChassisLocationGCJ02ListenerManager.INSTANCE.removeListener(TAG);
@@ -345,9 +326,6 @@ public class OrderModel {
@Override
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
if (null == gnssInfo) return;
if (mControllerStatusCallback != null) {
mControllerStatusCallback.onCarLocationChanged(gnssInfo);
}
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
if (isGoingToNextStation && !isArrivedStation) {
@@ -1015,13 +993,6 @@ public class OrderModel {
}
}
/**
* 延时查询站点信心
*/
private void queryBusStationDelay() {
handler.sendEmptyMessageDelayed(MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY);
}
/**
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
@@ -1065,7 +1036,6 @@ public class OrderModel {
clearBusStationDatas();
queryBusRoutes();// 重新获取任务
removeTipRunnables();
// startOrStopQueryPassengerWriteOff(false);
ttsEndTask();
}
}

View File

@@ -1,19 +1,15 @@
package com.mogo.och.bus.net;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.och.bus.bean.BusCloseTaskRequest;
import com.mogo.och.bus.bean.BusOrdersResponse;
import com.mogo.och.bus.bean.BusQueryWriteOffPassengersResponse;
import com.mogo.och.bus.bean.BusWriteOffPassengersQueryRequest;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
import com.mogo.och.bus.bean.BusRoutesResponse;
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
import com.mogo.och.bus.bean.BusResetDrivingLineRequest;
import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
import com.mogo.och.bus.bean.request.BusCloseTaskRequest;
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean;
import com.mogo.och.bus.bean.response.BusRoutesResponse;
import com.mogo.och.bus.bean.request.CarHeartbeatReqBean;
import com.mogo.och.bus.bean.request.BusQueryLineStationsRequest;
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest;
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest;
import io.reactivex.Observable;
import retrofit2.http.Body;
@@ -38,9 +34,7 @@ public interface IBascApiService {
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
// @POST( "/autopilot-car-hailing/line/v2/lineDataWithDriver/query" )
@POST( "/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query" )
// @POST( "/mock/268/autopilot-car-hailing/bus/api/lineDataWithDriver/query" )
Observable<BusRoutesResponse> queryBusRoutes(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
/**
@@ -58,10 +52,7 @@ public interface IBascApiService {
* @return
*/
@Headers({"Content-Type:application/json;charset=UTF-8"})
// @POST("/autopilot-car-hailing/car/v2/bus/driving/away")
// @POST("/autopilot-car-hailing/car/v2/driver/bus/driving/away")
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/away")
Observable<BaseData> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
/**
@@ -70,37 +61,16 @@ public interface IBascApiService {
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @POST("/autopilot-car-hailing/order/v2/bus/driving/attachSite")
// @POST("/autopilot-car-hailing/order/v2/driver/bus/driving/attachSite")
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/attachSite")
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusUpdateSiteStatusRequest request);
/**
* 到站查询下车乘客
* @param request
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @POST("/autopilot-car-hailing/order/v2/bus/driving/siteArrivedOrders")
@POST("/autopilot-car-hailing/order/v2/driver/bus/driving/siteArrivedOrders")
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/siteArrivedOrders")
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers(@Header ("appId") String appId,@Header("ticket") String ticket,@Body QueryLeaveAwayPassengersRequest request);
@Headers({"Content-type:application/json;charset=UTF-8"})
// @GET("/autopilot-car-hailing/order/v2/bus/servicingOrders/query")
@GET("/autopilot-car-hailing/order/v2/driver/bus/servicingOrders/query")
// @GET("/mock/268/autopilot-car-hailing/bus/api/servicingOrders/query")
Observable<BusOrdersResponse> queryBusOrders(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
/**
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
* @param data
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
// @POST( "/autopilot-car-hailing/location/v2/driver/heartbeat" )
@POST( "/autopilot-car-hailing/location/v2/driver/bus/heartbeat" )
Observable<BaseData> runCarHeartbeat(@Header ("appId") String appId,@Header("ticket") String ticket,@Body CarHeartbeatReqBean data);
@@ -125,6 +95,13 @@ public interface IBascApiService {
Observable<BusQueryLineTaskResponse> queryBusTaskByLineId(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("lineId") String lineId);
/**
* 上传轨迹信息
* @param appId
* @param ticket
* @param data
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate" )
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusRoutePlanningUpdateReqBean data);
@@ -149,16 +126,5 @@ public interface IBascApiService {
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
Observable<BaseData> endTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
/**
* 查询核销乘客,目前不再使用,改为后台下发核销的乘客
* @param appId
* @param ticket
* @param data
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST("/autopilot-car-hailing/operation/v1/driver/order/verificationResult")
Observable<BusQueryWriteOffPassengersResponse> queryWriteOffPassengers(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusWriteOffPassengersQueryRequest data);
}

View File

@@ -1,20 +1,13 @@
package com.mogo.och.bus.net;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.och.bus.bean.BusCloseTaskRequest;
import com.mogo.och.bus.bean.BusOrdersResponse;
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.BusQueryWriteOffPassengersResponse;
import com.mogo.och.bus.bean.BusResetDrivingLineRequest;
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
import com.mogo.och.bus.bean.BusRoutesResponse;
import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
import com.mogo.och.bus.bean.BusWriteOffPassengersQueryRequest;
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
import com.mogo.och.bus.bean.request.BusCloseTaskRequest;
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest;
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean;
import com.mogo.och.bus.bean.response.BusRoutesResponse;
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest;
import io.reactivex.Observable;
import retrofit2.http.Body;
@@ -34,12 +27,8 @@ import retrofit2.http.Query;
public interface ISAASApiService {
/**
* 根据车机坐标获取所在区域全部站点信息
*
* @param request 请求参数
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
// @POST( "/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query" )
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
Observable<BusRoutesResponse> queryBusRoutes(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
@@ -49,64 +38,28 @@ public interface ISAASApiService {
* 开始路线
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
// @POST( "/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startTask" )
@POST( "/och-bus-cabin/cab/flow/v1/bus/driver/startTask" )
Observable<BusRoutesResponse> switchLine(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetDrivingLineRequest request);
/**
* 离站,通知服务器
* @param request
* @return
*/
@Headers({"Content-Type:application/json;charset=UTF-8"})
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/leave")
Observable<BaseData> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
/**
* 到站 更新到站信息
* @param request
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/arrive")
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusUpdateSiteStatusRequest request);
/**
* 到站查询下车乘客
* @param request
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @POST("/autopilot-car-hailing/order/v2/driver/bus/driving/siteArrivedOrders")
@POST("/och-bus-cabin/api/business/v1/siteArrivedOrders")
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers(@Header ("appId") String appId,@Header("ticket") String ticket,@Body QueryLeaveAwayPassengersRequest request);
@Headers({"Content-type:application/json;charset=UTF-8"})
// @GET("/autopilot-car-hailing/order/v2/driver/bus/servicingOrders/query")
@GET("/och-bus-cabin/api/business/v1/servicingOrders/query")
Observable<BusOrdersResponse> queryBusOrders(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
/**
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
* @param data
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/autopilot-car-hailing/location/v2/driver/bus/heartbeat" )
Observable<BaseData> runCarHeartbeat(@Header ("appId") String appId,@Header("ticket") String ticket,@Body CarHeartbeatReqBean data);
/**
* 查询车辆配置的所有路线
* @param appId
* @param ticket
* @param sn
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
// @GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
@GET("/och-bus-cabin/api/business/v1/driver/BusBindLine")
Observable<BusQueryLinesResponse> queryBusLines(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
@@ -118,11 +71,13 @@ public interface ISAASApiService {
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
// @GET("/autopilot-car-hailing/line/v2/driver/bus/task/query")
@GET("/och-bus-cabin/api/business/v1/driver/bus/task/query")
Observable<BusQueryLineTaskResponse> queryBusTaskByLineId(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("lineId") String lineId);
/**
* 上传轨迹信息
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST( "/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate" )
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusRoutePlanningUpdateReqBean data);
@@ -135,7 +90,6 @@ public interface ISAASApiService {
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/abortTask")
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/abortTask")
Observable<BaseData> abortTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
@@ -147,19 +101,8 @@ public interface ISAASApiService {
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/endTask")
Observable<BaseData> endTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
/**
* 查询核销乘客,目前不再使用,改为后台下发核销的乘客
* @param appId
* @param ticket
* @param data
* @return
*/
@Headers( {"Content-type:application/json;charset=UTF-8"} )
@POST("/autopilot-car-hailing/operation/v1/driver/order/verificationResult")
Observable<BusQueryWriteOffPassengersResponse> queryWriteOffPassengers(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusWriteOffPassengersQueryRequest data);
}

View File

@@ -7,7 +7,15 @@ import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.och.bus.bean.*
import com.mogo.och.bus.bean.request.BusCloseTaskRequest
import com.mogo.och.bus.bean.request.BusQueryLineStationsRequest
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest
import com.mogo.och.bus.bean.request.CarHeartbeatReqBean
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
import com.mogo.och.bus.bean.response.BusRoutesResponse
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
@@ -209,77 +217,6 @@ object OrderServiceManager {
}
}
/**
* 查询下车乘客
* @param context
* @param seq
* @param siteId
* @param callback
*/
@JvmStatic
fun queryStationLeaveAwayPassengers(
context: Context,
seq: Int,
siteId: Int,
callback: OchCommonServiceCallback<QueryLeaveAwayPassengersResponse>?
) {
M_SERVICE.queryStationLeaveAwayPassengers(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
SharedPrefsMgr.getInstance().token,
QueryLeaveAwayPassengersRequest(seq, siteId)
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryStationLeaveAwayPassengers"))
}
/**
* 查询当前到站点核销乘客
* @param context
* @param siteId
* @param callback
*/
@JvmStatic
fun queryStationWriteOffPassengers(
context: Context,
taskId: Int,
siteId: Int,
prePassengerTime: Long,
callback: OchCommonServiceCallback<BusQueryWriteOffPassengersResponse>?
) {
M_SERVICE.queryWriteOffPassengers(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
SharedPrefsMgr.getInstance().token,
BusWriteOffPassengersQueryRequest(taskId, siteId, prePassengerTime)
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryStationWriteOffPassengers"))
}
/**
* 查询小巴车订单
* @param context
* @param callback
*/
@JvmStatic
fun queryBusOrders(context: Context, callback: OchCommonServiceCallback<BusOrdersResponse>?) {
if (DebugConfig.getProjectFlavor().contains("saas")){
M_SAAS_SERVICE.queryBusOrders(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
SharedPrefsMgr.getInstance().token,
SharedPrefsMgr.getInstance().sn
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
}else{
M_SERVICE.queryBusOrders(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
SharedPrefsMgr.getInstance().token,
SharedPrefsMgr.getInstance().sn
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
}
}
@JvmStatic
fun queryBusLines(context: Context, callback: OchCommonServiceCallback<BusQueryLinesResponse>?) {
if (DebugConfig.getProjectFlavor().contains("saas")){

View File

@@ -7,8 +7,8 @@ import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
import com.mogo.och.bus.callback.IBusLinesCallback;
import com.mogo.och.bus.model.BusLineModel;
import com.mogo.och.bus.model.OrderModel;

View File

@@ -31,28 +31,6 @@ public class BusModelLoopManager {
}
private Disposable mHeartbeatDisposable; //心跳轮询
// private Disposable mQueryPassengerDisposable; //查询核销乘客
// public void startQueryPassengerWriteOffLoop() {
// if (mQueryPassengerDisposable != null && !mQueryPassengerDisposable.isDisposed()) {
// return;
// }
// CallerLogger.i(M_BUS + TAG, "startQueryPassengerWriteOffLoop()");
// mQueryPassengerDisposable = Observable.interval(LOOP_DELAY_500,
// LOOP_PASSENGER_5S, TimeUnit.MILLISECONDS)
// .map((aLong -> aLong + 1))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(aLong -> BusOrderModel.getInstance().queryPassengerWriteOff());
// }
// public void stopQueryPassengerWriteOffLoop() {
// if (mQueryPassengerDisposable != null) {
// CallerLogger.i(M_BUS + TAG, "stopQueryPassengerWriteOffLoop()");
// mQueryPassengerDisposable.dispose();
// mQueryPassengerDisposable = null;
// }
// }
public void startHeartbeatLoop() {
if (mHeartbeatDisposable != null && !mHeartbeatDisposable.isDisposed()) {

View File

@@ -2,8 +2,6 @@ package com.mogo.och.bus.presenter;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LifecycleOwner;
@@ -11,13 +9,12 @@ import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
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.bean.BusStationBean;
import com.mogo.och.bus.bean.response.BusStationBean;
import com.mogo.och.bus.bean.WriteOffPassenger;
import com.mogo.och.bus.callback.IBusADASStatusCallback;
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
@@ -35,15 +32,12 @@ import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager;
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
import com.zhjt.mogo.adas.data.AdasConstants;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
* 网约车小巴
@@ -240,11 +234,6 @@ public class BusPresenter extends Presenter<BusFragment>
}
}
@Override
public void onCarLocationChanged(MogoLocation location) {
}
@Override
public void startOpenAutopilot() {
//非美化模式下启动动画

View File

@@ -1,42 +0,0 @@
package com.mogo.och.bus.receiver;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.bus.constant.BusConst;
/**
* 测试小巴车的场景
*
* @author donghongyu
* @date 4/26/21 12:08 PM
*/
public class TestBusBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "TestBusBroadcastReceiver";
private Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
try {
this.mContext = context;
int sceneType = intent.getIntExtra(BusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
CallerLogger.d(M_BUS + TAG, "sceneType:" + sceneType);
// 分发场景
dispatchSceneTest(sceneType);
} catch (Exception e) {
e.printStackTrace();
}
}
private void dispatchSceneTest(int sceneType) {
}
}

View File

@@ -15,12 +15,12 @@ import com.mogo.commons.mvp.MvpActivity
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.och.bus.presenter.BusLinePresenter
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter
import com.mogo.och.bus.bean.BusQueryLinesResponse
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
import com.mogo.och.bus.ui.adapter.OpenItemAnimator
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.BusQueryLineTaskResponse
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
import java.util.ArrayList
/**
@@ -146,7 +146,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
finish()
}
override fun onBusLineTasks(lineTaskInfo: BusQueryLineTaskResponse?, position: Int,autoRefresh:Boolean) {
override fun onBusLineTasks(lineTaskInfo: BusQueryLineTaskResponse?, position: Int, autoRefresh:Boolean) {
val result = mData[position]
if (result.taskList == null) {
result.taskList = ArrayList()

View File

@@ -1,8 +1,8 @@
package com.mogo.och.bus.ui;
import com.mogo.commons.mvp.IView;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
/**
* @author: wangmingjun

View File

@@ -10,7 +10,7 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.BusQueryLinesResponse
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter.SwitchLineViewHolder
import java.lang.Exception
import kotlin.text.StringBuilder

View File

@@ -8,7 +8,7 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.BusQueryLineTaskResponse
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
import com.mogo.och.bus.ui.adapter.SwitchLineTaskAdapter.SwitchLineTaskViewHolder
/**

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.och.bus.bean.BusRoutesResult;
import com.mogo.och.bus.bean.response.BusRoutesResult;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.model.OrderModel;
import com.mogo.och.common.module.biz.login.LoginStatusManager;

View File

@@ -1,187 +0,0 @@
package com.mogo.och.bus.view;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.View;
import androidx.annotation.Nullable;
import com.mogo.och.bus.R;
/**
* created by wujifei on 2021/3/24 16:20
* describe:
*/
public class BusArcView extends View {
//中心的文字描述
private final String mDes = "KM/H";
//根据数据显示的圆弧Paint
private Paint mArcPaint;
//圆弧颜色
private int mArcColor;
//圆弧的画笔的宽度
private final float mStrokeWith = getResources().getDimension(R.dimen.bus_ext_arcView_stroke_with);
//文字描述的paint
private Paint mTextPaint;
//当前进度夹角大小
private float mIncludedAngle = 0;
//当前数据
private int currentValue;
//最大数据
private final int maxValue = 240;
//圆弧背景的开始和结束间的夹角大小
private final float mAngle = 270;
//上次绘制圆弧夹角
private float lastAngle = 0;
public BusArcView(Context context) {
this(context, null);
}
public BusArcView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public BusArcView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//初始化paint
initPaint();
//绘制弧度
drawArc(canvas);
//绘制文本
drawText(canvas);
}
private void drawText(Canvas canvas) {
Rect mRect = new Rect();
String mValue = String.valueOf(currentValue);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
//绘制中心的数值
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
//绘制中心文字描述
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_des_text_size));
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
}
private void drawArc(Canvas canvas) {
//绘制圆弧背景
RectF mRectF = new RectF(mStrokeWith, mStrokeWith, getWidth() - mStrokeWith, getHeight() - mStrokeWith);
canvas.drawArc(mRectF, 135, mAngle, false, mArcPaint);
//绘制当前数值对应的圆弧
mArcPaint.setColor(mArcColor);
//根据当前数据绘制对应的圆弧
canvas.drawArc(mRectF, 135, mIncludedAngle, false, mArcPaint);
}
private void initPaint() {
//圆弧的paint
mArcPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
//抗锯齿
mArcPaint.setAntiAlias(true);
mArcPaint.setColor(Color.parseColor("#151D4C"));
//设置透明度数值为0-255
mArcPaint.setAlpha(100);
//设置画笔的画出的形状
mArcPaint.setStrokeJoin(Paint.Join.ROUND);
mArcPaint.setStrokeCap(Paint.Cap.ROUND);
//设置画笔类型
mArcPaint.setStyle(Paint.Style.STROKE);
//画笔宽度
mArcPaint.setStrokeWidth(mStrokeWith);
//中心文字的paint
mTextPaint = new Paint();
mTextPaint.setAntiAlias(true);
mTextPaint.setColor(Color.parseColor("#FFFFFF"));
//设置文本的对齐方式
mTextPaint.setTextAlign(Paint.Align.CENTER);
//mTextPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.dp_12));
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_center_text_size));
}
/**
* 为绘制弧度及数据设置动画
*
* @param startAngle 开始的弧度
* @param currentAngle 需要绘制的弧度
* @param time 动画执行的时长
*/
private void setAnimation(float startAngle, float currentAngle, int time) {
//绘制当前数据对应的圆弧的动画效果
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
progressAnimator.setDuration(time);
progressAnimator.setTarget(mIncludedAngle);
progressAnimator.addUpdateListener(animation -> {
mIncludedAngle = (float) animation.getAnimatedValue();
//重新绘制,不然不会出现效果
postInvalidate();
});
//开始执行动画
progressAnimator.start();
}
/**
* 设置弧形颜色
*
* @param value 颜色值
*/
public void setArcColor(int value) {
mArcColor = value;
}
/**
* 设置数据
*
* @param value 当前绘制的值
*/
public void setValues(int value) {
//完全覆盖
if (value > maxValue) {
value = maxValue;
}
if (value < 0) {
value = 0;
}
currentValue = value;
//计算弧度比重
float scale = (float) currentValue / maxValue;
//计算弧度
float currentAngle = scale * mAngle;
//开始执行动画
setAnimation(lastAngle, currentAngle, 1000);
lastAngle = currentAngle;
//重新绘制
postInvalidate();
}
private float dp2px(float dp) {
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
return dp * metrics.density;
}
}

View File

@@ -1,37 +0,0 @@
package com.mogo.och.bus.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.debug.DebugConfig;
/**
* 强制拦截所有touch时间的约束布局
*
* @author tongchenfei
*/
public class NoTouchConstraintLayout extends ConstraintLayout {
public NoTouchConstraintLayout(Context context) {
super(context);
}
public NoTouchConstraintLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NoTouchConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if(DebugConfig.isDebug()){
return super.onInterceptTouchEvent(ev);
}else {
return true;
}
}
}

View File

@@ -1,64 +0,0 @@
package com.mogo.och.bus.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
/**
* 垂直虚线
*
* @author tongchenfei
*/
public class VerticalDashLineView extends View {
public VerticalDashLineView(Context context) {
this(context,null);
}
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs,0);
}
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private final Paint linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Path dashPath = new Path();
private void init(){
linePaint.setColor(Color.GREEN);
linePaint.setStyle(Paint.Style.STROKE);
linePaint.setStrokeWidth(2);
linePaint.setPathEffect(new DashPathEffect(new float[]{5, 5}, 0));
}
public void setGradient(int startColor, int endColor) {
LinearGradient linearGradient = new LinearGradient(0, 0, getWidth(), getHeight(), startColor, endColor, Shader.TileMode.CLAMP);
linePaint.setShader(linearGradient);
invalidate();
}
public void setColor(int color) {
linePaint.setShader(null);
linePaint.setColor(color);
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
dashPath.reset();
dashPath.moveTo((float) getWidth()/2, 0);
dashPath.lineTo((float) getWidth()/2,getHeight());
canvas.drawPath(dashPath,linePaint);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_ai_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/icon_ai_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/icon_ai_select" android:state_selected="true" />
<item android:drawable="@drawable/icon_ai_select" android:state_focused="true" />
<item android:drawable="@drawable/icon_ai_normal" />
</selector>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/icon_bad_case_select" android:state_selected="true" />
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="true" />
<item android:drawable="@drawable/icon_bad_case_normal" />
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_base_icon_in_autopilot" android:state_checked="true" />
<item android:drawable="@drawable/bus_base_icon_not_in_autopilot" />
</selector>

View File

@@ -6,11 +6,13 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<!-- 高精地图 -->
<com.mogo.och.bus.view.BizMapView
android:id="@+id/mapBizView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 打开调试窗口 -->
<com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugViewTrigger
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_100"
@@ -19,6 +21,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!-- 展示速度、档位、方向盘、刹车、加速度 -->
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_618"
@@ -106,8 +109,8 @@
<!--消息盒子选择入口-->
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
android:id="@+id/viewDriverMsgBoxButton"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginTop="15dp"
android:layout_marginEnd="25dp"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
@@ -152,6 +155,7 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- 自动驾驶状态 -->
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/dp_616"
@@ -187,16 +191,17 @@
</RelativeLayout>
<!-- 站点信息页面 -->
<FrameLayout
android:id="@+id/module_mogo_och_station_panel_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="-24dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
/>
<!--订单调试页面-->
<include
android:id="@+id/module_mogo_och_bus_test_bar"
layout="@layout/bus_test_bar_view"
@@ -207,96 +212,59 @@
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_station_panel_container"
tools:visibility="visible" />
<!--切换地图远近事件 @dimen/module_switch_map -->
<LinearLayout
android:id="@+id/bus_switch_model_layout"
android:layout_width="@dimen/dp_172"
android:layout_height="@dimen/dp_172"
android:background="@drawable/bus_operation_status_bg"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_arrived_tv"
app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_arrived_tv"
app:layout_goneMarginBottom="@dimen/module_mogo_och_margin_bottom"
app:layout_goneMarginLeft="@dimen/module_mogo_och_margin_left">
<ImageView
android:id="@+id/bus_switch_model_icon"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80" />
</LinearLayout>
<!-- <CheckedTextView-->
<!-- android:id="@+id/module_mogo_och_operation_status"-->
<!-- android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"-->
<!-- android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"-->
<!-- android:background="@drawable/bus_operation_status_bg"-->
<!-- android:elevation="@dimen/dp_10"-->
<!-- android:gravity="center"-->
<!-- android:text="出车"-->
<!-- android:textAlignment="center"-->
<!-- android:textColor="@color/bus_autopilot_text_color_selector"-->
<!-- android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"-->
<!-- android:textStyle="bold"-->
<!-- android:layout_marginLeft="@dimen/module_mogo_och_margin_left"-->
<!-- android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"/>-->
<TextView
android:id="@+id/module_mogo_och_arrived_tv"
android:layout_width="@dimen/dp_172"
android:layout_height="@dimen/dp_172"
android:background="@drawable/bus_operation_status_bg"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginBottom="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_19"
android:background="@drawable/common_arrive_station_selector"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="@string/bus_arrived_str"
android:textColor="@color/bus_autopilot_text_color_selector"
android:textSize="@dimen/module_mogo_och_arrived_text_size"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<RelativeLayout
android:id="@+id/module_mogo_och_setting_layout"
android:layout_width="@dimen/dp_172"
android:layout_height="@dimen/dp_172"
android:background="@drawable/bus_operation_status_bg"
android:elevation="@dimen/dp_10"
<com.mogo.och.common.module.wigets.map.toolsview.ToolsView
android:id="@+id/toolsView"
android:layout_marginStart="-10dp"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/bus_switch_model_layout">
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_arrived_tv"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"/>
<ImageView
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:background="@drawable/bus_setting_btn_bg" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/module_mogo_och_badcase_rl"
android:layout_width="@dimen/dp_172"
android:layout_height="@dimen/dp_172"
android:background="@drawable/bus_operation_status_bg_selector"
<!--切换地图远近事件 @dimen/module_switch_map -->
<com.mogo.och.common.module.wigets.map.switchvisual.VisualView
android:id="@+id/switch_visual_view"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout">
app:layout_constraintLeft_toRightOf="@id/toolsView"
android:layout_marginStart="-10dp"
android:layout_marginBottom="@dimen/dp_17"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"/>
<ImageView
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:src="@drawable/icon_bad_case" />
</RelativeLayout>
<com.mogo.eagle.core.function.hmi.ui.widget.RomaBusView
android:layout_width="@dimen/dp_172"
android:layout_height="@dimen/dp_172"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_badcase_rl"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_badcase_rl"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_badcase_rl"
app:roma_close_bg="@drawable/bus_operation_status_bg"
app:roma_open_bg="@drawable/bus_operation_status_select_bg" />
<com.mogo.och.common.module.wigets.map.reportworkorder.ReportWorkOrderView
android:id="@+id/reportworkorderview"
android:layout_marginStart="-10dp"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/switch_visual_view"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"/>
<com.mogo.eagle.core.function.hmi.ui.widget.RomaTaxiView
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="-10dp"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintLeft_toRightOf="@id/reportworkorderview"
app:roma_close_bg="@drawable/common_driverroma_normal"
app:roma_open_bg="@drawable/common_driver_roma_press" />
<com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView
android:layout_width="wrap_content"
@@ -324,76 +292,6 @@
app:textSize="@dimen/module_mogo_och_slide_panel_textSize"
tools:visibility="visible" />
<Button
android:id="@+id/btnAutopilotDisable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#f00"
android:text="Disable"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnAutopilotEnable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0f0"
android:text="Enable"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotDisable" />
<Button
android:id="@+id/btnAutopilotRunning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00f"
android:text="Running"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
<Button
android:id="@+id/btnAutopilotPingxing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00f"
android:text="pingxingjiashi"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<Button
android:id="@+id/btnAutopilotArrive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#f00"
android:text="Arrived"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotPingxing" />
<Button
android:id="@+id/btnAutopilotRoute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#023D35"
android:text="上传全路径"
android:textSize="@dimen/dp_60"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotArrive"
tools:ignore="TextContrastCheck" />
<androidx.constraintlayout.widget.Group
android:id="@+id/groupTestPanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable
,btnAutopilotRunning,btnAutopilotRoute,btnAutopilotPingxing"
tools:visibility="visible" />
<com.mogo.eagle.core.function.smp.view.SmallMapView
android:id="@+id/smallMapView"
android:layout_width="wrap_content"

View File

@@ -23,7 +23,6 @@ public interface PassengerSAASServiceApi {
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
// @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
@@ -33,7 +32,6 @@ public interface PassengerSAASServiceApi {
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @GET("/autopilot-car-hailing/operation/v1/driver/bus/passenger/loginStatus")
@GET("/och-bus-cabin/api/business/v1/loginStatus")
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);

View File

@@ -32,7 +32,6 @@ public interface PassengerServiceApi {
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
@GET("/autopilot-car-hailing/operation/v1/driver/bus/passenger/loginStatus")
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);

View File

@@ -1,64 +0,0 @@
package com.mogo.och.bus.passenger.utils;
import android.content.Context;
import java.io.IOException;
import java.io.InputStream;
/**
* @author donghongyu
* @date 12/18/20 5:37 PM
*/
public class BusPassengerMapAssetStyleUtil {
public static byte[] getAssetsStyle(Context context,String fileName) {
byte[] buffer1 = null;
InputStream is1 = null;
try {
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
int count = 0;
while ((count = is1.read(buffer1)) > 0) {
is1.read(buffer1);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is1 != null) {
is1.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return buffer1;
}
public static byte[] getAssetsExtraStyle(Context context, String fileName) {
byte[] buffer1 = null;
InputStream is1 = null;
try {
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style_extra.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is1 != null) {
is1.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return buffer1;
}
}

View File

@@ -1,13 +0,0 @@
package com.mogo.och.bus.passenger.utils
import android.content.res.Resources
/**
* @author: wangmingjun
* @date: 2022/1/21
*/
object DimenUtil{
fun dp2px(value:Float):Float{
return (0.5f + value * Resources.getSystem().displayMetrics.density)
}
}

View File

@@ -1,9 +0,0 @@
package com.mogo.och.bus.passenger.callback;
/**
* @author: wangmingjun
* @date: 2022/3/10
*/
public interface IBusPassengerMapViewCallback {
void onCameraChange(float bearing);
}

View File

@@ -21,7 +21,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.addListener
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
@@ -66,7 +65,6 @@ import com.mogo.och.common.module.utils.PinYinUtil
import com.mogo.och.data.bean.BusRoutesResult
import com.mogo.och.data.bean.BusStationBean
import io.reactivex.schedulers.Schedulers
import mogo.telematics.pad.MessagePad.ArrivalNotification
import java.util.concurrent.ConcurrentHashMap
/**
@@ -261,12 +259,12 @@ object BusPassengerModel {
return
}
d(M_BUS_P + TAG, "AutopilotControlParameters is update.")
updateAutopilotControlParameters(parameters)
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
}
private fun clearAutopilotControlParameters() {
d(M_BUS_P + TAG, "AutopilotControlParameters is clear.")
updateAutopilotControlParameters(null)
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
}
private fun initAutopilotControlParameters(

View File

@@ -27,23 +27,11 @@ class PM2BaseFragment :
}
override fun initViews() {
//横竖屏
// setScreenDirection()
tv_bug_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
//隐藏小地图
initFragment()
}
// private fun setScreenDirection() {
// var ro = Settings.System.getInt(context?.contentResolver,
// Settings.System.USER_ROTATION,Surface.ROTATION_270)
// if (ro != Surface.ROTATION_270){
// ro = Surface.ROTATION_270
// }
// Settings.System.putInt(context?.contentResolver,
// Settings.System.USER_ROTATION,ro)
// }
/**
* 初始化行程信息,高静地图,宣传 三个fragment
*/

View File

@@ -6,9 +6,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.constraintlayout.widget.Group
import com.magic.mogo.och.charter.R
@@ -17,13 +14,9 @@ import com.magic.mogo.och.charter.view.autopilot.AutopilotStatusView
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.initAiCollect
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.reportWorkOrder
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showToolsView
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView.ClickListener
@@ -31,10 +24,6 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
import com.mogo.eagle.core.function.smp.view.SmallMapView
import com.mogo.eagle.core.function.view.MapBizView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHandler
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.och.common.module.utils.SoundPoolHelper
import kotlinx.android.synthetic.main.charter_base_fragment.module_mogo_och_arrived_tv
import org.greenrobot.eventbus.EventBus
@@ -48,21 +37,15 @@ import org.greenrobot.eventbus.EventBus
* @author tongchenfei
*/
abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
MvpFragment<V, P>(), IMogoMapListener, IMoGoAutopilotRecordListener {
MvpFragment<V, P>() {
private val TAG = "BaseBusTabFragment"
private var ctvAutopilotStatus: AutopilotStatusView? = null
protected var mSettingBtn: RelativeLayout? = null
protected var mBadcaseBtn: RelativeLayout? = null
protected var mAICollectBtn: RelativeLayout? = null
private var flStationPanelContainer: FrameLayout? = null
private var mapBizView: MapBizView? = null
private var groupTestPanel: Group? = null
protected var slidePanelView: SlidePanelView? = null
//远景和中景的切换
private var mSwitchMapModeImage: ImageView? = null
private var mSwitchMapModeLayout: LinearLayout? = null
protected var smallMapView: SmallMapView? = null
@@ -90,36 +73,13 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
slidePanelView?.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
// mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
val flSpeed = findViewById<FrameLayout>(R.id.fl_speed)
if (flSpeed != null) {
attachAutopilotBeforeLaunchView(flSpeed.context, flSpeed)
}
LayoutInflater.from(context).inflate(getStationPanelViewId(), flStationPanelContainer)
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout)
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon)
updateSwitchMapIcon()
mSwitchMapModeLayout!!.setOnClickListener(object : OnPreventFastClickListener() {
override fun onClickImpl(v: View) {
mapBizView?.let {
it.getUI()?.let { ui ->
if (ui.currentMapVisualAngle.isLongSight) {
ui.setLockMode(true)
ui.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
} else if (ui.currentMapVisualAngle.isMediumSight) {
ui.setLockMode(false)
ui.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_long)
} else {
ui.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
}
}
}
}
})
initListener()
// 模拟 不可自动驾驶目前场景是刚开机adas还未和工控机连接
@@ -153,21 +113,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
onArriveStation()
}
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout)
mSettingBtn!!.setOnClickListener { v: View? ->
showToolsView()
}
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl)
if (mBadcaseBtn != null) {
reportWorkOrder(mBadcaseBtn!!)
CallerAutopilotRecordListenerManager.addListener(TAG, this)
}
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl)
if (mAICollectBtn != null) {
initAiCollect(mAICollectBtn!!)
}
//消息盒子
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton)
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList)
@@ -260,20 +205,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
requireActivity().runOnUiThread { slidePanelView?.visibility = View.GONE }
}
private fun updateSwitchMapIcon() {
mapBizView?.let {
it.getUI()?.let { ui ->
if (ui.currentMapVisualAngle.isLongSight) {
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_long)
} else if (ui.currentMapVisualAngle.isMediumSight) {
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
} else {
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
}
}
}
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mapBizView!!.onSaveInstanceState(outState)
@@ -299,7 +230,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
}
private fun initListener() {
mogoMapListenerHandler.registerHostMapListener(TAG, this)
}
@@ -334,17 +264,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
override fun onDestroy() {
super.onDestroy()
mogoMapListenerHandler.unregisterHostMapListener(TAG)
}
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode) {
if (visualAngleMode.isMediumSight) {
mSwitchMapModeLayout!!.visibility = View.VISIBLE
} else if (visualAngleMode.isLongSight) {
mSwitchMapModeLayout!!.visibility = View.VISIBLE
} else if (visualAngleMode.isCloseSight) {
mSwitchMapModeLayout!!.visibility = View.GONE
}
}
/**
@@ -370,43 +289,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
private var stopMd5TV: TextView? = null
private var trajMd5DPQPTV: TextView? = null
private var stopMd5DPQPTV: TextView? = null
// open fun showHideTestBar() {
// if (busTestBar == null) {
// busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar)
// lineIdTV = findViewById(R.id.bus_test_bar_current_line_id)
// trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5)
// stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5)
// trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp)
// stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp)
// }
// if (busTestBar!!.visibility == View.VISIBLE) {
// busTestBar!!.visibility = View.GONE
// } else {
// val routesResult: BusRoutesResult = BusOrderModel.getInstance().getBusRoutesResult()
// lineIdTV!!.text = "lineId:" + (routesResult.lineId.toString() ?: "")
// trajMd5TV!!.text = "TMd5:" + routesResult.csvFileMd5
// stopMd5TV!!.text = "SMd5:" + routesResult.txtFileMd5
// trajMd5DPQPTV!!.text =
// "TMd5DPQP:" + routesResult.csvFileMd5DPQP
// stopMd5DPQPTV!!.text =
// "SMd5DPQP:" + routesResult.txtFileMd5DPQP
// busTestBar!!.visibility = View.VISIBLE
// }
// }
// open fun updateBusTestBarInfo() {
// if (busTestBar != null && busTestBar!!.visibility == View.VISIBLE) {
// val routesResult: BusRoutesResult = BusOrderModel.getInstance().busRoutesResult
// lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
// trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
// stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
// trajMd5DPQPTV!!.text =
// "TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
// stopMd5DPQPTV!!.text =
// "SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
// }
// }
/**
* END
*/

View File

@@ -4,6 +4,4 @@ package com.magic.mogo.och.charter.bean
* @author: wangmingjun
* @date: 2023/2/23
*/
data class Station(var siteId: Int, var siteName: String, var seq: Int)
data class ArriveDestRequest(val sn:String, val lineId:Long,val writeVersion:Long)

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Some files were not shown because too many files have changed in this diff Show More