From 91835a94e0e65a480f392e305f047f96b2d8a1b3 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Mon, 5 Sep 2022 15:13:05 +0800 Subject: [PATCH] =?UTF-8?q?[2.10.0]=20taxi-d/taxi-p=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=A9=BE=E9=A9=B6=E6=8C=89=E9=92=AE=E5=8A=A8=E7=94=BB=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/utils/AnimatorDrawableUtil.java | 29 ++++++++++++------- .../ui/TaxiPassengerStartAutopilotView.java | 6 ++-- .../och/taxi/presenter/TaxiPresenter.java | 11 +++++-- 3 files changed, 30 insertions(+), 16 deletions(-) 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