mirror of
https://github.com/status-im/react-native-webview-bridge.git
synced 2026-08-31 13:21:15 +00:00
attempt to improve onProgressChanged
This commit is contained in:
+3
-13
@@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Picture;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
@@ -89,22 +90,11 @@ public class WebViewBridgeManager extends ReactWebViewManager {
|
||||
|
||||
protected static class ReactWebChromeClient extends WebChromeClient {
|
||||
|
||||
private boolean was = false;
|
||||
private int last = 100;
|
||||
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
if (newProgress < 90) {
|
||||
if(was == false || last < newProgress){
|
||||
was = true;
|
||||
last = newProgress;
|
||||
((ReactWebView) view).callInjectedOnStartLoadingJavaScript();
|
||||
}
|
||||
} else {
|
||||
was = false;
|
||||
last = 100;
|
||||
if (newProgress < 80) {
|
||||
((ReactWebView) view).callInjectedOnStartLoadingJavaScript();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user