Added in API level 33

Builder

class Builder
kotlin.Any
   ↳ android.view.DisplayCutout.Builder

A Builder class to construct a DisplayCutout instance.

Note that this is only for tests purpose. For production code, developers should always use a DisplayCutout obtained from the system.

Summary

Public constructors

Begin building a DisplayCutout.

Public methods
DisplayCutout

Construct a new DisplayCutout with the set parameters.

DisplayCutout.Builder
setBoundingRectBottom(boundingRectBottom: Rect)

Set a bounding rectangle for a non-functional area on the display which is located on the bottom of the screen.

DisplayCutout.Builder
setBoundingRectLeft(boundingRectLeft: Rect)

Set a bounding rectangle for a non-functional area on the display which is located on the left of the screen.

DisplayCutout.Builder
setBoundingRectRight(boundingRectRight: Rect)

Set a bounding rectangle for a non-functional area on the display which is located on the right of the screen.

DisplayCutout.Builder
setBoundingRectTop(boundingRectTop: Rect)

Set a bounding rectangle for a non-functional area on the display which is located on the top of the screen.

DisplayCutout.Builder
setCutoutPath(cutoutPath: Path)

Set the cutout Path.

DisplayCutout.Builder
setSafeInsets(safeInsets: Insets)

Set the safe insets.

DisplayCutout.Builder
setWaterfallInsets(waterfallInsets: Insets)

Set the waterfall insets of the DisplayCutout.

Public constructors

Builder

Added in API level 33
Builder()

Begin building a DisplayCutout.

Public methods

build

Added in API level 33
fun build(): DisplayCutout

Construct a new DisplayCutout with the set parameters.

Return
DisplayCutout This value cannot be null.

setBoundingRectBottom

Added in API level 33
fun setBoundingRectBottom(boundingRectBottom: Rect): DisplayCutout.Builder

Set a bounding rectangle for a non-functional area on the display which is located on the bottom of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectBottom Rect: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.

setBoundingRectLeft

Added in API level 33
fun setBoundingRectLeft(boundingRectLeft: Rect): DisplayCutout.Builder

Set a bounding rectangle for a non-functional area on the display which is located on the left of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectLeft Rect: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.

setBoundingRectRight

Added in API level 33
fun setBoundingRectRight(boundingRectRight: Rect): DisplayCutout.Builder

Set a bounding rectangle for a non-functional area on the display which is located on the right of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectRight Rect: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.

setBoundingRectTop

Added in API level 33
fun setBoundingRectTop(boundingRectTop: Rect): DisplayCutout.Builder

Set a bounding rectangle for a non-functional area on the display which is located on the top of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectTop Rect: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.

setCutoutPath

Added in API level 33
fun setCutoutPath(cutoutPath: Path): DisplayCutout.Builder

Set the cutout Path. Note that not support creating/testing multiple display cutouts with setCutoutPath() in parallel.

Parameters
cutoutPath Path: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.

setSafeInsets

Added in API level 33
fun setSafeInsets(safeInsets: Insets): DisplayCutout.Builder

Set the safe insets. If not set, the default value is Insets#NONE.

Parameters
safeInsets Insets: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.

setWaterfallInsets

Added in API level 33
fun setWaterfallInsets(waterfallInsets: Insets): DisplayCutout.Builder

Set the waterfall insets of the DisplayCutout. If not set, the default value is Insets#NONE

Parameters
waterfallInsets Insets: This value cannot be null.
Return
DisplayCutout.Builder This value cannot be null.