diff options
author | Zoltan Szatmary-Ban <szatmz@google.com> | 2014-07-23 11:02:46 +0100 |
---|---|---|
committer | Zoltan Szatmary-Ban <szatmz@google.com> | 2014-08-07 14:15:14 +0100 |
commit | ebb36ec9207c9519f6ae6a1aa39909279aa1d0e9 (patch) | |
tree | 7c85ef5e23b7eebad8d9eef33d5b13878f113d74 /src/com/android/settings/fuelgauge/PowerGaugePreference.java | |
parent | f34c3501948190acf44defefba8eb161ec6dc07b (diff) | |
download | packages_apps_Settings-ebb36ec9207c9519f6ae6a1aa39909279aa1d0e9.zip packages_apps_Settings-ebb36ec9207c9519f6ae6a1aa39909279aa1d0e9.tar.gz packages_apps_Settings-ebb36ec9207c9519f6ae6a1aa39909279aa1d0e9.tar.bz2 |
Badge texts correctly for accessibility in Settings
If an app is a managed profile's app then its label should read correctly by TalkBack.
Affected screens: Data Usage, Location, Battery.
Bug:16053981
Change-Id: I393c0ebf56917032d619b1e39b4bf141ee236981
Diffstat (limited to 'src/com/android/settings/fuelgauge/PowerGaugePreference.java')
-rw-r--r-- | src/com/android/settings/fuelgauge/PowerGaugePreference.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java index 990b654..8157b5d 100644 --- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java +++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java @@ -34,12 +34,15 @@ public class PowerGaugePreference extends Preference { private BatteryEntry mInfo; private int mProgress; private CharSequence mProgressText; + private final String mContentDescription; - public PowerGaugePreference(Context context, Drawable icon, BatteryEntry info) { + public PowerGaugePreference(Context context, Drawable icon, String contentDescription, + BatteryEntry info) { super(context); setLayoutResource(R.layout.preference_app_percentage); setIcon(icon != null ? icon : new ColorDrawable(0)); mInfo = info; + mContentDescription = contentDescription; } public void setPercent(double percentOfMax, double percentOfTotal) { @@ -62,5 +65,10 @@ public class PowerGaugePreference extends Preference { final TextView text1 = (TextView) view.findViewById(android.R.id.text1); text1.setText(mProgressText); + + if (mContentDescription != null) { + final TextView titleView = (TextView) view.findViewById(android.R.id.title); + titleView.setContentDescription(mContentDescription); + } } } |