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
add more Animation APIs and call onAnimationEnd()
Directly calling onAnimationEnd() skips the animation and directly sets the target values
This commit is contained in:
@@ -3,10 +3,15 @@ package android.animation;
|
|||||||
public class Animator {
|
public class Animator {
|
||||||
|
|
||||||
public interface AnimatorListener {
|
public interface AnimatorListener {
|
||||||
|
public abstract void onAnimationEnd (Animator animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarget(Object target) {}
|
public void setTarget(Object target) {}
|
||||||
|
|
||||||
public void start() {}
|
public void start() {}
|
||||||
|
|
||||||
|
public void addListener(AnimatorListener listener) {
|
||||||
|
listener.onAnimationEnd(Animator.this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ package android.animation;
|
|||||||
* Any custom listener that cares only about a subset of the methods of this listener can
|
* Any custom listener that cares only about a subset of the methods of this listener can
|
||||||
* simply subclass this adapter class instead of implementing the interface directly.
|
* simply subclass this adapter class instead of implementing the interface directly.
|
||||||
*/
|
*/
|
||||||
public abstract class AnimatorListenerAdapter /*implements Animator.AnimatorListener,
|
public abstract class AnimatorListenerAdapter implements Animator.AnimatorListener/*,
|
||||||
Animator.AnimatorPauseListener*/ {
|
Animator.AnimatorPauseListener*/ {
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ 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 addListener(Animator.AnimatorListener listener) {}
|
|
||||||
public void setFloatValues(float[] values) {}
|
public void setFloatValues(float[] values) {}
|
||||||
|
public boolean isRunning() {return false;}
|
||||||
|
public void setIntValues(int[] values) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementors of this interface can add themselves as update listeners
|
* Implementors of this interface can add themselves as update listeners
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public class ViewPropertyAnimator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ViewPropertyAnimator setListener(Animator.AnimatorListener listener) {
|
public ViewPropertyAnimator setListener(Animator.AnimatorListener listener) {
|
||||||
|
if (listener != null)
|
||||||
|
listener.onAnimationEnd(null);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,5 +29,17 @@ public class ViewPropertyAnimator {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ViewPropertyAnimator rotation(float rotation) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewPropertyAnimator translationX(float translationX) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewPropertyAnimator translationY(float translationY) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void start() {}
|
public void start() {}
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/api-impl/android/view/animation/AlphaAnimation.java
Normal file
7
src/api-impl/android/view/animation/AlphaAnimation.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package android.view.animation;
|
||||||
|
|
||||||
|
public class AlphaAnimation extends Animation {
|
||||||
|
|
||||||
|
public AlphaAnimation(float fromAlpha, float toAlpha) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,4 +2,10 @@ package android.view.animation;
|
|||||||
|
|
||||||
public class Animation {
|
public class Animation {
|
||||||
|
|
||||||
|
public interface AnimationListener {}
|
||||||
|
|
||||||
|
public void setDuration(long durationMillis) {}
|
||||||
|
|
||||||
|
public void setInterpolator(Interpolator i) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,8 @@ import android.content.Context;
|
|||||||
|
|
||||||
public class AnimationUtils {
|
public class AnimationUtils {
|
||||||
public static Animation loadAnimation(Context context, int dummy) { return new Animation(); }
|
public static Animation loadAnimation(Context context, int dummy) { return new Animation(); }
|
||||||
|
|
||||||
|
public static long currentAnimationTimeMillis() {
|
||||||
|
return System.currentTimeMillis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -320,6 +320,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/view/WindowManagerImpl.java',
|
'android/view/WindowManagerImpl.java',
|
||||||
'android/view/WindowManager.java',
|
'android/view/WindowManager.java',
|
||||||
'android/view/animation/AccelerateDecelerateInterpolator.java',
|
'android/view/animation/AccelerateDecelerateInterpolator.java',
|
||||||
|
'android/view/animation/AlphaAnimation.java',
|
||||||
'android/view/animation/Animation.java',
|
'android/view/animation/Animation.java',
|
||||||
'android/view/animation/AnimationUtils.java',
|
'android/view/animation/AnimationUtils.java',
|
||||||
'android/view/animation/LinearInterpolator.java',
|
'android/view/animation/LinearInterpolator.java',
|
||||||
|
|||||||
Reference in New Issue
Block a user