The alternative to android:editable="false" (which is deprecated) is to set inputType="none", however due to a framework bug that has no effect. This change makes it so it works as expected.
PiperOrigin-RevId: 299411110
This is the initial implementation of placeholder text; it does not contain motion. At this stage, TextInputLayout sets the placeholder text visibility based on whether or not it should show.
PiperOrigin-RevId: 284808331
Prefix text can be set via the prefixText attribute or via the setPrefixText(CharSequence) method.
Similarly, suffix text can be set via the suffixText attribute or via setSuffixText(CharSequence)
PiperOrigin-RevId: 269799139
Prefix text can be set via the prefixText attribute or via the setPrefixText(CharSequence) method.
Similarly, suffix text can be set via the suffixText attribute or via setSuffixText(CharSequence)
PiperOrigin-RevId: 268680301
This is the initial implementation of placeholder text; it does not contain motion. At this stage, TextInputLayout sets the placeholder text visibility based on whether or not it should show.
PiperOrigin-RevId: 264230778
For the outlined textfields, those attrs control the outline stroke, while for the filled textfields, they control the underline width.
PiperOrigin-RevId: 262933557
They are set by default when the text field is on error state, but can be disabled by setting the error icon drawable to null via the errorIconDrawable attribute or the setErrorIconDrawable method.
PiperOrigin-RevId: 260495196
Also updating clear text end icon to be not checkable, so that screen readers don't announce the icon's checked state as it's not relevant (differently from the password toggle icon, for example).
PiperOrigin-RevId: 259532643
An AutoCompleteTextView should be used in the place of a TextInputEditText, along with with a Widget.MaterialComponents.TextInputLayout.(...).ExposedMenuDropdown style.
PiperOrigin-RevId: 246343749
This resource is not in the public.xml file. This means that they are not intended to be shipped as part of our library and are fine to delete.
PiperOrigin-RevId: 241732718
The boxCornerRadius attributes were still in the MDC styles, which means that the shapeAppearance and shapeAppearanceOverlay attributes were not respected. This commit removes the boxCornerRadius attributes to ensure that changes to shapeAppearance or shapeAppearanceOverlay are respected where shape theming is enabled.
PiperOrigin-RevId: 239214930
NOTE: This case is not supported. Limited support is provided when feasible in order to avoid breaking existing usages, but all TextInputLayouts used with a Widget.MaterialComponents style and a non-Widget.MaterialComponents input child should update the input child to use a Widget.MaterialComponents.TextInputEditText style to avoid future breakages.
PiperOrigin-RevId: 239047527
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
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
TextInputLayout's EditText child.
Set the ?attr/editTextBackground attribute to null in TextInputLayout's materialThemeOverlay to make sure that ?attr/editTextBackground is @null no matter what EditText subclass or style is used for the TextInputLayout's input text child.
PiperOrigin-RevId: 233407060
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
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