From 34b6527cefd36fbd5da78464ce9771e379158552 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 11 Mar 2015 16:56:52 -0700 Subject: Lazy loading high res icons > Loading low-res icons for icons which are not visible on the homescreen. Change-Id: I8ac7bf09f6030ed554cb60a4cd402f3f36ffe12b --- src/com/android/launcher3/ShortcutInfo.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/com/android/launcher3/ShortcutInfo.java') 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 @@ -83,6 +83,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; + } } -- cgit v1.2.3