You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Animator: call onAnimationEnd() asynchronously
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package android.animation;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
public class Animator {
|
||||
|
||||
public interface AnimatorListener {
|
||||
@@ -11,8 +14,14 @@ public class Animator {
|
||||
public void setTarget(Object target) {}
|
||||
|
||||
public void start() {
|
||||
if (listener != null)
|
||||
listener.onAnimationEnd(this);
|
||||
if (listener == null)
|
||||
return;
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
if (listener != null)
|
||||
listener.onAnimationEnd(Animator.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addListener(AnimatorListener listener) {
|
||||
@@ -33,4 +42,6 @@ public class Animator {
|
||||
|
||||
public boolean isStarted() { return false; }
|
||||
|
||||
public void end() {}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user