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

Commit 9be22455 authored by Adam Powell's avatar Adam Powell
Browse files

Fix EdgeEffect clipping and AbsListView's use of it

Make sure that we clip the edge glow against the edges of the view and
not against padding. If we're clipping to padding already, this will
happen automatically.

Bug 15020863

Change-Id: I4645c92f2a372d3c9fa8bb5a9fda44c0d82ac4cf
parent 94236c56
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -4028,12 +4028,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            final int scrollY = mScrollY;
            if (!mEdgeGlowTop.isFinished()) {
                final int restoreCount = canvas.save();
                final int leftPadding = mListPadding.left + mGlowPaddingLeft;
                final int rightPadding = mListPadding.right + mGlowPaddingRight;
                final int width = getWidth() - leftPadding - rightPadding;
                final int width = getWidth();

                int edgeY = Math.min(0, scrollY + mFirstPositionDistanceGuess);
                canvas.translate(leftPadding, edgeY);
                canvas.translate(0, edgeY);
                mEdgeGlowTop.setSize(width, getHeight());
                if (mEdgeGlowTop.draw(canvas)) {
                    invalidate(0, 0, getWidth(),
@@ -4043,12 +4041,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            }
            if (!mEdgeGlowBottom.isFinished()) {
                final int restoreCount = canvas.save();
                final int leftPadding = mListPadding.left + mGlowPaddingLeft;
                final int rightPadding = mListPadding.right + mGlowPaddingRight;
                final int width = getWidth() - leftPadding - rightPadding;
                final int width = getWidth();
                final int height = getHeight();

                int edgeX = -width + leftPadding;
                int edgeX = -width;
                int edgeY = Math.max(height, scrollY + mLastPositionDistanceGuess);
                canvas.translate(edgeX, edgeY);
                canvas.rotate(180, width, 0);
+1 −2
Original line number Diff line number Diff line
@@ -312,8 +312,7 @@ public class EdgeEffect {
        final float displacement = Math.max(0, Math.min(mDisplacement, 1.f)) - 0.5f;
        float translateX = mBounds.width() * displacement / 2;

        canvas.clipRect(Float.MIN_VALUE, mBounds.top,
                Float.MAX_VALUE, Float.MAX_VALUE);
        canvas.clipRect(mBounds);
        canvas.translate(translateX, 0);
        canvas.drawArc(mArcRect, 45, 90, true, mPaint);
        canvas.restoreToCount(count);