DisplayCutout.Builder

public static final class DisplayCutout.Builder
extends Object

java.lang.Object
   ↳ 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

Builder()

Begin building a DisplayCutout.

Public methods

DisplayCutout build()

Construct a new DisplayCutout with the set parameters.

DisplayCutout.Builder setBoundingRectBottom(Rect boundingRectBottom)

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

DisplayCutout.Builder setBoundingRectLeft(Rect boundingRectLeft)

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

DisplayCutout.Builder setBoundingRectRight(Rect boundingRectRight)

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

DisplayCutout.Builder setBoundingRectTop(Rect boundingRectTop)

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

DisplayCutout.Builder setCutoutPath(Path cutoutPath)

Set the cutout Path.

DisplayCutout.Builder setSafeInsets(Insets safeInsets)

Set the safe insets.

DisplayCutout.Builder setWaterfallInsets(Insets waterfallInsets)

Set the waterfall insets of the DisplayCutout.

Inherited methods

Public constructors

Builder

Added in API level 33
public Builder ()

Begin building a DisplayCutout.

Public methods

build

Added in API level 33
public DisplayCutout build ()

Construct a new DisplayCutout with the set parameters.

Returns
DisplayCutout This value cannot be null.

setBoundingRectBottom

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

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.

Returns
DisplayCutout.Builder This value cannot be null.

setBoundingRectLeft

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

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.

Returns
DisplayCutout.Builder This value cannot be null.

setBoundingRectRight

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

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.

Returns
DisplayCutout.Builder This value cannot be null.

setBoundingRectTop

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

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.

Returns
DisplayCutout.Builder This value cannot be null.

setCutoutPath

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

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.

Returns
DisplayCutout.Builder This value cannot be null.

setSafeInsets

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

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

Parameters
safeInsets Insets: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setWaterfallInsets

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

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

Parameters
waterfallInsets Insets: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.