From fd3911ba29a136cb6310442d825be389d3c8fd37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pomini?= Date: Mon, 14 Nov 2022 15:28:00 +0000 Subject: [PATCH] Add discrete contrast UI slider in the setting This slider is temporary and will be replaced by the final UI in the next couple weeks. In this first version, the slider is added in Settings -> Accessibility -> Color and motion. It is discrete with three values. The slider manipulates the setting currently named CONTRAST_LEVEL in Settings.Secure. This setting is ranging from [-1, 1] with a default value of 0. However, the three values of the slider correspond to the contrast values [0, 0.5, 1] respectively Test: Manual: put a log before Settings.System.putFloatForUser, move the slider manually and verify the logs Test: make RunSettingsRoboTests ROBOTEST_FILTER=ContrastLevelSeekBar Bug: 259091608 Change-Id: I2eaf751d6008ad20b3564dde2c0f4648cc6c8178 --- .../preference_contrast_level_slider.xml | 104 +++++++++++++++ res/values/dimens.xml | 4 + res/values/strings.xml | 6 + res/xml/accessibility_color_and_motion.xml | 5 + .../accessibility/ContrastLevelSeekBar.java | 118 ++++++++++++++++++ .../ContrastLevelSeekBarPreference.java | 73 +++++++++++ .../ContrastLevelSeekBarPreferenceTest.java | 69 ++++++++++ .../ContrastLevelSeekBarTest.java | 106 ++++++++++++++++ 8 files changed, 485 insertions(+) create mode 100644 res/layout/preference_contrast_level_slider.xml create mode 100644 src/com/android/settings/accessibility/ContrastLevelSeekBar.java create mode 100644 src/com/android/settings/accessibility/ContrastLevelSeekBarPreference.java create mode 100644 tests/robotests/src/com/android/settings/accessibility/ContrastLevelSeekBarPreferenceTest.java create mode 100644 tests/robotests/src/com/android/settings/accessibility/ContrastLevelSeekBarTest.java diff --git a/res/layout/preference_contrast_level_slider.xml b/res/layout/preference_contrast_level_slider.xml new file mode 100644 index 00000000000..1766dd7f2ee --- /dev/null +++ b/res/layout/preference_contrast_level_slider.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 2fc6247c32e..2707d069e9e 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -220,6 +220,10 @@ 20dp 27dp + + 14dp + 1dp + 16dp diff --git a/res/values/strings.xml b/res/values/strings.xml index 7466b143c90..17949323a3c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4213,6 +4213,12 @@ Remove animations Reduce movement on the screen + + Contrast Level + + Standard + + High Mono audio diff --git a/res/xml/accessibility_color_and_motion.xml b/res/xml/accessibility_color_and_motion.xml index a3135261a9a..72c67f93778 100644 --- a/res/xml/accessibility_color_and_motion.xml +++ b/res/xml/accessibility_color_and_motion.xml @@ -64,6 +64,11 @@ android:title="@string/accessibility_toggle_large_pointer_icon_title" settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/> + +