Merge branch 'dev_robotaxi-d-app-module_280_220608_2.8.0' into dev_robotaxi-d-app-module_280_taxi_passenger

This commit is contained in:
yangyakun
2022-06-24 18:47:31 +08:00
106 changed files with 643 additions and 214 deletions

View File

@@ -43,6 +43,11 @@ class BusConst {
const val LOOP_PERIOD_1S = 1 * 1000L
const val LOOP_DELAY = 100L
// 下发给MEC轨迹信息间隔时间 10秒
const val LOOP_PERIOD_10S = 10 * 1000L
// 尝试下发给MEC轨迹最多10次
const val LOOP_SEND_TRAJ_TIMES = 10
//起点UUID
const val BUS_START_MAP_MAKER = "bus_start_map_maker";
//终点UUID

View File

@@ -43,7 +43,9 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusRoutesResult;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.model.BusOrderModel;
import com.mogo.och.bus.util.BDRouteDataTestUtils;
import com.mogo.och.bus.view.BusArcView;
import com.mogo.och.bus.view.SlidePanelView;
@@ -71,6 +73,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
public boolean isOperationStatus;//false-收车true-出车
private FrameLayout flStationPanelContainer;
private Group groupTestPanel;
private View busTestBar;
private FrameLayout flSpeed;
private BusArcView mouduleArc;
private ImageView mUpgradeTipIv;
@@ -106,6 +109,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
@Override
protected void initViews() {
groupTestPanel = findViewById(R.id.groupTestPanel);
busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar);
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
ctvAutopilotStatusIv = findViewById(R.id.bus_autopilot_btn_iv);
@@ -510,4 +514,24 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
groupTestPanel.setVisibility(View.VISIBLE);
}
}
/**
* bus testBar开关
*/
public void showHideTestBar() {
if (busTestBar.getVisibility() == View.VISIBLE) {
busTestBar.setVisibility(View.GONE);
} else {
BusRoutesResult routesResult = BusOrderModel.getInstance().getBusRoutesResult();
if (routesResult != null) {
TextView lineIdTV = findViewById(R.id.bus_test_bar_current_line_id);
TextView trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5);
TextView stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5);
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
}
busTestBar.setVisibility(View.VISIBLE);
}
}
}

View File

@@ -84,6 +84,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
//debug下调用测试面板
mCurrentStationName.setOnLongClickListener(v -> {
debugTestBar();
showHideTestBar();
return true;
});
}

View File

@@ -23,12 +23,9 @@ import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -51,6 +48,7 @@ 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.BusTrajectoryManager;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.och.common.module.utils.PinYinUtil;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
@@ -612,6 +610,7 @@ public class BusOrderModel {
mIsWorking = !mIsWorking;
carOperationStatusCallback.changeOperationStatus(isWorking());
startOrStopOrderLoop(mIsWorking);
BusTrajectoryManager.getInstance().stopTrajReqLoop();
}
@Override
public void onFail(String failMsg) {
@@ -745,6 +744,9 @@ public class BusOrderModel {
if ( currentStation.isLeaving() && slidePannelHideCallback != null) {
slidePannelHideCallback.hideSlidePanel();
}
//需放在currentStationIndex赋值之后
BusTrajectoryManager.getInstance().syncTrajectoryInfo();
}
/**
@@ -922,4 +924,12 @@ public class BusOrderModel {
BusAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestart, send,
currentStation.getName(), nextStation.getName(), currentLineId);
}
public BusRoutesResult getBusRoutesResult() {
return busRoutesResult;
}
public int getCurrentStationIndex() {
return currentStationIndex;
}
}

View File

@@ -23,6 +23,7 @@ import com.mogo.och.bus.callback.IRefreshBusStationsCallback;
import com.mogo.och.bus.callback.ISlidePannelHideCallback;
import com.mogo.och.bus.fragment.BusFragment;
import com.mogo.och.bus.model.BusOrderModel;
import com.mogo.och.bus.util.BusTrajectoryManager;
import org.jetbrains.annotations.NotNull;
@@ -276,7 +277,7 @@ public class BusPresenter extends Presenter<BusFragment>
@Override
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
BusTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo);
}
@Override

View File

@@ -0,0 +1,186 @@
package com.mogo.och.bus.util;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.och.bus.bean.BusRoutesResult;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.model.BusOrderModel;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import mogo_msg.MogoReportMsg;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
/**
* Bus轨迹管理给MEC下发用于轨迹下载的信息
* Created on 2022/6/23
*/
public class BusTrajectoryManager {
private static final String TAG = BusTrajectoryManager.class.getSimpleName();
private static final class SingletonHolder {
private static final BusTrajectoryManager INSTANCE = new BusTrajectoryManager();
}
public static BusTrajectoryManager getInstance() {
return BusTrajectoryManager.SingletonHolder.INSTANCE;
}
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
private Disposable mSendReqDisposable = null;
public BusTrajectoryManager() {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
-1, "", "", "", "",
0, "");
}
/**
* 同步Bus路线信息
*/
public void syncTrajectoryInfo() {
BusRoutesResult routesResult = BusOrderModel.getInstance().getBusRoutesResult();
if (routesResult != null
&& BusOrderModel.getInstance().getCurrentStationIndex() == 0
&& !BusOrderModel.getInstance().isGoingToNextStation()) {
CallerLogger.INSTANCE.d(M_BUS + TAG, "syncTrajectoryInfo() start.");
startTrajReqLoop();
} else {
// 无路线信息or当前未在始发站
CallerLogger.INSTANCE.d(M_BUS + TAG, "syncTrajectoryInfo() stop.");
stopTrajReqLoop();
}
}
/**
* 接口MEC反馈的常规信息MAP v2.5.0新增轨迹相关信息)
* @param guardianInfo
*/
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
if (guardianInfo == null || !guardianInfo.hasCode()) return;
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
// 1. 轨迹管理_轨迹开始下载本地已有对应轨迹也触发
CallerLogger.INSTANCE.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹开始下载");
stopTrajReqLoop();
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS".equals(guardianInfo.getCode())) {
// 2. 轨迹管理_轨迹下载成功本地已有对应轨迹也触发
CallerLogger.INSTANCE.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹下载成功");
stopTrajReqLoop();
} else if ("ISYS_INIT_TRAJECTORY_FAILURE".equals(guardianInfo.getCode())) {
// 3. 轨迹管理_轨迹下载失败本地无对应轨迹
CallerLogger.INSTANCE.d(M_BUS + TAG, "onAutopilotGuardian() " +
"轨迹下载失败,本地无对应轨迹");
} else if ("ISYS_INIT_TRAJECTORY_WARNING".equals(guardianInfo.getCode())) {
// 4. 轨迹管理_轨迹下载失败本地有对应轨迹认为成功
CallerLogger.INSTANCE.d(M_BUS + TAG, "onAutopilotGuardian() " +
"轨迹下载失败,本地有对应轨迹,认为成功");
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
// 5. 轨迹管理_轨迹下载超时
CallerLogger.INSTANCE.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹下载超时");
}
}
private void setupAutoPilotLine() {
BusRoutesResult routesResult = BusOrderModel.getInstance().getBusRoutesResult();
if (routesResult == null) {
CallerLogger.INSTANCE.e(M_BUS + TAG,
"setupAutoPilotLine(): routesResult is null.");
return;
} else {
if (mAutoPilotLine == null) {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(routesResult.getLineId(),
routesResult.csvFileUrl, routesResult.csvFileMd5,
routesResult.txtFileUrl, routesResult.txtFileMd5,
routesResult.contrailSaveTime, routesResult.carModel);
} else {
mAutoPilotLine.setLineId(routesResult.getLineId());
mAutoPilotLine.setTrajUrl(routesResult.csvFileUrl);
mAutoPilotLine.setTrajMd5(routesResult.csvFileMd5);
mAutoPilotLine.setStopUrl(routesResult.txtFileUrl);
mAutoPilotLine.setStopMd5(routesResult.txtFileMd5);
mAutoPilotLine.setTimestamp(routesResult.contrailSaveTime);
mAutoPilotLine.setVehicleModel(routesResult.carModel);
}
}
}
private void clearAutoPilotLine() {
if (mAutoPilotLine == null) return;
mAutoPilotLine.setLineId(-1);
mAutoPilotLine.setTrajUrl("");
mAutoPilotLine.setTrajMd5("");
mAutoPilotLine.setStopUrl("");
mAutoPilotLine.setStopMd5("");
mAutoPilotLine.setTimestamp(0);
mAutoPilotLine.setVehicleModel("");
}
private void startTrajReqLoop() {
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.d(M_BUS + TAG, "startTrajReqLoop()");
setupAutoPilotLine();
mSendReqDisposable = Observable.interval(BusConst.LOOP_DELAY,
BusConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> {
if (aLong > BusConst.LOOP_SEND_TRAJ_TIMES) {
stopTrajReqLoop();
return;
}
CallerLogger.INSTANCE.d(M_BUS + TAG, "loop sendTrajectoryReq: " + aLong);
sendTrajectoryReq();
});
}
public void stopTrajReqLoop() {
if (mSendReqDisposable != null) {
CallerLogger.INSTANCE.d(M_BUS + TAG, "stopTrajReqLoop()");
mSendReqDisposable.dispose();
mSendReqDisposable = null;
clearAutoPilotLine();
}
}
private void sendTrajectoryReq() {
if (mAutoPilotLine == null) {
CallerLogger.INSTANCE.e(M_BUS + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
return;
}
// TODO: 2022/6/24
// test1
// mAutoPilotLine.setLineId(148);
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
// mAutoPilotLine.setVehicleModel("红旗H9");
// test2
// mAutoPilotLine.setLineId(148);
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
// mAutoPilotLine.setVehicleModel("红旗H9");
CallerAutoPilotManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
CallerLogger.INSTANCE.d(M_BUS + TAG, "sendTrajectoryReq(): "
+ GsonUtils.toJson(mAutoPilotLine));
}
}

View File

@@ -70,6 +70,16 @@
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
tools:visibility="visible" />
<include
android:id="@+id/module_mogo_och_bus_test_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/bus_test_bar_view"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_station_panel_container"
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_station_panel_container"
tools:visibility="visible"/>
<!--切换地图远近事件 @dimen/module_switch_map -->
<LinearLayout
android:id="@+id/bus_switch_model_layout"

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/bus_test_bar_current_line_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/bus_test_bar_current_traj_md5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/bus_test_bar_current_stop_md5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
</LinearLayout>

View File

@@ -394,7 +394,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
public void run() {
decodedBitmapByReuse(bitmapIds.get(index), options);
index++;
if (index < bitmapIds.size()) {
if (index < bitmapIds.size() && null != handler) {
handler.post(this);
} else {
index = 0;

View File

@@ -50,6 +50,13 @@ public class TaxiPassengerOrderQueryRespBean extends BaseData {
//订单多少乘客
public String passengerNum;
public long lineId = -1; //路线id默认-1
public String csvFileUrl = ""; //轨迹文件下载的cos url默认“”
public String csvFileMd5 = ""; //轨迹文件md5默认“”
public String txtFileUrl = ""; //打点文件下载的cos url默认“”
public String txtFileMd5 = ""; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel = ""; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
// !!!接口中暂无此字段仅用于本地实现逻辑使用起始站目的站距离km
public double travelDistance;

View File

@@ -869,6 +869,15 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
parameters.endName = PinYinUtil.getPinYinHeadChar(mCurrentOCHOrder.endSiteAddr); // 终点名称拼音首字母大写科学城C区三号门KXCCQSHM
parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(startWgsLat, startWgsLon);
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(endWgsLat, endWgsLon);
if (parameters.autoPilotLine == null) {
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
mCurrentOCHOrder.lineId,
mCurrentOCHOrder.csvFileUrl, mCurrentOCHOrder.csvFileMd5,
mCurrentOCHOrder.txtFileUrl, mCurrentOCHOrder.txtFileMd5,
mCurrentOCHOrder.contrailSaveTime, mCurrentOCHOrder.carModel);
}
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "start autopilot with parameter: %s"
, GsonUtil.jsonFromObject(parameters)

View File

@@ -190,7 +190,7 @@ public class TaxiPassengerServiceManager {
,TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
mOCHTaxiServiceApi.startServicePilotDone(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
,MoGoAiCloudClientConfig.getInstance().getToken()
,new TaxiPassengerStartReqBean(MoGoAiCloudClientConfig.getInstance().getSn()
,new TaxiPassengerStartReqBean(getDriverAppSn()
,orderNo,loc))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -188,8 +188,8 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
}
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
runOnUIThread(() ->{
mView.showOrHideServingOrderFragment(true);
mView.showOrHideStartAutopilotView(false,false);
mView.showOrHideServingOrderFragment(true);
});
TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotoop(false);
}

View File

@@ -1,10 +1,10 @@
package com.mogo.och.taxi.passenger.ui;
import android.animation.ObjectAnimator;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -17,6 +17,7 @@ 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.hmi.CallerHmiManager;
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.OverlayViewUtils;
import com.mogo.map.MogoMapUIController;
import com.mogo.map.MogoMarkerManager;
@@ -184,9 +185,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status
&& mPrevAPStatus != status) {
// 2. 主动开启自动驾驶中为2则停止loading并isStarting = false
if ( mStartAutopilotView != null && mStartAutopilotView.get() != null){
mStartAutopilotView.get().startOrStopLoadingAnim(false);
}
onAutopilotStatusSuccessDone();
}
// 3. 其他过程直接更新
if (mPrevAPStatus != status){
@@ -291,11 +290,15 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
OverlayViewUtils.showOverlayView(getActivity(),mStartAutopilotView.get());
updateStartAutopilotBtnStatus(isClickable);
}else {
CallerLogger.INSTANCE.d(M_TAXI_P+" showOrHideStartAutopilotView","mStartAutopilotView = " + mStartAutopilotView);
if (mStartAutopilotView != null){
CallerLogger.INSTANCE.d(M_TAXI_P+" showOrHideStartAutopilotView","mStartAutopilotView.get() = " + mStartAutopilotView.get());
}
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
return;
}
mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(null);
OverlayViewUtils.dismissOverlayView(mStartAutopilotView.get());
mStartAutopilotView.get().closeAllAnimsAndView();
}
}
@@ -306,6 +309,13 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
mStartAutopilotView.get().updateStartAutopilotBtnStatus(isClickable);
}
public void onAutopilotStatusSuccessDone(){
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
return;
}
mStartAutopilotView.get().onAutopilotStatusSuccess();
}
/**
* 显示或者隐藏到达乘客站点的洁面
* ① 取消订单 可有可无

View File

@@ -1,13 +1,17 @@
package com.mogo.och.taxi.passenger.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.elegant.utils.UiThreadHandler;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.common.module.wigets.sfv.FrameFinishCallback;
import com.mogo.och.common.module.wigets.sfv.FrameSurfaceView;
@@ -24,93 +28,15 @@ import java.util.Arrays;
public class TaxiPassengerStartAutopilotView extends RelativeLayout implements View.OnClickListener {
private TextView mStartAutopilotBtn;
// private ImageView mAutopilotStartingImage;
private ImageView mAutopilotBtnBg;
private ImageView mCloseIV;
private ITPClickStartAutopilotCallback mClickCallback;
public boolean isStarting = false;
private AnimationDrawable mAnimationBtnDrawable;
private AnimationDrawable mAnimationStartingDrawable;
private static final long TIMER_START_AUTOPILOT_INTERVAL = 10 * 1000L;
private Context mContext;
private View view;
private FrameSurfaceView svCarStartingFrame;
private FrameSurfaceView svBtnBgFrame;
private Integer[] btnBgAnimIds = new Integer[]{
R.drawable.image_00000,
R.drawable.image_00001,
R.drawable.image_00002,
R.drawable.image_00003,
R.drawable.image_00004,
R.drawable.image_00005,
R.drawable.image_00006,
R.drawable.image_00007,
R.drawable.image_00008,
R.drawable.image_00009,
R.drawable.image_00010,
R.drawable.image_00011,
R.drawable.image_00012,
R.drawable.image_00013,
R.drawable.image_00014,
R.drawable.image_00015,
R.drawable.image_00016,
R.drawable.image_00017,
R.drawable.image_00018,
R.drawable.image_00019,
R.drawable.image_00020,
R.drawable.image_00021,
R.drawable.image_00022,
R.drawable.image_00023,
R.drawable.image_00024,
R.drawable.image_00025,
R.drawable.image_00026,
R.drawable.image_00027,
R.drawable.image_00028,
R.drawable.image_00029,
R.drawable.image_00030,
R.drawable.image_00031,
R.drawable.image_00032,
R.drawable.image_00033,
R.drawable.image_00034,
R.drawable.image_00035,
R.drawable.image_00036,
R.drawable.image_00037,
R.drawable.image_00038,
R.drawable.image_00039,
R.drawable.image_00040,
R.drawable.image_00041,
R.drawable.image_00042,
R.drawable.image_00043,
R.drawable.image_00044,
R.drawable.image_00045,
R.drawable.image_00046,
R.drawable.image_00047,
R.drawable.image_00048,
R.drawable.image_00049,
R.drawable.image_00050,
R.drawable.image_00051,
R.drawable.image_00052,
R.drawable.image_00053,
R.drawable.image_00054,
R.drawable.image_00055,
R.drawable.image_00056,
R.drawable.image_00057,
R.drawable.image_00058,
R.drawable.image_00059,
R.drawable.image_00060,
R.drawable.image_00061,
R.drawable.image_00062,
R.drawable.image_00063,
R.drawable.image_00064,
R.drawable.image_00065,
R.drawable.image_00066,
R.drawable.image_00067,
R.drawable.image_00068,
R.drawable.image_00069,
R.drawable.image_00070,
R.drawable.image_00071,
R.drawable.image_00072,
R.drawable.image_00073,
R.drawable.image_00074
};
private Integer[] startingAnimIds = new Integer[]{
R.drawable.light_00000,
R.drawable.light_00001,
@@ -138,15 +64,15 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
view = LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this,true);
mStartAutopilotBtn = view.findViewById(R.id.taxi_p_start_autopilot);
mStartAutopilotBtn.setOnClickListener(this);
// mAutopilotStartingImage = view.findViewById(R.id.taxi_p_autopilot_starting);
mCloseIV = view.findViewById(R.id.starting_autopilot_view_close);
mCloseIV.setOnClickListener(this);
mAutopilotBtnBg = view.findViewById(R.id.taxi_p_autopilot_btn_bg);
svCarStartingFrame = view.findViewById(R.id.taxi_p_autopilot_starting);
svCarStartingFrame.setBitmapIds(Arrays.asList(startingAnimIds));
svCarStartingFrame.setDuration(1680);
svBtnBgFrame = view.findViewById(R.id.taxi_p_start_autopilot_btn_sfv);
svBtnBgFrame.setBitmapIds(Arrays.asList(btnBgAnimIds));
svBtnBgFrame.setDuration(7500);
svCarStartingFrame.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@@ -172,117 +98,109 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
startOrStopLoadingAnim(true);
if (mClickCallback != null) mClickCallback.onClickCallback();
}
}else if (v.getId() == R.id.starting_autopilot_view_close){
OverlayViewUtils.dismissOverlayView(this);
}
}
@SuppressLint("UseCompatLoadingForDrawables")
public void updateStartAutopilotBtnStatus(boolean isClickable){
svCarStartingFrame.setBackgroundResource(R.drawable.light_00000);
if (svCarStartingFrame != null){
svCarStartingFrame.setBackgroundResource(R.drawable.light_00000);
}
if (mStartAutopilotBtn == null) return;
mStartAutopilotBtn.setTag(isClickable);
mStartAutopilotBtn.setText(
mContext.getResources().getString(R.string.taxi_p_start_autopilot_txt));
if (isClickable){ //高亮可点击状态下UI
mStartAutopilotBtn.setTextColor(
mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_color));
mStartAutopilotBtn.setBackground(null);
mAutopilotBtnBg.setBackground(mContext.getResources().getDrawable(R.drawable.anmi_flow));
startAutopilotBgAnimatorDrawable(true);
}else {// 置灰色可点击状态下 UI
startAutopilotBgAnimatorDrawable(false);
mStartAutopilotBtn.setBackground(
mContext.getResources().getDrawable(R.drawable.taxi_p_start_autopilot_txt_btn_bg));
mAutopilotBtnBg.setBackground(null);
mStartAutopilotBtn.setTextColor(
mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_un_color));
startAutopilotBgAnimatorDrawable(false);
}
mStartAutopilotBtn.setTag(isClickable);
mStartAutopilotBtn.setText(
mContext.getResources().getString(R.string.taxi_p_start_autopilot_txt));
}
public void startAutopilotBgAnimatorDrawable(boolean isStart){
if (isStart){
svBtnBgFrame.setRepeatTimes(-1);
svBtnBgFrame.setFrameFinishCallback(new FrameFinishCallback() {
@Override
public void onFinishCallback() {
// svBtnBgFrame.setBackgroundResource(R.drawable.image_00000);
}
});
svBtnBgFrame.start();
if (mAnimationBtnDrawable == null) {
mAnimationBtnDrawable = (AnimationDrawable) mAutopilotBtnBg.getBackground();
}
if (mAnimationBtnDrawable.isRunning()) {
return;
}
mAnimationBtnDrawable.selectDrawable(0);
mAnimationBtnDrawable.start();
}else {
svBtnBgFrame.reset();
svBtnBgFrame.setBackground(null);
clearBgAnimDrawable();
}
// if (isStart){
// if (mAnimationBtnDrawable == null) {
// mAnimationBtnDrawable = (AnimationDrawable) mStartAutopilotBtn.getBackground();
// }
// if (mAnimationBtnDrawable.isRunning()) {
// return;
// }
// mAnimationBtnDrawable.selectDrawable(0);
// mAnimationBtnDrawable.start();
// }else {
// if (mAnimationBtnDrawable != null) {
// mAnimationBtnDrawable.stop();
// }
// mAnimationBtnDrawable = null;
// }
}
private void startingCarBgAnimatorDrawable(boolean isStart){
if (isStart){
if (isStart && svCarStartingFrame != null){
svCarStartingFrame.setRepeatTimes(-1);
svCarStartingFrame.setFrameFinishCallback(new FrameFinishCallback() {
@Override
public void onFinishCallback() {
}
});
svCarStartingFrame.setBackground(null);
svCarStartingFrame.start();
}else {
svCarStartingFrame.reset();
svCarStartingFrame.setBackgroundResource(R.drawable.light_00000);
if (svCarStartingFrame != null){
svCarStartingFrame.reset();
svCarStartingFrame.setBackgroundResource(R.drawable.light_00000);
}
}
// if (isStart){
// if (mAnimationStartingDrawable == null) {
// mAnimationStartingDrawable = (AnimationDrawable) mAutopilotStartingImage.getBackground();
// }
// if (mAnimationStartingDrawable.isRunning()) {
// return;
// }
// mAnimationStartingDrawable.selectDrawable(0);
// mAnimationStartingDrawable.start();
// }else {
// if (mAnimationStartingDrawable != null) {
// mAnimationStartingDrawable.selectDrawable(0);
// mAnimationStartingDrawable.stop();
// }
// mAnimationStartingDrawable = null;
// }
}
public void startOrStopLoadingAnim(boolean start) {
startingCarBgAnimatorDrawable(start);
if (start) {
isStarting = true;
mStartAutopilotBtn.setText(getResources().getString(R.string.taxi_p_start_autopilot_loading));
mStartAutopilotBtn.setTextColor(getResources().getColor(R.color.taxi_p_start_autopilot_txt_color));
startingAutopilotCountDown();
} else {
clearBgAnimDrawable();
isStarting = false;
updateStartAutopilotBtnStatus(true);
}
}
public void onAutopilotStatusSuccess(){
startOrStopLoadingAnim(false);
public void clearBgAnimDrawable() {
if (mAnimationBtnDrawable != null) {
mAnimationBtnDrawable.stop();
}
mAnimationBtnDrawable = null;
}
public void onAutopilotStatusFailure(){
public void closeAllAnimsAndView(){
clearStartingAnimFrame();
if (mAnimationBtnDrawable != null) {
mAnimationBtnDrawable.stop();
}
isStarting = false;
OverlayViewUtils.dismissOverlayView(this);
}
public void clearStartingAnimFrame(){
if (svCarStartingFrame != null){
svCarStartingFrame.destroy();
}
svCarStartingFrame = null;
}
public void onAutopilotStatusSuccess(){
startOrStopLoadingAnim(false);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:width="520px" android:height="150px"/>
<corners android:radius="76px"/>
<gradient
android:angle="180"

View File

@@ -4,38 +4,49 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MissingDefaultResource"
android:background="@drawable/taxi_p_passenger_start_panel_bg">
android:background="@drawable/taxi_p_passenger_start_panel_bg"
tools:ignore="MissingDefaultResource">
<com.mogo.och.common.module.wigets.sfv.FrameSurfaceView
android:id="@+id/taxi_p_autopilot_starting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
android:id="@+id/taxi_p_autopilot_starting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.och.common.module.wigets.sfv.FrameSurfaceView
android:id="@+id/taxi_p_start_autopilot_btn_sfv"
<ImageView
android:id="@+id/starting_autopilot_view_close"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/taxi_p_passenger_arrived_close"
android:layout_marginEnd="@dimen/dp_70"
android:layout_marginTop="@dimen/dp_140"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/taxi_p_autopilot_btn_bg"
android:layout_width="1000px"
android:layout_height="500px"
android:clickable="false"
android:elevation="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/taxi_p_start_autopilot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/taxi_p_start_autopilot_txt"
android:textSize="@dimen/taxi_p_start_autopilot_txt_size"
android:textStyle="bold"
android:textColor="@color/taxi_p_start_autopilot_txt_un_color"
android:elevation="5dp"
app:layout_constraintLeft_toLeftOf="@+id/taxi_p_start_autopilot_btn_sfv"
app:layout_constraintRight_toRightOf="@+id/taxi_p_start_autopilot_btn_sfv"
app:layout_constraintTop_toTopOf="@+id/taxi_p_start_autopilot_btn_sfv"
app:layout_constraintBottom_toBottomOf="@+id/taxi_p_start_autopilot_btn_sfv"/>
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/taxi_p_start_autopilot"
android:layout_width="@dimen/taxi_p_start_autopilot_btn_width"
android:layout_height="@dimen/taxi_p_start_autopilot_btn_height"
android:gravity="center"
android:text="@string/taxi_p_start_autopilot_txt"
android:textColor="@color/taxi_p_start_autopilot_txt_color"
android:textSize="@dimen/taxi_p_start_autopilot_txt_size"
android:textStyle="bold"
android:background="@drawable/taxi_p_start_autopilot_txt_btn_bg"
app:layout_constraintBottom_toBottomOf="@+id/taxi_p_autopilot_btn_bg"
app:layout_constraintLeft_toLeftOf="@+id/taxi_p_autopilot_btn_bg"
app:layout_constraintRight_toRightOf="@+id/taxi_p_autopilot_btn_bg"
app:layout_constraintTop_toTopOf="@+id/taxi_p_autopilot_btn_bg"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -63,6 +63,6 @@
<dimen name="taxi_p_route_txt_unit_size">28px</dimen>
<dimen name="taxi_p_start_autopilot_txt_size">52px</dimen>
<dimen name="taxi_p_start_autopilot_btn_width">1000px</dimen>
<dimen name="taxi_p_start_autopilot_btn_height">500px</dimen>
<dimen name="taxi_p_start_autopilot_btn_width">520px</dimen>
<dimen name="taxi_p_start_autopilot_btn_height">150px</dimen>
</resources>

View File

@@ -126,7 +126,7 @@
<dimen name="taxi_p_route_txt_unit_size">28px</dimen>
<dimen name="taxi_p_start_autopilot_txt_size">52px</dimen>
<dimen name="taxi_p_start_autopilot_btn_width">1000px</dimen>
<dimen name="taxi_p_start_autopilot_btn_height">500px</dimen>
<dimen name="taxi_p_start_autopilot_btn_width">520px</dimen>
<dimen name="taxi_p_start_autopilot_btn_height">150px</dimen>
</resources>

View File

@@ -121,6 +121,6 @@
<dimen name="taxi_p_route_txt_unit_size">28px</dimen>
<dimen name="taxi_p_start_autopilot_txt_size">52px</dimen>
<dimen name="taxi_p_start_autopilot_btn_width">1000px</dimen>
<dimen name="taxi_p_start_autopilot_btn_height">500px</dimen>
<dimen name="taxi_p_start_autopilot_btn_width">520px</dimen>
<dimen name="taxi_p_start_autopilot_btn_height">150px</dimen>
</resources>

View File

@@ -38,6 +38,11 @@ class TaxiConst {
const val LOOP_PERIOD_1S = 1 * 1000L
const val LOOP_DELAY = 100L
// 下发给MEC轨迹信息间隔时间 10秒
const val LOOP_PERIOD_10S = 10 * 1000L
// 尝试下发给MEC轨迹最多10次
const val LOOP_SEND_TRAJ_TIMES = 10
// 订单信息
const val SP_KEY_OCH_TAXI_ORDER = "SP_KEY_OCH_TAXI_ORDER"

View File

@@ -63,6 +63,7 @@ import com.mogo.och.taxi.network.TaxiServiceManager;
import com.mogo.och.taxi.utils.TaxiAnalyticsManager;
import com.mogo.och.taxi.utils.OrderUtil;
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
import com.mogo.och.taxi.utils.TaxiTrajectoryManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -262,7 +263,6 @@ public class TaxiModel {
//更新view
CallerLogger.INSTANCE.d(M_TAXI + TAG, "changeCarStatus:" + mOCHCarStatus);
startOrStopOrderLoop(mOCHCarStatus == 1);
queryAutopilotStatus(mOCHCarStatus == 1);
String role = "";
if (TaxiDriverRoleEnum.DEMO.getCode() == data.data.purpose) {
role = TaxiConst.DEMO_USER;
@@ -822,6 +822,7 @@ public class TaxiModel {
return;
}
mCurrentOCHOrder = data;
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo();
SharedPrefsMgr.getInstance(mContext).putString(TaxiConst.SP_KEY_OCH_TAXI_ORDER,
GsonUtil.jsonFromObject(data));
if (FunctionBuildConfig.isDemoMode
@@ -835,6 +836,7 @@ public class TaxiModel {
//清除订单信息
public void clearCurrentOCHOrder() {
mCurrentOCHOrder = null;
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo();
SharedPrefsMgr.getInstance(mContext).remove(TaxiConst.SP_KEY_OCH_TAXI_ORDER);
if (FunctionBuildConfig.isDemoMode) {
// 当美化模式(演示模式)开启时: 取消或订单已完成时置false
@@ -1064,7 +1066,7 @@ public class TaxiModel {
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
TaxiTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo);
}
@Override

View File

@@ -205,9 +205,14 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
@Override
public void onCurrentOrderStatusChanged(OrderQueryRespBean.Result order) {
CallerLogger.INSTANCE.d(M_TAXI + TAG,"order = "+order.toString());
if (TaxiOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus){
TaxiModel.getInstance().queryAutopilotStatus(true);
}
if (TaxiOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
TaxiModel.getInstance().startDynamicCalculateRouteInfo();
}
if (TaxiOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus ||
TaxiOrderStatusEnum.Cancel.getCode() == order.orderStatus ||
TaxiOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){

View File

@@ -379,13 +379,15 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
testBar.setVisibility(View.GONE);
} else {
TextView testCurOrderId = findViewById(R.id.test_bar_current_order_id);
TextView testCurStartName = findViewById(R.id.test_bar_current_start_name);
TextView testCurEndName = findViewById(R.id.test_bar_current_end_name);
TextView testCurLineId = findViewById(R.id.test_bar_current_line_id);
TextView testCurTrajMd5 = findViewById(R.id.test_bar_current_traj_md5);
TextView testCurStopMd5 = findViewById(R.id.test_bar_current_stop_md5);
OrderQueryRespBean.Result order = TaxiModel.getInstance().getCurrentOCHOrder();
testCurOrderId.setText(order == null ? "" : String.valueOf(order.orderNo));
testCurStartName.setText(order == null ? "" : PinYinUtil.getPinYinHeadChar(order.startSiteAddr));
testCurEndName.setText(order == null ? "" : PinYinUtil.getPinYinHeadChar(order.endSiteAddr));
testCurOrderId.setText("orderNo:" + (order == null ? "" : String.valueOf(order.orderNo)));
testCurLineId.setText("lineId:" + (order == null ? "" : String.valueOf(order.lineId)));
testCurTrajMd5.setText("TMd5:" + (order == null ? "" : order.csvFileMd5));
testCurStopMd5.setText("SMd5:" + (order == null ? "" : order.txtFileMd5));
testBar.setVisibility(View.VISIBLE);
}

View File

@@ -0,0 +1,183 @@
package com.mogo.och.taxi.utils;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.och.taxi.bean.OrderQueryRespBean;
import com.mogo.och.taxi.constant.TaxiConst;
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
import com.mogo.och.taxi.model.TaxiModel;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import mogo_msg.MogoReportMsg;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
/**
* Taxi轨迹管理给MEC下发用于轨迹下载的信息
* Created on 2022/6/22
*/
public class TaxiTrajectoryManager {
private static final String TAG = TaxiTrajectoryManager.class.getSimpleName();
private static final class SingletonHolder {
private static final TaxiTrajectoryManager INSTANCE = new TaxiTrajectoryManager();
}
public static TaxiTrajectoryManager getInstance() {
return TaxiTrajectoryManager.SingletonHolder.INSTANCE;
}
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
private Disposable mSendReqDisposable = null;
public TaxiTrajectoryManager() {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
-1, "", "", "", "",
0, "");
}
/**
* 同步订单信息
*/
public void syncTrajectoryInfo() {
OrderQueryRespBean.Result orderInfo = TaxiModel.getInstance().getCurrentOCHOrder();
if (orderInfo == null || orderInfo.orderStatus >= TaxiOrderStatusEnum.OnTheWayToEnd.getCode()) {
CallerLogger.INSTANCE.d(M_TAXI + TAG, "syncTrajectoryInfo() stop.");
stopTrajReqLoop();
} else {
CallerLogger.INSTANCE.d(M_TAXI + TAG, "syncTrajectoryInfo() start.");
startTrajReqLoop();
}
}
/**
* 接口MEC反馈的常规信息MAP v2.5.0新增轨迹相关信息)
* @param guardianInfo
*/
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
if (guardianInfo == null || !guardianInfo.hasCode()) return;
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
// 1. 轨迹管理_轨迹开始下载本地已有对应轨迹也触发
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() 轨迹开始下载");
stopTrajReqLoop();
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS".equals(guardianInfo.getCode())) {
// 2. 轨迹管理_轨迹下载成功本地已有对应轨迹也触发
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() 轨迹下载成功");
stopTrajReqLoop();
} else if ("ISYS_INIT_TRAJECTORY_FAILURE".equals(guardianInfo.getCode())) {
// 3. 轨迹管理_轨迹下载失败本地无对应轨迹
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() " +
"轨迹下载失败,本地无对应轨迹");
} else if ("ISYS_INIT_TRAJECTORY_WARNING".equals(guardianInfo.getCode())) {
// 4. 轨迹管理_轨迹下载失败本地有对应轨迹认为成功
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() " +
"轨迹下载失败,本地有对应轨迹,认为成功");
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
// 5. 轨迹管理_轨迹下载超时
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() 轨迹下载超时");
}
}
private void setupAutoPilotLine() {
OrderQueryRespBean.Result order = TaxiModel.getInstance().getCurrentOCHOrder();
if (order == null) {
CallerLogger.INSTANCE.e(M_TAXI + TAG,
"setupAutoPilotLine(): orderInfo is null.");
return;
} else {
if (mAutoPilotLine == null) {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(order.lineId,
order.csvFileUrl, order.csvFileMd5, order.txtFileUrl, order.txtFileMd5,
order.contrailSaveTime, order.carModel);
} else {
mAutoPilotLine.setLineId(order.lineId);
mAutoPilotLine.setTrajUrl(order.csvFileUrl);
mAutoPilotLine.setTrajMd5(order.csvFileMd5);
mAutoPilotLine.setStopUrl(order.txtFileUrl);
mAutoPilotLine.setStopMd5(order.txtFileMd5);
mAutoPilotLine.setTimestamp(order.contrailSaveTime);
mAutoPilotLine.setVehicleModel(order.carModel);
}
}
}
private void clearAutoPilotLine() {
if (mAutoPilotLine == null) return;
mAutoPilotLine.setLineId(-1);
mAutoPilotLine.setTrajUrl("");
mAutoPilotLine.setTrajMd5("");
mAutoPilotLine.setStopUrl("");
mAutoPilotLine.setStopMd5("");
mAutoPilotLine.setTimestamp(0);
mAutoPilotLine.setVehicleModel("");
}
private void startTrajReqLoop() {
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.d(M_TAXI + TAG, "startTrajReqLoop()");
setupAutoPilotLine();
mSendReqDisposable = Observable.interval(TaxiConst.LOOP_DELAY,
TaxiConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> {
if (aLong > TaxiConst.LOOP_SEND_TRAJ_TIMES) {
stopTrajReqLoop();
return;
}
CallerLogger.INSTANCE.d(M_TAXI + TAG, "loop sendTrajectoryReq: " + aLong);
sendTrajectoryReq();
});
}
private void stopTrajReqLoop() {
if (mSendReqDisposable != null) {
CallerLogger.INSTANCE.d(M_TAXI + TAG, "stopTrajReqLoop()");
mSendReqDisposable.dispose();
mSendReqDisposable = null;
clearAutoPilotLine();
}
}
private void sendTrajectoryReq() {
if (mAutoPilotLine == null) {
CallerLogger.INSTANCE.e(M_TAXI + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
return;
}
// TODO: 2022/6/24
// test1
// mAutoPilotLine.setLineId(148);
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
// mAutoPilotLine.setVehicleModel("红旗H9");
// test2
// mAutoPilotLine.setLineId(148);
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
// mAutoPilotLine.setVehicleModel("红旗H9");
CallerAutoPilotManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
CallerLogger.INSTANCE.d(M_TAXI + TAG, "sendTrajectoryReq(): "
+ GsonUtils.toJson(mAutoPilotLine));
}
}

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