return mLinearLayout.getWidth() - getWidth();
}
+ private void addToRecycledViews(View v) {
+ if (mRecycledViews.size() < mNumItemsInOneScreenful) {
+ mRecycledViews.add(v);
+ }
+ }
+
private void update() {
for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
View v = mLinearLayout.getChildAt(i);
- mRecycledViews.add(v);
+ addToRecycledViews(v);
mAdapter.recycleView(v);
}
LayoutTransition transitioner = getLayoutTransition();
}
public void onChildDismissed(View v) {
- mRecycledViews.add(v);
+ addToRecycledViews(v);
mLinearLayout.removeView(v);
if (v.getParent() != null) {
throw new RuntimeException("Recycled child has parent");
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
mNumItemsInOneScreenful =
(int) FloatMath.ceil(dm.widthPixels / (float) child.getMeasuredWidth());
- mRecycledViews.add(child);
+ addToRecycledViews(child);
if (child.getParent() != null) {
throw new RuntimeException("First recycled child has parent");
}
for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
- mRecycledViews.add(mAdapter.createView(mLinearLayout));
+ addToRecycledViews(mAdapter.createView(mLinearLayout));
if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) {
throw new RuntimeException("Recycled child has parent");
}
public void addViewCallback(View newLinearLayoutChild) {
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
- final View view = newLinearLayoutChild;
- view.setDrawingCacheEnabled(true);
- view.buildDrawingCache();
+ final RecentsPanelView.ViewHolder holder =
+ (RecentsPanelView.ViewHolder) newLinearLayoutChild.getTag();
+ holder.labelView.setDrawingCacheEnabled(true);
+ holder.labelView.buildDrawingCache();
}
}
return mLinearLayout.getHeight() - getHeight();
}
+ private void addToRecycledViews(View v) {
+ if (mRecycledViews.size() < mNumItemsInOneScreenful) {
+ mRecycledViews.add(v);
+ }
+ }
+
private void update() {
for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
View v = mLinearLayout.getChildAt(i);
- mRecycledViews.add(v);
+ addToRecycledViews(v);
mAdapter.recycleView(v);
}
LayoutTransition transitioner = getLayoutTransition();
}
public void onChildDismissed(View v) {
- mRecycledViews.add(v);
+ addToRecycledViews(v);
mLinearLayout.removeView(v);
if (v.getParent() != null) {
throw new RuntimeException("Recycled child has parent");
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
mNumItemsInOneScreenful =
(int) FloatMath.ceil(dm.heightPixels / (float) child.getMeasuredHeight());
- mRecycledViews.add(child);
+ addToRecycledViews(child);
if (child.getParent() != null) {
throw new RuntimeException("First recycled child has parent");
}
for (int i = 0; i < mNumItemsInOneScreenful - 1; i++) {
- mRecycledViews.add(mAdapter.createView(mLinearLayout));
+ addToRecycledViews(mAdapter.createView(mLinearLayout));
if (mRecycledViews.get(mRecycledViews.size() - 1).getParent() != null) {
throw new RuntimeException("Recycled child has parent");
}