summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Chen <clchen@google.com>2009-11-10 14:05:41 -0800
committerCharles Chen <clchen@google.com>2009-11-16 15:28:31 -0800
commit05b08a50f86a91ab2db6b7e47febadc593972609 (patch)
tree8f62abbf62973f7b3d1a22abeb5729cc25994c21
parent51004fbf7f30bbc7a90b54faadbb2b5a2bbe2c04 (diff)
downloadpackages_apps_settings-05b08a50f86a91ab2db6b7e47febadc593972609.zip
packages_apps_settings-05b08a50f86a91ab2db6b7e47febadc593972609.tar.gz
packages_apps_settings-05b08a50f86a91ab2db6b7e47febadc593972609.tar.bz2
Adding a prompt to help users download Talkback
(Google's open source screen reader) if they go to the Accessibility settings screen and do not have any accessibility tools installed. This is a fix for bug #2250279
-rw-r--r--res/values/strings.xml10
-rw-r--r--src/com/android/settings/AccessibilitySettings.java50
2 files changed, 60 insertions, 0 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5bbe03d..dce66db 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1752,6 +1752,16 @@ found in the list of installed applications.</string>
<!-- Warning about disabling accessibility displayed as a dialog message when the user
selects to disable accessibility. This avoids accidental disabling. -->
<string name="accessibility_service_disable_warning">Disable accessibility?</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. -->
+ <string name="accessibility_service_no_apps_title">No accessibility related applications found
+ </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. -->
+ <string name="accessibility_service_no_apps_message">You do not have any accessibility related
+ applications installed.\n\nYou can download a screen reader for your device from Android
+ Market.\n\nClick "OK" to install the screen reader.</string>
+
<!-- App Fuel Gauge strings -->
<skip/>
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java
index 6199e50..1d6db20 100644
--- a/src/com/android/settings/AccessibilitySettings.java
+++ b/src/com/android/settings/AccessibilitySettings.java
@@ -19,8 +19,14 @@ package com.android.settings;
import android.app.AlertDialog;
import android.app.Service;
import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ServiceInfo;
+import android.net.Uri;
import android.os.Bundle;
+import android.os.SystemProperties;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
@@ -39,6 +45,9 @@ import java.util.Map;
* Activity with the accessibility settings.
*/
public class AccessibilitySettings extends PreferenceActivity {
+ private static final String DEFAULT_SCREENREADER_MARKET_LINK =
+ "market://search?q=pname:com.google.android.marvin.talkback";
+
private final String TOGGLE_ACCESSIBILITY_SERVICE_CHECKBOX =
"toggle_accessibility_service_checkbox";
@@ -108,6 +117,9 @@ public class AccessibilitySettings extends PreferenceActivity {
setAccessibilityServicePreferencesState(false);
}
mToggleCheckBox.setEnabled(false);
+ // Notify user that they do not have any accessibility apps
+ // installed and direct them to Market to get TalkBack
+ displayNoAppsAlert();
}
}
@@ -274,4 +286,42 @@ public class AccessibilitySettings extends PreferenceActivity {
mAccessibilityServicesCategory.addPreference(preference);
}
}
+
+ /**
+ * Displays a message telling the user that they do not have any accessibility
+ * related apps installed and that they can get TalkBack (Google's free screen
+ * reader) from Market.
+ */
+ private void displayNoAppsAlert() {
+ try {
+ PackageManager pm = getPackageManager();
+ ApplicationInfo info = pm.getApplicationInfo("com.android.vending", 0);
+ } catch (NameNotFoundException e) {
+ // This is a no-op if the user does not have Android Market
+ return;
+ }
+ AlertDialog.Builder noAppsAlert = new AlertDialog.Builder(this);
+ noAppsAlert.setTitle(R.string.accessibility_service_no_apps_title);
+ noAppsAlert.setMessage(R.string.accessibility_service_no_apps_message);
+
+ noAppsAlert.setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ String screenreaderMarketLink =
+ SystemProperties.get("ro.screenreader.market", DEFAULT_SCREENREADER_MARKET_LINK);
+ Uri marketUri = Uri.parse(screenreaderMarketLink);
+ Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
+ startActivity(marketIntent);
+ finish();
+ }
+ });
+
+ noAppsAlert.setNegativeButton(android.R.string.cancel,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ });
+
+ noAppsAlert.show();
+ }
}