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

Commit 3331f2be authored by Mindy Pereira's avatar Mindy Pereira
Browse files

Make webview edges behave the same way abslistview overscroll edges do.

The assets are not scaled to start before the left or after the
right edge of the view.
For the top edge, start the canvas for rendering the glow
after the title bar (if it is visible) or most of the glow
gets cut off.
Change-Id: Ia1a513fda4d1106d671919bb289aa83f8800c2c2
parent efd804b0
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -168,18 +168,18 @@ public class OverScrollGlow {
        if (!mEdgeGlowTop.isFinished()) {
            final int restoreCount = canvas.save();

            canvas.translate(-width / 2 + scrollX, Math.min(0, scrollY));
            mEdgeGlowTop.setSize(width * 2, height);
            canvas.translate(scrollX, mHostView.getVisibleTitleHeight() + Math.min(0, scrollY));
            mEdgeGlowTop.setSize(width, height);
            invalidateForGlow |= mEdgeGlowTop.draw(canvas);
            canvas.restoreToCount(restoreCount);
        }
        if (!mEdgeGlowBottom.isFinished()) {
            final int restoreCount = canvas.save();

            canvas.translate(-width / 2 + scrollX,
                    Math.max(mHostView.computeMaxScrollY(), scrollY) + height);
            canvas.translate(-width + scrollX, Math.max(mHostView.computeMaxScrollY(), scrollY)
                    + height);
            canvas.rotate(180, width, 0);
            mEdgeGlowBottom.setSize(width * 2, height);
            mEdgeGlowBottom.setSize(width, height);
            invalidateForGlow |= mEdgeGlowBottom.draw(canvas);
            canvas.restoreToCount(restoreCount);
        }
@@ -187,8 +187,8 @@ public class OverScrollGlow {
            final int restoreCount = canvas.save();

            canvas.rotate(270);
            canvas.translate(-height * 1.5f - scrollY, Math.min(0, scrollX));
            mEdgeGlowLeft.setSize(height * 2, width);
            canvas.translate(-height - scrollY, Math.min(0, scrollX));
            mEdgeGlowLeft.setSize(height, width);
            invalidateForGlow |= mEdgeGlowLeft.draw(canvas);
            canvas.restoreToCount(restoreCount);
        }
@@ -196,9 +196,9 @@ public class OverScrollGlow {
            final int restoreCount = canvas.save();

            canvas.rotate(90);
            canvas.translate(-height / 2 + scrollY,
            canvas.translate(scrollY,
                    -(Math.max(mHostView.computeMaxScrollX(), scrollX) + width));
            mEdgeGlowRight.setSize(height * 2, width);
            mEdgeGlowRight.setSize(height, width);
            invalidateForGlow |= mEdgeGlowRight.draw(canvas);
            canvas.restoreToCount(restoreCount);
        }
+3 −0
Original line number Diff line number Diff line
@@ -3553,6 +3553,9 @@ public class WebView extends AbsoluteLayout
            // When drawing the title bar, move it horizontally to always show
            // at the top of the WebView.
            mTitleBar.offsetLeftAndRight(mScrollX - mTitleBar.getLeft());
            int newTop = Math.min(0, mScrollY);
            mTitleBar.setBottom(newTop + getTitleHeight());
            mTitleBar.setTop(newTop);
        }
        return super.drawChild(canvas, child, drawingTime);
    }