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
This commit is contained in:
@@ -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/>
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user