MaterialSharedAxis

public final class MaterialSharedAxis


A androidx.transition.Visibility transition that provides shared motion along an axis.

When configured along the X axis, this transition slides and fades in the target when appearing and slides and fades out the target when disappearing.

When configured along the Y axis, this transition slides and fades in the target when appearing and slides and fades out the target when disappearing.

When configured along the Z axis, this transition scales and fades in when the target is appearing and scales and fades out when the target is disappearing.

The direction of the slide or scale is determined by the constructors's forward property. When true, the target will slide to the left on the X axis, up on the Y axis and out in on the Z axis. When false, the target will slide to the right on the X axis, down on the Y axis and in on the Z axis. Note that this is independent of whether or not the target is appearing or disappearing.

MaterialSharedAxis supports theme-based easing and duration. The transition will load theme values from the SceneRoot's context before it runs, and only use them if the corresponding properties weren't already set on the transition instance.

Summary

Constants

static final int
X = 0

Indicates that the x-axis should be shared for the transition, meaning a horizontal slide and fade should be used.

static final int
Y = 1

Indicates that the y-axis should be shared for the transition, meaning a vertical slide and fade should be used.

static final int
Z = 2

Indicates that the z-axis should be shared for the transition, meaning a scale and fade should be used.

Public constructors

MaterialSharedAxis(int axis, boolean forward)

Public methods

void
addAdditionalAnimatorProvider(
    VisibilityAnimatorProvider additionalAnimatorProvider
)

Adds an additional VisibilityAnimatorProvider, which provides animators be played together with the primary and secondary VisibilityAnimatorProviders.

void

Clears all additional VisibilityAnimatorProviders that were previously added.

int
P

Returns the primary VisibilityAnimatorProvider for this transition, which can be modified but not swapped out completely.

VisibilityAnimatorProvider

Returns the secondary VisibilityAnimatorProvider for this transition or null, which can be modified or swapped out completely for a different VisibilityAnimatorProvider.

boolean
boolean
Animator
onAppear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)
Animator
onDisappear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)
boolean

Removes an additional VisibilityAnimatorProvider that was previously added.

void
setSecondaryAnimatorProvider(
    VisibilityAnimatorProvider secondaryAnimatorProvider
)

Sets the secondary VisibilityAnimatorProvider, which provides animators to be played together with the primary VisibilityAnimatorProvider.

Constants

X

public static final int X = 0

Indicates that the x-axis should be shared for the transition, meaning a horizontal slide and fade should be used.

In the forward direction, targets of this transition will slide left.

Y

public static final int Y = 1

Indicates that the y-axis should be shared for the transition, meaning a vertical slide and fade should be used.

In the forward direction, targets of this transition will slide up.

Z

public static final int Z = 2

Indicates that the z-axis should be shared for the transition, meaning a scale and fade should be used.

In the forward direction, targets of this transition will scale out.

Public fields

axis

public final int axis

primaryAnimatorProvider

public final P primaryAnimatorProvider

secondaryAnimatorProvider

public VisibilityAnimatorProvider secondaryAnimatorProvider

Public constructors

MaterialSharedAxis

public MaterialSharedAxis(int axis, boolean forward)

Public methods

addAdditionalAnimatorProvider

public void addAdditionalAnimatorProvider(
    VisibilityAnimatorProvider additionalAnimatorProvider
)

Adds an additional VisibilityAnimatorProvider, which provides animators be played together with the primary and secondary VisibilityAnimatorProviders.

clearAdditionalAnimatorProvider

public void clearAdditionalAnimatorProvider()

Clears all additional VisibilityAnimatorProviders that were previously added.

getAxis

public int getAxis()

getPrimaryAnimatorProvider

public P getPrimaryAnimatorProvider()

Returns the primary VisibilityAnimatorProvider for this transition, which can be modified but not swapped out completely.

getSecondaryAnimatorProvider

public VisibilityAnimatorProvider getSecondaryAnimatorProvider()

Returns the secondary VisibilityAnimatorProvider for this transition or null, which can be modified or swapped out completely for a different VisibilityAnimatorProvider.

isForward

public boolean isForward()

isSeekingSupported

public boolean isSeekingSupported()

onAppear

public Animator onAppear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)

onDisappear

public Animator onDisappear(
    ViewGroup sceneRoot,
    View view,
    TransitionValues startValues,
    TransitionValues endValues
)

removeAdditionalAnimatorProvider

public boolean removeAdditionalAnimatorProvider(
    VisibilityAnimatorProvider additionalAnimatorProvider
)

Removes an additional VisibilityAnimatorProvider that was previously added.

setSecondaryAnimatorProvider

public void setSecondaryAnimatorProvider(
    VisibilityAnimatorProvider secondaryAnimatorProvider
)

Sets the secondary VisibilityAnimatorProvider, which provides animators to be played together with the primary VisibilityAnimatorProvider.