diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/AnimatorDrawableUtil.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/AnimatorDrawableUtil.java index bbf9d779eb..513bfa6c34 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/AnimatorDrawableUtil.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/AnimatorDrawableUtil.java @@ -35,7 +35,7 @@ public class AnimatorDrawableUtil { //图片资源的ID列表 private List mResourceIdList = null; //定时任务器 - private Timer mTimer = null; + private final Timer mTimer = new Timer(); //定时任务 private AnimTimerTask mTimeTask = null; //记录播放位置 @@ -44,7 +44,7 @@ public class AnimatorDrawableUtil { private boolean isLooping = false; public AnimatorDrawableUtil() { - mTimer = new Timer(); +// mTimer = new Timer(); } /** @@ -139,18 +139,25 @@ public class AnimatorDrawableUtil { */ public void start(boolean loop, int duration, AnimationLisenter lisenter) { this.lisenter = lisenter; - stop(); +// stop(); if (mResourceIdList == null || mResourceIdList.size() == 0) { return; } - if (mTimer == null) { - mTimer = new Timer(); +// if (mTimer == null) { +// mTimer = new Timer(); +// } + try { + isLooping = loop; + mFrameIndex = 0; + mState = STATE_RUNNING; + if (mTimeTask != null){ + return; + } + mTimeTask = new AnimTimerTask(); + mTimer.schedule(mTimeTask, 0, duration); + }catch (Exception e){ + e.printStackTrace(); } - isLooping = loop; - mFrameIndex = 0; - mState = STATE_RUNNING; - mTimeTask = new AnimTimerTask(); - mTimer.schedule(mTimeTask, 0, duration); if (lisenter != null){ lisenter.startAnimation(); } @@ -163,7 +170,7 @@ public class AnimatorDrawableUtil { if (mTimer != null) { mTimer.purge(); mTimer.cancel(); - mTimer = null; +// mTimer = null; } if (mTimeTask != null) { mFrameIndex = 0; 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 5d8aba7836..7f93833b86 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 @@ -101,9 +101,9 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V mAutopilotBtnBg = view.findViewById(R.id.taxi_p_autopilot_btn_bg); mCarIv = view.findViewById(R.id.taxi_p_autopilot_starting); - initBtnAnimatonDrawable(); - - initCarStartingFrame(); +// initBtnAnimatonDrawable(); +// +// initCarStartingFrame(); } private void initCarStartingFrame() { diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/TaxiPresenter.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/TaxiPresenter.java index 242054397e..5bd2c9cb2f 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/TaxiPresenter.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/TaxiPresenter.java @@ -42,6 +42,7 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS private static final String TAG = TaxiPresenter.class.getSimpleName(); private boolean isFirstShow = true; + private int preAutopilotStatus = 0; public TaxiPresenter(TaxiFragment view) { super(view); @@ -191,24 +192,30 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS public void onAutopilotEnable() { runOnUIThread(() -> mView.updateAutopilotStatus( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)); + preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE; } @Override public void onAutopilotDisable() { runOnUIThread(() -> mView.updateAutopilotStatus( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)); + preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE; } @Override public void onAutopilotRunning() { - runOnUIThread(() -> mView.updateAutopilotStatus( - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)); + if (preAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ + runOnUIThread(() -> mView.updateAutopilotStatus( + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)); + } + preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING; } @Override public void onManMachineCoDriving() { runOnUIThread(() -> mView.onManMachineCoDriving(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING)); + preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING; } @Override