[2.11.0/1.6.0] taxi司机端,增加人工/自驾模式

This commit is contained in:
wangmingjun
2022-09-22 15:48:40 +08:00
parent a074324054
commit b90530ac2c
11 changed files with 163 additions and 60 deletions

View File

@@ -100,12 +100,19 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
}
/**
* 开启自动驾驶
* 开启自动驾驶 自驾模式
*/
public void startAutoPilot() {
TaxiModel.getInstance().startAutoPilot();
}
/**
* 人工模式
*/
public void startManualDrive(){
TaxiModel.getInstance().startServicePilotDone();
}
/**
* 跳过乘客验证环节
*/

View File

@@ -21,9 +21,7 @@ import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import androidx.fragment.app.FragmentTransaction;
import com.mogo.cloud.httpdns.util.L;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
@@ -388,13 +386,11 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
public void onCheckPilotConditionSafe(boolean isSafe){
updateCtvAutopilotStatusTag(isSafe);
if (isSafe){
ToastUtils.showLong(getResources().getString(
R.string.module_och_taxi_order_choose_start_autopilot_tip));
updateOrderUI();
updateOrderBottomBtnUI();
}
}
protected abstract void updateOrderUI();
protected abstract void updateOrderBottomBtnUI();
private AnimatorDrawableUtil animatorDrawableUtil = null;

View File

@@ -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.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
@@ -62,19 +61,14 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
private OrderQueryRespBean.Result mCurrentOrder = null;
private boolean isFirstStartAutopilotDone = true;
public static TaxiBeingServerdOrdersFragment newInstance(Activity activity, TaxiFragment taxiFragment) {
mActivity = activity;
mTaxiFragment = taxiFragment;
Bundle args = new Bundle();
TaxiBeingServerdOrdersFragment fragment = new TaxiBeingServerdOrdersFragment();
fragment.setArguments(args);
return fragment;
}
private TextView mOrderStatus;
private ImageView mOrderCancel;
private TextView mOrderServerStatus;
private ConstraintLayout mOrderStartModeBtn;
private TextView mAutoPilotBtn;
private TextView mManualBtn;
private ConstraintLayout mBeingOrderLayout;
private ConstraintLayout mContentModule3;
private ConstraintLayout mContentModule2;
@@ -103,6 +97,16 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
private volatile int saveOrderState = -1;
public static TaxiBeingServerdOrdersFragment newInstance(Activity activity, TaxiFragment taxiFragment) {
mActivity = activity;
mTaxiFragment = taxiFragment;
Bundle args = new Bundle();
TaxiBeingServerdOrdersFragment fragment = new TaxiBeingServerdOrdersFragment();
fragment.setArguments(args);
return fragment;
}
@Override
protected int getLayoutId() {
return R.layout.taxi_being_order;
@@ -112,7 +116,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
protected void initViews(View view) {
mOrderStatus = view.findViewById(R.id.module_och_taxi_order_status);
mOrderCancel = view.findViewById(R.id.module_och_taxi_order_cancel_iv);
mOrderServerStatus = view.findViewById(R.id.module_och_taxi_order_server_status_tv);
mOrderStartModeBtn = view.findViewById(R.id.taxi_start_mode_btn);
mAutoPilotBtn = view.findViewById(R.id.taxi_start_by_auto);
mManualBtn = view.findViewById(R.id.taxi_start_by_manual);
mBeingOrderLayout = view.findViewById(R.id.module_och_taxi_being_order_content);
mContentModule2 = view.findViewById(R.id.module_och_taxi_order_status_station_2);
mContentModule3 = view.findViewById(R.id.module_och_taxi_order_status_station_3);
@@ -136,16 +145,22 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mNoDatasTv = view.findViewById(R.id.no_order_data_tv);
mNoDataView = view.findViewById(R.id.being_no_data_view);
mOrderCancel.setOnClickListener(this);
mOrderServerStatus.setOnClickListener(this);
initOnClickListener();
initNaviView(view);
isHaveBeingOrder(false);
// if (DebugConfig.isDebug()) { //任意模式下调试信息都打开
initOrderTestBar(view);
// }
//任意模式下调试信息都打开
initOrderTestBar(view);
}
private void initOnClickListener() {
mOrderCancel.setOnClickListener(this);
mOrderServerStatus.setOnClickListener(this);
mAutoPilotBtn.setOnClickListener(this);
mManualBtn.setOnClickListener(this);
}
@Override
@@ -175,29 +190,34 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mOrderNo = order.orderNo;
onOrderStatusChanged(order);
if (TaxiOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus) {
showOrHideOrderModeBtn(false);
mTaxiFragment.queryCurOrderRouteInfo();
mContentModule3.setVisibility(View.GONE);
mContentModule2.setVisibility(View.VISIBLE);
CallerLogger.INSTANCE.d(M_TAXI + TAG, "已经达到终点");
mOrderStatus.setText(R.string.module_och_taxi_arrive_at_end_station2);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_end);
mOrderServerStatus.setTextColor(Color.parseColor("#FFFFFF"));
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#FF1D5EF3"));
mOrderServerStatus.setClickable(true);
updateOrderBottomBtn(getString(R.string.module_och_taxi_order_server_end),
Color.parseColor("#FFFFFF"),
Color.parseColor("#FF1D5EF3"),
true);
mTitleTV2.setText("送乘客至");
mStationTv2.setText(order.endSiteAddr);
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus) {
CallerLogger.INSTANCE.d(M_TAXI + TAG, "已经去往终点");
showOrHideOrderModeBtn(false);
mContentModule3.setVisibility(View.GONE);
mContentModule2.setVisibility(View.VISIBLE);
mOrderStatus.setText(R.string.module_och_taxi_on_the_way_2_end_station);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_end);
mOrderServerStatus.setTextColor(Color.parseColor("#4DFFFFFF"));
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#4D1D5EF3"));
mOrderServerStatus.setClickable(false);
updateOrderBottomBtn(getString(R.string.module_och_taxi_order_server_end),
Color.parseColor("#4DFFFFFF"),
Color.parseColor("#4D1D5EF3"),
false);
mTitleTV2.setText("送乘客至");
mStationTv2.setText(order.endSiteAddr);
@@ -240,21 +260,25 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mPassengerNum.setText(order.passengerNum + "");
mPassengerPhone.setText(order.passengerPhone);
mOrderStatus.setText(R.string.module_och_taxi_waiting);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start_wait_check);
mOrderServerStatus.setTextColor(Color.parseColor("#FFFFFF"));
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#FF1D5EF3"));
mOrderServerStatus.setClickable(true);
updateOrderBottomBtn(getString(R.string.module_och_taxi_order_server_start_wait_check),
Color.parseColor("#FFFFFF"),
Color.parseColor("#FF1D5EF3"),
true);
showOrHideOrderModeBtn(false);
}else if (TaxiOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus ){
CallerLogger.INSTANCE.d(M_TAXI + TAG, "乘客已上车验证成功");
mPassengerInfoLayout.setVisibility(View.GONE);
mOrderStatus.setText(R.string.module_och_taxi_user_check_success);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start);
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#FF1D5EF3"));
mOrderServerStatus.setTextColor(Color.parseColor("#FFFFFF"));
mOrderServerStatus.setClickable(true);
updateOrderBottomBtn(getString(R.string.module_och_taxi_order_server_start),
Color.parseColor("#FFFFFF"),
Color.parseColor("#FF1D5EF3"),
true);
showOrHideOrderModeBtn(true);
}
}else if (TaxiModel.getInstance().checkCurrentOCHOrder()) {
@@ -270,11 +294,14 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mPassengerNum.setText(order.passengerNum + "");
mPassengerPhone.setText(order.passengerPhone);
mOrderStatus.setText(R.string.module_och_taxi_new_order);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start);
mOrderServerStatus.setTextColor(Color.parseColor("#4DFFFFFF"));
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#4D1D5EF3"));
mOrderServerStatus.setClickable(false);
showOrHideOrderModeBtn(false);
updateOrderBottomBtn(getString(R.string.module_och_taxi_order_server_start),
Color.parseColor("#4DFFFFFF"),
Color.parseColor("#4D1D5EF3"),
false);
mGoAheadStationTitleTv31.setText("前往");
mCatchStationTitleTv31.setText("接乘客");
mStationTv31.setText(order.startSiteAddr);
@@ -302,6 +329,16 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
}
}
private void showOrHideOrderModeBtn(boolean isShow) {
if (isShow){
mOrderStartModeBtn.setVisibility(View.VISIBLE);
mOrderServerStatus.setVisibility(View.GONE);
}else {
mOrderStartModeBtn.setVisibility(View.GONE);
mOrderServerStatus.setVisibility(View.VISIBLE);
}
}
private void startNaviToStartStation(boolean isShow, double orderStartStationLat, double orderStartStationLng) {
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
CallerLogger.INSTANCE.d(M_TAXI + TAG, "currentLatLng=" + mTaxiFragment.mCurLatitude + " " + mTaxiFragment.mCurLongitude);
@@ -523,6 +560,14 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
if (mTaxiFragment != null) {
showNaviToStartStationFragment(true);
}
} else if (v.getId() == R.id.taxi_start_by_auto){//自驾模式
CallerLogger.INSTANCE.d(M_TAXI + TAG, "自驾模式");
mOrderStartModeBtn.setTag(0);
startOrEndService();
} else if (v.getId() == R.id.taxi_start_by_manual){//人工模式
CallerLogger.INSTANCE.d(M_TAXI + TAG, "人工模式");
mOrderStartModeBtn.setTag(1);
mTaxiFragment.confirmAutopilotConditionByDriver();
}
}
@@ -652,20 +697,30 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
}
}
public void updateOrderUI() {
public void updateOrderBottomBtnUI() {
try {
updateOrderBottomBtn();
if ((int)mOrderStartModeBtn.getTag() == 1){//人工
mTaxiFragment.startManualDirve();
return;
}
ToastUtils.showLong(getResources().getString(
R.string.module_och_taxi_order_choose_start_autopilot_tip));
showOrHideOrderModeBtn(false);
updateOrderBottomBtn(getString(R.string.module_och_taxi_order_server_wait_passenger_start),
Color.parseColor("#4DFFFFFF"),
Color.parseColor("#FF1D5EF3"),
false);
}catch (NullPointerException e){
mTaxiFragment.confirmAutopilotConditionByDriver();
}
}
public void updateOrderBottomBtn(){
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_wait_passenger_start);
mOrderServerStatus.setTextColor(Color.parseColor("#4DFFFFFF"));
public void updateOrderBottomBtn(String txt, int txtColorId, int bgColorId,boolean isClickable){
mOrderServerStatus.setText(txt);
mOrderServerStatus.setTextColor(txtColorId);
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#FF1D5EF3"));
mOrderServerStatus.setClickable(false);
background.setColor(bgColorId);
mOrderServerStatus.setClickable(isClickable);
}
/**
* END

View File

@@ -17,7 +17,6 @@ import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.temp.EventLogout;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -236,6 +235,10 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
mPresenter.completeOrderService();
}
public void startManualDirve(){
mPresenter.startManualDrive();
}
public void cancelCurOrder(int reasonType, String reaso) {
mPresenter.cancelCurOrder(reasonType, reaso);
}
@@ -256,9 +259,9 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
}
@Override
protected void updateOrderUI() {
protected void updateOrderBottomBtnUI() {
if (null == serverOrdersFragment) return;
serverOrdersFragment.updateOrderUI();
serverOrdersFragment.updateOrderBottomBtnUI();
}
public void onNewBookingOrderGot(OrderQueryRespBean.Result order) {

View File

@@ -213,8 +213,8 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
beingServerdOrdersFragment.onCurrentOrderRouteInfoGot(routeInfo);
}
public void updateOrderUI() {
public void updateOrderBottomBtnUI() {
if (null == beingServerdOrdersFragment) return;
beingServerdOrdersFragment.updateOrderUI();
beingServerdOrdersFragment.updateOrderBottomBtnUI();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/module_och_taxi_panel_width"
android:layout_height="130px"
android:id="@+id/taxi_start_mode_btn"
android:visibility="gone"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/order_drive_mode_bg">
<TextView
android:id="@+id/taxi_start_by_auto"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_40"
android:text="@string/och_taxi_auto_txt"
android:textColor="#FFFFFF"
android:textSize="24sp"/>
<TextView
android:id="@+id/taxi_start_by_manual"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:text="@string/och_taxi_manual_txt"
android:layout_marginRight="@dimen/dp_40"
android:textColor="#FFFFFF"
android:textSize="24sp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -275,6 +275,13 @@
android:textColor="#4DFFFFFF"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent" />
<include layout="@layout/auto_or_manual_btn_view"
android:layout_width="match_parent"
android:layout_height="130px"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include

View File

@@ -19,6 +19,8 @@
<string name="module_och_taxi_order_cancel_tip">出现异常情况时,可选择原因无责取消订单:</string>
<string name="module_och_taxi_order_cancel_commit">确认</string>
<string name="module_och_taxi_order_server_start">开始服务</string>
<string name="och_taxi_auto_txt">自驾模式</string>
<string name="och_taxi_manual_txt">人工模式</string>
<string name="module_och_taxi_order_server_start_wait_check">跳过乘客验证</string>
<string name="module_och_taxi_order_server_wait_passenger_start">等待乘客开始行程</string>
<string name="module_och_taxi_order_choose_start_autopilot_tip">请等待乘客启动自动驾驶,或您自行启动</string>