material-components / material-components/material-components-android
[MaterialSwitch] Support for processing state
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Support processing state drawable for thumb as suggested in [material docs](https://m2.material.io/components/selection-controls#switches). This helps with business logic where a request can't be processed immediately and has some user noticeable latency like network requests.
**Describe the solution you'd like**
API to specify processing state drawable (to be drawn over thumb). It would be nice to support default processing drawable.
API to indicate processing state when calling setChecked for both on and off states
```
setChecked(true, true) -> On state and loading
setChecked(true, false) -> On state
setChecked(false, true) -> Off state and loading
setChecked(false, false) -> Off state
```
**Describe alternatives you've considered**
**Additional context**
https://user-images.githubusercontent.com/1020585/234715458-f114e73e-0d1a-41c8-93d8-01247c6ae01a.mov
We also happily accept [pull requests](https://github.com/material-components/material-components-android/pulls).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the MaterialSwitch component and its existing setChecked entry point, then trace how the thumb drawable and checked-state changes are handled. Define the processing drawable and loading behavior for the four setChecked combinations described in the issue, while preserving the normal on and off visuals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- design, mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100