OSDN Git Service

Polish of the accessibility settings.
authorSvetoslav Ganov <svetoslavganov@google.com>
Wed, 14 Sep 2011 19:20:06 +0000 (12:20 -0700)
committerSvetoslav Ganov <svetoslavganov@google.com>
Wed, 14 Sep 2011 19:26:33 +0000 (12:26 -0700)
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
res/xml/accessibility_settings.xml
src/com/android/settings/AccessibilitySettings.java

index c59ba49..e54c260 100644 (file)
@@ -2741,10 +2741,16 @@ found in the list of installed applications.</string>
          <xliff:g id="service" example="TalkBack">%1$s</xliff:g>?</string>
     <!-- Summary for a warning message about security implications of enabling an accessibility service,
          displayed as a dialog message when the user selects to enable an accessibility service (tablet). [CHAR LIMIT=NONE] -->
-    <string name="accessibility_service_security_warning_summary">
+    <string name="accessibility_service_security_warning_summary" product="tablet">
             <xliff:g id="accessibility_service_name">%1$s</xliff:g> 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.</string>
+            numbers. It can also collect data about your interactions with the tablet.</string>
+    <!-- Summary for a warning message about security implications of enabling an accessibility service,
+         displayed as a dialog message when the user selects to enable an accessibility service (phone). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_service_security_warning_summary" product="default">
+            <xliff:g id="accessibility_service_name">%1$s</xliff:g> 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.</string>
 
     <!-- Title for a warning about disabling an accessibility service displayed as a dialog message when the user
          selects to disable that service. This avoids accidental disabling. [CHAR LIMIT=NONE] -->
@@ -2755,16 +2761,20 @@ found in the list of installed applications.</string>
     <string name="accessibility_service_disable_warning_summary">Touching OK will
         stop <xliff:g id="service" example="TalkBack">%1$s</xliff:g>.</string>
 
+    <!-- Title for the prompt shown as a placeholder if no accessibility serivices are installed. [CHAR LIMIT=50] -->
+    <string name="accessibility_no_services_installed">No services installed</string>
+
     <!-- Title for the prompt that lets users know that they have no accessibility related apps
          installed and that they can install TalkBack from Market. [CHAR LIMIT=50] -->
-    <string name="accessibility_service_no_apps_title">No accessibility applications</string>
+    <string name="accessibility_service_no_apps_title">Need a screen reader?</string>
     <!-- Message for the prompt that lets users know that they have no accessibility related apps
          installed and that they can install TalkBack from Market. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_service_no_apps_message">You don\'t have accessibility
-        applications installed. Do you want to download a screen reader from the Android Market?</string>
+    <string name="accessibility_service_no_apps_message">TalkBack provides spoken feedback to
+         help blind and low-vision users. Do you want to install it for free from Android
+         Market?</string>
 
     <!-- Title for a warning about downloading accessibility scripts displayed as a dialog message
-         when the user selects to enable script downloading. [CHAR LIMIT=40] -->
+         when the user selects to enable script downloading. [CHAR LIMIT=50] -->
     <string name="accessibility_script_injection_security_warning_title">Install accessibility scripts?</string>
     <!-- Warning message about security implications of downloading accessibility scripts,
          displayed as a dialog message when the user selects to enable script downloading. [CHAR LIMIT=NONE] -->
@@ -2774,10 +2784,12 @@ found in the list of installed applications.</string>
     <!-- Warning message that the interaction model changes on enabling touch exploration. [CHAR LIMIT=NONE] -->
     <string name="accessibility_touch_exploration_warning">This feature changes the
         way your device responds to touch. Turn on?</string>
-    <!-- Default description for an accessiiblity serivice if the latter doesn't provide one. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_service_default_description">This accessibility service has no
-        description.\n\nAccessibility services provide various types of feedback when you interact
-        with the device. </string>
+    <!-- Default description for an accessibility serivice if the latter doesn't provide one (tablet). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_service_default_description" product="tablet">This service has no
+        description.\n\nServices provide feedback when you interact with the tablet.</string>
+    <!-- Default description for an accessibility serivice if the latter doesn't provide one (phone). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_service_default_description" product="default">This service has no
+        description.\n\nServices provide feedback when you interact with the phone.</string>
 
     <!-- Accessibility settings: button for lauching settings for an accessibility service -->
     <string name="settings_button">Settings</string>
index bd054ad..45f1dce 100644 (file)
         <CheckBoxPreference
                 android:key="toggle_large_text_preference"
                 android:title="@string/accessibility_toggle_large_text_title"
-                android:persistent="false"/>
+                android:persistent="false"
+                android:order="1"/>
 
         <CheckBoxPreference
                 android:key="toggle_power_button_ends_call_preference"
                 android:title="@string/accessibility_power_button_ends_call_title"
-                android:persistent="false"/>
+                android:persistent="false"
+                android:order="2"/>
 
         <CheckBoxPreference
                 android:key="toggle_auto_rotate_screen_preference"
                 android:title="@string/accelerometer_title"
-                android:persistent="false"/>
+                android:persistent="false"
+                android:order="3"/>
 
         <PreferenceScreen
                 android:key="toggle_touch_exploration_preference"
                 android:title="@string/accessibility_touch_exploration_title"
-                android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment" >
+                android:fragment="com.android.settings.AccessibilitySettings$ToggleTouchExplorationFragment"
+                android:order="4" >
                 <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" />
@@ -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"/>
 
         <com.android.settings.AccessibilityEnableScriptInjectionPreference
                 android:key="toggle_script_injection_preference"
@@ -68,7 +73,8 @@
                 android:dialogMessage="@string/accessibility_script_injection_security_warning_summary"
                 android:positiveButtonText="@string/accessibility_script_injection_button_allow"
                 android:negativeButtonText="@string/accessibility_script_injection_button_disallow"
-                android:persistent="false"/>
+                android:persistent="false"
+                android:order="6"/>
 
     </PreferenceCategory>
 
index e87b3e8..f98ca7e 100644 (file)
@@ -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(),