[290 taxi乘客屏] 开始行程页内存泄漏
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:background="@drawable/taxi_p_passenger_start_panel_bg"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<com.mogo.och.common.module.wigets.sfv.FrameSurfaceView
|
||||
<ImageView
|
||||
android:id="@+id/taxi_p_autopilot_starting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user