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
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
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
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
This commit updates the style names for the outlined text field box from "Outline" to "Outlined.
Widget.MaterialComponents.TextInputLayout.OutlineBox -> Widget.MaterialComponents.TextInputLayout.OutlinedBox, and
Widget.MaterialComponents.TextInputEditText.OutlineBox -> Widget.MaterialComponents.TextInputEditText.OutlinedBox.
This name matches spec and is closer to what is used on the other platforms.
PiperOrigin-RevId: 198768731
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
Bazel is happier if Java/Java test roots are named 'java' and 'javatests', and
this will mean that once we create a BUILD file for
android/support/design/{widget,internal}/ we'll no longer need a custom package
specified in our build (which tends to cause build problems that manifest quite
weirdly). This commit doesn't attempt to refactor the build at all yet, and is
just a pure move.
PiperOrigin-RevId: 178060739
- Update page title for each piece of documentation to use the vernacular concept rather
than the class name for the component.
- Treat all instances of class names as proper nouns and mark them as code names.
PiperOrigin-RevId: 155705022
The link to a method on Android's doc site had slashes in it, so it linked to the right documentation page, but not the specific method.
PiperOrigin-RevId: 155658544
I'm updating this CL as I go to fix all the issue we can find.
* Icon lists items now use correct icons, and are rearranged to be consistent.
* Removed HTML comments that were interfering with the Liquid templates.
* Added the benefits list to the docsite-index.
* Capitalized "Design" in Material Design.
* Spec links in icon list now use consistent labels.
* URLs, headings and page titles are now internally consistent within the platform.
PiperOrigin-RevId: 155445665