public sealed interface WindowInsetsRulers
Contains rulers used for window insets. The current values are available as well as values when the insets are fully visible.
Other animation properties can be retrieved with getAnimation.
Properties
current
public val current: RectRulers
The current values for the window insets RectRulers. Values for some insets may not be provided on platforms that don't support specific Window Insets types. These also may not be provided if no WindowInsetsRulers encroach on the content.
maximum
public val maximum: RectRulers
The values for the insets when the insets are fully visible. The value does not change when the insets are hidden. Values for some insets may not be provided on some platforms. For example, values are never provided for Ime on Android. These may not be provided if no WindowInsetsRulers encroach on the content.
When no animations are active, maximum and current will have the same value if WindowInsetsAnimation.isVisible is true. If false, then maximum will not be changed, while current will have values the same as the Window borders. For example, when a status bar is visible, its height may be intrude 100 pixels into the Window and maximum's top will be at 100 pixels for StatusBars. When the status bar is invisible, maximum will have the same top value at 100 pixels, while current's top will be at 0 pixels.
Functions
getAnimation
public fun getAnimation(scope: Placeable.PlacementScope): WindowInsetsAnimation
Additional properties related to animating this WindowInsetsRulers.
Members
Companion
public companion object
Properties
CaptionBar
public val CaptionBar: WindowInsetsRulers = WindowInsetsRulersImpl("caption bar")
Rulers used for caption bar insets.
See WindowInsetsCompat.Type.captionBar)
DisplayCutout
public val DisplayCutout: WindowInsetsRulers = WindowInsetsRulersImpl("display cutout")
Rulers used for display cutout insets.
This is the safe insets that avoid all display cutouts. To get the bounds of the display cutouts themselves, use Placeable.PlacementScope.getDisplayCutoutBounds.
See WindowInsetsCompat.Type.displayCutout)
Ime
public val Ime: WindowInsetsRulers = WindowInsetsRulersImpl("ime")
Rulers used for IME insets.
See WindowInsetsCompat.Type.ime)
MandatorySystemGestures
public val MandatorySystemGestures: WindowInsetsRulers =
WindowInsetsRulersImpl("mandatory system gestures")
Rulers used for mandatory system gestures insets.
See WindowInsetsCompat.Type.mandatorySystemGestures)
NavigationBars
public val NavigationBars: WindowInsetsRulers = WindowInsetsRulersImpl("navigation bars")
Rulers used for navigation bars insets.
See WindowInsetsCompat.Type.navigationBars)
StatusBars
public val StatusBars: WindowInsetsRulers = WindowInsetsRulersImpl("status bars")
Rulers used for status bars insets.
See WindowInsetsCompat.Type.statusBars)
SystemBars
public val SystemBars: WindowInsetsRulers =
InnermostInsetsRulers("system bars", arrayOf(StatusBars, NavigationBars, CaptionBar))
Rulers used for system bars insets, including StatusBars, NavigationBars, and CaptionBar.
See WindowInsetsCompat.Type.systemBars)
SystemGestures
public val SystemGestures: WindowInsetsRulers = WindowInsetsRulersImpl("system gestures")
Rulers used for system gestures insets.
See WindowInsetsCompat.Type.systemGestures)
TappableElement
public val TappableElement: WindowInsetsRulers = WindowInsetsRulersImpl("tappable element")
Rulers used for tappable elements insets.
See WindowInsetsCompat.Type.tappableElement)
Waterfall
public val Waterfall: WindowInsetsRulers = WindowInsetsRulersImpl("waterfall")
Rulers used for waterfall insets.
See DisplayCutoutCompat.getWaterfallInsets)
SafeDrawing
public val SafeDrawing: WindowInsetsRulers =
InnermostInsetsRulers(
"safe drawing",
arrayOf(StatusBars, NavigationBars, CaptionBar, DisplayCutout, Ime, TappableElement),
)
Rulers used for insets including system bars, IME, and the display cutout.
SafeGestures
public val SafeGestures: WindowInsetsRulers =
InnermostInsetsRulers(
"safe gestures",
arrayOf(MandatorySystemGestures, SystemGestures, TappableElement, Waterfall),
)
Rulers used for insets that include places where gestures could conflict. This includes MandatorySystemGestures, SystemGestures, TappableElement, and Waterfall.
SafeContent
public val SafeContent: WindowInsetsRulers =
InnermostInsetsRulers(
"safe content",
arrayOf(
StatusBars,
NavigationBars,
CaptionBar,
Ime,
SystemGestures,
MandatorySystemGestures,
TappableElement,
DisplayCutout,
Waterfall,
),
)
Rulers used for insets that are safe for any content. This includes SafeGestures and SafeDrawing.
Functions
innermostOf
public fun innermostOf(vararg windowInsetsRulers: WindowInsetsRulers): WindowInsetsRulers
Merges the rulers in windowInsetsRulers, providing the innermost values from current and maximum. getAnimation will return values with only WindowInsetsAnimation.isVisible and WindowInsetsAnimation.isAnimating set to meaningful values.