Showing
1 changed file
with
15 additions
and
0 deletions
... | @@ -128,6 +128,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -128,6 +128,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
128 | private Activity WarpActivity; | 128 | private Activity WarpActivity; |
129 | private String geolocationOrigin = ""; | 129 | private String geolocationOrigin = ""; |
130 | private Callback geolocationCallback; | 130 | private Callback geolocationCallback; |
131 | + private static boolean mWebviewLoaded = false; | ||
131 | 132 | ||
132 | // =========================================================== | 133 | // =========================================================== |
133 | // Constructors | 134 | // Constructors |
... | @@ -146,6 +147,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -146,6 +147,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
146 | super(context, null); | 147 | super(context, null); |
147 | ProcessLifecycleOwner.get().getLifecycle().addObserver(this); | 148 | ProcessLifecycleOwner.get().getLifecycle().addObserver(this); |
148 | WarpActivity = activity; | 149 | WarpActivity = activity; |
150 | + mWebviewLoaded = false; | ||
149 | init(); | 151 | init(); |
150 | } | 152 | } |
151 | 153 | ||
... | @@ -416,6 +418,13 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -416,6 +418,13 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
416 | DefaultLifecycleObserver.super.onStart(owner); | 418 | DefaultLifecycleObserver.super.onStart(owner); |
417 | if (!EventBus.getDefault().isRegistered(this)) | 419 | if (!EventBus.getDefault().isRegistered(this)) |
418 | EventBus.getDefault().register(this); | 420 | EventBus.getDefault().register(this); |
421 | + | ||
422 | + if (mWebviewLoaded) { | ||
423 | + String scriptSourceInit = "webviewDidFocus(true);"; | ||
424 | + WarpView.this.evaluateJavascript(scriptSourceInit, s -> { | ||
425 | + | ||
426 | + }); | ||
427 | + } | ||
419 | } | 428 | } |
420 | 429 | ||
421 | @Override | 430 | @Override |
... | @@ -771,6 +780,12 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { | ... | @@ -771,6 +780,12 @@ public class WarpView extends WebView implements DefaultLifecycleObserver { |
771 | 780 | ||
772 | @Override | 781 | @Override |
773 | public void onPageFinished(WebView view, String url) { | 782 | public void onPageFinished(WebView view, String url) { |
783 | + mWebviewLoaded = true; | ||
784 | + String scriptSourceInit = "webviewDidFocus(true);"; | ||
785 | + view.evaluateJavascript(scriptSourceInit, s -> { | ||
786 | + | ||
787 | + }); | ||
788 | + | ||
774 | String scriptSource = "passParams(" + WarpUtils.getWebviewParams(getContext()) + ");"; | 789 | String scriptSource = "passParams(" + WarpUtils.getWebviewParams(getContext()) + ");"; |
775 | view.evaluateJavascript(scriptSource, s -> { | 790 | view.evaluateJavascript(scriptSource, s -> { |
776 | 791 | ... | ... |
-
Please register or login to post a comment