Merge "Fixing a couple StackView bugs:" into honeycomb

This commit is contained in:
Adam Cohen
2011-01-21 18:12:15 -08:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 2 deletions

View File

@@ -695,6 +695,8 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
if (mWhichChild >= getWindowSize()) { if (mWhichChild >= getWindowSize()) {
mWhichChild = 0; mWhichChild = 0;
showOnly(mWhichChild, true);
} else if (mOldItemCount != getCount()) {
showOnly(mWhichChild, true); showOnly(mWhichChild, true);
} }
refreshChildren(); refreshChildren();

View File

@@ -454,10 +454,14 @@ public class StackView extends AdapterViewAnimator {
canvas.getClipBounds(stackInvalidateRect); canvas.getClipBounds(stackInvalidateRect);
final int childCount = getChildCount(); final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
LayoutParams lp = (LayoutParams) getChildAt(i).getLayoutParams(); final View child = getChildAt(i);
stackInvalidateRect.union(lp.getInvalidateRect()); LayoutParams lp = (LayoutParams) child.getLayoutParams();
if ((lp.horizontalOffset == 0 && lp.verticalOffset == 0) ||
child.getAlpha() == 0f || child.getVisibility() != VISIBLE) {
lp.resetInvalidateRect(); lp.resetInvalidateRect();
} }
stackInvalidateRect.union(lp.getInvalidateRect());
}
canvas.save(Canvas.CLIP_SAVE_FLAG); canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(stackInvalidateRect, Region.Op.UNION); canvas.clipRect(stackInvalidateRect, Region.Op.UNION);
super.dispatchDraw(canvas); super.dispatchDraw(canvas);