# FoldingFeature

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/layout/FoldingFeature.kt+class:androidx.window.layout.FoldingFeature) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

*** ** * ** ***


```
public interface FoldingFeature extends DisplayFeature
```

<br />

*** ** * ** ***

A feature that describes a fold in the flexible display or a hinge between two physical display panels.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType` Represents how the hinge might occlude content. |
| `public final class https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation` Represents the axis for which the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` runs parallel to. |
| `public final class https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` Represents the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` of the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature`. |

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature#getOcclusionType()()` Calculates the occlusion mode to determine if a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` occludes a part of the window. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature#getOrientation()()` Returns `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` if the width is greater than the height, `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#VERTICAL()` otherwise. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature#getState()()` Returns the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` for the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` |
| `abstract boolean` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature#isSeparating()()` Calculates if a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` should be thought of as splitting the window into multiple physical areas that can be seen by users as logically separate. |

| ### Inherited methods |
|---|
| From [androidx.window.layout.DisplayFeature](https://developer.android.com/reference/androidx/window/layout/DisplayFeature) |---|---| | `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/androidx/window/layout/DisplayFeature#getBounds()()` The bounding rectangle of the feature within the application window in the window coordinate space. | |

## Public methods

### getOcclusionType

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

```
abstract @NonNull FoldingFeature.OcclusionType getOcclusionType()
```

Calculates the occlusion mode to determine if a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` occludes a part of the window. This flag is useful for determining if UI elements need to be moved around so that the user can access them. For some devices occluded elements can not be accessed by the user at all.

For occlusion type `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType#NONE()` the feature can be treated as a guideline. One example would be for a continuously folding screen. For occlusion type `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType#FULL()` the feature should be avoided completely since content will not be visible or touchable, like a hinge device with two displays.

The occlusion mode is useful to determine if the UI needs to adapt to the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature`. For example, full screen games should consider avoiding anything in the occluded region if it negatively affects the gameplay. The user can not tap on the occluded interactive UI elements nor can they see important information.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType#NONE()` if the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` has empty bounds. |

### getOrientation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

```
abstract @NonNull FoldingFeature.Orientation getOrientation()
```

Returns `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` if the width is greater than the height, `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#VERTICAL()` otherwise.

### getState

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

```
abstract @NonNull FoldingFeature.State getState()
```

Returns the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` for the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature`

### isSeparating

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

```
abstract boolean isSeparating()
```

Calculates if a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` should be thought of as splitting the window into multiple physical areas that can be seen by users as logically separate. Display panels connected by a hinge are always separated. Folds on flexible screens should be treated as separating when they are not `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State#FLAT()`.

Apps may use this to determine if content should lay out around the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature`. Developers should consider the placement of interactive elements. Similar to the case of `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.OcclusionType#FULL()`, when a feature is separating then consider laying out the controls around the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature`.

An example use case is to determine if the UI should be split into two logical areas. A media app where there is some auxiliary content, such as comments or description of a video, may need to adapt the layout. The media can be put on one side of the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature` and the auxiliary content can be placed on the other side.

| Returns |
|---|---|
| `boolean` | `true` if the feature splits the display into two areas, `false` otherwise. |