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

Commit 3ee06efe authored by Marcin Kosiba's avatar Marcin Kosiba
Browse files

Add a WebView.zoomBy API.

The WebView has zoomIn/zoomOut APIs which zoom in/out by a fixed
amount. This adds a more flexible API.

BUG: 13399510
Change-Id: Ia505048d5b1c48f9a3ff1c4ce7129ed2f55804f8
parent d1d2d43f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36700,6 +36700,7 @@ package android.webkit {
    method public void setWebViewClient(android.webkit.WebViewClient);
    method public deprecated boolean showFindDialog(java.lang.String, boolean);
    method public void stopLoading();
    method public boolean zoomBy(float);
    method public boolean zoomIn();
    method public boolean zoomOut();
    field public static final java.lang.String SCHEME_GEO = "geo:0,0?q=";
+17 −0
Original line number Diff line number Diff line
@@ -1944,6 +1944,23 @@ public class WebView extends AbsoluteLayout
        return mProvider.canZoomOut();
    }

    /**
     * Performs a zoom operation in this WebView.
     *
     * @param zoomFactor the zoom factor to apply. The zoom factor will be clamped to the Webview's
     * zoom limits. This value must be in the range 0.01 to 100.0 inclusive.
     *
     * @return false if no zoom changes, true otherwise.
     */
    public boolean zoomBy(float zoomFactor) {
        checkThread();
        if (zoomFactor < 0.01)
            throw new IllegalArgumentException("zoomFactor must be greater than 0.01.");
        if (zoomFactor > 100.0)
            throw new IllegalArgumentException("zoomFactor must be less than 100.");
        return mProvider.zoomBy(zoomFactor);
    }

    /**
     * Performs zoom in in this WebView.
     *
+2 −0
Original line number Diff line number Diff line
@@ -238,6 +238,8 @@ public interface WebViewProvider {

    public boolean canZoomOut();

    public boolean zoomBy(float zoomFactor);

    public boolean zoomIn();

    public boolean zoomOut();