From 67aa51a99d1f886cd6dd85c0c04e591f15002e1e Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 29 Jun 2022 18:21:10 +0800 Subject: [PATCH] [Taxi-d 280 Taxi-p 130] opt --- .../presenter/BaseTaxiPassengerPresenter.java | 14 +++--- .../ui/TaxiPassengerBaseFragment.java | 33 ++++++++------ .../ui/TaxiPassengerStartAutopilotView.java | 43 ++++++++----------- .../taxi_p_autopilot_btn_bg_selector.xml | 5 --- .../taxi_p_start_autopilot_txt_btn_bg.xml | 1 + .../layout/taxi_p_start_autopilot_view.xml | 7 ++- .../src/main/res/values-sw320dp/dimens.xml | 2 +- .../res/values-xhdpi-2560x1440/dimens.xml | 2 +- .../src/main/res/values/dimens.xml | 2 +- .../com/mogo/och/taxi/model/TaxiModel.java | 16 ++++--- 10 files changed, 65 insertions(+), 60 deletions(-) delete mode 100644 OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_autopilot_btn_bg_selector.xml diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/BaseTaxiPassengerPresenter.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/BaseTaxiPassengerPresenter.java index 93d84aa94a..ced41770c1 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/BaseTaxiPassengerPresenter.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/BaseTaxiPassengerPresenter.java @@ -144,10 +144,10 @@ public class BaseTaxiPassengerPresenter extends Presenter{ + mView.showOrHideServingOrderFragment(true); mView.showOrHideStartAutopilotView(false,false); }); TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotoop(false); diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java index 178b318c8a..c5b06ba04c 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerBaseFragment.java @@ -283,20 +283,27 @@ public class TaxiPassengerBaseFragment extends MvpFragment(new TaxiPassengerStartAutopilotView(getContext())); - } - OverlayViewUtils.showOverlayView(getActivity(),mStartAutopilotView.get()); - mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(this); - mStartAutopilotView.get().updateStartAutopilotBtnStatus(isClickable); - }else { - if (mStartAutopilotView == null || mStartAutopilotView.get() == null){ - return; - } - mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(null); - OverlayViewUtils.dismissOverlayView(mStartAutopilotView.get()); +// if (isShow){ +// if (mStartAutopilotView == null || mStartAutopilotView.get() == null){ +// mStartAutopilotView = new WeakReference<>(new TaxiPassengerStartAutopilotView(getContext())); +// mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(this); +// } +// OverlayViewUtils.showOverlayView(getActivity(),mStartAutopilotView.get()); +// updateStartAutopilotBtnStatus(isClickable); +// }else { +// if (mStartAutopilotView == null || mStartAutopilotView.get() == null){ +// return; +// } +// mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(null); +// OverlayViewUtils.dismissOverlayView(mStartAutopilotView.get()); +// } + } + + public void updateStartAutopilotBtnStatus(boolean isClickable){ + if (mStartAutopilotView == null || mStartAutopilotView.get() == null){ + return; } + mStartAutopilotView.get().updateStartAutopilotBtnStatus(isClickable); } /** diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerStartAutopilotView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerStartAutopilotView.java index ed06db4087..aa4a0cd938 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerStartAutopilotView.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerStartAutopilotView.java @@ -1,19 +1,17 @@ package com.mogo.och.taxi.passenger.ui; -import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.drawable.AnimationDrawable; import android.view.LayoutInflater; import android.view.View; -import android.view.animation.LinearInterpolator; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.och.taxi.passenger.R; import com.mogo.och.taxi.passenger.callback.ITPClickStartAutopilotCallback; -import com.mogo.och.taxi.passenger.model.TaxiPassengerModel; /** * @author: wangmingjun @@ -29,6 +27,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V private AnimationDrawable mAnimationStartingDrawable; private static final long TIMER_START_AUTOPILOT_INTERVAL = 10 * 1000L; private Context mContext; + private View view; public TaxiPassengerStartAutopilotView(Context context) { super(context); @@ -37,23 +36,10 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V } private void initView(Context context) { - View view = LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this,true); + view = LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this,true); mStartAutopilotBtn = view.findViewById(R.id.taxi_p_start_autopilot); mAutopilotStartingImage = view.findViewById(R.id.taxi_p_autopilot_starting); mStartAutopilotBtn.setOnClickListener(this); - - //debug 调试使用,长按光圈,调用乘客开启自动驾驶 - mAutopilotStartingImage.setOnLongClickListener(new OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - //开启动画和自动驾驶 - if (!isStarting){ - startOrStopLoadingAnim(true); - TaxiPassengerModel.getInstance().startAutopilot(); - } - return false; - } - }); } public void setOnClickStartAutopilotBtnCallback(ITPClickStartAutopilotCallback clickCallback){ @@ -74,12 +60,24 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V public void updateStartAutopilotBtnStatus(boolean isClickable){ if (mStartAutopilotBtn == null) return; mStartAutopilotBtn.setClickable(isClickable); - mStartAutopilotBtn.setText(mContext.getResources().getString(R.string.taxi_p_start_autopilot_txt)); + 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)); + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mStartAutopilotBtn.getLayoutParams(); + params.bottomMargin = 0; + mStartAutopilotBtn.setLayoutParams(params); + mStartAutopilotBtn.setTextColor( + mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_color)); + mStartAutopilotBtn.setBackground(mContext.getResources().getDrawable(R.drawable.anmi_flow)); startAutopilotBgAnimatorDrawable(true); }else {// 不可点击状态下 UI - mStartAutopilotBtn.setTextColor(mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_un_color)); + LayoutParams params = (LayoutParams) mStartAutopilotBtn.getLayoutParams(); + params.bottomMargin = 294; + mStartAutopilotBtn.setLayoutParams(params); + mStartAutopilotBtn.setBackground( + mContext.getResources().getDrawable(R.drawable.taxi_p_start_autopilot_txt_btn_bg)); + mStartAutopilotBtn.setTextColor( + mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_un_color)); startAutopilotBgAnimatorDrawable(false); } } @@ -87,7 +85,6 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V public void startAutopilotBgAnimatorDrawable(boolean isStart){ if (isStart){ if (mAnimationBtnDrawable == null) { - mStartAutopilotBtn.setBackground(getResources().getDrawable(R.drawable.anmi_flow)); mAnimationBtnDrawable = (AnimationDrawable) mStartAutopilotBtn.getBackground(); } if (mAnimationBtnDrawable.isRunning()) { @@ -97,7 +94,6 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V mAnimationBtnDrawable.start(); }else { if (mAnimationBtnDrawable != null) { - mAnimationBtnDrawable.selectDrawable(0); mAnimationBtnDrawable.stop(); } mAnimationBtnDrawable = null; @@ -107,7 +103,6 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V private void startingAutopilotAnimatorDrawable(boolean isStart){ if (isStart){ if (mAnimationStartingDrawable == null) { - mAutopilotStartingImage.setBackground(getResources().getDrawable(R.drawable.starting_anmi_flow)); mAnimationStartingDrawable = (AnimationDrawable) mAutopilotStartingImage.getBackground(); } if (mAnimationStartingDrawable.isRunning()) { @@ -130,7 +125,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V isStarting = true; mStartAutopilotBtn.setText(getResources().getString(R.string.taxi_p_start_autopilot_loading)); - mStartAutopilotBtn.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal)); + mStartAutopilotBtn.setTextColor(getResources().getColor(R.color.taxi_p_start_autopilot_txt_un_color)); startingAutopilotCountDown(); } else { diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_autopilot_btn_bg_selector.xml b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_autopilot_btn_bg_selector.xml deleted file mode 100644 index ae2eaa5ab3..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_autopilot_btn_bg_selector.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_start_autopilot_txt_btn_bg.xml b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_start_autopilot_txt_btn_bg.xml index dc7ba06b43..6e6e5b6729 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_start_autopilot_txt_btn_bg.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/drawable/taxi_p_start_autopilot_txt_btn_bg.xml @@ -1,6 +1,7 @@ + diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml index b98348363f..5b26b8687b 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values-sw320dp/dimens.xml @@ -62,7 +62,7 @@ 34px 28px - 60px + 52px 1000px 500px \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml index 7a4117d665..b1e2c1dd14 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -125,7 +125,7 @@ 34px 28px - 60px + 52px 1000px 500px diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml b/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml index 019843e4ff..a453e6d3b3 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/values/dimens.xml @@ -120,7 +120,7 @@ 34px 28px - 60px + 52px 1000px 500px \ No newline at end of file diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java index d1218f43af..ef85f1b00f 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java @@ -185,7 +185,6 @@ public class TaxiModel { }); if (NetworkUtils.isConnected(mContext)) { - queryAutopilotStatus(); queryCarStatus(); } } @@ -263,6 +262,7 @@ 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; @@ -774,13 +774,20 @@ public class TaxiModel { } } + public void queryAutopilotStatus(boolean isStart){ + if (isStart){ + queryAutopilotStatus(); + } + } + public void queryAutopilotStatus(){ if (mCurrentOCHOrder == null) return; TaxiServiceManager.getInstance().queryAutopilotStatus(mContext, mCurrentOCHOrder.orderNo, new TaxiServiceCallback() { @Override public void onSuccess(TaxiDataBaseRespBean data) { - updateAutopilotStatus(data.code == 0); + if (data != null && data.code == 0 && data.data.equals(true)) + updateAutopilotStatus(data.data.equals(true)); } @Override @@ -1337,7 +1344,7 @@ public class TaxiModel { @Override public void onFail(int code, String msg) { - + ToastUtils.showShort(msg); } }); } @@ -1361,7 +1368,6 @@ public class TaxiModel { @Override public void onFail(int code, String msg) { - } }); } @@ -1430,7 +1436,7 @@ public class TaxiModel { @Override public void onFail(int code, String msg) { - + ToastUtils.showShort(msg); } }); }