Accessibility text contrast control
b/14624452 Change-Id: I0f6708680eb37cf8e7dc63cae56b639eaf7c8dbd
This commit is contained in:
@@ -3337,6 +3337,8 @@
|
|||||||
<string name="accessibility_global_gesture_preference_description">When this feature is turned on, you can quickly enable accessibility features in two steps:\n\nStep 1: Press and hold the power button until you hear a sound or feel a vibration.\n\nStep 2: Touch and hold two fingers until you hear audio confirmation.\n\nIf the device has multiple users, using this shortcut on the lock screen temporarily enables accessibility until the device is unlocked.</string>
|
<string name="accessibility_global_gesture_preference_description">When this feature is turned on, you can quickly enable accessibility features in two steps:\n\nStep 1: Press and hold the power button until you hear a sound or feel a vibration.\n\nStep 2: Touch and hold two fingers until you hear audio confirmation.\n\nIf the device has multiple users, using this shortcut on the lock screen temporarily enables accessibility until the device is unlocked.</string>
|
||||||
<!-- Title for the accessibility preference to enable large text. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference to enable large text. [CHAR LIMIT=35] -->
|
||||||
<string name="accessibility_toggle_large_text_preference_title">Large text</string>
|
<string name="accessibility_toggle_large_text_preference_title">Large text</string>
|
||||||
|
<!-- Title for the accessibility preference to high contrast text. [CHAR LIMIT=35] -->
|
||||||
|
<string name="accessibility_toggle_high_text_contrast_preference_title">High contrast text</string>
|
||||||
<!-- Title for the accessibility preference to enable screen magnification. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference to enable screen magnification. [CHAR LIMIT=35] -->
|
||||||
<string name="accessibility_toggle_screen_magnification_preference_title">Screen magnification</string>
|
<string name="accessibility_toggle_screen_magnification_preference_title">Screen magnification</string>
|
||||||
<!-- Title for the accessibility preference to auto update screen magnification. [CHAR LIMIT=35] -->
|
<!-- Title for the accessibility preference to auto update screen magnification. [CHAR LIMIT=35] -->
|
||||||
|
@@ -42,6 +42,11 @@
|
|||||||
android:title="@string/accessibility_toggle_large_text_preference_title"
|
android:title="@string/accessibility_toggle_large_text_preference_title"
|
||||||
android:persistent="false"/>
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="toggle_high_text_contrast_preference"
|
||||||
|
android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
|
||||||
|
android:persistent="false"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="toggle_power_button_ends_call_preference"
|
android:key="toggle_power_button_ends_call_preference"
|
||||||
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
|
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
|
||||||
|
@@ -78,6 +78,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
// Preferences
|
// Preferences
|
||||||
private static final String TOGGLE_LARGE_TEXT_PREFERENCE =
|
private static final String TOGGLE_LARGE_TEXT_PREFERENCE =
|
||||||
"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 =
|
private static final String TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE =
|
||||||
"toggle_power_button_ends_call_preference";
|
"toggle_power_button_ends_call_preference";
|
||||||
private static final String TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE =
|
private static final String TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE =
|
||||||
@@ -182,6 +184,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
private PreferenceCategory mSystemsCategory;
|
private PreferenceCategory mSystemsCategory;
|
||||||
|
|
||||||
private CheckBoxPreference mToggleLargeTextPreference;
|
private CheckBoxPreference mToggleLargeTextPreference;
|
||||||
|
private CheckBoxPreference mToggleHighTextContrastPreference;
|
||||||
private CheckBoxPreference mTogglePowerButtonEndsCallPreference;
|
private CheckBoxPreference mTogglePowerButtonEndsCallPreference;
|
||||||
private CheckBoxPreference mToggleLockScreenRotationPreference;
|
private CheckBoxPreference mToggleLockScreenRotationPreference;
|
||||||
private CheckBoxPreference mToggleSpeakPasswordPreference;
|
private CheckBoxPreference mToggleSpeakPasswordPreference;
|
||||||
@@ -246,6 +249,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
if (mToggleLargeTextPreference == preference) {
|
if (mToggleLargeTextPreference == preference) {
|
||||||
handleToggleLargeTextPreferenceClick();
|
handleToggleLargeTextPreferenceClick();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (mToggleHighTextContrastPreference == preference) {
|
||||||
|
handleToggleTextContrastPreferenceClick();
|
||||||
|
return true;
|
||||||
} else if (mTogglePowerButtonEndsCallPreference == preference) {
|
} else if (mTogglePowerButtonEndsCallPreference == preference) {
|
||||||
handleTogglePowerButtonEndsCallPreferenceClick();
|
handleTogglePowerButtonEndsCallPreferenceClick();
|
||||||
return true;
|
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() {
|
private void handleTogglePowerButtonEndsCallPreferenceClick() {
|
||||||
Settings.Secure.putInt(getContentResolver(),
|
Settings.Secure.putInt(getContentResolver(),
|
||||||
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
|
Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
|
||||||
@@ -325,6 +337,10 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
|||||||
mToggleLargeTextPreference =
|
mToggleLargeTextPreference =
|
||||||
(CheckBoxPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);
|
(CheckBoxPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);
|
||||||
|
|
||||||
|
// Text contrast.
|
||||||
|
mToggleHighTextContrastPreference =
|
||||||
|
(CheckBoxPreference) findPreference(TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE);
|
||||||
|
|
||||||
// Power button ends calls.
|
// Power button ends calls.
|
||||||
mTogglePowerButtonEndsCallPreference =
|
mTogglePowerButtonEndsCallPreference =
|
||||||
(CheckBoxPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE);
|
(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);
|
mToggleLargeTextPreference.setChecked(mCurConfig.fontScale == LARGE_FONT_SCALE);
|
||||||
|
|
||||||
|
mToggleHighTextContrastPreference.setChecked(
|
||||||
|
AccessibilityManager.getInstance(getActivity()).isHighTextContrastEnabled());
|
||||||
|
|
||||||
// Power button ends calls.
|
// Power button ends calls.
|
||||||
if (KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
|
if (KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
|
||||||
&& Utils.isVoiceCapable(getActivity())) {
|
&& Utils.isVoiceCapable(getActivity())) {
|
||||||
|
Reference in New Issue
Block a user