Ensure that we have a reasonable cache size for AllApps.

Change-Id: Ic0cb5ec2911567102227748cd9d2c1d8297fe105
This commit is contained in:
Winson Chung
2015-05-15 16:30:08 -07:00
parent 32f14071cc
commit da25da3d55
@@ -128,6 +128,14 @@ public class AppsContainerRecyclerView extends BaseContainerRecyclerView {
public void setNumAppsPerRow(int numAppsPerRow, int numPredictedAppsPerRow) {
mNumAppsPerRow = numAppsPerRow;
mNumPredictedAppsPerRow = numPredictedAppsPerRow;
DeviceProfile grid = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile();
RecyclerView.RecycledViewPool pool = getRecycledViewPool();
int approxRows = (int) Math.ceil(grid.availableHeightPx / grid.allAppsIconSizePx);
pool.setMaxRecycledViews(AppsGridAdapter.PREDICTION_BAR_SPACER_TYPE, 1);
pool.setMaxRecycledViews(AppsGridAdapter.EMPTY_VIEW_TYPE, 1);
pool.setMaxRecycledViews(AppsGridAdapter.ICON_VIEW_TYPE, approxRows * mNumAppsPerRow);
pool.setMaxRecycledViews(AppsGridAdapter.SECTION_BREAK_VIEW_TYPE, approxRows);
}
public void updateBackgroundPadding(Drawable background) {