From 4842ed029c5861b1696a9c69caa45f9a6e6e5f7e Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Thu, 7 Jul 2011 15:33:20 -0700 Subject: [PATCH] Moving a bit of code around - Resources.NotFoundException now handled inside getFullResIcon() --- src/com/android/launcher2/IconCache.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/com/android/launcher2/IconCache.java b/src/com/android/launcher2/IconCache.java index 5c07cfb42f..22691a5031 100644 --- a/src/com/android/launcher2/IconCache.java +++ b/src/com/android/launcher2/IconCache.java @@ -69,13 +69,15 @@ public class IconCache { com.android.internal.R.mipmap.sym_def_app_icon); } - public Drawable getFullResIcon(Resources resources, int iconId) - throws Resources.NotFoundException { - return resources.getDrawableForDensity(iconId, mIconDpi); + public Drawable getFullResIcon(Resources resources, int iconId) { + try { + return resources.getDrawableForDensity(iconId, mIconDpi); + } catch (Resources.NotFoundException e) { + return getFullResDefaultActivityIcon(); + } } - public Drawable getFullResIcon(ResolveInfo info, PackageManager packageManager) - throws Resources.NotFoundException { + public Drawable getFullResIcon(ResolveInfo info, PackageManager packageManager) { Resources resources; try { resources = packageManager.getResourcesForApplication( @@ -178,13 +180,8 @@ public class IconCache { entry.title = info.activityInfo.name; } - Drawable icon; - try { - icon = getFullResIcon(info, mPackageManager); - } catch (Resources.NotFoundException e) { - icon = getFullResDefaultActivityIcon(); - } - entry.icon = Utilities.createIconBitmap(icon, mContext); + entry.icon = Utilities.createIconBitmap( + getFullResIcon(info, mPackageManager), mContext); } return entry; }