Fixing issues with holographic outline cache in AllApps/Customize.
- Fixing issue where the outline cache was not properly used when changing orientations
- Making the outline cache static, and shared across both the AllApps/Customize (since they
share an Apps view)
- Making sure that holographic outlines for items on only one page are not created, since
the holographic outlines will never be shown in that case.
- No longer clearing outline cache as frequently
Change-Id: I291db3802260249d0470d2637d871958baa8ebff
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index e4049eb..6ce308b 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -32,7 +32,6 @@
import android.widget.Checkable;
import com.android.launcher.R;
-import com.android.launcher2.PagedView.PagedViewIconCache;
@@ -50,7 +49,7 @@
private Bitmap mHolographicOutline;
private Bitmap mIcon;
- private Object mIconCacheKey;
+ private PagedViewIconCache.Key mIconCacheKey;
private PagedViewIconCache mIconCache;
private int mAlpha = 255;
@@ -140,26 +139,23 @@
}
public void applyFromApplicationInfo(ApplicationInfo info, PagedViewIconCache cache,
- boolean scaleUp) {
- mIconCache = cache;
- mIconCacheKey = info;
- mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
-
+ boolean scaleUp, boolean createHolographicOutlines) {
mIcon = info.iconBitmap;
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
setText(info.title);
buildAndEnableCache();
setTag(info);
- queueHolographicOutlineCreation();
+ if (createHolographicOutlines) {
+ mIconCache = cache;
+ mIconCacheKey = new PagedViewIconCache.Key(info);
+ mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
+ queueHolographicOutlineCreation();
+ }
}
public void applyFromResolveInfo(ResolveInfo info, PackageManager packageManager,
- PagedViewIconCache cache, IconCache modelIconCache) {
- mIconCache = cache;
- mIconCacheKey = info;
- mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
-
+ PagedViewIconCache cache, IconCache modelIconCache, boolean createHolographicOutlines) {
mIcon = Utilities.createIconBitmap(
modelIconCache.getFullResIcon(info, packageManager), mContext);
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
@@ -167,7 +163,12 @@
buildAndEnableCache();
setTag(info);
- queueHolographicOutlineCreation();
+ if (createHolographicOutlines) {
+ mIconCache = cache;
+ mIconCacheKey = new PagedViewIconCache.Key(info);
+ mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
+ queueHolographicOutlineCreation();
+ }
}
@Override