summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-05-22 12:25:45 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-06-03 19:07:44 -0700
commit53d7ee4285842732517edcccbdcaa92dccb1e107 (patch)
tree95f5a6520d621ab43c122ed37b7d12f45633b41e /src/com/android/launcher3/Launcher.java
parentf4fe7fc5449bbfcfa7e95c7f9040c81d833a1fdb (diff)
downloadandroid_packages_apps_Trebuchet-53d7ee4285842732517edcccbdcaa92dccb1e107.tar.gz
android_packages_apps_Trebuchet-53d7ee4285842732517edcccbdcaa92dccb1e107.tar.bz2
android_packages_apps_Trebuchet-53d7ee4285842732517edcccbdcaa92dccb1e107.zip
Fixing different bitmap sizes in different orientations
> Using a single bitmap icon size > Picking up appropriate density for satisfy the required icon size > Fixing some icon size assumptions during icon animations Bug: 19514688 Change-Id: Ia7a1d0d2c03a9d39ccc241fa4ae3eb8a0f374585
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 867a6e71d..dc63a761b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -453,9 +453,6 @@ public class Launcher extends Activity
app.getInvariantDeviceProfile().landscapeProfile
: app.getInvariantDeviceProfile().portraitProfile;
- // TODO: Move this to icon cache.
- Utilities.setIconSize(mDeviceProfile.iconSizePx);
-
// the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(),
Context.MODE_PRIVATE);
@@ -4674,6 +4671,23 @@ public class Launcher extends Activity
}
/**
+ * Returns a FastBitmapDrawable with the icon, accurately sized.
+ */
+ public FastBitmapDrawable createIconDrawable(Bitmap icon) {
+ FastBitmapDrawable d = new FastBitmapDrawable(icon);
+ d.setFilterBitmap(true);
+ resizeIconDrawable(d);
+ return d;
+ }
+
+ /**
+ * Resizes an icon drawable to the correct icon size.
+ */
+ public void resizeIconDrawable(Drawable icon) {
+ icon.setBounds(0, 0, mDeviceProfile.iconSizePx, mDeviceProfile.iconSizePx);
+ }
+
+ /**
* Prints out out state for debugging.
*/
public void dumpState() {