Fixing issue where holographic icons could get out of sync in AllApps (when number of pages changes).
Change-Id: I1a63d4837c5b726a90229430f5fc698aa1db5550
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index d9a503f..c812a46 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -517,6 +517,7 @@
if (!mFilteredApps.isEmpty()) {
int curNumPageItems = layout.getPageChildCount();
int numPageItems = endIndex - startIndex;
+ boolean createHolographicOutlines = (numPages > 1);
// If we were previously an empty page, then restart anew
boolean wasEmptyPage = false;
@@ -541,7 +542,6 @@
// Add any necessary items
for (int i = curNumPageItems; i < numPageItems; ++i) {
- final boolean createHolographicOutlines = (numPages > 1);
TextView text = (TextView) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false);
text.setOnClickListener(this);
@@ -549,14 +549,13 @@
text.setOnTouchListener(this);
layout.addViewToCellLayout(text, -1, i,
- new PagedViewCellLayout.LayoutParams(0, 0, 1, 1), createHolographicOutlines);
+ new PagedViewCellLayout.LayoutParams(0, 0, 1, 1));
}
// Actually reapply to the existing text views
for (int i = startIndex; i < endIndex; ++i) {
final int index = i - startIndex;
final ApplicationInfo info = mFilteredApps.get(i);
- final boolean createHolographicOutlines = (numPages > 1);
PagedViewIcon icon = (PagedViewIcon) layout.getChildOnPageAt(index);
icon.applyFromApplicationInfo(
info, mPageViewIconCache, true, createHolographicOutlines);
@@ -567,6 +566,9 @@
params.cellY = index / mCellCountX;
}
+ // We should try and sync all the holographic icons after adding/removing new items
+ layout.reloadHolographicIcons(createHolographicOutlines);
+
// Default to left-aligned icons
layout.enableCenteredContent(false);
} else {
@@ -585,7 +587,7 @@
layout.enableCenteredContent(true);
layout.removeAllViewsOnPage();
layout.addViewToCellLayout(icon, -1, 0,
- new PagedViewCellLayout.LayoutParams(0, 0, 4, 1), createHolographicOutlines);
+ new PagedViewCellLayout.LayoutParams(0, 0, 4, 1));
}
layout.createHardwareLayers();
}