Package 

Class DisplayCutoutCompat


  • 
    public final class DisplayCutoutCompat
    
                        

    Represents the area of the display that is not functional for displaying content.

    {@code DisplayCutoutCompat} instances are immutable.

    • Method Summary

      Modifier and Type Method Description
      int getSafeInsetTop() Returns the inset from the top which avoids the display cutout in pixels.
      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.
      List<Rect> getBoundingRects() Returns a list of {@code Rect}s, each of which is the bounding rectangle for a non-functionalarea on the display.There will be at most one non-functional area per short edge of the device, and none onthe long edges.
      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.
      boolean equals(Object o)
      int hashCode()
      String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DisplayCutoutCompat

        DisplayCutoutCompat(Rect safeInsets, List<Rect> boundingRects)
        Creates a DisplayCutout instance.
        Parameters:
        safeInsets - the insets from each edge which avoid the display cutout as returned bygetSafeInsetTop etc.
        boundingRects - the bounding rects of the display cutouts as returned bygetBoundingRects ()}.
      • DisplayCutoutCompat

        DisplayCutoutCompat(Insets safeInsets, Rect boundLeft, Rect boundTop, Rect boundRight, Rect boundBottom, Insets waterfallInsets)
        Creates a DisplayCutout instance.
        Parameters:
        safeInsets - the insets from each edge which avoid the display cutout as returned bygetSafeInsetTop etc.
        boundLeft - the left bounding rect of the display cutout in pixels.
        boundTop - the top bounding rect of the display cutout in pixels.
        boundRight - the right bounding rect of the display cutout in pixels.
        boundBottom - the bottom bounding rect of the display cutout in pixels.
        waterfallInsets - the insets for the curved areas in waterfall display.
    • Method Detail

      • getSafeInsetTop

         int getSafeInsetTop()

        Returns the inset from the top which avoids the display cutout in pixels.

      • getSafeInsetBottom

         int getSafeInsetBottom()

        Returns the inset from the bottom which avoids the display cutout in pixels.

      • getSafeInsetLeft

         int getSafeInsetLeft()

        Returns the inset from the left which avoids the display cutout in pixels.

      • getSafeInsetRight

         int getSafeInsetRight()

        Returns the inset from the right which avoids the display cutout in pixels.

      • getBoundingRects

        @NonNull() List<Rect> getBoundingRects()

        Returns a list of {@code Rect}s, each of which is the bounding rectangle for a non-functionalarea on the display.There will be at most one non-functional area per short edge of the device, and none onthe long edges.

      • getWaterfallInsets

        @NonNull() 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 carefulwhen showing UI and handling touch input in those insets because the curve may impairlegibility and can frequently lead to unintended touch inputs.