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;
|
package android.animation;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
public class Animator {
|
public class Animator {
|
||||||
|
|
||||||
public interface AnimatorListener {
|
public interface AnimatorListener {
|
||||||
@@ -11,8 +14,14 @@ public class Animator {
|
|||||||
public void setTarget(Object target) {}
|
public void setTarget(Object target) {}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
if (listener != null)
|
if (listener == null)
|
||||||
listener.onAnimationEnd(this);
|
return;
|
||||||
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (listener != null)
|
||||||
|
listener.onAnimationEnd(Animator.this);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener(AnimatorListener listener) {
|
public void addListener(AnimatorListener listener) {
|
||||||
@@ -33,4 +42,6 @@ public class Animator {
|
|||||||
|
|
||||||
public boolean isStarted() { return false; }
|
public boolean isStarted() { return false; }
|
||||||
|
|
||||||
|
public void end() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user