<commit_before># View DSL Design

The documentation of this split has not been written yet, but feel free to
take a look at the source code to see what it's all about.<commit_msg>Write View DSL Design README<commit_after># View DSL Design

*Design Support Library extension of [View DSL](../viewdsl)*

## Content

The Android Design Support libraries has a few `ViewGroup` subclasses that
have their own `LayoutParams`. This split provides extensions on these
`ViewGroup`s to create their associated `LayoutParams` for use with View DSL
in the `add` function.

It also provides extensions for using `BottomSheetBehavior` with View DSL,
and using `TextInputLayout`.

### `AppBarLayout` extensions

#### `defaultLParams`

This extension function has a default width of `matchParent`
and a default height of `wrapContent` so you don't have to specify them in
most of the cases.

It also has a `scrollFlags` parameter which defaults to `ENTER_ALWAYS`, same
as when inflated from an xml layout. 

Use it when you add a `View` to an `AppBarLayout`.

#### Values for `scrollFlags`

`SCROLL`, `EXIT_UNTIL_COLLAPSED`, `ENTER_ALWAYS`, `ENTER_ALWAYS_COLLAPSED`
and `SNAP` are extension properties on `AppBarLayout` that are meant to be
used as flags (using `or` if you use multiple ones) with the `scrollFlags`
parameter of the `defaultLParams` function mentioned above. They are
provided for your convenience so they appear in autocomplete when relevant.

### `CollapsingToolbarLayout` extensions

#### `defaultLParams`

As for `AppBarLayout`, this extension function has a default width of
`matchParent` and a default height of `wrapContent` so you don't have to
specify them in most of the cases.

It also has two optional parameters:
- `collapseMode`, which defaults to `COLLAPSE_MODE_OFF`
- `parallaxMultiplier`, which defaults to `0.5f` (default value as of 27.1.0)

Use it when you add a `View` to a `CollapsingToolbarLayout`.

#### `actionBarLParams`

Similar to `defaultLParams`, but the height is `R.attr.actionBarSize`
instead of `wrapContent`. Use it when adding a `Toolbar`.

#### Values for `collapseMode`

`PIN` and `PARALLAX` are extension properties on `CollapsingToolbarLayout`
that are meant to be used for the `collapseMode` parameter of the
`defaultLParams` and `actionBarLParams` functions mentioned above. They are
provided for your convenience so they appear in autocomplete when relevant.

### `CoordinatorLayout` extensions

#### `defaultLParams`

This extension has default width and height set to `wrapContent` and an
optional `gravity` parameter.

#### `appBarLParams`

Has a `matchParent` width.
Use it when adding an `AppBarLayout`.

#### `contentScrollingWithAppBarLParams()`

If you `CoordinatorLayout` has an `AppbarLayout` and scrolling content
(e.g. a `RecyclerView`),
use this method to add the scrolling content View. It sets an
`AppBarLayout.ScrollingViewBehavior` under the hood.

### Bottom sheet behavior

#### `bottomSheetBehavior`

This extension function on `Ui` that takes an optional initialization lambda
creates a `BottomSheetBehavior` to use on `CoordinatorLayout.LayoutParams`.

#### Bottom sheet state extensions

This split also includes extensions on `BottomSheetBehavior`:
* `hidden` and `expanded`: read-write extension properties.
* `hide()` and `expand()`: extension functions.

They make playing with your bottom sheets programmatically a breeze.
See their KDoc to see their exact behavior.

### TextInputLayout helper

The `addInput` extension function on `TextInputLayout` takes a required id
used for the `TextInputEditText` that it creates and adds to the layout.

The id is required so the content of the user input is saved in instance
state even if the host Activity is killed by the system.

Like `add`, it has an optional initialization lambda.
{'fraction_non_alphanumeric': 0.07708497763746383, 'fraction_numerical': 0.0015785319652722968, 'mean_word_length': 5.2430213464696225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2194381', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1012, 'n_words': 507}