From 98d3b4099be40e0094bcb3f76f909dbab88ae705 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Fri, 29 Jul 2022 15:24:18 +0800 Subject: [PATCH] =?UTF-8?q?[290=20taxi=E4=B9=98=E5=AE=A2=E5=B1=8F]=20?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=A1=8C=E7=A8=8B=E9=A1=B5=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/TaxiPassengerStartAutopilotView.java | 39 ++++++++++--------- .../layout/taxi_p_start_autopilot_view.xml | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) 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 41146e5982..5d8aba7836 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 @@ -37,8 +37,9 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V private static final long TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L; private Context mContext; private View view; - private FrameSurfaceView svCarStartingFrame; private AnimatorDrawableUtil mAnimationDrawable ; + private AnimatorDrawableUtil mCarAnimationDrawable ; + private ImageView mCarIv; private Integer[] startingAnimIds = new Integer[]{ R.drawable.light_00000, R.drawable.light_00001, @@ -98,6 +99,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V mCloseIV.setOnClickListener(this); mAutopilotBtnBg = view.findViewById(R.id.taxi_p_autopilot_btn_bg); + mCarIv = view.findViewById(R.id.taxi_p_autopilot_starting); initBtnAnimatonDrawable(); @@ -105,9 +107,8 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V } private void initCarStartingFrame() { - svCarStartingFrame = view.findViewById(R.id.taxi_p_autopilot_starting); - svCarStartingFrame.setBitmapIds(Arrays.asList(startingAnimIds)); - svCarStartingFrame.setDuration(1300); + mCarAnimationDrawable = new AnimatorDrawableUtil(); + mCarAnimationDrawable.setAnimation(mCarIv,Arrays.asList(startingAnimIds)); } private void initBtnAnimatonDrawable() { @@ -143,8 +144,8 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V @SuppressLint("UseCompatLoadingForDrawables") public void handleStartAutopilotBtnStatus(boolean isClickable){ - if (svCarStartingFrame != null){ - svCarStartingFrame.setBackgroundResource(R.drawable.light_00000); + if (mCarIv != null){ + mCarIv.setBackgroundResource(R.drawable.light_00000); } if (mStartAutopilotBtn == null) return; @@ -178,7 +179,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V if (isStart){ if (mAnimationDrawable == null){ - + initBtnAnimatonDrawable(); } if (mAnimationDrawable != null){ mAnimationDrawable.start(true, 30, null); @@ -189,17 +190,18 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V } private void startingCarBgAnimatorDrawable(boolean isStart){ - if (isStart && svCarStartingFrame != null){ - svCarStartingFrame.setRepeatTimes(-1); - svCarStartingFrame.setBackground(null); - svCarStartingFrame.start(); - }else { - if (svCarStartingFrame != null){ - svCarStartingFrame.reset(); - svCarStartingFrame.setBackgroundResource(R.drawable.light_00000); + if (isStart){ + if (mCarAnimationDrawable == null){ + initCarStartingFrame(); } + mCarIv.setBackgroundResource(0); + mCarAnimationDrawable.start(true,40, null); + }else { + if (mCarAnimationDrawable != null){ + mCarAnimationDrawable.stop(); + } + mCarIv.setBackgroundResource(R.drawable.light_00000); } - } public void startOrStopLoadingAnim(boolean start) { @@ -234,10 +236,9 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V } public void clearStartingAnimFrame(){ - if (svCarStartingFrame != null){ - svCarStartingFrame.destroy(); + if (mCarAnimationDrawable != null){ + mCarAnimationDrawable.stop(); } - svCarStartingFrame = null; } public void onAutopilotStatusSuccess(){ startOrStopLoadingAnim(false); diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_start_autopilot_view.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_start_autopilot_view.xml index aefbd0fe6d..3416786abb 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_start_autopilot_view.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_start_autopilot_view.xml @@ -7,7 +7,7 @@ android:background="@drawable/taxi_p_passenger_start_panel_bg" tools:ignore="MissingDefaultResource"> -