add AccelerateInterpolator based on AOSP version

This commit is contained in:
Julian Winkler
2023-07-13 22:28:44 +02:00
parent c10504c089
commit def2804a85
3 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package android.view.animation;
/**
* An interpolator where the rate of change starts out slowly and
* and then accelerates.
*
*/
public class AccelerateInterpolator implements Interpolator {
private final float mFactor;
private final double mDoubleFactor;
public AccelerateInterpolator() {
mFactor = 1.0f;
mDoubleFactor = 2.0;
}
public float getInterpolation(float input) {
if (mFactor == 1.0f) {
return input * input;
} else {
return (float)Math.pow(input, mDoubleFactor);
}
}
}

View File

@@ -0,0 +1,5 @@
package android.view.animation;
public interface Interpolator {
}

View File

@@ -191,6 +191,8 @@ hax_jar = jar('hax', [
'android/util/TypedValue.java',
'android/util/Xml.java',
'android/util/XmlPullAttributes.java',
'android/view/animation/AccelerateInterpolator.java',
'android/view/animation/Interpolator.java',
'android/view/Choreographer.java',
'android/view/Display.java',
'android/view/Gravity.java',