35 Commits

Author SHA1 Message Date
leticiars
9a30c9331b Fixing focus order when text fields have the password toggle enabled.
PiperOrigin-RevId: 227893863
2019-01-10 16:18:57 -05:00
cketcham
dc72aaeed4 Migrate Gradle build and sources to androidx
PiperOrigin-RevId: 225551505
2018-12-21 11:07:45 -05:00
afohrman
530a7a8f9e Automated g4 rollback of changelist 223552187
PiperOrigin-RevId: 223870917
2018-12-06 11:47:52 -05:00
afohrman
671f785662 Automated g4 rollback of changelist 223530191
PiperOrigin-RevId: 223552187
2018-12-06 11:42:22 -05:00
afohrman
ead212fbff Support shape theming in TextInputLayout.
PiperOrigin-RevId: 223530191
2018-12-06 11:41:19 -05:00
afohrman
16c6daa9ea Update counter content description every time the counter is updated.
Also clarify the counter description when the limit is not exceeded. Instead of "3/10" it now reads "Characters entered 3 of 10."

Before this change, the counter would read out incorrect character lengths when focused on -- since the live region was set to ACCESSIBILITY_LIVE_REGION_POLITE, it wouldn't be incorrectly read out to the user unless they explored by touch, but if the user were to tap the counter view, it would read out an incorrect character length. This commit fixes that by updating the counter description at the appropriate point when the character count is updated.

PiperOrigin-RevId: 221671905
2018-11-16 12:20:03 -05:00
leticiars
ea44a6fc85 Fixing MDC filled background text field for hovered and disabled states.
PiperOrigin-RevId: 220843896
2018-11-16 11:12:58 -05:00
afohrman
ff9dded7ba Use typescale for TextInputLayout.
Update the type within TextInputLayout create color attributes for each element in order to ensure that the colors can be set outside of our typescale. The colors set in those new attributes are intended to be visual no-ops; the goal of this change is not to update the colors.

PiperOrigin-RevId: 219726813
2018-11-16 10:35:41 -05:00
leticiars
7eac68f306 Adding surface layer support to MDC text fields.
PiperOrigin-RevId: 219499276
2018-11-01 16:19:29 -07:00
leticiars
7169461605 Initial support for color subsystem in MDC text fields.
PiperOrigin-RevId: 218608066
2018-10-28 19:14:20 -04:00
afohrman
3216dd634b Fix typo in TextInputLayout.
In the word "visibility".

PiperOrigin-RevId: 217509351
2018-10-28 18:25:47 -04:00
marianomartin
9e36c150c0 Fix most javadocs errors
PiperOrigin-RevId: 216697274
2018-10-11 18:24:53 -04:00
Material Design Team
493c090a88 Set a default contentDescription on TextInputLayout's character counter unless it is overflowed.
PiperOrigin-RevId: 215026891
2018-10-01 12:24:49 -04:00
dniz
35a0839ad6 Add defStyleRes to materialThemeOverlay wrapping
- Fixes materialThemeOverlay case where client is not using our theme or style (e.g., AppCompat + component with no style set)
- Also refactors createThemedContext() to use obtainStyledAttributes with defStyleAttr and defStyleRes instead of getTheme().resolveAttribute()

PiperOrigin-RevId: 213464594
2018-09-28 14:53:34 -04:00
leticiars
df551410c4 Fixing padding of hint label when there is a leading icon
PiperOrigin-RevId: 213277053
2018-09-28 14:49:23 -04:00
leticiars
f317d634cf Fixing text overlapping end toggle drawable when app starts.
PiperOrigin-RevId: 212885605
2018-09-14 11:04:37 -04:00
cketcham
655b3dc1b0 Add materialThemeOverlay attribute
PiperOrigin-RevId: 212665868
2018-09-14 10:58:21 -04:00
Alex Saveau
3edda8be14 Add baseline alignment support to TextInputLayout.
Resolves https://github.com/material-components/material-components-android/issues/13.
Resolves https://github.com/material-components/material-components-android/pull/56.

PiperOrigin-RevId: 212022367
2018-09-14 10:51:16 -04:00
cketcham
a8c0d6f762 Remove workaround for background drawable state for TextInputLayout
It appears this workaround is no longer necessary and is causing the EditText to lose its padding on sdk 21 and 22.

PiperOrigin-RevId: 211798802
2018-09-07 11:55:57 -04:00
marianomartin
72eaab9ff2 TextInputLayout: setBoxCornerRadiiResources param mismatch
PiperOrigin-RevId: 210719217
2018-08-29 11:32:56 -04:00
afohrman
a239a14139 Use null check instead of instanceOf for boxBackground's GradientDrawable initialization.
PiperOrigin-RevId: 209596322
2018-08-28 16:31:27 -04:00
cketcham
c73ee1b061 Update ThemeEnforcement to correctly read the android:theme attribute from the style
PiperOrigin-RevId: 206579912
2018-08-02 18:04:42 -07:00
cketcham
7487a539f7 Add support for ThemeOverlays with the default style attr in MaterialCardView and TextInputLayout
PiperOrigin-RevId: 206004683
2018-08-02 17:54:28 -07:00
afohrman
631301e4b1 Update outline box to take on the counter overflow color when overflowed.
PiperOrigin-RevId: 203775391
2018-07-09 15:01:23 -04:00
afohrman
61672b79a4 Remove prefixes from variables in TextInputLayout.
mHelperTextAppearance and mErrorTextAppearance slipped by when the fields were changed.

PiperOrigin-RevId: 203173302
2018-07-09 15:00:21 -04:00
afohrman
6d28b64043 Update documentation to discourage setting the hint on TextInputEditText.
Remove ambiguity about where to set the hint by strongly recommending that it be set on the TextInputLayout.

This commit also updates the documentation to more strongly encourage the use of TextInputEditText over an EditText.

PiperOrigin-RevId: 201037651
2018-06-20 17:28:41 -04:00
Material Design Team
390a7acbf8 Causes TextInputLayout to expose its AccessibilityNodeInfo as contentInvalid if its character counter has overflowed
PiperOrigin-RevId: 198481505
2018-05-30 17:41:46 -04:00
afohrman
bdb25ff7e3 Use android:padding attributes instead of boxPadding attributes for text field dimensions.
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
2018-05-30 17:35:13 -04:00
Material Design Team
3e20d0720f Hide TextInputLayout from accessibility services and instead mirror its attributes on its EditText.
PiperOrigin-RevId: 197509011
2018-05-22 13:59:17 -04:00
afohrman
1cad4007dc Roll forward box background fix.
PiperOrigin-RevId: 197041463
2018-05-17 19:45:46 -04:00
afohrman
4700966a38 Roll back box background changes.
PiperOrigin-RevId: 196762626
2018-05-16 11:49:37 -04:00
afohrman
e566a535ac Ensure box background is drawn behind other text field elements.
This commit:
- Moves the draw calls in TextInputLayout#draw to happen in a better order: now, the background is drawn first, then TextInputLayout and its children, then the hint. This prevents the box from drawing on top of other text field elements.
- Updates box background setters and getters to modify boxBackgroundColor instead of defaultBoxBackgroundColor.
- Adds a demo for filled box background color changes to the text field demo.

PiperOrigin-RevId: 196748102
2018-05-16 11:48:54 -04:00
afohrman
886853babb Use start/end for TextInputLayout attributes.
Change attributes, setters, getters, resources, and tests for corner radii and box padding to use start/end instead of left/right. The goal is to make TextInputLayout more RTL friendly; beforehand, RTL use cases would have to directly call padding and corner radii methods with RTL values. After this change, TextInputLayout will determine whether it is in RTL mode and apply the relevant attributes appropriately.

PiperOrigin-RevId: 193565849
2018-04-30 11:35:26 -04:00
afohrman
2eb1f951fc Add feedback when character counter limit is exceeded.
This commit adds feedback once the character counter limit is exceeded (ex: 11/10), and backs off for every other case to avoid spamming the user.

Also adds a content description with a detailed message to the counter view to make it clear what the overflow is.

PiperOrigin-RevId: 193397006
2018-04-30 11:31:45 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00