mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
Animator: add delay before calling onAnimationEnd()
This fixes a crash in NewPipe's Download Activity
This commit is contained in:
parent
078006f7fb
commit
2e11934bcf
1 changed files with 8 additions and 4 deletions
|
@ -9,6 +9,7 @@ public class Animator {
|
|||
public abstract void onAnimationEnd (Animator animation);
|
||||
}
|
||||
|
||||
private long duration = 50;
|
||||
private AnimatorListener listener;
|
||||
|
||||
public void setTarget(Object target) {}
|
||||
|
@ -16,12 +17,12 @@ public class Animator {
|
|||
public void start() {
|
||||
if (listener == null)
|
||||
return;
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
if (listener != null)
|
||||
listener.onAnimationEnd(Animator.this);
|
||||
}
|
||||
});
|
||||
}, duration);
|
||||
}
|
||||
|
||||
public void addListener(AnimatorListener listener) {
|
||||
|
@ -32,9 +33,12 @@ public class Animator {
|
|||
|
||||
public long getStartDelay() { return 0; }
|
||||
|
||||
public long getDuration() { return 0; }
|
||||
public long getDuration() { return duration; }
|
||||
|
||||
public Animator setDuration(long duration) { return this; }
|
||||
public Animator setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setInterpolator(TimeInterpolator i) {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue