DisplayCutoutCompat
public
final
class
DisplayCutoutCompat
extends Object
java.lang.Object | |
↳ | androidx.core.view.DisplayCutoutCompat |
Represents the area of the display that is not functional for displaying content.
DisplayCutoutCompat
instances are immutable.
Summary
Public constructors | |
---|---|
DisplayCutoutCompat(Rect safeInsets, List<Rect> boundingRects)
Creates a DisplayCutout instance. |
|
DisplayCutoutCompat(Insets safeInsets, Rect boundLeft, Rect boundTop, Rect boundRight, Rect boundBottom, Insets waterfallInsets)
Creates a DisplayCutout instance. |
Public methods | |
---|---|
boolean
|
equals(Object o)
|
List<Rect>
|
getBoundingRects()
Returns a list of |
int
|
getSafeInsetBottom()
Returns the inset from the bottom which avoids the display cutout in pixels. |
int
|
getSafeInsetLeft()
Returns the inset from the left which avoids the display cutout in pixels. |
int
|
getSafeInsetRight()
Returns the inset from the right which avoids the display cutout in pixels. |
int
|
getSafeInsetTop()
Returns the inset from the top which avoids the display cutout in pixels. |
Insets
|
getWaterfallInsets()
Returns the insets representing the curved areas of a waterfall display. |
int
|
hashCode()
|
String
|
toString()
|
Inherited methods | |
---|---|
Public constructors
DisplayCutoutCompat
public DisplayCutoutCompat (Rect safeInsets, List<Rect> boundingRects)
Creates a DisplayCutout instance.
Parameters | |
---|---|
safeInsets |
Rect : the insets from each edge which avoid the display cutout as returned by
getSafeInsetTop() etc. |
boundingRects |
List : the bounding rects of the display cutouts as returned by
getBoundingRects() ()}.
|
DisplayCutoutCompat
public DisplayCutoutCompat (Insets safeInsets, Rect boundLeft, Rect boundTop, Rect boundRight, Rect boundBottom, Insets waterfallInsets)
Creates a DisplayCutout instance.
Parameters | |
---|---|
safeInsets |
Insets : the insets from each edge which avoid the display cutout as returned by
getSafeInsetTop() etc. |
boundLeft |
Rect : the left bounding rect of the display cutout in pixels. If null is passed,
it's treated as an empty rectangle (0,0)-(0,0). |
boundTop |
Rect : the top bounding rect of the display cutout in pixels. If null is passed,
it's treated as an empty rectangle (0,0)-(0,0). |
boundRight |
Rect : the right bounding rect of the display cutout in pixels. If null is
passed, it's treated as an empty rectangle (0,0)-(0,0). |
boundBottom |
Rect : the bottom bounding rect of the display cutout in pixels. If null is
passed, it's treated as an empty rectangle (0,0)-(0,0). |
waterfallInsets |
Insets : the insets for the curved areas in waterfall display.
|
Public methods
equals
public boolean equals (Object o)
Parameters | |
---|---|
o |
Object |
Returns | |
---|---|
boolean |
getBoundingRects
public List<Rect> getBoundingRects ()
Returns a list of Rect
s, each of which is the bounding rectangle for a non-functional
area on the display.
There will be at most one non-functional area per short edge of the device, and none on
the long edges.
Returns | |
---|---|
List<Rect> |
a list of bounding Rect s, one for each display cutout area.
|
getSafeInsetBottom
public int getSafeInsetBottom ()
Returns the inset from the bottom which avoids the display cutout in pixels.
Returns | |
---|---|
int |
getSafeInsetLeft
public int getSafeInsetLeft ()
Returns the inset from the left which avoids the display cutout in pixels.
Returns | |
---|---|
int |
getSafeInsetRight
public int getSafeInsetRight ()
Returns the inset from the right which avoids the display cutout in pixels.
Returns | |
---|---|
int |
getSafeInsetTop
public int getSafeInsetTop ()
Returns the inset from the top which avoids the display cutout in pixels.
Returns | |
---|---|
int |
getWaterfallInsets
public Insets getWaterfallInsets ()
Returns the insets representing the curved areas of a waterfall display. A waterfall display has curved areas along the edges of the screen. Apps should be careful when showing UI and handling touch input in those insets because the curve may impair legibility and can frequently lead to unintended touch inputs.
Returns | |
---|---|
Insets |
the insets for the curved areas of a waterfall display in pixels or Insets.NONE if there are no curved areas or they don't overlap with the window.
|
hashCode
public int hashCode ()
Returns | |
---|---|
int |
toString
public String toString ()
Returns | |
---|---|
String |