38 Commits

Author SHA1 Message Date
afohrman
201ec6241c Add support for placeholder text in TextInputLayout.
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
2019-12-11 17:06:57 -05:00
leticiars
18cb4b41e8 Updating text field documentation with prefix and suffix attributes
PiperOrigin-RevId: 271135855
2019-09-26 17:56:20 -04:00
Material Design Team
322cbaae8a Automated g4 rollback of changelist 264230778
PiperOrigin-RevId: 264382083
2019-08-20 11:22:09 -04:00
afohrman
04955f6421 Add placeholder text functionality to TextInputLayout.
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
2019-08-20 11:19:02 -04:00
leticiars
631c320dea Adding error icon documentation.
PiperOrigin-RevId: 261348566
2019-08-02 15:58:54 -04:00
leticiars
931bbef505 Adding documentation for the Exposed Dropdown Menu.
PiperOrigin-RevId: 246854538
2019-05-06 19:25:16 -04:00
leticiars
34df99b4bb Fixing table formatting in TextInputLayout documentation.
PiperOrigin-RevId: 246561639
2019-05-06 10:31:33 -04:00
afohrman
5d59ec05fc Update boxCornerRadius attributes in TextInputLayout's documentation to the correct names.
These attributes were renamed before our library was released as stable.

Resolves https://github.com/material-components/material-components-android/issues/312.

PiperOrigin-RevId: 241940785
2019-04-05 15:57:21 -04:00
leticiars
eda47ac568 Updating TextInputLayout's documentation to include information about the end icon modes.
PiperOrigin-RevId: 237104993
2019-03-08 10:07:22 -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
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
Material Design Team
9ab0e36ee4 Fixed the usage sample code to match what the document said at the bottom.
PiperOrigin-RevId: 216714647
2018-10-11 18:31:10 -04:00
cketcham
5a5c6fe5e4 A workaround has been applied that lets us use ThemeOverlays on default styles.
PiperOrigin-RevId: 209434277
2018-08-28 16:18:16 -04:00
afohrman
955d47d251 Update documentation for TextInputLayout's default style.
Resolves https://github.com/material-components/material-components-android/issues/143 by clarifying that TextInputLayout does not currently set the default style because of a bug in ThemeOverlay.

PiperOrigin-RevId: 205452751
2018-07-20 18:28:16 -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
afohrman
f2ebf56e21 Rename text field outlined style from "Outline" to "Outlined".
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
2018-05-31 16:39:44 -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
afohrman
6709e6af1e Remove escape characters from links in TextInputLayout documentation.
PiperOrigin-RevId: 196504132
2018-05-16 11:43:25 -04:00
afohrman
4d4923e00a Fix formatting for text field attribute table.
GitHub was failing to render the table with multi-line rows.

PiperOrigin-RevId: 196501962
2018-05-16 11:43:00 -04:00
cketcham
73d1c6f148 Update links in material component docs
PiperOrigin-RevId: 195898245
2018-05-08 20:10:49 -04:00
Material Design Team
87b5e046c4 Replace links to Material design guidance with short links as appropriate.
PiperOrigin-RevId: 194927609
2018-05-01 17:10:56 -04:00
dniz
375eb8220b Update docs to point to new widget class locations
PiperOrigin-RevId: 193539651
2018-04-30 11:34:37 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00
markwei
19c081b025 Use common style header for TextInputLayout
PiperOrigin-RevId: 183316060
2018-02-27 13:21:50 -05:00
markwei
1bc7c013d1 Add updated Material theme guidance on top of component documentation.
The goal is that this snippet can be copied and pasted across all of our component documentation.

PiperOrigin-RevId: 183315682
2018-02-27 13:05:53 -05:00
travisc
ab2fec6da4 Move lib/src/ to lib/java/, and lib/jvmtests/javatests/ to lib/javatests/.
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
2018-01-11 10:50:18 -05:00
dniz
4538e1ec69 Update text field documentaion for new functionality
PiperOrigin-RevId: 175669674
2017-11-14 15:07:16 -05:00
dniz
56f5cca116 Update TextInputLayout documentation to have notes about setting hint programmatically.
PiperOrigin-RevId: 173691474
2017-11-14 14:11:07 -05:00
dcarlsson
c6fdfe669e Update headers for Android Material Components documentation to clarify page titles in relation to table of contents/index listings.
- 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
2017-05-11 12:57:38 -07:00
afohrman
0a157b9975 Fix semi-broken link in TextInputLayout documentation.
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
2017-05-10 12:05:58 -07:00
Material Design Team
17ded0f2e1 Update one-line component descriptions for consistency across the three MDC sites.
PiperOrigin-RevId: 155531666
2017-05-09 13:00:58 -07:00
shyndman
50cc15caa4 Adds screenshot mocks to the documentation of several components.
PiperOrigin-RevId: 155454192
2017-05-08 18:04:09 -07:00
shyndman
a14fe167cf Documentation cleanup.
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
2017-05-08 16:48:53 -07:00
afohrman
246d51ca6f Change formatting in XML example for TextInputLayout.
PiperOrigin-RevId: 155424482
2017-05-08 15:50:11 -07:00
afohrman
ef469ab452 Add documentation for TextInputLayout.
PiperOrigin-RevId: 155413910
2017-05-08 13:06:21 -07:00
dcarlsson
f37a53e9b6 Move component documentation under docs/ root.
PiperOrigin-RevId: 153763840
2017-04-24 16:14:48 -07:00