setCompoundDrawables(null, iconDrawable, null, null);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
setText(info.title);
+ if (info.contentDescription != null) {
+ setContentDescription(info.contentDescription);
+ }
setTag(info);
if (info.isPromise()) {
setState(ShortcutInfo.PACKAGE_STATE_UNKNOWN); // TODO: persist this state somewhere
textView.setCompoundDrawables(null,
Utilities.createIconDrawable(item.getIcon(mIconCache)), null, null);
textView.setText(item.title);
+ if (item.contentDescription != null) {
+ textView.setContentDescription(item.contentDescription);
+ }
textView.setTag(item);
textView.setTextColor(getResources().getColor(R.color.folder_items_text_color));
textView.setShadowsEnabled(false);
private static class CacheEntry {
public Bitmap icon;
public String title;
+ public String contentDescription;
}
private static class CacheKey {
application.title = entry.title;
application.iconBitmap = entry.icon;
+ application.contentDescription = entry.contentDescription;
}
}
CacheEntry entry = cacheLocked(component, launcherActInfo, null, user);
if (title != null) {
entry.title = title;
+ entry.contentDescription = mUserManager.getBadgedLabelForUser(title, user);
}
return entry.icon;
}
}
}
+ entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
entry.icon = Utilities.createIconBitmap(
info.getBadgedIcon(mIconDpi), mContext);
} else {
CharSequence title;
/**
+ * Content description of the item.
+ */
+ String contentDescription;
+
+ /**
* The position of the item in a drag-and-drop operation.
*/
int[] dropPos = null;
UserHandleCompat user;
ItemInfo() {
+ user = UserHandleCompat.myUserHandle();
}
ItemInfo(ItemInfo info) {
itemType = info.itemType;
container = info.container;
user = info.user;
+ contentDescription = info.contentDescription;
// tempdebug:
LauncherModel.checkItemInfo(this);
}
public ItemInfo createShortcutDragInfo(Intent shortcutIntent, CharSequence caption,
Bitmap icon, UserHandleCompat user) {
- return new ShortcutInfo(shortcutIntent, caption, icon, user);
+ UserManagerCompat userManager = UserManagerCompat.getInstance(this);
+ String contentDescription = userManager.getBadgedLabelForUser(caption.toString(), user);
+ return new ShortcutInfo(shortcutIntent, caption, contentDescription, icon, user);
}
protected void moveWorkspaceToDefaultScreen() {
if (isShortcutInfoUpdateable(i)) {
ShortcutInfo info = (ShortcutInfo) i;
info.title = a.title.toString();
+ info.contentDescription = a.contentDescription;
updateItemInDatabase(context, info);
}
}
info.title = "";
}
info.user = UserHandleCompat.myUserHandle();
+ info.contentDescription = mUserManager.getBadgedLabelForUser(
+ info.title.toString(), info.user);
info.setIcon(mIconCache.getIcon(intent, info.title.toString(), info.user));
info.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
info.restoredIntent = intent;
}
info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
info.user = user;
+ info.contentDescription = mUserManager.getBadgedLabelForUser(
+ info.title.toString(), info.user);
return info;
}
info.setIcon(icon);
info.title = name;
+ info.contentDescription = mUserManager.getBadgedLabelForUser(
+ info.title.toString(), info.user);
info.intent = intent;
info.customIcon = customIcon;
info.iconResource = iconResource;
setCompoundDrawables(null, icon, null, null);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
setText(info.title);
+ if (info.contentDescription != null) {
+ setContentDescription(info.contentDescription);
+ }
setTag(info);
}
}
}
- ShortcutInfo(Intent intent, CharSequence title, Bitmap icon, UserHandleCompat user) {
+ ShortcutInfo(Intent intent, CharSequence title, String contentDescrition,
+ Bitmap icon, UserHandleCompat user) {
this();
this.intent = intent;
this.title = title;
+ this.contentDescription = contentDescription;
mIcon = icon;
this.user = user;
}
shortcutInfo.restore();
shortcutInfo.updateIcon(mIconCache);
shortcutInfo.title = appInfo.title.toString();
+ shortcutInfo.contentDescription = appInfo.contentDescription;
shortcut.applyFromShortcutInfo(shortcutInfo, mIconCache);
}
}