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: add delay before calling onAnimationEnd()
This fixes a crash in NewPipe's Download Activity
This commit is contained in:
@@ -9,6 +9,7 @@ public class Animator {
|
|||||||
public abstract void onAnimationEnd (Animator animation);
|
public abstract void onAnimationEnd (Animator animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long duration = 50;
|
||||||
private AnimatorListener listener;
|
private AnimatorListener listener;
|
||||||
|
|
||||||
public void setTarget(Object target) {}
|
public void setTarget(Object target) {}
|
||||||
@@ -16,12 +17,12 @@ public class Animator {
|
|||||||
public void start() {
|
public void start() {
|
||||||
if (listener == null)
|
if (listener == null)
|
||||||
return;
|
return;
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
listener.onAnimationEnd(Animator.this);
|
listener.onAnimationEnd(Animator.this);
|
||||||
}
|
}
|
||||||
});
|
}, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener(AnimatorListener listener) {
|
public void addListener(AnimatorListener listener) {
|
||||||
@@ -32,9 +33,12 @@ public class Animator {
|
|||||||
|
|
||||||
public long getStartDelay() { return 0; }
|
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) {}
|
public void setInterpolator(TimeInterpolator i) {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user