diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-06 16:23:56 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2014-10-07 14:56:58 -0700 |
commit | b50cc8c5d6125715b139d978887830a5341971aa (patch) | |
tree | a349b95ae8835b0d72608124e58664d55241ee65 /src/com/android/launcher3/Utilities.java | |
parent | 2fce90c38a79d318e96a28107dea287e42509861 (diff) | |
download | android_packages_apps_Trebuchet-b50cc8c5d6125715b139d978887830a5341971aa.tar.gz android_packages_apps_Trebuchet-b50cc8c5d6125715b139d978887830a5341971aa.tar.bz2 android_packages_apps_Trebuchet-b50cc8c5d6125715b139d978887830a5341971aa.zip |
Updating icons for sortcuts when the target app updates.
Bug: 17398260
Change-Id: I055abb971d1f72245e8616ac2ce07bcdf37cdd52
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 84eb8bfa2..6caa1cf56 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -108,6 +108,27 @@ public final class Utilities { } /** + * Returns a bitmap suitable for the all apps view. If the package or the resource do not + * exist, it returns null. + */ + static Bitmap createIconBitmap(String packageName, String resourceName, IconCache cache, + Context context) { + PackageManager packageManager = context.getPackageManager(); + // the resource + try { + Resources resources = packageManager.getResourcesForApplication(packageName); + if (resources != null) { + final int id = resources.getIdentifier(resourceName, null, null); + return createIconBitmap( + resources.getDrawableForDensity(id, cache.getFullResIconDpi()), context); + } + } catch (Exception e) { + // Icon not found. + } + return null; + } + + /** * Returns a bitmap which is of the appropriate size to be displayed as an icon */ static Bitmap createIconBitmap(Bitmap icon, Context context) { |