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
Before, in requestRectangleOnScreen we were setting the text input layout’s rectangle to a specific and constant position, which caused the zoomed in screen to be fixed to the left instead of following the input text as it was typed. We should use the edit text’s rectangle’s position first, then adjust for the text field’s height (which includes the helper/error text), then use that updated rectangle on the super call of the method.
PiperOrigin-RevId: 435402032
We already had class documentation that explains that TextInputEditText should be instantiated with the parent TextInputLayout's context for proper theming, but this information is important enough to the basic usage of TextInputLayout and TextInputEditText that it's best to have it the class documentation, as well.
Added the guidance in both TextInputLayout and TextInputEditText because it's relevant to both classes.
PiperOrigin-RevId: 432244388
The setLabelFor calls were made in the call to populate the accessibility node but they were made after calling super (one of them was actually nested inside of a getter!), this is too late, the accessibility node is populated with the label for by the super class
PiperOrigin-RevId: 407178334
* To make announcements clearer, removed helper text from hint announcement.
* Calling setLabelFor on helper text view so it's clear it refers to the edit text visually above it.
* Calling setError is enough to let the screen reader decide how to announce the error.
PiperOrigin-RevId: 317651946
In APIs < 23 some things set in TextInputLayout's AccessibilityDelegate get overwritten, so announcements are not as expected.
PiperOrigin-RevId: 283396918
Move to use native android:padding attrs instead of custom boxPadding attributes for text fields. This is accomplished by creating box styles for TextInputEditText, and setting android:padding attributes in those.
The TextInputLayout box styles set the appropriate TextInputEditText style on its child by wrapping the TextInputEditText style in theme overlays. This is kind of neat, since it allows for the user not to have to set a style on both the TextInputLayout and TextInputEditText - the user does not even have to know about the TextInputEditText styles with this pattern. It should also help clear up some confusion over where to set the hint and other areas of haziness between TextInputLayout and TextInputEditText.
The default editTextStyle is set to the filled box style, to match the default TextInputLayout style.
This change removes the box padding attributes, and it also removes the dimension resources in favor of setting them in the style to improve readability.
This commit also changes TextInputEditText constructors to both use a theme attribute in the 3-arg constructor and call through to the TextInputEditText overloaded constructors rather than call the super's constructor from each. This allows the theme attribute set in the theme overlays to take effect.
PiperOrigin-RevId: 198051251