Commit e09c2819 by huangzhicong

现在webview页面加载完成后会调用onMaxrockyReady方法

parent 67c73370
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Maxrocky</title> <title>Maxrocky</title>
<script> <script>
function onMaxrockyReady() {
alert('onReady');
}
function cropPhoto(uri){ function cropPhoto(uri){
window.cropPhotoSuccess = function(uri, base64) { window.cropPhotoSuccess = function(uri, base64) {
document.getElementById('img').src = base64; document.getElementById('img').src = base64;
......
...@@ -72,6 +72,12 @@ class MainFragment : Fragment() { ...@@ -72,6 +72,12 @@ class MainFragment : Fragment() {
result: JsResult? result: JsResult?
): Boolean = false ): Boolean = false
} }
wv.webViewClient = object : WebViewClient() {
override fun onPageFinished(view: WebView?, url: String?) {
Log.d(TAG, "onPageFinished: $url")
view?.evaluateJavascript("javascript:onMaxrockyReady()", null)
}
}
wv.settings.apply { wv.settings.apply {
javaScriptEnabled = true javaScriptEnabled = true
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment