[taxi/bus-d 270] taxi 自动驾驶按钮逻辑优化
This commit is contained in:
@@ -71,5 +71,7 @@ class TaxiConst {
|
||||
* 订单起终点Marker类型
|
||||
*/
|
||||
const val TYPE_MARKER_TAXI_ORDER = "TYPE_MARKER_TAXI_ORDER"
|
||||
|
||||
const val TIMER_START_AUTOPILOT_INTERVAL = 10 * 1000L
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
import static com.mogo.och.taxi.constant.TaxiConst.TIMER_START_AUTOPILOT_INTERVAL;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Intent;
|
||||
@@ -37,6 +38,7 @@ 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.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
@@ -171,7 +173,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
restartAutopilot();
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
restartAutopilot();
|
||||
}
|
||||
// TODO: 2021/11/27 通过开启结果更新ui
|
||||
// onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
}
|
||||
@@ -389,7 +393,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
}, 1000L);
|
||||
}
|
||||
|
||||
private boolean isStarting = false;
|
||||
public boolean isStarting = false;
|
||||
private ObjectAnimator autopilotLoadingAnimator;
|
||||
|
||||
public void startOrStopLoadingAnim(boolean start) {
|
||||
@@ -407,6 +411,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
autopilotLoadingAnimator.setStartDelay(100);
|
||||
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
|
||||
autopilotLoadingAnimator.start();//动画开始
|
||||
|
||||
startingAutoApilotCountDown();
|
||||
|
||||
} else {
|
||||
isStarting = false;
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
@@ -417,6 +424,18 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
}
|
||||
}
|
||||
|
||||
private void startingAutoApilotCountDown() {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() { //未启动成功10s后做处理
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
!= IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING && isStarting){
|
||||
startAutopilotDone(false);
|
||||
}
|
||||
}
|
||||
},TIMER_START_AUTOPILOT_INTERVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
// 在自动驾驶中,才会有重新开启自动驾驶的操作
|
||||
if (mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd) {
|
||||
if (mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd && !isStarting) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "restartAutopilot");
|
||||
mPresenter.startAutoPilot();
|
||||
startOrStopLoadingAnim(true);
|
||||
@@ -219,8 +219,10 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
}
|
||||
|
||||
public void startAutoPilot() {
|
||||
mPresenter.startAutoPilot();
|
||||
startOrStopLoadingAnim(true);
|
||||
if (!isStarting){
|
||||
mPresenter.startAutoPilot();
|
||||
startOrStopLoadingAnim(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void completeOrderService(TaxiOrderStatusEnum status) {
|
||||
@@ -347,207 +349,14 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
});
|
||||
findViewById(R.id.test_bar_on_the_way_to_end).setOnClickListener(v -> {
|
||||
showNotice("自动驾驶已启动,请系好安全带");
|
||||
TaxiModel.getInstance().setOnTheWayToEndStation();
|
||||
// testRouteInfoUpload();
|
||||
// TaxiModel.getInstance().setOnTheWayToEndStation();
|
||||
//// testRouteInfoUpload();
|
||||
restartAutopilot();
|
||||
});
|
||||
}
|
||||
|
||||
private void testRouteInfoUpload() {
|
||||
TPRouteDataTestUtils.converToRouteData();
|
||||
// String listStr = "{\"models\":[{\n" +
|
||||
// "\t\t\"lat\": 40.19927810144466,\n" +
|
||||
// "\t\t\"lon\": 116.73527259387767\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19927836356079,\n" +
|
||||
// "\t\t\"lon\": 116.73513114732762\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19927759500293,\n" +
|
||||
// "\t\t\"lon\": 116.73497660879111\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.199264819842284,\n" +
|
||||
// "\t\t\"lon\": 116.73480063747202\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1992510141554,\n" +
|
||||
// "\t\t\"lon\": 116.73463922037767\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.199245872804,\n" +
|
||||
// "\t\t\"lon\": 116.73445960685193\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19924673374912,\n" +
|
||||
// "\t\t\"lon\": 116.73427704009703\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19924747108264,\n" +
|
||||
// "\t\t\"lon\": 116.7340707102972\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19924828745573,\n" +
|
||||
// "\t\t\"lon\": 116.73385916927226\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19924941093133,\n" +
|
||||
// "\t\t\"lon\": 116.73364048294795\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19924939253381,\n" +
|
||||
// "\t\t\"lon\": 116.73340837408566\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19924949105934,\n" +
|
||||
// "\t\t\"lon\": 116.73317368725336\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19925040039033,\n" +
|
||||
// "\t\t\"lon\": 116.73296532811216\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1992515355653,\n" +
|
||||
// "\t\t\"lon\": 116.73277787366743\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1992512720328,\n" +
|
||||
// "\t\t\"lon\": 116.73263377253741\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.199205174954606,\n" +
|
||||
// "\t\t\"lon\": 116.73249773114644\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1991015743076,\n" +
|
||||
// "\t\t\"lon\": 116.7324219601283\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.198971862686285,\n" +
|
||||
// "\t\t\"lon\": 116.73239393296355\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19883883071582,\n" +
|
||||
// "\t\t\"lon\": 116.73237676435652\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19870171355796,\n" +
|
||||
// "\t\t\"lon\": 116.73236052150362\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1985491853193,\n" +
|
||||
// "\t\t\"lon\": 116.73234157857011\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1983890047355,\n" +
|
||||
// "\t\t\"lon\": 116.73232167996464\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1982209877466,\n" +
|
||||
// "\t\t\"lon\": 116.73230101645792\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.198037574138326,\n" +
|
||||
// "\t\t\"lon\": 116.73227735486083\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19787327856243,\n" +
|
||||
// "\t\t\"lon\": 116.73225676816314\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19771917207499,\n" +
|
||||
// "\t\t\"lon\": 116.73223814728027\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.197548305175935,\n" +
|
||||
// "\t\t\"lon\": 116.73221624705808\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19739568979691,\n" +
|
||||
// "\t\t\"lon\": 116.73219618210774\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19724703821575,\n" +
|
||||
// "\t\t\"lon\": 116.73217598293311\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1970956560885,\n" +
|
||||
// "\t\t\"lon\": 116.73215773721505\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19697703483188,\n" +
|
||||
// "\t\t\"lon\": 116.73214337172284\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19687000725696,\n" +
|
||||
// "\t\t\"lon\": 116.73210037067965\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.196833449601726,\n" +
|
||||
// "\t\t\"lon\": 116.73196646708011\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19685833847804,\n" +
|
||||
// "\t\t\"lon\": 116.73181315361103\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.196889170203264,\n" +
|
||||
// "\t\t\"lon\": 116.73164355747393\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19692242860347,\n" +
|
||||
// "\t\t\"lon\": 116.7314555399657\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19696431701069,\n" +
|
||||
// "\t\t\"lon\": 116.7312261834129\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19700025925464,\n" +
|
||||
// "\t\t\"lon\": 116.73102774016093\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19703414798773,\n" +
|
||||
// "\t\t\"lon\": 116.73084270562073\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19707287604138,\n" +
|
||||
// "\t\t\"lon\": 116.73062835248406\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19710951629977,\n" +
|
||||
// "\t\t\"lon\": 116.73041744082339\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19714593807105,\n" +
|
||||
// "\t\t\"lon\": 116.73021414314803\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.197183297026285,\n" +
|
||||
// "\t\t\"lon\": 116.7300057066447\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.1972247359487,\n" +
|
||||
// "\t\t\"lon\": 116.7297751515664\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19726518822745,\n" +
|
||||
// "\t\t\"lon\": 116.72954958923812\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19730538240706,\n" +
|
||||
// "\t\t\"lon\": 116.72932440756041\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19734272112662,\n" +
|
||||
// "\t\t\"lon\": 116.72911631453036\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.197379191549075,\n" +
|
||||
// "\t\t\"lon\": 116.72890982812105\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.197417565369314,\n" +
|
||||
// "\t\t\"lon\": 116.72869447869044\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19746052080799,\n" +
|
||||
// "\t\t\"lon\": 116.72845641541247\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19750040582118,\n" +
|
||||
// "\t\t\"lon\": 116.72823569991117\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19753999704064,\n" +
|
||||
// "\t\t\"lon\": 116.72801998373052\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19757796882569,\n" +
|
||||
// "\t\t\"lon\": 116.72781280504363\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.197617062364586,\n" +
|
||||
// "\t\t\"lon\": 116.72759949431683\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19765391602761,\n" +
|
||||
// "\t\t\"lon\": 116.72739776789756\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19768973009218,\n" +
|
||||
// "\t\t\"lon\": 116.72719980764646\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.197726191028785,\n" +
|
||||
// "\t\t\"lon\": 116.72699719861669\n" +
|
||||
// "\t}, {\n" +
|
||||
// "\t\t\"lat\": 40.19776233489642,\n" +
|
||||
// "\t\t\"lon\": 116.72679516155276\n" +
|
||||
// "\t}]}\n";
|
||||
//
|
||||
//
|
||||
// List<MessagePad.Location> list = new ArrayList<>();
|
||||
//
|
||||
// try {
|
||||
// JSONObject jsonObject = new JSONObject(listStr);
|
||||
// JSONArray jsonElements = jsonObject.getJSONArray("models");
|
||||
// for (int i = 0; i < jsonElements.length(); i++) {
|
||||
// JSONObject s = jsonElements.getJSONObject(i);
|
||||
// MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
// builder.setLatitude(s.getDouble("lat"));
|
||||
// builder.setLongitude(s.getDouble("lon"));
|
||||
// list.add(builder.build());
|
||||
// }
|
||||
// TaxiModel.getInstance().updateOrderRoute(list);
|
||||
// TaxiModel.getInstance().updateOrderRouteInfo(list);
|
||||
// } catch (JSONException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
public void clickTestBar() {
|
||||
|
||||
Reference in New Issue
Block a user