diff options
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/Folder.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/PagedViewIcon.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 16 |
5 files changed, 21 insertions, 5 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 287bb5096..eb65a0a9c 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -110,8 +110,7 @@ public class BubbleTextView extends TextView { DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); setCompoundDrawablesWithIntrinsicBounds(null, - new FastBitmapDrawable(b), - null, null); + Utilities.createIconDrawable(b), null, null); setCompoundDrawablePadding((int) ((grid.folderIconSizePx - grid.iconSizePx) / 2f)); setText(info.title); setTag(info); diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index 5231aacf5..ce2edbed2 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -533,7 +533,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList final BubbleTextView textView = (BubbleTextView) mInflater.inflate(R.layout.application, this, false); textView.setCompoundDrawablesWithIntrinsicBounds(null, - new FastBitmapDrawable(item.getIcon(mIconCache)), null, null); + Utilities.createIconDrawable(item.getIcon(mIconCache)), null, null); textView.setText(item.title); textView.setTag(item); textView.setTextColor(getResources().getColor(R.color.folder_items_text_color)); diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 2aab64d73..094e188c7 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -150,7 +150,7 @@ public class Hotseat extends FrameLayout { TextView allAppsButton = (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false); Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); - d.setBounds(0, 0, Utilities.sIconTextureWidth, Utilities.sIconTextureHeight); + Utilities.resizeIconDrawable(d); allAppsButton.setCompoundDrawables(null, d, null, null); allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label)); diff --git a/src/com/android/launcher3/PagedViewIcon.java b/src/com/android/launcher3/PagedViewIcon.java index c6d5e4996..561215721 100644 --- a/src/com/android/launcher3/PagedViewIcon.java +++ b/src/com/android/launcher3/PagedViewIcon.java @@ -69,7 +69,8 @@ public class PagedViewIcon extends TextView { PagedViewIcon.PressedCallback cb) { mIcon = info.iconBitmap; mPressedCallback = cb; - setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null); + setCompoundDrawablesWithIntrinsicBounds(null, Utilities.createIconDrawable(mIcon), + null, null); setText(info.title); setTag(info); } diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 2cb9314e1..fe8655029 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -66,6 +66,22 @@ final class Utilities { static int sColorIndex = 0; /** + * Returns a FastBitmapDrawable with the icon, accurately sized. + */ + static Drawable createIconDrawable(Bitmap icon) { + FastBitmapDrawable d = new FastBitmapDrawable(icon); + resizeIconDrawable(d); + return d; + } + + /** + * Resizes an icon drawable to the correct icon size. + */ + static void resizeIconDrawable(Drawable icon) { + icon.setBounds(0, 0, sIconTextureWidth, sIconTextureHeight); + } + + /** * Returns a bitmap suitable for the all apps view. Used to convert pre-ICS * icon bitmaps that are stored in the database (which were 74x74 pixels at hdpi size) * to the proper size (48dp) |