# MaterialContainerTransformSharedElementCallback

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.java)

*** ** * ** ***


```
public class MaterialContainerTransformSharedElementCallback
```

<br />

*** ** * ** ***

A SharedElementCallback to be used for `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransform` transitions.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` Allows providing a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` for the shared element view. |
| `public class https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeableViewShapeProvider implements https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` A `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` that provides the view's `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` if the view implements the `https://developer.android.com/reference/com/google/android/material/shape/Shapeable` interface. |

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#shapeProvider()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#MaterialContainerTransformSharedElementCallback()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#getShapeProvider()()` Get the `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` for this callback, or null if it is not set. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#isSharedElementReenterTransitionEnabled()()` Returns whether incoming Activity's sharedElementReenterTransition will be respected. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#isTransparentWindowBackgroundEnabled()()` Returns whether the incoming window's background should be made transparent during the transition. |
| `Parcelable` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#onCaptureSharedElementSnapshot(View,Matrix,RectF)( View sharedElement, Matrix viewToGlobalMatrix, RectF screenBounds )` |
| `View` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#onCreateSnapshotView(Context,Parcelable)(Context context, Parcelable snapshot)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#onMapSharedElements(java.util.List<java.lang.String>,java.util.Map<java.lang.String,View>)( https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> names, https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, View> sharedElements )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#onSharedElementEnd(java.util.List<java.lang.String>,java.util.List<View>,java.util.List<View>)( https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> sharedElementNames, https://developer.android.com/reference/java/util/List<View> sharedElements, https://developer.android.com/reference/java/util/List<View> sharedElementSnapshots )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#onSharedElementStart(java.util.List<java.lang.String>,java.util.List<View>,java.util.List<View>)( https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> sharedElementNames, https://developer.android.com/reference/java/util/List<View> sharedElements, https://developer.android.com/reference/java/util/List<View> sharedElementSnapshots )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#setShapeProvider(com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback.ShapeProvider)( https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider shapeProvider )` Set the `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` for this callback, which allows providing a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` for the shared element view. |
| `void` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#setSharedElementReenterTransitionEnabled(boolean)( boolean sharedElementReenterTransitionEnabled )` If enabled, the Activity's sharedElementReenterTransition will be respected; otherwise it will be set to null. |
| `void` | `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#setTransparentWindowBackgroundEnabled(boolean)( boolean transparentWindowBackgroundEnabled )` If enabled, the incoming window's background will be made transparent during the transition. |

## Public fields

### shapeProvider

```
public MaterialContainerTransformSharedElementCallback.ShapeProvider shapeProvider
```

## Public constructors

### MaterialContainerTransformSharedElementCallback

```
public MaterialContainerTransformSharedElementCallback()
```

## Public methods

### getShapeProvider

```
public MaterialContainerTransformSharedElementCallback.ShapeProvider getShapeProvider()
```

Get the `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` for this callback, or null if it is not set.

### isSharedElementReenterTransitionEnabled

```
public boolean isSharedElementReenterTransitionEnabled()
```

Returns whether incoming Activity's sharedElementReenterTransition will be respected.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#setSharedElementReenterTransitionEnabled(boolean)` |   |

### isTransparentWindowBackgroundEnabled

```
public boolean isTransparentWindowBackgroundEnabled()
```

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback#setTransparentWindowBackgroundEnabled(boolean)` |   |

### 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 `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeProvider` for this callback, which allows providing a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` for the shared element view.

The default is a `https://developer.android.com/reference/com/google/android/material/transition/platform/MaterialContainerTransformSharedElementCallback.ShapeableViewShapeProvider`, which will use the view's `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` if the view implements the `https://developer.android.com/reference/com/google/android/material/shape/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.