334 Commits

Author SHA1 Message Date
pekingme
8204856dd4 [Token][Color] Upgraded to v0.170 for tonal surface colors.
PiperOrigin-RevId: 555230534
2023-08-09 19:03:25 +00:00
rightnao
e3b255b3a0 [Docs] Crosslink github docs in javadocs
PiperOrigin-RevId: 546393704
2023-07-11 19:37:37 +00:00
Material Design Team
bdef355289 [TextInputEditText]Fix: TextInputEditText misses some visible lines in CursorAnchorInfo#getVisibleLineBounds after scrolled
TextInputEditText#getGlobalVisibleRect is overridden to call getGlobalVisibleRect on parent TextLayoutInput view directly. It doesn't match with the View#getGlobalVisibleRect implementation where the return globalOffset contains negative amount of the scroll in the view. As a result, calling getLocalVisibleRect will return a wrong rectangle when TextInputEiditText is scrolled.

PiperOrigin-RevId: 542341678
2023-06-26 21:26:12 +00:00
pekingme
1562d0b64f [ExposedDropdownMenu] Added attribute to set dropdown menu's container.
PiperOrigin-RevId: 528578402
2023-05-02 16:10:48 -04:00
leticiars
c598ccd51e [TextInputLayout] Added API to set cursor colors for API 28+.
This is useful if the cursor color should be set in runtime, where setting ?attr/colorControlActivated for the edit text is not possible. Using the added APIs will take precedence over the value of ?attr/colorControlActivated.

This API is limited to APIs 28+ due to the framework getTextCursorDrawable() method being 28+.

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

PiperOrigin-RevId: 521448134
2023-04-10 14:23:58 +00:00
pekingme
d722a782bc [Tokens] Upgraded outdated token output in textfield & appbar.
PiperOrigin-RevId: 520714140
2023-03-30 21:58:22 +00:00
pekingme
4c5b917609 [Tokens] Internal migration.
PiperOrigin-RevId: 520708971
2023-03-30 21:56:43 +00:00
dsn5ft
5689ce2608 [i18n] Update string translations
PiperOrigin-RevId: 513006191
2023-02-28 22:08:20 +00:00
conradchen
d9b97b42ff [TextField] Make collapsed hint aligned with prefix and suffix text
The original logic prevents displaying the collapsed hint on top of suffix text. The behavior looks not consistent with the case of prefix text or outline variants of text fields.

This CL also fixes the issue that when drawable paddings are set on EditText, the collapsed hint is not aligned with the prefix anymore.

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

PiperOrigin-RevId: 511390069
2023-02-23 03:45:40 -08:00
conradchen
25b3c2b15c [TextField] Fix cutout not working when backgroundTint is set
When backgroundTint is set against the AutoCompleteTextView, since the background drawable of it is a LayerDrawable, which will try to get the constant states of its child drawables and create new drawables from them.

In CutoutDrawable we didn't implement that logic - so the constant state returned will be MaterialShapeDrawableState, and therefore the new drawables created are plain MaterialShapeDrawables, instead of CutoutDrawable.

Fixes this by correctly implement drawable state for CutoutDrawable.

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

PiperOrigin-RevId: 508664043
2023-02-10 16:20:37 +00:00
pfthomas
3b99749bc8 [DropdownMenu][a11y] Fix incorrect state
PiperOrigin-RevId: 502659684
2023-01-18 15:26:10 +00:00
pfthomas
e1688f3d19 [MaterialDatePicker][a11y] Improve date input validation feedback
Resolves https://github.com/material-components/material-components-android/issues/2223

Add `TextInputLayout.setErrorAccessibilityLiveRegion` and `TextInputLayout.getErrorAccessibilityLiveRegion` to allow controlling the way the TextInputLayout error is announced.

Example:

```
textInputLayout.setErrorAccessibilityLiveRegion(ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);
```

PiperOrigin-RevId: 497323465
2022-12-29 00:19:00 -05:00
rightnao
dfb9e81eeb [Motion] Motion tweaks
PiperOrigin-RevId: 493105642
2022-12-06 15:22:34 -05:00
pekingme
567cc5494b [Tokens] Refresh the output to reflect the current version.
PiperOrigin-RevId: 484515702
2022-10-28 07:46:16 -07:00
Material Design Team
644d141359 [ExposedDropdownMenu] Dismiss modal popup in dismissDropDown
PiperOrigin-RevId: 484502383
2022-10-28 07:45:40 -07:00
Material Design Team
db115f0a1f [ExposedDropdownMenu] Fix MaterialAutoCompleteTextView.setDropDownBackgroundDrawable(Drawable).
[TextField] MaterialAutoCompleteTextView uses a ListPopupWindow to show a modal dropdown menu when in "Accessibility Touch Exploration" mode. This popup also should respond to setDropDownBackgroundDrawable(Drawable).

PiperOrigin-RevId: 482233381
2022-10-21 16:23:52 +00:00
conradchen
a3521784e8 [TextField] Fix label cutout doesn't work on API < 18
Android framework Canvas.clipRect() has a bug with Region.Op.DIFFERENCE when handling bounds.left on APIs lower than 18, which causes text field outlines are still drawn over the label on lower APIs, despite the label area is supposed to be cut out.

Fixes this by bringing back the old solution we were using - "painting out" the label area after the stroke is drawn. Since the implementation is quite complicated, this CL also splits the CutoutDrawable to two inner impl classes to have a better code structure.

Resolves https://github.com/material-components/material-components-android/issues/2811#issuecomment-1196016169

PiperOrigin-RevId: 482013070
2022-10-19 09:20:41 -07:00
pubiqq
e76eaff716 [TextInputLayout] Fixed counter overflow text color getter
Resolves https://github.com/material-components/material-components-android/pull/3002

GIT_ORIGIN_REV_ID=b9f8e26840e02df2529561cf464e347fe220065d
PiperOrigin-RevId: 478059617
2022-10-03 19:14:09 +00:00
Material Design Team
e804957628 [TextInputLayout] Fix code formatting.
PiperOrigin-RevId: 474180631
2022-09-15 14:18:55 -04:00
leticiars
e7697c235b [TextInputLayout] Integrated tokens for text fields and the exposed dropdown menu.
PiperOrigin-RevId: 474105090
2022-09-15 14:15:10 -04:00
leticiars
fbd75ec5b0 [TextInputLayout] Updated cursor color on error for APIs >= 29.
Resolves https://github.com/material-components/material-components-android/issues/2719

PiperOrigin-RevId: 472535969
2022-09-08 13:41:59 -04:00
rightnao
7c56473a58 [Translations] Update string translations
PiperOrigin-RevId: 472531245
2022-09-08 13:25:10 -04:00
rightnao
c98480c019 [TextInputLayout] Update motion attributes for textfield animations
PiperOrigin-RevId: 472525831
2022-09-08 13:24:09 -04:00
leticiars
a85204eb75 [TextInputLayout] Updated expanded label color to take error color when on error.
Partially fixes https://github.com/material-components/material-components-android/issues/2719

PiperOrigin-RevId: 471799584
2022-09-02 12:54:09 -07:00
leticiars
08c40d85e5 [TextInputLayout] Added method to set corner family programmatically and a setShapeAppearanceModel method for greater customizability of the box background shape.
Resolves https://github.com/material-components/material-components-android/issues/1957

PiperOrigin-RevId: 470826160
2022-08-30 11:28:55 -04:00
rightnao
6b53f62aa2 [TextInputLayout] Update motion specs for hint animation
PiperOrigin-RevId: 469753395
2022-08-24 14:41:36 -07:00
leticiars
9147704468 [ExposedDropdownMenu] Fixed missing icon activated color.
PiperOrigin-RevId: 466742317
2022-08-10 16:34:12 -04:00
rightnao
e284e57d64 [TextInputLayout] Add scale type setters/getters for start and end image buttons in the TextInputLayout
Resolves https://github.com/material-components/material-components-android/issues/2080

PiperOrigin-RevId: 463381963
2022-07-28 17:36:31 -04:00
rightnao
633b3cecfa [TextInputLayout] Adding set/get methods to control minimum width and height for start/end icons
Resolves https://github.com/material-components/material-components-android/issues/2080

PiperOrigin-RevId: 461939723
2022-07-20 21:44:40 +00:00
pubiqq
b18f45ee99 [TextInputLayout] Delete unused paint
Resolves https://github.com/material-components/material-components-android/pull/2812

    GIT_ORIGIN_REV_ID=b1c718c45ab55d0c70539afe6233d10e883c413a
    Co-authored-by: paulfthomas

PiperOrigin-RevId: 460962180
2022-07-14 18:17:02 +00:00
pubiqq
15fa4db616 [TextInputLayout] Fix "android:enabled" attribute support
Resolves https://github.com/material-components/material-components-android/issues/2766
Resolves https://github.com/material-components/material-components-android/pull/2769

GIT_ORIGIN_REV_ID=9e60355679855b57ab63edf63944d3e23d2aec9a
PiperOrigin-RevId: 458516880
2022-07-06 05:03:16 -07:00
AshutoshSundresh
cd80b71817 [Resources] Remove unused public.xml resources
Resolves https://github.com/material-components/material-components-android/pull/2761

GIT_ORIGIN_REV_ID=fbc80605591c097ab56f4a8f0c9b4a2a3cbcfe10
PiperOrigin-RevId: 457959343
2022-06-29 14:39:28 +00:00
conradchen
051410b7ef [TextField] Stop saving/restoring TextInputLayout's themeable fields
Saving/restoring themeable fields will cause problems when the view is recreated, because those fields will be restored to the value resolved from the context before the recreation, instead of the current context. For example, when the device locale changes, those fields will still be restored to the previous locale instead of the new one.

It's a general practice in Android framework and AndroidX not to save/restore themeable fields. If clients need this, they should implement their own logic.

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

PiperOrigin-RevId: 454708278
2022-06-13 16:15:10 -07:00
rightnao
4ded01ed3f [TextInputLayout] Add a new custom length counter field and getters/setters to switch how text length is calculated for the counter.
Resolves https://github.com/material-components/material-components-android/issues/2418

PiperOrigin-RevId: 449842640
2022-05-23 10:21:23 -04:00
conradchen
2db8b0cd5a [TextField] Link OnItemSelectedListener of AutoCompleteTextView with the actual drop-down list
Framework has no default implementation of how or when OnItemSelectedListener will be called. We need to link it with the actual ListPopupWindow we are going to show.

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

PiperOrigin-RevId: 449725174
2022-05-19 14:24:31 -04:00
conradchen
73cb1b6e78 [TextField] Fix hint is not displayed when expanding space is limited
In CollapsingTextHelper we are checking both the expanded bound and the collapsed bound to be larger than 0 to decide if we are going to draw the collapsing text. However this can result in a situation that when there's no space to display expanded hint, the collapsed hint won't be drawn either, even if the hint is not expandable at all.

This CL fixes the issue in a more generic way - whenever draw() is called, we check if the current bound (should be calculated whenever the collapsing fraction is changed) is larger than 0 to decide if we need to draw the collapsing text.

This CL also adds the logic to ensure the cutout bound will never be larger than the collapsed bound.

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

PiperOrigin-RevId: 449597658
2022-05-18 21:14:13 -04:00
raajkumars
673cefc714 [TextInputLayout] Fix for TextInputLayout leak via AccessibilityManager.
Resolves https://github.com/material-components/material-components-android/issues/2615

PiperOrigin-RevId: 449517571
2022-05-18 21:12:36 -04:00
conradchen
ac74bc3bfd [CleanUp][TextField] Centralize icon view state handling logic
Note that there are a slight behavior changes - when a new end icon mode is set, the state will always be reset, if applicable. This should be logically more consistent and correct than the current behavior.

PiperOrigin-RevId: 449027939
2022-05-16 16:09:50 -04:00
conradchen
86b512a81c [CleanUp][TextField] Move end icon and content description logic to the layout class
PiperOrigin-RevId: 448036109
2022-05-11 14:59:46 -04:00
conradchen
d3ab6d7bf1 [CleanUp][TextField] Centralize accessibility event dispatching logic for drop-downs
This also fixes the bug that clients cannot use custom AccessibilityDelegate with drop-down mode.

PiperOrigin-RevId: 447748501
2022-05-10 15:04:34 -04:00
leticiars
6206ff5a1f [ExposedDropdownMenu] Added support for default/ripple background colors for the selected item of the exposed dropdown menu when the default MaterialAutoCompleteArrayAdapter is being used.
PiperOrigin-RevId: 447531152
2022-05-09 17:35:43 -04:00
conradchen
7b2f92443a [CleanUp][TextField] Remove TextInputLayout.getEditText() calls from EndIconDelegates
PiperOrigin-RevId: 446240046
2022-05-03 15:06:11 -04:00
conradchen
2c0e42f56a [TextField] Fix icon ripples go behind the edit text
On API 21 & 22, the borderless ripple will go behind the container view under certain conditions. Setting a mask when creating the ripple drawable to restrain the ripple inside view bounds somehow solves the issue.

PiperOrigin-RevId: 445920587
2022-05-02 09:52:55 -04:00
conradchen
1a42c743fe [CleanUp][TextField] Move drop-down background and ripple creation to TextInputLayout class
This CL also cleans up and fixes the edit text background setting logic - when the edit text is an autocomplete text view and provides its own background, we won't override the background by trying to add ripples to it.

Later they should be split again from the main class with other box-background-relevant logic.

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

PiperOrigin-RevId: 445486075
2022-05-02 09:19:04 -04:00
Material Design Team
940c8aafd8 Automated g4 rollback of changelist 444595599
PiperOrigin-RevId: 445446957
2022-04-29 14:34:16 -04:00
leticiars
0e4e44e8cd [TextInputLayout] Updated shape to use M3 attrs/styles.
PiperOrigin-RevId: 444647020
2022-04-27 10:09:51 -04:00
conradchen
e3bd856567 [TextField] Fix icon ripples go behind the edit text
On API 21 & 22, the borderless ripple will go behind the container view under certain conditions. Setting a mask when creating the ripple drawable to restrain the ripple inside view bounds somehow solves the issue.

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

PiperOrigin-RevId: 444595599
2022-04-26 14:09:24 -04:00
conradchen
431e291b01 [Translation] Update string translations
PiperOrigin-RevId: 443191056
2022-04-20 17:19:02 -04:00
pubiqq
3ca41be8f0 [General] Fix typos
Resolves https://github.com/material-components/material-components-android/pull/2654

GIT_ORIGIN_REV_ID=b8f6728979875629f2c813ef90d2f671cf56b4eb
PiperOrigin-RevId: 442852630
2022-04-19 14:48:55 -04:00
conradchen
a0e8c35470 [CleanUp][TextField] Create EndIconDelegate.deactivate() method and remove the relevant listener
PiperOrigin-RevId: 442846789
2022-04-19 13:57:46 -04:00