diff options
| author | yingleiw <yingleiw@google.com> | 2019-12-16 15:11:26 -0800 |
|---|---|---|
| committer | yingleiw <yingleiw@google.com> | 2019-12-16 17:58:20 -0800 |
| commit | 6a55e06d96b5d7d6bd46a36f73a76dcbeef46aaf (patch) | |
| tree | 9b3f3542a537eff4c959c2ad69fe7a39da9efd73 /core/java/android/widget/Switch.java | |
| parent | 695bd671a3750c7d7ac03a06b155704644d13876 (diff) | |
Fix setting state description of toggle button and switch
We should set the state description whenever textOn and textOff are
updated. Setting it multiple times doesn't hurt because the
setStateDescription method won't do anything if the state description is
the same.
Test: tested with talkback test app. Without the change, a toggle button
with textOn and textOff set won't have them announced as the state
before a click happens. After the change, a toggle button with textOn
and textOff set has them announced as state.
Change-Id: Ia1cc6218c8cd0125c123c9b650bb4963825db23a
Diffstat (limited to 'core/java/android/widget/Switch.java')
| -rw-r--r-- | core/java/android/widget/Switch.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index ac2336c4a10f..fbd29ba2f592 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -309,6 +309,9 @@ public class Switch extends CompoundButton { // Refresh display with current params refreshDrawableState(); + // Default state is derived from on/off-text, so state has to be updated when on/off-text + // are updated. + setDefaultStateDescritption(); setChecked(isChecked()); } |
