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
ValueAnimator: actually call the AnimatorUpdateListener
This commit is contained in:
@@ -2,23 +2,34 @@ package android.animation;
|
|||||||
|
|
||||||
public class ValueAnimator extends Animator {
|
public class ValueAnimator extends Animator {
|
||||||
|
|
||||||
|
private AnimatorUpdateListener update_listener;
|
||||||
|
private Object value_end;
|
||||||
|
|
||||||
public static ValueAnimator ofFloat(float... values) {
|
public static ValueAnimator ofFloat(float... values) {
|
||||||
return new ValueAnimator();
|
ValueAnimator animator = new ValueAnimator();
|
||||||
|
animator.value_end = values[values.length - 1];
|
||||||
|
return animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValueAnimator ofObject(TypeEvaluator evaluator, Object[] values) {
|
public static ValueAnimator ofObject(TypeEvaluator evaluator, Object[] values) {
|
||||||
return new ValueAnimator();
|
ValueAnimator animator = new ValueAnimator();
|
||||||
|
animator.value_end = values[values.length - 1];
|
||||||
|
return animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValueAnimator ofInt(int... values) {
|
public static ValueAnimator ofInt(int... values) {
|
||||||
return new ValueAnimator();
|
ValueAnimator animator = new ValueAnimator();
|
||||||
|
animator.value_end = values[values.length - 1];
|
||||||
|
return animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueAnimator setDuration(long duration) {
|
public ValueAnimator setDuration(long duration) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUpdateListener(AnimatorUpdateListener listener) {}
|
public void addUpdateListener(AnimatorUpdateListener listener) {
|
||||||
|
this.update_listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
public static long getFrameDelay() {
|
public static long getFrameDelay() {
|
||||||
return 20; // 20ms frame interval
|
return 20; // 20ms frame interval
|
||||||
@@ -34,15 +45,30 @@ public class ValueAnimator extends Animator {
|
|||||||
public int getRepeatCount() {return 0;}
|
public int getRepeatCount() {return 0;}
|
||||||
public int getRepeatMode() {return 0;}
|
public int getRepeatMode() {return 0;}
|
||||||
public void setInterpolator(TimeInterpolator interpolator) {}
|
public void setInterpolator(TimeInterpolator interpolator) {}
|
||||||
public void setFloatValues(float[] values) {}
|
public void setFloatValues(float[] values) {
|
||||||
|
value_end = values[values.length - 1];
|
||||||
|
}
|
||||||
public boolean isRunning() {return false;}
|
public boolean isRunning() {return false;}
|
||||||
public void setIntValues(int[] values) {}
|
public void setIntValues(int[] values) {
|
||||||
|
value_end = values[values.length - 1];
|
||||||
|
}
|
||||||
public void setRepeatCount(int value) {}
|
public void setRepeatCount(int value) {}
|
||||||
public void setRepeatMode(int value) {}
|
public void setRepeatMode(int value) {}
|
||||||
public void cancel() {}
|
public void cancel() {}
|
||||||
public void setEvaluator(TypeEvaluator evaluator) {}
|
public void setEvaluator(TypeEvaluator evaluator) {}
|
||||||
public void setStartDelay(long startDelay) {}
|
public void setStartDelay(long startDelay) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
if (update_listener != null)
|
||||||
|
update_listener.onAnimationUpdate(this);
|
||||||
|
super.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getAnimatedValue() {
|
||||||
|
return value_end;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementors of this interface can add themselves as update listeners
|
* Implementors of this interface can add themselves as update listeners
|
||||||
* to an <code>ValueAnimator</code> instance to receive callbacks on every animation
|
* to an <code>ValueAnimator</code> instance to receive callbacks on every animation
|
||||||
|
|||||||
Reference in New Issue
Block a user