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
Prior to this change, when setLayoutDirection is called on a parent/ancestor View of a Chip, the updated layout direction could be propagated to the Chip without updating its text padding. This change forces a padding update whenever layout direction changes.
PiperOrigin-RevId: 230933347
The annotation was only necessary for the method in TextInputLayout that calls CollapsingTextHelper#getCurrentCollapsedTextColor.
PiperOrigin-RevId: 230616582
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 hardcoded "rounded" corner family from FAB shapeAppearanceOverlay
- Remove BottomAppBar shape toggle override from demo (now that we have a
global switcher)
- Update BottomAppBar demo to base top edge on FAB shape appearance
PiperOrigin-RevId: 229971238
Because the Behavior is to slide down to disappear, the more reasonable sliding distance should be the height of the view plus the bottomMargin of the view.
Resolves https://github.com/material-components/material-components-android/pull/253
GIT_ORIGIN_REV_ID=77073b466107d2741c5688e06d7591a28913dcba
PiperOrigin-RevId: 229931959
1) When touches normal child view in settling bottom sheet,
the state goes to STATE_EXPANDED or STATE_COLLAPSED by SettleRunnable.
It should be STATE_DRAGGING.
SettleRunnable’s targetState should be ignored when settling is aborted.
2) When touches nested scroll child view in settling bottom sheet,
the settling animation is not stopped.
In settling state, the child view should be captured, not the nested scroll child.
Fixes: https://issuetracker.google.com/issues/119289861
Test: Touch or drag the settling bottom sheet
GIT_ORIGIN_REV_ID=514e20ad10aafcc6e95015d95e1efc888d93bed7
PiperOrigin-RevId: 228944484
Makes the following methods public:
- setScrollPosition(int, float, boolean, boolean)
- selectTab(Tab)
- selectTab(Tab, boolean)
This makes it possible to separate the link between a TabLayout and a ViewPager to another class.
PiperOrigin-RevId: 228887919