This commit is contained in:
liujing
2020-08-07 13:16:14 +08:00
parent 1be996e3db
commit 0d16fdcc23
4 changed files with 167 additions and 156 deletions

View File

@@ -1,6 +1,7 @@
package com.mogo.module.v2x.utils.animation;
import android.graphics.drawable.AnimationDrawable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
@@ -9,6 +10,7 @@ import com.mogo.utils.UiThreadHandler;
public class V2XAnimationManager implements Animation {
private static final String TAG = "V2XAnimationManager";
private ImageView targetImageView;
private Animation delegate;
private boolean isStarted = false;
@@ -18,6 +20,7 @@ public class V2XAnimationManager implements Animation {
ThreadPoolService.execute(() -> {
final AnimationDrawable drawable = new AnimationDrawable();
for (int i = 0; i < resources.length; i++) {
drawable.setOneShot(false);
drawable.addFrame(targetImageView.getResources().getDrawable(resources[i]), duration);
}
UiThreadHandler.post(() -> {
@@ -48,6 +51,7 @@ public class V2XAnimationManager implements Animation {
}
public void release() {
delegate = null;
}
}