25 Commits

Author SHA1 Message Date
afohrman
7b4e6d356c Improve logic for setting box background mode.
Using a switch statement to ensure that the box background mode is only ever set to one of the BoxBackgroundMode constants. Also pulled the logic out into its own method to improve readability in the already large constructor, and added a check to make sure that the box background's GradientDrawable is only created if a background is requested.

PiperOrigin-RevId: 167194185
2017-09-21 14:44:38 -04:00
afohrman
fd1da78e7e Add outline text field box.
This commit adds the initial outline version of the text field box. The box drawable is now created programmatically based on early versions of parameters. Parameters at this point are just hardcoded variables.

Also included: skeleton styles and attributes for the filled and outline box. These are very basic for now. Eventually, the styles will each set parameters for the box attributes, and Widget.Design.TextInputLayout.Box will set the values that each box style has in common (like height). For now, the styles pretty much just say whether the box is filled or outlined, and the setBoxAttributes() method fills in the missing information.

Not included in this commit:
- Padding
- Actual parameters set via styles/attributes
- States

PiperOrigin-RevId: 166736640
2017-09-21 14:33:13 -04:00
Material Design Team
feee8126e6 Automated g4 rollback of changelist 165622891.
*** Reason for rollback ***

Breaks GMM

*** Original change description ***

Reposition label to adapt to box surroundings.

Move the collapsed and expanded bounds of the floating label towards where each belongs. This commit is the first stage in setting the floating label's bounds, so it avoids calculating the exact dimensions based on internal dimensions. The label positioning work is being broken up into stages since the internal dimensions of the text field will likely change either in an upcoming design rethink and while adding the dimension parameters. The final d...

***

PiperOrigin-RevId: 165664978
2017-09-21 14:32:18 -04:00
afohrman
84d3d9ef92 Reposition label to adapt to box surroundings.
Move the collapsed and expanded bounds of the floating label towards where each belongs. This commit is the first stage in setting the floating label's bounds, so it avoids calculating the exact dimensions based on internal dimensions. The label positioning work is being broken up into stages since the internal dimensions of the text field will likely change either in an upcoming design rethink and while adding the dimension parameters. The final dimensions will be set once the design is agreed upon, and probably during the dimension parameterization phase.

PiperOrigin-RevId: 165622891
2017-09-21 14:31:54 -04:00
afohrman
a0550d04c5 Add box for text field.
Add a background box for text field to create the text field box. This does not upgrade all "line" text fields, it simply adds another style for text fields that users can opt in to in order to get the box version.

This commit adds a basic grey background box. Not included in this commit:
- Padding/positioning for the label to adjust to being in the box
- Dark/light theme versions
- Exact dimensions and colors

PiperOrigin-RevId: 165596665
2017-09-21 14:31:29 -04:00
markwei
9a32f67d40 Pull AnimationUtils into a new package.
PiperOrigin-RevId: 163743184
2017-09-21 14:21:16 -04:00
afohrman
0c49c64a57 Turn hint/label to error color when error is set.
Adds functionality to turn the floating label, or "hint", to the error color when the error is set. The error color for the label will match whatever the error color is set to via app:errorTextAppearance. In the case where no custom errorTextAppearance is set, the label gets set to the error color's default color, which is red/dark pink, depending on whether the text field is used in a dark or light theme.

PiperOrigin-RevId: 162553182
2017-09-21 12:12:31 -04:00
afohrman
b28f0e0996 Add helper text feature to TextInputLayout.
This commit adds functionality to TextInputLayout to support helper text, as outlined in spec: https://material.io/guidelines/components/text-fields.html#text-fields-layout.

This is an initial implementation of helper text. It is a large commit, and in order to avoid making it any larger, it does not include the following things:

- Setting helper text via XML attribute

PiperOrigin-RevId: 162390341
2017-09-21 12:09:20 -04:00
afohrman
127dfe1255 Add graceful degradation for character counter and label text overflow color.
Previously, the character counter and label overflow color ended up as Color.MAGENTA, which actually is a sickly pink color. This appears to have been happening when the theme doesn't extend from Theme.Design, and therefore doesn't have textErrorColor. On API 23 and above, it gets set to MAGENTA instead of throwing an exception. The only reason this pink color was being used for the character counter and not the error text is because there already a fix for the error text - it just wasn't applied to the character counter.

I pulled the logic for the fix out to make this graceful degradation code reusable for both error and character text, and for future situations like this.

PiperOrigin-RevId: 159229718
2017-09-21 11:23:47 -04:00
afohrman
73cb135c15 Update vertical motion for TextInputLayout's error text.
Motion additions/updates in this change:
- Added animation for error text's translation down
- Updated durations and interpolators for the opacity in and out animations

These changes roll forward changes that were previously rolled back because they broke screenshot tests.

PiperOrigin-RevId: 158881906
2017-06-14 16:38:11 -07:00
afohrman
94947cde8a Broke some screenshot tests.
PiperOrigin-RevId: 157239931
2017-06-14 16:33:59 -07:00
afohrman
63acb542ed Update motion for TextInputLayout's error state.
Motion additions/updates in this change:
- Added animation for error text's translation down
- Updated durations and interpolators for the opacity in and out animations

PiperOrigin-RevId: 157220100
2017-06-14 16:32:30 -07:00
afohrman
78eb50a405 Update motion for TextInputLayout's active state.
Motion updates in this change:
- Shortened the duration for the label scale
- Changed the interpolators from linear to FastOutSlowIn

PiperOrigin-RevId: 156553820
2017-05-24 16:35:55 -07:00
Aurimas Liutikas
682c45cbd3 Clean up ParcelableCompat after minSdk 14 bump.
Bug: 32794064
Test: ./gradlew assemble
Change-Id: I87d35d527e80d55ac4a2a626a6040fcdaff63ae3
PiperOrigin-RevId: 152212864
2017-04-12 17:38:28 -07:00
Aurimas Liutikas
8428f09805 Remove ViewCompat method usages for things that were added in API 11.
Bug: 32794064
Test: ./gradlew assemble assembleAndroidTest still works
Change-Id: I18fb0cc1ebc67c911eeb30aada7b8315afc15835
PiperOrigin-RevId: 152030798
2017-04-12 17:31:18 -07:00
Aurimas Liutikas
d32ba949a8 Move to using ValueAnimator directly instead of compat versions.
ValueAnimator can now be used directly given that our minSdk is 14.

Bug: 32794064
Test: ./gradlew clean assemble still works
Change-Id: Ibf0111b104eaea10acf33c8d54a3275fdfa0c1a4
PiperOrigin-RevId: 151641145
2017-04-12 17:22:06 -07:00
Alan Viverette
8b7af4099b Fix TextInputLayout's hint not expanding
Happens when the EditText is populated with
text from the layout, etc. Caused by some
state being set wrong in the constructor,
which makes the proceeding state update
no-op, since it thinks it is already in the
state.

BUG: 33585556
Test: included
Change-Id: I34c6e9aca3c41f864974ad32fcdbb6dc829645b8

PiperOrigin-RevId: 147067802
2017-02-09 17:32:24 -08:00
travisc
9ba7c6c5fc Fix password toggle taking FOCUS_DOWN events
Pressing the TAB key sends a FOCUS_DOWN event, and
now that the EditText floats in the center, the
password toggle is actually the next vertically top focusable
view.

This CL fixes it by ensuring that the EditText has the same
min-height as the password toggle, thus making the EditText
the next focusable view.

BUG: 33771077
Test: included
Change-Id: I18f5a7e419fa6ae2b13d4081e6f3e369b67ccdbe

PiperOrigin-RevId: 144259419
2017-01-18 18:11:11 -08:00
travisc
ed279941b4 Reformat all Java files to match Google style.
This change was generated with an automated tool, and should be a no-op.

PiperOrigin-RevId: 142082461
2016-12-14 17:00:32 -08:00
Chris Banes
615d32fc46 Merge "Small TextInputLayout label fixes" into nyc-support-25.1-dev
GitOrigin-RevId=b1d1c0478c81b1319d1c3fb2970e09380adf2091

PiperOrigin-RevId: 141512013
2016-12-12 16:04:19 -08:00
TreeHugger Robot
8a34d1903b Merge "Fix accessibility for password toggle button" into nyc-support-25.1-dev
GitOrigin-RevId=ce68d2b2f605e85c22fe6453d10610d2d40d09f1

PiperOrigin-RevId: 141510504
2016-12-12 16:03:46 -08:00
Alan Viverette
0ed7e06c94 Merge remote-tracking branch 'goog/master' into ffwd
GitOrigin-RevId=b0ee811d9ded5a8b94c94652c01d5db7b0ce4b51

PiperOrigin-RevId: 141507272
2016-12-12 16:03:00 -08:00
Chris Banes
c2e6816d6d Merge "Sync password toggle view after being re-enabled"
GitOrigin-RevId=2a6de19abd05a25e956cd9a62e7069480637ccc4

PiperOrigin-RevId: 141501611
2016-12-12 16:02:03 -08:00
travisc
0cbebc7887 Begin syncing to 25.1.0 design library code.
This CL will look a bit strange, as it reverse some changes that
were already present. Unfortunately the Android auto-merger greatly
confuses our syncing tool, as it effectively creates new commits
that have the same content as old commits, and does so in a
non-linear fashion (e.g. the commit tree in 25.1.0 is not merely
built on top of 25.0.1).

This CL will get us into a state where we're ready to apply the rest
of the 25.1.0 changes in succession, and once that is completed,
we'll be at the correct (matching) state.

GitOrigin-RevId=11a895a323af06c4731e4c64a7ec2c09ac0aaf2f

PiperOrigin-RevId: 141497561
2016-12-12 16:01:37 -08:00
travisc
5effa7d71f Add gradle wrapper and associated files, restructure top-level directories.
This new structure will allow for a top-level gradle file and a multi-project
build (which is a more typical structure for things). In the future, it will
allow us to place other projects in here as well (such as sample applications).

PiperOrigin-RevId: 141247594
2016-12-12 16:01:26 -08:00