From 9b539cc584821761690d1065b309557265582bbf Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Wed, 14 Sep 2011 12:20:06 -0700 Subject: [PATCH] Polish of the accessibility settings. 1. Some string changes according to updated UX specs. 2. Explore by touch now shown only if accessibility is on. 3. The one time dialog for installing TalkBack if no services are installed was not showing. bug:5293099 bug:5286578 Change-Id: I633999f798b16e2910d95d541a7c33d1a4f296b9 --- res/values/strings.xml | 32 ++++++++++++------ res/xml/accessibility_settings.xml | 18 ++++++---- .../settings/AccessibilitySettings.java | 33 +++++++++++-------- 3 files changed, 53 insertions(+), 30 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index c59ba49d542..e54c260baed 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2741,10 +2741,16 @@ found in the list of installed applications. %1$s? - + %1$s can collect all of the text you type, except passwords. This includes personal data such as credit card - numbers. It can also collect data about your interactions with the device. + numbers. It can also collect data about your interactions with the tablet. + + + %1$s can + collect all of the text you type, except passwords. This includes personal data such as credit card + numbers. It can also collect data about your interactions with the phone. @@ -2755,16 +2761,20 @@ found in the list of installed applications. Touching OK will stop %1$s. + + No services installed + - No accessibility applications + Need a screen reader? - You don\'t have accessibility - applications installed. Do you want to download a screen reader from the Android Market? + TalkBack provides spoken feedback to + help blind and low-vision users. Do you want to install it for free from Android + Market? + when the user selects to enable script downloading. [CHAR LIMIT=50] --> Install accessibility scripts? @@ -2774,10 +2784,12 @@ found in the list of installed applications. This feature changes the way your device responds to touch. Turn on? - - This accessibility service has no - description.\n\nAccessibility services provide various types of feedback when you interact - with the device. + + This service has no + description.\n\nServices provide feedback when you interact with the tablet. + + This service has no + description.\n\nServices provide feedback when you interact with the phone. Settings diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml index bd054adf01f..45f1dce9651 100644 --- a/res/xml/accessibility_settings.xml +++ b/res/xml/accessibility_settings.xml @@ -30,22 +30,26 @@ + android:persistent="false" + android:order="1"/> + android:persistent="false" + android:order="2"/> + android:persistent="false" + android:order="3"/> + android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment" + android:order="4" > @@ -58,7 +62,8 @@ android:title="@string/accessibility_long_press_timeout_title" android:entries="@array/long_press_timeout_selector_titles" android:entryValues="@array/long_press_timeout_selector_values" - android:persistent="false"/> + android:persistent="false" + android:order="5"/> + android:persistent="false" + android:order="6"/> diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java index e87b3e820b1..f98ca7e4a50 100644 --- a/src/com/android/settings/AccessibilitySettings.java +++ b/src/com/android/settings/AccessibilitySettings.java @@ -153,6 +153,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements private Preference mToggleTouchExplorationPreference; private ListPreference mSelectLongPressTimeoutPreference; private AccessibilityEnableScriptInjectionPreference mToggleScriptInjectionPreference; + private Preference mNoServicesMessagePreference; private int mLongPressTimeoutDefault; @@ -376,7 +377,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements containerView.setGravity(Gravity.CENTER); TextView summaryView = (TextView) view.findViewById(R.id.summary); - String title = getString(R.string.accessibility_service_no_apps_title); + String title = getString(R.string.accessibility_no_services_installed); summaryView.setText(title); } }; @@ -389,8 +390,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } } - private Preference mNoServicesMessagePreference; - private void updateSystemPreferences() { // Large text. try { @@ -417,16 +416,22 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements mToggleAutoRotateScreenPreference.setChecked(autoRotationEnabled); // Touch exploration enabled. - final boolean touchExplorationEnabled = (Settings.Secure.getInt(getContentResolver(), - Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1); - if (touchExplorationEnabled) { - mToggleTouchExplorationPreference.setSummary( - getString(R.string.accessibility_service_state_on)); - mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, true); + if (AccessibilityManager.getInstance(getActivity()).isEnabled()) { + mSystemsCategory.addPreference(mToggleTouchExplorationPreference); + final boolean touchExplorationEnabled = (Settings.Secure.getInt(getContentResolver(), + Settings.Secure.TOUCH_EXPLORATION_ENABLED, 0) == 1); + if (touchExplorationEnabled) { + mToggleTouchExplorationPreference.setSummary( + getString(R.string.accessibility_service_state_on)); + mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, true); + } else { + mToggleTouchExplorationPreference.setSummary( + getString(R.string.accessibility_service_state_off)); + mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, false); + } + } else { - mToggleTouchExplorationPreference.setSummary( - getString(R.string.accessibility_service_state_off)); - mToggleTouchExplorationPreference.getExtras().putBoolean(EXTRA_CHECKED, false); + mSystemsCategory.removePreference(mToggleTouchExplorationPreference); } // Long press timeout. @@ -443,7 +448,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } private void offerInstallAccessibilitySerivceOnce() { - if (mServicesCategory.getPreferenceCount() > 0) { + // There is always one preference - if no services it is just a message. + if (mServicesCategory.getPreference(0) != mNoServicesMessagePreference) { return; } SharedPreferences preferences = getActivity().getPreferences(Context.MODE_PRIVATE); @@ -578,7 +584,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements // Enabling the first service enables accessibility. Settings.Secure.putInt(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 1); - } else if (length > 0) { enabledServices += ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR + preferenceKey; Settings.Secure.putString(getContentResolver(),