TextInputEditText#getGlobalVisibleRect is overridden to call getGlobalVisibleRect on parent TextLayoutInput view directly. It doesn't match with the View#getGlobalVisibleRect implementation where the return globalOffset contains negative amount of the scroll in the view. As a result, calling getLocalVisibleRect will return a wrong rectangle when TextInputEiditText is scrolled.
PiperOrigin-RevId: 542341678
The original logic prevents displaying the collapsed hint on top of suffix text. The behavior looks not consistent with the case of prefix text or outline variants of text fields.
This CL also fixes the issue that when drawable paddings are set on EditText, the collapsed hint is not aligned with the prefix anymore.
Resolves https://github.com/material-components/material-components-android/issues/2800
PiperOrigin-RevId: 511390069
When backgroundTint is set against the AutoCompleteTextView, since the background drawable of it is a LayerDrawable, which will try to get the constant states of its child drawables and create new drawables from them.
In CutoutDrawable we didn't implement that logic - so the constant state returned will be MaterialShapeDrawableState, and therefore the new drawables created are plain MaterialShapeDrawables, instead of CutoutDrawable.
Fixes this by correctly implement drawable state for CutoutDrawable.
Resolves https://github.com/material-components/material-components-android/issues/3041
PiperOrigin-RevId: 508664043
Resolves https://github.com/material-components/material-components-android/issues/2223
Add `TextInputLayout.setErrorAccessibilityLiveRegion` and `TextInputLayout.getErrorAccessibilityLiveRegion` to allow controlling the way the TextInputLayout error is announced.
Example:
```
textInputLayout.setErrorAccessibilityLiveRegion(ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);
```
PiperOrigin-RevId: 497323465
[TextField] MaterialAutoCompleteTextView uses a ListPopupWindow to show a modal dropdown menu when in "Accessibility Touch Exploration" mode. This popup also should respond to setDropDownBackgroundDrawable(Drawable).
PiperOrigin-RevId: 482233381
Android framework Canvas.clipRect() has a bug with Region.Op.DIFFERENCE when handling bounds.left on APIs lower than 18, which causes text field outlines are still drawn over the label on lower APIs, despite the label area is supposed to be cut out.
Fixes this by bringing back the old solution we were using - "painting out" the label area after the stroke is drawn. Since the implementation is quite complicated, this CL also splits the CutoutDrawable to two inner impl classes to have a better code structure.
Resolves https://github.com/material-components/material-components-android/issues/2811#issuecomment-1196016169
PiperOrigin-RevId: 482013070
Saving/restoring themeable fields will cause problems when the view is recreated, because those fields will be restored to the value resolved from the context before the recreation, instead of the current context. For example, when the device locale changes, those fields will still be restored to the previous locale instead of the new one.
It's a general practice in Android framework and AndroidX not to save/restore themeable fields. If clients need this, they should implement their own logic.
Resolves https://github.com/material-components/material-components-android/issues/2075
PiperOrigin-RevId: 454708278
In CollapsingTextHelper we are checking both the expanded bound and the collapsed bound to be larger than 0 to decide if we are going to draw the collapsing text. However this can result in a situation that when there's no space to display expanded hint, the collapsed hint won't be drawn either, even if the hint is not expandable at all.
This CL fixes the issue in a more generic way - whenever draw() is called, we check if the current bound (should be calculated whenever the collapsing fraction is changed) is larger than 0 to decide if we need to draw the collapsing text.
This CL also adds the logic to ensure the cutout bound will never be larger than the collapsed bound.
Resolves https://github.com/material-components/material-components-android/issues/2573
PiperOrigin-RevId: 449597658
Note that there are a slight behavior changes - when a new end icon mode is set, the state will always be reset, if applicable. This should be logically more consistent and correct than the current behavior.
PiperOrigin-RevId: 449027939
On API 21 & 22, the borderless ripple will go behind the container view under certain conditions. Setting a mask when creating the ripple drawable to restrain the ripple inside view bounds somehow solves the issue.
PiperOrigin-RevId: 445920587
This CL also cleans up and fixes the edit text background setting logic - when the edit text is an autocomplete text view and provides its own background, we won't override the background by trying to add ripples to it.
Later they should be split again from the main class with other box-background-relevant logic.
Resolves https://github.com/material-components/material-components-android/issues/1431
PiperOrigin-RevId: 445486075
On API 21 & 22, the borderless ripple will go behind the container view under certain conditions. Setting a mask when creating the ripple drawable to restrain the ripple inside view bounds somehow solves the issue.
Resolves https://github.com/material-components/material-components-android/issues/929
PiperOrigin-RevId: 444595599