diff options
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/accessibility_settings.xml | 12 | ||||
-rw-r--r-- | src/com/android/settings/AccessibilitySettings.java | 20 |
3 files changed, 31 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 9218b5f..6355c88 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2762,6 +2762,8 @@ found in the list of installed apps.</string> <string name="accessibility_toggle_large_text_title">Large text</string> <!-- Title for the accessibility preference to power button to end a call. [CHAR LIMIT=35] --> <string name="accessibility_power_button_ends_call_title">Power button ends call</string> + <!-- Title for the accessibility preference to speak passwords. [CHAR LIMIT=35] --> + <string name="accessibility_speak_password_title">Speak passwords</string> <!-- Title for accessibility preference to enable touch exploration mode. [CHAR LIMIT=35] --> <string name="accessibility_touch_exploration_title">Explore by touch</string> <!-- Summary for accessibility of the touch exploration mode. [CHAR LIMIT=NONE] --> diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml index acb14ac..88f6491 100644 --- a/res/xml/accessibility_settings.xml +++ b/res/xml/accessibility_settings.xml @@ -45,11 +45,17 @@ android:persistent="false" android:order="3"/> + <CheckBoxPreference + android:key="toggle_speak_password_preference" + android:title="@string/accessibility_speak_password_title" + android:persistent="false" + android:order="4"/> + <PreferenceScreen android:key="toggle_touch_exploration_preference" android:title="@string/accessibility_touch_exploration_title" android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment" - android:order="4" > + android:order="5" > <extra android:name="title" android:value="@string/accessibility_touch_exploration_title" /> <extra android:name="summary" android:value="@string/accessibility_touch_exploration_summary" /> <extra android:name="enable_warning_title" android:value="@android:string/dialog_alert_title" /> @@ -63,7 +69,7 @@ android:entries="@array/long_press_timeout_selector_titles" android:entryValues="@array/long_press_timeout_selector_values" android:persistent="false" - android:order="5"/> + android:order="6"/> <!-- We want a dialog with no title, so use an empty string to avoid a fall back to the preference title. --> <com.android.settings.AccessibilityEnableScriptInjectionPreference @@ -75,7 +81,7 @@ android:positiveButtonText="@string/accessibility_script_injection_button_allow" android:negativeButtonText="@string/accessibility_script_injection_button_disallow" android:persistent="false" - android:order="6"/> + android:order="7"/> </PreferenceCategory> diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java index 9aabe21..827af13 100644 --- a/src/com/android/settings/AccessibilitySettings.java +++ b/src/com/android/settings/AccessibilitySettings.java @@ -108,6 +108,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements "toggle_power_button_ends_call_preference"; private static final String TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE = "toggle_auto_rotate_screen_preference"; + private static final String TOGGLE_SPEAK_PASSWORD_PREFERENCE = + "toggle_speak_password_preference"; private static final String TOGGLE_TOUCH_EXPLORATION_PREFERENCE = "toggle_touch_exploration_preference"; private static final String SELECT_LONG_PRESS_TIMEOUT_PREFERENCE = @@ -159,6 +161,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements private CheckBoxPreference mToggleLargeTextPreference; private CheckBoxPreference mTogglePowerButtonEndsCallPreference; private CheckBoxPreference mToggleAutoRotateScreenPreference; + private CheckBoxPreference mToggleSpeakPasswordPreference; private Preference mToggleTouchExplorationPreference; private ListPreference mSelectLongPressTimeoutPreference; private AccessibilityEnableScriptInjectionPreference mToggleScriptInjectionPreference; @@ -213,6 +216,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } else if (mToggleAutoRotateScreenPreference == preference) { handleToggleAutoRotateScreenPreferenceClick(); return true; + } else if (mToggleSpeakPasswordPreference == preference) { + handleToggleSpeakPasswordPreferenceClick(); } return super.onPreferenceTreeClick(preferenceScreen, preference); } @@ -248,6 +253,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } } + private void handleToggleSpeakPasswordPreferenceClick() { + Settings.Secure.putInt(getContentResolver(), + Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, + mToggleSpeakPasswordPreference.isChecked() ? 1 : 0); + } + private void initializeAllPreferences() { mServicesCategory = (PreferenceCategory) findPreference(SERVICES_CATEGORY); mSystemsCategory = (PreferenceCategory) findPreference(SYSTEM_CATEGORY); @@ -268,6 +279,10 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements mToggleAutoRotateScreenPreference = (CheckBoxPreference) findPreference(TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE); + // Speak passwords. + mToggleSpeakPasswordPreference = + (CheckBoxPreference) findPreference(TOGGLE_SPEAK_PASSWORD_PREFERENCE); + // Touch exploration enabled. mToggleTouchExplorationPreference = findPreference(TOGGLE_TOUCH_EXPLORATION_PREFERENCE); @@ -427,6 +442,11 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements Settings.System.ACCELEROMETER_ROTATION, 0) != 0; mToggleAutoRotateScreenPreference.setChecked(autoRotationEnabled); + // Speak passwords. + final boolean speakPasswordEnabled = Settings.Secure.getInt(getContentResolver(), + Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) != 0; + mToggleSpeakPasswordPreference.setChecked(speakPasswordEnabled); + // Touch exploration enabled. if (AccessibilityManager.getInstance(getActivity()).isEnabled()) { mSystemsCategory.addPreference(mToggleTouchExplorationPreference); |