Move over to CharSequence version of badging method.
Bug: 16484455 Change-Id: Ie5ee010efc439219cb71fd4241fdb798a5f4ea12
This commit is contained in:
@@ -34,9 +34,9 @@ public class PowerGaugePreference extends Preference {
|
|||||||
private BatteryEntry mInfo;
|
private BatteryEntry mInfo;
|
||||||
private int mProgress;
|
private int mProgress;
|
||||||
private CharSequence mProgressText;
|
private CharSequence mProgressText;
|
||||||
private final String mContentDescription;
|
private final CharSequence mContentDescription;
|
||||||
|
|
||||||
public PowerGaugePreference(Context context, Drawable icon, String contentDescription,
|
public PowerGaugePreference(Context context, Drawable icon, CharSequence contentDescription,
|
||||||
BatteryEntry info) {
|
BatteryEntry info) {
|
||||||
super(context);
|
super(context);
|
||||||
setLayoutResource(R.layout.preference_app_percentage);
|
setLayoutResource(R.layout.preference_app_percentage);
|
||||||
|
@@ -297,9 +297,7 @@ public class PowerUsageSummary extends PreferenceFragment {
|
|||||||
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
|
final BatteryEntry entry = new BatteryEntry(getActivity(), mHandler, mUm, sipper);
|
||||||
final Drawable badgedIcon = mUm.getBadgedDrawableForUser(entry.getIcon(),
|
final Drawable badgedIcon = mUm.getBadgedDrawableForUser(entry.getIcon(),
|
||||||
userHandle);
|
userHandle);
|
||||||
// TODO: type of this will be replaced by CharSequence (see
|
final CharSequence contentDescription = mUm.getBadgedLabelForUser(entry.getLabel(),
|
||||||
// https://b.corp.google.com/issue?id=16401636 )
|
|
||||||
final String contentDescription = mUm.getBadgedLabelForUser(entry.getLabel(),
|
|
||||||
userHandle);
|
userHandle);
|
||||||
final PowerGaugePreference pref = new PowerGaugePreference(getActivity(),
|
final PowerGaugePreference pref = new PowerGaugePreference(getActivity(),
|
||||||
badgedIcon, contentDescription, entry);
|
badgedIcon, contentDescription, entry);
|
||||||
|
@@ -82,9 +82,9 @@ public class RecentLocationApps {
|
|||||||
* them for accessibility purposes.
|
* them for accessibility purposes.
|
||||||
*/
|
*/
|
||||||
private static class AccessiblePreference extends Preference {
|
private static class AccessiblePreference extends Preference {
|
||||||
public String mContentDescription;
|
public CharSequence mContentDescription;
|
||||||
|
|
||||||
public AccessiblePreference(Context context, String contentDescription) {
|
public AccessiblePreference(Context context, CharSequence contentDescription) {
|
||||||
super(context);
|
super(context);
|
||||||
mContentDescription = contentDescription;
|
mContentDescription = contentDescription;
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ public class RecentLocationApps {
|
|||||||
Drawable icon,
|
Drawable icon,
|
||||||
CharSequence label,
|
CharSequence label,
|
||||||
boolean isHighBattery,
|
boolean isHighBattery,
|
||||||
String contentDescription,
|
CharSequence contentDescription,
|
||||||
Preference.OnPreferenceClickListener listener) {
|
Preference.OnPreferenceClickListener listener) {
|
||||||
AccessiblePreference pref = new AccessiblePreference(mActivity, contentDescription);
|
AccessiblePreference pref = new AccessiblePreference(mActivity, contentDescription);
|
||||||
pref.setIcon(icon);
|
pref.setIcon(icon);
|
||||||
@@ -209,7 +209,7 @@ public class RecentLocationApps {
|
|||||||
Drawable appIcon = mPackageManager.getApplicationIcon(appInfo);
|
Drawable appIcon = mPackageManager.getApplicationIcon(appInfo);
|
||||||
Drawable icon = um.getBadgedDrawableForUser(appIcon, userHandle);
|
Drawable icon = um.getBadgedDrawableForUser(appIcon, userHandle);
|
||||||
CharSequence appLabel = mPackageManager.getApplicationLabel(appInfo);
|
CharSequence appLabel = mPackageManager.getApplicationLabel(appInfo);
|
||||||
String badgedAppLabel = um.getBadgedLabelForUser(appLabel.toString(), userHandle);
|
CharSequence badgedAppLabel = um.getBadgedLabelForUser(appLabel.toString(), userHandle);
|
||||||
preference = createRecentLocationEntry(icon,
|
preference = createRecentLocationEntry(icon,
|
||||||
appLabel, highBattery, badgedAppLabel,
|
appLabel, highBattery, badgedAppLabel,
|
||||||
new PackageEntryClickedListener(packageName));
|
new PackageEntryClickedListener(packageName));
|
||||||
|
Reference in New Issue
Block a user