MaterialContainerTransformSharedElementCallback

public class MaterialContainerTransformSharedElementCallback


A SharedElementCallback to be used for MaterialContainerTransform transitions.

Summary

Nested types

Allows providing a ShapeAppearanceModel for the shared element view.

A ShapeProvider that provides the view's ShapeAppearanceModel if the view implements the Shapeable interface.

Public methods

MaterialContainerTransformSharedElementCallback.ShapeProvider

Get the ShapeProvider for this callback, or null if it is not set.

boolean

Returns whether incoming Activity's sharedElementReenterTransition will be respected.

boolean

Returns whether the incoming window's background should be made transparent during the transition.

Parcelable
onCaptureSharedElementSnapshot(
    View sharedElement,
    Matrix viewToGlobalMatrix,
    RectF screenBounds
)
View
onCreateSnapshotView(Context context, Parcelable snapshot)
void
onMapSharedElements(
    List<String> names,
    Map<String, View> sharedElements
)
void
onSharedElementEnd(
    List<String> sharedElementNames,
    List<View> sharedElements,
    List<View> sharedElementSnapshots
)
void
onSharedElementStart(
    List<String> sharedElementNames,
    List<View> sharedElements,
    List<View> sharedElementSnapshots
)
void

Set the ShapeProvider for this callback, which allows providing a for the shared element view.

void
setSharedElementReenterTransitionEnabled(
    boolean sharedElementReenterTransitionEnabled
)

If enabled, the Activity's sharedElementReenterTransition will be respected; otherwise it will be set to null.

void
setTransparentWindowBackgroundEnabled(
    boolean transparentWindowBackgroundEnabled
)

If enabled, the incoming window's background will be made transparent during the transition.

Public constructors

MaterialContainerTransformSharedElementCallback

public MaterialContainerTransformSharedElementCallback()

Public methods

getShapeProvider

public MaterialContainerTransformSharedElementCallback.ShapeProvider getShapeProvider()

Get the ShapeProvider for this callback, or null if it is not set.

isSharedElementReenterTransitionEnabled

public boolean isSharedElementReenterTransitionEnabled()

Returns whether incoming Activity's sharedElementReenterTransition will be respected.

isTransparentWindowBackgroundEnabled

public boolean isTransparentWindowBackgroundEnabled()

Returns whether the incoming window's background should be made transparent during the transition.

onCaptureSharedElementSnapshot

public Parcelable onCaptureSharedElementSnapshot(
    View sharedElement,
    Matrix viewToGlobalMatrix,
    RectF screenBounds
)

onCreateSnapshotView

public View onCreateSnapshotView(Context context, Parcelable snapshot)

onMapSharedElements

public void onMapSharedElements(
    List<String> names,
    Map<String, View> sharedElements
)

onSharedElementEnd

public void onSharedElementEnd(
    List<String> sharedElementNames,
    List<View> sharedElements,
    List<View> sharedElementSnapshots
)

onSharedElementStart

public void onSharedElementStart(
    List<String> sharedElementNames,
    List<View> sharedElements,
    List<View> sharedElementSnapshots
)

setShapeProvider

public void setShapeProvider(
    MaterialContainerTransformSharedElementCallback.ShapeProvider shapeProvider
)

Set the ShapeProvider for this callback, which allows providing a for the shared element view.

The default is a ShapeableViewShapeProvider, which will use the view's if the view implements the Shapeable interface.

setSharedElementReenterTransitionEnabled

public void setSharedElementReenterTransitionEnabled(
    boolean sharedElementReenterTransitionEnabled
)

If enabled, the Activity's sharedElementReenterTransition will be respected; otherwise it will be set to null. Default is false, meaning the sharedElementReenterTransition will be set to null.

setTransparentWindowBackgroundEnabled

public void setTransparentWindowBackgroundEnabled(
    boolean transparentWindowBackgroundEnabled
)

If enabled, the incoming window's background will be made transparent during the transition. This results in an effect where the outgoing activity's content is visible for the duration of the transition, because the incoming window background will not be faded in on top of it. Default is true.

Note: in order to avoid some visual artifacts, when this setting is enabled the window's transition background fade duration (see setTransitionBackgroundFadeDuration) will be overridden to be greater than the duration of the transform transition.