summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-10-14 17:46:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-14 17:46:46 +0000
commit140e79bb48f6639f2d58c729d6f2597bda0a51b1 (patch)
treea7d0da86ebcf62100879100f0fc9e2910d7e0579 /src
parentdecbaa694da558a7860317a6d113864ec2fcaae2 (diff)
parent0dbd734384df38960515ce49dfcb5e15a394deca (diff)
downloadandroid_packages_apps_Trebuchet-140e79bb48f6639f2d58c729d6f2597bda0a51b1.tar.gz
android_packages_apps_Trebuchet-140e79bb48f6639f2d58c729d6f2597bda0a51b1.tar.bz2
android_packages_apps_Trebuchet-140e79bb48f6639f2d58c729d6f2597bda0a51b1.zip
Merge "Workaround for small icons. Draw icon drawables at the expected icon size. (Bug 11203738)" into jb-ub-now-indigo-rose
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java3
-rw-r--r--src/com/android/launcher3/Folder.java2
-rw-r--r--src/com/android/launcher3/Hotseat.java2
-rw-r--r--src/com/android/launcher3/PagedViewIcon.java3
-rw-r--r--src/com/android/launcher3/Utilities.java16
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)