67 Commits

Author SHA1 Message Date
leticiars
1ba8a45332 Fixing TextInputLayout wrongly announcing "End of field" message in TalkBack mode.
PiperOrigin-RevId: 253242183
2019-06-18 13:29:19 -04:00
cketcham
bff75f2d3e Update to lamdas
PiperOrigin-RevId: 252846439
2019-06-18 13:21:02 -04:00
marianomartin
5a5d311a36 Check more lint warnings, show warnings as errors.
PiperOrigin-RevId: 252822573
2019-06-18 13:20:15 -04:00
afohrman
569d33a055 Remove corner radius adjustment from outline text fields.
PiperOrigin-RevId: 252682213
2019-06-18 12:04:27 -04:00
leticiars
34e9ab24fb Only make filled text field hint vertically centered if edit text's min lines is 1.
In APIs > 15.

PiperOrigin-RevId: 252630869
2019-06-18 11:56:16 -04:00
leticiars
2ec8717f9f Make decorative icons in text fields not focusable in TalkBack mode.
PiperOrigin-RevId: 252405963
2019-06-18 11:51:17 -04:00
leticiars
16a6e72ecc Fixing passwordToggleEnabled="false" not working as expected.
Note: it's advised to use endIconMode instead of passwordToggleEnabled.
PiperOrigin-RevId: 250892878
2019-06-10 08:22:56 -07:00
leticiars
0c0951ce6d Fixing requestLayout() being incorrectly called multiple times.
The end icon dummy drawable should only be set if it's not yet set.

PiperOrigin-RevId: 249462027
2019-05-24 14:18:31 -04:00
marianomartin
90837ec485 Internal cleanup
PiperOrigin-RevId: 249243403
2019-05-21 12:15:07 -04:00
leticiars
837febea61 Adding the EditText as a parameter for onEditTextAttached().
PiperOrigin-RevId: 248218371
2019-05-16 17:17:14 -04:00
leticiars
5f8f60457a Changing how password toggle end icon updates its checked state.
Now it will automatically change to checked or not checked depending if the EditText's transformation method is changed.

PiperOrigin-RevId: 248185643
2019-05-16 17:12:39 -04:00
leticiars
c71b6ccb13 Exposed Dropdown Menu (https://material.io/design/components/menus.html#exposed-dropdown-menu).
An AutoCompleteTextView should be used in the place of a TextInputEditText, along with with a Widget.MaterialComponents.TextInputLayout.(...).ExposedMenuDropdown style.

PiperOrigin-RevId: 246343749
2019-05-03 10:58:36 -04:00
marianomartin
0e9513a86f Fix getter in text input layout
PiperOrigin-RevId: 245479204
2019-04-29 15:57:13 -07:00
leticiars
aa84ca93be Creating EndIconDelegate abstract class and subclasses to refactor how TextInputLayout initialize its end icons.
PiperOrigin-RevId: 244058404
2019-04-19 21:35:40 -04:00
afohrman
db408ee4ce Add clearer documentation that box background colors are only supported for filled text fields.
PiperOrigin-RevId: 242870719
2019-04-19 15:24:13 -04:00
leticiars
27eac541b0 Fixing end and start icon ripples appearing behind text input layout.
PiperOrigin-RevId: 242660816
2019-04-19 13:09:03 -04:00
afohrman
4476564820 Vertically center the filled text field's expanded label.
PiperOrigin-RevId: 241791031
2019-04-05 15:46:27 -04:00
leticiars
efc7f37699 Fixing bug of single hex color values set in the XML not being read for icons tint lists.
PiperOrigin-RevId: 239217545
2019-03-22 16:55:11 -04:00
leticiars
29b0670cee Updating end icon setter parameters to match the method names.
PiperOrigin-RevId: 239197723
2019-03-22 16:51:08 -04:00
leticiars
2642ff2697 Adding support for TextInputLayout start icon. It can be set to be just a drawable or, if a OnClickListener is set to it, a button.
For that reason, users should opt to use the start icon API instead of setting a start/left compound drawable on the text field's edit text.

PiperOrigin-RevId: 238984066
2019-03-22 16:19:36 -04:00
leticiars
4690a8893d Fixing end icon tint always being overriden by old password toggle tint.
PiperOrigin-RevId: 236645688
2019-03-08 09:51:23 -05:00
leticiars
168a468f29 Refactoring TextInputLayout's end icon initialization to always have the end icon view ready. Also refactoring OnEndIconInitializedListener to OnEditTextAttached listener.
PiperOrigin-RevId: 235781672
2019-02-27 17:59:10 -05:00
leticiars
b7f520d0f6 Fix padding of TextInputEditText when an icon is present.
PiperOrigin-RevId: 235236593
2019-02-24 14:36:44 -05:00
leticiars
56859415e8 Adding support for a custom end icon for the TextInputLayout.
A user-specified icon can now be set via app:endIconMode="custom" and attributes app:endIconDrawable and app:endIconContentDescription. It is also possible to set a custom OnClickListener via TextInputLayout's end icon API.

PiperOrigin-RevId: 234671237
2019-02-24 14:23:57 -05:00
leticiars
4882a4f131 Adding clear text button end icon to TextInputLayout.
PiperOrigin-RevId: 234141273
2019-02-24 14:15:28 -05:00
leticiars
ee66029e6c Adding back padding to the text field end icon.
PiperOrigin-RevId: 233668308
2019-02-24 14:08:11 -05:00
leticiars
4c2e9c4004 Changing the TextInputLayout's password toggle implementation into a generic API implementation, which will allow for easier support of future end icons. Also deprecating current password toggle end icon methods and attributes.
This change doesn't include support of a custom end icon yet.

PiperOrigin-RevId: 233645798
2019-02-24 14:07:11 -05:00
afohrman
beee015feb Use EditText's background for the filled text field and fix underline flakiness.
PiperOrigin-RevId: 231857938
2019-02-11 11:08:22 -08:00
leticiars
564bd28527 Fixing bug where font set via xml for text input's labels wouldn't be applied to the labels of an EditText with password transformation.
PiperOrigin-RevId: 231611177
2019-02-11 11:00:25 -08:00
afohrman
19039f7772 Automated g4 rollback of changelist 231246920
PiperOrigin-RevId: 231313735
2019-02-01 12:37:35 -05:00
afohrman
ef919e870a Use EditText's background for the filled text field and fix underline flakiness.
Use the EditText's background for the filled box text field and a MaterialShapeDrawable drawn to the canvas for the underline. This allows for many improvements to the filled text field.

This commit:
- Fixes the underline flakiness, where the underline used to not meet the edges until drawableStateChanged() was called after a layout pass (because TextInputLayout was attempting to use EditText's pre-existing underline, and the bounds of that Drawable weren't known in order to modify them until after drawableStateChanged())
- Removes the hard-coded box offset since it was only necessary when trying to use EditText's background drawable
- Brings the expanded label/hint a bit closer to the vertical center. Any more than this will require changing the bounds set on the expanded hint text and create misalignment between the expanded hint and any compound drawable that might be set

Specs: https://material.io/design/components/text-fields.html#spec

There is a possible alternative to drawing the underline manually: including the underline as part of the EditText's background. I investigated this option and rejected it, since it would require a re-architecture of the way TextInputLayout handles the box logic and many layers of box drawable nesting. It is much more straightforward and performant to draw the underline directly to the canvas than to convert the boxBackground to {LayerDrawable{MaterialShapeDrawable,{InsetDrawable{MaterialShapeDrawable}}}}.

This commit should only change the visuals of the filled text field; the outline text field should be visually untouched.

PiperOrigin-RevId: 231246920
2019-02-01 12:35:48 -05:00
afohrman
0aa470af86 Support custom backgrounds for outline text fields and use EditText's background for the text field's outline.
The outline box styles previously didn't allow a custom drawable to be set. The box background was handled by TextInputLayout, which nulled out the EditText's background and drew the boxBackground directly to the canvas. That meant that a call to TextInputEditText#setBackground() would not actually do anything - it would result in the same outline text field.

In order to respect the background drawable, TextInputEditText's background is set to null in the style. Then, TextInputLayout programmatically sets the custom outline drawable if the background is already null. This avoids overwriting a drawable that may have already been set on the TextInputEditText.

This change does pretty much nothing to the filled box style; since the EditText's underline is still being used, the background of the EditText was never set to null for that style. This change should be a no-op for that style.

This move to using the EditText's background for the outline also improves the bounds of the outline text field and gets rid of the cutoff that was appearing at the top of the outline when TextInputLayout's hint was disabled and a hint was set on the EditText.

PiperOrigin-RevId: 230538561
2019-01-25 13:55:36 -05:00
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