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

Commit 15961365 authored by Grace Kloba's avatar Grace Kloba Committed by Android (Google) Code Review
Browse files

Merge "Add an api to set WebView over scroll background."

parents 7e93cde2 2d17e1d2
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -193450,6 +193450,17 @@
 visibility="public"
>
</method>
<method name="getUseSystemOverscrollBackground"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getUseWideViewPort"
 return="boolean"
 abstract="false"
@@ -194029,6 +194040,19 @@
<parameter name="use" type="boolean">
</parameter>
</method>
<method name="setUseSystemOverscrollBackground"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="system" type="boolean">
</parameter>
</method>
<method name="setUseWideViewPort"
 return="void"
 abstract="false"
+18 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ public class WebSettings {
    private boolean         mBuiltInZoomControls = false;
    private boolean         mAllowFileAccess = true;
    private boolean         mLoadWithOverviewMode = false;
    private boolean         mUseSystemOverscrollBackground = false;

    // private WebSettings, not accessible by the host activity
    static private int      mDoubleTapToastCount = 3;
@@ -469,6 +470,23 @@ public class WebSettings {
        return mLoadWithOverviewMode;
    }

    /**
     * Set whether the WebView uses system background for over scroll
     * background. If false, it will use the WebView's background. Default is
     * false.
     */
    public void setUseSystemOverscrollBackground(boolean system) {
        mUseSystemOverscrollBackground = system;
    }

    /**
     * Returns true if this WebView uses system background instead of WebView
     * background for over scroll background.
     */
    public boolean getUseSystemOverscrollBackground() {
        return mUseSystemOverscrollBackground;
    }

    /**
     * Store whether the WebView is saving form data.
     */
+7 −4
Original line number Diff line number Diff line
@@ -2305,9 +2305,11 @@ public class WebView extends AbsoluteLayout
            boolean clampedY) {
        mInOverScrollMode = false;
        int maxX = computeMaxScrollX();
        if (Math.abs(mMinZoomScale - mMaxZoomScale) < 0.01f && maxX == 0) {
            // do not over scroll x if the page can't be zoomed and it just fits
            // the screen
        if (maxX == 0 && (Math.abs(mMinZoomScale - mMaxZoomScale) < 0.01f)
                || !getSettings().supportZoom()
                || !getSettings().getUseWideViewPort()) {
            // do not over scroll x if the page just fits the screen and it
            // can't zoom or the view doesn't use wide viewport
            scrollX = pinLocX(scrollX);
        } else if (scrollX < 0 || scrollX > maxX) {
            mInOverScrollMode = true;
@@ -3112,7 +3114,8 @@ public class WebView extends AbsoluteLayout
        }

        int saveCount = canvas.save();
        if (mInOverScrollMode) {
        if (mInOverScrollMode
                && getSettings().getUseSystemOverscrollBackground()) {
            if (mOverScrollBackground == null) {
                mOverScrollBackground = new Paint();
                Bitmap bm = BitmapFactory.decodeResource(