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
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
*** 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
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
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
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
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
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
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
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
Motion updates in this change:
- Shortened the duration for the label scale
- Changed the interpolators from linear to FastOutSlowIn
PiperOrigin-RevId: 156553820
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
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
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
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
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