Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e86ff4d5 authored by Adam Cohen's avatar Adam Cohen
Browse files

Fixing a couple StackView bugs:

-> Making sure to update visuals every time adapter count changes
-> Fixing a clipping issue seen on some devices

Change-Id: I489395b5caaa06eb7187b2dac679b793bf54d7e1
parent ef17dd49
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -695,6 +695,8 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
                    if (mWhichChild >= getWindowSize()) {
                        mWhichChild = 0;

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