Merge remote-tracking branch 'origin/release_robotaxi-d-app-module_2120_221017_2.12.0.1'
# Conflicts: # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java # core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.passenger.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -14,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -58,9 +60,11 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
}else {
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
||||
}
|
||||
}else{
|
||||
if (position == mStations.size() - 1){
|
||||
@@ -77,22 +81,26 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_grey);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
||||
} else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//刚到站未离开的
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_grey);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING && preStation.isLeaving()){//即将到站
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_green);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
|
||||
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING &&
|
||||
(preStation.getDrivingStatus() == STATION_STATUS_ARRIVING
|
||||
|| preStation.getDrivingStatus() == STATION_STATUS_STOPPED)){ //未到站的并且前面也是未到站或者刚到站的
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_blue);
|
||||
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_blue);
|
||||
viewHolder.stationName.setEllipsize(TextUtils.TruncateAt.END);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +111,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
}
|
||||
}
|
||||
class StationViewHolder extends RecyclerView.ViewHolder{
|
||||
public TextView stationName;
|
||||
public MarqueeTextView stationName;
|
||||
public ImageView stationCircle;
|
||||
public ImageView curArrowBg;
|
||||
public ImageView stationStationTag;
|
||||
|
||||
@@ -39,8 +39,8 @@ import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceCallback;
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -129,8 +129,8 @@ public class BusPassengerModel {
|
||||
}
|
||||
|
||||
private void queryDriverOperationStatus() {
|
||||
BusPassengerServiceManager.getInstance().queryDriverOperationStatus(mContext
|
||||
, new BusPassengerServiceCallback<BusPassengerOperationStatusResponse>() {
|
||||
BusPassengerServiceManager.queryDriverOperationStatus(mContext
|
||||
, new OchCommonServiceCallback<BusPassengerOperationStatusResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusPassengerOperationStatusResponse data) {
|
||||
if (data == null || data.data == null) return;
|
||||
@@ -149,8 +149,8 @@ public class BusPassengerModel {
|
||||
}
|
||||
|
||||
public void queryDriverSiteByCoordinate(){
|
||||
BusPassengerServiceManager.getInstance().queryDriverSiteByCoordinate(mContext
|
||||
, new BusPassengerServiceCallback<BusPassengerRoutesResponse>() {
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(mContext
|
||||
, new OchCommonServiceCallback<BusPassengerRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusPassengerRoutesResponse data) {
|
||||
if ( data == null
|
||||
@@ -172,8 +172,10 @@ public class BusPassengerModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
//code = 1003; message = bus车辆已收车或未出车;
|
||||
//code = 1003; message = bus车辆已收车或未出车;bus driver shadow,not exists
|
||||
if (code == 1003){
|
||||
routesResult = null;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
queryDriverOperationDelay();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.network;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public interface BusPassengerServiceCallback<T> {
|
||||
|
||||
void onSuccess(T data);
|
||||
|
||||
void onFail(int code, String msg);
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
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.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BusPassengerServiceManager {
|
||||
private static final String TAG = BusPassengerServiceManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerServiceManager INSTANCE = new BusPassengerServiceManager();
|
||||
}
|
||||
|
||||
public static BusPassengerServiceManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private BusPassengerServiceApi mBusPassengerServiceApi;
|
||||
|
||||
private BusPassengerServiceManager() {
|
||||
if (mBusPassengerServiceApi == null){
|
||||
mBusPassengerServiceApi = MoGoRetrofitFactory.getInstance(
|
||||
BusPassengerConst.getBaseUrl()).create(BusPassengerServiceApi.class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
private String getDriverAppSn(){
|
||||
return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
// return "X2020211111NG0XNFK";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定行驶的小巴车路线
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryDriverSiteByCoordinate(Context context
|
||||
,BusPassengerServiceCallback<BusPassengerRoutesResponse> callback){
|
||||
mBusPassengerServiceApi.queryDriverSiteByCoordinate(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusPassengerQueryLineRequest(getDriverAppSn()))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryDriverSiteByCoordinate"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机端出车收车状态,以及车牌号
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryDriverOperationStatus(Context context, BusPassengerServiceCallback<BusPassengerOperationStatusResponse> callback){
|
||||
mBusPassengerServiceApi.queryDriverOperationStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,getDriverAppSn())
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryDriverOperationStatus"));
|
||||
}
|
||||
|
||||
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
|
||||
Context context, BusPassengerServiceCallback<T> callback, String apiName) {
|
||||
return new SubscribeImpl<T>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(T o) {
|
||||
super.onSuccess(o);
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG,apiName +
|
||||
": onSuccess() " + o.msg);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG,apiName +
|
||||
": onError() " + e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG,String.format(apiName +
|
||||
": onError() code = %d; message = %s;", code, message));
|
||||
if (callback != null) {
|
||||
callback.onFail(code, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.och.bus.passenger.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst.Companion.getBaseUrl
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
object BusPassengerServiceManager {
|
||||
|
||||
private var mBusPassengerServiceApi = MoGoRetrofitFactory.getInstance(getBaseUrl())
|
||||
.create(BusPassengerServiceApi::class.java)
|
||||
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
private val driverAppSn: String
|
||||
get() = getServerToken()
|
||||
/**
|
||||
* 查询绑定行驶的小巴车路线
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverSiteByCoordinate(
|
||||
context: Context, callback: OchCommonServiceCallback<BusPassengerRoutesResponse>?
|
||||
) {
|
||||
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusPassengerQueryLineRequest(driverAppSn))
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机端出车收车状态,以及车牌号
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverOperationStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<BusPassengerOperationStatusResponse>?) {
|
||||
mBusPassengerServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
driverAppSn)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
|
||||
}
|
||||
}
|
||||
@@ -227,8 +227,8 @@ public class BusPassengerMapDirectionView
|
||||
if (mAMap != null) {
|
||||
|
||||
addRouteColorList();
|
||||
|
||||
if (mLinePointsLatLng.size() > 2) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mLinePointsLatLng.size() = " +mLinePointsLatLng.size());
|
||||
if (mLinePointsLatLng.size() >= 2 && mCoordinatesLatLng.size() > 2) {
|
||||
|
||||
//设置线段纹理
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
@@ -303,6 +303,7 @@ public class BusPassengerMapDirectionView
|
||||
texIndexList.clear();
|
||||
mCoordinatesLatLng.clear();
|
||||
mLinePointsLatLng.clear();
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, " mCoordinatesLatLng.clear " );
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
@@ -26,6 +27,7 @@ import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
|
||||
import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager;
|
||||
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -49,7 +51,7 @@ public class BusPassengerRouteFragment extends
|
||||
private TextView mSpeedTv;
|
||||
private ConstraintLayout mNoLineInfoView;
|
||||
private TextView mCarPlateNum;
|
||||
private TextView mLineName;
|
||||
private MarqueeTextView mLineName;
|
||||
private TextView mOperationTime;
|
||||
private ConstraintLayout mRouteInfoView;
|
||||
private RecyclerView mStationsListRv;
|
||||
@@ -97,19 +99,21 @@ public class BusPassengerRouteFragment extends
|
||||
mMapArrowIcon = findViewById(R.id.bus_p_arrow_nor);
|
||||
|
||||
//测试
|
||||
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
BPRouteDataTestUtils.converToRouteData();
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateWayPointList(mStationsList,1);
|
||||
}
|
||||
},1000);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (DebugConfig.isDebug()){
|
||||
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
BPRouteDataTestUtils.converToRouteData();
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateWayPointList(mStationsList,1);
|
||||
}
|
||||
},1000);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,21 +105,25 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<com.mogo.och.common.module.wigets.MarqueeTextView
|
||||
android:id="@+id/bus_p_line_name_tv"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:text="----"
|
||||
app:customGap="0.5"
|
||||
app:useCustomGap="true"
|
||||
android:textColor="@color/bus_p_line_name_color"
|
||||
android:textSize="@dimen/bus_p_driver_number_plate_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/bus_p_driver_num_plate_tv"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_driver_num_plate_tv"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_p_driver_num_plate_tv"
|
||||
app:layout_goneMarginLeft="0px" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<TextView
|
||||
|
||||
<com.mogo.och.common.module.wigets.MarqueeTextView
|
||||
android:id="@+id/bus_p_station"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -17,6 +18,8 @@
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
android:textColor="@color/bus_p_station_txt_color"
|
||||
android:layout_marginLeft="@dimen/dp_90"
|
||||
app:customGap="0.5"
|
||||
app:useCustomGap="true"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/bus_p_tag"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_arrow_bg"/>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface IBusADASStatusCallback {
|
||||
//自驾返回失败
|
||||
void onStartAdasFailure();
|
||||
}
|
||||
@@ -63,8 +63,12 @@ class BusConst {
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_LINE_ID = "line_id"
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
|
||||
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境:true/false
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_bus_ap_unable_start_reason"
|
||||
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
|
||||
|
||||
/**
|
||||
* 订单起终点Marker类型
|
||||
|
||||
@@ -317,12 +317,6 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
});
|
||||
}
|
||||
|
||||
public void showNotice(String notice) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
|
||||
});
|
||||
}
|
||||
|
||||
public void playDI(){
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(getContext(), R.raw.bus_di);
|
||||
}
|
||||
@@ -391,14 +385,18 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
return;
|
||||
}
|
||||
if (isAnimateRunning){
|
||||
stopAutopilotAnimation();
|
||||
updateAutopilotStatus(autopilotStatus);
|
||||
stopAnimAndUpdateBtnStatus();
|
||||
}else {
|
||||
setAutopilotBtnStatus(autopilotStatus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void stopAnimAndUpdateBtnStatus(){
|
||||
stopAutopilotAnimation();
|
||||
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ 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.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
@@ -35,6 +36,7 @@ import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -53,7 +55,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
public static final String TAG = "BusFragment";
|
||||
|
||||
private TextView mSwitchLine; //切换路线
|
||||
private TextView mLineName;
|
||||
private MarqueeTextView mLineName;
|
||||
private TextView mTaskTime;
|
||||
private Group groupStationsPanel;
|
||||
private ConstraintLayout noDataView;
|
||||
@@ -428,6 +430,9 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
}
|
||||
|
||||
//清除鹰眼右下角小地图轨迹
|
||||
CallerSmpManager.clearPolyline();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,9 @@ import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
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;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.util.BusSendTripInfoManager;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -42,7 +43,7 @@ public class BusLineModel {
|
||||
mBusLinesCallback = callback;
|
||||
}
|
||||
public void queryBusLines(){
|
||||
BusServiceManager.getInstance().queryBusLines(mContext, new IBusServiceCallback<BusQueryLinesResponse>() {
|
||||
BusServiceManager.queryBusLines(mContext, new OchCommonServiceCallback<BusQueryLinesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusQueryLinesResponse data) {
|
||||
if (null == data && mBusLinesCallback != null) {
|
||||
@@ -56,7 +57,7 @@ public class BusLineModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
@@ -72,7 +73,7 @@ public class BusLineModel {
|
||||
* @param position 位置
|
||||
*/
|
||||
public void queryBusLineTasksById(int lineId, int position,boolean autoRefresh){
|
||||
BusServiceManager.getInstance().queryBusTaskByLineId(mContext, String.valueOf(lineId),new IBusServiceCallback<BusQueryLineTaskResponse>() {
|
||||
BusServiceManager.queryBusTaskByLineId(mContext, String.valueOf(lineId),new OchCommonServiceCallback<BusQueryLineTaskResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusQueryLineTaskResponse data) {
|
||||
if (null == data && mBusLinesCallback != null) {
|
||||
@@ -86,7 +87,7 @@ public class BusLineModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
@@ -97,7 +98,7 @@ public class BusLineModel {
|
||||
}
|
||||
|
||||
public void commitSwitchLineId(int taskId,int lineId){
|
||||
BusServiceManager.getInstance().switchLine(mContext,taskId, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
BusServiceManager.switchLine(mContext,taskId, new OchCommonServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
SharedPrefs.getInstance(mContext).putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
@@ -107,7 +108,7 @@ public class BusLineModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
|
||||
@@ -40,18 +40,21 @@ 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.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IPassengerCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.net.BusServiceManager;
|
||||
import com.mogo.och.bus.net.IBusServiceCallback;
|
||||
import com.mogo.och.bus.presenter.BusModelLoopManager;
|
||||
import com.mogo.och.bus.util.BusAnalyticsManager;
|
||||
import com.mogo.och.bus.util.BusSendTripInfoManager;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
@@ -59,6 +62,7 @@ import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
@@ -66,7 +70,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.UndeliverableException;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
@@ -103,6 +106,7 @@ public class BusOrderModel {
|
||||
private ISlidePannelHideCallback slidePanelHideCallback;
|
||||
private IBusControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private IPassengerCallback mPassengerCallback; //乘客核销回调
|
||||
private IBusADASStatusCallback mADASStatusCallback;
|
||||
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();//全路径信息
|
||||
|
||||
@@ -158,6 +162,9 @@ public class BusOrderModel {
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
|
||||
}
|
||||
|
||||
//2022.1.28
|
||||
@@ -198,6 +205,10 @@ public class BusOrderModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void setAdasStatusCallback(IBusADASStatusCallback callback){
|
||||
this.mADASStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setRefreshBusStationsCallback(IRefreshBusStationsCallback callback){
|
||||
this.refreshBusStationsCallback = callback;
|
||||
}
|
||||
@@ -255,15 +266,15 @@ public class BusOrderModel {
|
||||
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex +1);
|
||||
|
||||
BusServiceManager.getInstance().updateOrderRoute(mContext, currentLineId, currentStation.getSiteId()
|
||||
, nextStation.getSiteId(), points, new IBusServiceCallback<BaseData>() {
|
||||
BusServiceManager.updateOrderRoute(mContext, currentLineId, currentStation.getSiteId()
|
||||
, nextStation.getSiteId(), points, new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (isGoingToNextStation){//重试
|
||||
updateOrderRoute();
|
||||
}
|
||||
@@ -295,6 +306,8 @@ public class BusOrderModel {
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
loginService = null;
|
||||
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null);
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
@@ -314,6 +327,17 @@ public class BusOrderModel {
|
||||
}
|
||||
};
|
||||
|
||||
private final OchAdasStartFailureCallback mAdasStartFailureListener = new OchAdasStartFailureCallback() {
|
||||
@Override
|
||||
public void onStartAutopilotFailure(@NonNull String startFailedMessage) {
|
||||
BusAnalyticsManager.getInstance().triggerStartAutopilotFailureEventByAdas(startFailedMessage);
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode){
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "mAdasStartFailureListener = "+startFailedMessage );
|
||||
mADASStatusCallback.onStartAdasFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
@@ -361,7 +385,7 @@ public class BusOrderModel {
|
||||
*/
|
||||
public void queryBusRoutes() {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "查询小巴路线");
|
||||
BusServiceManager.getInstance().queryBusRoutes(mContext, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
BusServiceManager.queryBusRoutes(mContext, new OchCommonServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse data) {
|
||||
if ( data == null
|
||||
@@ -382,7 +406,7 @@ public class BusOrderModel {
|
||||
updateBusStatus( data.getResult());
|
||||
}
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
// 重复请求小巴路线,直至成功
|
||||
//改为任务,为空不再去一直取
|
||||
// queryBusStationDelay();
|
||||
@@ -448,14 +472,13 @@ public class BusOrderModel {
|
||||
*/
|
||||
public void abortTask() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "结束当前路线abortTask");
|
||||
BusServiceManager.getInstance().abortTask(mContext, currentTaskId
|
||||
, new IBusServiceCallback<BaseData>() {
|
||||
BusServiceManager.abortTask(mContext, currentTaskId
|
||||
, new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "abortTask success: " + o);
|
||||
clearNativeTag();
|
||||
if (o.code == 0){ // 重置成功
|
||||
clearNativeTag();
|
||||
endOrAbortTaskSuccess();
|
||||
clearBusStationDatas();
|
||||
queryBusRoutes();
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
@@ -463,16 +486,28 @@ public class BusOrderModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
ToastUtils.showShort(failMsg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void clearNativeTag() {
|
||||
/**
|
||||
* 中断或者正常结束任务后的处理
|
||||
*/
|
||||
private void endOrAbortTaskSuccess() {
|
||||
|
||||
isGoingToNextStation = false;
|
||||
backgroundCurrentStationIndex = 0;
|
||||
|
||||
if (busRoutesResult != null){
|
||||
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.END_TRIP
|
||||
, busRoutesResult.getName()
|
||||
,""
|
||||
,""
|
||||
,false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,7 +515,27 @@ public class BusOrderModel {
|
||||
* 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站,
|
||||
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
|
||||
*/
|
||||
private void leaveStationSuccess(int leaveIndex) {
|
||||
private void leaveStationSuccess(int leaveIndex,String leaveStation,String nextStation) {
|
||||
|
||||
onStartAutopilot(leaveIndex);
|
||||
|
||||
leaveTTSTips(nextStation);
|
||||
|
||||
if (busRoutesResult != null){
|
||||
boolean isLastStop = false;
|
||||
if (leaveIndex + 1 == stationList.size() -1){
|
||||
isLastStop = true;
|
||||
}
|
||||
//给bus外屏发送
|
||||
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.LEAVE_STATION
|
||||
, busRoutesResult.getName()
|
||||
,leaveStation
|
||||
,nextStation
|
||||
,isLastStop);
|
||||
}
|
||||
}
|
||||
|
||||
private void onStartAutopilot(int leaveIndex) {
|
||||
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
|
||||
isGoingToNextStation = true;
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
@@ -500,6 +555,7 @@ public class BusOrderModel {
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
triggerUnableStartAPReasonEvent();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -532,11 +588,11 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "数组越界" );
|
||||
return;
|
||||
}
|
||||
BusServiceManager.getInstance().queryStationWriteOffPassengers(mContext,
|
||||
BusServiceManager.queryStationWriteOffPassengers(mContext,
|
||||
currentTaskId,
|
||||
stationList.get(backgroundCurrentStationIndex).getSiteId(),
|
||||
prePassengerWriteOffTime,
|
||||
new IBusServiceCallback<BusQueryWriteOffPassengersResponse>(){
|
||||
new OchCommonServiceCallback<BusQueryWriteOffPassengersResponse>(){
|
||||
|
||||
@Override
|
||||
public void onSuccess(BusQueryWriteOffPassengersResponse o) {
|
||||
@@ -548,7 +604,7 @@ public class BusOrderModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -586,28 +642,27 @@ public class BusOrderModel {
|
||||
}
|
||||
int arrivedStationIndex = backgroundCurrentStationIndex + 1;
|
||||
String arriveStation = stationList.get(arrivedStationIndex).getName();
|
||||
String departureStopName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex);
|
||||
|
||||
BusServiceManager.getInstance().arriveSiteStation(mContext ,
|
||||
BusServiceManager.arriveSiteStation(mContext ,
|
||||
stationList.get(arrivedStationIndex).getSeq(),
|
||||
stationList.get(arrivedStationIndex).getSiteId(),
|
||||
currentTaskId ,
|
||||
new IBusServiceCallback<BaseData>() {
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-arriveSiteStation success");
|
||||
queryBusRoutes();
|
||||
|
||||
ttsTips(String.format(mContext
|
||||
.getString(R.string.bus_arrived_station_tip),
|
||||
arriveStation));
|
||||
arriveStationSuccess(arrivedStationIndex,departureStopName,arriveStation);
|
||||
|
||||
//5s轮询核销乘客
|
||||
startOrStopQueryPassengerWriteOff(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
isArrivedStation = false;
|
||||
isGoingToNextStation = true;
|
||||
if (ToastUtilsOch.isCustomFastClick(5000)){
|
||||
@@ -621,6 +676,25 @@ public class BusOrderModel {
|
||||
});
|
||||
}
|
||||
|
||||
private void arriveStationSuccess(int arrivedStationIndex,String departureStopName,String arriveStation) {
|
||||
if (busRoutesResult != null){
|
||||
boolean isLastStop = false;
|
||||
if (arrivedStationIndex == busRoutesResult.getSites().size() - 1 ){
|
||||
isLastStop = true;
|
||||
}
|
||||
//给bus外屏发送
|
||||
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.ARRIVE_STATION
|
||||
, busRoutesResult.getName()
|
||||
,departureStopName
|
||||
,arriveStation
|
||||
,isLastStop);
|
||||
}
|
||||
|
||||
VoiceNotice.showNotice(String.format(mContext
|
||||
.getString(R.string.bus_arrived_station_tip),
|
||||
arriveStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
*/
|
||||
@@ -630,12 +704,13 @@ public class BusOrderModel {
|
||||
if (backgroundCurrentStationIndex < stationList.size() - 1){
|
||||
nextStationName = stationList.get(backgroundCurrentStationIndex + 1).getName();
|
||||
}
|
||||
final String currentStationName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
String finalNextStationName = nextStationName;
|
||||
BusServiceManager.getInstance().leaveStation(mContext,
|
||||
BusServiceManager.leaveStation(mContext,
|
||||
stationList.get(backgroundCurrentStationIndex).getSeq(),
|
||||
stationList.get(backgroundCurrentStationIndex).getSiteId(),
|
||||
currentTaskId,
|
||||
new IBusServiceCallback<BaseData>() {
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
isArrivedStation = false;
|
||||
@@ -643,11 +718,10 @@ public class BusOrderModel {
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
queryBusRoutes();
|
||||
leaveStationSuccess(backgroundCurrentStationIndex);
|
||||
leaveTTSTips(finalNextStationName);
|
||||
leaveStationSuccess(backgroundCurrentStationIndex,currentStationName,finalNextStationName);
|
||||
}
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else{
|
||||
@@ -659,20 +733,9 @@ public class BusOrderModel {
|
||||
|
||||
//车站10s后播报
|
||||
private void leaveTTSTips(String nextStation) {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ttsTips(String.format(mContext
|
||||
.getString(R.string.bus_leave_station_tip),
|
||||
nextStation));
|
||||
}
|
||||
},DELAY_10S);
|
||||
}
|
||||
|
||||
private void ttsTips(String notice) {
|
||||
UiThreadHandler.post(() ->{
|
||||
AIAssist.getInstance(mContext).speakTTSVoice(notice);
|
||||
});
|
||||
VoiceNotice.showNotice(String.format(mContext
|
||||
.getString(R.string.bus_leave_station_tip),
|
||||
nextStation),DELAY_10S);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -734,6 +797,10 @@ public class BusOrderModel {
|
||||
if (backgroundCurrentStationIndex == 0 &&
|
||||
stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
|
||||
&& !stationList.get(0).isLeaving()){ //默认是第一站到站查询
|
||||
if (busRoutesResult != null){ // 第一站到站也是行程开始的时候
|
||||
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.START_TRIP
|
||||
,busRoutesResult.getName(),"","",false);
|
||||
}
|
||||
startOrStopQueryPassengerWriteOff(true);
|
||||
}
|
||||
|
||||
@@ -829,22 +896,22 @@ public class BusOrderModel {
|
||||
*/
|
||||
private void endTask() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "任务正常走完endTask()");
|
||||
BusServiceManager.getInstance().endTask(mContext, currentTaskId
|
||||
, new IBusServiceCallback<BaseData>() {
|
||||
BusServiceManager.endTask(mContext, currentTaskId
|
||||
, new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "endTask success: " + o);
|
||||
if (o.code == 0){
|
||||
clearNativeTag();
|
||||
endOrAbortTaskSuccess();
|
||||
clearBusStationDatas();
|
||||
queryBusRoutes();// 重新获取任务
|
||||
startOrStopQueryPassengerWriteOff(false);
|
||||
ttsTips(mContext.getString(R.string.bus_end_task_tip));
|
||||
VoiceNotice.showNotice(mContext.getString(R.string.bus_end_task_tip));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
ToastUtils.showShort(failMsg);
|
||||
}
|
||||
});
|
||||
@@ -895,15 +962,15 @@ public class BusOrderModel {
|
||||
|
||||
// 车机端上传心跳数据(只在出车状态时上传)
|
||||
public void runCarHeartbeat() {
|
||||
BusServiceManager.getInstance().runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
new IBusServiceCallback<BaseData>() {
|
||||
BusServiceManager.runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
public void onFail(int code, String failMsg) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -933,6 +1000,17 @@ public class BusOrderModel {
|
||||
currentStation.getName(), nextStation.getName(), currentLineId);
|
||||
}
|
||||
|
||||
public void triggerUnableStartAPReasonEvent() {
|
||||
if (stationList == null || backgroundCurrentStationIndex >= stationList.size()-1) {
|
||||
return;
|
||||
}
|
||||
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex +1);
|
||||
BusAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
currentStation.getName(), nextStation.getName(), currentLineId,
|
||||
OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason());
|
||||
}
|
||||
|
||||
public BusRoutesResult getBusRoutesResult() {
|
||||
return busRoutesResult;
|
||||
}
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
package com.mogo.och.bus.net;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
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.BusCloseTaskRequest;
|
||||
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.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusWriteOffPassengersQueryRequest;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
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.BusConst;
|
||||
import com.mogo.och.bus.model.BusOrderModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/20
|
||||
*/
|
||||
public class BusServiceManager {
|
||||
|
||||
private static final String TAG = BusServiceManager.class.getSimpleName();
|
||||
|
||||
private final IBusApiService mService;
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusServiceManager INSTANCE = new BusServiceManager();
|
||||
}
|
||||
|
||||
public static BusServiceManager getInstance(){
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private BusServiceManager(){
|
||||
mService = MoGoRetrofitFactory.getInstance(BusConst.getBaseUrl()).create(IBusApiService.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴车当前任务
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryBusRoutes(Context context, IBusServiceCallback<BusRoutesResponse> callback) {
|
||||
//获取当前高德坐标
|
||||
|
||||
mService.queryBusRoutes(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new BusQueryLineStationsRequest())
|
||||
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( getSubscribeImpl(context,callback,"queryBusRoutes"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置线路站点
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
public void switchLine(Context context, int taskId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.switchLine(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new BusResetDrivingLineRequest(taskId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"switchLine"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断当前任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
public void abortTask(Context context, int taskId, IBusServiceCallback<BaseData> callback){
|
||||
mService.abortTask(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusCloseTaskRequest(taskId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"abortTask"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常结束任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
public void endTask(Context context, int taskId, IBusServiceCallback<BaseData> callback){
|
||||
mService.endTask(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusCloseTaskRequest(taskId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"endTask"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void leaveStation(Context context, int seq, int siteId,int taskId, IBusServiceCallback<BaseData> callback){
|
||||
mService.leaveStation(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusUpdateSiteStatusRequest(taskId,siteId,seq))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站更新站点状态
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void arriveSiteStation(Context context, int seq, int siteId,int taskId,
|
||||
IBusServiceCallback<BaseData> callback){
|
||||
mService.arriveSiteStation(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusUpdateSiteStatusRequest(taskId,siteId,seq))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"arriveSiteStation"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询下车乘客
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param 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() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryStationLeaveAwayPassengers"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前到站点核销乘客
|
||||
* @param context
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void queryStationWriteOffPassengers(Context context,int taskId,int siteId,long prePassengerTime
|
||||
, IBusServiceCallback<BusQueryWriteOffPassengersResponse> callback){
|
||||
mService.queryWriteOffPassengers( MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusWriteOffPassengersQueryRequest(taskId,siteId,prePassengerTime))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryStationWriteOffPassengers"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询小巴车订单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryBusOrders(Context context, IBusServiceCallback<BusOrdersResponse> callback){
|
||||
mService.queryBusOrders(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryBusOrders"));
|
||||
}
|
||||
|
||||
public void queryBusLines(Context context, IBusServiceCallback<BusQueryLinesResponse> callback){
|
||||
mService.queryBusLines(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryBusLines"));
|
||||
}
|
||||
|
||||
public void queryBusTaskByLineId(Context context,String lineId,IBusServiceCallback<BusQueryLineTaskResponse> callback){
|
||||
mService.queryBusTaskByLineId(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,lineId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryBusLines"));
|
||||
}
|
||||
|
||||
public void updateOrderRoute(Context context,int lineId, int startSiteId, int endSiteId
|
||||
, List< BusRoutePlanningUpdateReqBean.Result > points
|
||||
, IBusServiceCallback<BaseData> callback){
|
||||
mService.updateOrderRoute(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusRoutePlanningUpdateReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,lineId,startSiteId,endSiteId, points))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"updateOrderRoute"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param callback
|
||||
*/
|
||||
public void runCarHeartbeat(Context context, double lon, double lat,
|
||||
IBusServiceCallback<BaseData> callback) {
|
||||
mService.runCarHeartbeat(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), lon, lat))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "runCarHeartbeat"));
|
||||
}
|
||||
|
||||
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) {
|
||||
super.onSuccess(o);
|
||||
CallerLogger.INSTANCE.e(M_BUS + TAG,apiName + ": onSuccess() " + o.msg);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
CallerLogger.INSTANCE.e(M_BUS + TAG,apiName + ": onError() " +"msg="+ message+" code="+code);
|
||||
if (callback != null) {
|
||||
callback.onFail("msg="+ message+" code="+code);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
CallerLogger.INSTANCE.e(M_BUS + TAG,apiName + ": onError() " +" e="+e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package com.mogo.och.bus.net
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.bus.constant.BusConst.Companion.getBaseUrl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.och.bus.bean.*
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/20
|
||||
*/
|
||||
object BusServiceManager {
|
||||
|
||||
private val mService: IBusApiService = MoGoRetrofitFactory.getInstance(getBaseUrl()).create(
|
||||
IBusApiService::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 查询小巴车当前任务
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusRoutes(context: Context, callback: OchCommonServiceCallback<BusRoutesResponse>?) {
|
||||
//获取当前高德坐标
|
||||
mService.queryBusRoutes(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusQueryLineStationsRequest()
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusRoutes"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置线路站点
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun switchLine(
|
||||
context: Context,
|
||||
taskId: Int,
|
||||
callback: OchCommonServiceCallback<BusRoutesResponse>?
|
||||
) {
|
||||
mService.switchLine(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusResetDrivingLineRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "switchLine"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断当前任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun abortTask(context: Context, taskId: Int, callback: OchCommonServiceCallback<BaseData>?) {
|
||||
mService.abortTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "abortTask"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常结束任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun endTask(context: Context, taskId: Int, callback: OchCommonServiceCallback<BaseData>?) {
|
||||
mService.endTask(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusCloseTaskRequest(taskId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "endTask"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun leaveStation(
|
||||
context: Context,
|
||||
seq: Int,
|
||||
siteId: Int,
|
||||
taskId: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mService.leaveStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "leaveStation"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站更新站点状态
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun arriveSiteStation(
|
||||
context: Context, seq: Int, siteId: Int, taskId: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mService.arriveSiteStation(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusUpdateSiteStatusRequest(taskId, siteId, seq)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arriveSiteStation"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询下车乘客
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryStationLeaveAwayPassengers(
|
||||
context: Context,
|
||||
seq: Int,
|
||||
siteId: Int,
|
||||
callback: OchCommonServiceCallback<QueryLeaveAwayPassengersResponse>?
|
||||
) {
|
||||
mService.queryStationLeaveAwayPassengers(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.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>?
|
||||
) {
|
||||
mService.queryWriteOffPassengers(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusWriteOffPassengersQueryRequest(taskId, siteId, prePassengerTime)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryStationWriteOffPassengers"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴车订单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusOrders(context: Context, callback: OchCommonServiceCallback<BusOrdersResponse>?) {
|
||||
mService.queryBusOrders(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryBusLines(context: Context, callback: OchCommonServiceCallback<BusQueryLinesResponse>?) {
|
||||
mService.queryBusLines(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryBusTaskByLineId(
|
||||
context: Context,
|
||||
lineId: String?,
|
||||
callback: OchCommonServiceCallback<BusQueryLineTaskResponse>?
|
||||
) {
|
||||
mService.queryBusTaskByLineId(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
lineId
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusLines"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun updateOrderRoute(
|
||||
context: Context,
|
||||
lineId: Int,
|
||||
startSiteId: Int,
|
||||
endSiteId: Int,
|
||||
points: List<BusRoutePlanningUpdateReqBean.Result?>?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mService.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
BusRoutePlanningUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lineId, startSiteId, endSiteId, points
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderRoute"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun runCarHeartbeat(
|
||||
context: Context, lon: Double, lat: Double,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mService.runCarHeartbeat(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lon, lat
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "runCarHeartbeat"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.och.bus.net;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/20
|
||||
*/
|
||||
public interface IBusServiceCallback< T >{
|
||||
void onSuccess(T o);
|
||||
|
||||
void onFail(String failMsg);
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -20,6 +21,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
import com.mogo.och.bus.callback.IPassengerCallback;
|
||||
import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
|
||||
@@ -31,6 +33,7 @@ import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.zhidao.socket.utils.LoginStatusUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -49,7 +52,7 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
public class BusPresenter extends Presenter<BusFragment>
|
||||
implements IRefreshBusStationsCallback, ISlidePannelHideCallback
|
||||
, IMoGoAutopilotStatusListener, IBusControllerStatusCallback, ILoginCallback, IPassengerCallback {
|
||||
, IMoGoAutopilotStatusListener, IBusControllerStatusCallback, ILoginCallback, IPassengerCallback, IBusADASStatusCallback {
|
||||
|
||||
private static final String TAG = "BusPresenter";
|
||||
|
||||
@@ -84,6 +87,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
BusOrderModel.getInstance().setSlidePanelHideCallback(this);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(this);
|
||||
BusOrderModel.getInstance().setPassengerCallback(this);
|
||||
BusOrderModel.getInstance().setAdasStatusCallback(this);
|
||||
}
|
||||
|
||||
public void releaseListener() {
|
||||
@@ -91,6 +95,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
BusOrderModel.getInstance().setSlidePanelHideCallback(null);
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
BusOrderModel.getInstance().setPassengerCallback(null);
|
||||
BusOrderModel.getInstance().setAdasStatusCallback(null);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
}
|
||||
|
||||
@@ -302,10 +307,16 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
@Override
|
||||
public void playPassenger(WriteOffPassenger passenger) {
|
||||
int passengerNum = passenger.passengerSize;
|
||||
if (passengerNum > 1){ //多人播报 "x人"
|
||||
mView.showNotice(passengerNum + "人");
|
||||
}else { //是 1 播放 "滴"
|
||||
mView.playDI();
|
||||
if (passengerNum > 1){ //多人播报 "x人" ---》x人核验通过
|
||||
VoiceNotice.showNotice(passengerNum+"人核验通过", AIAssist.LEVEL3);
|
||||
}else { //是 1 播放 "滴" 2022.11.09 改为: "核验通过"
|
||||
// mView.playDI();
|
||||
VoiceNotice.showNotice("核验通过", AIAssist.LEVEL3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAdasFailure() {
|
||||
runOnUIThread(() -> mView.stopAnimAndUpdateBtnStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
@@ -8,12 +9,12 @@ import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
|
||||
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.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* OCH Bus埋点工具
|
||||
@@ -30,18 +31,35 @@ public class BusAnalyticsManager {
|
||||
return BusAnalyticsManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String mStartAutopilotKey;
|
||||
private HashMap<String, Object> mStartAutopilotParams = new HashMap<>();
|
||||
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
triggerStartAutopilotFailureEvent("15s后app等待超时");
|
||||
};
|
||||
|
||||
public void triggerStartAutopilotFailureEventByAdas(String failMsg){
|
||||
removeWaitingCallback();
|
||||
triggerStartAutopilotFailureEvent(failMsg);
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failMsg){
|
||||
CallerLogger.INSTANCE.e( M_BUS + "triggerStartAutopilotFailureEvent", failMsg );
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT
|
||||
, CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG,
|
||||
failMsg);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
};
|
||||
}
|
||||
|
||||
private void removeWaitingCallback() {
|
||||
if (startAutopilotRunnable != null &&
|
||||
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
@@ -69,14 +87,38 @@ public class BusAnalyticsManager {
|
||||
|
||||
if (send) {
|
||||
// 开启成功,上报埋点
|
||||
if (startAutopilotRunnable != null &&
|
||||
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, BusConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发"无法开启自驾已知异常"埋点
|
||||
* @param startName
|
||||
* @param endName
|
||||
* @param lineId
|
||||
*/
|
||||
public void triggerUnableStartAPReasonEvent(String startName, String endName, int lineId,
|
||||
String reason) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
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(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);
|
||||
params.put(BusConst.EVENT_PARAM_UNABLE_START_REASON, reason);
|
||||
AnalyticsManager.INSTANCE.track(BusConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/10/24
|
||||
*/
|
||||
object BusSendTripInfoManager{
|
||||
|
||||
const val START_TRIP = 1
|
||||
const val END_TRIP = 2
|
||||
const val LEAVE_STATION = 3
|
||||
const val ARRIVE_STATION = 4
|
||||
|
||||
/**
|
||||
* 行程信息
|
||||
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
|
||||
* @param lineName 路线名, for type 1, 2
|
||||
* @param departureStopName 出站站点名, for type 3, 4
|
||||
* @param arrivalStopName 下一站到达站点名, for type 3, 4
|
||||
* @param isLastStop 是否终点站(下一站或者要到达站)
|
||||
* @return
|
||||
*/
|
||||
fun sendBusTripInfo(type: Int, lineName: String,
|
||||
departureStopName: String,
|
||||
arrivalStopName: String,
|
||||
isLastStop: Boolean) {
|
||||
d(SceneConstant.M_BUS + "BusSendTripInfoManager", "type: "+ type
|
||||
+", lineName: "+ lineName +", departureStopName: "+ departureStopName
|
||||
+ ", arrivalStopName: "+arrivalStopName+", isLastStop: "+isLastStop)
|
||||
CallerAutoPilotManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop)
|
||||
}
|
||||
}
|
||||
@@ -10,15 +10,16 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
<com.mogo.och.common.module.wigets.MarqueeTextView
|
||||
android:id="@+id/module_och_bus_line_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_68"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_64"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="38px"
|
||||
|
||||
@@ -39,8 +39,12 @@
|
||||
<string name="bus_dialog_cancel">取消</string>
|
||||
|
||||
<string name="bus_no_task_tip">暂无任务</string>
|
||||
|
||||
|
||||
<!-- region tts -->
|
||||
<string name="bus_arrived_station_tip">已到达%1$s,带好随身物品,下车请注意。</string>
|
||||
<string name="bus_leave_station_tip">车辆起步,请扶稳坐好,前方到站是%1$s,请下车的乘客做好准备。</string>
|
||||
<string name="bus_end_task_tip">感谢您体验\'蘑菇车联\'无人驾驶小巴车,请您携带好随身物品,我们下次再见。</string>
|
||||
<string name="bus_arrived_station_tip">已到达%1$s,带好随身物品,下车请注意安全。</string>
|
||||
<string name="bus_end_task_tip">感谢您体验\'蘑菇车联\'自动驾驶小巴车,我们下次再见。</string>
|
||||
<!-- endregion -->
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -10,58 +10,9 @@ class SimpleInterceptor: Interceptor {
|
||||
val encodedPath = original.url().encodedPath()
|
||||
Log.e("SimpleInterceptor",original.method()+ encodedPath+original.url().encodedQuery())
|
||||
when (encodedPath) {
|
||||
"/autopilot-car-hailing/operation/v1/driver/bus/loginStatus" -> {
|
||||
val builder = Response.Builder()
|
||||
val create:ResponseBody
|
||||
if(first) {
|
||||
create = ResponseBody.create(
|
||||
MediaType.parse("application/json"),
|
||||
"{\"code\":0,\"msg\":\"\",\"data\":{\"servingStatus\":0,\"driverStatus\":1,\"orderNo\":\"12111\",\"purpose\":1,\"sn\":\"fjsdlfjslf\",\"plateNumber\":\"车牌号\",\"phone\":\"18811539480\",\"lineId\":\"线路id\",\"taskId\":\"任务id\"}}"
|
||||
)
|
||||
first = false
|
||||
}else{
|
||||
create = ResponseBody.create(
|
||||
MediaType.parse("application/json"),
|
||||
"{\"code\":0,\"msg\":\"\",\"data\":{\"servingStatus\":0,\"driverStatus\":0,\"orderNo\":\"12111\",\"purpose\":1,\"sn\":\"fjsdlfjslf\",\"plateNumber\":\"车牌号\",\"phone\":\"18811539480\",\"lineId\":\"线路id\",\"taskId\":\"任务id\"}}"
|
||||
)
|
||||
first = true
|
||||
}
|
||||
builder.code(200)
|
||||
builder.request(original)
|
||||
builder.protocol(Protocol.HTTP_1_1)
|
||||
builder.message("")
|
||||
return builder.body(create).build()
|
||||
}
|
||||
"/autopilot-car-hailing/line/v2/driver/bus/task/query" -> {
|
||||
val builder = Response.Builder()
|
||||
val create = ResponseBody.create(MediaType.parse("application/json"), "{\"code\":0,\"msg\":\"\",\"data\":[{\"id\":1,\"taskStartTime\":1663722000000},{\"id\":2,\"taskStartTime\":1663725600000},{\"id\":3,\"taskStartTime\":1663729200000},{\"id\":4,\"taskStartTime\":1663732800000},{\"id\":5,\"taskStartTime\":1663736400000},{\"id\":6,\"taskStartTime\":1663740000000},{\"id\":7,\"taskStartTime\":1663743600000},{\"id\":8,\"taskStartTime\":1663747200000},{\"id\":9,\"taskStartTime\":1663750800000},{\"id\":10,\"taskStartTime\":1663754400000}]}")
|
||||
builder.code(200)
|
||||
builder.request(original)
|
||||
builder.protocol(Protocol.HTTP_1_1)
|
||||
builder.message("")
|
||||
return builder.body(create).build()
|
||||
}
|
||||
"/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startTask" -> {
|
||||
val builder = Response.Builder()
|
||||
val create = ResponseBody.create(MediaType.parse("application/json"), "{\"code\":0,\"msg\":\"\",\"data\":null}")
|
||||
builder.code(200)
|
||||
builder.request(original)
|
||||
builder.protocol(Protocol.HTTP_1_1)
|
||||
builder.message("")
|
||||
return builder.body(create).build()
|
||||
}
|
||||
"/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endOperation" -> {
|
||||
val builder = Response.Builder()
|
||||
val create = ResponseBody.create(MediaType.parse("application/json"), "{\"code\":0,\"msg\":\"\",\"data\":null}")
|
||||
builder.code(200)
|
||||
builder.request(original)
|
||||
builder.protocol(Protocol.HTTP_1_1)
|
||||
builder.message("")
|
||||
return builder.body(create).build()
|
||||
}
|
||||
"/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startOperation" -> {
|
||||
val builder = Response.Builder()
|
||||
val create = ResponseBody.create(MediaType.parse("application/json"), "{\"code\":0,\"msg\":\"\",\"data\":null}")
|
||||
val create = ResponseBody.create(MediaType.parse("application/json"), "{\"code\":100006,\"msg\":\"\",\"data\":null}")
|
||||
builder.code(200)
|
||||
builder.request(original)
|
||||
builder.protocol(Protocol.HTTP_1_1)
|
||||
|
||||
@@ -71,66 +71,70 @@ object OchCommonLoginModel{
|
||||
* 获取手机验证码
|
||||
*/
|
||||
fun getPhoneCode(phone: String?) {
|
||||
OchCommonServiceManager.getInstance().getPhoneCode(mContext, phone,
|
||||
object : OchCommonServiceCallback<BaseData?> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
ToastUtils.showShort(mContext?.getString(R.string.module_och_taxi_login_get_code_success))
|
||||
iTaxiLoginCallback?.getPhoneCodeSuccess()
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastUtils.showShort(data.code)
|
||||
mContext?.let {
|
||||
OchCommonServiceManager.getPhoneCode(it, phone,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
ToastUtils.showShort(mContext?.getString(R.string.module_och_taxi_login_get_code_success))
|
||||
iTaxiLoginCallback?.getPhoneCodeSuccess()
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastUtils.showShort(data.code)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.request_error_tip))
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg)
|
||||
}
|
||||
})
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun gotoLogin(phone: String, code: String) {
|
||||
val location4Login = TaxiLoginReqBean.Location4Login(mLatitude, mLongitude)
|
||||
OchCommonServiceManager.getInstance().gotoLoginBycode(mContext, phone, code, location4Login,
|
||||
object : OchCommonServiceCallback<TaxiLoginRespBean?> {
|
||||
override fun onSuccess(data: TaxiLoginRespBean?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
ToastUtils.showShort(mContext?.getString(R.string.module_och_taxi_login_login_success))
|
||||
LoginStatusManager.setLoginStatus(TaxiLoginStatusEnum.Login)
|
||||
mContext?.let {
|
||||
SharedPrefs.getInstance(it).putString("och_account",phone)
|
||||
}
|
||||
iTaxiLoginCallback?.loginSuccess()
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastUtils.showShort(data.code)
|
||||
mContext?.let {
|
||||
val location4Login = TaxiLoginReqBean.Location4Login(mLatitude, mLongitude)
|
||||
OchCommonServiceManager.gotoLoginBycode(it, phone, code, location4Login,
|
||||
object : OchCommonServiceCallback<TaxiLoginRespBean> {
|
||||
override fun onSuccess(data: TaxiLoginRespBean?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
ToastUtils.showShort(mContext?.getString(R.string.module_och_taxi_login_login_success))
|
||||
LoginStatusManager.setLoginStatus(TaxiLoginStatusEnum.Login)
|
||||
mContext?.let {
|
||||
SharedPrefs.getInstance(it).putString("och_account",phone)
|
||||
}
|
||||
iTaxiLoginCallback?.loginSuccess()
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastUtils.showShort(data.code)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.request_error_tip))
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext?.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg)
|
||||
}
|
||||
})
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public abstract class OchCommonLoginStatusModel {
|
||||
* 8、登录页面关闭后查下状态
|
||||
*/
|
||||
public void queryCarStatus() {
|
||||
OchCommonServiceManager.getInstance().queryDriverServiceStatus(mContext,
|
||||
OchCommonServiceManager.queryDriverServiceStatus(mContext,
|
||||
new OchCommonServiceCallback<DriverStatusQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(DriverStatusQueryRespBean data) {
|
||||
@@ -93,7 +93,7 @@ public abstract class OchCommonLoginStatusModel {
|
||||
// 登出
|
||||
public void logout(double mLatitude,double mLongitude) {
|
||||
TaxiLogoutReqBean.Location4Login location4Login = new TaxiLogoutReqBean.Location4Login(mLatitude, mLongitude);
|
||||
OchCommonServiceManager.getInstance().logout(mContext,location4Login,
|
||||
OchCommonServiceManager.logout(mContext,location4Login,
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.mogo.och.common.module.biz.network;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
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.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginReqBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginRespBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginSmsReqBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLogoutReqBean;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
public class OchCommonServiceManager {
|
||||
private static final String TAG = OchCommonServiceManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final OchCommonServiceManager INSTANCE = new OchCommonServiceManager();
|
||||
}
|
||||
|
||||
public static OchCommonServiceManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private OchCommonServiceApiNew mOCHTaxiServiceApi;
|
||||
|
||||
private OchCommonServiceManager() {
|
||||
if (mOCHTaxiServiceApi == null){
|
||||
mOCHTaxiServiceApi = MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(OchCommonServiceApiNew.class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手机验证码
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void getPhoneCode(Context context, String phone,
|
||||
OchCommonServiceCallback<BaseData> callback) {
|
||||
mOCHTaxiServiceApi.getPhoneCode(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new TaxiLoginSmsReqBean(phone))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "getPhoneCode"));
|
||||
}
|
||||
/**
|
||||
* 通过验证码登录
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void gotoLoginBycode(Context context, String phone, String code,
|
||||
TaxiLoginReqBean.Location4Login location4Login,
|
||||
OchCommonServiceCallback<TaxiLoginRespBean> callback) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
Observable<TaxiLoginRespBean> taxiLoginRespBeanObservable = null;
|
||||
switch (DebugConfig.getProductFlavor()) {
|
||||
case "fPadLenovoOchTaxi": {//出租车司机
|
||||
taxiLoginRespBeanObservable = mOCHTaxiServiceApi.gotoLoginBycode4Taxi(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new TaxiLoginReqBean(phone, code, sn, location4Login));
|
||||
break;
|
||||
}
|
||||
case "fPadLenovoOchBus": {//小巴车司机
|
||||
taxiLoginRespBeanObservable = mOCHTaxiServiceApi.gotoLoginBycode4Bus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new TaxiLoginReqBean(phone, code, sn, location4Login));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (taxiLoginRespBeanObservable != null) {
|
||||
taxiLoginRespBeanObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "gotoLoginBycode"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*/
|
||||
public void logout(Context context, TaxiLogoutReqBean.Location4Login location4Login, OchCommonServiceCallback<BaseData> callback) {
|
||||
Observable<BaseData> logout = null;
|
||||
switch (DebugConfig.getProductFlavor()) {
|
||||
case "fPadLenovoOchTaxi": {//出租车司机
|
||||
logout = mOCHTaxiServiceApi.logout4Taxi(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId(),
|
||||
MoGoAiCloudClientConfig.getInstance().getToken(),
|
||||
new TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().getSn(), location4Login));
|
||||
break;
|
||||
}
|
||||
case "fPadLenovoOchBus": {//小巴车司机
|
||||
logout = mOCHTaxiServiceApi.logout4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId(),
|
||||
MoGoAiCloudClientConfig.getInstance().getToken(),
|
||||
new TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().getSn(), location4Login));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (logout != null) {
|
||||
logout.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "logout"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单状态和登录状态查询
|
||||
*
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryDriverServiceStatus(Context context,
|
||||
OchCommonServiceCallback<DriverStatusQueryRespBean> callback) {
|
||||
if (MoGoAiCloudClientConfig.getInstance().getToken().isEmpty()) {
|
||||
callback.onFail(OchCommonConst.WAIT_TAKEN, "等待令牌中请稍等");
|
||||
MoGoAiCloudClient.getInstance().refreshToken();
|
||||
return;
|
||||
}
|
||||
String flavor = "";
|
||||
switch (DebugConfig.getProductFlavor()) {
|
||||
case "fPadLenovoOchTaxi": {//出租车司机
|
||||
flavor = "taxi";
|
||||
break;
|
||||
}
|
||||
case "fPadLenovoOchBus": {//小巴车司机
|
||||
flavor = "bus";
|
||||
break;
|
||||
}
|
||||
case "fPadLenovoOchBusPassenger": {//小巴车乘客
|
||||
flavor = "bus/passenger";
|
||||
break;
|
||||
}
|
||||
}
|
||||
mOCHTaxiServiceApi.queryDriverServiceStatusAndLoginStatus(flavor, MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryDriverServiceStatus"));
|
||||
}
|
||||
|
||||
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
|
||||
Context context, OchCommonServiceCallback<T> callback, String apiName) {
|
||||
return new SubscribeImpl<T>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(T o) {
|
||||
super.onSuccess(o);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, apiName + ": onSuccess() " + o.msg);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, apiName + ": onError() " + e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, String.format(apiName + ": onError() code = %d; message = %s;", code, message));
|
||||
if (callback != null) {
|
||||
callback.onFail(code, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.mogo.och.common.module.biz.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst.Companion.getBaseUrl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginSmsReqBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginReqBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginRespBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLogoutReqBean
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
import io.reactivex.Observable
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
object OchCommonServiceManager {
|
||||
|
||||
private const val TAG = "OchCommonServiceManager"
|
||||
|
||||
private val mOCHTaxiServiceApi: OchCommonServiceApiNew =
|
||||
MoGoRetrofitFactory.getInstance(getBaseUrl()).create(
|
||||
OchCommonServiceApiNew::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取手机验证码
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getPhoneCode(
|
||||
context: Context, phone: String?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.getPhoneCode(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLoginSmsReqBean(phone)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getPhoneCode"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过验证码登录
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun gotoLoginBycode(
|
||||
context: Context, phone: String?, code: String?,
|
||||
location4Login: TaxiLoginReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<TaxiLoginRespBean>?
|
||||
) {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
var taxiLoginRespBeanObservable: Observable<TaxiLoginRespBean>? = null
|
||||
when (DebugConfig.getProductFlavor()) {
|
||||
"fPadLenovoOchTaxi" -> {
|
||||
//出租车司机
|
||||
taxiLoginRespBeanObservable = mOCHTaxiServiceApi.gotoLoginBycode4Taxi(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLoginReqBean(phone, code, sn, location4Login)
|
||||
).transformTry()
|
||||
}
|
||||
"fPadLenovoOchBus" -> {
|
||||
//小巴车司机
|
||||
taxiLoginRespBeanObservable = mOCHTaxiServiceApi.gotoLoginBycode4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLoginReqBean(phone, code, sn, location4Login)
|
||||
).transformTry()
|
||||
}
|
||||
}
|
||||
taxiLoginRespBeanObservable?.subscribe(OchCommonSubscribeImpl(context, callback, "gotoLoginBycode"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun logout(
|
||||
context: Context,
|
||||
location4Login: TaxiLogoutReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
var logout: Observable<BaseData>? = null
|
||||
when (DebugConfig.getProductFlavor()) {
|
||||
"fPadLenovoOchTaxi" -> {
|
||||
//出租车司机
|
||||
logout = mOCHTaxiServiceApi.logout4Taxi(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().sn, location4Login)
|
||||
).transformTry()
|
||||
}
|
||||
"fPadLenovoOchBus" -> {
|
||||
//小巴车司机
|
||||
logout = mOCHTaxiServiceApi.logout4Bus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().sn, location4Login)
|
||||
).transformTry()
|
||||
}
|
||||
}
|
||||
logout?.subscribe(OchCommonSubscribeImpl(context, callback, "logout"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单状态和登录状态查询
|
||||
*
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverServiceStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<DriverStatusQueryRespBean>?
|
||||
) {
|
||||
if (MoGoAiCloudClientConfig.getInstance().token.isEmpty()) {
|
||||
callback?.onFail(OchCommonConst.WAIT_TAKEN, "等待令牌中请稍等")
|
||||
MoGoAiCloudClient.getInstance().refreshToken()
|
||||
return
|
||||
}
|
||||
var flavor = ""
|
||||
when (DebugConfig.getProductFlavor()) {
|
||||
"fPadLenovoOchTaxi" -> {
|
||||
//出租车司机
|
||||
flavor = "taxi"
|
||||
}
|
||||
"fPadLenovoOchBus" -> {
|
||||
//小巴车司机
|
||||
flavor = "bus"
|
||||
}
|
||||
"fPadLenovoOchBusPassenger" -> {
|
||||
//小巴车乘客
|
||||
flavor = "bus/passenger"
|
||||
}
|
||||
}
|
||||
mOCHTaxiServiceApi.queryDriverServiceStatusAndLoginStatus(
|
||||
flavor,
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverServiceStatus"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.och.common.module.biz.network
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
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.common.module.utils.CallerLoggerUtils.flavorTag
|
||||
|
||||
class OchCommonSubscribeImpl<T : BaseData>(
|
||||
val context: Any,
|
||||
val callback: OchCommonServiceCallback<T>?,
|
||||
val apiName: String
|
||||
) : SubscribeImpl<T>(RequestOptions.create(context)) {
|
||||
|
||||
companion object {
|
||||
const val TAG = "OchCommonSubscribeImpl"
|
||||
}
|
||||
|
||||
override fun onSuccess(o: T) {
|
||||
super.onSuccess(o)
|
||||
CallerLogger.d("$flavorTag$TAG", "$apiName: onSuccess() ${o.msg}")
|
||||
callback?.onSuccess(o)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
super.onError(e)
|
||||
CallerLogger.e("$flavorTag$TAG", "$apiName: onError() ${e.message}")
|
||||
callback?.onError()
|
||||
}
|
||||
|
||||
override fun onError(message: String, code: Int) {
|
||||
super.onError(message, code)
|
||||
CallerLogger.e("$flavorTag$TAG", "$apiName: onError() code = $code; message = $message")
|
||||
callback?.onFail(code, message)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.och.common.module.biz.network.interceptor
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableSource
|
||||
import io.reactivex.functions.Function
|
||||
|
||||
class FRetryWithTime<T : BaseData> : Function<T, ObservableSource<T>> {
|
||||
|
||||
override fun apply(baseData: T): ObservableSource<T> {
|
||||
baseData.let {
|
||||
if (it.code == 100046 || it.code == 100045 || it.code == 100005 || it.code == 100006 || it.code == 520003) {
|
||||
MoGoAiCloudClient.getInstance().refreshToken()
|
||||
return Observable.error(OchCommonRetryException())
|
||||
}
|
||||
}
|
||||
return Observable.just(baseData)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.och.common.module.biz.network.interceptor
|
||||
|
||||
import io.reactivex.Observable
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
fun <T : BaseData> Observable<T>.transformTry():Observable<T> {
|
||||
return flatMap(FRetryWithTime<T>())
|
||||
.retryWhen(RetryWithTime())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.och.common.module.biz.network.interceptor;
|
||||
|
||||
public class OchCommonRetryException extends RuntimeException{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.och.common.module.biz.network.interceptor
|
||||
|
||||
import com.mogo.eagle.core.utilcode.constant.TimeConstants
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.och.common.module.utils.CallerLoggerUtils.flavorTag
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableSource
|
||||
import io.reactivex.functions.Function
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
class RetryWithTime : Function<Observable<Throwable?>, ObservableSource<Any?>> {
|
||||
companion object {
|
||||
private const val TAG = "RetryWithTime"
|
||||
}
|
||||
var current = -1
|
||||
private var timeDelys = intArrayOf(3, 1, 2)
|
||||
override fun apply(throwableObservable: Observable<Throwable?>): ObservableSource<Any?>? {
|
||||
return throwableObservable.flatMap {
|
||||
++current
|
||||
CallerLogger.e("${flavorTag}${TAG}", " 时间:${TimeUtils.getStringByNow(0, TimeConstants.SEC)}")
|
||||
if (it is OchCommonRetryException && current < timeDelys.size) {
|
||||
Observable.timer(timeDelys[current].toLong(), TimeUnit.SECONDS)
|
||||
} else {
|
||||
Observable.error(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.och.common.module.biz.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
@@ -20,10 +21,10 @@ import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.MvpDialogFragment
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
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.BarUtils
|
||||
import com.mogo.eagle.core.utilcode.util.KeyboardUtils
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
@@ -35,7 +36,8 @@ import com.mogo.och.common.module.biz.provider.LoginService
|
||||
* @author: yangyakun
|
||||
* @date: 2022/8/15
|
||||
*/
|
||||
class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchCommonLoginPresenter?>(),
|
||||
class TaxiLoginDialogFragment :
|
||||
MvpDialogFragment<TaxiLoginDialogFragment?, OchCommonLoginPresenter?>(),
|
||||
DialogInterface.OnKeyListener {
|
||||
|
||||
lateinit var clMain: ConstraintLayout
|
||||
@@ -54,14 +56,6 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
setStyle(STYLE_NO_TITLE, R.style.DialogFullScreen) //dialog全屏
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
dialog?.let {
|
||||
it.window?.let {window->
|
||||
BarUtils.setNavBarVisibility(window,false)
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
@@ -88,11 +82,8 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
initBg()
|
||||
initListener()
|
||||
dialog?.window?.let {
|
||||
context?.let { contextIn->
|
||||
BarUtils.setStatusBarColor(
|
||||
it,
|
||||
ContextCompat.getColor(contextIn, R.color.taxi_4D000000)
|
||||
)
|
||||
context?.let { _ ->
|
||||
CallerHmiManager.setStatusBarDarkOrLight(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,23 +99,22 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initListener() {
|
||||
mRootView.isFocusable = true
|
||||
mRootView.isFocusableInTouchMode = true
|
||||
mRootView.setOnTouchListener(object : View.OnTouchListener {
|
||||
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
closeSoftInput()
|
||||
}
|
||||
mRootView.setOnTouchListener { _, event ->
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
closeSoftInput()
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
false
|
||||
}
|
||||
acbtnLogin.onClick {
|
||||
val phone = aceLoginPhoneValue.text.toString()
|
||||
val code = acetPhoneCodeValue.text.toString()
|
||||
mPresenter?.gotoLogin(phone,code)
|
||||
mPresenter?.gotoLogin(phone, code)
|
||||
}
|
||||
actvWelcomeLoginTitle.setOnClickListener {
|
||||
continuousClick()
|
||||
@@ -148,7 +138,7 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
actvLoginGetCode.onClick {
|
||||
mPresenter?.getPhoneCode(aceLoginPhoneValue.text.toString())
|
||||
}
|
||||
actvLoginShowSn.setOnLongClickListener{
|
||||
actvLoginShowSn.setOnLongClickListener {
|
||||
val loginService = ARouter.getInstance().build(OchCommonConst.LOGINSERVICE)
|
||||
.navigation() as LoginService
|
||||
loginService.showUiModel(false)
|
||||
@@ -156,8 +146,8 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
true
|
||||
}
|
||||
aceLoginPhoneValue.addTextChangedListener {
|
||||
it?.let { itEditable->
|
||||
if(itEditable.isNotEmpty()){
|
||||
it?.let { itEditable ->
|
||||
if (itEditable.isNotEmpty()) {
|
||||
inputPhoneNormal()
|
||||
}
|
||||
}
|
||||
@@ -175,28 +165,29 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
}
|
||||
}
|
||||
|
||||
fun setCountDownText(text:String,enable: Boolean){
|
||||
if(enable){
|
||||
fun setCountDownText(text: String, enable: Boolean) {
|
||||
if (enable) {
|
||||
actvLoginGetCode.setText(R.string.module_och_taxi_login_get_code)
|
||||
actvLoginGetCode.isEnabled = true
|
||||
}else{
|
||||
} else {
|
||||
actvLoginGetCode.text = text
|
||||
actvLoginGetCode.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
fun inputPhoneError(){
|
||||
fun inputPhoneError() {
|
||||
aceLoginPhoneValue.text?.clear()
|
||||
aceLoginPhoneValue.setHint(R.string.module_och_taxi_login_phone_error)
|
||||
context?.let {
|
||||
aceLoginPhoneValue.setHintTextColor(ContextCompat.getColor(it,R.color.taxi_EF262C))
|
||||
aceLoginPhoneValue.setHintTextColor(ContextCompat.getColor(it, R.color.taxi_EF262C))
|
||||
aceLoginPhoneValue.setBackgroundResource(R.drawable.taxi_login_phone_error)
|
||||
}
|
||||
}
|
||||
private fun inputPhoneNormal(){
|
||||
|
||||
private fun inputPhoneNormal() {
|
||||
//aceLoginPhoneValue.setHint(R.string.module_och_taxi_login_phone_hint_text)
|
||||
context?.let {
|
||||
aceLoginPhoneValue.setHintTextColor(ContextCompat.getColor(it,R.color.taxi_878890))
|
||||
aceLoginPhoneValue.setHintTextColor(ContextCompat.getColor(it, R.color.taxi_878890))
|
||||
aceLoginPhoneValue.setBackgroundResource(R.drawable.taxi_login_phone_normal)
|
||||
}
|
||||
}
|
||||
@@ -205,17 +196,30 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
return OchCommonLoginPresenter(this)
|
||||
}
|
||||
|
||||
val COUNTS = 4 // 点击次数
|
||||
val DURATION: Long = 1000 // 规定有效时间
|
||||
var mHits = LongArray(COUNTS)
|
||||
companion object {
|
||||
private const val COUNTS = 4 // 点击次数
|
||||
private const val DURATION: Long = 1000 // 规定有效时间
|
||||
val TAG = TaxiLoginDialogFragment::class.java.simpleName
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(): TaxiLoginDialogFragment {
|
||||
val args = Bundle()
|
||||
val fragment = TaxiLoginDialogFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private var mHits = LongArray(COUNTS)
|
||||
|
||||
private fun continuousClick() {
|
||||
//每次点击时,数组向前移动一位
|
||||
System.arraycopy(mHits, 1, mHits, 0, mHits.size - 1)
|
||||
//为数组最后一位赋值
|
||||
mHits[mHits.size-1] = SystemClock.uptimeMillis()
|
||||
mHits[mHits.size - 1] = SystemClock.uptimeMillis()
|
||||
if (mHits[0] >= (SystemClock.uptimeMillis() - DURATION)) {
|
||||
mHits = LongArray(COUNTS) //重新初始化数组
|
||||
mPresenter?.gotoLogin("13288888888","8888")
|
||||
mPresenter?.gotoLogin("13288888888", "8888")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +238,7 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
mOnClickListener?.onDismiss(dialog)
|
||||
CallerHmiManager.setStatusBarDarkOrLight(false)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,16 +274,4 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
val TAG = TaxiLoginDialogFragment::class.java.simpleName
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(): TaxiLoginDialogFragment {
|
||||
val args = Bundle()
|
||||
val fragment = TaxiLoginDialogFragment()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.och.common.module.callback
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/11/9
|
||||
*/
|
||||
interface OchAdasStartFailureCallback {
|
||||
fun onStartAutopilotFailure(startFailedMessage : String)
|
||||
}
|
||||
@@ -6,9 +6,13 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotAbility;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatistics;
|
||||
|
||||
import chassis.Chassis;
|
||||
import system_master.SystemStatusInfo;
|
||||
@@ -18,12 +22,15 @@ import system_master.SystemStatusInfo;
|
||||
* 工控机状态信息回调(判断是否能否启动自动驾驶的回调)
|
||||
* 目前定的是3秒回调一次
|
||||
*/
|
||||
public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener {
|
||||
public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMoGoAutopilotStatisticsListener {
|
||||
|
||||
private static final String TAG = OCHAdasAbilityManager.class.getSimpleName();
|
||||
|
||||
private boolean isAutopilotAbility = true;
|
||||
private String autopilotAbilityReason = "";
|
||||
private String startFailedMessage = "";
|
||||
|
||||
private OchAdasStartFailureCallback failureCallback = null;
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final OCHAdasAbilityManager INSTANCE = new OCHAdasAbilityManager();
|
||||
@@ -37,6 +44,10 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener {
|
||||
initListeners();
|
||||
}
|
||||
|
||||
public void setAdasStartFailureCallback(OchAdasStartFailureCallback callback){
|
||||
failureCallback = callback;
|
||||
}
|
||||
|
||||
public boolean getAutopilotAbilityStatus(){
|
||||
return isAutopilotAbility;
|
||||
}
|
||||
@@ -45,13 +56,19 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener {
|
||||
return autopilotAbilityReason;
|
||||
}
|
||||
|
||||
public String getStartFailedMessage() {
|
||||
return startFailedMessage;
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
//2022.10.9 工控机状态信息回调(判断是否能否启动自动驾驶的回调), 目前定的是3秒回调一次
|
||||
CallerAutopilotActionsListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotStatisticsListenerManager.INSTANCE.addListener(TAG,this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
CallerAutopilotActionsListenerManager.INSTANCE.removeListener(this);
|
||||
CallerAutopilotStatisticsListenerManager.INSTANCE.removeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,6 +105,18 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener {
|
||||
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + autopilotAbilityReason);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatistics(@Nullable AutopilotStatistics statistics) {
|
||||
if (statistics == null) return;
|
||||
Logger.d(TAG, "AutopilotStatistics= " + statistics.status);
|
||||
if (failureCallback != null && 1 == statistics.status){
|
||||
startFailedMessage = statistics.failedMessage.getMsg();
|
||||
failureCallback.onStartAutopilotFailure(startFailedMessage);
|
||||
Logger.d(TAG, "statistics-startFailedMessage= " + startFailedMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
releaseListeners();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.model;
|
||||
package com.mogo.och.common.module.map;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
@@ -25,8 +25,7 @@ import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.taxi.utils.PermissionUtil;
|
||||
import com.mogo.och.common.module.utils.PermissionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -36,24 +35,27 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/6
|
||||
*/
|
||||
public class NaviToDestinationModel implements AMapNaviListener {
|
||||
public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
|
||||
public static final String TAG = "NaviToDestinationModel";
|
||||
|
||||
private static Context mContext;
|
||||
private AMapNavi mAMapNavi = null;
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
protected List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
|
||||
private ITaxiNaviChangedCallback mNaviChangedCallback;
|
||||
private ICommonNaviChangedCallback mNaviChangedCallback;
|
||||
private AtomicInteger errorCount = new AtomicInteger(0);
|
||||
private boolean isPlay;
|
||||
public static NaviToDestinationModel getInstance(Context context) {
|
||||
public static AmapNaviToDestinationModel getInstance(Context context) {
|
||||
mContext = context;
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final NaviToDestinationModel INSTANCE = new NaviToDestinationModel();
|
||||
private static final AmapNaviToDestinationModel INSTANCE = new AmapNaviToDestinationModel();
|
||||
}
|
||||
private NaviToDestinationModel(){
|
||||
private AmapNaviToDestinationModel(){
|
||||
}
|
||||
public void initAMapNavi(NaviLatLng startLatLng,NaviLatLng endLatLng) {
|
||||
try {
|
||||
@@ -90,7 +92,7 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void setOCHTaciNaviChangedCallback(ITaxiNaviChangedCallback callback){
|
||||
public void setOCHTaciNaviChangedCallback(ICommonNaviChangedCallback callback){
|
||||
this.mNaviChangedCallback = callback;
|
||||
}
|
||||
@Override
|
||||
@@ -132,6 +134,7 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
public void onNaviInfoUpdate(NaviInfo naviinfo) {
|
||||
//导航过程中的信息更新,请看NaviInfo的具体说明
|
||||
if (null != mNaviChangedCallback){
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "距离=" + naviinfo.getPathRetainDistance() + ", 剩余时间 " + naviinfo.getPathRetainTime());
|
||||
mNaviChangedCallback.onCurrentNaviDistAndTimeChanged(naviinfo.getPathRetainDistance(),naviinfo.getPathRetainTime());// 米、秒
|
||||
}
|
||||
}
|
||||
@@ -165,13 +168,9 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// if (result.getErrorCode() == 3){
|
||||
// ToastUtils.showShort("车辆当前坐标错误");
|
||||
// }else if (result.getErrorCode() == 6){
|
||||
// ToastUtils.showShort("终点坐标错误");
|
||||
// }
|
||||
CallerLogger.INSTANCE.i(M_TAXI + "dm", "路线计算失败:错误码=" + result.getErrorCode() + ",Error Message= " + result.getErrorDetail());
|
||||
CallerLogger.INSTANCE.i(M_TAXI + "dm", "错误码详细链接见:http://lbs.amap.com/api/android-navi-sdk/guide/tools/errorcode/");
|
||||
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "路线计算失败:错误码=" + result.getErrorCode() + ",Error Message= " + result.getErrorDetail());
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "错误码详细链接见:http://lbs.amap.com/api/android-navi-sdk/guide/tools/errorcode/");
|
||||
}
|
||||
@Override
|
||||
public void onStartNavi(int type) {
|
||||
@@ -341,88 +340,4 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
public void onPlayRing(int i) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车道信息说明:
|
||||
* <p>
|
||||
* 0xFF, 无对应车道
|
||||
* 0, 直行
|
||||
* 1, 左转
|
||||
* 2, 直行+左转
|
||||
* 3, 右转
|
||||
* 4, 直行+右转
|
||||
* 5, 左掉头
|
||||
* 6, 左转+右转
|
||||
* 7, 直行+左转+右转
|
||||
* 8, 右掉头
|
||||
* 9, 直行+左掉头
|
||||
* 10, 直行+右掉头
|
||||
* 11, 左转+左掉头
|
||||
* 12, 右转+右掉头
|
||||
* 13, 直行+扩展
|
||||
* 14, 左转+左掉头+扩展
|
||||
* 15, 保留
|
||||
* 16, 直行+左转+左掉头
|
||||
* 17, 右转+左掉头
|
||||
* 18, 左转+右转+左掉头
|
||||
* 19, 直行+右转+左掉头
|
||||
* 20, 左转+右掉头
|
||||
* 21, 公交车道
|
||||
* 22, 空车道
|
||||
* 23 可变车道
|
||||
*/
|
||||
|
||||
String[] array = {
|
||||
"直行车道"
|
||||
, "左转车道"
|
||||
, "左转或直行车道"
|
||||
, "右转车道"
|
||||
, "右转或直行车道"
|
||||
, "左掉头车道"
|
||||
, "左转或者右转车道"
|
||||
, " 左转或右转或直行车道"
|
||||
, "右转掉头车道"
|
||||
, "直行或左转掉头车道"
|
||||
, "直行或右转掉头车道"
|
||||
, "左转或左掉头车道"
|
||||
, "右转或右掉头车道"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择该车道"
|
||||
, "直行+左转+左掉头车道"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
|
||||
String[] actions = {
|
||||
"直行"
|
||||
, "左转"
|
||||
, "左转或直行"
|
||||
, "右转"
|
||||
, "右转或这行"
|
||||
, "左掉头"
|
||||
, "左转或者右转"
|
||||
, " 左转或右转或直行"
|
||||
, "右转掉头"
|
||||
, "直行或左转掉头"
|
||||
, "直行或右转掉头"
|
||||
, "左转或左掉头"
|
||||
, "右转或右掉头"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择"
|
||||
, "直行+左转+左掉头"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package com.mogo.och.common.module.map
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import com.amap.api.maps.AMap
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions
|
||||
import com.amap.api.navi.AMapNaviView
|
||||
import com.amap.api.navi.AMapNaviViewListener
|
||||
import com.amap.api.navi.AMapNaviViewOptions
|
||||
import com.amap.api.navi.model.RouteOverlayOptions
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.R
|
||||
import kotlinx.android.synthetic.main.taxi_common_amap_navi_view.view.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/10/23
|
||||
*/
|
||||
class CommonAmapNaviVIew @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0)
|
||||
: RelativeLayout(context,attrs,defStyleAttr), AMapNaviViewListener {
|
||||
|
||||
private val TAG : String = "TaxiAmapNaviVIew"
|
||||
|
||||
var aMap : AMap? = null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_common_amap_navi_view,this,true)
|
||||
initMapView()
|
||||
}
|
||||
|
||||
private fun initMapView(){
|
||||
|
||||
amapNaviView.setAMapNaviViewListener(this)
|
||||
//车头向上模式
|
||||
amapNaviView.naviMode = AMapNaviView.CAR_UP_MODE
|
||||
aMap = amapNaviView.map
|
||||
//关闭地图文字显示
|
||||
aMap!!.showMapText(false)
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
aMap!!.mapType = AMap.MAP_TYPE_NIGHT
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
aMap!!.isTrafficEnabled = false
|
||||
setMapViewOptions()
|
||||
|
||||
thread(start = true){
|
||||
try {
|
||||
Thread.sleep(1000L)
|
||||
} catch (e : InterruptedException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
if (null == context){
|
||||
return@thread
|
||||
}
|
||||
|
||||
aMap!!.setCustomMapStyle(
|
||||
CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(context, "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(context, "over_view_style_extra.data"))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setMapViewOptions() {
|
||||
|
||||
val options = AMapNaviViewOptions()
|
||||
options.tilt = 0 //设置 2D 模式
|
||||
|
||||
options.isLayoutVisible = false //设置导航界面UI是否显示。
|
||||
|
||||
options.isTrafficBarEnabled = false //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
|
||||
options.isAutoLockCar = true //设置6秒后是否自动锁车
|
||||
|
||||
options.isAutoDisplayOverview = true //设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
|
||||
options.isTrafficLine = false
|
||||
options.setModeCrossDisplayShow(true) //设置是否显示路口放大图(路口模型图)
|
||||
|
||||
options.isAutoChangeZoom = true //自动缩放级别
|
||||
|
||||
options.carBitmap =
|
||||
BitmapFactory.decodeResource(context.resources, R.drawable.taxi_navi_arrow_icon)
|
||||
options.fourCornersBitmap =
|
||||
BitmapFactory.decodeResource(this.resources, R.drawable.taxi_navi_direction_icon)
|
||||
options.isAutoChangeZoom = true //设置是否开启动态比例尺 (锁车态下自动进行地图缩放变化)
|
||||
|
||||
// options.setZoom(18);//14-18
|
||||
// options.setTrafficInfoUpdateEnabled(false);
|
||||
// options.setTrafficLayerEnabled(false);//设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setCameraInfoUpdateEnabled(false);
|
||||
// options.setCompassEnabled(false);//设置指南针图标否在导航界面显示,默认显示。
|
||||
// options.setLaneInfoShow(false);// 设置是否显示道路信息view
|
||||
// options.setNaviArrowVisible(false);//设置路线转向箭头隐藏和显示
|
||||
// options.setRealCrossDisplayShow(false);//设置是否显示路口放大图(实景图)
|
||||
// options.setRouteListButtonShow(true);//设置导航界面是否显示路线全览按钮。
|
||||
// options.setSettingMenuEnabled(false);//设置菜单按钮是否在导航界面显示。
|
||||
|
||||
// options.setZoom(18);//14-18
|
||||
// options.setTrafficInfoUpdateEnabled(false);
|
||||
// options.setTrafficLayerEnabled(false);//设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setCameraInfoUpdateEnabled(false);
|
||||
// options.setCompassEnabled(false);//设置指南针图标否在导航界面显示,默认显示。
|
||||
// options.setLaneInfoShow(false);// 设置是否显示道路信息view
|
||||
// options.setNaviArrowVisible(false);//设置路线转向箭头隐藏和显示
|
||||
// options.setRealCrossDisplayShow(false);//设置是否显示路口放大图(实景图)
|
||||
// options.setRouteListButtonShow(true);//设置导航界面是否显示路线全览按钮。
|
||||
// options.setSettingMenuEnabled(false);//设置菜单按钮是否在导航界面显示。
|
||||
val routeOverlayOptions = RouteOverlayOptions()
|
||||
|
||||
// routeOverlayOptions.setArrowOnTrafficRoute(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_aolr));
|
||||
|
||||
// routeOverlayOptions.setArrowOnTrafficRoute(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_aolr));
|
||||
routeOverlayOptions.normalRoute =
|
||||
BitmapFactory.decodeResource(resources, R.drawable.taxi_navi_line_icon)
|
||||
options.routeOverlayOptions = routeOverlayOptions
|
||||
|
||||
amapNaviView.viewOptions = options
|
||||
}
|
||||
|
||||
override fun onNaviSetting() {
|
||||
//底部导航设置点击回调
|
||||
}
|
||||
|
||||
override fun onNaviCancel() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onNaviBackClick(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onNaviMapMode(p0: Int) {
|
||||
//导航态车头模式,0:车头朝上状态;1:正北朝上模式。
|
||||
}
|
||||
|
||||
override fun onNaviTurnClick() {
|
||||
//转弯view的点击回调
|
||||
}
|
||||
|
||||
override fun onNextRoadClick() {
|
||||
//下一个道路View点击回调
|
||||
}
|
||||
|
||||
override fun onScanViewButtonClick() {
|
||||
//全览按钮点击回调
|
||||
}
|
||||
|
||||
override fun onLockMap(p0: Boolean) {
|
||||
//锁地图状态发生变化时回调
|
||||
}
|
||||
|
||||
override fun onNaviViewLoaded() {
|
||||
d(SceneConstant.M_TAXI + TAG, "导航页面加载成功")
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onMapTypeChanged(p0: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onNaviViewShowMode(p0: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
fun onCreate(savedInstanceState : Bundle?){
|
||||
amapNaviView.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
fun onResume(){
|
||||
amapNaviView.onResume()
|
||||
}
|
||||
|
||||
fun onPause(){
|
||||
amapNaviView.onPause()
|
||||
}
|
||||
|
||||
fun onDestroy(){
|
||||
amapNaviView.onDestroy()
|
||||
}
|
||||
|
||||
var array = arrayOf(
|
||||
"直行车道",
|
||||
"左转车道",
|
||||
"左转或直行车道",
|
||||
"右转车道",
|
||||
"右转或直行车道",
|
||||
"左掉头车道",
|
||||
"左转或者右转车道",
|
||||
" 左转或右转或直行车道",
|
||||
"右转掉头车道",
|
||||
"直行或左转掉头车道",
|
||||
"直行或右转掉头车道",
|
||||
"左转或左掉头车道",
|
||||
"右转或右掉头车道",
|
||||
"直行并且车道扩展",
|
||||
"左转+左掉头+扩展",
|
||||
"不可以选择该车道",
|
||||
"直行+左转+左掉头车道",
|
||||
"右转+左掉头",
|
||||
"左转+右转+左掉头",
|
||||
"直行+右转+左掉头",
|
||||
"左转+右掉头",
|
||||
"公交车道",
|
||||
"空车道",
|
||||
"可变车道"
|
||||
)
|
||||
|
||||
var actions = arrayOf(
|
||||
"直行",
|
||||
"左转",
|
||||
"左转或直行",
|
||||
"右转",
|
||||
"右转或这行",
|
||||
"左掉头",
|
||||
"左转或者右转",
|
||||
" 左转或右转或直行",
|
||||
"右转掉头",
|
||||
"直行或左转掉头",
|
||||
"直行或右转掉头",
|
||||
"左转或左掉头",
|
||||
"右转或右掉头",
|
||||
"直行并且车道扩展",
|
||||
"左转+左掉头+扩展",
|
||||
"不可以选择",
|
||||
"直行+左转+左掉头",
|
||||
"右转+左掉头",
|
||||
"左转+右转+左掉头",
|
||||
"直行+右转+左掉头",
|
||||
"左转+右掉头",
|
||||
"公交车道",
|
||||
"空车道",
|
||||
"可变车道"
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
package com.mogo.och.common.module.map;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/3
|
||||
*/
|
||||
public interface ITaxiNaviChangedCallback {
|
||||
public interface ICommonNaviChangedCallback {
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentNaviDistAndTimeChanged(int meters, long timeInSecond);
|
||||
void reInitNaviAmap(boolean isPlay,boolean isRestart);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.och.common.module.utils
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI_P
|
||||
|
||||
object CallerLoggerUtils {
|
||||
var flavorTag = when (DebugConfig.getProductFlavor()) {
|
||||
"fPadLenovoOchTaxi" -> {
|
||||
//出租车司机
|
||||
M_TAXI
|
||||
}
|
||||
"fPadLenovoOchBus" -> {
|
||||
//小巴车司机
|
||||
M_BUS
|
||||
}
|
||||
"fPadLenovoOchTaxiPassenger" -> {
|
||||
//出租车乘客
|
||||
M_TAXI_P
|
||||
}
|
||||
"fPadLenovoOchBusPassenger" -> {
|
||||
//小巴车乘客
|
||||
M_BUS_P
|
||||
}
|
||||
else -> {
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
@@ -8,7 +9,9 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -161,7 +164,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
latePoints.add(mRoutePoints.get(currentIndex));
|
||||
}else {
|
||||
}else if(currentIndex < mRoutePoints.size()-1){
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
}
|
||||
return latePoints;
|
||||
@@ -202,4 +205,108 @@ public class CoordinateCalculateRouteUtil {
|
||||
}
|
||||
return currentIndex;
|
||||
}
|
||||
|
||||
public static float calculateRouteSumLengthByLocation(List<Location> points){
|
||||
if (null == points || points.size() == 0) return 0;
|
||||
|
||||
float sumLength = 0;
|
||||
|
||||
//计算全路径总距离
|
||||
for (int i = 0;i + 1< points.size();i++){
|
||||
double preLat = points.get(i).getLatitude();
|
||||
double preLon = points.get(i).getLongitude();
|
||||
double laLat = points.get(i+1).getLatitude();
|
||||
double laLon = points.get(i+1).getLongitude();
|
||||
|
||||
float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat);
|
||||
sumLength += length;
|
||||
}
|
||||
return sumLength;
|
||||
}
|
||||
|
||||
|
||||
public static List<Location> coordinateConverterWgsToGcjLocations(Context mContext, List<MessagePad.Location> models) {
|
||||
//转成MogoLatLng集合
|
||||
List<Location> list = new ArrayList<>();
|
||||
for (MessagePad.Location m : models) {
|
||||
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m);
|
||||
Location location = new Location("gcj_provider");
|
||||
location.setBearing((float) m.getHeading());
|
||||
location.setLatitude(mogoLatLng.latitude);
|
||||
location.setLongitude(mogoLatLng.longitude);
|
||||
list.add(location);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Map<Integer,List<LatLng>> getRemainPointListByCompareNew(int preIndex,
|
||||
List<Location> mRoutePoints,
|
||||
Location realLocation) {
|
||||
Map<Integer,List<LatLng>> routePonits = new HashMap<>();
|
||||
List<LatLng> latePoints = new ArrayList<>(); // 剩余轨迹集合
|
||||
int currentIndex = 0; //记录疑似点
|
||||
if (mRoutePoints.size() > preIndex){
|
||||
//基础点
|
||||
Location baseLatLng = mRoutePoints.get(preIndex);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
|
||||
realLocation.getLatitude()
|
||||
,baseLatLng.getLongitude(),baseLatLng.getLongitude());// lon,lat, prelon, prelat
|
||||
|
||||
for (int i= preIndex; i < mRoutePoints.size(); i++){
|
||||
Location latLng = mRoutePoints.get(i);
|
||||
//todo 先看index对应点的方向和realLocation方向是否一致, 方向角度不能过90度
|
||||
if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
|
||||
realLocation.getLatitude(),
|
||||
latLng.getLongitude(),latLng.getLatitude());
|
||||
if (baseDiffDis > diff ){
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.d( "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
Location location = mRoutePoints.get(currentIndex);
|
||||
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
latePoints.add(latLng);
|
||||
}else {
|
||||
List<Location> locations = mRoutePoints.subList(currentIndex,mRoutePoints.size()-1);
|
||||
for (Location location: locations) {
|
||||
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
latePoints.add(latLng);
|
||||
}
|
||||
}
|
||||
routePonits.put(currentIndex,latePoints);
|
||||
return routePonits;
|
||||
}
|
||||
return routePonits;
|
||||
}
|
||||
|
||||
public static int getArrivedPointIndexNew(List<Location> mRoutePoints,
|
||||
Location realLocation) {
|
||||
int currentIndex = 0; //记录疑似点 //基础点
|
||||
Location baseLatLng = mRoutePoints.get(0);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
|
||||
realLocation.getLatitude()
|
||||
, baseLatLng.getLongitude(), baseLatLng.getLongitude());// lon,lat, prelon, prelat
|
||||
|
||||
for (int i = 0; i < mRoutePoints.size(); i++) {
|
||||
Location latLng = mRoutePoints.get(i);
|
||||
//todo 先看index对应点的方向和realLocation方向是否一致, 方向角度不能过90度
|
||||
if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90) {
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
|
||||
realLocation.getLatitude(),
|
||||
latLng.getLongitude(), latLng.getLatitude());
|
||||
if (baseDiffDis > diff) {
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.d("calculateRouteSumLength", "点:" + currentIndex + "-------是最近的点------ ");
|
||||
return currentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public class FieldUtils {
|
||||
|
||||
public static Field getDeclaredField(final Class<?> cls, final String fieldName, final
|
||||
boolean forceAccess) {
|
||||
if (cls == null || TextUtils.isEmpty(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// only consider the specified class by using getDeclaredField()
|
||||
final Field field = cls.getDeclaredField(fieldName);
|
||||
if (!isAccessible(field)) {
|
||||
if (forceAccess) {
|
||||
field.setAccessible(true);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return field;
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isAccessible(final Member m) {
|
||||
return m != null && Modifier.isPublic(m.getModifiers()) && !m.isSynthetic();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.LocationManager;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/7
|
||||
*/
|
||||
public class PermissionUtil {
|
||||
|
||||
public static boolean checkPermission(Context context,String... permissons) {
|
||||
|
||||
for (String permisson : permissons) {
|
||||
if ((ContextCompat.checkSelfPermission(context,
|
||||
permisson) != PackageManager.PERMISSION_GRANTED)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isLocServiceEnable(Context context) {
|
||||
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
|
||||
if (gps || network) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.mogo.och.common.module.voice
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
object VoiceNotice {
|
||||
@JvmStatic
|
||||
fun showNotice(notice: String?) {
|
||||
showNotice(notice, AIAssist.LEVEL0)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showNotice(notice: String?, level: Int) {
|
||||
showNotice(notice,level,0)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showNotice(notice: String?, delayed: Long) {
|
||||
showNotice(notice, AIAssist.LEVEL0, delayed)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showNotice(notice: String?, level: Int, delayed: Long = 0) {
|
||||
notice?.let {
|
||||
if (delayed == 0L) {
|
||||
UiThreadHandler.post {
|
||||
AIAssist.getInstance(AbsMogoApplication.getApp())
|
||||
.speakTTSVoiceWithLevel(it, level)
|
||||
}
|
||||
} else {
|
||||
UiThreadHandler.postDelayed({
|
||||
AIAssist.getInstance(AbsMogoApplication.getApp())
|
||||
.speakTTSVoiceWithLevel(it, level)
|
||||
}, delayed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 中断当前在播语音
|
||||
*/
|
||||
@JvmStatic
|
||||
fun stopCurrentTts(){
|
||||
UiThreadHandler.post {
|
||||
AIAssist.getInstance(AbsMogoApplication.getApp()).stopTts()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewDebug;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.och.common.module.R;
|
||||
import com.mogo.och.common.module.utils.FieldUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
||||
public class MarqueeTextView extends androidx.appcompat.widget.AppCompatTextView{
|
||||
|
||||
/**
|
||||
* 上一次设置的时间,用于过滤多余操作
|
||||
*/
|
||||
private long mLastSetTime;
|
||||
/**
|
||||
* 自定义 gap
|
||||
*/
|
||||
private float mCustomGap = 0.3f;
|
||||
/**
|
||||
* 是否使用自定义 gap
|
||||
*/
|
||||
private boolean mUseCustomGap;
|
||||
|
||||
public MarqueeTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public MarqueeTextView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public MarqueeTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MarqueeTextView);
|
||||
mCustomGap = typedArray.getFloat(R.styleable.MarqueeTextView_customGap, mCustomGap);
|
||||
mUseCustomGap = typedArray.getBoolean(R.styleable.MarqueeTextView_useCustomGap, false);
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ViewDebug.ExportedProperty(category = "focus")
|
||||
public boolean isFocused() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean isSelected() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
reflectToChangeGap();
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
private void reflectToChangeGap() {
|
||||
if (!mUseCustomGap) {
|
||||
return;
|
||||
}
|
||||
if (System.currentTimeMillis() - mLastSetTime < 1000) {
|
||||
// 1s 内不重新设置,过滤多余操作
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Class marqueClass = null;
|
||||
Class[] innerClazz = TextView.class.getDeclaredClasses();
|
||||
for (Class clazz : innerClazz) {
|
||||
if ("Marquee".equals(clazz.getSimpleName())) {
|
||||
marqueClass = clazz;
|
||||
}
|
||||
}
|
||||
|
||||
if (marqueClass == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Field field1 = FieldUtils.getDeclaredField(marqueClass, "mGhostStart", true);
|
||||
|
||||
if (field1 == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int textWidth = getWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
|
||||
final float lineWidth = getLayout().getLineWidth(0);
|
||||
final float gap = mCustomGap*textWidth;
|
||||
float ghostStart = lineWidth - textWidth + gap;
|
||||
float maxScroll = ghostStart + textWidth;
|
||||
float ghostOffset = lineWidth + gap;
|
||||
float maxFadeScroll = ghostStart + lineWidth + lineWidth;
|
||||
|
||||
final Field field = FieldUtils.getDeclaredField(TextView.class, "mMarquee", true);
|
||||
if (field != null) {
|
||||
Object mMarque = field.get(this);
|
||||
if (mMarque != null) {
|
||||
mLastSetTime = System.currentTimeMillis();
|
||||
float mGhostStart = (float) field1.get(mMarque);
|
||||
if (mGhostStart != ghostStart) {
|
||||
// 需要设置的 mGhostStart 与当前 ghostStart 不相等时才去设置
|
||||
Field field2 = FieldUtils.getDeclaredField(marqueClass, "mMaxScroll", true);
|
||||
Field field3 = FieldUtils.getDeclaredField(marqueClass, "mGhostOffset", true);
|
||||
Field field4 = FieldUtils.getDeclaredField(marqueClass, "mMaxFadeScroll", true);
|
||||
|
||||
if (field2 == null || field3 == null || field4 == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
field1.set(mMarque, ghostStart);
|
||||
field2.set(mMarque, maxScroll);
|
||||
field3.set(mMarque, ghostOffset);
|
||||
field4.set(mMarque, maxFadeScroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 542 B |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.amap.api.navi.AMapNaviView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/amapNaviView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
@@ -52,4 +52,9 @@
|
||||
<attr name="och_realtime_end_color" format="color" />
|
||||
<attr name="och_realtime_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="MarqueeTextView">
|
||||
<attr name="customGap" format="float" />
|
||||
<attr name="useCustomGap" format="boolean"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -13,4 +13,5 @@ import mogo.telematics.pad.MessagePad;
|
||||
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
|
||||
void setLineMarker(List<LatLng> models);
|
||||
void routeResultByServer(List<LatLng> models,int haveArrivedIndex);
|
||||
void showRottingMapView();
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
|
||||
@@ -56,7 +56,12 @@ class TaxiPassengerConst {
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_ORDER_NUMBER = "order_num"
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
|
||||
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境:true/false
|
||||
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_taxi_ap_unable_start_reason"
|
||||
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
@@ -32,6 +33,9 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerBaseRespBean;
|
||||
@@ -51,7 +55,6 @@ import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonValueCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerVeloctityCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerAnalyticsManager;
|
||||
@@ -288,8 +291,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
* 才更新最新进行中单到本地
|
||||
*/
|
||||
public void queryInAndWaitOrders() {
|
||||
TaxiPassengerServiceManager.getInstance().queryOrdersInAndWaitService(mContext,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerOrdersInServiceQueryRespBean>() {
|
||||
TaxiPassengerServiceManager.queryOrdersInAndWaitService(mContext,
|
||||
new OchCommonServiceCallback<TaxiPassengerOrdersInServiceQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerOrdersInServiceQueryRespBean data) {
|
||||
if (data == null || data.data == null) {
|
||||
@@ -346,8 +349,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
return;
|
||||
}
|
||||
final String orderNo = mCurrentOCHOrder.orderNo;
|
||||
TaxiPassengerServiceManager.getInstance().queryOrderById(mContext, orderNo,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerOrderQueryRespBean>() {
|
||||
TaxiPassengerServiceManager.queryOrderById(mContext, orderNo,
|
||||
new OchCommonServiceCallback<TaxiPassengerOrderQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerOrderQueryRespBean data) {
|
||||
if (data != null && data.data != null
|
||||
@@ -618,6 +621,29 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
mLocationsModels.clear();
|
||||
mLocationsModels.addAll(latLngModels);
|
||||
startOrStopRouteAndWipe(true);
|
||||
showRottingMapView();
|
||||
}
|
||||
|
||||
public void showRottingMapView(){
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi();
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.showRottingMapView();
|
||||
}
|
||||
}
|
||||
|
||||
public void startNaviByAmap() {
|
||||
if (mCurrentOCHOrder != null &&
|
||||
mCurrentOCHOrder.orderStatus == TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi();
|
||||
|
||||
double orderEndStationLat = mCurrentOCHOrder.endSiteGcjPoint.get(1);
|
||||
double orderEndStationLng = mCurrentOCHOrder.endSiteGcjPoint.get(0);
|
||||
NaviLatLng startNaviLatLng = new NaviLatLng(mLatitude, mLongitude);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(orderEndStationLat,orderEndStationLng);
|
||||
AmapNaviToDestinationModel.getInstance(mContext).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
AmapNaviToDestinationModel.getInstance(mContext).setVoiceIsMute(false);
|
||||
// AmapNaviToDestinationModel.getInstance(mContext).setOCHTaciNaviChangedCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -682,7 +708,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
public void startOrStopQueryOrderRemaining(boolean isStart){
|
||||
if (isStart){
|
||||
TaxiPassengerModelLoopManager.getInstance().startQueryOrderRemainingtLoop();
|
||||
TaxiPassengerModelLoopManager.getInstance().startQueryOrderRemainingLoop();
|
||||
}else {
|
||||
TaxiPassengerModelLoopManager.getInstance().stopQueryOrderRemainingLoop();
|
||||
}
|
||||
@@ -693,7 +719,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
*/
|
||||
public void queryOrderRemaining(){
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiPassengerServiceManager.getInstance().queryOrderRemaining(mContext, mCurrentOCHOrder.orderNo, new TaxiPassengerServiceCallback<TaxiPassengerOrderQueryRemainingResp>() {
|
||||
TaxiPassengerServiceManager.queryOrderRemaining(mContext, mCurrentOCHOrder.orderNo, new OchCommonServiceCallback<TaxiPassengerOrderQueryRemainingResp>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerOrderQueryRemainingResp data) {
|
||||
if (data != null && data.data!=null){
|
||||
@@ -714,7 +740,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
public void queryOrderRouteList() {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "--route--- queryOrderRouteList");
|
||||
TaxiPassengerServiceManager.getInstance().queryOrderRouteList(mContext, mCurrentOCHOrder.orderNo, new TaxiPassengerServiceCallback<TaxiPassengerQueryOrderRouteResp>() {
|
||||
TaxiPassengerServiceManager.queryOrderRouteList(mContext, mCurrentOCHOrder.orderNo, new OchCommonServiceCallback<TaxiPassengerQueryOrderRouteResp>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerQueryOrderRouteResp data) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "--route---"+GsonUtil.jsonFromObject(data));
|
||||
@@ -765,8 +791,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
public void checkPhoneAndUpdateStatus(String phoneTail,ITaxiPassengerCommonCallback commonCallback) {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiPassengerServiceManager.getInstance().checkPhoneAndUpdateOrderStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
phoneTail, new TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
TaxiPassengerServiceManager.checkPhoneAndUpdateOrderStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
phoneTail, new OchCommonServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerBaseRespBean data) {
|
||||
if (data != null && data.code == 0 && mCurrentOCHOrder != null){
|
||||
@@ -799,8 +825,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
public void arrivedAndScore(TaxiPassengerScoreUpdateOrderReqBean taxiPassengerScoreUpdateOrderReqBean , ITaxiPassengerCommonValueCallback<Boolean> commonCallback) {
|
||||
if (taxiPassengerScoreUpdateOrderReqBean.orderNo == null) return;
|
||||
TaxiPassengerServiceManager.getInstance().arrivedAndScore(mContext,taxiPassengerScoreUpdateOrderReqBean,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
TaxiPassengerServiceManager.arrivedAndScore(mContext,taxiPassengerScoreUpdateOrderReqBean,
|
||||
new OchCommonServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerBaseRespBean data) {
|
||||
if(commonCallback!=null) {
|
||||
@@ -829,13 +855,13 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
public void loopQueryPilotStatus(){
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiPassengerServiceManager.getInstance().queryPilotStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
TaxiPassengerServiceManager.queryPilotStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
new OchCommonServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerBaseRespBean data) {
|
||||
if (data != null && data.code == 0 && data.data.equals(true)) {
|
||||
updateAutopilotStatus(true);
|
||||
startOrStopReadyToAutopilotoop(false);
|
||||
startOrStopReadyToAutopilotLoop(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,11 +882,11 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
public void startDriverReadyToAutopilotLoop(){
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopReadyToAutopilotoop(true);
|
||||
startOrStopReadyToAutopilotLoop(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void startOrStopReadyToAutopilotoop(boolean isStart) {
|
||||
public void startOrStopReadyToAutopilotLoop(boolean isStart) {
|
||||
if (isStart){
|
||||
TaxiPassengerModelLoopManager.getInstance().startReadyToAutopilot();
|
||||
}else {
|
||||
@@ -873,9 +899,9 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
TaxiPassengerStartReqBean.Result result = new TaxiPassengerStartReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiPassengerServiceManager.getInstance().startServicePilotDone(mContext,
|
||||
TaxiPassengerServiceManager.startServicePilotDone(mContext,
|
||||
mCurrentOCHOrder.orderNo, result,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean>(){
|
||||
new OchCommonServiceCallback<TaxiPassengerBaseRespBean>(){
|
||||
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerBaseRespBean data) {
|
||||
@@ -900,6 +926,16 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
startServicePilotDone();
|
||||
}
|
||||
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
|
||||
TaxiPassengerAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.orderNo,
|
||||
OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason());
|
||||
return;
|
||||
}
|
||||
|
||||
double startWgsLon = mCurrentOCHOrder.startSitePoint.get(0);
|
||||
double startWgsLat = mCurrentOCHOrder.startSitePoint.get(1);
|
||||
double endWgsLon = mCurrentOCHOrder.endSitePoint.get(0);
|
||||
|
||||
@@ -131,11 +131,11 @@ public class TaxiPassengerModelLoopManager {
|
||||
/**
|
||||
* 轮训查下 查询订单剩余里程和时间
|
||||
*/
|
||||
public void startQueryOrderRemainingtLoop() {
|
||||
public void startQueryOrderRemainingLoop() {
|
||||
if (mQueryOrderRemainingDisposable != null && !mQueryOrderRemainingDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startQueryOrderRemainingtLoop()");
|
||||
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startQueryOrderRemainingLoop()");
|
||||
mQueryOrderRemainingDisposable = Observable.interval(TaxiPassengerConst.LOOP_DELAY,
|
||||
TaxiPassengerConst.LOOP_CALCULATEROUTE_2S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.network;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 修改订单状态回调接口
|
||||
*/
|
||||
public interface TaxiPassengerServiceCallback< T > {
|
||||
|
||||
void onSuccess(T data);
|
||||
|
||||
void onFail(int code, String msg);
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.network;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
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.taxi.passenger.bean.TaxiPassengerAllStarWorld;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerBaseRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerCheckPhoneUpdateOrderReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRemainingResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerQueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerScoreUpdateOrderReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerStartReqBean;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
public class TaxiPassengerServiceManager {
|
||||
private static final String TAG = TaxiPassengerServiceManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiPassengerServiceManager INSTANCE = new TaxiPassengerServiceManager();
|
||||
}
|
||||
|
||||
public static TaxiPassengerServiceManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private TaxiPassengerServiceApi mOCHTaxiServiceApi;
|
||||
|
||||
private TaxiPassengerServiceManager() {
|
||||
if (mOCHTaxiServiceApi == null){
|
||||
mOCHTaxiServiceApi = MoGoRetrofitFactory.getInstance(TaxiPassengerConst.getBaseUrl()).create(TaxiPassengerServiceApi.class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取司机端的sn
|
||||
* @return
|
||||
*/
|
||||
private String getDriverAppSn(){
|
||||
return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单列表
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrdersInAndWaitService(Context context,
|
||||
TaxiPassengerServiceCallback<TaxiPassengerOrdersInServiceQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrdersInAndWaitService(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,getDriverAppSn()) //获取到司机端的sn
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrdersInAndWaitService"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单剩余里程和时间
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrderRemaining(Context context, String orderNo, TaxiPassengerServiceCallback<TaxiPassengerOrderQueryRemainingResp> callback){
|
||||
mOCHTaxiServiceApi.queryOrderRemaining(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,orderNo)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderRemaining"));
|
||||
}
|
||||
|
||||
public void queryOrderRouteList(Context context, String orderNo, TaxiPassengerServiceCallback<TaxiPassengerQueryOrderRouteResp> callback){
|
||||
|
||||
mOCHTaxiServiceApi.queryOrderRoute(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,orderNo)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderRouteList"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
*/
|
||||
public void queryOrderById(Context context, String orderNo,
|
||||
TaxiPassengerServiceCallback<TaxiPassengerOrderQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrderById(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiPassengerOrderQueryReqBean(getDriverAppSn(), orderNo))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderById"));
|
||||
}
|
||||
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
|
||||
Context context, TaxiPassengerServiceCallback<T> callback, String apiName) {
|
||||
return new SubscribeImpl<T>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(T o) {
|
||||
super.onSuccess(o);
|
||||
CallerLogger.INSTANCE.e(M_TAXI_P + TAG,apiName + ": onSuccess() " + o.msg);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
CallerLogger.INSTANCE.e(M_TAXI_P + TAG,apiName + ": onError() " + e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
CallerLogger.INSTANCE.e(M_TAXI_P + TAG,String.format(apiName + ": onError() code = %d; message = %s;", code, message));
|
||||
if (callback != null) {
|
||||
callback.onFail(code, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void checkPhoneAndUpdateOrderStatus(Context context, String orderNo,String phone ,TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
|
||||
|
||||
mOCHTaxiServiceApi.checkPhoneAndUpdateOrderStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiPassengerCheckPhoneUpdateOrderReqBean(orderNo,phone))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"));
|
||||
}
|
||||
public void arrivedAndScore(Context context,TaxiPassengerScoreUpdateOrderReqBean taxiPassengerScoreUpdateOrderReqBean, TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.arrivedAndScore(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,taxiPassengerScoreUpdateOrderReqBean)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"));
|
||||
}
|
||||
|
||||
public void getAllScoreWorld(Context context,TaxiPassengerServiceCallback<TaxiPassengerAllStarWorld> callback){
|
||||
mOCHTaxiServiceApi.getWorldAllStar(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "arrivedAndScore"));
|
||||
}
|
||||
|
||||
public void queryPilotStatus(Context context, String orderNo
|
||||
,TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.queryPilotStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,orderNo)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryPilotStatus"));
|
||||
}
|
||||
|
||||
public void startServicePilotDone(Context context,String orderNo,TaxiPassengerStartReqBean.Result loc
|
||||
,TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.startServicePilotDone(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiPassengerStartReqBean(getDriverAppSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"startServicePilotDone"));
|
||||
}
|
||||
public void getWorldByStar(Context context,String start,TaxiPassengerServiceCallback<TaxiPassengerAllStarWorld> callback){
|
||||
mOCHTaxiServiceApi.getWorldByStar(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),start)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.mogo.och.taxi.passenger.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst.Companion.getBaseUrl
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRemainingResp
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerQueryOrderRouteResp
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryReqBean
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerBaseRespBean
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerCheckPhoneUpdateOrderReqBean
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerScoreUpdateOrderReqBean
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerAllStarWorld
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerStartReqBean
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
object TaxiPassengerServiceManager {
|
||||
|
||||
private val mOCHTaxiServiceApi: TaxiPassengerServiceApi = MoGoRetrofitFactory.getInstance(getBaseUrl()).create(
|
||||
TaxiPassengerServiceApi::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取司机端的sn
|
||||
* @return
|
||||
*/
|
||||
private val driverAppSn: String
|
||||
get() = getServerToken()
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单列表
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrdersInAndWaitService(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerOrdersInServiceQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrdersInAndWaitService(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
driverAppSn
|
||||
) //获取到司机端的sn
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrdersInAndWaitService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单剩余里程和时间
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderRemaining(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerOrderQueryRemainingResp>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderRemaining(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderRemaining"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryOrderRouteList(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerQueryOrderRouteResp>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderRouteList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
@Deprecated("v2.1_0930需求中暂不再使用此接口")
|
||||
fun queryOrderById(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerOrderQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderById(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiPassengerOrderQueryReqBean(driverAppSn, orderNo)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderById"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun checkPhoneAndUpdateOrderStatus(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
phone: String?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.checkPhoneAndUpdateOrderStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiPassengerCheckPhoneUpdateOrderReqBean(orderNo, phone)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun arrivedAndScore(
|
||||
context: Context,
|
||||
taxiPassengerScoreUpdateOrderReqBean: TaxiPassengerScoreUpdateOrderReqBean?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.arrivedAndScore(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
taxiPassengerScoreUpdateOrderReqBean
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun getAllScoreWorld(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerAllStarWorld>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.getWorldAllStar(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arrivedAndScore"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryPilotStatus(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryPilotStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryPilotStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun startServicePilotDone(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiPassengerStartReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.startServicePilotDone(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiPassengerStartReqBean(
|
||||
driverAppSn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "startServicePilotDone"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun getWorldByStar(
|
||||
context: Context,
|
||||
start: String?,
|
||||
callback: OchCommonServiceCallback<TaxiPassengerAllStarWorld>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.getWorldByStar(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
start
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
});
|
||||
TaxiPassengerModel.getInstance().recoverNaviInfo();
|
||||
TaxiPassengerGeocodeSearchModel.getInstance(getContext()).destroyGeocodeSearch();
|
||||
TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotoop(false);
|
||||
TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotLoop(false);
|
||||
return;
|
||||
}
|
||||
// 20 司机到达上车点
|
||||
@@ -194,7 +194,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
mView.showOrHideStartAutopilotView(false,false);
|
||||
mView.showOrHideServingOrderFragment(true,true);
|
||||
});
|
||||
TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotoop(false);
|
||||
TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotLoop(false);
|
||||
}
|
||||
// 30 用户到达上车点 并通过了手机号后四位验证
|
||||
// 40 服务中
|
||||
|
||||
@@ -81,6 +81,11 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
||||
runOnUIThread(() ->mView.routeResultByServer(models,haveArrivedIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showRottingMapView() {
|
||||
runOnUIThread(() ->mView.showRottingMapView());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
|
||||
@@ -103,7 +103,7 @@ class TaxiPassengerCheckView :RelativeLayout, View.OnClickListener {
|
||||
R.id.tv_taxi_passenger_number_second -> {selectIndex(1)}
|
||||
R.id.tv_taxi_passenger_number_third -> {selectIndex(2)}
|
||||
R.id.tv_taxi_passenger_number_fourth -> {selectIndex(3)}
|
||||
R.id.tv_taxi_passenger_number_submit -> {checkAndCommit()}
|
||||
R.id.tv_taxi_passenger_number_submit -> {clearNumber()}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
@@ -130,9 +130,27 @@ class TaxiPassengerCheckView :RelativeLayout, View.OnClickListener {
|
||||
index++
|
||||
}
|
||||
changeStyle()
|
||||
numSelect.forEach {
|
||||
if(it==null){
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
checkAndCommit()
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearNumber(){
|
||||
for(i in numSelect.indices){
|
||||
numSelect[i] = null
|
||||
}
|
||||
numSelectTextView.forEach {
|
||||
it?.text = ""
|
||||
}
|
||||
index = 0
|
||||
changeStyle()
|
||||
}
|
||||
|
||||
private fun deleteNumver() {
|
||||
if (index in 0..3) {
|
||||
if(numSelect[index]==null){
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.map.CommonAmapNaviVIew;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
@@ -63,7 +65,9 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
private TextView mTPOrderRemainArriveTime;
|
||||
private ImageView mMapArrowIcon;
|
||||
|
||||
private TaxiPassengerMapDirectionView mMapDirectionView;
|
||||
private TaxiPassengerMapDirectionView mMapRottingView;
|
||||
private CommonAmapNaviVIew mAmapNaviVIew;
|
||||
|
||||
private float lastBearing = 0;
|
||||
private RotateAnimation rotateAnimation;
|
||||
|
||||
@@ -130,9 +134,20 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mMapDirectionView = mRootView.findViewById(R.id.taxi_p_order_map_view);
|
||||
mMapDirectionView.onCreateView(savedInstanceState);
|
||||
mMapDirectionView.setTaxiPassengerMapViewCallback(this);
|
||||
initRouteNaviView(savedInstanceState);
|
||||
initAmapNaviView(savedInstanceState);
|
||||
}
|
||||
|
||||
private void initAmapNaviView(Bundle savedInstanceState) {
|
||||
mAmapNaviVIew = mRootView.findViewById(R.id.taxi_p_order_amap_navi_view);
|
||||
mAmapNaviVIew.onCreate(savedInstanceState);
|
||||
TaxiPassengerModel.getInstance().startNaviByAmap();
|
||||
}
|
||||
|
||||
private void initRouteNaviView(Bundle savedInstanceState) {
|
||||
mMapRottingView = mRootView.findViewById(R.id.taxi_p_order_rotting_map_view);
|
||||
mMapRottingView.onCreateView(savedInstanceState);
|
||||
mMapRottingView.setTaxiPassengerMapViewCallback(this);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -174,8 +189,11 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.onResume();
|
||||
if (mMapRottingView != null) {
|
||||
mMapRottingView.onResume();
|
||||
}
|
||||
if (mAmapNaviVIew != null){
|
||||
mAmapNaviVIew.onResume();
|
||||
}
|
||||
TaxiPassengerModel.getInstance().initGeocodeSearch();
|
||||
}
|
||||
@@ -196,29 +214,44 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.onPause();
|
||||
if (mMapRottingView != null) {
|
||||
mMapRottingView.onPause();
|
||||
}
|
||||
if (mAmapNaviVIew != null){
|
||||
mAmapNaviVIew.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.onDestroy();
|
||||
if (mMapRottingView != null) {
|
||||
mMapRottingView.onDestroy();
|
||||
}
|
||||
if (mAmapNaviVIew != null){
|
||||
mAmapNaviVIew.onDestroy();
|
||||
}
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
TaxiPassengerModel.getInstance().destoryGeocodeSearch();
|
||||
}
|
||||
|
||||
public void showRottingMapView(){
|
||||
if (mAmapNaviVIew != null && mAmapNaviVIew.getVisibility() == View.VISIBLE){
|
||||
mAmapNaviVIew.setVisibility(View.GONE);
|
||||
}
|
||||
if (mMapRottingView != null && mMapRottingView.getVisibility() == View.GONE){
|
||||
mMapRottingView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLineMarker(List<LatLng> latLngList){
|
||||
if (latLngList.size() > 0) {
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.setCoordinatesLatLng(latLngList);
|
||||
if (mMapRottingView != null) {
|
||||
mMapRottingView.setCoordinatesLatLng(latLngList);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.setLineMarker();
|
||||
mMapRottingView.setLineMarker();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -236,22 +269,22 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
}
|
||||
|
||||
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng,int haveArrivedIndex){
|
||||
if (mMapDirectionView != null){
|
||||
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
|
||||
if (mMapRottingView != null){
|
||||
mMapRottingView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.drawablePolyline();
|
||||
mMapRottingView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private void clearPolyline() {
|
||||
if (mMapDirectionView != null) {
|
||||
if (mMapRottingView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearPolyline();
|
||||
mMapRottingView.clearPolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerAllStarWorld
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerScoreUpdateOrderReqBean
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerScoreCallback
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager
|
||||
import com.mogo.och.taxi.passenger.ui.comment.adapter.CommentAdapter
|
||||
import com.mogo.och.taxi.passenger.widget.ResizeAnimation
|
||||
@@ -412,8 +412,8 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
|
||||
}
|
||||
|
||||
private fun requestStarWord() {
|
||||
TaxiPassengerServiceManager.getInstance().getAllScoreWorld(context,
|
||||
object : TaxiPassengerServiceCallback<TaxiPassengerAllStarWorld?> {
|
||||
TaxiPassengerServiceManager.getAllScoreWorld(context,
|
||||
object : OchCommonServiceCallback<TaxiPassengerAllStarWorld> {
|
||||
override fun onError() {
|
||||
CallerLogger.e(
|
||||
SceneConstant.M_TAXI_P + TAG,
|
||||
@@ -436,8 +436,8 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
|
||||
}
|
||||
|
||||
private fun requestStarWordByStar(start:Int) {
|
||||
TaxiPassengerServiceManager.getInstance().getWorldByStar(context,start.toString(),
|
||||
object : TaxiPassengerServiceCallback<TaxiPassengerAllStarWorld?> {
|
||||
TaxiPassengerServiceManager.getWorldByStar(context,start.toString(),
|
||||
object : OchCommonServiceCallback<TaxiPassengerAllStarWorld> {
|
||||
override fun onError() {
|
||||
CallerLogger.e(
|
||||
SceneConstant.M_TAXI_P + TAG,
|
||||
|
||||
@@ -13,14 +13,10 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
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.BarUtils
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst
|
||||
import com.mogo.och.taxi.passenger.event.FinishActivity
|
||||
import com.mogo.och.taxi.passenger.mulprocess.ICallback
|
||||
import com.mogo.och.taxi.passenger.ui.leftmenu.LeftMenuOpen
|
||||
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils
|
||||
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselLayoutManager
|
||||
@@ -41,7 +37,6 @@ import rx.Observer
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import java.util.Calendar
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.math.floor
|
||||
@@ -49,18 +44,18 @@ import kotlin.math.floor
|
||||
|
||||
class VideoActivity : AppCompatActivity() {
|
||||
|
||||
private var rvVideoPlaylist: RecyclerView?=null
|
||||
private var rvVideoPlaylist: RecyclerView? = null
|
||||
private lateinit var indicatorView: IndicatorView
|
||||
private lateinit var clContain: ConstraintLayout
|
||||
private lateinit var acivTitleIcon: AppCompatImageView
|
||||
private lateinit var tvTitle: TextView
|
||||
private var subscribe: Subscription?=null
|
||||
private var subscribe: Subscription? = null
|
||||
private val TAG = "mulprocessVideoActivity"
|
||||
|
||||
private val arrayListOf = ArrayList<TaxiPassengerVideoPlay>()
|
||||
|
||||
|
||||
companion object{
|
||||
companion object {
|
||||
const val VIDEOTYPE = "VIDEOTYPE"
|
||||
const val VIDEOTYPE_CONSULT = 0
|
||||
const val VIDEOTYPE_MOIES = 1
|
||||
@@ -68,10 +63,10 @@ class VideoActivity : AppCompatActivity() {
|
||||
|
||||
const val EVENT_FINISH = 0
|
||||
|
||||
fun startActivity(context:Context,videoType:Int,sumDis:Int){
|
||||
fun startActivity(context: Context, videoType: Int, sumDis: Int) {
|
||||
val intent = Intent(context, VideoActivity::class.java)
|
||||
intent.putExtra(VIDEOTYPE, videoType)
|
||||
intent.putExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,sumDis)
|
||||
intent.putExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, sumDis)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
@@ -114,7 +109,7 @@ class VideoActivity : AppCompatActivity() {
|
||||
LeftMenuOpen.registerCallback(LeftMenuOpen.callBack)
|
||||
}
|
||||
|
||||
private fun initConsultData(){
|
||||
private fun initConsultData() {
|
||||
arrayListOf.clear()
|
||||
arrayListOf.add(
|
||||
TaxiPassengerVideoPlay(
|
||||
@@ -238,7 +233,7 @@ class VideoActivity : AppCompatActivity() {
|
||||
}
|
||||
indicatorView.onPageScrolled(currentIndex, fl, 0)
|
||||
}
|
||||
val recyclerVideoAdapter = RecyclerVideoAdapter(this, arrayListOf,rvVideoPlaylist)
|
||||
val recyclerVideoAdapter = RecyclerVideoAdapter(this, arrayListOf, rvVideoPlaylist)
|
||||
recyclerVideoAdapter.setOnThumbImageClilckListener {
|
||||
val (_: Int, player) = getPlayer(carouselLayoutManager)
|
||||
if (player is ConsultVideoPlayer) {
|
||||
@@ -280,24 +275,31 @@ class VideoActivity : AppCompatActivity() {
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
when (videotype){
|
||||
when (videotype) {
|
||||
VIDEOTYPE_CONSULT -> {
|
||||
OverlayLeftViewUtils.showOverlayView(this,isOpen = false, checkIndex = OverlayLeftViewUtils.CONSULT)
|
||||
OverlayLeftViewUtils.showOverlayView(
|
||||
this,
|
||||
isOpen = false,
|
||||
checkIndex = OverlayLeftViewUtils.CONSULT
|
||||
)
|
||||
}
|
||||
VIDEOTYPE_MOIES -> {
|
||||
OverlayLeftViewUtils.showOverlayView(this,isOpen = false, checkIndex = OverlayLeftViewUtils.MOVIE)
|
||||
OverlayLeftViewUtils.showOverlayView(
|
||||
this,
|
||||
isOpen = false,
|
||||
checkIndex = OverlayLeftViewUtils.MOVIE
|
||||
)
|
||||
}
|
||||
}
|
||||
val sumDis = intent.getIntExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, 0)
|
||||
FloatingDistanceInfoUtils.showOverlayView(this,sumDis=sumDis)
|
||||
FloatingDistanceInfoUtils.showOverlayView(this, sumDis = sumDis)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
BarUtils.setNavBarVisibility(window,false)
|
||||
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
|
||||
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
|
||||
if(centerItemPosition<0){
|
||||
if (centerItemPosition < 0) {
|
||||
setBackageAndPlayNext(arrayListOf[0])
|
||||
}
|
||||
player?.let {
|
||||
@@ -325,12 +327,20 @@ class VideoActivity : AppCompatActivity() {
|
||||
override fun onError(e: Throwable?) {}
|
||||
override fun onNext(t: Long?) {
|
||||
if (!OverlayLeftViewUtils.getStatus()) {
|
||||
when (videotype){
|
||||
when (videotype) {
|
||||
VIDEOTYPE_CONSULT -> {
|
||||
OverlayLeftViewUtils.showOverlayView(this@VideoActivity,isOpen = false, checkIndex = OverlayLeftViewUtils.CONSULT)
|
||||
OverlayLeftViewUtils.showOverlayView(
|
||||
this@VideoActivity,
|
||||
isOpen = false,
|
||||
checkIndex = OverlayLeftViewUtils.CONSULT
|
||||
)
|
||||
}
|
||||
VIDEOTYPE_MOIES -> {
|
||||
OverlayLeftViewUtils.showOverlayView(this@VideoActivity,isOpen = false, checkIndex = OverlayLeftViewUtils.MOVIE)
|
||||
OverlayLeftViewUtils.showOverlayView(
|
||||
this@VideoActivity,
|
||||
isOpen = false,
|
||||
checkIndex = OverlayLeftViewUtils.MOVIE
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,7 +366,7 @@ class VideoActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun finishActivity(event: FinishActivity){
|
||||
fun finishActivity(event: FinishActivity) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "finishActivity(event)")
|
||||
cancleSubscribe()
|
||||
val intent = Intent()
|
||||
@@ -379,21 +389,21 @@ class VideoActivity : AppCompatActivity() {
|
||||
cancleSubscribe()
|
||||
}
|
||||
|
||||
private fun cancleSubscribe(){
|
||||
private fun cancleSubscribe() {
|
||||
subscribe?.let {
|
||||
if(!it.isUnsubscribed){
|
||||
if (!it.isUnsubscribed) {
|
||||
it.unsubscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun releaseOnNewInstance() {
|
||||
if (rvVideoPlaylist!=null&&rvVideoPlaylist?.layoutManager != null) {
|
||||
if (rvVideoPlaylist != null && rvVideoPlaylist?.layoutManager != null) {
|
||||
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
|
||||
val (_: Int, player) = getPlayer(carouselLayoutManager)
|
||||
player?.let {
|
||||
player.currentPlayer.release()
|
||||
player.onVideoReset()
|
||||
player.currentPlayer.release()
|
||||
player.onVideoReset()
|
||||
}
|
||||
}
|
||||
FullVideoUtils.dismissOverlayView(true)
|
||||
|
||||
@@ -35,6 +35,8 @@ public class TaxiPassengerAnalyticsManager {
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_RESULT, false);
|
||||
mStartAutopilotParams.put(TaxiPassengerConst.EVENT_PARAM_START_FAILURE_MSG,
|
||||
"15s后app等待超时");
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
};
|
||||
|
||||
@@ -74,4 +76,31 @@ public class TaxiPassengerAnalyticsManager {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, TaxiPassengerConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发"无法开启自驾已知异常"埋点
|
||||
* @param startName
|
||||
* @param endName
|
||||
* @param orderNo
|
||||
*/
|
||||
public void triggerUnableStartAPReasonEvent(String startName, String endName, String orderNo,
|
||||
String reason) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_SN, sn);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
|
||||
params.put(TaxiPassengerConst.EVENT_PARAM_UNABLE_START_REASON, reason);
|
||||
AnalyticsManager.INSTANCE.track(TaxiPassengerConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,15 +257,30 @@
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerMapDirectionView
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/taxi_p_order_map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/taxi_p_order_map_height"
|
||||
android:background="@color/taxi_p_map_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/taxi_p_order_remain"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
app:layout_constraintLeft_toLeftOf="parent" >
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerMapDirectionView
|
||||
android:id="@+id/taxi_p_order_rotting_map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/taxi_p_order_map_height"
|
||||
android:visibility="gone"
|
||||
android:background="@color/taxi_p_map_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<com.mogo.och.common.module.map.CommonAmapNaviVIew
|
||||
android:id="@+id/taxi_p_order_amap_navi_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/taxi_p_order_map_height"
|
||||
android:background="@color/taxi_p_map_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
android:layout_marginTop="@dimen/dp_14"
|
||||
tools:text="蘑菇 3291号为您服务"
|
||||
android:textColor="@color/taxi_p_check_keyboard_samll_mogo_color"
|
||||
android:textSize="@dimen/dp_24"
|
||||
android:textSize="24px"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_small_mogo"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_small_mogo" />
|
||||
|
||||
@@ -198,12 +198,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_84"
|
||||
android:layout_marginTop="@dimen/dp_129"
|
||||
android:layout_marginTop="308px"
|
||||
android:text="@string/taxi_p_check_input_phone_tail_title"
|
||||
android:textColor="@color/taxi_p_check_keyboard_samll_mogo_color"
|
||||
android:textSize="@dimen/sp_36"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_taxi_number" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<TextView
|
||||
@@ -246,11 +246,12 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_nine"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_98"
|
||||
android:id="@+id/tv_taxi_passenger_number_back"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:layout_marginBottom="@dimen/dp_80"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:text="9"
|
||||
android:text="@string/tv_delete"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_zero"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
@@ -258,81 +259,87 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_zero"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:text="0"
|
||||
style="@style/och_check_number_keyboard"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_back"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_nine"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_nine" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_back"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:background="@drawable/bg_taxi_p_keyboard_background"
|
||||
android:text="@string/tv_delete"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:textSize="@dimen/sp_36"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_submit"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_zero"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_nine" />
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_back"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_submit"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:background="@drawable/bg_taxi_p_keyboard_submit_background"
|
||||
android:text="确定"
|
||||
android:textColor="@color/taxi_autopilot_text_color_normal"
|
||||
android:text="清空"
|
||||
android:textSize="@dimen/sp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_back"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_nine" />
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_zero"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_back" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_five"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_30"
|
||||
android:text="5"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_taxi_passenger_number_nine"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_six"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_six"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:text="6"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_seven"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_five"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_five" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_seven"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:background="@drawable/bg_taxi_p_keyboard_background"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:layout_marginBottom="24px"
|
||||
android:text="7"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_taxi_passenger_number_back"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_eight"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_six"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_five" />
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_eight"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:text="8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_nine"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_seven"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_five" />
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_seven" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_nine"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:text="9"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_eight"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_seven" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_four"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:layout_marginBottom="24px"
|
||||
android:text="4"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_taxi_passenger_number_seven"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_five"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_five"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:text="5"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_six"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_four"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_four" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_six"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:text="6"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_five"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_four" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_one"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:layout_marginBottom="24px"
|
||||
android:text="1"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_taxi_passenger_number_five"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_taxi_passenger_number_four"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_two"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
@@ -340,7 +347,7 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_two"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_39"
|
||||
android:text="2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_three"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_one"
|
||||
@@ -349,18 +356,9 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_three"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:text="3"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_taxi_passenger_number_four"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_two"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_one" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_taxi_passenger_number_four"
|
||||
style="@style/och_check_number_keyboard"
|
||||
android:text="4"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_three"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_taxi_passenger_number_two"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_taxi_passenger_number_one" />
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</style>
|
||||
|
||||
<style name="och_check_number_keyboard">
|
||||
<item name="android:layout_width">@dimen/dp_150</item>
|
||||
<item name="android:layout_width">@dimen/dp_212</item>
|
||||
<item name="android:layout_height">@dimen/dp_80</item>
|
||||
<item name="android:background">@drawable/bg_taxi_p_keyboard_background</item>
|
||||
<item name="android:gravity">center</item>
|
||||
|
||||
BIN
OCH/mogo-och-taxi/src/main/assets/map_style.data
Normal file
BIN
OCH/mogo-och-taxi/src/main/assets/map_style_extra.data
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface IOCHTaxiAutopilotPlanningCallback {
|
||||
void setLineMarker(List<LatLng> models);
|
||||
void routeResult(List<LatLng> models, int haveArrivedIndex);
|
||||
}
|
||||
@@ -20,4 +20,7 @@ public interface ITaxiADASStatusCallback {
|
||||
|
||||
//人机共驾
|
||||
void onManMachineCoDriving();
|
||||
|
||||
//自驾返回失败
|
||||
void onStartAdasFailure();
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface ITaxiAutopilotPlanningCallback {
|
||||
void routeResult(List<MessagePad.Location> models);
|
||||
}
|
||||
@@ -48,4 +48,11 @@ public interface ITaxiOrderStatusCallback {
|
||||
|
||||
// 司机已确认开启自动驾驶环境
|
||||
void onDriverHasCheckedPilotCondition(boolean isSafe);
|
||||
|
||||
/**
|
||||
* 导航到目的地
|
||||
* @param isAmap 是否是高德导航
|
||||
* @param isShow 是否显示导航地图(否播报声音)
|
||||
*/
|
||||
void onNaviToEnd(boolean isAmap, boolean isShow);
|
||||
}
|
||||
|
||||
@@ -65,8 +65,12 @@ class TaxiConst {
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_ORDER_NUMBER = "order_num"
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
|
||||
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境:true/false
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_taxi_ap_unable_start_reason"
|
||||
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
|
||||
|
||||
// 实时计算当前剩余里程和时间 间隔 2秒
|
||||
const val LOOP_CALCULATEROUTE_2S = 2 * 1000L
|
||||
|
||||
@@ -31,12 +31,16 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
@@ -53,6 +57,7 @@ import com.mogo.och.taxi.bean.OrdersNewBookingQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.QueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.bean.TaxiDataBaseRespBean;
|
||||
import com.mogo.och.taxi.bean.TaxiOrPassengerReadyReqBean;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiCarStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback;
|
||||
@@ -61,7 +66,6 @@ import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderTypeEnum;
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager;
|
||||
import com.mogo.och.taxi.network.TaxiServiceCallback;
|
||||
import com.mogo.och.taxi.network.TaxiServiceManager;
|
||||
import com.mogo.och.taxi.utils.TaxiAnalyticsManager;
|
||||
import com.mogo.och.taxi.utils.OrderUtil;
|
||||
@@ -116,6 +120,7 @@ public class TaxiModel {
|
||||
private ITaxiCarStatusCallback mCarStatusCallback; //Model->Presenter:接单状态、登录状态和司机今日接单状态
|
||||
private ITaxiControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private ITaxiOrderStatusCallback mOrderStatusCallback; //Model->Presenter:订单变更
|
||||
private IOCHTaxiAutopilotPlanningCallback mAutopilotPlanningCallback;
|
||||
|
||||
private volatile boolean isRestartAutopilot = false;
|
||||
|
||||
@@ -128,6 +133,11 @@ public class TaxiModel {
|
||||
private TaxiModel() {
|
||||
}
|
||||
|
||||
public void setMoGoAutopilotPlanningListener(IOCHTaxiAutopilotPlanningCallback
|
||||
moGoAutopilotPlanningCallback) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback;
|
||||
}
|
||||
|
||||
public void setADASStatusCallback(ITaxiADASStatusCallback callback) {
|
||||
this.mADASStatusCallback = callback;
|
||||
}
|
||||
@@ -223,6 +233,9 @@ public class TaxiModel {
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
@@ -242,6 +255,7 @@ public class TaxiModel {
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null);
|
||||
}
|
||||
|
||||
public void startOrStopOrderLoop(boolean start) {
|
||||
@@ -263,8 +277,8 @@ public class TaxiModel {
|
||||
loginService.queryLoginStatusByNet();
|
||||
return;
|
||||
}
|
||||
TaxiServiceManager.getInstance().changeOrderServing(mContext,TaxtServingStatusManager.isOpeningOrderStatus(),
|
||||
new TaxiServiceCallback<BaseData>() {
|
||||
TaxiServiceManager.changeOrderServing(mContext,TaxtServingStatusManager.isOpeningOrderStatus(),
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
if (null != data && 0 == data.code) {
|
||||
@@ -296,8 +310,8 @@ public class TaxiModel {
|
||||
* 才更新最新进行中单到本地
|
||||
*/
|
||||
public void queryInAndWaitOrders() {
|
||||
TaxiServiceManager.getInstance().queryOrdersInAndWaitService(mContext,
|
||||
new TaxiServiceCallback<OrdersInServiceQueryRespBean>() {
|
||||
TaxiServiceManager.queryOrdersInAndWaitService(mContext,
|
||||
new OchCommonServiceCallback<OrdersInServiceQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrdersInServiceQueryRespBean data) {
|
||||
if (data == null || data.data == null) {
|
||||
@@ -372,8 +386,8 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
final String orderNo = mCurrentOCHOrder.orderNo;
|
||||
TaxiServiceManager.getInstance().queryOrderById(mContext, orderNo,
|
||||
new TaxiServiceCallback<OrderQueryRespBean>() {
|
||||
TaxiServiceManager.queryOrderById(mContext, orderNo,
|
||||
new OchCommonServiceCallback<OrderQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrderQueryRespBean data) {
|
||||
if (data != null && data.data != null
|
||||
@@ -406,8 +420,8 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
final String orderNo = mCurrentOCHOrder.orderNo;
|
||||
TaxiServiceManager.getInstance().cancelOrder(mContext, orderNo, reasonType, reason,
|
||||
new TaxiServiceCallback<BaseData>() {
|
||||
TaxiServiceManager.cancelOrder(mContext, orderNo, reasonType, reason,
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
if (null != data && 0 == data.code
|
||||
@@ -438,8 +452,8 @@ public class TaxiModel {
|
||||
|
||||
// 取消待服务中订单
|
||||
public void cancelOrderById(final String orderNo, int reasonType, String reason) {
|
||||
TaxiServiceManager.getInstance().cancelOrder(mContext, orderNo, reasonType, reason,
|
||||
new TaxiServiceCallback<BaseData>() {
|
||||
TaxiServiceManager.cancelOrder(mContext, orderNo, reasonType, reason,
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
if (null != data && 0 == data.code) {
|
||||
@@ -471,8 +485,8 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
final String orderNo = mCurrentOCHOrder.orderNo;
|
||||
TaxiServiceManager.getInstance().queryOrderRouteInfo(mContext, orderNo,
|
||||
new TaxiServiceCallback<OrderQueryRouteInfoRespBean>() {
|
||||
TaxiServiceManager.queryOrderRouteInfo(mContext, orderNo,
|
||||
new OchCommonServiceCallback<OrderQueryRouteInfoRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrderQueryRouteInfoRespBean data) {
|
||||
if (null != data && 0 == data.code
|
||||
@@ -492,8 +506,8 @@ public class TaxiModel {
|
||||
|
||||
// 获取全部订单列表
|
||||
public void queryOrdersList(int page, int size) {
|
||||
TaxiServiceManager.getInstance().queryOrdersList(mContext, page, size,
|
||||
new TaxiServiceCallback<OrdersListQueryRespBean>() {
|
||||
TaxiServiceManager.queryOrdersList(mContext, page, size,
|
||||
new OchCommonServiceCallback<OrdersListQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrdersListQueryRespBean data) {
|
||||
if (null != data && 0 == data.code) {
|
||||
@@ -525,8 +539,8 @@ public class TaxiModel {
|
||||
* 注:只有在本地缓存mNewBookingOrder为null时(执行完抢单or司机关闭改单),才更新新到待抢单
|
||||
*/
|
||||
public void queryNewBookingOrder() {
|
||||
TaxiServiceManager.getInstance().queryNewBookingOrder(mContext,
|
||||
new TaxiServiceCallback<OrdersNewBookingQueryRespBean>() {
|
||||
TaxiServiceManager.queryNewBookingOrder(mContext,
|
||||
new OchCommonServiceCallback<OrdersNewBookingQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrdersNewBookingQueryRespBean data) {
|
||||
if (data != null && data.code == 0
|
||||
@@ -553,8 +567,8 @@ public class TaxiModel {
|
||||
|
||||
// 仅限于获取到新待抢单且需要展示时查询该单信息:(queryOrderById接口可以查询属于该车的单、未派的单)
|
||||
private void queryNewBookingContent(final String orderNo) {
|
||||
TaxiServiceManager.getInstance().queryOrderById(mContext, orderNo,
|
||||
new TaxiServiceCallback<OrderQueryRespBean>() {
|
||||
TaxiServiceManager.queryOrderById(mContext, orderNo,
|
||||
new OchCommonServiceCallback<OrderQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrderQueryRespBean data) {
|
||||
if (data != null && data.code == 0
|
||||
@@ -584,8 +598,8 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
final String orderNo = mNewBookingOrder.orderNo;
|
||||
TaxiServiceManager.getInstance().grabOrder(mContext, orderNo,
|
||||
new TaxiServiceCallback<OrderGrabRespBean>() {
|
||||
TaxiServiceManager.grabOrder(mContext, orderNo,
|
||||
new OchCommonServiceCallback<OrderGrabRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrderGrabRespBean data) {
|
||||
if (data != null && data.code == 0
|
||||
@@ -623,8 +637,8 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
final String orderNo = mNewBookingOrder.orderNo;
|
||||
TaxiServiceManager.getInstance().queryOrderGrabStatus(mContext, orderNo,
|
||||
new TaxiServiceCallback<OrderGrabStatusQueryRespBean>() {
|
||||
TaxiServiceManager.queryOrderGrabStatus(mContext, orderNo,
|
||||
new OchCommonServiceCallback<OrderGrabStatusQueryRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(OrderGrabStatusQueryRespBean data) {
|
||||
//TaxiModelLoopManager.getInstance().stopGrabResultLoop();
|
||||
@@ -662,8 +676,8 @@ public class TaxiModel {
|
||||
|
||||
// 车机端上传心跳数据(只在出车状态时上传)
|
||||
public void runCarHeartbeat() {
|
||||
TaxiServiceManager.getInstance().runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
new TaxiServiceCallback<BaseData>() {
|
||||
TaxiServiceManager.runCarHeartbeat(mContext, mLongitude, mLatitude,
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
|
||||
@@ -678,8 +692,8 @@ public class TaxiModel {
|
||||
|
||||
// 查询司机服务数据
|
||||
public void queryDriverServiceData() {
|
||||
TaxiServiceManager.getInstance().queryDriverServiceData(mContext,
|
||||
new TaxiServiceCallback<DriverServiceDataRespBean>() {
|
||||
TaxiServiceManager.queryDriverServiceData(mContext,
|
||||
new OchCommonServiceCallback<DriverServiceDataRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(DriverServiceDataRespBean data) {
|
||||
if (data != null && data.code == 0
|
||||
@@ -715,10 +729,10 @@ public class TaxiModel {
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiServiceManager.getInstance().confirmAutopilotConditionByDriver(mContext,
|
||||
TaxiServiceManager.confirmAutopilotConditionByDriver(mContext,
|
||||
mCurrentOCHOrder.orderNo,
|
||||
result,
|
||||
new TaxiServiceCallback<TaxiDataBaseRespBean>(){
|
||||
new OchCommonServiceCallback<TaxiDataBaseRespBean>(){
|
||||
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
@@ -746,8 +760,8 @@ public class TaxiModel {
|
||||
|
||||
public void queryAutopilotStatus(){
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiServiceManager.getInstance().queryAutopilotStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
new TaxiServiceCallback<TaxiDataBaseRespBean>() {
|
||||
TaxiServiceManager.queryAutopilotStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
if (data != null && data.code == 0)
|
||||
@@ -803,6 +817,7 @@ public class TaxiModel {
|
||||
}
|
||||
if (mCurrentOCHOrder.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.getCode()){
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "setIPCDemoMode:false");
|
||||
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
|
||||
}
|
||||
|
||||
@@ -877,6 +892,9 @@ public class TaxiModel {
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){
|
||||
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
|
||||
", 请稍候重试");
|
||||
TaxiAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
mCurrentOCHOrder.startSiteAddr, mCurrentOCHOrder.endSiteAddr, mCurrentOCHOrder.orderNo,
|
||||
OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -995,6 +1013,17 @@ public class TaxiModel {
|
||||
}
|
||||
};
|
||||
|
||||
private final OchAdasStartFailureCallback mAdasStartFailureListener = new OchAdasStartFailureCallback() {
|
||||
@Override
|
||||
public void onStartAutopilotFailure(@NonNull String startFailedMessage) {
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotFailureEventByAdas(startFailedMessage);
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode){
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "mAdasStartFailureListener = "+startFailedMessage);
|
||||
mADASStatusCallback.onStartAdasFailure();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final IMogoStatusChangedListener mMogoStatusChangedListener = new IMogoStatusChangedListener() {
|
||||
// VR mode变更回调
|
||||
@Override
|
||||
@@ -1239,12 +1268,25 @@ public class TaxiModel {
|
||||
}
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0) {
|
||||
updateOrderRoute(routeList.getWayPointsList());
|
||||
// setRouteLineMarker(routeList.getWayPointsList());
|
||||
updateOrderRouteInfo(routeList.getWayPointsList());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置路径规划起终点
|
||||
* @param latLngModels
|
||||
*/
|
||||
public void setRouteLineMarker(List<LatLng> latLngModels) {
|
||||
// List<LatLng> latLngModels = CoordinateCalculateRouteUtil
|
||||
// .coordinateConverterWgsToGcjListCommon(mContext,models);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.setLineMarker(latLngModels);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报订单全路径规划数据
|
||||
*
|
||||
@@ -1253,8 +1295,8 @@ public class TaxiModel {
|
||||
public void updateOrderRoute(List<MessagePad.Location> models) {
|
||||
if (null == mCurrentOCHOrder) return;
|
||||
List<OrderRouteUpdateReqBean.Result> points = coordinateConverterWgsToGcjList(mContext, models);
|
||||
TaxiServiceManager.getInstance().updateOrderRoute(mContext, mCurrentOCHOrder.orderNo
|
||||
, points, new TaxiServiceCallback<BaseData>() {
|
||||
TaxiServiceManager.updateOrderRoute(mContext, mCurrentOCHOrder.orderNo
|
||||
, points, new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
|
||||
@@ -1315,6 +1357,10 @@ public class TaxiModel {
|
||||
}
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true);
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi();
|
||||
if (mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(false,false);
|
||||
}
|
||||
}
|
||||
|
||||
private void reportTotalDisAndTime() {
|
||||
@@ -1356,6 +1402,19 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
reportOrderRemain((long) lastSumLength, (long) lastTime);
|
||||
|
||||
routeAndWipe();
|
||||
}
|
||||
}
|
||||
|
||||
private void routeAndWipe() {
|
||||
if (mRoutePoints != null && mRoutePoints.size() > 0){
|
||||
int haveArrivedIndex = CoordinateCalculateRouteUtil
|
||||
.getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex);
|
||||
}
|
||||
setRouteLineMarker(mRoutePoints);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1364,8 +1423,8 @@ public class TaxiModel {
|
||||
*/
|
||||
private void queryOrderRouteList(String orderNo) {
|
||||
if (mCurrentOCHOrder != null) {
|
||||
TaxiServiceManager.getInstance().queryOrderRoute(mContext, orderNo,
|
||||
new TaxiServiceCallback<QueryOrderRouteResp>() {
|
||||
TaxiServiceManager.queryOrderRoute(mContext, orderNo,
|
||||
new OchCommonServiceCallback<QueryOrderRouteResp>() {
|
||||
@Override
|
||||
public void onSuccess(QueryOrderRouteResp data) {
|
||||
if (data != null && data.data != null && mRoutePoints.size() == 0) {
|
||||
@@ -1403,15 +1462,15 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报订单剩余里程和时间 单位:KM, M, 单位:分钟
|
||||
* 上报订单剩余里程和时间 单位:KM, M, 单位:秒
|
||||
*
|
||||
* @param lastSumLength
|
||||
* @param duration
|
||||
*/
|
||||
private void reportOrderRemain(long lastSumLength, long duration) {// 米/分钟
|
||||
public void reportOrderRemain(long lastSumLength, long duration) {// 米/秒
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiServiceManager.getInstance().reportOrderRemain(mContext, mCurrentOCHOrder.orderNo
|
||||
, lastSumLength, duration, new TaxiServiceCallback<BaseData>() {
|
||||
TaxiServiceManager.reportOrderRemain(mContext, mCurrentOCHOrder.orderNo
|
||||
, lastSumLength, duration, new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData data) {
|
||||
|
||||
@@ -1436,10 +1495,10 @@ public class TaxiModel {
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiServiceManager.getInstance().updatePassengerHasBoardedStatus(mContext
|
||||
TaxiServiceManager.updatePassengerHasBoardedStatus(mContext
|
||||
, mCurrentOCHOrder.orderNo
|
||||
, result
|
||||
, new TaxiServiceCallback<TaxiDataBaseRespBean>() {
|
||||
, new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
|
||||
@@ -1458,10 +1517,10 @@ public class TaxiModel {
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiServiceManager.getInstance().startServicePilotDone(mContext
|
||||
TaxiServiceManager.startServicePilotDone(mContext
|
||||
, mCurrentOCHOrder.orderNo
|
||||
, result
|
||||
, new TaxiServiceCallback<TaxiDataBaseRespBean>() {
|
||||
, new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
|
||||
@@ -1478,10 +1537,10 @@ public class TaxiModel {
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiServiceManager.getInstance().arrivedStartPoint(mContext
|
||||
TaxiServiceManager.arrivedStartPoint(mContext
|
||||
, mCurrentOCHOrder.orderNo
|
||||
, result
|
||||
, new TaxiServiceCallback<TaxiDataBaseRespBean>() {
|
||||
, new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
|
||||
@@ -1499,10 +1558,10 @@ public class TaxiModel {
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiServiceManager.getInstance().arriveTerminal(mContext
|
||||
TaxiServiceManager.arriveTerminal(mContext
|
||||
, mCurrentOCHOrder.orderNo
|
||||
, result
|
||||
, new TaxiServiceCallback<TaxiDataBaseRespBean>() {
|
||||
, new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
|
||||
@@ -1520,15 +1579,12 @@ public class TaxiModel {
|
||||
TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result();
|
||||
result.lat = mLatitude;
|
||||
result.lon = mLongitude;
|
||||
TaxiServiceManager.getInstance().orderCompleted(mContext
|
||||
TaxiServiceManager.orderCompleted(mContext
|
||||
, mCurrentOCHOrder.orderNo
|
||||
, result
|
||||
, new TaxiServiceCallback<TaxiDataBaseRespBean>() {
|
||||
, new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
// if (null != data && 0 == data.code){
|
||||
// updateOrderStatus(TaxiOrderStatusEnum.JourneyCompleted);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1542,4 +1598,28 @@ public class TaxiModel {
|
||||
public void logout() {
|
||||
loginService.loginOut(mLatitude,mLongitude);
|
||||
}
|
||||
|
||||
//导航去订单终点目的地
|
||||
public void startNaviToEndStation(boolean isShow){
|
||||
if (mRoutePoints.size() > 0 ){ //使用自驾轨迹
|
||||
if (mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(false,isShow);
|
||||
}
|
||||
}else {//若直接要显示导航地图则直接导航, 若不是则2s后若无轨迹数据使用高德导航
|
||||
if (isShow && mRoutePoints.size() == 0 && mOrderStatusCallback != null){
|
||||
|
||||
mOrderStatusCallback.onNaviToEnd(true,true);
|
||||
}else {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mRoutePoints.size() == 0 && mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(true,false);
|
||||
}
|
||||
}
|
||||
},2000l);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.och.taxi.network;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 修改订单状态回调接口
|
||||
*/
|
||||
public interface TaxiServiceCallback< T > {
|
||||
|
||||
void onSuccess(T data);
|
||||
|
||||
void onFail(int code, String msg);
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,463 +0,0 @@
|
||||
package com.mogo.och.taxi.network;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
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.taxi.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.taxi.bean.DriverServiceDataRespBean;
|
||||
import com.mogo.och.taxi.bean.DriverStatusUpdateReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderCancelReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabStatusQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderRouteUpdateReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderStatusUpdateReqBean;
|
||||
import com.mogo.och.taxi.bean.OrdersInServiceQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrdersListQueryReqBean;
|
||||
import com.mogo.och.taxi.bean.OrdersListQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrdersNewBookingQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.QueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.bean.TaxiDataBaseRespBean;
|
||||
import com.mogo.och.taxi.bean.TaxiOrPassengerReadyReqBean;
|
||||
import com.mogo.och.taxi.bean.UpdateOrderDisAndTimeReqBean;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
public class TaxiServiceManager {
|
||||
private static final String TAG = TaxiServiceManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiServiceManager INSTANCE = new TaxiServiceManager();
|
||||
}
|
||||
|
||||
public static TaxiServiceManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private TaxiServiceApiNew mOCHTaxiServiceApi;
|
||||
|
||||
private TaxiServiceManager() {
|
||||
if (mOCHTaxiServiceApi == null){
|
||||
mOCHTaxiServiceApi = MoGoRetrofitFactory.getInstance(TaxiConst.getBaseUrl()).create(TaxiServiceApiNew.class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单列表
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrdersInAndWaitService(Context context,
|
||||
TaxiServiceCallback<OrdersInServiceQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrdersInAndWaitService(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrdersInAndWaitService"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新到的预约单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryNewBookingOrder(Context context,
|
||||
TaxiServiceCallback<OrdersNewBookingQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryNewBookingOrder(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryNewBookingOrder"));
|
||||
}
|
||||
|
||||
/**
|
||||
* (预约单)执行抢单动作
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
public void grabOrder(Context context, String orderNo,
|
||||
TaxiServiceCallback<OrderGrabRespBean> callback) {
|
||||
mOCHTaxiServiceApi.grabOrder(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderGrabReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), orderNo))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "grabOrder"));
|
||||
}
|
||||
|
||||
/**
|
||||
* (预约单)查询抢单结果
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrderGrabStatus(Context context, String orderNo,
|
||||
TaxiServiceCallback<OrderGrabStatusQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrderGrabStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderGrabReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), orderNo))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderGrabStatus"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单路径规划信息(到上车点、起始点间的距离和预估时间)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrderRouteInfo(Context context, String orderNo,
|
||||
TaxiServiceCallback<OrderQueryRouteInfoRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrderRouteInfo(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderQueryRouteInfoReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), orderNo))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderRouteInfo"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
*/
|
||||
public void queryOrderById(Context context, String orderNo,
|
||||
TaxiServiceCallback<OrderQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrderById(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderQueryReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), orderNo))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderById"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未完成态订单信息(用于本地无orderId时)
|
||||
* 如果有多条,只会返回时间最近的一条
|
||||
* @param context
|
||||
* @param callback
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
*/
|
||||
public void queryOrderInService(Context context,
|
||||
TaxiServiceCallback<OrderQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrderInService(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrderInService"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机取消订单
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param cancelType
|
||||
* @param cancelReason
|
||||
* @param callback
|
||||
*/
|
||||
public void cancelOrder(Context context, String orderNo, int cancelType, String cancelReason,
|
||||
TaxiServiceCallback<BaseData> callback) {
|
||||
mOCHTaxiServiceApi.cancelOrder(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderCancelReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), orderNo, cancelType, cancelReason))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "cancelOrder"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表获取
|
||||
* @param context
|
||||
* @param page
|
||||
* @param size
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrdersList(Context context, int page, int size,
|
||||
TaxiServiceCallback<OrdersListQueryRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryOrdersList(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrdersListQueryReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), page, size))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryOrdersList"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态更新
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param orderStatus
|
||||
* @param callback
|
||||
*/
|
||||
public void updateOrderStatus(Context context, String orderNo, int orderStatus,
|
||||
TaxiServiceCallback<BaseData> callback) {
|
||||
mOCHTaxiServiceApi.updateOrderStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), orderNo, orderStatus))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "updateOrderStatus"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void changeOrderServing(Context context,boolean isOrdering,
|
||||
TaxiServiceCallback<BaseData> callback) {
|
||||
Observable<BaseData> baseDataObservable = null;
|
||||
if(isOrdering) {// 正在接单去暂停
|
||||
baseDataObservable = mOCHTaxiServiceApi.stopOrderServing(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn()));
|
||||
}else {// 没有接单去接单
|
||||
baseDataObservable = mOCHTaxiServiceApi.resetOrderServing(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn()));
|
||||
}
|
||||
baseDataObservable.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "updateDriverServiceStatus"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param callback
|
||||
*/
|
||||
public void runCarHeartbeat(Context context, double lon, double lat,
|
||||
TaxiServiceCallback<BaseData> callback) {
|
||||
mOCHTaxiServiceApi.runCarHeartbeat(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), lon, lat))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "runCarHeartbeat"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机服务数据
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryDriverServiceData(Context context,
|
||||
TaxiServiceCallback<DriverServiceDataRespBean> callback) {
|
||||
mOCHTaxiServiceApi.queryServiceData(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "queryDriverServiceData"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单上传工控机返回的全路径规划数据
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
public void updateOrderRoute(Context context, String orderNo, List<OrderRouteUpdateReqBean.Result> points,
|
||||
TaxiServiceCallback<BaseData> callback){
|
||||
mOCHTaxiServiceApi.updateOrderRoute(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new OrderRouteUpdateReqBean(orderNo,points))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"updateOrderRoute"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报剩余里程,时间
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param distance
|
||||
* @param duration
|
||||
* @param callback
|
||||
*/
|
||||
public void reportOrderRemain(Context context, String orderNo, long distance, long duration
|
||||
, TaxiServiceCallback<BaseData> callback){
|
||||
|
||||
mOCHTaxiServiceApi.reportOrderRemain(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new UpdateOrderDisAndTimeReqBean(orderNo,distance,duration))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"reportOrderRemain"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单全路径
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOrderRoute(Context context, String orderNo, TaxiServiceCallback<QueryOrderRouteResp> callback) {
|
||||
mOCHTaxiServiceApi.queryOrderRoute(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,orderNo)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryOrderRoute"));
|
||||
}
|
||||
|
||||
public void confirmAutopilotConditionByDriver(Context context, String orderNo
|
||||
, TaxiOrPassengerReadyReqBean.Result loc
|
||||
, TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.confirmAutopilotConditionByDriver(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiOrPassengerReadyReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"confirmAutopilotConditionByDriver"));
|
||||
}
|
||||
|
||||
public void queryAutopilotStatus(Context context, String orderNo,
|
||||
TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.queryPilotStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,orderNo)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryAutopilotStatus"));
|
||||
}
|
||||
|
||||
public void updatePassengerHasBoardedStatus(Context context, String orderNo
|
||||
, TaxiOrPassengerReadyReqBean.Result loc
|
||||
, TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
|
||||
mOCHTaxiServiceApi.updatePassengerHasBoardedStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiOrPassengerReadyReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "updatePassengerHasBoardedStatus"));
|
||||
}
|
||||
|
||||
public void startServicePilotDone(Context context, String orderNo
|
||||
, TaxiOrPassengerReadyReqBean.Result loc
|
||||
, TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.startServicePilotDone(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiOrPassengerReadyReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "startServicePilotDone"));
|
||||
}
|
||||
|
||||
public void arrivedStartPoint(Context context, String orderNo
|
||||
, TaxiOrPassengerReadyReqBean.Result loc
|
||||
, TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.arrivedStartPoint(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiOrPassengerReadyReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "arrivedStartPoint"));
|
||||
|
||||
}
|
||||
|
||||
public void arriveTerminal(Context context, String orderNo
|
||||
, TaxiOrPassengerReadyReqBean.Result loc
|
||||
, TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.arriveTerminal(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiOrPassengerReadyReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "arriveTerminal"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void orderCompleted(Context context, String orderNo
|
||||
, TaxiOrPassengerReadyReqBean.Result loc
|
||||
, TaxiServiceCallback<TaxiDataBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.orderCompleted(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiOrPassengerReadyReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
|
||||
,orderNo,loc))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "orderCompleted"));
|
||||
|
||||
}
|
||||
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
|
||||
Context context, TaxiServiceCallback<T> callback, String apiName) {
|
||||
return new SubscribeImpl<T>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(T o) {
|
||||
super.onSuccess(o);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG,apiName + ": onSuccess() " + o.msg);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG,apiName + ": onError() " + e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG,String.format(apiName + ": onError() code = %d; message = %s;", code, message));
|
||||
if (callback != null) {
|
||||
callback.onFail(code, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,497 @@
|
||||
package com.mogo.och.taxi.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.taxi.constant.TaxiConst.Companion.getBaseUrl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
import com.mogo.och.taxi.bean.*
|
||||
import io.reactivex.Observable
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
object TaxiServiceManager {
|
||||
|
||||
|
||||
private var mOCHTaxiServiceApi: TaxiServiceApiNew =
|
||||
MoGoRetrofitFactory.getInstance(getBaseUrl()).create(
|
||||
TaxiServiceApiNew::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单列表
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrdersInAndWaitService(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrdersInServiceQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrdersInAndWaitService(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrdersInAndWaitService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新到的预约单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryNewBookingOrder(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrdersNewBookingQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryNewBookingOrder(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryNewBookingOrder"))
|
||||
}
|
||||
|
||||
/**
|
||||
* (预约单)执行抢单动作
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun grabOrder(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderGrabRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.grabOrder(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderGrabReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "grabOrder"))
|
||||
}
|
||||
|
||||
/**
|
||||
* (预约单)查询抢单结果
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderGrabStatus(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderGrabStatusQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderGrabStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderGrabReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderGrabStatus"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单路径规划信息(到上车点、起始点间的距离和预估时间)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderRouteInfo(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderQueryRouteInfoRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderRouteInfo(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderQueryRouteInfoReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderRouteInfo"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
@Deprecated("v2.1_0930需求中暂不再使用此接口")
|
||||
fun queryOrderById(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderById(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderQueryReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderById"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未完成态订单信息(用于本地无orderId时)
|
||||
* 如果有多条,只会返回时间最近的一条
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
@Deprecated("v2.1_0930需求中暂不再使用此接口")
|
||||
fun queryOrderInService(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrderQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderInService(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderInService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机取消订单
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param cancelType
|
||||
* @param cancelReason
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun cancelOrder(
|
||||
context: Context, orderNo: String?, cancelType: Int, cancelReason: String?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.cancelOrder(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderCancelReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, cancelType, cancelReason
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "cancelOrder"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表获取
|
||||
* @param context
|
||||
* @param page
|
||||
* @param size
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrdersList(
|
||||
context: Context, page: Int, size: Int,
|
||||
callback: OchCommonServiceCallback<OrdersListQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrdersList(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrdersListQueryReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, page, size
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrdersList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态更新
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param orderStatus
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun updateOrderStatus(
|
||||
context: Context, orderNo: String?, orderStatus: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.updateOrderStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, orderStatus
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderStatus"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun changeOrderServing(
|
||||
context: Context, isOrdering: Boolean,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
val baseDataObservable: Observable<BaseData> = if (isOrdering) { // 正在接单去暂停
|
||||
mOCHTaxiServiceApi.stopOrderServing(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
).transformTry()
|
||||
} else { // 没有接单去接单
|
||||
mOCHTaxiServiceApi.resetOrderServing(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
).transformTry()
|
||||
}
|
||||
baseDataObservable
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateDriverServiceStatus"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun runCarHeartbeat(
|
||||
context: Context, lon: Double, lat: Double,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.runCarHeartbeat(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lon, lat
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "runCarHeartbeat"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机服务数据
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverServiceData(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<DriverServiceDataRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryServiceData(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverServiceData"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单上传工控机返回的全路径规划数据
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun updateOrderRoute(
|
||||
context: Context, orderNo: String?, points: List<OrderRouteUpdateReqBean.Result?>?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderRouteUpdateReqBean(orderNo, points)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderRoute"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报剩余里程,时间
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param distance
|
||||
* @param duration
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun reportOrderRemain(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
distance: Long,
|
||||
duration: Long,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.reportOrderRemain(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
UpdateOrderDisAndTimeReqBean(orderNo, distance, duration)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "reportOrderRemain"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单全路径
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderRoute(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
callback: OchCommonServiceCallback<QueryOrderRouteResp>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderRoute"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun confirmAutopilotConditionByDriver(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.confirmAutopilotConditionByDriver(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "confirmAutopilotConditionByDriver"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryAutopilotStatus(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryPilotStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryAutopilotStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun updatePassengerHasBoardedStatus(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.updatePassengerHasBoardedStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updatePassengerHasBoardedStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun startServicePilotDone(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.startServicePilotDone(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "startServicePilotDone"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun arrivedStartPoint(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.arrivedStartPoint(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arrivedStartPoint"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun arriveTerminal(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>
|
||||
) {
|
||||
mOCHTaxiServiceApi.arriveTerminal(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arriveTerminal"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun orderCompleted(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>
|
||||
) {
|
||||
mOCHTaxiServiceApi.orderCompleted(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "orderCompleted"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.mogo.och.taxi.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiRottingNaviFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
public class NaviPresenter extends Presenter<TaxiRottingNaviFragment> implements IOCHTaxiAutopilotPlanningCallback {
|
||||
|
||||
private static final String TAG = NaviPresenter.class.getSimpleName();
|
||||
|
||||
public NaviPresenter(TaxiRottingNaviFragment view) {
|
||||
super(view);
|
||||
TaxiModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, " onCreate" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineMarker(List<LatLng> models) {
|
||||
runOnUIThread(() -> mView.setLineMarker(models));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<LatLng> models, int haveArrivedIndex) {
|
||||
mView.routeResult(models,haveArrivedIndex);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -19,6 +20,7 @@ import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiDriverRoleEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
@@ -83,6 +85,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().setControllerStatusCallback(null);
|
||||
TaxiModel.getInstance().setOrderStatusCallback(null);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
@@ -180,6 +183,14 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().logout();
|
||||
}
|
||||
|
||||
//导航去订单目的地
|
||||
public void startNaviToEndStation(boolean isShow){
|
||||
TaxiModel.getInstance().startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
public void reportToEndDisAndTime(long lastSumLength, long duration){//米/秒
|
||||
TaxiModel.getInstance().reportOrderRemain(lastSumLength,duration);
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
@@ -215,6 +226,11 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAdasFailure() {
|
||||
runOnUIThread(() -> mView.stopAnimAndUpdateBtnStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum) {
|
||||
runOnUIThread(() -> mView.onServiceDataUpdate(dailyTimeDuration,dailyOrderNum));
|
||||
@@ -247,6 +263,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiOrderStatusEnum.Cancel.getCode() == order.orderStatus ||
|
||||
TaxiOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){
|
||||
TaxiModel.getInstance().startOrStopCalculateRouteInfo(false);
|
||||
TaxiModel.getInstance().setRouteLineMarker(null);
|
||||
}
|
||||
runOnUIThread(() -> mView.updateCurrentOrderStatusChanged(order));
|
||||
}
|
||||
@@ -268,7 +285,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.onCurrentOrderDistToStartChanged(meters,timeInSecond));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -306,6 +322,11 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
runOnUIThread(() -> mView.onCheckPilotConditionSafe(isSafe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviToEnd(boolean isAmap, boolean isShow) {
|
||||
runOnUIThread( () -> mView.onNaviToEnd(isAmap,isShow));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
runOnUIThread(() -> mView.switchVRFlatMode(isVRMode));
|
||||
|
||||
@@ -21,7 +21,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
@@ -34,19 +33,15 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.common.module.utils.AnimatorDrawableUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -81,7 +76,8 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
protected RelativeLayout mSettingBtn;
|
||||
protected LinearLayout mBadcaseBtn;
|
||||
protected LinearLayout mAICollectBtn;
|
||||
protected TaxiNaviFragment ochNaviFragment = null;
|
||||
protected TaxiAmapNaviFragment ochAmapNaviFragment = null;
|
||||
protected TaxiRottingNaviFragment taxiRottingNaviFragment = null;
|
||||
// protected TaxiTrafficLightView mTrafficLightView;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
@@ -294,7 +290,8 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
onChangeOperationStatus();
|
||||
});
|
||||
mCloseNaviIcon.setOnClickListener(v -> {
|
||||
showNaviToStartStationFragment(false);
|
||||
showAmapNaviToStationFragment(false);
|
||||
showRottingToStationFragment(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -335,12 +332,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
|
||||
}
|
||||
|
||||
public void showNotice(String notice) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
@@ -363,19 +354,15 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
// 3. 其他过程直接更新
|
||||
startOrStopLoadingAnim(false);
|
||||
autopilotStatusAnimchanged(status);
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == mPrevAPStatus) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
|
||||
// 2->1
|
||||
// AIAssist.getInstance(getContext()).speakTTSVoice("已进入人工驾驶模式");
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE == status) {
|
||||
// 2->0
|
||||
// AIAssist.getInstance(getContext()).speakTTSVoice("自动驾驶已停止,请人工接管");
|
||||
}
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
});
|
||||
}
|
||||
|
||||
public void stopAnimAndUpdateBtnStatus(){
|
||||
startOrStopLoadingAnim(false);
|
||||
startAutopilotDone(false);
|
||||
}
|
||||
|
||||
public void onManMachineCoDriving(int manMachineCoDriving){
|
||||
if (mPrevAPStatus != manMachineCoDriving){
|
||||
autopilotStatusAnimchanged(manMachineCoDriving);
|
||||
@@ -567,30 +554,75 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
//todo ui 切换
|
||||
}
|
||||
|
||||
protected void showNaviToStartStationFragment(boolean isShow) {
|
||||
protected void showAmapNaviToStationFragment(boolean isShow) {
|
||||
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
closeAmapViewIFHadeAdd();
|
||||
if (isShow) {
|
||||
closeRouteViewIFHadeAdd();
|
||||
// if (ochNaviFragment == null){
|
||||
ochNaviFragment = TaxiNaviFragment.newInstance();
|
||||
ochAmapNaviFragment = TaxiAmapNaviFragment.newInstance();
|
||||
// }
|
||||
if (ochNaviFragment.isAdded()) {
|
||||
if (ochAmapNaviFragment.isAdded()) {
|
||||
return;
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochNaviFragment).show(ochNaviFragment);
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochAmapNaviFragment).show(ochAmapNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
mCloseNaviIcon.setVisibility(View.VISIBLE);
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
CallerSmpManager.hidePanel();//隐藏小地图
|
||||
} else {
|
||||
if (ochNaviFragment != null) {
|
||||
ochNaviFragment.onDestroy();
|
||||
transaction.remove(ochNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
ochNaviFragment = null;
|
||||
}
|
||||
mCloseNaviIcon.setVisibility(View.GONE);
|
||||
flNaviPanelContainer.setVisibility(View.GONE);
|
||||
CallerSmpManager.showPanel();//显示小地图
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAmapViewIFHadeAdd(){
|
||||
if (ochAmapNaviFragment != null) {
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
ochAmapNaviFragment.onDestroy();
|
||||
transaction.remove(ochAmapNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
ochAmapNaviFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void closeRouteViewIFHadeAdd(){
|
||||
if (taxiRottingNaviFragment != null) {
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
taxiRottingNaviFragment.onDestroy();
|
||||
transaction.remove(taxiRottingNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
taxiRottingNaviFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void showRottingToStationFragment(boolean isShow) {
|
||||
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
if (isShow) {
|
||||
closeAmapViewIFHadeAdd();
|
||||
// if (ochNaviFragment == null){
|
||||
taxiRottingNaviFragment = TaxiRottingNaviFragment.newInstance();
|
||||
// }
|
||||
if (taxiRottingNaviFragment.isAdded()) {
|
||||
return;
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, taxiRottingNaviFragment).show(taxiRottingNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
mCloseNaviIcon.setVisibility(View.VISIBLE);
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
CallerSmpManager.hidePanel();//隐藏小地图
|
||||
} else {
|
||||
closeRouteViewIFHadeAdd();
|
||||
mCloseNaviIcon.setVisibility(View.GONE);
|
||||
flNaviPanelContainer.setVisibility(View.GONE);
|
||||
CallerSmpManager.showPanel();//显示小地图
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public abstract void startNaviToEndStation(boolean isShow);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/6/24 11:33 上午
|
||||
*/
|
||||
public interface ITaxiMapDirectionView {
|
||||
|
||||
/**
|
||||
* 绘制路径线
|
||||
*/
|
||||
void drawablePolyline();
|
||||
|
||||
/**
|
||||
* 清除路径线
|
||||
*/
|
||||
void clearPolyline();
|
||||
|
||||
/**
|
||||
* 设置路径中起终点marker
|
||||
*/
|
||||
void setLineMarker();
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.amap.api.navi.AMapNaviViewListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback;
|
||||
import com.mogo.och.common.module.map.CommonAmapNaviVIew;
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/30
|
||||
*/
|
||||
public class TaxiAmapNaviFragment extends BaseTaxiUIFragment implements AMapNaviViewListener {
|
||||
|
||||
private CommonAmapNaviVIew mAMapNaviView;
|
||||
private ICommonNaviChangedCallback mNaviToStartInfoCallback;
|
||||
public static TaxiAmapNaviFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiAmapNaviFragment fragment = new TaxiAmapNaviFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_amap_navi_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(View view) {
|
||||
mAMapNaviView = view.findViewById(R.id.navi_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
if (mAMapNaviView != null)
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mAMapNaviView != null)
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mAMapNaviView != null)
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(false);
|
||||
if (mAMapNaviView != null){
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
|
||||
if (mNaviToStartInfoCallback != null){
|
||||
mNaviToStartInfoCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviSetting() {
|
||||
//底部导航设置点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviMapMode(int naviMode) {
|
||||
//导航态车头模式,0:车头朝上状态;1:正北朝上模式。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviTurnClick() {
|
||||
//转弯view的点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextRoadClick() {
|
||||
//下一个道路View点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onScanViewButtonClick() {
|
||||
//全览按钮点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
//锁地图状态发生变化时回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewLoaded() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "导航页面加载成功");
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapTypeChanged(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewShowMode(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNaviBackClick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车道信息说明:
|
||||
* <p>
|
||||
* 0xFF, 无对应车道
|
||||
* 0, 直行
|
||||
* 1, 左转
|
||||
* 2, 直行+左转
|
||||
* 3, 右转
|
||||
* 4, 直行+右转
|
||||
* 5, 左掉头
|
||||
* 6, 左转+右转
|
||||
* 7, 直行+左转+右转
|
||||
* 8, 右掉头
|
||||
* 9, 直行+左掉头
|
||||
* 10, 直行+右掉头
|
||||
* 11, 左转+左掉头
|
||||
* 12, 右转+右掉头
|
||||
* 13, 直行+扩展
|
||||
* 14, 左转+左掉头+扩展
|
||||
* 15, 保留
|
||||
* 16, 直行+左转+左掉头
|
||||
* 17, 右转+左掉头
|
||||
* 18, 左转+右转+左掉头
|
||||
* 19, 直行+右转+左掉头
|
||||
* 20, 左转+右掉头
|
||||
* 21, 公交车道
|
||||
* 22, 空车道
|
||||
* 23 可变车道
|
||||
*/
|
||||
|
||||
String[] array = {
|
||||
"直行车道"
|
||||
, "左转车道"
|
||||
, "左转或直行车道"
|
||||
, "右转车道"
|
||||
, "右转或直行车道"
|
||||
, "左掉头车道"
|
||||
, "左转或者右转车道"
|
||||
, " 左转或右转或直行车道"
|
||||
, "右转掉头车道"
|
||||
, "直行或左转掉头车道"
|
||||
, "直行或右转掉头车道"
|
||||
, "左转或左掉头车道"
|
||||
, "右转或右掉头车道"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择该车道"
|
||||
, "直行+左转+左掉头车道"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
|
||||
String[] actions = {
|
||||
"直行"
|
||||
, "左转"
|
||||
, "左转或直行"
|
||||
, "右转"
|
||||
, "右转或这行"
|
||||
, "左掉头"
|
||||
, "左转或者右转"
|
||||
, " 左转或右转或直行"
|
||||
, "右转掉头"
|
||||
, "直行或左转掉头"
|
||||
, "直行或右转掉头"
|
||||
, "左转或左掉头"
|
||||
, "右转或右掉头"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择"
|
||||
, "直行+左转+左掉头"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
@@ -29,17 +28,18 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.model.NaviToDestinationModel;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -49,14 +49,13 @@ import java.util.List;
|
||||
* @since 2021/1/18
|
||||
* 正在进行中订单
|
||||
*/
|
||||
public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implements View.OnClickListener, ITaxiNaviChangedCallback {
|
||||
public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment
|
||||
implements View.OnClickListener, ICommonNaviChangedCallback {
|
||||
|
||||
public static final String TAG = "OCHTaxiBeingServerd";
|
||||
private static Activity mActivity;
|
||||
private static TaxiFragment mTaxiFragment;
|
||||
private String mOrderNo;
|
||||
private double mOrderStartStationLat = 0;
|
||||
private double mOrderStartStationLng = 0;
|
||||
private volatile int mTtsLessThan200Tip = 0;//离终点200米提示播报
|
||||
private OrderQueryRespBean.Result mCurrentOrder = null;
|
||||
private boolean isFirstStartAutopilotDone = true;
|
||||
@@ -81,12 +80,13 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
|
||||
private LinearLayout mContentModule31;
|
||||
private TextView mStationTv31;
|
||||
private LinearLayout mContentModule32;
|
||||
private ConstraintLayout mContentModule32;
|
||||
private TextView mStationTv32;
|
||||
private TextView mArrivedStationTitleTv32;
|
||||
private TextView mGoAheadStationTitleTv31;
|
||||
private TextView mCatchStationTitleTv31;
|
||||
private ImageView mNaviIcon;
|
||||
private ImageView mNaviStartIcon;
|
||||
private ImageView mNaviToEndIcon;
|
||||
private TextView mPassengerNum;
|
||||
private TextView mPassengerPhone;
|
||||
private ConstraintLayout mPassengerInfoLayout;
|
||||
@@ -169,8 +169,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
}
|
||||
|
||||
private void initNaviView(View view) {
|
||||
mNaviIcon = view.findViewById(R.id.module_och_taxi_navi_iv);
|
||||
mNaviIcon.setOnClickListener(this);
|
||||
mNaviStartIcon = view.findViewById(R.id.module_och_taxi_navi_iv);
|
||||
mNaviStartIcon.setOnClickListener(this);
|
||||
|
||||
mNaviToEndIcon = view.findViewById(R.id.module_och_taxi_navi_end_iv);
|
||||
mNaviToEndIcon.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,8 +325,6 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
+ "<font color=\"#CAD6FF\"> 用车</font>";
|
||||
}
|
||||
mOrderOtherContent3.setText(Html.fromHtml(strHtml1));
|
||||
mOrderStartStationLat = order.startSiteGcjPoint.get(1);
|
||||
mOrderStartStationLng = order.startSiteGcjPoint.get(0);
|
||||
}
|
||||
}catch (NullPointerException e){ //可能会出现订单信息已经轮询回来,但进行中页面控件还未初始化完成的情况
|
||||
TaxiModel.getInstance().clearCurrentOCHOrder();
|
||||
@@ -339,21 +341,23 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
}
|
||||
}
|
||||
|
||||
private void startNaviToStartStation(boolean isShow, double orderStartStationLat, double orderStartStationLng) {
|
||||
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
private void startNaviToStation(boolean isVoicePlay, double stationLat, double stationLng) {
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "currentLatLng=" + mTaxiFragment.mCurLatitude + " " + mTaxiFragment.mCurLongitude);
|
||||
NaviLatLng startNaviLatLng = new NaviLatLng(mTaxiFragment.mCurLatitude, mTaxiFragment.mCurLongitude);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(orderStartStationLat, orderStartStationLng);
|
||||
NaviToDestinationModel.getInstance(getContext()).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
NaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(isShow);
|
||||
NaviToDestinationModel.getInstance(getContext()).setOCHTaciNaviChangedCallback(this);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(stationLat, stationLng);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(isVoicePlay);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setOCHTaciNaviChangedCallback(this);
|
||||
}
|
||||
|
||||
private void showOrHideNavi(boolean isShow) {
|
||||
if (!isShow) {
|
||||
mNaviIcon.setVisibility(View.GONE);
|
||||
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
mTaxiFragment.showNaviToStartStationFragment(false);
|
||||
mNaviStartIcon.setVisibility(View.GONE);
|
||||
mNaviToEndIcon.setVisibility(View.GONE);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
mTaxiFragment.showAmapNaviToStationFragment(false);
|
||||
mTaxiFragment.showRottingToStationFragment(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,17 +383,24 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
|
||||
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + min + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
|
||||
|
||||
if (mContentModule3 != null && mContentModule3.getVisibility() == View.VISIBLE) { //前往上车点
|
||||
if (mCurrentOrder != null && mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) { //前往上车点
|
||||
|
||||
mDistanceAndTime3.setText(Html.fromHtml(strHtml2));
|
||||
mNaviIcon.setVisibility(View.VISIBLE);
|
||||
} else if (mContentModule2 != null && mContentModule2.getVisibility() == View.VISIBLE) { //前往终点 时间单位是分钟
|
||||
if (mNaviStartIcon.getVisibility() == View.GONE){
|
||||
mNaviStartIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
} else if (mCurrentOrder != null && mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()) { //前往终点 时间单位是分钟
|
||||
if (mNaviToEndIcon.getVisibility() == View.GONE){
|
||||
mNaviToEndIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (mTtsLessThan200Tip < 1 && meters <= 250 && meters > 150){
|
||||
speekVoice200mTipsOnce();
|
||||
}
|
||||
mDistanceAndTime2.setText(Html.fromHtml(strHtml2));
|
||||
if (isFirstStartAutopilotDone){
|
||||
showNotice(String.format(getResources()
|
||||
VoiceNotice.showNotice(String.format(getResources()
|
||||
.getString(R.string.module_och_taxi_order_server_start_auto_tip),
|
||||
dis,disUnit,min));
|
||||
isFirstStartAutopilotDone = false;
|
||||
@@ -400,7 +411,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
|
||||
private void speekVoice200mTipsOnce() {
|
||||
mTtsLessThan200Tip = 1;
|
||||
showNotice(getResources().getString(R.string.module_och_taxi_order_arrive_end_200m_tip));
|
||||
VoiceNotice.showNotice(getResources().getString(R.string.module_och_taxi_order_arrive_end_200m_tip));
|
||||
}
|
||||
|
||||
public void onCurrentOrderRouteInfoGot(OrderQueryRouteInfoRespBean.Result routeInfo) {// 单位 米, 秒
|
||||
@@ -427,7 +438,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
}
|
||||
|
||||
private void startOrEndService() {
|
||||
@@ -438,7 +449,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
mTaxiFragment.confirmAutopilotConditionByDriver();
|
||||
}else if (TaxiOrderStatusEnum.ArriveAtEnd.getCode() == mCurrentOrder.orderStatus) {//点击了完成服务,结束订单并更新订单信息
|
||||
mTaxiFragment.completeOrderService();
|
||||
showNotice(getResources().getString(R.string.module_och_taxi_order_server_completed_tip));
|
||||
//VoiceNotice.showNotice(getResources().getString(R.string.module_och_taxi_order_server_completed_tip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,8 +461,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
if (status == TaxiOrderStatusEnum.None.getCode() || status == TaxiOrderStatusEnum.Cancel.getCode() || status == TaxiOrderStatusEnum.JourneyCompleted.getCode()) {
|
||||
isHaveBeingOrder(false);
|
||||
mCurrentOrder = null;
|
||||
mDistanceAndTime2.setText("距离 - - 公里,用时 - - 分");
|
||||
mDistanceAndTime3.setText("距离 - - 公里,用时 - - 分");
|
||||
clearOrderTag();
|
||||
} else {
|
||||
isHaveBeingOrder(true);
|
||||
}
|
||||
@@ -460,11 +470,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
switch (ochStatus) {
|
||||
case OnTheWayToStart:
|
||||
mOrderCancel.setVisibility(View.VISIBLE);
|
||||
showNotice(mActivity.getString(R.string.module_och_taxi_new_order));
|
||||
VoiceNotice.showNotice(mActivity.getString(R.string.module_och_taxi_new_order));
|
||||
mTtsLessThan200Tip = 0;
|
||||
isFirstStartAutopilotDone = true;
|
||||
startNaviToStartStation(false, mOrderStartStationLat, mOrderStartStationLng);
|
||||
showOrHideNavi(true);
|
||||
double orderStartStationLat = order.startSiteGcjPoint.get(1);
|
||||
double orderStartStationLng = order.startSiteGcjPoint.get(0);
|
||||
startNaviToStation(false, orderStartStationLat, orderStartStationLng);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
|
||||
break;
|
||||
@@ -473,7 +484,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
mTtsLessThan200Tip = 0;
|
||||
isFirstStartAutopilotDone = true;
|
||||
mOrderCancel.setVisibility(View.VISIBLE);
|
||||
showNotice(mActivity.getString(R.string.module_och_taxi_order_cancel));
|
||||
//VoiceNotice.showNotice(mActivity.getString(R.string.module_och_taxi_order_cancel));
|
||||
showOrHideNavi(false);
|
||||
setOrRemoveMapMaker(false, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
setOrRemoveMapMaker(false, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
|
||||
@@ -485,9 +496,9 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
isFirstStartAutopilotDone = true;
|
||||
mOrderCancel.setVisibility(View.VISIBLE);
|
||||
if (TaxiOrderStatusEnum.UserArriveAtStart.getCode() == ochStatus.getCode()){
|
||||
showNotice(mActivity.getString(R.string.module_och_taxi_order_status_ph_text_check_success));
|
||||
VoiceNotice.showNotice(mActivity.getString(R.string.module_och_taxi_order_status_ph_text_check_success));
|
||||
}else {
|
||||
showNotice(mActivity.getString(R.string.module_och_taxi_order_status_ph_text));
|
||||
VoiceNotice.showNotice(mActivity.getString(R.string.module_och_taxi_order_status_ph_text));
|
||||
}
|
||||
showOrHideNavi(false);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
@@ -496,14 +507,19 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
case OnTheWayToEnd:
|
||||
// showNotice("欢迎使用蘑菇智行");
|
||||
mOrderCancel.setVisibility(View.VISIBLE);
|
||||
showOrHideNavi(false);
|
||||
// double orderEndStationLat = order.endSiteGcjPoint.get(1);
|
||||
// double orderEndStationLng = order.endSiteGcjPoint.get(0);
|
||||
// startNaviToStation(false, orderEndStationLat, orderEndStationLng);
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToEndStationFragment(false);
|
||||
}
|
||||
setOrRemoveMapMaker(false, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
|
||||
break;
|
||||
case ArriveAtEnd:
|
||||
mTtsLessThan200Tip = 0;
|
||||
mOrderCancel.setVisibility(View.GONE);
|
||||
showNotice(mActivity.getString(R.string.module_och_taxi_order_auto_arrive_end_tip));
|
||||
VoiceNotice.showNotice(mActivity.getString(R.string.module_och_taxi_order_auto_arrive_end_tip));
|
||||
showOrHideNavi(false);
|
||||
setOrRemoveMapMaker(false, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
setOrRemoveMapMaker(false, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
|
||||
@@ -514,7 +530,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
mTtsLessThan200Tip = 0;
|
||||
isFirstStartAutopilotDone = true;
|
||||
mOrderCancel.setVisibility(View.GONE);
|
||||
showNotice("感谢您使用蘑菇智行,再见~");
|
||||
VoiceNotice.showNotice("感谢您使用蘑菇智行,再见~");
|
||||
showOrHideNavi(false);
|
||||
break;
|
||||
}
|
||||
@@ -523,6 +539,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
});
|
||||
}
|
||||
|
||||
private void clearOrderTag() {
|
||||
saveOrderState = -1;
|
||||
mDistanceAndTime2.setText("距离 - - 公里,用时 - - 分");
|
||||
mDistanceAndTime3.setText("距离 - - 公里,用时 - - 分");
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有正在进行的订单,进行UI显示
|
||||
*
|
||||
@@ -556,11 +578,15 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
} else if (v.getId() == R.id.module_och_taxi_order_cancel_iv) {
|
||||
new TaxiOrderCancelDialog(mTaxiFragment, mActivity, mOrderNo, saveOrderState).show();
|
||||
} else if (v.getId() == R.id.module_och_taxi_navi_iv) {
|
||||
// TODO: 2021/11/30 打开去往乘客上车点的导航页面
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToStartStationFragment(true);
|
||||
}
|
||||
} else if (v.getId() == R.id.taxi_start_by_auto){//自驾模式
|
||||
} else if (v.getId() == R.id.module_och_taxi_navi_end_iv){
|
||||
// TODO: 2021/11/30 打开去往乘客下车点的导航页面
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToEndStationFragment(true);
|
||||
}
|
||||
}else if (v.getId() == R.id.taxi_start_by_auto){//自驾模式
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "自驾模式");
|
||||
mOrderStartModeBtn.setTag(0);
|
||||
startOrEndService();
|
||||
@@ -577,8 +603,22 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
* @param isShow
|
||||
*/
|
||||
private void showNaviToStartStationFragment(boolean isShow) {
|
||||
mTaxiFragment.showNaviToStartStationFragment(isShow);
|
||||
startNaviToStartStation(isShow, mOrderStartStationLat, mOrderStartStationLng);
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()){
|
||||
double orderStartStationLat = mCurrentOrder.startSiteGcjPoint.get(1);
|
||||
double orderStartStationLng = mCurrentOrder.startSiteGcjPoint.get(0);
|
||||
mTaxiFragment.showAmapNaviToStationFragment(isShow);
|
||||
startNaviToStation(isShow, orderStartStationLat, orderStartStationLng);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示/隐藏 前往乘客目的地的导航
|
||||
*
|
||||
* @param isShow
|
||||
*/
|
||||
private void showNaviToEndStationFragment(boolean isShow) {
|
||||
mTaxiFragment.startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
|
||||
@@ -594,6 +634,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
//更新界面
|
||||
isHaveBeingOrder(false);
|
||||
showOrHideNavi(false);
|
||||
clearOrderTag();
|
||||
}
|
||||
|
||||
private void clearSmallMapRouteLine() {
|
||||
@@ -610,46 +651,62 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
});
|
||||
}
|
||||
|
||||
public void showNotice(String notice) {
|
||||
mActivity.runOnUiThread(() -> {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentNaviDistAndTimeChanged(int meters, long timeInSecond) {
|
||||
updateDistanceAndTime(meters, timeInSecond);
|
||||
if (mCurrentOrder != null
|
||||
&& mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
mTaxiFragment.reportToEndDisAndTime(meters, timeInSecond);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reInitNaviAmap(boolean isPlay, boolean isRestart) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "isPlay = " + isPlay + ", isRestart=" + isRestart);
|
||||
if (!isRestart) {
|
||||
mTaxiFragment.showNaviToStartStationFragment(false);
|
||||
mTaxiFragment.showAmapNaviToStationFragment(false);
|
||||
return;
|
||||
}
|
||||
mTaxiFragment.showNaviToStartStationFragment(false);
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (saveOrderState == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
startNaviToStartStation(false, mOrderStartStationLat, mOrderStartStationLng);
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
double orderStartStationLat = mCurrentOrder.startSiteGcjPoint.get(1);
|
||||
double orderStartStationLng = mCurrentOrder.startSiteGcjPoint.get(0);
|
||||
startNaviToStation(false, orderStartStationLat, orderStartStationLng);
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (saveOrderState == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
if (mNaviIcon.getVisibility() == View.GONE) {
|
||||
mNaviIcon.setVisibility(View.VISIBLE);
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
if (mNaviStartIcon.getVisibility() == View.GONE) {
|
||||
mNaviStartIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
if (mNaviToEndIcon.getVisibility() == View.GONE) {
|
||||
mNaviToEndIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
public void onNaviToEndAmap(boolean isShow) {
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
double orderEndStationLat = mCurrentOrder.endSiteGcjPoint.get(1);
|
||||
double orderEndStationLng = mCurrentOrder.endSiteGcjPoint.get(0);
|
||||
mTaxiFragment.showAmapNaviToStationFragment(isShow);
|
||||
startNaviToStation(isShow,orderEndStationLat,orderEndStationLng);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制地图起点终点
|
||||
* @param isAdd
|
||||
|
||||
@@ -94,6 +94,11 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNaviToEndStation(boolean isShow) {
|
||||
mPresenter.startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return "TaxiFragment";
|
||||
@@ -306,6 +311,27 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
grabOrderFragment.onGrabOrderFailed();
|
||||
}
|
||||
|
||||
public void onNaviToEnd(boolean isAmap , boolean isShow){
|
||||
if (isAmap){
|
||||
if (null == serverOrdersFragment) return;
|
||||
serverOrdersFragment.onNaviToEndAmap(isShow);
|
||||
}else if (isShow){ //使用rotting数据
|
||||
showRottingToStationFragment(true);
|
||||
}else {
|
||||
showAmapNaviToStationFragment(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高德计算出来的到达目的地的剩余里程和时间
|
||||
* @param meters
|
||||
* @param timeInSecond
|
||||
*/
|
||||
public void reportToEndDisAndTime(int meters, long timeInSecond){ //米/秒
|
||||
mPresenter.reportToEndDisAndTime(Long.parseLong(String.valueOf(meters)),timeInSecond);
|
||||
}
|
||||
|
||||
|
||||
public void onOrdersWaitServiceChanged(List<OrderQueryRespBean.Result> waitServiceList) {
|
||||
if (null == waitServiceList) return;
|
||||
if (null == serverOrdersFragment) return;
|
||||
@@ -341,11 +367,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
serverOrdersFragment.onCurrentOrderRouteInfoGot(routeInfo);
|
||||
}
|
||||
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond) {
|
||||
// if (null == serverOrdersFragment) return;
|
||||
// serverOrdersFragment.onCurrentOrderDistToStartChanged(meters,timeInSecond);
|
||||
}
|
||||
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
|
||||
if (null == serverOrdersFragment) return;
|
||||
serverOrdersFragment.onCurrentOrderDistToEndChanged(meters, timeInSecond);
|
||||
@@ -375,6 +396,9 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
}
|
||||
TaxiModel.getInstance().setOnTheWayToEndStation();
|
||||
});
|
||||
findViewById(R.id.test_bar_route).setOnClickListener(v -> {
|
||||
testRouteInfoUpload();
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
|
||||
@@ -77,6 +78,7 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
if (null != countDownTimer){
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
VoiceNotice.stopCurrentTts();//中断当前在播语音
|
||||
getOchTaxiFragment().cancelNewBookingOrder();
|
||||
}else if (v.getId() == R.id.grab_order_tv){
|
||||
if (!mOrderGrabBt.getText().toString().equals("抢单中...")){
|
||||
@@ -93,11 +95,11 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
Calendar calendar = DateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
if (DateTimeUtil.compareDateIsCurrentDay(calendar)){
|
||||
mOrderReserverTime.setText("用车时间:今天 "+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm));
|
||||
getOchTaxiFragment().showNotice("预约单,今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)+"从"
|
||||
VoiceNotice.showNotice("预约单,今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)+"从"
|
||||
+order.startSiteAddr+"到"+order.endSiteAddr);
|
||||
}else {
|
||||
mOrderReserverTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd_HH_mm));
|
||||
getOchTaxiFragment().showNotice("预约单,"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd)+"从"
|
||||
VoiceNotice.showNotice("预约单,"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd)+"从"
|
||||
+order.startSiteAddr+"到"+order.endSiteAddr);
|
||||
}
|
||||
mOrderStartStation.setText(order.startSiteAddr);
|
||||
@@ -139,7 +141,7 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
// 接单成功,语音播报“抢单成功,请合理安排后续行程接送乘客”
|
||||
// 接单未成功,语音播报“接单失败,请继续接单”
|
||||
public void onGrabOrderSuccess(){//抢单成功,更新btn 和 动画 语音
|
||||
getOchTaxiFragment().showNotice("抢单成功,请合理安排后续行程接送乘客");
|
||||
VoiceNotice.showNotice("抢单成功,请合理安排后续行程接送乘客");
|
||||
mGrabResultAnimView.setVisibility(View.VISIBLE);
|
||||
mGrabResultAnimView.setImageDrawable(getResources().getDrawable(R.drawable.grab_success_anmi_flow));
|
||||
mOrderGrabBt.setClickable(false);
|
||||
@@ -165,7 +167,7 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
//开启动画结束的监听
|
||||
}
|
||||
public void onGrabOrderFailed(){//抢单失败,更新btn 和 动画 语音
|
||||
getOchTaxiFragment().showNotice("接单失败,请继续接单");
|
||||
VoiceNotice.showNotice("接单失败,请继续接单");
|
||||
mGrabResultAnimView.setVisibility(View.VISIBLE);
|
||||
mGrabResultAnimView.setImageDrawable(getResources().getDrawable(R.drawable.grab_failure_anmi_flow));
|
||||
mOrderGrabBt.setClickable(false);
|
||||
|
||||
@@ -0,0 +1,373 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.BitmapDescriptor;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.utils.TaxiMapAssetStyleUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* taxi司机端前往目的地小地图导航
|
||||
*/
|
||||
public class TaxiMapDirectionView
|
||||
extends RelativeLayout
|
||||
implements IMoGoMapLocationListener, ITaxiMapDirectionView, AMap.OnCameraChangeListener {
|
||||
|
||||
//小地图名称
|
||||
public static final String TAG = "TPMapDirectionView";
|
||||
|
||||
private TextureMapView mAMapNaviView;
|
||||
private AMap mAMap;
|
||||
private Marker mCarMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 13;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
private int mHaveArrivedIndex;
|
||||
|
||||
List<BitmapDescriptor> textureList = new ArrayList<>();
|
||||
List<Integer> texIndexList = new ArrayList<>();
|
||||
|
||||
private BitmapDescriptor mArrivedRes;
|
||||
private BitmapDescriptor mUnArrivedRes;
|
||||
|
||||
public TaxiMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaxiMapDirectionView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaxiMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
try {
|
||||
initView(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "initView");
|
||||
|
||||
mContext = context;
|
||||
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.taxi_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.taxi_amap_view);
|
||||
|
||||
initAMapView();
|
||||
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
|
||||
}
|
||||
|
||||
private void initAMapView() {
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(false);
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_car))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_view_dir_end)));
|
||||
mStartMarker.setVisible(false);
|
||||
mEndMarker.setVisible(false);
|
||||
|
||||
mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_arrived);
|
||||
mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_un_arrive);
|
||||
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
|
||||
.setStyleExtraData(TaxiMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(mCameraUpdate);
|
||||
|
||||
// 设置地图的样式
|
||||
UiSettings uiSettings = mAMap.getUiSettings();
|
||||
uiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
|
||||
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
|
||||
.setStyleExtraData(TaxiMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
}
|
||||
});
|
||||
|
||||
//设置地图状态的监听接口
|
||||
mAMap.setOnCameraChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
|
||||
if (location == null){
|
||||
return;
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
//圈定地图显示范围
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
//存放经纬度
|
||||
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
|
||||
boundsBuilder.include(currentLatLng);
|
||||
boundsBuilder.include(endLatLng);
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100,100,100,100));
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "onCarLocationChanged2--moveCamera :" + location.getLatitude()+", "+location.getLongitude());
|
||||
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder()
|
||||
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
//更新车辆位置
|
||||
if (mCarMarker != null) {
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "location.getBearing() = " + location.getBearing());
|
||||
mCarMarker.setRotateAngle(360 - location.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "onCarLocationChanged2--loacation :" + location.getLatitude()+", "+location.getLongitude());
|
||||
mCarMarker.setToTop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineMarker() {
|
||||
// if (mStartMarker != null) {
|
||||
// mStartMarker.setVisible(false);
|
||||
// }
|
||||
// if (mEndMarker != null) {
|
||||
// mEndMarker.setVisible(false);
|
||||
// }
|
||||
if (mStartMarker != null && mEndMarker != null
|
||||
&& mStartMarker.isVisible() && mEndMarker.isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
LatLng startLatLng = mCoordinatesLatLng.get(0);
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
|
||||
mStartMarker.setPosition(startLatLng);
|
||||
mEndMarker.setPosition(endLatLng);
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawablePolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mAMap != null) {
|
||||
|
||||
addRouteColorList();
|
||||
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
//设置线段纹理
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
polylineOptions.addAll(mCoordinatesLatLng);
|
||||
polylineOptions.setUseTexture(true);
|
||||
polylineOptions.width(15);
|
||||
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
|
||||
polylineOptions.setCustomTextureList(textureList);
|
||||
polylineOptions.setCustomTextureIndex(texIndexList);
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加画线颜色值
|
||||
*/
|
||||
private void addRouteColorList() {
|
||||
textureList.clear();
|
||||
texIndexList.clear();
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
|
||||
if (i <= mHaveArrivedIndex){
|
||||
textureList.add(mArrivedRes);
|
||||
}else {
|
||||
textureList.add(mUnArrivedRes);
|
||||
}
|
||||
texIndexList.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LatLng CoordinateConverterFrom84(Context mContext, MogoLatLng mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MogoLatLng m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyLine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void convert(List<MogoLatLng> coordinates) {
|
||||
mCoordinatesLatLng.clear();
|
||||
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext, coordinates);
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
public void setCoordinatesLatLng(List<LatLng> latLngs){
|
||||
mCoordinatesLatLng.clear();
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
public void setCoordinatesLatLng(List<LatLng> latLngs, int haveArrivedIndex){
|
||||
mCoordinatesLatLng.clear();
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
mHaveArrivedIndex = haveArrivedIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition cameraPosition) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish(CameraPosition cameraPosition) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.amap.api.navi.AMapNaviViewListener;
|
||||
import com.amap.api.navi.AMapNaviViewOptions;
|
||||
import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.taxi.model.NaviToDestinationModel;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/30
|
||||
*/
|
||||
public class TaxiNaviFragment extends BaseTaxiUIFragment implements AMapNaviViewListener, View.OnClickListener {
|
||||
|
||||
private AMapNaviView mAMapNaviView;
|
||||
// private OverviewButtonView mOverviewButtonView;
|
||||
// private NextTurnTipView mNextTurnTipView;
|
||||
private AMap aMap;
|
||||
private ITaxiNaviChangedCallback mNaviToStartInfoCallback; // 前往乘客上车点
|
||||
public static TaxiNaviFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiNaviFragment fragment = new TaxiNaviFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_navi_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(View view) {
|
||||
view.bringToFront();
|
||||
initMapView(view);
|
||||
}
|
||||
|
||||
private void initMapView(View view) {
|
||||
// mOverviewButtonView = view.findViewById(R.id.navi_overviewbuttonview);
|
||||
// mAMapNaviView.setLazyOverviewButtonView(mOverviewButtonView);
|
||||
// mOverviewButtonView.setOnClickListener(this);
|
||||
// DriveWayView mDriveWayView = view.findViewById(R.id.navi_drivewayview);
|
||||
// mAMapNaviView.setLazyDriveWayView(mDriveWayView);
|
||||
// mNextTurnTipView = view.findViewById(R.id.navi_nextturntipview);
|
||||
// mAMapNaviView.setLazyNextTurnTipView(mNextTurnTipView);
|
||||
mAMapNaviView = view.findViewById(R.id.navi_view);
|
||||
mAMapNaviView.setAMapNaviViewListener(this);
|
||||
//车头向上模式
|
||||
mAMapNaviView.setNaviMode(AMapNaviView.CAR_UP_MODE);
|
||||
aMap = mAMapNaviView.getMap();
|
||||
//关闭地图文字显示
|
||||
aMap.showMapText(false);
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
aMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
aMap.setTrafficEnabled(false);
|
||||
setMapViewOptions();
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null == getContext()){
|
||||
return;
|
||||
}
|
||||
aMap.setCustomMapStyle(
|
||||
new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"))
|
||||
);
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void setMapViewOptions() {
|
||||
AMapNaviViewOptions options = new AMapNaviViewOptions();
|
||||
options.setTilt(0);//设置 2D 模式
|
||||
options.setLayoutVisible(false);//设置导航界面UI是否显示。
|
||||
options.setTrafficBarEnabled(false);//设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
options.setAutoLockCar(true);//设置6秒后是否自动锁车
|
||||
options.setAutoDisplayOverview(true);//设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
options.setTrafficLine(false);
|
||||
options.setModeCrossDisplayShow(true);//设置是否显示路口放大图(路口模型图)
|
||||
options.setAutoChangeZoom(true);//自动缩放级别
|
||||
options.setCarBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.taxi_navi_arrow_icon));
|
||||
options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.taxi_navi_direction_icon));
|
||||
options.setAutoChangeZoom(true);//设置是否开启动态比例尺 (锁车态下自动进行地图缩放变化)
|
||||
// options.setZoom(18);//14-18
|
||||
// options.setTrafficInfoUpdateEnabled(false);
|
||||
// options.setTrafficLayerEnabled(false);//设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setCameraInfoUpdateEnabled(false);
|
||||
// options.setCompassEnabled(false);//设置指南针图标否在导航界面显示,默认显示。
|
||||
// options.setLaneInfoShow(false);// 设置是否显示道路信息view
|
||||
// options.setNaviArrowVisible(false);//设置路线转向箭头隐藏和显示
|
||||
// options.setRealCrossDisplayShow(false);//设置是否显示路口放大图(实景图)
|
||||
// options.setRouteListButtonShow(true);//设置导航界面是否显示路线全览按钮。
|
||||
// options.setSettingMenuEnabled(false);//设置菜单按钮是否在导航界面显示。
|
||||
|
||||
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
|
||||
|
||||
// routeOverlayOptions.setArrowOnTrafficRoute(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_aolr));
|
||||
routeOverlayOptions.setNormalRoute(BitmapFactory.decodeResource(getResources(), R.drawable.taxi_navi_line_icon));
|
||||
options.setRouteOverlayOptions(routeOverlayOptions);
|
||||
|
||||
mAMapNaviView.setViewOptions(options);
|
||||
}
|
||||
public void goToOverview(){
|
||||
if (mAMapNaviView.isRouteOverviewNow()){
|
||||
mAMapNaviView.recoverLockMode();
|
||||
}else {
|
||||
mAMapNaviView.displayOverview();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// if (v.getId() == R.id.navi_overviewbuttonview){
|
||||
// goToOverview();
|
||||
// }
|
||||
}
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
NaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(false);
|
||||
if (mAMapNaviView != null){
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
|
||||
if (mNaviToStartInfoCallback != null){
|
||||
mNaviToStartInfoCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviSetting() {
|
||||
//底部导航设置点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviMapMode(int naviMode) {
|
||||
//导航态车头模式,0:车头朝上状态;1:正北朝上模式。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviTurnClick() {
|
||||
//转弯view的点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextRoadClick() {
|
||||
//下一个道路View点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onScanViewButtonClick() {
|
||||
//全览按钮点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
//锁地图状态发生变化时回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewLoaded() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "导航页面加载成功");
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapTypeChanged(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewShowMode(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNaviBackClick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车道信息说明:
|
||||
* <p>
|
||||
* 0xFF, 无对应车道
|
||||
* 0, 直行
|
||||
* 1, 左转
|
||||
* 2, 直行+左转
|
||||
* 3, 右转
|
||||
* 4, 直行+右转
|
||||
* 5, 左掉头
|
||||
* 6, 左转+右转
|
||||
* 7, 直行+左转+右转
|
||||
* 8, 右掉头
|
||||
* 9, 直行+左掉头
|
||||
* 10, 直行+右掉头
|
||||
* 11, 左转+左掉头
|
||||
* 12, 右转+右掉头
|
||||
* 13, 直行+扩展
|
||||
* 14, 左转+左掉头+扩展
|
||||
* 15, 保留
|
||||
* 16, 直行+左转+左掉头
|
||||
* 17, 右转+左掉头
|
||||
* 18, 左转+右转+左掉头
|
||||
* 19, 直行+右转+左掉头
|
||||
* 20, 左转+右掉头
|
||||
* 21, 公交车道
|
||||
* 22, 空车道
|
||||
* 23 可变车道
|
||||
*/
|
||||
|
||||
String[] array = {
|
||||
"直行车道"
|
||||
, "左转车道"
|
||||
, "左转或直行车道"
|
||||
, "右转车道"
|
||||
, "右转或直行车道"
|
||||
, "左掉头车道"
|
||||
, "左转或者右转车道"
|
||||
, " 左转或右转或直行车道"
|
||||
, "右转掉头车道"
|
||||
, "直行或左转掉头车道"
|
||||
, "直行或右转掉头车道"
|
||||
, "左转或左掉头车道"
|
||||
, "右转或右掉头车道"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择该车道"
|
||||
, "直行+左转+左掉头车道"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
|
||||
String[] actions = {
|
||||
"直行"
|
||||
, "左转"
|
||||
, "左转或直行"
|
||||
, "右转"
|
||||
, "右转或这行"
|
||||
, "左掉头"
|
||||
, "左转或者右转"
|
||||
, " 左转或右转或直行"
|
||||
, "右转掉头"
|
||||
, "直行或左转掉头"
|
||||
, "直行或右转掉头"
|
||||
, "左转或左掉头"
|
||||
, "右转或右掉头"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择"
|
||||
, "直行+左转+左掉头"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.presenter.NaviPresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/30
|
||||
*/
|
||||
public class TaxiRottingNaviFragment extends MvpFragment<TaxiRottingNaviFragment, NaviPresenter> {
|
||||
|
||||
private final String TAG = TaxiRottingNaviFragment.class.getSimpleName();
|
||||
|
||||
private TaxiMapDirectionView mMapDirectionView;
|
||||
public static TaxiRottingNaviFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiRottingNaviFragment fragment = new TaxiRottingNaviFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_rotting_navi_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mMapDirectionView = mRootView.findViewById(R.id.rotting_navi_view);
|
||||
mMapDirectionView.onCreateView(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mMapDirectionView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mMapDirectionView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mMapDirectionView != null){
|
||||
mMapDirectionView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected NaviPresenter createPresenter() {
|
||||
return new NaviPresenter(this);
|
||||
}
|
||||
|
||||
public void routeResult(List<LatLng> latLngList, int haveArrivedIndex){
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolylineByRoute(latLngList,haveArrivedIndex);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
public void setLineMarker(List<LatLng> latLngList){
|
||||
if (null != latLngList && latLngList.size() > 0) {
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.setCoordinatesLatLng(latLngList);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.setLineMarker();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawablePolylineByRoute(List<LatLng> mCoordinatesLatLng,int haveArrivedIndex){
|
||||
if (mMapDirectionView != null){
|
||||
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private void clearPolyline() {
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearPolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,10 +200,7 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.onCurrentOrderCancelDone();
|
||||
}
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond){
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.updateDistanceAndTime(meters,timeInSecond);
|
||||
}
|
||||
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond){
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.updateDistanceAndTime(meters,timeInSecond);
|
||||
@@ -217,4 +214,9 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.updateOrderBottomBtnUI();
|
||||
}
|
||||
|
||||
public void onNaviToEndAmap(boolean isShow){
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.onNaviToEndAmap(isShow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TPRouteDataTestUtils {
|
||||
builder.setLongitude(s.getDouble("lon"));
|
||||
list.add(builder.build());
|
||||
}
|
||||
TaxiModel.getInstance().updateOrderRoute(list);
|
||||
// TaxiModel.getInstance().updateOrderRoute(list);
|
||||
TaxiModel.getInstance().updateOrderRouteInfo(list);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
@@ -37,10 +36,29 @@ public class TaxiAnalyticsManager {
|
||||
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT, false);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
triggerStartAutopilotFailureEvent("15s后app等待超时");
|
||||
};
|
||||
|
||||
public void triggerStartAutopilotFailureEventByAdas(String failMsg){
|
||||
removeWaitingCallback();
|
||||
triggerStartAutopilotFailureEvent(failMsg);
|
||||
}
|
||||
|
||||
private void removeWaitingCallback() {
|
||||
if (startAutopilotRunnable != null &&
|
||||
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failMsg){
|
||||
CallerLogger.INSTANCE.e(M_TAXI + "triggerStartAutopilotFailureEvent", failMsg);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT, false);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_MSG,
|
||||
failMsg);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
* 开启自动驾驶,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
@@ -69,14 +87,38 @@ public class TaxiAnalyticsManager {
|
||||
|
||||
if (send) {
|
||||
// 开启成功,上报埋点
|
||||
if (startAutopilotRunnable != null &&
|
||||
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, TaxiConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发"无法开启自驾已知异常"埋点
|
||||
* @param startName
|
||||
* @param endName
|
||||
* @param orderNo
|
||||
*/
|
||||
public void triggerUnableStartAPReasonEvent(String startName, String endName, String orderNo,
|
||||
String reason) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put(TaxiConst.EVENT_PARAM_SN, sn);
|
||||
params.put(TaxiConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(TaxiConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(TaxiConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(TaxiConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(TaxiConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(TaxiConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
|
||||
params.put(TaxiConst.EVENT_PARAM_UNABLE_START_REASON, reason);
|
||||
AnalyticsManager.INSTANCE.track(TaxiConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/18/20 5:37 PM
|
||||
*/
|
||||
public class TaxiMapAssetStyleUtil {
|
||||
|
||||
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];
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 783 B |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 783 B |