MaterialSharedAxis

public final class MaterialSharedAxis
extends Visibility

java.lang.Object
   ↳ androidx.transition.Transition
     ↳ androidx.transition.Visibility
       ↳ com.google.android.material.transition.MaterialSharedAxis


A 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

int X

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

int Y

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

int Z

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

Inherited constants

int MODE_IN

int MODE_OUT

int MATCH_ID

int MATCH_INSTANCE

int MATCH_ITEM_ID

int MATCH_NAME

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 clearAdditionalAnimatorProvider()

Clears all additional VisibilityAnimatorProviders that were previously added.

int getAxis()
P extends VisibilityAnimatorProvider getPrimaryAnimatorProvider()

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

VisibilityAnimatorProvider getSecondaryAnimatorProvider()

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

boolean isForward()
boolean isSeekingSupported()
Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues)
Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues)
boolean removeAdditionalAnimatorProvider(VisibilityAnimatorProvider additionalAnimatorProvider)

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.

Inherited methods

void captureEndValues(TransitionValues arg0)
void captureStartValues(TransitionValues arg0)
Animator createAnimator(ViewGroup arg0, TransitionValues arg1, TransitionValues arg2)
int getMode()
String[] getTransitionProperties()
boolean isTransitionRequired(TransitionValues arg0, TransitionValues arg1)
boolean isVisible(TransitionValues arg0)
Animator onAppear(ViewGroup arg0, View arg1, TransitionValues arg2, TransitionValues arg3)
Animator onAppear(ViewGroup arg0, TransitionValues arg1, int arg2, TransitionValues arg3, int arg4)
Animator onDisappear(ViewGroup arg0, TransitionValues arg1, int arg2, TransitionValues arg3, int arg4)
Animator onDisappear(ViewGroup arg0, View arg1, TransitionValues arg2, TransitionValues arg3)
void setMode(int arg0)
Transition addListener(Transition.TransitionListener arg0)
Transition addTarget(String arg0)
Transition addTarget(View arg0)
Transition addTarget(int arg0)
Transition addTarget(Class<?> arg0)
void animate(Animator arg0)
void cancel()
abstract void captureEndValues(TransitionValues arg0)
abstract void captureStartValues(TransitionValues arg0)
Object clone()
Animator createAnimator(ViewGroup arg0, TransitionValues arg1, TransitionValues arg2)
void end()
Transition excludeChildren(int arg0, boolean arg1)
Transition excludeChildren(Class<?> arg0, boolean arg1)
Transition excludeChildren(View arg0, boolean arg1)
Transition excludeTarget(int arg0, boolean arg1)
Transition excludeTarget(View arg0, boolean arg1)
Transition excludeTarget(Class<?> arg0, boolean arg1)
Transition excludeTarget(String arg0, boolean arg1)
long getDuration()
Rect getEpicenter()
Transition.EpicenterCallback getEpicenterCallback()
TimeInterpolator getInterpolator()
String getName()
PathMotion getPathMotion()
TransitionPropagation getPropagation()
final Transition getRootTransition()
long getStartDelay()
List<Integer> getTargetIds()
List<String> getTargetNames()
List<Class<?>> getTargetTypes()
List<View> getTargets()
String[] getTransitionProperties()
TransitionValues getTransitionValues(View arg0, boolean arg1)
boolean isSeekingSupported()
boolean isTransitionRequired(TransitionValues arg0, TransitionValues arg1)
void pause(View arg0)
Transition removeListener(Transition.TransitionListener arg0)
Transition removeTarget(View arg0)
Transition removeTarget(String arg0)
Transition removeTarget(Class<?> arg0)
Transition removeTarget(int arg0)
void resume(View arg0)
void runAnimators()
Transition setDuration(long arg0)
void setEpicenterCallback(Transition.EpicenterCallback arg0)
Transition setInterpolator(TimeInterpolator arg0)
void setMatchOrder(int... arg0)
void setPathMotion(PathMotion arg0)
void setPropagation(TransitionPropagation arg0)
Transition setStartDelay(long arg0)
void start()
String toString()
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait(long arg0, int arg1)
final void wait(long arg0)
final void wait()

Constants

X

public static final int X

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.

Constant Value: 0 (0x00000000)

Y

public static final int Y

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.

Constant Value: 1 (0x00000001)

Z

public static final int Z

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.

Constant Value: 2 (0x00000002)

Public constructors

MaterialSharedAxis

public MaterialSharedAxis (int axis, 
                boolean forward)

Parameters
axis int

forward boolean

Public methods

addAdditionalAnimatorProvider

public void addAdditionalAnimatorProvider (VisibilityAnimatorProvider additionalAnimatorProvider)

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

Parameters
additionalAnimatorProvider VisibilityAnimatorProvider

clearAdditionalAnimatorProvider

public void clearAdditionalAnimatorProvider ()

Clears all additional VisibilityAnimatorProviders that were previously added.

getAxis

public int getAxis ()

Returns
int

getPrimaryAnimatorProvider

public P extends VisibilityAnimatorProvider getPrimaryAnimatorProvider ()

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

Returns
P extends VisibilityAnimatorProvider

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 ()

Returns
boolean

isSeekingSupported

public boolean isSeekingSupported ()

Returns
boolean

onAppear

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

Parameters
sceneRoot ViewGroup

view View

startValues TransitionValues

endValues TransitionValues

Returns
Animator

onDisappear

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

Parameters
sceneRoot ViewGroup

view View

startValues TransitionValues

endValues TransitionValues

Returns
Animator

removeAdditionalAnimatorProvider

public boolean removeAdditionalAnimatorProvider (VisibilityAnimatorProvider additionalAnimatorProvider)

Removes an additional VisibilityAnimatorProvider that was previously added.

Parameters
additionalAnimatorProvider VisibilityAnimatorProvider

Returns
boolean

setSecondaryAnimatorProvider

public void setSecondaryAnimatorProvider (VisibilityAnimatorProvider secondaryAnimatorProvider)

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

Parameters
secondaryAnimatorProvider VisibilityAnimatorProvider