WindowInsetsAnimationCompat
class WindowInsetsAnimationCompat
kotlin.Any | |
↳ | androidx.core.view.WindowInsetsAnimationCompat |
Class representing an animation of a set of windows that cause insets.
Summary
Nested classes | |
---|---|
Class representing the range of an |
|
abstract |
Interface that allows the application to listen to animation events for windows that cause insets. |
Public constructors | |
---|---|
<init>(typeMask: Int, @Nullable interpolator: Interpolator?, durationMillis: Long) Creates a new |
Public methods | |
---|---|
Float |
getAlpha() Retrieves the translucency of the windows that are animating. |
Long | |
Float |
Returns the raw fractional progress of this animation between start state of the animation and the end state of the animation. |
Float |
Returns the interpolated fractional progress of this animation between start state of the animation and the end state of the animation. |
Interpolator? |
Retrieves the interpolator used for this animation, or |
Int | |
Unit |
Sets the translucency of the windows that are animating. |
Unit |
setFraction(@FloatRange(0.0, 1.0) fraction: Float) Set fraction of the progress if |
Public constructors
<init>
WindowInsetsAnimationCompat(
typeMask: Int,
@Nullable interpolator: Interpolator?,
durationMillis: Long)
Creates a new WindowInsetsAnimationCompat
object.
This should only be used for testing, as usually the system creates this object for the application to listen to with WindowInsetsAnimationCompat.Callback
.
Parameters | |
---|---|
typeMask |
Int: The bitmask of WindowInsetsCompat.Type s that are animating. |
interpolator |
Interpolator?: The interpolator of the animation. |
durationMillis |
Long: The duration of the animation in java.util.concurrent.TimeUnit#MILLISECONDS . |
Public methods
getAlpha
@FloatRange(0.0, 1.0) fun getAlpha(): Float
Retrieves the translucency of the windows that are animating.
Return | |
---|---|
Float |
Alpha of windows that cause insets of type Type . |
getDurationMillis
fun getDurationMillis(): Long
Return | |
---|---|
Long |
duration of animation in java.util.concurrent.TimeUnit#MILLISECONDS , or -1 if the animation doesn't have a fixed duration. |
getFraction
@FloatRange(0.0, 1.0) fun getFraction(): Float
Returns the raw fractional progress of this animation between start state of the animation and the end state of the animation. Note that this progress is the global progress of the animation, whereas WindowInsetsAnimationCompat.Callback#onProgress
will only dispatch the insets that may be inset with WindowInsetsCompat#inset by parents of views in the hierarchy. Progress per insets animation is global for the entire animation. One animation animates all things together (in, out, ...). If they don't animate together, we'd have multiple animations.
Note: In case the application is controlling the animation, the valued returned here will be the same as the application passed into WindowInsetsAnimationControllerCompat#setInsetsAndAlpha( * androidx.core.graphics.Insets, float, float)
.
Return | |
---|---|
Float |
The current progress of this animation. |
getInterpolatedFraction
fun getInterpolatedFraction(): Float
Returns the interpolated fractional progress of this animation between start state of the animation and the end state of the animation. Note that this progress is the global progress of the animation, whereas WindowInsetsAnimationCompat.Callback#onProgress
will only dispatch the insets that may be inset with WindowInsetsCompat#inset by parents of views in the hierarchy. Progress per insets animation is global for the entire animation. One animation animates all things together (in, out, ...). If they don't animate together, we'd have multiple animations.
Note: In case the application is controlling the animation, the valued returned here will be the same as the application passed into WindowInsetsAnimationControllerCompat#setInsetsAndAlpha(Insets, float, float)
, interpolated with the interpolator passed into WindowInsetsControllerCompat#controlWindowInsetsAnimation
.
Note: For system-initiated animations, this will always return a valid value between 0 and 1.
Return | |
---|---|
Float |
The current interpolated progress of this animation. |
See Also
getInterpolator
@Nullable fun getInterpolator(): Interpolator?
Retrieves the interpolator used for this animation, or null
if this animation doesn't follow an interpolation curved. For system-initiated animations, this will never return null
.
Return | |
---|---|
Interpolator? |
The interpolator used for this animation. |
setAlpha
fun setAlpha(@FloatRange(0.0, 1.0) alpha: Float): Unit
Sets the translucency of the windows that are animating.
Note: This should only be used for testing, as the system fills in the alpha for the application or the alpha that was passed into WindowInsetsAnimationControllerCompat#setInsetsAndAlpha(Insets, float, float)
is being used.
Parameters | |
---|---|
alpha |
Float: Alpha of windows that cause insets of type Type . |
See Also