AdaptiveSystemUiHelper

@IviExperimental(reasons = [])
class AdaptiveSystemUiHelper<T : Enum<T>>(context: Context, viewVariantSelector: (widthDp: Int, heightDp: Int) -> T, inflateFunctionProvider: (T) -> (LayoutInflater) -> ViewDataBinding, bindDataFunction: (ViewDataBinding) -> Unit)

A helper class for a system UI that adapts its view depending on the size that it's given, offering an adaptive system UI.

A 'view variant' of type T defines the different possible variations of the system UI view. For example the view could have different orientations (HORIZONTAL, VERTICAL), different sizes (SMALL, MEDIUM, LARGE), or any combination of those variations.

Parameters

T

The enum type of view variant.

context

The context of the system UI.

viewVariantSelector

Called at construction time, uses the measured display size to determine which view variant to use.

inflateFunctionProvider

Provides an inflate function based on the view variant.

bindDataFunction

A function that operates on the view data binding, for instance to set variables.

Constructors

Link copied to clipboard
fun <T : Enum<T>> AdaptiveSystemUiHelper(context: Context, viewVariantSelector: (widthDp: Int, heightDp: Int) -> T, inflateFunctionProvider: (T) -> (LayoutInflater) -> ViewDataBinding, bindDataFunction: (ViewDataBinding) -> Unit)

Properties

Link copied to clipboard

The ViewFactory that the SystemUiHost should use to create views. Can be used directly from the system UI host with: