Package com.tomtom.tools.android.core.animation

Types

Link copied to clipboard
typealias AnimationEndListener = () -> Unit
Link copied to clipboard
class InstantAnimation : Animation

An empty animation that instantly completes. Useful for replacing dynamic animations with when an animation should conditionally be instant.

Link copied to clipboard
class LifecycleAwareAnimationController(lifecycleOwner: LifecycleOwner)

A utility for keeping animations within the scope of a given lifecycleOwner.

Link copied to clipboard
class LongEvaluator : TypeEvaluator<Long>

A TypeEvaluator for Long values.

Link copied to clipboard
data class TimeTransition(startFraction: Double, endFraction: Double, startTimeMs: Long, endTimeMs: Long)

Contains the time transition information from a start to an end point. This class helps to use the ValueAnimator for animations, see property animation system for more details.

Functions

Link copied to clipboard
fun View.animateVisibility(newVisibility: Int?, enterAnimation: Animation?, exitAnimation: Animation?)

Starts animations based on the View visibility (newVisibility).

Link copied to clipboard
fun View.animateVisibleIf(condition: Boolean?, enterAnimation: Animation?, exitAnimation: Animation?)

Starts animations based on the View visibility. The visibility is based on whether the condition is satisfied.

Link copied to clipboard
fun View.animateVisibleIfNot(condition: Boolean?, enterAnimation: Animation?, exitAnimation: Animation?)

Starts animations based on the View visibility. The visibility is based on whether the condition is satisfied.

Link copied to clipboard
fun View.animateVisibleIfNotNull(instance: Any?, enterAnimation: Animation?, exitAnimation: Animation?)

Starts animations based on the View visibility. The visibility is based on whether the instance is null.

Link copied to clipboard
fun View.animateVisibleIfNull(instance: Any?, enterAnimation: Animation?, exitAnimation: Animation?)

Starts animations based on the View visibility. The visibility is based on whether the instance is null.

Link copied to clipboard
fun areAnimationsInstant(context: Context): Boolean

Whether or not the animation scale on the system is set to 0 to make animations instant. This will typically return true during test runs.

Link copied to clipboard
fun ViewGroup.enableAnimateLayoutChanges(enable: Boolean?)

Enables or disables Android's default LayoutTransition to a ViewGroup.

Link copied to clipboard
fun AnimatorSet.playTogether(vararg animatorValues: Pair<Int, Int>, updateListener: (List<Int>) -> Unit)

A helper function to create ValueAnimators for multiple transitions between Int values, play them together, and emit callbacks for each batch of updates. This assumes that this has a duration specified such that all ValueAnimators run for the same amount of time.

fun <T> AnimatorSet.playTogether(animators: Collection<ValueAnimator>, updateListener: (List<T>) -> Unit)

A helper function to play multiple ValueAnimators together and emit callbacks for each batch of updates. This assumes that this has a duration specified such that all ValueAnimators run for the same amount of time, and that all ValueAnimators animate the same type, namely T.

Link copied to clipboard
fun ValueAnimator.update(timeTransition: TimeTransition, vararg values: Any)
fun ValueAnimator.update(timeTransition: TimeTransition, vararg values: Float)
fun ValueAnimator.update(timeTransition: TimeTransition, vararg values: Int)