commit | 17bc9141675899028a9ec09818832985017635ce | [log] [tgz] |
---|---|---|
author | Chuck Liao <chuckliao@google.com> | Fri Dec 03 19:19:34 2021 +0800 |
committer | Chuck Liao <chuckliao@google.com> | Mon Dec 06 15:21:21 2021 +0800 |
tree | ff4e6e073bf21ebd6233a6db76f3b8a127dbd194 | |
parent | d83335057d50f64dc03580c910aa90af5b5b7ca6 [diff] |
Let Talkback announce to the user when changing dark/light theme Screenshot: https://screenshot.googleplex.com/B42zbNsdsA8AC23.png Video: https://drive.google.com/file/d/10rUKU76GpsJie8B9UFlFC_PckNX0LPlE/view?usp=sharing&resourcekey=0-N9fOs-f6WYVpfg5_3zQOww Bug: 207738704 Test: manual Change-Id: I361cd216f752886e8e2aa9b6ba6545517ba4f31a
diff --git a/res/values/strings.xml b/res/values/strings.xml index 0ea2f7e..3f9b2bb 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml
@@ -237,6 +237,8 @@ <!-- The title of mode section view. [CHAR_LIMIT=20] --> <string name="mode_title" msgid="1000319159005403986">Dark theme</string> <string name="mode_disabled_msg" msgid="1926077857799715086">Temporarily disabled due to Battery Saver</string> + <!-- The text for A11y announcement when theme changes. --> + <string name="mode_changed">Theme changed</string> <!-- Title of a section of the customization where the user can select color override for icon. [CHAR LIMIT=30] --> <string name="themed_icon_title" msgid="4305612684940220645">Themed icons</string>
diff --git a/src/com/android/customization/model/mode/DarkModeSectionController.java b/src/com/android/customization/model/mode/DarkModeSectionController.java index 382162e..f56b709 100644 --- a/src/com/android/customization/model/mode/DarkModeSectionController.java +++ b/src/com/android/customization/model/mode/DarkModeSectionController.java
@@ -128,7 +128,11 @@ UiModeManager uiModeManager = context.getSystemService(UiModeManager.class); int shortDelay = context.getResources().getInteger(android.R.integer.config_shortAnimTime); new Handler(Looper.getMainLooper()).postDelayed( - () -> uiModeManager.setNightModeActivated(viewActivated), + () -> { + mDarkModeSectionView.announceForAccessibility( + context.getString(R.string.mode_changed)); + uiModeManager.setNightModeActivated(viewActivated); + }, /* delayMillis= */ shortDelay); }