125 Commits

Author SHA1 Message Date
conradchen
413a047957 [ChipGroup] Fix ChipGroup.getCheckedChipIds() returns wrong state
In the Chip implementation, onCheckedChangeListener was called before onCheckedChangeListenerInternal. This causes an issue that in onCheckedChangeListener's callback, the checkable group's checked state is not updated yet, therefore ChipGroup.getCheckedChipIds() will return the outdated checked state.

Fixes this by overriding Chip.setOnCheckedChangeListener to get full control of the execution order between onCheckedChangeListener and onCheckedChangeListenerInternal.

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

PiperOrigin-RevId: 449100861
2022-05-17 11:04:03 -04:00
pfthomas
d4c2c95490 [Chip][a11y] Make multi-selection Chips announced as Buttons
PiperOrigin-RevId: 447993125
2022-05-11 14:58:44 -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
788866e448 [Chip] Fix chip layout not updated when programmatically setting text size
We didn't forward Chip.setTextSize() call properly to ChipDrawable.setTextSize(). Fixes this by properly overriding the method.

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

PiperOrigin-RevId: 442056225
2022-04-15 14:18:11 -04:00
pfthomas
a51d1dcb68 [MaterialTimePicker][a11y] Update accessibility className used for hour/minute Chips
PiperOrigin-RevId: 436207977
2022-03-21 18:53:24 +00:00
conradchen
f3c6430f94 [ChipGroup] Refactor chip group selection logic to a standalone class
This CL pulls out the checkable group logic to a standalone class, which can be shared by different UX components. It also makes chip groups support multiple selection better with introducing a new listener based on the multiple selection and deprecates the old listener which only supports single selection.

PiperOrigin-RevId: 427204476
2022-02-09 15:55:24 +00:00
jeremymuhia
90787bf0e0 [TextAppearance] fix drawables not applying system level bold
PiperOrigin-RevId: 421066050
2022-01-12 11:21:15 -05:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
pfthomas
c6be59ce8b [Chip][a11y] Fix system level bold not applied
PiperOrigin-RevId: 408609073
2021-11-10 16:02:22 -05:00
dsn5ft
9ae56ceedd [Javadocs] Remove all broken attr links from Javadocs
PiperOrigin-RevId: 404246710
2021-10-20 19:06:18 +00:00
conradchen
37bb2efb38 [Chip] Rollback workaround of ExploreByTouchHelper bug
The original bug has been fixed.

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

PiperOrigin-RevId: 397813859
2021-09-21 08:07:41 -07:00
conradchen
7085319b35 [Chip] Fix touching cannot put focus on chips with Talkback
We disabled ChipTouchHelper on purpose to workaround a Talkback issue but we didn't stop forwarding touch/hover events to ChipTouchHelper, which cause some Talkback logic work incorrectly on certain API levels.

Adds a state variable to avoid using ChipTouchHelper when it's not registered as accessibility delegate to solve the issue.

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

PiperOrigin-RevId: 383911836
2021-07-12 19:41:11 +00:00
conradchen
31ca1106ab [Chip] Report a11y class name as RadioButton in single selection mode
Also consolidates the logic of reporting a11y class name.

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

PiperOrigin-RevId: 383849367
2021-07-12 19:38:32 +00:00
isabellekim
738cccb433 [Chip] Update javadocs @see methods to match the actual methods.
PiperOrigin-RevId: 344160354
2020-11-25 10:28:33 -05:00
connieshi
93f4f161cd [Chip] If a close icon is purely decorative (e.g. no closeIconClickListener is specified), the close icon should not intercept the click and instead let the superclass manages the touch event for the overall chip.
PiperOrigin-RevId: 338260731
2020-10-21 15:51:08 -07:00
connieshi
8544f7acc2 [Chip] Include font padding.
Resolves https://github.com/material-components/material-components-android/issues/1424

PiperOrigin-RevId: 318817230
2020-06-29 16:17:12 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Material Design Team
76ffe35fef Cleanup
PiperOrigin-RevId: 313865830
2020-06-01 16:52:06 -04:00
Rafael
45f59032c8 [Chip]Fix chip icon with different width and height
Resolves https://github.com/material-components/material-components-android/pull/1242

GIT_ORIGIN_REV_ID=2c843f543245ac17327cbc55566eb3f8098d9082
Co-authored-by: wcshi <38438920+wcshi@github.com>
PiperOrigin-RevId: 309745804
2020-05-04 11:42:31 -04:00
connieshi
0687ca80b0 Fix javadocs errors in Chip and ChipDrawable.
PiperOrigin-RevId: 300592847
2020-03-13 11:11:29 -04:00
Material Design Team
5213b46edd [Chip] Support setting checked icon's tint via xml attribute
PiperOrigin-RevId: 299429881
2020-03-09 10:45:57 -07:00
connieshi
ded0c3ff61 Initialize chipCornerRadius to -1 instead of 0 so it would not ignore a user who sets the corner radius to 0.
Resolves https://github.com/material-components/material-components-android/issues/1058

PiperOrigin-RevId: 297422651
2020-02-27 15:49:57 -05:00
isabellekim
1f9de68025 [All] Add support for materialThemeOverlay
Resolves https://github.com/material-components/material-components-android/pull/948

GIT_ORIGIN_REV_ID=5a8bb35a56c1b813df47d964de8482a26e0da66d
PiperOrigin-RevId: 293839172
2020-02-10 09:55:19 -05:00
Material Design Team
253cdc2114 Add CollectionInfos and CollectionItemInfos to ChipGroup and Chip for accessibility.
PiperOrigin-RevId: 288944549
2020-01-10 09:05:36 -08:00
Material Design Team
ba8e18ea62 Fix RTL padding issue on Chips.
PiperOrigin-RevId: 288737367
2020-01-08 12:11:28 -08:00
dniz
d72f3bc7d0 Remove log line from Chip
PiperOrigin-RevId: 286572627
2019-12-21 08:48:40 -05:00
connieshi
a3204758f9 Fix chip text mis-alignment when its width is less than the minimum recommended touch target width.
Resolves https://github.com/material-components/material-components-android/issues/800

PiperOrigin-RevId: 286421752
2019-12-19 15:46:43 -05:00
connieshi
2a9c3f3ad1 Automated g4 rollback of changelist 283714901
PiperOrigin-RevId: 283801062
2019-12-05 14:45:24 -05:00
connieshi
415628f1cd Automated g4 rollback of changelist 283621202
PiperOrigin-RevId: 283714901
2019-12-05 14:37:46 -05:00
connieshi
e3be6b0e85 Support setting textAllCaps in textAppearance xml, switch from calling setSingleLine to setLines(1) so the transformation methods don't replace each other.
android:textAllCaps="true" in the layout xml is being ignored because:

1) A known issue where Chip only reads from its textappearance. However, even after creating a custom textappearance that sets textAllCaps to true, I'm observing an odd behavior:
if I comment out the setSingleLine method call in the constructor, then the text becomes all caps. If I comment setSingleLine back in and call setAllCaps, then the text becomes capitalized and single line.

I think it's related to two different transformation methods being applied. The one inside setsingleline clobbers the one set by setAllCaps.

TextView's constructor applies the singleLine transformation before applying text appearance attributes
https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/widget/TextView.java#L1570-L1609

https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/widget/TextView.java#L10232

2) The library implementation of TextAppearance reads from "textAllCaps" instead of "android:textAllCaps".
11c57abbd6/lib/java/com/google/android/material/resources/TextAppearance.java (L96)
However, if you call Chip#setTextAppearance(@StyleRes int id) which passes it the super method, then "android:textAllCaps" needs to be set because "textAllCaps" is ignored
::sigh::

PiperOrigin-RevId: 283621202
2019-12-05 14:33:18 -05:00
Material Design Team
bb72e50930 Automated g4 rollback of changelist 281530369
PiperOrigin-RevId: 281569140
2019-11-22 21:24:02 +00:00
Material Design Team
32362bed3d Automated g4 rollback of changelist 281519201
PiperOrigin-RevId: 281530369
2019-11-22 21:23:01 +00:00
connieshi
39e62ec220 Remove attrs check inside Chip#initMinTarget because the current context's theme may have custom values.
PiperOrigin-RevId: 281519201
2019-11-20 14:40:33 -05:00
connieshi
b58d3481c3 Restore padding after #setRippleColor update a chip's background.
PiperOrigin-RevId: 278660797
2019-11-06 10:18:27 -05:00
ldjesper
294f12498d Rename setCornerRadius to setAllCornerSizes
PiperOrigin-RevId: 272959729
2019-10-04 20:08:43 -04:00
connieshi
c1c55475f3 Suppress ClickableViewAccessibility lint error in Chip#onTouchEvent.
PiperOrigin-RevId: 271128148
2019-09-26 17:55:16 -04:00
connieshi
461e7f9be8 Remove obsolete todo.
PiperOrigin-RevId: 268932308
2019-09-18 14:07:33 -04:00
connieshi
a6106e12b2 When a chip's close icon is purely decorative (i.e. no onCloseIconClickLisetener is set), avoid setting custom accessibility delegate.
PiperOrigin-RevId: 268904579
2019-09-18 14:03:37 -04:00
marianomartin
215a839598 Internal cleanup
PiperOrigin-RevId: 267504117
2019-09-12 13:48:16 -04:00
cketcham
7bb525ff59 Update usages of ShapeAppearanceModel to use Builder pattern
PiperOrigin-RevId: 266144471
2019-08-29 15:39:51 -04:00
marianomartin
0d4515cb46 Internal cleanup
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
Material Design Team
79953b02e3 if we don't set anything, talkback will announce it as checkbox because this class extends AppCompatCheckBox. This fix set the class name to be generic android view so nothing is announced if view is not checkable or clickable
PiperOrigin-RevId: 265746456
2019-08-29 12:19:52 -04:00
cketcham
3021dc0ac8 Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 264856214
2019-08-26 11:41:00 -04:00
connieshi
238fad4560 Update Chip's AccessibilityDelegate to avoid setting classname /type description when chip is not clickable or checkable.
PiperOrigin-RevId: 264676607
2019-08-26 11:12:38 -04:00
connieshi
a6f066c0bf Chip is an unsupported item type according to Accessibility Scanner.
Set the class name on chip's AccessibilityNodeInfo as either android.widget.Button or android.widget.CompoundButton depending on whether chip is checkable.

PiperOrigin-RevId: 263424377
2019-08-16 16:12:47 -04:00
dniz
cc73c2a630 Update TODOs
PiperOrigin-RevId: 259535844
2019-07-23 11:21:39 -04:00
marianomartin
0a5d66ffc0 Internal cleanup
PiperOrigin-RevId: 257802841
2019-07-15 19:07:26 -04:00
marianomartin
164bf0fabd Internal cleanup
PiperOrigin-RevId: 255609320
2019-07-03 14:02:53 -04:00
dniz
5df3bebd63 Update elevation overlays to be based absolute elevation, factoring in the elevation of all parent views
Will follow-up with TabLayout absolute elevation separately

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

PiperOrigin-RevId: 255404830
2019-07-03 13:55:49 -04:00
isabellekim
bee37933f4 Update chips to support state_checkable.
PiperOrigin-RevId: 255186618
2019-06-26 11:22:10 -04:00