ui-animation-core to MPP.
Test: ./gradlew buildOnServer
Change-Id: Ia62892294153360ed203167c6ce757de929a1386
diff --git a/ui/ui-animation-core/api/0.1.0-dev14.txt b/ui/ui-animation-core/api/0.1.0-dev14.txt
index 3944e4a..714fd9c 100644
--- a/ui/ui-animation-core/api/0.1.0-dev14.txt
+++ b/ui/ui-animation-core/api/0.1.0-dev14.txt
@@ -138,7 +138,8 @@
property public abstract T! value;
}
- public abstract sealed class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ public abstract class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ ctor public BaseAnimationClock();
method public void subscribe(androidx.animation.AnimationClockObserver observer);
method public void unsubscribe(androidx.animation.AnimationClockObserver observer);
field @Deprecated public static final androidx.animation.BaseAnimationClock.Companion! Companion;
@@ -188,7 +189,7 @@
}
public final class ExponentialDecay implements androidx.animation.DecayAnimation {
- ctor public ExponentialDecay(@FloatRange(from=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, fromInclusive=null) float absVelocityThreshold);
+ ctor public ExponentialDecay(@FloatRange(from=null, to=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, to=null, fromInclusive=null) float absVelocityThreshold);
ctor public ExponentialDecay();
method public float getAbsVelocityThreshold();
method public long getDurationMillis(float start, float startVelocity);
@@ -212,6 +213,9 @@
property public androidx.animation.TwoWayConverter<java.lang.Integer,androidx.animation.AnimationVector1D> typeConverter;
}
+ @kotlin.RequiresOptIn(message="This API is internal to library.") @kotlin.annotation.Target(allowedTargets={AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public @interface InternalAnimationApi {
+ }
+
public enum InterruptionHandling {
enum_constant public static final androidx.animation.InterruptionHandling PHYSICS;
enum_constant public static final androidx.animation.InterruptionHandling SNAP_TO_END;
@@ -276,6 +280,14 @@
property public final Integer? iterations;
}
+ @androidx.animation.InternalAnimationApi public final class SeekableAnimation<T> {
+ ctor public SeekableAnimation(androidx.animation.TransitionDefinition<T> def, T! fromState, T! toState);
+ method public java.util.Map<androidx.animation.PropKey<java.lang.Object,androidx.animation.AnimationVector>,java.lang.Object> getAnimValuesAt(long playTime);
+ method public androidx.animation.TransitionDefinition<T> getDef();
+ method public long getDuration();
+ property public final long duration;
+ }
+
public final class SnapBuilder<T> extends androidx.animation.AnimationBuilder<T> {
ctor public SnapBuilder();
method public <V extends androidx.animation.AnimationVector> androidx.animation.Animation<V> build$lintWithKotlin(androidx.animation.TwoWayConverter<T,V> converter);
@@ -295,6 +307,9 @@
}
public final class SpringEstimationKt {
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(float stiffness, float dampingRatio, float initialVelocity, float initialDisplacement, float delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double stiffness, double dampingRatio, double initialVelocity, double initialDisplacement, double delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double springConstant, double dampingCoefficient, double mass, double initialVelocity, double initialDisplacement, double delta);
}
public final class SpringSimulationKt {
@@ -310,6 +325,8 @@
}
public final class ToolingGlueKt {
+ method @androidx.animation.InternalAnimationApi public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
+ method @androidx.animation.InternalAnimationApi public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
}
public final class TransitionAnimation<T> implements androidx.animation.TransitionState {
@@ -326,6 +343,13 @@
property public final kotlin.jvm.functions.Function0<kotlin.Unit>? onUpdate;
}
+ @androidx.animation.InternalAnimationApi public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
+ ctor public TransitionAnimation.TransitionAnimationClockObserver();
+ method public androidx.animation.TransitionAnimation<T> getAnimation();
+ method public void onAnimationFrame(long frameTimeMillis);
+ property public final androidx.animation.TransitionAnimation<T> animation;
+ }
+
public final class TransitionAnimationKt {
}
diff --git a/ui/ui-animation-core/api/current.txt b/ui/ui-animation-core/api/current.txt
index 3944e4a..714fd9c 100644
--- a/ui/ui-animation-core/api/current.txt
+++ b/ui/ui-animation-core/api/current.txt
@@ -138,7 +138,8 @@
property public abstract T! value;
}
- public abstract sealed class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ public abstract class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ ctor public BaseAnimationClock();
method public void subscribe(androidx.animation.AnimationClockObserver observer);
method public void unsubscribe(androidx.animation.AnimationClockObserver observer);
field @Deprecated public static final androidx.animation.BaseAnimationClock.Companion! Companion;
@@ -188,7 +189,7 @@
}
public final class ExponentialDecay implements androidx.animation.DecayAnimation {
- ctor public ExponentialDecay(@FloatRange(from=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, fromInclusive=null) float absVelocityThreshold);
+ ctor public ExponentialDecay(@FloatRange(from=null, to=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, to=null, fromInclusive=null) float absVelocityThreshold);
ctor public ExponentialDecay();
method public float getAbsVelocityThreshold();
method public long getDurationMillis(float start, float startVelocity);
@@ -212,6 +213,9 @@
property public androidx.animation.TwoWayConverter<java.lang.Integer,androidx.animation.AnimationVector1D> typeConverter;
}
+ @kotlin.RequiresOptIn(message="This API is internal to library.") @kotlin.annotation.Target(allowedTargets={AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public @interface InternalAnimationApi {
+ }
+
public enum InterruptionHandling {
enum_constant public static final androidx.animation.InterruptionHandling PHYSICS;
enum_constant public static final androidx.animation.InterruptionHandling SNAP_TO_END;
@@ -276,6 +280,14 @@
property public final Integer? iterations;
}
+ @androidx.animation.InternalAnimationApi public final class SeekableAnimation<T> {
+ ctor public SeekableAnimation(androidx.animation.TransitionDefinition<T> def, T! fromState, T! toState);
+ method public java.util.Map<androidx.animation.PropKey<java.lang.Object,androidx.animation.AnimationVector>,java.lang.Object> getAnimValuesAt(long playTime);
+ method public androidx.animation.TransitionDefinition<T> getDef();
+ method public long getDuration();
+ property public final long duration;
+ }
+
public final class SnapBuilder<T> extends androidx.animation.AnimationBuilder<T> {
ctor public SnapBuilder();
method public <V extends androidx.animation.AnimationVector> androidx.animation.Animation<V> build$lintWithKotlin(androidx.animation.TwoWayConverter<T,V> converter);
@@ -295,6 +307,9 @@
}
public final class SpringEstimationKt {
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(float stiffness, float dampingRatio, float initialVelocity, float initialDisplacement, float delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double stiffness, double dampingRatio, double initialVelocity, double initialDisplacement, double delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double springConstant, double dampingCoefficient, double mass, double initialVelocity, double initialDisplacement, double delta);
}
public final class SpringSimulationKt {
@@ -310,6 +325,8 @@
}
public final class ToolingGlueKt {
+ method @androidx.animation.InternalAnimationApi public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
+ method @androidx.animation.InternalAnimationApi public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
}
public final class TransitionAnimation<T> implements androidx.animation.TransitionState {
@@ -326,6 +343,13 @@
property public final kotlin.jvm.functions.Function0<kotlin.Unit>? onUpdate;
}
+ @androidx.animation.InternalAnimationApi public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
+ ctor public TransitionAnimation.TransitionAnimationClockObserver();
+ method public androidx.animation.TransitionAnimation<T> getAnimation();
+ method public void onAnimationFrame(long frameTimeMillis);
+ property public final androidx.animation.TransitionAnimation<T> animation;
+ }
+
public final class TransitionAnimationKt {
}
diff --git a/ui/ui-animation-core/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-animation-core/api/public_plus_experimental_0.1.0-dev14.txt
index b3720d5..714fd9c 100644
--- a/ui/ui-animation-core/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-animation-core/api/public_plus_experimental_0.1.0-dev14.txt
@@ -138,7 +138,8 @@
property public abstract T! value;
}
- public abstract sealed class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ public abstract class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ ctor public BaseAnimationClock();
method public void subscribe(androidx.animation.AnimationClockObserver observer);
method public void unsubscribe(androidx.animation.AnimationClockObserver observer);
field @Deprecated public static final androidx.animation.BaseAnimationClock.Companion! Companion;
@@ -188,7 +189,7 @@
}
public final class ExponentialDecay implements androidx.animation.DecayAnimation {
- ctor public ExponentialDecay(@FloatRange(from=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, fromInclusive=null) float absVelocityThreshold);
+ ctor public ExponentialDecay(@FloatRange(from=null, to=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, to=null, fromInclusive=null) float absVelocityThreshold);
ctor public ExponentialDecay();
method public float getAbsVelocityThreshold();
method public long getDurationMillis(float start, float startVelocity);
@@ -212,6 +213,9 @@
property public androidx.animation.TwoWayConverter<java.lang.Integer,androidx.animation.AnimationVector1D> typeConverter;
}
+ @kotlin.RequiresOptIn(message="This API is internal to library.") @kotlin.annotation.Target(allowedTargets={AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public @interface InternalAnimationApi {
+ }
+
public enum InterruptionHandling {
enum_constant public static final androidx.animation.InterruptionHandling PHYSICS;
enum_constant public static final androidx.animation.InterruptionHandling SNAP_TO_END;
@@ -276,7 +280,7 @@
property public final Integer? iterations;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class SeekableAnimation<T> {
+ @androidx.animation.InternalAnimationApi public final class SeekableAnimation<T> {
ctor public SeekableAnimation(androidx.animation.TransitionDefinition<T> def, T! fromState, T! toState);
method public java.util.Map<androidx.animation.PropKey<java.lang.Object,androidx.animation.AnimationVector>,java.lang.Object> getAnimValuesAt(long playTime);
method public androidx.animation.TransitionDefinition<T> getDef();
@@ -303,6 +307,9 @@
}
public final class SpringEstimationKt {
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(float stiffness, float dampingRatio, float initialVelocity, float initialDisplacement, float delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double stiffness, double dampingRatio, double initialVelocity, double initialDisplacement, double delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double springConstant, double dampingCoefficient, double mass, double initialVelocity, double initialDisplacement, double delta);
}
public final class SpringSimulationKt {
@@ -318,8 +325,8 @@
}
public final class ToolingGlueKt {
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
+ method @androidx.animation.InternalAnimationApi public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
+ method @androidx.animation.InternalAnimationApi public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
}
public final class TransitionAnimation<T> implements androidx.animation.TransitionState {
@@ -336,7 +343,7 @@
property public final kotlin.jvm.functions.Function0<kotlin.Unit>? onUpdate;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
+ @androidx.animation.InternalAnimationApi public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
ctor public TransitionAnimation.TransitionAnimationClockObserver();
method public androidx.animation.TransitionAnimation<T> getAnimation();
method public void onAnimationFrame(long frameTimeMillis);
diff --git a/ui/ui-animation-core/api/public_plus_experimental_current.txt b/ui/ui-animation-core/api/public_plus_experimental_current.txt
index b3720d5..714fd9c 100644
--- a/ui/ui-animation-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-animation-core/api/public_plus_experimental_current.txt
@@ -138,7 +138,8 @@
property public abstract T! value;
}
- public abstract sealed class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ public abstract class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ ctor public BaseAnimationClock();
method public void subscribe(androidx.animation.AnimationClockObserver observer);
method public void unsubscribe(androidx.animation.AnimationClockObserver observer);
field @Deprecated public static final androidx.animation.BaseAnimationClock.Companion! Companion;
@@ -188,7 +189,7 @@
}
public final class ExponentialDecay implements androidx.animation.DecayAnimation {
- ctor public ExponentialDecay(@FloatRange(from=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, fromInclusive=null) float absVelocityThreshold);
+ ctor public ExponentialDecay(@FloatRange(from=null, to=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, to=null, fromInclusive=null) float absVelocityThreshold);
ctor public ExponentialDecay();
method public float getAbsVelocityThreshold();
method public long getDurationMillis(float start, float startVelocity);
@@ -212,6 +213,9 @@
property public androidx.animation.TwoWayConverter<java.lang.Integer,androidx.animation.AnimationVector1D> typeConverter;
}
+ @kotlin.RequiresOptIn(message="This API is internal to library.") @kotlin.annotation.Target(allowedTargets={AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public @interface InternalAnimationApi {
+ }
+
public enum InterruptionHandling {
enum_constant public static final androidx.animation.InterruptionHandling PHYSICS;
enum_constant public static final androidx.animation.InterruptionHandling SNAP_TO_END;
@@ -276,7 +280,7 @@
property public final Integer? iterations;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class SeekableAnimation<T> {
+ @androidx.animation.InternalAnimationApi public final class SeekableAnimation<T> {
ctor public SeekableAnimation(androidx.animation.TransitionDefinition<T> def, T! fromState, T! toState);
method public java.util.Map<androidx.animation.PropKey<java.lang.Object,androidx.animation.AnimationVector>,java.lang.Object> getAnimValuesAt(long playTime);
method public androidx.animation.TransitionDefinition<T> getDef();
@@ -303,6 +307,9 @@
}
public final class SpringEstimationKt {
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(float stiffness, float dampingRatio, float initialVelocity, float initialDisplacement, float delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double stiffness, double dampingRatio, double initialVelocity, double initialDisplacement, double delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double springConstant, double dampingCoefficient, double mass, double initialVelocity, double initialDisplacement, double delta);
}
public final class SpringSimulationKt {
@@ -318,8 +325,8 @@
}
public final class ToolingGlueKt {
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
+ method @androidx.animation.InternalAnimationApi public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
+ method @androidx.animation.InternalAnimationApi public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
}
public final class TransitionAnimation<T> implements androidx.animation.TransitionState {
@@ -336,7 +343,7 @@
property public final kotlin.jvm.functions.Function0<kotlin.Unit>? onUpdate;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
+ @androidx.animation.InternalAnimationApi public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
ctor public TransitionAnimation.TransitionAnimationClockObserver();
method public androidx.animation.TransitionAnimation<T> getAnimation();
method public void onAnimationFrame(long frameTimeMillis);
diff --git a/ui/ui-animation-core/api/restricted_0.1.0-dev14.txt b/ui/ui-animation-core/api/restricted_0.1.0-dev14.txt
index b3720d5..714fd9c 100644
--- a/ui/ui-animation-core/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-animation-core/api/restricted_0.1.0-dev14.txt
@@ -138,7 +138,8 @@
property public abstract T! value;
}
- public abstract sealed class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ public abstract class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ ctor public BaseAnimationClock();
method public void subscribe(androidx.animation.AnimationClockObserver observer);
method public void unsubscribe(androidx.animation.AnimationClockObserver observer);
field @Deprecated public static final androidx.animation.BaseAnimationClock.Companion! Companion;
@@ -188,7 +189,7 @@
}
public final class ExponentialDecay implements androidx.animation.DecayAnimation {
- ctor public ExponentialDecay(@FloatRange(from=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, fromInclusive=null) float absVelocityThreshold);
+ ctor public ExponentialDecay(@FloatRange(from=null, to=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, to=null, fromInclusive=null) float absVelocityThreshold);
ctor public ExponentialDecay();
method public float getAbsVelocityThreshold();
method public long getDurationMillis(float start, float startVelocity);
@@ -212,6 +213,9 @@
property public androidx.animation.TwoWayConverter<java.lang.Integer,androidx.animation.AnimationVector1D> typeConverter;
}
+ @kotlin.RequiresOptIn(message="This API is internal to library.") @kotlin.annotation.Target(allowedTargets={AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public @interface InternalAnimationApi {
+ }
+
public enum InterruptionHandling {
enum_constant public static final androidx.animation.InterruptionHandling PHYSICS;
enum_constant public static final androidx.animation.InterruptionHandling SNAP_TO_END;
@@ -276,7 +280,7 @@
property public final Integer? iterations;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class SeekableAnimation<T> {
+ @androidx.animation.InternalAnimationApi public final class SeekableAnimation<T> {
ctor public SeekableAnimation(androidx.animation.TransitionDefinition<T> def, T! fromState, T! toState);
method public java.util.Map<androidx.animation.PropKey<java.lang.Object,androidx.animation.AnimationVector>,java.lang.Object> getAnimValuesAt(long playTime);
method public androidx.animation.TransitionDefinition<T> getDef();
@@ -303,6 +307,9 @@
}
public final class SpringEstimationKt {
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(float stiffness, float dampingRatio, float initialVelocity, float initialDisplacement, float delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double stiffness, double dampingRatio, double initialVelocity, double initialDisplacement, double delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double springConstant, double dampingCoefficient, double mass, double initialVelocity, double initialDisplacement, double delta);
}
public final class SpringSimulationKt {
@@ -318,8 +325,8 @@
}
public final class ToolingGlueKt {
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
+ method @androidx.animation.InternalAnimationApi public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
+ method @androidx.animation.InternalAnimationApi public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
}
public final class TransitionAnimation<T> implements androidx.animation.TransitionState {
@@ -336,7 +343,7 @@
property public final kotlin.jvm.functions.Function0<kotlin.Unit>? onUpdate;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
+ @androidx.animation.InternalAnimationApi public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
ctor public TransitionAnimation.TransitionAnimationClockObserver();
method public androidx.animation.TransitionAnimation<T> getAnimation();
method public void onAnimationFrame(long frameTimeMillis);
diff --git a/ui/ui-animation-core/api/restricted_current.txt b/ui/ui-animation-core/api/restricted_current.txt
index b3720d5..714fd9c 100644
--- a/ui/ui-animation-core/api/restricted_current.txt
+++ b/ui/ui-animation-core/api/restricted_current.txt
@@ -138,7 +138,8 @@
property public abstract T! value;
}
- public abstract sealed class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ public abstract class BaseAnimationClock implements androidx.animation.AnimationClockObservable {
+ ctor public BaseAnimationClock();
method public void subscribe(androidx.animation.AnimationClockObserver observer);
method public void unsubscribe(androidx.animation.AnimationClockObserver observer);
field @Deprecated public static final androidx.animation.BaseAnimationClock.Companion! Companion;
@@ -188,7 +189,7 @@
}
public final class ExponentialDecay implements androidx.animation.DecayAnimation {
- ctor public ExponentialDecay(@FloatRange(from=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, fromInclusive=null) float absVelocityThreshold);
+ ctor public ExponentialDecay(@FloatRange(from=null, to=null, fromInclusive=null) float frictionMultiplier, @FloatRange(from=null, to=null, fromInclusive=null) float absVelocityThreshold);
ctor public ExponentialDecay();
method public float getAbsVelocityThreshold();
method public long getDurationMillis(float start, float startVelocity);
@@ -212,6 +213,9 @@
property public androidx.animation.TwoWayConverter<java.lang.Integer,androidx.animation.AnimationVector1D> typeConverter;
}
+ @kotlin.RequiresOptIn(message="This API is internal to library.") @kotlin.annotation.Target(allowedTargets={AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public @interface InternalAnimationApi {
+ }
+
public enum InterruptionHandling {
enum_constant public static final androidx.animation.InterruptionHandling PHYSICS;
enum_constant public static final androidx.animation.InterruptionHandling SNAP_TO_END;
@@ -276,7 +280,7 @@
property public final Integer? iterations;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class SeekableAnimation<T> {
+ @androidx.animation.InternalAnimationApi public final class SeekableAnimation<T> {
ctor public SeekableAnimation(androidx.animation.TransitionDefinition<T> def, T! fromState, T! toState);
method public java.util.Map<androidx.animation.PropKey<java.lang.Object,androidx.animation.AnimationVector>,java.lang.Object> getAnimValuesAt(long playTime);
method public androidx.animation.TransitionDefinition<T> getDef();
@@ -303,6 +307,9 @@
}
public final class SpringEstimationKt {
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(float stiffness, float dampingRatio, float initialVelocity, float initialDisplacement, float delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double stiffness, double dampingRatio, double initialVelocity, double initialDisplacement, double delta);
+ method @VisibleForTesting(otherwise=3) public static long estimateAnimationDurationMillis(double springConstant, double dampingCoefficient, double mass, double initialVelocity, double initialDisplacement, double delta);
}
public final class SpringSimulationKt {
@@ -318,8 +325,8 @@
}
public final class ToolingGlueKt {
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
+ method @androidx.animation.InternalAnimationApi public static <T> androidx.animation.SeekableAnimation<T> createSeekableAnimation(androidx.animation.TransitionAnimation<T>, T? fromState, T? toState);
+ method @androidx.animation.InternalAnimationApi public static <T> java.util.Set<T> getStates(androidx.animation.TransitionAnimation<T>);
}
public final class TransitionAnimation<T> implements androidx.animation.TransitionState {
@@ -336,7 +343,7 @@
property public final kotlin.jvm.functions.Function0<kotlin.Unit>? onUpdate;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
+ @androidx.animation.InternalAnimationApi public final class TransitionAnimation.TransitionAnimationClockObserver implements androidx.animation.AnimationClockObserver {
ctor public TransitionAnimation.TransitionAnimationClockObserver();
method public androidx.animation.TransitionAnimation<T> getAnimation();
method public void onAnimationFrame(long frameTimeMillis);
diff --git a/ui/ui-animation-core/build.gradle b/ui/ui-animation-core/build.gradle
index 439d4cd..0222e9a 100644
--- a/ui/ui-animation-core/build.gradle
+++ b/ui/ui-animation-core/build.gradle
@@ -25,25 +25,39 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("org.jetbrains.kotlin.android")
- id("kotlin-android-extensions")
+ id("kotlin-multiplatform")
}
dependencies {
- implementation(KOTLIN_STDLIB)
+ kotlinPlugin project(path: ":compose:compose-compiler")
+}
- api "androidx.annotation:annotation:1.1.0"
- implementation project(":ui:ui-util")
+kotlin {
+ android()
+ sourceSets {
+ commonMain.dependencies {
+ implementation project(":ui:ui-util")
+ implementation (KOTLIN_STDLIB_COMMON)
+ }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ implementation (KOTLIN_STDLIB)
+ }
- testImplementation(ANDROIDX_TEST_RULES)
- testImplementation(ANDROIDX_TEST_RUNNER)
- testImplementation(JUNIT)
- testImplementation(TRUTH)
- testImplementation(KOTLIN_COROUTINES_CORE)
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(KOTLIN_COROUTINES_CORE)
+ }
- androidTestImplementation(ANDROIDX_TEST_RULES)
- androidTestImplementation(ANDROIDX_TEST_RUNNER)
- androidTestImplementation(JUNIT)
+ androidAndroidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ }
+ }
}
androidx {
@@ -57,6 +71,8 @@
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
- freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
+ freeCompilerArgs += [
+ "-Xuse-experimental=kotlin.Experimental"
+ ]
}
}
diff --git a/ui/ui-animation-core/src/main/AndroidManifest.xml b/ui/ui-animation-core/src/androidMain/AndroidManifest.xml
similarity index 100%
rename from ui/ui-animation-core/src/main/AndroidManifest.xml
rename to ui/ui-animation-core/src/androidMain/AndroidManifest.xml
diff --git a/ui/ui-animation-core/src/androidMain/kotlin/androidx/animation/AndroidAnimationClock.kt b/ui/ui-animation-core/src/androidMain/kotlin/androidx/animation/AndroidAnimationClock.kt
new file mode 100644
index 0000000..5360e90
--- /dev/null
+++ b/ui/ui-animation-core/src/androidMain/kotlin/androidx/animation/AndroidAnimationClock.kt
@@ -0,0 +1,85 @@
+// ktlint-disable filename
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.animation
+
+import android.os.Handler
+import android.os.Looper
+import android.view.Choreographer
+import java.util.concurrent.CountDownLatch
+
+/**
+ * Default Choreographer based clock that pushes a new frame to all subscribers on each
+ * Choreographer tick, until all subscribers have unsubscribed. An instance of this clock will be
+ * provided through [AnimationClockAmbient][androidx.ui.core.AnimationClockAmbient] at the root
+ * of the composition tree.
+ *
+ * If initialized from any other thread but the main thread, part of the initialization is done
+ * synchronously on the main thread. If this poses a problem, consider initializing this clock on
+ * the main thread itself.
+ */
+actual class DefaultAnimationClock actual constructor() : BaseAnimationClock() {
+
+ private val mainChoreographer: Choreographer
+
+ init {
+ /**
+ * If not initializing on the main thread, a message will be posted on the main thread to
+ * fetch the Choreographer, and initialization blocks until that fetch is completed.
+ */
+ if (Looper.myLooper() == Looper.getMainLooper()) {
+ mainChoreographer = Choreographer.getInstance()
+ } else {
+ val latch = CountDownLatch(1)
+ var choreographer: Choreographer? = null
+ Handler(Looper.getMainLooper()).postAtFrontOfQueue {
+ try {
+ choreographer = Choreographer.getInstance()
+ } finally {
+ latch.countDown()
+ }
+ }
+ latch.await()
+ mainChoreographer = choreographer!!
+ }
+ }
+
+ @Volatile
+ private var subscribedToChoreographer = false
+
+ private val frameCallback = Choreographer.FrameCallback {
+ dispatchTime(it / 1000000)
+ }
+
+ override fun subscribe(observer: AnimationClockObserver) {
+ if (!subscribedToChoreographer) {
+ mainChoreographer.postFrameCallback(frameCallback)
+ subscribedToChoreographer = true
+ }
+ super.subscribe(observer)
+ }
+
+ override fun dispatchTime(frameTimeMillis: Long) {
+ super.dispatchTime(frameTimeMillis)
+ subscribedToChoreographer = if (hasObservers()) {
+ mainChoreographer.postFrameCallback(frameCallback)
+ true
+ } else {
+ false
+ }
+ }
+}
\ No newline at end of file
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/AnimatedValue.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimatedValue.kt
similarity index 93%
rename from ui/ui-animation-core/src/main/java/androidx/animation/AnimatedValue.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimatedValue.kt
index 871d162..e1e0b0b 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/AnimatedValue.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimatedValue.kt
@@ -16,7 +16,6 @@
package androidx.animation
-import android.util.Log
import androidx.animation.AnimationEndReason.BoundReached
import androidx.animation.AnimationEndReason.Interrupted
import androidx.animation.AnimationEndReason.TargetReached
@@ -107,11 +106,12 @@
// end of the animation.
private var lastFrameTime: Long = Unset
- private var animationClockObserver = object : AnimationClockObserver {
- override fun onAnimationFrame(frameTimeMillis: Long) {
- doAnimationFrame(frameTimeMillis)
+ private var animationClockObserver: AnimationClockObserver =
+ object : AnimationClockObserver {
+ override fun onAnimationFrame(frameTimeMillis: Long) {
+ doAnimationFrame(frameTimeMillis)
+ }
}
- }
private fun defaultPhysicsBuilder(): PhysicsBuilder<T> {
return visibilityThreshold?.let {
@@ -146,12 +146,6 @@
value, velocityVector, targetValue, anim.build(typeConverter), typeConverter
)
- if (DEBUG) {
- Log.w(
- "AnimValue", "To value called: start value: $value," +
- "end value: $targetValue, velocity: $velocityVector"
- )
- }
this.>
startAnimation(animationWrapper)
}
@@ -202,13 +196,6 @@
protected open fun checkFinished(playtime: Long) {
val animationFinished = anim.isFinished(playtime)
- if (DEBUG) {
- val debugLogMessage = if (animationFinished)
- "value = $value, playtime = $playtime, animation finished"
- else
- "value = $value, playtime = $playtime, velocity: $velocityVector"
- Log.w("AnimValue", debugLogMessage)
- }
if (animationFinished) endAnimation()
}
@@ -229,9 +216,6 @@
isRunning = true
clock.subscribe(animationClockObserver)
}
- if (DEBUG) {
- Log.w("AnimValue", "start animation")
- }
}
internal fun endAnimation(endReason: AnimationEndReason = TargetReached) {
@@ -239,9 +223,6 @@
isRunning = false
startTime = Unset
lastFrameTime = Unset
- if (DEBUG) {
- Log.w("AnimValue", "end animation with reason $endReason")
- }
notifyEnded(endReason, value)
// reset velocity after notifyFinish as we might need to return it in onFinished callback
// depending on whether or not velocity was involved in the animation
@@ -412,17 +393,8 @@
}
// start from current value with the given velocity
- if (DEBUG) {
- Log.w("AnimFloat", "Calculating target. Value: $value, velocity: $startVelocity")
- }
targetValue = decay.getTarget(value, startVelocity)
val targetAnimation = adjustTarget(targetValue)
- if (DEBUG) {
- Log.w(
- "AnimFloat", "original targetValue: $targetValue, new target:" +
- " ${targetAnimation?.target}"
- )
- }
if (targetAnimation == null) {
val animWrapper = DecayAnimationWrapper(value, startVelocity, decay)
startAnimation(animWrapper)
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationBuilder.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationBuilder.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/AnimationBuilder.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationBuilder.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationClock.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationClock.kt
similarity index 68%
rename from ui/ui-animation-core/src/main/java/androidx/animation/AnimationClock.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationClock.kt
index 161f342..511dc89 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationClock.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationClock.kt
@@ -16,83 +16,17 @@
package androidx.animation
-import android.os.Handler
-import android.os.Looper
-import android.view.Choreographer
-import androidx.annotation.CallSuper
-import androidx.annotation.RestrictTo
-import org.jetbrains.annotations.TestOnly
-import java.util.concurrent.CountDownLatch
+import androidx.ui.util.annotation.CallSuper
+
+expect class DefaultAnimationClock() : BaseAnimationClock
/** @suppress */
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+@InternalAnimationApi
var rootAnimationClockFactory: () -> AnimationClockObservable = { DefaultAnimationClock() }
- @TestOnly
+ // @TestOnly
set
/**
- * Default Choreographer based clock that pushes a new frame to all subscribers on each
- * Choreographer tick, until all subscribers have unsubscribed. An instance of this clock will be
- * provided through [AnimationClockAmbient][androidx.ui.core.AnimationClockAmbient] at the root
- * of the composition tree.
- *
- * If initialized from any other thread but the main thread, part of the initialization is done
- * synchronously on the main thread. If this poses a problem, consider initializing this clock on
- * the main thread itself.
- */
-class DefaultAnimationClock : BaseAnimationClock() {
-
- private val mainChoreographer: Choreographer
-
- init {
- /**
- * If not initializing on the main thread, a message will be posted on the main thread to
- * fetch the Choreographer, and initialization blocks until that fetch is completed.
- */
- if (Looper.myLooper() == Looper.getMainLooper()) {
- mainChoreographer = Choreographer.getInstance()
- } else {
- val latch = CountDownLatch(1)
- var choreographer: Choreographer? = null
- Handler(Looper.getMainLooper()).postAtFrontOfQueue {
- try {
- choreographer = Choreographer.getInstance()
- } finally {
- latch.countDown()
- }
- }
- latch.await()
- mainChoreographer = choreographer!!
- }
- }
-
- @Volatile
- private var subscribedToChoreographer = false
-
- private val frameCallback = Choreographer.FrameCallback {
- dispatchTime(it / 1000000)
- }
-
- override fun subscribe(observer: AnimationClockObserver) {
- if (!subscribedToChoreographer) {
- mainChoreographer.postFrameCallback(frameCallback)
- subscribedToChoreographer = true
- }
- super.subscribe(observer)
- }
-
- override fun dispatchTime(frameTimeMillis: Long) {
- super.dispatchTime(frameTimeMillis)
- subscribedToChoreographer = if (hasObservers()) {
- mainChoreographer.postFrameCallback(frameCallback)
- true
- } else {
- false
- }
- }
-}
-
-/**
* A custom clock whose frame time can be manually updated via mutating [clockTimeMillis].
* Observers will be called immediately with the current time when they are subscribed. Use
* [dispatchOnSubscribe] = false to wait for the next tick instead, which can be useful if the
@@ -132,7 +66,7 @@
* Base implementation for the AnimationClockObservable that handles the subscribing and
* unsubscribing logic that would be common for all custom animation clocks.
*/
-sealed class BaseAnimationClock : AnimationClockObservable {
+abstract class BaseAnimationClock : AnimationClockObservable {
// Using LinkedHashSet to increase removal performance
private val observers: MutableSet<AnimationClockObserver> = LinkedHashSet()
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationClockObservable.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationClockObservable.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/AnimationClockObservable.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationClockObservable.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationVectors.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationVectors.kt
similarity index 96%
rename from ui/ui-animation-core/src/main/java/androidx/animation/AnimationVectors.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationVectors.kt
index 91af2ac..cb19d52 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationVectors.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationVectors.kt
@@ -16,6 +16,8 @@
package androidx.animation
+import androidx.ui.util.identityHashCode
+
/**
* [AnimationVector] class that is the base class of [AnimationVector1D], [AnimationVector2D],
* [AnimationVector3D] and [AnimationVector4D]. In order to animate any arbitrary type, it is
@@ -120,7 +122,7 @@
override fun equals(other: Any?): Boolean =
other is AnimationVector1D && other.value == value
- override fun hashCode(): Int = System.identityHashCode(this)
+ override fun hashCode(): Int = identityHashCode()
}
/**
@@ -172,7 +174,7 @@
override fun equals(other: Any?): Boolean =
other is AnimationVector2D && other.v1 == v1 && other.v2 == v2
- override fun hashCode(): Int = System.identityHashCode(this)
+ override fun hashCode(): Int = identityHashCode()
}
/**
@@ -235,7 +237,7 @@
override fun equals(other: Any?): Boolean =
other is AnimationVector3D && other.v1 == v1 && other.v2 == v2 && other.v3 == v3
- override fun hashCode(): Int = System.identityHashCode(this)
+ override fun hashCode(): Int = identityHashCode()
}
/**
@@ -310,5 +312,5 @@
other.v3 == v3 &&
other.v4 == v4
- override fun hashCode(): Int = System.identityHashCode(this)
+ override fun hashCode(): Int = identityHashCode()
}
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/AnimationWrapper.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationWrapper.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/AnimationWrapper.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/AnimationWrapper.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/ComplexDouble.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/ComplexDouble.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/ComplexDouble.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/ComplexDouble.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/DecayAnimation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/DecayAnimation.kt
similarity index 89%
rename from ui/ui-animation-core/src/main/java/androidx/animation/DecayAnimation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/DecayAnimation.kt
index 652288c..749cdfd 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/DecayAnimation.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/DecayAnimation.kt
@@ -16,7 +16,7 @@
package androidx.animation
-import androidx.annotation.FloatRange
+import androidx.ui.util.annotation.FloatRange
import kotlin.math.abs
import kotlin.math.exp
import kotlin.math.ln
@@ -89,8 +89,18 @@
* the animation will travel with the same starting condition.
*/
class ExponentialDecay(
- @FloatRange(from = 0.0, fromInclusive = false) frictionMultiplier: Float = 1f,
- @FloatRange(from = 0.0, fromInclusive = false) absVelocityThreshold: Float = 0.1f
+ @FloatRange(
+ from = 0.0,
+ // TODO(b/158069385): use POSITIVE_INFINITY constant once it's possible to do in MPP code.
+ to = 3.4e38, // POSITIVE_INFINITY,
+ fromInclusive = false
+ ) frictionMultiplier: Float = 1f,
+ @FloatRange(
+ from = 0.0,
+ // TODO(b/158069385): use POSITIVE_INFINITY constant once it's possible to do in MPP code.
+ to = 3.4e38, // POSITIVE_INFINITY,
+ fromInclusive = false
+ ) absVelocityThreshold: Float = 0.1f
) : DecayAnimation {
override val absVelocityThreshold: Float = max(0.0000001f, abs(absVelocityThreshold))
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/DynamicTargetAnimation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/DynamicTargetAnimation.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/DynamicTargetAnimation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/DynamicTargetAnimation.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/Easing.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/Easing.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/Easing.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/Easing.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/FloatAnimation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/FloatAnimation.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/FloatAnimation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/FloatAnimation.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/PropKey.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/PropKey.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/PropKey.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/PropKey.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/SpringEstimation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/SpringEstimation.kt
similarity index 97%
rename from ui/ui-animation-core/src/main/java/androidx/animation/SpringEstimation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/SpringEstimation.kt
index 2126129..99846cd 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/SpringEstimation.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/SpringEstimation.kt
@@ -16,7 +16,8 @@
package androidx.animation
-import androidx.annotation.VisibleForTesting
+import androidx.ui.util.annotation.VisibleForTesting
+
import kotlin.math.abs
import kotlin.math.exp
import kotlin.math.ln
@@ -26,7 +27,7 @@
/**
* Returns the estimated time that the spring will last be at [delta]
*/
-@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
+@VisibleForTesting(otherwise = 3 /* VisibleForTesting.PACKAGE_PRIVATE */)
fun estimateAnimationDurationMillis(
stiffness: Float,
dampingRatio: Float,
@@ -44,7 +45,7 @@
/**
* Returns the estimated time that the spring will last be at [delta]
*/
-@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
+@VisibleForTesting(otherwise = 3 /* VisibleForTesting.PACKAGE_PRIVATE */)
fun estimateAnimationDurationMillis(
stiffness: Double,
dampingRatio: Double,
@@ -67,7 +68,7 @@
/**
* Returns the estimated time that the spring will last be at [delta]
*/
-@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
+@VisibleForTesting(otherwise = 3 /* VisibleForTesting.PACKAGE_PRIVATE */)
fun estimateAnimationDurationMillis(
springConstant: Double,
dampingCoefficient: Double,
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/SpringSimulation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/SpringSimulation.kt
similarity index 81%
rename from ui/ui-animation-core/src/main/java/androidx/animation/SpringSimulation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/SpringSimulation.kt
index 39a927e..76845c4 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/SpringSimulation.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/SpringSimulation.kt
@@ -20,6 +20,11 @@
import androidx.ui.util.unpackFloat1
import androidx.ui.util.unpackFloat2
+import kotlin.math.cos
+import kotlin.math.exp
+import kotlin.math.sin
+import kotlin.math.sqrt
+
/**
* Spring Simulation simulates spring physics, and allows you to query the motion (i.e. value and
* velocity) at certain time in the future based on the starting velocity and value.
@@ -58,7 +63,7 @@
internal class SpringSimulation(var finalPosition: Float) {
// Natural frequency
- private var naturalFreq = Math.sqrt(Spring.StiffnessVeryLow.toDouble())
+ private var naturalFreq = sqrt(Spring.StiffnessVeryLow.toDouble())
// Indicates whether the spring has been initialized
private var initialized = false
@@ -76,7 +81,7 @@
if (stiffness <= 0) {
throw IllegalArgumentException("Spring stiffness constant must be positive.")
}
- naturalFreq = Math.sqrt(value.toDouble())
+ naturalFreq = sqrt(value.toDouble())
// All the intermediate values need to be recalculated.
initialized = false
}
@@ -131,12 +136,12 @@
if (dampingRatio > 1) {
// Over damping
gammaPlus =
- (-dampingRatio * naturalFreq + naturalFreq * Math.sqrt(dampingRatioSquared - 1))
+ (-dampingRatio * naturalFreq + naturalFreq * sqrt(dampingRatioSquared - 1))
gammaMinus =
- (-dampingRatio * naturalFreq - naturalFreq * Math.sqrt(dampingRatioSquared - 1))
+ (-dampingRatio * naturalFreq - naturalFreq * sqrt(dampingRatioSquared - 1))
} else if (dampingRatio >= 0 && dampingRatio < 1) {
// Under damping
- dampedFreq = naturalFreq * Math.sqrt(1 - dampingRatioSquared)
+ dampedFreq = naturalFreq * sqrt(1 - dampingRatioSquared)
}
initialized = true
@@ -161,31 +166,31 @@
(gammaMinus - gammaPlus)))
val coeffB = ((gammaMinus * adjustedDisplacement - lastVelocity) /
(gammaMinus - gammaPlus))
- displacement = (coeffA * Math.pow(Math.E, gammaMinus * deltaT) +
- coeffB * Math.pow(Math.E, gammaPlus * deltaT))
- currentVelocity = (coeffA * gammaMinus * Math.pow(Math.E, gammaMinus * deltaT) +
- coeffB * gammaPlus * Math.pow(Math.E, gammaPlus * deltaT))
+ displacement = (coeffA * exp(gammaMinus * deltaT) +
+ coeffB * exp(gammaPlus * deltaT))
+ currentVelocity = (coeffA * gammaMinus * exp(gammaMinus * deltaT) +
+ coeffB * gammaPlus * exp(gammaPlus * deltaT))
} else if (dampingRatio == 1.0f) {
// Critically damped
val coeffA = adjustedDisplacement
val coeffB = lastVelocity + naturalFreq * adjustedDisplacement
- displacement = (coeffA + coeffB * deltaT) * Math.pow(Math.E, -naturalFreq * deltaT)
+ displacement = (coeffA + coeffB * deltaT) * exp(-naturalFreq * deltaT)
currentVelocity =
- (((coeffA + coeffB * deltaT) * Math.pow(Math.E, -naturalFreq * deltaT) *
- (-naturalFreq)) + coeffB * Math.pow(Math.E, -naturalFreq * deltaT))
+ (((coeffA + coeffB * deltaT) * exp(-naturalFreq * deltaT) *
+ (-naturalFreq)) + coeffB * exp(-naturalFreq * deltaT))
} else {
// Underdamped
val cosCoeff = adjustedDisplacement
val sinCoeff =
((1 / dampedFreq) * (((dampingRatio * naturalFreq * adjustedDisplacement) +
lastVelocity)))
- displacement = (Math.pow(Math.E, -dampingRatio * naturalFreq * deltaT) *
- ((cosCoeff * Math.cos(dampedFreq * deltaT) +
- sinCoeff * Math.sin(dampedFreq * deltaT))))
- currentVelocity = (displacement * (-naturalFreq) * dampingRatio + (Math.pow(Math.E,
- - dampingRatio * naturalFreq * deltaT) * ((-dampedFreq * cosCoeff *
- Math.sin(dampedFreq * deltaT) + dampedFreq * sinCoeff *
- Math.cos(dampedFreq * deltaT)))))
+ displacement = (exp(-dampingRatio * naturalFreq * deltaT) *
+ ((cosCoeff * cos(dampedFreq * deltaT) +
+ sinCoeff * sin(dampedFreq * deltaT))))
+ currentVelocity = (displacement * (-naturalFreq) * dampingRatio + (exp(
+ -dampingRatio * naturalFreq * deltaT) * ((-dampedFreq * cosCoeff *
+ sin(dampedFreq * deltaT) + dampedFreq * sinCoeff *
+ cos(dampedFreq * deltaT)))))
}
val newValue = (displacement + finalPosition).toFloat()
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/ToolingGlue.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/ToolingGlue.kt
similarity index 87%
rename from ui/ui-animation-core/src/main/java/androidx/animation/ToolingGlue.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/ToolingGlue.kt
index acc5e99..f522ba4 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/ToolingGlue.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/ToolingGlue.kt
@@ -16,7 +16,9 @@
package androidx.animation
-import androidx.annotation.RestrictTo
+@RequiresOptIn(message = "This API is internal to library.")
+@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
+annotation class InternalAnimationApi
/**
* Seekable animation class provides utilities to create an animation using a state pair, and
@@ -24,9 +26,9 @@
* entirely stateless in terms of animation lifecycle. This design makes it easy for higher level
* stateful construct to be built on top of it.
*
- * This API is intended for tools' use only. Hence the @RestrictTo.
+ * This API is intended for tools' use only. Hence the @InternalAnimationApi.
*/
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+@InternalAnimationApi
class SeekableAnimation<T>(
val def: TransitionDefinition<T>,
fromState: T,
@@ -81,19 +83,19 @@
* Creates a [SeekableAnimation] using the same [TransitionDefinition] that the
* [TransitionAnimation] is created from.
*
- * Note: This API is intended for tools' use only. Hence the @RestrictTo.
+ * Note: This API is intended for tools' use only. Hence the @InternalAnimationApi.
*
* @param fromState The state that a [SeekableAnimation] will start from.
* @param toState The state that a [SeekableAnimation] will end in.
*/
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+@InternalAnimationApi
fun <T> TransitionAnimation<T>.createSeekableAnimation(fromState: T, toState: T) =
SeekableAnimation<T>(def, fromState, toState)
/**
* Returns the all states available in a [TransitionDefinition].
*
- * This API is intended for tools' use only. Hence the @RestrictTo.
+ * This API is intended for tools' use only. Hence the @InternalAnimationApi.
*/
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+@InternalAnimationApi
fun <T> TransitionAnimation<T>.getStates(): Set<T> = def.states.keys
\ No newline at end of file
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/TransitionAnimation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionAnimation.kt
similarity index 96%
rename from ui/ui-animation-core/src/main/java/androidx/animation/TransitionAnimation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionAnimation.kt
index f5e94c7..5d34294 100644
--- a/ui/ui-animation-core/src/main/java/androidx/animation/TransitionAnimation.kt
+++ b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionAnimation.kt
@@ -16,9 +16,7 @@
package androidx.animation
-import android.util.Log
import androidx.animation.InterruptionHandling.UNINTERRUPTIBLE
-import androidx.annotation.RestrictTo
/**
* [TransitionAnimation] is the underlying animation used in [androidx.ui.animation.Transition] for
@@ -40,6 +38,7 @@
*
* @see [androidx.ui.animation.Transition]
*/
+@OptIn(InternalAnimationApi::class)
class TransitionAnimation<T>(
internal val def: TransitionDefinition<T>,
private val clock: AnimationClockObservable,
@@ -71,10 +70,9 @@
private var startVelocityMap: MutableMap<PropKey<Any, AnimationVector>, Any> = mutableMapOf()
// Named class for animation clock observer to help with tools' reflection.
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ @InternalAnimationApi
inner class TransitionAnimationClockObserver : AnimationClockObserver {
- // This API is intended for tools' use only. Hence the @RestrictTo.
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ // This API is intended for tools' use only. Hence the @InternalAnimationApi.
val animation: TransitionAnimation<T> = this@TransitionAnimation
override fun onAnimationFrame(frameTimeMillis: Long) {
doAnimationFrame(frameTimeMillis)
@@ -128,9 +126,6 @@
fromState = AnimationState(currentState, toState.name)
toState = newState
- if (DEBUG) {
- Log.w("TransAnim", "Animating to new state: ${toState.name}")
- }
// Start animation should be called after all the setup has been done
startAnimation()
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/TransitionDefinition.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionDefinition.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/TransitionDefinition.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionDefinition.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/TransitionState.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionState.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/TransitionState.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/TransitionState.kt
diff --git a/ui/ui-animation-core/src/main/java/androidx/animation/VectorAnimation.kt b/ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/VectorAnimation.kt
similarity index 100%
rename from ui/ui-animation-core/src/main/java/androidx/animation/VectorAnimation.kt
rename to ui/ui-animation-core/src/commonMain/kotlin/androidx/animation/VectorAnimation.kt
diff --git a/ui/ui-animation-core/src/test/java/androidx/animation/ToolingGlueTest.kt b/ui/ui-animation-core/src/test/java/androidx/animation/ToolingGlueTest.kt
index 4b65ff6..d8c5010 100644
--- a/ui/ui-animation-core/src/test/java/androidx/animation/ToolingGlueTest.kt
+++ b/ui/ui-animation-core/src/test/java/androidx/animation/ToolingGlueTest.kt
@@ -24,6 +24,7 @@
import java.lang.Long.max
@RunWith(JUnit4::class)
+@OptIn(InternalAnimationApi::class)
class ToolingGlueTest {
@Test
fun testSeekableAnimation() {
diff --git a/ui/ui-core/build.gradle b/ui/ui-core/build.gradle
index 38b0ca7..c073121 100644
--- a/ui/ui-core/build.gradle
+++ b/ui/ui-core/build.gradle
@@ -86,7 +86,10 @@
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
- freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental", "-XXLanguage:+InlineClasses"]
+ freeCompilerArgs += [
+ "-Xuse-experimental=kotlin.Experimental",
+ "-XXLanguage:+InlineClasses"
+ ]
useIR = true
}
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/Ambients.kt b/ui/ui-core/src/main/java/androidx/ui/core/Ambients.kt
index a87aed6..bc7fc60 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/Ambients.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/Ambients.kt
@@ -103,6 +103,7 @@
val UriHandlerAmbient = staticAmbientOf<UriHandler>()
@Composable
+@OptIn(androidx.animation.InternalAnimationApi::class)
internal fun ProvideCommonAmbients(
owner: Owner,
uriHandler: UriHandler,
diff --git a/ui/ui-desktop/android-emu/src/desktopMain/kotlin/androidx/ui/core/R.kt b/ui/ui-desktop/android-emu/src/desktopMain/kotlin/androidx/ui/core/R.kt
index dea489c..ef23d80 100644
--- a/ui/ui-desktop/android-emu/src/desktopMain/kotlin/androidx/ui/core/R.kt
+++ b/ui/ui-desktop/android-emu/src/desktopMain/kotlin/androidx/ui/core/R.kt
@@ -85,6 +85,8 @@
val accessibility_custom_action_30 = 30
@JvmField
val accessibility_custom_action_31 = 31
+ @JvmField
+ var inspection_slot_table_set = 0
}
}
}
diff --git a/ui/ui-desktop/build.gradle b/ui/ui-desktop/build.gradle
index b59311d..7f261bc 100644
--- a/ui/ui-desktop/build.gradle
+++ b/ui/ui-desktop/build.gradle
@@ -147,11 +147,9 @@
"ui-livedata",
"ui-material",
"ui-saved-instance-state",
- "ui-test",
"ui-text",
"ui-text-android",
"ui-text-core",
- "ui-tooling",
"ui-unit",
"ui-util",
"ui-vector"
diff --git a/ui/ui-desktop/src/jvmMain/kotlin/androidx/ui/desktop/Wrapper.kt b/ui/ui-desktop/src/jvmMain/kotlin/androidx/ui/desktop/Wrapper.kt
index 57ace89..7573dae 100644
--- a/ui/ui-desktop/src/jvmMain/kotlin/androidx/ui/desktop/Wrapper.kt
+++ b/ui/ui-desktop/src/jvmMain/kotlin/androidx/ui/desktop/Wrapper.kt
@@ -33,6 +33,7 @@
import org.jetbrains.skija.Canvas
+@OptIn(androidx.animation.InternalAnimationApi::class)
fun SkiaWindow.setContent(content: @Composable () -> Unit) {
SwingUtilities.invokeLater {
val fps = 60
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/TestAnimationClock.kt b/ui/ui-test/src/main/java/androidx/ui/test/TestAnimationClock.kt
index d8fdb44..ab8373e 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/TestAnimationClock.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/TestAnimationClock.kt
@@ -121,6 +121,7 @@
return AnimationClockStatement(base)
}
+ @OptIn(androidx.animation.InternalAnimationApi::class)
private inner class AnimationClockStatement(private val base: Statement) : Statement() {
override fun evaluate() {
val oldFactory = rootAnimationClockFactory
diff --git a/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/AndroidTrace.kt b/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/AndroidTrace.kt
index f31ea68..d57b7fc 100644
--- a/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/AndroidTrace.kt
+++ b/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/AndroidTrace.kt
@@ -29,4 +29,4 @@
} finally {
Trace.endSection()
}
-}
+}
\ No newline at end of file
diff --git a/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/annotation/AndroidAnnotation.kt b/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/annotation/AndroidAnnotation.kt
index b407c4a..8c43efc8 100644
--- a/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/annotation/AndroidAnnotation.kt
+++ b/ui/ui-util/src/androidMain/kotlin/androidx/ui/util/annotation/AndroidAnnotation.kt
@@ -21,4 +21,5 @@
actual typealias IntRange = androidx.annotation.IntRange
actual typealias Size = androidx.annotation.Size
actual typealias GuardedBy = androidx.annotation.GuardedBy
-actual typealias VisibleForTesting = androidx.annotation.VisibleForTesting
\ No newline at end of file
+actual typealias VisibleForTesting = androidx.annotation.VisibleForTesting
+actual typealias CallSuper = androidx.annotation.CallSuper
diff --git a/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/MathHelpers.kt b/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/MathHelpers.kt
index 2f98750..4bd3af4 100644
--- a/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/MathHelpers.kt
+++ b/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/MathHelpers.kt
@@ -46,4 +46,4 @@
fun Int.toHexString() = "0x${toUInt().toString(16).padStart(8, '0')}"
fun Float.toRadians(): Float = this / 180f * PI.toFloat()
-fun Double.toRadians(): Double = this / 180 * PI
\ No newline at end of file
+fun Double.toRadians(): Double = this / 180 * PI
diff --git a/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/annotation/Annotation.kt b/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/annotation/Annotation.kt
index 3bee49a..d23fef5 100644
--- a/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/annotation/Annotation.kt
+++ b/ui/ui-util/src/commonMain/kotlin/androidx/ui/util/annotation/Annotation.kt
@@ -53,3 +53,7 @@
expect annotation class VisibleForTesting(
val otherwise: Int = 2
)
+
+@OptionalExpectation
+@ExperimentalMultiplatform
+expect annotation class CallSuper()
\ No newline at end of file