library / dev.chrisbanes.insetter / Insetter

Insetter

open class Insetter

A collection of utility functions to make handling android.view.WindowInsets easier.

Functions

requestApplyInsetsWhenAttached

open static fun requestApplyInsetsWhenAttached(view: View): Unit

A wrapper around ViewCompat#requestApplyInsets(View) which ensures the request will happen, regardless of whether the view is attached or not.

setOnApplyInsetsListener

open static fun setOnApplyInsetsListener(view: View, listener: OnApplyInsetsListener): Unit

A wrapper around ViewCompat#setOnApplyWindowInsetsListener(View, * OnApplyWindowInsetsListener) which stores the initial view state, and provides them whenever a android.view.WindowInsets instance is dispatched to the listener provided.

This allows the listener to be able to append inset values to any existing view state properties, rather than overwriting them.