[Bus/Taxi d 2.6.5]Bus code opt
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# 网约车(Online Car Hailing)
|
||||
|
||||
## 小巴
|
||||
|
||||
## 出租车
|
||||
|
||||
## 无实现
|
||||
1. mogo-och-bus:Bus司机端(Bus)
|
||||
2. mogo-och-bus-passenger:Bus乘客端(BusPassenger)
|
||||
3. mogo-och-taxi:Taxi司机端(Taxi)
|
||||
4. mogo-och-taxi-passenger:Taxi乘客端(TaxiPassenger)
|
||||
5. mogo-och-noop:空实现,用于独立鹰眼打包
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<application>
|
||||
<!--这里是为了测试增加的广播-->
|
||||
<receiver android:name=".receiver.TestOchBusBroadcastReceiver">
|
||||
<receiver android:name=".receiver.TestBusBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.bus.test_control" />
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.fragment.BusFragment;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
@@ -25,12 +25,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = OchBusConst.PATH)
|
||||
public class OchBusProvider implements IMogoOCH {
|
||||
@Route(path = BusConst.PATH)
|
||||
public class BusProvider implements IMogoOCH {
|
||||
|
||||
private static final String TAG = "OchBusProvider";
|
||||
private static final String TAG = "BusProvider";
|
||||
|
||||
private OchBusFragment busFragment;
|
||||
private BusFragment busFragment;
|
||||
private int containerId;
|
||||
private FragmentActivity activity;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class OchBusProvider implements IMogoOCH {
|
||||
private void showFragment() {
|
||||
if (busFragment == null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "准备add fragment======");
|
||||
busFragment = new OchBusFragment();
|
||||
busFragment = new BusFragment();
|
||||
activity.getSupportFragmentManager().beginTransaction().add(containerId, busFragment).commitAllowingStateLoss();
|
||||
return;
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.mogo.och.bus.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.view.VerticalDashLineView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Station Panel 中的车站列表adapter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusStationAdapter extends RecyclerView.Adapter<OchBusStationAdapter.ViewHolder> {
|
||||
private final Context context;
|
||||
private final List<OchBusStation> stationList = new ArrayList<>();
|
||||
private int currentStation;
|
||||
|
||||
public OchBusStationAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void refreshStationList(List<OchBusStation> stationList) {
|
||||
this.stationList.clear();
|
||||
this.stationList.addAll(stationList);
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation station = stationList.get(i);
|
||||
if (station.getDrivingStatus() == OchBusConst.STATION_STATUS_ARRIVING || station.getDrivingStatus() == OchBusConst.STATION_STATUS_STOPPED ) {
|
||||
currentStation = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_och_bus_station, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// CallerLogger.INSTANCE.d(M_BUS + "OchBusStationAdapter", "position: " + position + " currPos: " + currentStation + " station: " + stationList.get(position));
|
||||
holder.tvStationName.setText(stationList.get(position).getName());
|
||||
if (position == currentStation) {
|
||||
if (currentStation == 0) {
|
||||
// 在起始点
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.bus_arrived_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.bus_icon_arrived_station);
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.bus_not_arrive_dash_color));
|
||||
} else {
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.bus_current_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.bus_icon_arriving_station);
|
||||
holder.vDashTop.setGradient(context.getResources().getColor(R.color.bus_arriving_start_dash_color), context.getResources().getColor(R.color.bus_arriving_end_dash_color));
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.bus_not_arrive_dash_color));
|
||||
}
|
||||
} else if (position < currentStation) {
|
||||
// 驶过
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.bus_arrived_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.bus_icon_arrived_station);
|
||||
if (position == currentStation - 1) {
|
||||
holder.vDashBottom.setGradient(context.getResources().getColor(R.color.bus_leaving_start_dash_color), context.getResources().getColor(R.color.bus_leaving_end_dash_color));
|
||||
holder.vDashTop.setColor(context.getResources().getColor(R.color.bus_arrived_dash_color));
|
||||
} else {
|
||||
holder.vDashTop.setColor(context.getResources().getColor(R.color.bus_arrived_dash_color));
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.bus_arrived_dash_color));
|
||||
}
|
||||
} else {
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.bus_not_arrive_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.bus_icon_not_arrive_station);
|
||||
holder.vDashTop.setColor(context.getResources().getColor(R.color.bus_not_arrive_dash_color));
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.bus_not_arrive_dash_color));
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
holder.tvStationNotice.setText("起点");
|
||||
holder.tvStationNotice.setVisibility(View.VISIBLE);
|
||||
holder.vDashTop.setVisibility(View.GONE);
|
||||
holder.vDashBottom.setVisibility(View.VISIBLE);
|
||||
} else if (position == getItemCount() - 1) {
|
||||
holder.tvStationNotice.setText("终点");
|
||||
holder.tvStationNotice.setVisibility(View.VISIBLE);
|
||||
holder.vDashTop.setVisibility(View.VISIBLE);
|
||||
holder.vDashBottom.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.tvStationNotice.setVisibility(View.GONE);
|
||||
holder.vDashTop.setVisibility(View.VISIBLE);
|
||||
holder.vDashBottom.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return stationList.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView ivIcon;
|
||||
TextView tvStationName;
|
||||
TextView tvStationNotice;
|
||||
VerticalDashLineView vDashBottom, vDashTop;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ivIcon = itemView.findViewById(R.id.module_mogo_och_bus_station_icon);
|
||||
tvStationName = itemView.findViewById(R.id.module_mogo_och_bus_station_name);
|
||||
tvStationNotice = itemView.findViewById(R.id.module_mogo_och_bus_station_notice);
|
||||
vDashTop = itemView.findViewById(R.id.module_mogo_och_bus_station_top_dash);
|
||||
vDashBottom = itemView.findViewById(R.id.module_mogo_och_bus_station_bottom_dash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,12 @@ public
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class OchBusOperationStatusRequest {
|
||||
class BusOperationStatusRequest {
|
||||
|
||||
private String sn;
|
||||
private double lat;
|
||||
private double lon;
|
||||
public OchBusOperationStatusRequest(double lon, double lat) {
|
||||
public BusOperationStatusRequest(double lon, double lat) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
@@ -8,7 +8,7 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
*
|
||||
* 小巴车运营状态返回参数
|
||||
*/
|
||||
public class OchBusOperationStatusResponse extends BaseData {
|
||||
public class BusOperationStatusResponse extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.mogo.och.bus.bean;
|
||||
* <p>
|
||||
* 小巴订单
|
||||
*/
|
||||
public class OchBusOrder {
|
||||
public class BusOrderBean {
|
||||
|
||||
/**
|
||||
* orderNo number
|
||||
@@ -74,7 +74,7 @@ public class OchBusOrder {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusOrder{" +
|
||||
return "BusOrderBean{" +
|
||||
"orderNo=" + orderNo +
|
||||
", passengerPhone='" + passengerPhone + '\'' +
|
||||
", startStationId=" + startStationId +
|
||||
@@ -8,15 +8,15 @@ import java.util.List;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/19
|
||||
*/
|
||||
public class OchBusOrdersResponse extends BaseData {
|
||||
public class BusOrdersResponse extends BaseData {
|
||||
public Result data;
|
||||
public static class Result{
|
||||
public List<OchBusOrder> orders;
|
||||
public List<BusOrderBean> orders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusOrdersResponse{" +
|
||||
return "BusOrdersResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
@@ -9,7 +9,7 @@ public
|
||||
*
|
||||
* 根据车机行驶线路站点信息
|
||||
*/
|
||||
class OchBusQueryLineStationsRequest {
|
||||
class BusQueryLineStationsRequest {
|
||||
|
||||
private String sn;
|
||||
private double lat;
|
||||
@@ -17,7 +17,7 @@ class OchBusQueryLineStationsRequest {
|
||||
private boolean markDrivingStatus; // 默认false;true:是否需要返回站点的行驶状态,对应返回的drivingStatus
|
||||
// 0 - 关闭、1 - 启动
|
||||
// public String status;
|
||||
public OchBusQueryLineStationsRequest(double lon, double lat,boolean markDrivingStatus) {
|
||||
public BusQueryLineStationsRequest(double lon, double lat, boolean markDrivingStatus) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
@@ -51,12 +51,12 @@ class OchBusQueryLineStationsRequest {
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
// public OchBusOperationStatusRequest shutdown() {
|
||||
// public BusOperationStatusRequest shutdown() {
|
||||
// status = "0";
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public OchBusOperationStatusRequest launch() {
|
||||
// public BusOperationStatusRequest launch() {
|
||||
// status = "1";
|
||||
// return this;
|
||||
// }
|
||||
@@ -7,11 +7,11 @@ import com.mogo.commons.network.Utils;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/18
|
||||
*/
|
||||
public class OchBusResetDrivingLineRequest {
|
||||
public class BusResetDrivingLineRequest {
|
||||
public String sn;
|
||||
public int lineId; //切换到的线路id
|
||||
|
||||
public OchBusResetDrivingLineRequest(int lineId) {
|
||||
public BusResetDrivingLineRequest(int lineId) {
|
||||
sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.lineId = lineId;
|
||||
}
|
||||
@@ -7,20 +7,20 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusRoutesResponse extends BaseData {
|
||||
private OchBusRoutesResult data;
|
||||
public class BusRoutesResponse extends BaseData {
|
||||
private BusRoutesResult data;
|
||||
|
||||
public OchBusRoutesResult getResult() {
|
||||
public BusRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(OchBusRoutesResult data) {
|
||||
public void setResult(BusRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResponse{" +
|
||||
return "BusRoutesResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
@@ -7,8 +7,8 @@ import java.util.List;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusRoutesResult {
|
||||
private List<OchBusStation> sites;
|
||||
public class BusRoutesResult {
|
||||
private List<BusStationBean> sites;
|
||||
private int lineId;
|
||||
private String name;
|
||||
private int lineType; //线路类型,0:环形
|
||||
@@ -23,17 +23,17 @@ public class OchBusRoutesResult {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<OchBusStation> getSites() {
|
||||
public List<BusStationBean> getSites() {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public void setSite(List<OchBusStation> site) {
|
||||
public void setSite(List<BusStationBean> site) {
|
||||
this.sites = sites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResult{" +
|
||||
return "BusRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
@@ -5,7 +5,7 @@ package com.mogo.och.bus.bean;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusStation {
|
||||
public class BusStationBean {
|
||||
// private int lineId;
|
||||
// private int siteId;
|
||||
// private String siteName;
|
||||
@@ -134,7 +134,7 @@ public class OchBusStation {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusStation{" +
|
||||
return "BusStationBean{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
@@ -9,7 +9,7 @@ import com.mogo.commons.network.Utils;
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
public class OchBusUpdateSiteStatusRequest {
|
||||
public class BusUpdateSiteStatusRequest {
|
||||
|
||||
public String sn;
|
||||
public int seq;//站点序号
|
||||
@@ -17,7 +17,7 @@ public class OchBusUpdateSiteStatusRequest {
|
||||
public double lon;
|
||||
public double lat;
|
||||
|
||||
public OchBusUpdateSiteStatusRequest(int seq, int siteId, double lon, double lat) {
|
||||
public BusUpdateSiteStatusRequest(int seq, int siteId, double lon, double lat) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.seq = seq;
|
||||
this.siteId = siteId;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -21,6 +21,6 @@ public class CarHeartbeatReqBean {
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
this.msgId = UUID.randomUUID().toString();
|
||||
this.interval = (int) (OchBusConst.LOOP_PERIOD_60S / 1000);
|
||||
this.interval = (int) (BusConst.LOOP_PERIOD_60S / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class QueryOchBusOperationStatusRequest {
|
||||
|
||||
public String sn;
|
||||
|
||||
|
||||
public QueryOchBusOperationStatusRequest() {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import android.location.Location;
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface IOCHBusControllerStatusCallback {
|
||||
public interface IBusControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
@@ -6,7 +6,7 @@ import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public interface BusLinesCallback {
|
||||
public interface IBusLinesCallback {
|
||||
void onBusLinesChange(BusQueryLinesResponse lines);
|
||||
void onChangeLineIdSuccess();
|
||||
}
|
||||
@@ -4,6 +4,6 @@ package com.mogo.och.bus.callback;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface CarOperationStatusCallback {
|
||||
public interface ICarOperationStatusCallback {
|
||||
void changeOperationStatus(boolean changeStatus);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface IRefreshBusStationsCallback {
|
||||
void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived);
|
||||
}
|
||||
@@ -4,6 +4,6 @@ package com.mogo.och.bus.callback;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface SlidePannelHideCallback {
|
||||
public interface ISlidePannelHideCallback {
|
||||
void hideSlidePanel();
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface RefreshBusStationsCallback {
|
||||
void refreshBusStations(List<OchBusStation> stationList, int currentStation, int nextStation,boolean isArrived);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.mogo.commons.debug.DebugConfig
|
||||
/**
|
||||
* Created on 2021/12/6
|
||||
*/
|
||||
class OchBusConst {
|
||||
class BusConst {
|
||||
companion object {
|
||||
|
||||
private const val BASE_URL_OCH_DEV = "http://tech-dev.zhidaohulian.com"
|
||||
@@ -53,7 +53,7 @@ import record_cache.RecordPanelOuterClass;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener, IMoGoAutopilotIdentifyListener {
|
||||
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener, IMoGoAutopilotIdentifyListener {
|
||||
|
||||
private static final String TAG = "BaseOchFragment";
|
||||
|
||||
@@ -20,9 +20,9 @@ import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.presenter.OchBusPresenter;
|
||||
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.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
|
||||
@@ -36,9 +36,9 @@ import mogo.telematics.pad.MessagePad;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBusPresenter>
|
||||
public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
private static final String TAG = "OchBusFragment";
|
||||
private static final String TAG = "BusFragment";
|
||||
|
||||
private TextView mCurrentStationName;
|
||||
private TextView mStartStationFlag;
|
||||
@@ -50,12 +50,12 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
|
||||
private View mBus;
|
||||
|
||||
private OchBusStation startStation = null;
|
||||
private OchBusStation endStation = null;
|
||||
private BusStationBean startStation = null;
|
||||
private BusStationBean endStation = null;
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return "OchBusFragment";
|
||||
return "BusFragment";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,8 +113,8 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected OchBusPresenter createPresenter() {
|
||||
return new OchBusPresenter(this);
|
||||
protected BusPresenter createPresenter() {
|
||||
return new BusPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +130,7 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
* @param nextStation 下个站点
|
||||
* @param isArrived 是否都站
|
||||
*/
|
||||
public void refreshBusStations(List<OchBusStation> stationList, int currentStation, int nextStation, boolean isArrived) {
|
||||
public void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived) {
|
||||
mCurrentStation = currentStation;
|
||||
if (getActivity() == null) {
|
||||
return;
|
||||
@@ -149,7 +149,7 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
/**
|
||||
* 重新刷新站点信息 isArrived 是否到站
|
||||
*/
|
||||
private void renderCurrentStationStatus(List<OchBusStation> stationList, int currentStation
|
||||
private void renderCurrentStationStatus(List<BusStationBean> stationList, int currentStation
|
||||
, int nextStation, boolean isArrived) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "MapMaker ", "currentStation=" + currentStation + ",nextStation=" + nextStation + "isArrived=" + isArrived);
|
||||
String currentStationName = null;
|
||||
@@ -173,16 +173,16 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
isArriveAtStartStation = true;
|
||||
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
|
||||
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon());
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon());
|
||||
} else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点
|
||||
isArriveAtStation = true;
|
||||
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon());
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon());
|
||||
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
|
||||
isArriveEndStation = true;
|
||||
@@ -191,14 +191,14 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
startStationFlagVisibility = View.VISIBLE;
|
||||
endStationFlagVisibility = View.INVISIBLE;
|
||||
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon());
|
||||
|
||||
if (isArrived) {
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon());
|
||||
} else {
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon());
|
||||
}
|
||||
}
|
||||
@@ -291,11 +291,11 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
|
||||
//移除起点终点
|
||||
if (null != startStation) {
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon());
|
||||
}
|
||||
if (null != endStation) {
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon());
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
|
||||
CallerLogger.INSTANCE.d("setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(OchBusConst.TYPE_MARKER_BUS_ORDER)
|
||||
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.gps(true)
|
||||
@@ -11,18 +11,18 @@ import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.OchBusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.OchBusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusUpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.BusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.presenter.OchBusOrderModel;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.presenter.BusOrderModel;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -31,22 +31,22 @@ import io.reactivex.schedulers.Schedulers;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/20
|
||||
*/
|
||||
public class OCHBusServiceManager {
|
||||
public class BusServiceManager {
|
||||
|
||||
private static final String TAG = OCHBusServiceManager.class.getSimpleName();
|
||||
private static final String TAG = BusServiceManager.class.getSimpleName();
|
||||
|
||||
private final IOchBusApiService mService;
|
||||
private final IBusApiService mService;
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final OCHBusServiceManager INSTANCE = new OCHBusServiceManager();
|
||||
private static final BusServiceManager INSTANCE = new BusServiceManager();
|
||||
}
|
||||
|
||||
public static OCHBusServiceManager getInstance(){
|
||||
public static BusServiceManager getInstance(){
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private OCHBusServiceManager(){
|
||||
mService = MoGoRetrofitFactory.getInstance(OchBusConst.getBaseUrl()).create(IOchBusApiService.class);
|
||||
private BusServiceManager(){
|
||||
mService = MoGoRetrofitFactory.getInstance(BusConst.getBaseUrl()).create(IBusApiService.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,13 +54,13 @@ public class OCHBusServiceManager {
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryBusRoutes(Context context,OCHServiceCallback<OchBusRoutesResponse> callback) {
|
||||
public void queryBusRoutes(Context context, IBusServiceCallback<BusRoutesResponse> callback) {
|
||||
//获取当前高德坐标
|
||||
|
||||
mService.querySiteByCoordinate(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new OchBusQueryLineStationsRequest(OchBusOrderModel.getInstance().mLongitude
|
||||
,OchBusOrderModel.getInstance().mLatitude,true))
|
||||
, new BusQueryLineStationsRequest(BusOrderModel.getInstance().mLongitude
|
||||
, BusOrderModel.getInstance().mLatitude,true))
|
||||
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( getSubscribeImpl(context,callback,"querySiteByCoordinate"));
|
||||
}
|
||||
@@ -71,9 +71,9 @@ public class OCHBusServiceManager {
|
||||
* @param lineId
|
||||
* @param callback
|
||||
*/
|
||||
public void resetStationStatus(Context context, int lineId, OCHServiceCallback<OchBusRoutesResponse> callback){
|
||||
public void resetStationStatus(Context context, int lineId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.resetStationStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new OchBusResetDrivingLineRequest(lineId))
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new BusResetDrivingLineRequest(lineId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"debugResetStationStatus"));
|
||||
}
|
||||
@@ -85,11 +85,11 @@ public class OCHBusServiceManager {
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void leaveStation(Context context,int seq,int siteId,OCHServiceCallback<OchBusRoutesResponse> callback){
|
||||
public void leaveStation(Context context, int seq, int siteId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.leaveStation(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OchBusUpdateSiteStatusRequest(seq,siteId,OchBusOrderModel.getInstance().mLongitude
|
||||
,OchBusOrderModel.getInstance().mLatitude))
|
||||
,new BusUpdateSiteStatusRequest(seq,siteId, BusOrderModel.getInstance().mLongitude
|
||||
, BusOrderModel.getInstance().mLatitude))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
@@ -102,11 +102,11 @@ public class OCHBusServiceManager {
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void arriveSiteStation(Context context,int seq,int siteId,OCHServiceCallback<BaseData> callback){
|
||||
public void arriveSiteStation(Context context, int seq, int siteId, IBusServiceCallback<BaseData> callback){
|
||||
mService.arriveSiteStation(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OchBusUpdateSiteStatusRequest(seq,siteId
|
||||
,OchBusOrderModel.getInstance().mLongitude,OchBusOrderModel.getInstance().mLatitude))
|
||||
,new BusUpdateSiteStatusRequest(seq,siteId
|
||||
, BusOrderModel.getInstance().mLongitude, BusOrderModel.getInstance().mLatitude))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
@@ -119,8 +119,8 @@ public class OCHBusServiceManager {
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void queryStationLeaveAwayPassengers(Context context,int seq,int siteId
|
||||
,OCHServiceCallback<QueryLeaveAwayPassengersResponse> callback){
|
||||
public void queryStationLeaveAwayPassengers(Context context, int seq, int siteId
|
||||
, IBusServiceCallback<QueryLeaveAwayPassengersResponse> callback){
|
||||
mService.queryStationLeaveAwayPassengers( MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new QueryLeaveAwayPassengersRequest(seq,siteId))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
@@ -133,11 +133,11 @@ public class OCHBusServiceManager {
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void stopTakeOrder(Context context,OCHServiceCallback<BaseData> callback){
|
||||
public void stopTakeOrder(Context context, IBusServiceCallback<BaseData> callback){
|
||||
mService.stopTakeOrder(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OchBusOperationStatusRequest(OchBusOrderModel.getInstance().mLongitude
|
||||
,OchBusOrderModel.getInstance().mLatitude))
|
||||
,new BusOperationStatusRequest(BusOrderModel.getInstance().mLongitude
|
||||
, BusOrderModel.getInstance().mLatitude))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"stopTakeOrder"));
|
||||
@@ -148,11 +148,11 @@ public class OCHBusServiceManager {
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void startTakeOrder(Context context,OCHServiceCallback<BaseData> callback){
|
||||
public void startTakeOrder(Context context, IBusServiceCallback<BaseData> callback){
|
||||
mService.startTakeOrder(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OchBusOperationStatusRequest(OchBusOrderModel.getInstance().mLongitude
|
||||
,OchBusOrderModel.getInstance().mLatitude))
|
||||
,new BusOperationStatusRequest(BusOrderModel.getInstance().mLongitude
|
||||
, BusOrderModel.getInstance().mLatitude))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"startTakeOrder"));
|
||||
@@ -163,7 +163,7 @@ public class OCHBusServiceManager {
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOperationStatus(Context context,OCHServiceCallback<OchBusOperationStatusResponse> callback){
|
||||
public void queryOperationStatus(Context context, IBusServiceCallback<BusOperationStatusResponse> callback){
|
||||
mService.queryOperationStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn( Schedulers.io() )
|
||||
@@ -176,7 +176,7 @@ public class OCHBusServiceManager {
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryBusOrders(Context context, OCHServiceCallback<OchBusOrdersResponse> callback){
|
||||
public void queryBusOrders(Context context, IBusServiceCallback<BusOrdersResponse> callback){
|
||||
mService.queryBusOrders(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -184,7 +184,7 @@ public class OCHBusServiceManager {
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryBusOrders"));
|
||||
}
|
||||
|
||||
public void queryBusLines(Context context, OCHServiceCallback<BusQueryLinesResponse> callback){
|
||||
public void queryBusLines(Context context, IBusServiceCallback<BusQueryLinesResponse> callback){
|
||||
mService.queryBusLines(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -200,7 +200,7 @@ public class OCHBusServiceManager {
|
||||
* @param callback
|
||||
*/
|
||||
public void runCarHeartbeat(Context context, double lon, double lat,
|
||||
OCHServiceCallback<BaseData> callback) {
|
||||
IBusServiceCallback<BaseData> callback) {
|
||||
mService.runCarHeartbeat(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), lon, lat))
|
||||
@@ -209,7 +209,7 @@ public class OCHBusServiceManager {
|
||||
.subscribe(getSubscribeImpl(context, callback, "runCarHeartbeat"));
|
||||
}
|
||||
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(Context context, OCHServiceCallback<T> callback, String apiName){
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(Context context, IBusServiceCallback<T> callback, String apiName){
|
||||
return new SubscribeImpl<T>(RequestOptions.create(context)){
|
||||
@Override
|
||||
public void onSuccess(T o) {
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.mogo.och.bus.net;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.OchBusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.bean.OchBusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.OchBusUpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -27,7 +27,7 @@ import retrofit2.http.Query;
|
||||
* <p>
|
||||
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||
*/
|
||||
public interface IOchBusApiService {
|
||||
public interface IBusApiService {
|
||||
/**
|
||||
* 根据车机坐标获取所在区域全部站点信息
|
||||
*
|
||||
@@ -38,7 +38,7 @@ public interface IOchBusApiService {
|
||||
// @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< OchBusRoutesResponse > querySiteByCoordinate(@Header ("appId") String appId,@Header("ticket") String ticket,@Body OchBusQueryLineStationsRequest request);
|
||||
Observable<BusRoutesResponse> querySiteByCoordinate(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||
|
||||
/**
|
||||
* 重置巴士路线: 点击小巴车tab 或者出车后会使用
|
||||
@@ -50,7 +50,7 @@ public interface IOchBusApiService {
|
||||
// @POST( "/autopilot-car-hailing/car/v2/bus/drivingLine/reset" )
|
||||
@POST( "/autopilot-car-hailing/car/v2/driver/bus/drivingLine/reset" )
|
||||
// @POST( "/mock/268/autopilot-car-hailing/bus/api/drivingLine/reset" )
|
||||
Observable< OchBusRoutesResponse > resetStationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body OchBusResetDrivingLineRequest request);
|
||||
Observable<BusRoutesResponse> resetStationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetDrivingLineRequest request);
|
||||
|
||||
/**
|
||||
* 离站,通知服务器
|
||||
@@ -61,7 +61,7 @@ public interface IOchBusApiService {
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/driving/away")
|
||||
@POST("/autopilot-car-hailing/car/v2/driver/bus/driving/away")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/away")
|
||||
Observable< OchBusRoutesResponse > leaveStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body OchBusUpdateSiteStatusRequest request);
|
||||
Observable<BusRoutesResponse> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
/**
|
||||
* 到站 更新到站信息
|
||||
@@ -72,7 +72,7 @@ public interface IOchBusApiService {
|
||||
// @POST("/autopilot-car-hailing/order/v2/bus/driving/attachSite")
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/bus/driving/attachSite")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/attachSite")
|
||||
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body OchBusUpdateSiteStatusRequest request);
|
||||
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ public interface IOchBusApiService {
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/startTakeOrder")
|
||||
@POST("/autopilot-car-hailing/car/v2/driver/bus/startTakeOrder")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/startTakeOrder")
|
||||
Observable<BaseData> startTakeOrder(@Header ("appId") String appId,@Header("ticket") String ticket,@Body OchBusOperationStatusRequest request);
|
||||
Observable<BaseData> startTakeOrder(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusOperationStatusRequest request);
|
||||
|
||||
/**
|
||||
* 收车
|
||||
@@ -106,7 +106,7 @@ public interface IOchBusApiService {
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/stopTakeOrder")
|
||||
@POST("/autopilot-car-hailing/car/v2/driver/bus/stopTakeOrder")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/stopTakeOrder")
|
||||
Observable<BaseData> stopTakeOrder(@Header ("appId") String appId,@Header("ticket") String ticket,@Body OchBusOperationStatusRequest request);
|
||||
Observable<BaseData> stopTakeOrder(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusOperationStatusRequest request);
|
||||
|
||||
/**
|
||||
* 查询小巴出车/收车状态
|
||||
@@ -117,13 +117,13 @@ public interface IOchBusApiService {
|
||||
// @GET("/autopilot-car-hailing/car/v2/bus/takeOrderStatus/query")
|
||||
@GET("/autopilot-car-hailing/car/v2/driver/bus/takeOrderStatus/query")
|
||||
// @GET("/mock/268/autopilot-car-hailing/bus/api/takeOrderStatus/query")
|
||||
Observable<OchBusOperationStatusResponse> queryOperationStatus(@Header ("appId") String appId,@Header("ticket") String ticket,@Query("sn") String sn);
|
||||
Observable<BusOperationStatusResponse> queryOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
@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<OchBusOrdersResponse> queryBusOrders(@Header ("appId") String appId,@Header("ticket") String ticket,@Query("sn") String sn);
|
||||
Observable<BusOrdersResponse> queryBusOrders(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
@@ -4,7 +4,7 @@ package com.mogo.och.bus.net;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/20
|
||||
*/
|
||||
public interface OCHServiceCallback< T >{
|
||||
public interface IBusServiceCallback< T >{
|
||||
void onSuccess(T o);
|
||||
|
||||
void onFail(String failMsg);
|
||||
@@ -5,40 +5,40 @@ import android.content.Context;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.callback.BusLinesCallback;
|
||||
import com.mogo.och.bus.net.OCHBusServiceManager;
|
||||
import com.mogo.och.bus.net.OCHServiceCallback;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.net.BusServiceManager;
|
||||
import com.mogo.och.bus.net.IBusServiceCallback;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public class OchBusLineModel {
|
||||
private static volatile OchBusLineModel sInstance;
|
||||
public class BusLineModel {
|
||||
private static volatile BusLineModel sInstance;
|
||||
private Context mContext;
|
||||
private BusLinesCallback mBusLinesCallback;
|
||||
public static OchBusLineModel getInstance() {
|
||||
private IBusLinesCallback mBusLinesCallback;
|
||||
public static BusLineModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( OchBusLineModel.class ) {
|
||||
synchronized ( BusLineModel.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new OchBusLineModel();
|
||||
sInstance = new BusLineModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
private OchBusLineModel() {
|
||||
private BusLineModel() {
|
||||
|
||||
}
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
public void setBusLinesCallback(BusLinesCallback callback){
|
||||
public void setBusLinesCallback(IBusLinesCallback callback){
|
||||
mBusLinesCallback = callback;
|
||||
}
|
||||
public void queryBusLines(){
|
||||
OCHBusServiceManager.getInstance().queryBusLines(mContext, new OCHServiceCallback<BusQueryLinesResponse>() {
|
||||
BusServiceManager.getInstance().queryBusLines(mContext, new IBusServiceCallback<BusQueryLinesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusQueryLinesResponse data) {
|
||||
if (null == data && mBusLinesCallback != null) {
|
||||
@@ -59,9 +59,9 @@ public class OchBusLineModel {
|
||||
}
|
||||
|
||||
public void commitSwitchLineId(int lineId){
|
||||
OCHBusServiceManager.getInstance().resetStationStatus(mContext,lineId, new OCHServiceCallback<OchBusRoutesResponse>() {
|
||||
BusServiceManager.getInstance().resetStationStatus(mContext,lineId, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onChangeLineIdSuccess();
|
||||
}
|
||||
@@ -5,20 +5,19 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.callback.BusLinesCallback;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public class OchBusLinePresenter extends Presenter<BusSwitchLineView> implements BusLinesCallback {
|
||||
public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IBusLinesCallback {
|
||||
|
||||
public OchBusLinePresenter(BusSwitchLineView view) {
|
||||
public BusLinePresenter(BusSwitchLineView view) {
|
||||
super(view);
|
||||
OchBusLineModel.getInstance().init();
|
||||
OchBusOrderModel.getInstance().init();
|
||||
BusLineModel.getInstance().init();
|
||||
BusOrderModel.getInstance().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -28,7 +27,7 @@ public class OchBusLinePresenter extends Presenter<BusSwitchLineView> implements
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
OchBusLineModel.getInstance().setBusLinesCallback(this);
|
||||
BusLineModel.getInstance().setBusLinesCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,20 +41,20 @@ public class OchBusLinePresenter extends Presenter<BusSwitchLineView> implements
|
||||
}
|
||||
|
||||
public void queryBusLines(){
|
||||
OchBusLineModel.getInstance().queryBusLines();
|
||||
BusLineModel.getInstance().queryBusLines();
|
||||
}
|
||||
|
||||
public void commitSwitchLineId(int lineId){
|
||||
OchBusLineModel.getInstance().commitSwitchLineId(lineId);
|
||||
BusLineModel.getInstance().commitSwitchLineId(lineId);
|
||||
}
|
||||
|
||||
public void queryBusRoutes(){
|
||||
OchBusOrderModel.getInstance().queryBusRoutes();
|
||||
BusOrderModel.getInstance().queryBusRoutes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
OchBusLineModel.getInstance().setBusLinesCallback(null);
|
||||
BusLineModel.getInstance().setBusLinesCallback(null);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.mogo.och.bus.presenter;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -17,15 +17,15 @@ import io.reactivex.schedulers.Schedulers;
|
||||
*
|
||||
* 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等)
|
||||
*/
|
||||
public class OchBusModelLoopManager {
|
||||
public class BusModelLoopManager {
|
||||
|
||||
private static final String TAG = OchBusModelLoopManager.class.getSimpleName();
|
||||
private static final String TAG = BusModelLoopManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final OchBusModelLoopManager INSTANCE = new OchBusModelLoopManager();
|
||||
private static final BusModelLoopManager INSTANCE = new BusModelLoopManager();
|
||||
}
|
||||
|
||||
public static OchBusModelLoopManager getInstance() {
|
||||
public static BusModelLoopManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@@ -36,12 +36,12 @@ public class OchBusModelLoopManager {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_BUS + TAG, "startHeartbeatLoop()");
|
||||
mHeartbeatDisposable = Observable.interval(OchBusConst.LOOP_DELAY,
|
||||
OchBusConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
|
||||
mHeartbeatDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
BusConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> OchBusOrderModel.getInstance().runCarHeartbeat());
|
||||
.subscribe(aLong -> BusOrderModel.getInstance().runCarHeartbeat());
|
||||
}
|
||||
|
||||
public void stopHeartbeatLoop() {
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPPED;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
@@ -24,21 +24,21 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusOrder;
|
||||
import com.mogo.och.bus.bean.OchBusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResult;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.BusOrderBean;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.callback.CarOperationStatusCallback;
|
||||
import com.mogo.och.bus.callback.IOCHBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.RefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.SlidePannelHideCallback;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.net.OCHBusServiceManager;
|
||||
import com.mogo.och.bus.net.OCHServiceCallback;
|
||||
import com.mogo.och.bus.util.OchBusAnalyticsUtil;
|
||||
import com.mogo.och.bus.callback.ICarOperationStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.net.BusServiceManager;
|
||||
import com.mogo.och.bus.net.IBusServiceCallback;
|
||||
import com.mogo.och.bus.util.BusAnalyticsUtil;
|
||||
import com.mogo.och.bus.util.PinYinUtil;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -63,8 +63,8 @@ import mogo.telematics.pad.MessagePad;
|
||||
*
|
||||
* 小巴订单管理
|
||||
*/
|
||||
public class OchBusOrderModel {
|
||||
private final String TAG = OchBusOrderModel.class.getSimpleName();
|
||||
public class BusOrderModel {
|
||||
private final String TAG = BusOrderModel.class.getSimpleName();
|
||||
private int currentLineId = -1;
|
||||
private int currentStationIndex = 0; //因为服务端和前台对于当前站不一致,所以设置两个current index, 一个用于前台展示, 一个用于服务端接口请求
|
||||
private int backgroundCurrentStationIndex = 0;//A->B 此处值是A站点索引
|
||||
@@ -72,14 +72,14 @@ public class OchBusOrderModel {
|
||||
* 运营状态、后端更具运营状态来判断车辆是否派单
|
||||
*/
|
||||
private boolean mIsWorking = false;
|
||||
private static volatile OchBusOrderModel sInstance;
|
||||
private static volatile BusOrderModel sInstance;
|
||||
public double mLongitude = 0;
|
||||
public double mLatitude = 0;
|
||||
private Context mContext;
|
||||
private Disposable mBusOrdersDisposable; //定时轮询小巴车订单
|
||||
private List<String> prevBusOrderNos = new ArrayList<>();
|
||||
private final List< OchBusStation > stationList = new ArrayList<>();
|
||||
private OchBusRoutesResult ochBusRoutesResult = null;
|
||||
private final List<BusStationBean> stationList = new ArrayList<>();
|
||||
private BusRoutesResult busRoutesResult = null;
|
||||
/**
|
||||
* 用来表示是否正在开往下一站
|
||||
*/
|
||||
@@ -89,10 +89,10 @@ public class OchBusOrderModel {
|
||||
private static final int MSG_QUERY_BUS_STATION = 1001;
|
||||
private static final long QUERY_BUS_STATION_DELAY = 5000;
|
||||
|
||||
private CarOperationStatusCallback carOperationStatusCallback;
|
||||
private RefreshBusStationsCallback refreshBusStationsCallback;
|
||||
private SlidePannelHideCallback slidePannelHideCallback;
|
||||
private IOCHBusControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private ICarOperationStatusCallback carOperationStatusCallback;
|
||||
private IRefreshBusStationsCallback refreshBusStationsCallback;
|
||||
private ISlidePannelHideCallback slidePannelHideCallback;
|
||||
private IBusControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
|
||||
private boolean hadQueryLeaveAwayPassager = false;
|
||||
|
||||
@@ -100,25 +100,25 @@ public class OchBusOrderModel {
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if ( msg.what == MSG_QUERY_BUS_STATION ) {
|
||||
OchBusOrderModel.getInstance().queryBusRoutes();
|
||||
BusOrderModel.getInstance().queryBusRoutes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
public static OchBusOrderModel getInstance() {
|
||||
public static BusOrderModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( OchBusOrderModel.class ) {
|
||||
synchronized ( BusOrderModel.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new OchBusOrderModel();
|
||||
sInstance = new BusOrderModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private OchBusOrderModel() {
|
||||
private BusOrderModel() {
|
||||
|
||||
}
|
||||
|
||||
@@ -178,19 +178,19 @@ public class OchBusOrderModel {
|
||||
startLoopBusOrders();
|
||||
}
|
||||
|
||||
public void setCarOperationStatusCallback(CarOperationStatusCallback callback){
|
||||
public void setCarOperationStatusCallback(ICarOperationStatusCallback callback){
|
||||
this.carOperationStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setRefreshBusStationsCallback(RefreshBusStationsCallback callback){
|
||||
public void setRefreshBusStationsCallback(IRefreshBusStationsCallback callback){
|
||||
this.refreshBusStationsCallback = callback;
|
||||
}
|
||||
|
||||
public void setSlidePannelHideCallback(SlidePannelHideCallback callback){
|
||||
public void setSlidePannelHideCallback(ISlidePannelHideCallback callback){
|
||||
this.slidePannelHideCallback = callback;
|
||||
}
|
||||
|
||||
public void setControllerStatusCallback(IOCHBusControllerStatusCallback callback) {
|
||||
public void setControllerStatusCallback(IBusControllerStatusCallback callback) {
|
||||
this.mControllerStatusCallback = callback;
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ public class OchBusOrderModel {
|
||||
if (mBusOrdersDisposable != null && !mBusOrdersDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
mBusOrdersDisposable = Observable.interval(OchBusConst.LOOP_DELAY,
|
||||
OchBusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
mBusOrdersDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
BusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -210,14 +210,14 @@ public class OchBusOrderModel {
|
||||
}
|
||||
|
||||
private void queryBusOrders() {
|
||||
OCHBusServiceManager.getInstance().queryBusOrders(mContext, new OCHServiceCallback<OchBusOrdersResponse>() {
|
||||
BusServiceManager.getInstance().queryBusOrders(mContext, new IBusServiceCallback<BusOrdersResponse>() {
|
||||
@Override
|
||||
public void onSuccess(OchBusOrdersResponse o) {
|
||||
public void onSuccess(BusOrdersResponse o) {
|
||||
if (o.data != null && o.data.orders != null && o.data.orders.size() > 0) {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "获取到bus订单数据: " + o.data.orders.toString() );
|
||||
List<OchBusOrder> busOrders = o.data.orders;
|
||||
List<BusOrderBean> busOrders = o.data.orders;
|
||||
for (int i = 0; i < busOrders.size(); i++) {
|
||||
OchBusOrder order = busOrders.get(i);
|
||||
BusOrderBean order = busOrders.get(i);
|
||||
if (order == null) return;
|
||||
if (TextUtils.isEmpty(order.getPassengerPhone())) return;
|
||||
if (prevBusOrderNos.contains(order.getOrderNo())) continue;
|
||||
@@ -300,9 +300,9 @@ public class OchBusOrderModel {
|
||||
*/
|
||||
public void queryBusRoutes() {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "查询小巴路线");
|
||||
OCHBusServiceManager.getInstance().queryBusRoutes(mContext, new OCHServiceCallback<OchBusRoutesResponse>() {
|
||||
BusServiceManager.getInstance().queryBusRoutes(mContext, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse data) {
|
||||
public void onSuccess(BusRoutesResponse data) {
|
||||
if ( data == null
|
||||
|| data.getResult() == null
|
||||
|| data.getResult().getSites() == null
|
||||
@@ -326,10 +326,10 @@ public class OchBusOrderModel {
|
||||
*/
|
||||
public void debugResetStationStatus() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "测试、重置站点状态");
|
||||
OCHBusServiceManager.getInstance().resetStationStatus(mContext, currentLineId
|
||||
, new OCHServiceCallback<OchBusRoutesResponse>() {
|
||||
BusServiceManager.getInstance().resetStationStatus(mContext, currentLineId
|
||||
, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据: " + o);
|
||||
isGoingToNextStation = false;
|
||||
if (o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty()) {
|
||||
@@ -352,10 +352,10 @@ public class OchBusOrderModel {
|
||||
*/
|
||||
public void leaveStation(boolean isOneWayOver,boolean isRestart){
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"leaveStation-backgroundCurrentStationIndex = "+backgroundCurrentStationIndex);
|
||||
OCHBusServiceManager.getInstance().leaveStation(mContext, stationList.get(backgroundCurrentStationIndex).getSeq()
|
||||
, stationList.get(backgroundCurrentStationIndex).getSiteId(), new OCHServiceCallback<OchBusRoutesResponse>() {
|
||||
BusServiceManager.getInstance().leaveStation(mContext, stationList.get(backgroundCurrentStationIndex).getSeq()
|
||||
, stationList.get(backgroundCurrentStationIndex).getSiteId(), new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
if ( o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ public class OchBusOrderModel {
|
||||
* 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站,
|
||||
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
|
||||
*/
|
||||
private void RenderLeaveStationSuccess(OchBusRoutesResult result,boolean isRestart) {
|
||||
private void RenderLeaveStationSuccess(BusRoutesResult result, boolean isRestart) {
|
||||
renderBusStationsStatus(result);
|
||||
if (slidePannelHideCallback != null) {
|
||||
slidePannelHideCallback.hideSlidePanel();
|
||||
@@ -406,8 +406,8 @@ public class OchBusOrderModel {
|
||||
* @param isRestart
|
||||
*/
|
||||
private void startAutopilot(boolean isRestart) {
|
||||
OchBusStation currentStation = stationList.get( currentStationIndex -1);
|
||||
OchBusStation nextStation = stationList.get( currentStationIndex);
|
||||
BusStationBean currentStation = stationList.get( currentStationIndex -1);
|
||||
BusStationBean nextStation = stationList.get( currentStationIndex);
|
||||
|
||||
// if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
// == CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
|
||||
@@ -438,9 +438,9 @@ public class OchBusOrderModel {
|
||||
*/
|
||||
private void arriveSiteStation(boolean isRestart) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+currentStationIndex);
|
||||
OCHBusServiceManager.getInstance().arriveSiteStation(mContext
|
||||
BusServiceManager.getInstance().arriveSiteStation(mContext
|
||||
, stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId()
|
||||
, new OCHServiceCallback<BaseData>() {
|
||||
, new IBusServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation success");
|
||||
@@ -459,7 +459,7 @@ public class OchBusOrderModel {
|
||||
}
|
||||
|
||||
private void renderArriveBusStation() {
|
||||
List< OchBusStation > site = ochBusRoutesResult.getSites();
|
||||
List<BusStationBean> site = busRoutesResult.getSites();
|
||||
if (site != null && site.size() > 0){
|
||||
backgroundCurrentStationIndex = currentStationIndex;
|
||||
if (refreshBusStationsCallback != null){
|
||||
@@ -475,9 +475,9 @@ public class OchBusOrderModel {
|
||||
private void queryStationLeaveAwayPassengers() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
|
||||
|
||||
OCHBusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
|
||||
BusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
|
||||
, stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId()
|
||||
, new OCHServiceCallback<QueryLeaveAwayPassengersResponse>() {
|
||||
, new IBusServiceCallback<QueryLeaveAwayPassengersResponse>() {
|
||||
@Override
|
||||
public void onSuccess(QueryLeaveAwayPassengersResponse o) {
|
||||
hadQueryLeaveAwayPassager = true;
|
||||
@@ -498,7 +498,7 @@ public class OchBusOrderModel {
|
||||
* 收车
|
||||
*/
|
||||
public void stopTakeOrder(){
|
||||
OCHBusServiceManager.getInstance().stopTakeOrder(mContext, new OCHServiceCallback<BaseData>() {
|
||||
BusServiceManager.getInstance().stopTakeOrder(mContext, new IBusServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
mIsWorking = !mIsWorking;
|
||||
@@ -520,7 +520,7 @@ public class OchBusOrderModel {
|
||||
* 出车
|
||||
*/
|
||||
public void startTakeOrder(){
|
||||
OCHBusServiceManager.getInstance().startTakeOrder(mContext, new OCHServiceCallback<BaseData>() {
|
||||
BusServiceManager.getInstance().startTakeOrder(mContext, new IBusServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
mIsWorking = !mIsWorking;
|
||||
@@ -548,10 +548,10 @@ public class OchBusOrderModel {
|
||||
*/
|
||||
public void queryOperationStatus() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询运营状态");
|
||||
OCHBusServiceManager.getInstance().queryOperationStatus(mContext
|
||||
, new OCHServiceCallback<OchBusOperationStatusResponse>() {
|
||||
BusServiceManager.getInstance().queryOperationStatus(mContext
|
||||
, new IBusServiceCallback<BusOperationStatusResponse>() {
|
||||
@Override
|
||||
public void onSuccess(OchBusOperationStatusResponse o) {
|
||||
public void onSuccess(BusOperationStatusResponse o) {
|
||||
if ( o.data != null ) {
|
||||
mIsWorking = o.data.serviceStatus == 1;
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询运营状态 result.status: " + o.data.serviceStatus);
|
||||
@@ -586,15 +586,15 @@ public class OchBusOrderModel {
|
||||
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理current index,不能直接渲染
|
||||
* @param result
|
||||
*/
|
||||
private void renderBusStationsStatus(OchBusRoutesResult result) {
|
||||
private void renderBusStationsStatus(BusRoutesResult result) {
|
||||
if (result == null) return;
|
||||
ochBusRoutesResult = result;
|
||||
List< OchBusStation > site = result.getSites();
|
||||
busRoutesResult = result;
|
||||
List<BusStationBean> site = result.getSites();
|
||||
currentLineId = result.getLineId();
|
||||
stationList.clear();
|
||||
stationList.addAll( site );
|
||||
for ( int i = 0; i < stationList.size(); i++ ) {
|
||||
OchBusStation s = stationList.get( i );
|
||||
BusStationBean s = stationList.get( i );
|
||||
// 是否正在开往下一站
|
||||
if ( s.isLeaving()) {
|
||||
isGoingToNextStation = true;
|
||||
@@ -606,7 +606,7 @@ public class OchBusOrderModel {
|
||||
}
|
||||
}
|
||||
backgroundCurrentStationIndex = currentStationIndex;
|
||||
OchBusStation currentStation = stationList.get(currentStationIndex);
|
||||
BusStationBean currentStation = stationList.get(currentStationIndex);
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "渲染站点信息服务端currentStationIndex="+currentStationIndex
|
||||
+" isLeaving()="+currentStation.isLeaving());
|
||||
//当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态
|
||||
@@ -802,8 +802,8 @@ public class OchBusOrderModel {
|
||||
|
||||
// 车机端上传心跳数据(只在出车状态时上传)
|
||||
public void runCarHeartbeat() {
|
||||
OCHBusServiceManager.getInstance().runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
new OCHServiceCallback<BaseData>() {
|
||||
BusServiceManager.getInstance().runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
new IBusServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
|
||||
@@ -819,9 +819,9 @@ public class OchBusOrderModel {
|
||||
private void startOrStopOrderLoop(boolean start) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "startOrStopOrderLoop() " + start);
|
||||
if (start) {
|
||||
OchBusModelLoopManager.getInstance().startHeartbeatLoop();
|
||||
BusModelLoopManager.getInstance().startHeartbeatLoop();
|
||||
} else {
|
||||
OchBusModelLoopManager.getInstance().stopHeartbeatLoop();
|
||||
BusModelLoopManager.getInstance().stopHeartbeatLoop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,9 +829,9 @@ public class OchBusOrderModel {
|
||||
if (stationList == null || currentStationIndex >= stationList.size()) {
|
||||
return;
|
||||
}
|
||||
OchBusStation currentStation = stationList.get( currentStationIndex -1);
|
||||
OchBusStation nextStation = stationList.get( currentStationIndex);
|
||||
OchBusAnalyticsUtil.triggerStartServiceEvent(send,
|
||||
BusStationBean currentStation = stationList.get( currentStationIndex -1);
|
||||
BusStationBean nextStation = stationList.get( currentStationIndex);
|
||||
BusAnalyticsUtil.triggerStartServiceEvent(send,
|
||||
currentStation.getName(), nextStation.getName(), currentLineId);
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,12 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.callback.CarOperationStatusCallback;
|
||||
import com.mogo.och.bus.callback.IOCHBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.RefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.SlidePannelHideCallback;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.callback.ICarOperationStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.fragment.BusFragment;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -35,73 +35,73 @@ import mogo_msg.MogoReportMsg;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
implements CarOperationStatusCallback, RefreshBusStationsCallback, SlidePannelHideCallback
|
||||
, IMoGoAutopilotStatusListener, IOCHBusControllerStatusCallback {
|
||||
public class BusPresenter extends Presenter<BusFragment>
|
||||
implements ICarOperationStatusCallback, IRefreshBusStationsCallback, ISlidePannelHideCallback
|
||||
, IMoGoAutopilotStatusListener, IBusControllerStatusCallback {
|
||||
|
||||
private static final String TAG = "OchBusPresenter";
|
||||
private static final String TAG = "BusPresenter";
|
||||
|
||||
private int currentAutopilotStatus = -1;
|
||||
private boolean isAnimateRunning = false;
|
||||
private List<OchBusStation> mStationList = new ArrayList<>();
|
||||
private List<BusStationBean> mStationList = new ArrayList<>();
|
||||
private int mCurrentStation = 0;
|
||||
|
||||
public OchBusPresenter(OchBusFragment view) {
|
||||
public BusPresenter(BusFragment view) {
|
||||
super(view);
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
OchBusOrderModel.getInstance().init();
|
||||
BusOrderModel.getInstance().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
OchBusOrderModel.getInstance().queryOperationStatus();
|
||||
OchBusOrderModel.getInstance().queryBusRoutes();
|
||||
BusOrderModel.getInstance().queryOperationStatus();
|
||||
BusOrderModel.getInstance().queryBusRoutes();
|
||||
initModelListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
OchBusOrderModel.getInstance().release();
|
||||
BusOrderModel.getInstance().release();
|
||||
releaseListener();
|
||||
}
|
||||
|
||||
public void initModelListener() {
|
||||
OchBusOrderModel.getInstance().setCarOperationStatusCallback(this);
|
||||
OchBusOrderModel.getInstance().setRefreshBusStationsCallback(this);
|
||||
OchBusOrderModel.getInstance().setSlidePannelHideCallback(this);
|
||||
OchBusOrderModel.getInstance().setControllerStatusCallback(this);
|
||||
BusOrderModel.getInstance().setCarOperationStatusCallback(this);
|
||||
BusOrderModel.getInstance().setRefreshBusStationsCallback(this);
|
||||
BusOrderModel.getInstance().setSlidePannelHideCallback(this);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(this);
|
||||
}
|
||||
|
||||
public void releaseListener() {
|
||||
OchBusOrderModel.getInstance().setCarOperationStatusCallback(null);
|
||||
OchBusOrderModel.getInstance().setRefreshBusStationsCallback(null);
|
||||
OchBusOrderModel.getInstance().setSlidePannelHideCallback(null);
|
||||
OchBusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
BusOrderModel.getInstance().setCarOperationStatusCallback(null);
|
||||
BusOrderModel.getInstance().setRefreshBusStationsCallback(null);
|
||||
BusOrderModel.getInstance().setSlidePannelHideCallback(null);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
}
|
||||
|
||||
public void queryBusRoutes() {
|
||||
OchBusOrderModel.getInstance().queryBusRoutes();
|
||||
BusOrderModel.getInstance().queryBusRoutes();
|
||||
}
|
||||
|
||||
public void debugResetStationStatus() {
|
||||
OchBusOrderModel.getInstance().debugResetStationStatus();
|
||||
BusOrderModel.getInstance().debugResetStationStatus();
|
||||
}
|
||||
|
||||
public void autoDriveToNextStation(boolean isRestart) {
|
||||
currentAutopilotStatus = -1;
|
||||
OchBusOrderModel.getInstance().autoDriveToNextStation(isRestart);
|
||||
BusOrderModel.getInstance().autoDriveToNextStation(isRestart);
|
||||
}
|
||||
|
||||
public void restartAutopilot() {
|
||||
currentAutopilotStatus = -1;
|
||||
OchBusOrderModel.getInstance().restartAutopilot();
|
||||
BusOrderModel.getInstance().restartAutopilot();
|
||||
}
|
||||
|
||||
public void onChangeOperationStatus() {
|
||||
OchBusOrderModel.getInstance().onChangeOperationStatus();
|
||||
BusOrderModel.getInstance().onChangeOperationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,25 +112,25 @@ public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshBusStations(List<OchBusStation> stationList, int currentStation, int nextStation, boolean isArrived) {
|
||||
public void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived) {
|
||||
mStationList.clear();
|
||||
mStationList.addAll(stationList);
|
||||
mCurrentStation = currentStation;
|
||||
functionDemoModeChange();
|
||||
CallerLogger.INSTANCE.d(M_BUS + "OchBusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList, currentStation, nextStation, isArrived);
|
||||
}
|
||||
}
|
||||
|
||||
private void functionDemoModeChange() {
|
||||
// CallerLogger.INSTANCE.d(M_BUS + "OchBusOrderModel ="," functionDemoModeChange ="+mCurrentStation);
|
||||
// CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel ="," functionDemoModeChange ="+mCurrentStation);
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& OchBusOrderModel.getInstance().isGoingToNextStation()
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
)
|
||||
) {
|
||||
@@ -147,7 +147,7 @@ public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
OchBusOrderModel.getInstance().onArriveAt(arrivalNotification);
|
||||
BusOrderModel.getInstance().onArriveAt(arrivalNotification);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,7 +169,7 @@ public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
|
||||
// 设置UI【自动驾驶】按钮是否展示
|
||||
mView.onAutopilotEnableChange(true);
|
||||
if (OchBusOrderModel.getInstance().isGoingToNextStation()) {
|
||||
if (BusOrderModel.getInstance().isGoingToNextStation()) {
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
@@ -177,11 +177,11 @@ public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& OchBusOrderModel.getInstance().isGoingToNextStation()
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "OchBusOrderModel=", "有美化功能");
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
return;
|
||||
}
|
||||
// 改变UI自动驾驶状态
|
||||
@@ -194,7 +194,7 @@ public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
// 改变UI自动驾驶状态
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning);
|
||||
OchBusOrderModel.getInstance().triggerStartServiceEvent(true);
|
||||
BusOrderModel.getInstance().triggerStartServiceEvent(true);
|
||||
}
|
||||
isAnimateRunning = false;
|
||||
break;
|
||||
@@ -209,11 +209,11 @@ public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& OchBusOrderModel.getInstance().isGoingToNextStation()
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "OchBusOrderModel=", "有美化功能");
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
return;
|
||||
}
|
||||
mView.onAutopilotEnableChange(false);
|
||||
@@ -7,7 +7,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
/**
|
||||
* 测试小巴车的场景
|
||||
@@ -15,8 +15,8 @@ import com.mogo.och.bus.constant.OchBusConst;
|
||||
* @author donghongyu
|
||||
* @date 4/26/21 12:08 PM
|
||||
*/
|
||||
public class TestOchBusBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "TestOchBusBroadcastReceiver";
|
||||
public class TestBusBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "TestBusBroadcastReceiver";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestOchBusBroadcastReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
int sceneType = intent.getIntExtra(OchBusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
int sceneType = intent.getIntExtra(BusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "sceneType:" + sceneType);
|
||||
|
||||
// 分发场景
|
||||
@@ -23,7 +23,7 @@ import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.presenter.OchBusLinePresenter;
|
||||
import com.mogo.och.bus.presenter.BusLinePresenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/2/8
|
||||
*/
|
||||
public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, OchBusLinePresenter>
|
||||
public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLinePresenter>
|
||||
implements View.OnClickListener, BusSwitchLineView {
|
||||
|
||||
private ImageView mClose;
|
||||
@@ -50,8 +50,8 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, OchBus
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected OchBusLinePresenter createPresenter() {
|
||||
return new OchBusLinePresenter(this);
|
||||
protected BusLinePresenter createPresenter() {
|
||||
return new BusLinePresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -18,7 +18,7 @@ import java.util.Map;
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
public class OchBusAnalyticsUtil {
|
||||
public class BusAnalyticsUtil {
|
||||
|
||||
/**
|
||||
* 触发'滑动出发'埋点流程:
|
||||
@@ -34,19 +34,19 @@ public class OchBusAnalyticsUtil {
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put(OchBusConst.EVENT_PARAM_SN, sn);
|
||||
params.put(OchBusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(OchBusConst.EVENT_PARAM_ENV_ONLINE,
|
||||
params.put(BusConst.EVENT_PARAM_SN, sn);
|
||||
params.put(BusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(BusConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(OchBusConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(OchBusConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(OchBusConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(OchBusConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
params.put(BusConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(BusConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(BusConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
|
||||
Runnable runnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
params.put(OchBusConst.EVENT_PARAM_START_RESULT, false);
|
||||
AnalyticsManager.INSTANCE.track(OchBusConst.EVENT_KEY_START_SERVICE, params);
|
||||
params.put(BusConst.EVENT_PARAM_START_RESULT, false);
|
||||
AnalyticsManager.INSTANCE.track(BusConst.EVENT_KEY_START_SERVICE, params);
|
||||
};
|
||||
|
||||
if (send) {
|
||||
@@ -54,10 +54,10 @@ public class OchBusAnalyticsUtil {
|
||||
if (runnable != null && UiThreadHandler.getsUiHandler().hasCallbacks(runnable)) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
}
|
||||
params.put(OchBusConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(OchBusConst.EVENT_KEY_START_SERVICE, params);
|
||||
params.put(BusConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(BusConst.EVENT_KEY_START_SERVICE, params);
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(runnable, OchBusConst.LOOP_PERIOD_15S);
|
||||
UiThreadHandler.postDelayed(runnable, BusConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user