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 were in 3.3.2 so doing a few changes from:
http://robolectric.org/migrating/
- Replaced RuntimeEnvironment.application with ApplicationProvider#getApplicationContext()
- Added android.enableUnitTestBinaryResources=true
This throws a warning but the release notes say that it can be safely ignored and will
be fixed in Gradle Plugin 3.4
- Removed @Config(manifest=...) from test
- Added dependencies.
- Added tools:overrideLibrary="androidx.test.core" to use a lower sdk
PiperOrigin-RevId: 226190528