summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/ShortcutInfo.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-03-11 16:56:52 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-03-17 15:05:23 -0700
commit34b6527cefd36fbd5da78464ce9771e379158552 (patch)
treeb7884c2d9c7500c54b9e5fcb54161cc2d00904c6 /src/com/android/launcher3/ShortcutInfo.java
parent5d85c44fd873c740dc191b28424c2ee367d730a2 (diff)
downloadandroid_packages_apps_Trebuchet-34b6527cefd36fbd5da78464ce9771e379158552.tar.gz
android_packages_apps_Trebuchet-34b6527cefd36fbd5da78464ce9771e379158552.tar.bz2
android_packages_apps_Trebuchet-34b6527cefd36fbd5da78464ce9771e379158552.zip
Lazy loading high res icons
> Loading low-res icons for icons which are not visible on the homescreen. Change-Id: I8ac7bf09f6030ed554cb60a4cd402f3f36ffe12b
Diffstat (limited to 'src/com/android/launcher3/ShortcutInfo.java')
-rw-r--r--src/com/android/launcher3/ShortcutInfo.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/launcher3/ShortcutInfo.java b/src/com/android/launcher3/ShortcutInfo.java
index 08ffaa299..9f7da6c3d 100644
--- a/src/com/android/launcher3/ShortcutInfo.java
+++ b/src/com/android/launcher3/ShortcutInfo.java
@@ -84,6 +84,11 @@ public class ShortcutInfo extends ItemInfo {
boolean usingFallbackIcon;
/**
+ * Indicates whether we're using a low res icon
+ */
+ boolean usingLowResIcon;
+
+ /**
* If isShortcut=true and customIcon=false, this contains a reference to the
* shortcut icon as an application's resource.
*/
@@ -192,7 +197,8 @@ public class ShortcutInfo extends ItemInfo {
public void updateIcon(IconCache iconCache) {
if (itemType == Favorites.ITEM_TYPE_APPLICATION) {
- iconCache.getTitleAndIcon(this, promisedIntent != null ? promisedIntent : intent, user);
+ iconCache.getTitleAndIcon(this, promisedIntent != null ? promisedIntent : intent, user,
+ shouldUseLowResIcon());
}
}
@@ -264,5 +270,9 @@ public class ShortcutInfo extends ItemInfo {
mInstallProgress = progress;
status |= FLAG_INSTALL_SESSION_ACTIVE;
}
+
+ public boolean shouldUseLowResIcon() {
+ return usingLowResIcon && container >= 0 && rank >= FolderIcon.NUM_ITEMS_IN_PREVIEW;
+ }
}