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"> -