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
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
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
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-L1609https://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
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