From fc72424cd7c3bbb6d45afb77e5ffb619d38ef641 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Wed, 16 Jul 2014 15:13:17 -0700 Subject: Accessibility text contrast control b/14624452 Change-Id: I0f6708680eb37cf8e7dc63cae56b639eaf7c8dbd --- .../settings/accessibility/AccessibilitySettings.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/com/android') diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java index b11629057..f035d7b4c 100644 --- a/src/com/android/settings/accessibility/AccessibilitySettings.java +++ b/src/com/android/settings/accessibility/AccessibilitySettings.java @@ -78,6 +78,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements // Preferences private static final String TOGGLE_LARGE_TEXT_PREFERENCE = "toggle_large_text_preference"; + private static final String TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE = + "toggle_high_text_contrast_preference"; private static final String TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE = "toggle_power_button_ends_call_preference"; private static final String TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE = @@ -182,6 +184,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements private PreferenceCategory mSystemsCategory; private CheckBoxPreference mToggleLargeTextPreference; + private CheckBoxPreference mToggleHighTextContrastPreference; private CheckBoxPreference mTogglePowerButtonEndsCallPreference; private CheckBoxPreference mToggleLockScreenRotationPreference; private CheckBoxPreference mToggleSpeakPasswordPreference; @@ -246,6 +249,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements if (mToggleLargeTextPreference == preference) { handleToggleLargeTextPreferenceClick(); return true; + } else if (mToggleHighTextContrastPreference == preference) { + handleToggleTextContrastPreferenceClick(); + return true; } else if (mTogglePowerButtonEndsCallPreference == preference) { handleTogglePowerButtonEndsCallPreferenceClick(); return true; @@ -274,6 +280,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } } + private void handleToggleTextContrastPreferenceClick() { + Settings.Secure.putInt(getContentResolver(), + Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, + (mToggleHighTextContrastPreference.isChecked() ? 1 : 0)); + } + private void handleTogglePowerButtonEndsCallPreferenceClick() { Settings.Secure.putInt(getContentResolver(), Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR, @@ -325,6 +337,10 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements mToggleLargeTextPreference = (CheckBoxPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE); + // Text contrast. + mToggleHighTextContrastPreference = + (CheckBoxPreference) findPreference(TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE); + // Power button ends calls. mTogglePowerButtonEndsCallPreference = (CheckBoxPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE); @@ -493,6 +509,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } mToggleLargeTextPreference.setChecked(mCurConfig.fontScale == LARGE_FONT_SCALE); + mToggleHighTextContrastPreference.setChecked( + AccessibilityManager.getInstance(getActivity()).isHighTextContrastEnabled()); + // Power button ends calls. if (KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER) && Utils.isVoiceCapable(getActivity())) { -- cgit v1.2.3