am 32f491c9: Merge "Fixing issue where default widget previews were not using large icons on tablet." into ics-mr1
* commit '32f491c9dfc21ad92fef28fce45dcee6ba036593': Fixing issue where default widget previews were not using large icons on tablet.
This commit is contained in:
@@ -932,7 +932,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
||||
Bitmap preview = Bitmap.createBitmap(bitmapSize, bitmapSize, Config.ARGB_8888);
|
||||
|
||||
// Render the icon
|
||||
Drawable icon = mIconCache.getFullResIcon(info, mPackageManager);
|
||||
Drawable icon = mIconCache.getFullResIcon(info);
|
||||
renderDrawableToBitmap(icon, preview, offset, offset, mAppIconSize, mAppIconSize);
|
||||
return preview;
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
||||
Drawable icon = null;
|
||||
int hoffset = (int) (bitmapWidth / 2 - mAppIconSize * iconScale / 2);
|
||||
int yoffset = (int) (bitmapHeight / 2 - mAppIconSize * iconScale / 2);
|
||||
if (info.icon > 0) icon = mPackageManager.getDrawable(packageName, info.icon, null);
|
||||
if (info.icon > 0) icon = mIconCache.getFullResIcon(packageName, info.icon);
|
||||
if (icon == null) icon = resources.getDrawable(R.drawable.ic_launcher_application);
|
||||
|
||||
renderDrawableToBitmap(icon, preview, hoffset, yoffset,
|
||||
|
||||
@@ -86,10 +86,25 @@ public class IconCache {
|
||||
return (d != null) ? d : getFullResDefaultActivityIcon();
|
||||
}
|
||||
|
||||
public Drawable getFullResIcon(ResolveInfo info, PackageManager packageManager) {
|
||||
public Drawable getFullResIcon(String packageName, int iconId) {
|
||||
Resources resources;
|
||||
try {
|
||||
resources = packageManager.getResourcesForApplication(
|
||||
resources = mPackageManager.getResourcesForApplication(packageName);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
resources = null;
|
||||
}
|
||||
if (resources != null) {
|
||||
if (iconId != 0) {
|
||||
return getFullResIcon(resources, iconId);
|
||||
}
|
||||
}
|
||||
return getFullResDefaultActivityIcon();
|
||||
}
|
||||
|
||||
public Drawable getFullResIcon(ResolveInfo info) {
|
||||
Resources resources;
|
||||
try {
|
||||
resources = mPackageManager.getResourcesForApplication(
|
||||
info.activityInfo.applicationInfo);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
resources = null;
|
||||
@@ -198,7 +213,7 @@ public class IconCache {
|
||||
}
|
||||
|
||||
entry.icon = Utilities.createIconBitmap(
|
||||
getFullResIcon(info, mPackageManager), mContext);
|
||||
getFullResIcon(info), mContext);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user