summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/IconCache.java
diff options
context:
space:
mode:
authorhuiwan <huiwan@codeaurora.org>2014-11-10 10:35:03 -0800
committerRajesh Yengisetty <rajesh@cyngn.com>2014-11-21 00:13:25 +0000
commit9b398417ff00bb67a43579c748fd335effad1c5b (patch)
treeaa112a7fc0d0128df46e63795c4717f9263e2cf4 /src/com/android/launcher3/IconCache.java
parent783be63c0a6d9b47f900c5d711a6a1663f1ca112 (diff)
downloadandroid_packages_apps_Trebuchet-9b398417ff00bb67a43579c748fd335effad1c5b.tar.gz
android_packages_apps_Trebuchet-9b398417ff00bb67a43579c748fd335effad1c5b.tar.bz2
android_packages_apps_Trebuchet-9b398417ff00bb67a43579c748fd335effad1c5b.zip
Launcher: show unread notify info number at APP icon on Launcher
Show APP's unread info number at Launcher: - Register a receiver to receive the UNREAD_CHANGED event to update the APP icon - When the unread number changed, recreate the icon bitmap of icon cache Change-Id: I7dd0fb2c29959f1584682965fb1476e3f3c77739
Diffstat (limited to 'src/com/android/launcher3/IconCache.java')
-rw-r--r--src/com/android/launcher3/IconCache.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index bb71d776c..03684f600 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -245,7 +245,7 @@ public class IconCache {
HashMap<Object, CharSequence> labelCache) {
synchronized (mCache) {
CacheEntry entry = cacheLocked(application.componentName, info, labelCache,
- info.getUser(), false);
+ info.getUser(), false, application.unreadNum);
application.title = entry.title;
application.iconBitmap = entry.icon;
@@ -267,7 +267,7 @@ public class IconCache {
}
LauncherActivityInfoCompat launcherActInfo = mLauncherApps.resolveActivity(intent, user);
- CacheEntry entry = cacheLocked(component, launcherActInfo, null, user, usePkgIcon);
+ CacheEntry entry = cacheLocked(component, launcherActInfo, null, user, usePkgIcon, -1);
if (title != null) {
entry.title = title;
entry.contentDescription = mUserManager.getBadgedLabelForUser(title, user);
@@ -292,7 +292,8 @@ public class IconCache {
} else {
LauncherActivityInfoCompat launcherActInfo =
mLauncherApps.resolveActivity(intent, user);
- CacheEntry entry = cacheLocked(component, launcherActInfo, null, user, usePkgIcon);
+ CacheEntry entry = cacheLocked(component, launcherActInfo, null, user, usePkgIcon,
+ -1);
shortcutInfo.setIcon(entry.icon);
shortcutInfo.title = entry.title;
@@ -316,7 +317,7 @@ public class IconCache {
return null;
}
- CacheEntry entry = cacheLocked(component, info, labelCache, info.getUser(), false);
+ CacheEntry entry = cacheLocked(component, info, labelCache, info.getUser(), false, -1);
return entry.icon;
}
}
@@ -326,10 +327,11 @@ public class IconCache {
}
private CacheEntry cacheLocked(ComponentName componentName, LauncherActivityInfoCompat info,
- HashMap<Object, CharSequence> labelCache, UserHandleCompat user, boolean usePackageIcon) {
+ HashMap<Object, CharSequence> labelCache, UserHandleCompat user,
+ boolean usePackageIcon, int unreadNum) {
CacheKey cacheKey = new CacheKey(componentName, user);
CacheEntry entry = mCache.get(cacheKey);
- if (entry == null) {
+ if (entry == null || unreadNum >= 0) {
entry = new CacheEntry();
mCache.put(cacheKey, entry);
@@ -347,7 +349,7 @@ public class IconCache {
entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);
entry.icon = Utilities.createIconBitmap(
- info.getBadgedIcon(mIconDpi), mContext);
+ info.getBadgedIcon(mIconDpi), mContext, unreadNum);
} else {
entry.title = "";
Bitmap preloaded = getPreloadedIcon(componentName, user);