当我将我的项目从cordova 3更新到cordova 6时,我发现没有WebChromeClient,但是我的项目使用了这个类并覆盖了onJsPrompt()。现在,我应该如何基于 Cordova 6 覆盖 OnJsPrompt()
package com.qtby.gxwlc;
import org.apache.cordova.CordovaChromeClient;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import com.jsdemo.ClientTool;
import com.jsdemo.JsNativeFunc;
import android.content.Intent;
import android.webkit.JsPromptResult;
import android.webkit.WebView;
public class CustomerWebChromeClient extends CordovaChromeClient {
public CustomerWebChromeClient(CordovaInterface ctx, CordovaWebView app){
super(ctx, app);
}
JsNativeFunc jsNativeFunc;
public JsNativeFunc getJsNativeFunc(){
return jsNativeFunc;
}
public boolean isJsNativeFunc(int requestCode){
if(jsNativeFunc == null)
return false;
return jsNativeFunc.isJsNativeFunc(requestCode);
}
public void jsResult(int requestCode, int resultCode,
Intent intent){
jsNativeFunc.jsResult(requestCode, resultCode, intent);
}
@Override
public boolean onJsPrompt(WebView view, String origin, String message,
String defaultValue, JsPromptResult result) {
if(ClientTool.callNativeFunc(message)){
return super.onJsPrompt(view, origin, message, defaultValue, result);
}
return true;
}
return super.onJsPrompt(view, origin, message, defaultValue, result);
}
}