Skip to content

Replacing LoadingFinishedCallback with custom WebViewClient#8

Merged
fangj merged 3 commits into
fangj:masterfrom
sohayb:master
Jan 3, 2017
Merged

Replacing LoadingFinishedCallback with custom WebViewClient#8
fangj merged 3 commits into
fangj:masterfrom
sohayb:master

Conversation

@sohayb

@sohayb sohayb commented Sep 29, 2015

Copy link
Copy Markdown

In order to give more control over the page loading, replaced the load finishing callback with a WebViewCallback to access more convenience methods.

Create a convenience interface for injecting data(initialising WebView with pre-fetched data) when the page loads completely to avoid adding another WebViewClient.
Example:
````java
        bridge.setLoadFinishedCallback(new WebViewJavascriptBridge.LoadFinishedCallback() {
            @OverRide
            public void onLoadFinished() {
                bridge.send("Test data to send", new WebViewJavascriptBridge.WVJBResponseCallback() {
                    @OverRide
                    public void callback(String data) {
                        Log.d("test", "Got response! " + data);
                    }
                });
            }
        });
````
Update WebViewJavascriptBridge.java
@fangj fangj merged commit fd99414 into fangj:master Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants