summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3
diff options
context:
space:
mode:
authorKenny Guy <kennyguy@google.com>2014-06-20 21:24:53 +0100
committerKenny Guy <kennyguy@google.com>2014-06-23 16:42:37 +0100
commit01453e855fa87ee19f61223b2b1a6965071ee95a (patch)
treeffe8620af0bf0f072f4ae231ad11c28024ebbec5 /src/com/android/launcher3
parent74b68a409766db18630f8131ca93b9269afab22e (diff)
downloadandroid_packages_apps_Trebuchet-01453e855fa87ee19f61223b2b1a6965071ee95a.tar.gz
android_packages_apps_Trebuchet-01453e855fa87ee19f61223b2b1a6965071ee95a.tar.bz2
android_packages_apps_Trebuchet-01453e855fa87ee19f61223b2b1a6965071ee95a.zip
Add content description to bagded icons.
Enabled accesibility so that icons badged by the managed profile have a content description that is different to the non-bagdged version. Bug: 15106236 Change-Id: Id483273173d9539916eebd59111d179087526be3
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java3
-rw-r--r--src/com/android/launcher3/Folder.java3
-rw-r--r--src/com/android/launcher3/IconCache.java4
-rw-r--r--src/com/android/launcher3/ItemInfo.java7
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/LauncherModel.java7
-rw-r--r--src/com/android/launcher3/PagedViewIcon.java3
-rw-r--r--src/com/android/launcher3/ShortcutInfo.java4
-rw-r--r--src/com/android/launcher3/Workspace.java1
9 files changed, 34 insertions, 2 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 95300c133..ffe836689 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -125,6 +125,9 @@ public class BubbleTextView extends TextView {
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
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index e900c2b5a..af4a1776c 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -571,6 +571,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
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);
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index be02d3583..7d8628d9d 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -65,6 +65,7 @@ public class IconCache {
private static class CacheEntry {
public Bitmap icon;
public String title;
+ public String contentDescription;
}
private static class CacheKey {
@@ -240,6 +241,7 @@ public class IconCache {
application.title = entry.title;
application.iconBitmap = entry.icon;
+ application.contentDescription = entry.contentDescription;
}
}
@@ -262,6 +264,7 @@ public class IconCache {
CacheEntry entry = cacheLocked(component, launcherActInfo, null, user);
if (title != null) {
entry.title = title;
+ entry.contentDescription = mUserManager.getBadgedLabelForUser(title, user);
}
return entry.icon;
}
@@ -310,6 +313,7 @@ public class IconCache {
}
}
+ entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
entry.icon = Utilities.createIconBitmap(
info.getBadgedIcon(mIconDpi), mContext);
} else {
diff --git a/src/com/android/launcher3/ItemInfo.java b/src/com/android/launcher3/ItemInfo.java
index 74f16e325..fe030171b 100644
--- a/src/com/android/launcher3/ItemInfo.java
+++ b/src/com/android/launcher3/ItemInfo.java
@@ -108,6 +108,11 @@ public class ItemInfo {
CharSequence title;
/**
+ * Content description of the item.
+ */
+ String contentDescription;
+
+ /**
* The position of the item in a drag-and-drop operation.
*/
int[] dropPos = null;
@@ -115,6 +120,7 @@ public class ItemInfo {
UserHandleCompat user;
ItemInfo() {
+ user = UserHandleCompat.myUserHandle();
}
ItemInfo(ItemInfo info) {
@@ -127,6 +133,7 @@ public class ItemInfo {
itemType = info.itemType;
container = info.container;
user = info.user;
+ contentDescription = info.contentDescription;
// tempdebug:
LauncherModel.checkItemInfo(this);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1d8591bd5..bf774f9c7 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4674,7 +4674,9 @@ public class Launcher extends Activity
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() {
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index a975da459..310450fdf 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -2820,6 +2820,7 @@ public class LauncherModel extends BroadcastReceiver
if (isShortcutInfoUpdateable(i)) {
ShortcutInfo info = (ShortcutInfo) i;
info.title = a.title.toString();
+ info.contentDescription = a.contentDescription;
updateItemInDatabase(context, info);
}
}
@@ -2955,6 +2956,8 @@ public class LauncherModel extends BroadcastReceiver
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;
@@ -3061,6 +3064,8 @@ public class LauncherModel extends BroadcastReceiver
}
info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
info.user = user;
+ info.contentDescription = mUserManager.getBadgedLabelForUser(
+ info.title.toString(), info.user);
return info;
}
@@ -3336,6 +3341,8 @@ public class LauncherModel extends BroadcastReceiver
info.setIcon(icon);
info.title = name;
+ info.contentDescription = mUserManager.getBadgedLabelForUser(
+ info.title.toString(), info.user);
info.intent = intent;
info.customIcon = customIcon;
info.iconResource = iconResource;
diff --git a/src/com/android/launcher3/PagedViewIcon.java b/src/com/android/launcher3/PagedViewIcon.java
index f7cb997cd..713d3a42f 100644
--- a/src/com/android/launcher3/PagedViewIcon.java
+++ b/src/com/android/launcher3/PagedViewIcon.java
@@ -77,6 +77,9 @@ public class PagedViewIcon extends TextView {
setCompoundDrawables(null, icon, null, null);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
setText(info.title);
+ if (info.contentDescription != null) {
+ setContentDescription(info.contentDescription);
+ }
setTag(info);
}
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java
index f40cf9fa1..0be7c0281 100644
--- a/src/com/android/launcher3/ShortcutInfo.java
+++ b/src/com/android/launcher3/ShortcutInfo.java
@@ -113,10 +113,12 @@ public class ShortcutInfo extends ItemInfo {
}
}
- 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;
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 6afea8268..6476bc9ee 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -4781,6 +4781,7 @@ public class Workspace extends SmoothPagedView
shortcutInfo.restore();
shortcutInfo.updateIcon(mIconCache);
shortcutInfo.title = appInfo.title.toString();
+ shortcutInfo.contentDescription = appInfo.contentDescription;
shortcut.applyFromShortcutInfo(shortcutInfo, mIconCache);
}
}