[2.10.0] taxi-d/taxi-p自动驾驶按钮动画优化
This commit is contained in:
@@ -35,7 +35,7 @@ public class AnimatorDrawableUtil {
|
||||
//图片资源的ID列表
|
||||
private List<Integer> 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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -42,6 +42,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> 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<TaxiFragment> 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
|
||||
|
||||
Reference in New Issue
Block a user