本文整理汇总了Java中android.webkit.JsResult类的典型用法代码示例。如果您正苦于以下问题:Java JsResult类的具体用法?Java JsResult怎么用?Java JsResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsResult类属于android.webkit包,在下文中一共展示了JsResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
new AlertDialog.Builder(view.getContext())
.setCancelable(false)
.setMessage(message)
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.confirm();
dialog.dismiss();
}
})
.create()
.show();
return true;
}
示例2: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(final WebView view, final String url, final String message, final JsResult result)
{
new AlertDialog.Builder(m_activity)
.setTitle("Alert")
.setMessage(message)
.setPositiveButton(android.R.string.ok,
new AlertDialog.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
result.confirm();
}
})
.setCancelable(false)
.create()
.show();
return true;
}
示例3: onJsConfirm
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
LogUtils.i(TAG, "onJsConfirm:" + message);
if (AgentWebUtils.isOverriedMethod(mWebChromeClient, "onJsConfirm", "public boolean " + ChromePath + ".onJsConfirm", WebView.class, String.class, String.class, JsResult.class)) {
return super.onJsConfirm(view, url, message, result);
}
LogUtils.i(TAG, "mAgentWebUiController:" + mAgentWebUiController.get());
if (mAgentWebUiController.get() != null) {
mAgentWebUiController.get().onJsConfirm(view, url, message, result);
}
// showJsConfirm(message, result);
return true;
}
示例4: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result)
{
return onMyJsAlert(WEBViewImpl.toWEBView(view), url, message, new MyJsResult()
{
@Override
public void cancel()
{
result.cancel();
}
@Override
public void confirm()
{
result.confirm();
}
});
}
示例5: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(WebView view, String url, String message,
final JsResult result) {
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
dlg.setMessage(message);
dlg.setTitle("提示");
// dlg.setTitle(null);
dlg.setCancelable(false);
dlg.setPositiveButton(android.R.string.ok,
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
result.confirm();
}
});
dlg.create();
dlg.show();
return true;
}
示例6: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
/**
* Tell the client to display a javascript alert dialog.
*/
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
dialogsHelper.showAlert(message, new CordovaDialogsHelper.Result() {
@Override public void gotResult(boolean success, String value) {
if (success) {
result.confirm();
} else {
result.cancel();
}
}
});
return true;
}
示例7: onJsConfirm
import android.webkit.JsResult; //导入依赖的package包/类
/**
* Tell the client to display a confirm dialog to the user.
*/
@Override
public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) {
dialogsHelper.showConfirm(message, new CordovaDialogsHelper.Result() {
@Override
public void gotResult(boolean success, String value) {
if (success) {
result.confirm();
} else {
result.cancel();
}
}
});
return true;
}
示例8: setupWebView
import android.webkit.JsResult; //导入依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void setupWebView() {
progressBar.spin();
final WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webSettings.setDomStorageEnabled(true);
webSettings.setGeolocationEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
mWebView.getSettings().setBlockNetworkImage(true);
mWebView.setWebViewClient(webViewClient);
mWebView.requestFocus(View.FOCUS_DOWN);
mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog.Builder b2 = new AlertDialog
.Builder(BrowserActivity.this)
.setTitle(R.string.app_name)
.setMessage(message)
.setPositiveButton("确定", (dialog, which) -> result.confirm());
b2.setCancelable(false);
b2.create();
b2.show();
return true;
}
});
mWebView.loadUrl(url);
}
示例9: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
new ThemeColorMaterialDialogBuilder(getContext())
.title(R.string.text_alert)
.content(message)
.onPositive((dialog, which) -> result.confirm())
.cancelListener(dialog -> result.cancel())
.positiveText(R.string.ok)
.show();
return true;
}
示例10: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(
WebView view,
String url,
String message,
JsResult result)
{
// Display alert as a Toast.
Toast.makeText(
view.getContext(),
message,
Toast.LENGTH_SHORT).show();
result.confirm();
return true;
}
示例11: showAlert
import android.webkit.JsResult; //导入依赖的package包/类
private void showAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle("")
.setMessage(message)
.setPositiveButton(getString(R.string.confirm), (dialog, which) -> {
result.confirm();
dialog.dismiss();
}).setOnCancelListener(dialog -> result.cancel());
builder.show();
}
示例12: JsAlert
import android.webkit.JsResult; //导入依赖的package包/类
protected void JsAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog.Builder builderAlert = new AlertDialog.Builder(BaseWebActivity.this)
.setTitle("")
.setMessage(message)
.setPositiveButton("ok", new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
result.confirm();
}
});
builderAlert.setCancelable(false);
builderAlert.create();
builderAlert.show();
}
示例13: onJsAlert
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
if (originalWebChromeClient != null) {
return originalWebChromeClient.onJsAlert(view, url, message, result);
} else {
return super.onJsAlert(view, url, message, result);
}
}
示例14: onJsBeforeUnload
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsBeforeUnload(WebView view, String url, String message, JsResult result) {
if (originalWebChromeClient.onJsBeforeUnload(view, url, message, result)) {
return originalWebChromeClient.onJsBeforeUnload(view, url, message, result);
} else {
return super.onJsBeforeUnload(view, url, message, result);
}
}
示例15: onJsConfirm
import android.webkit.JsResult; //导入依赖的package包/类
@Override
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
if (originalWebChromeClient != null) {
return originalWebChromeClient.onJsConfirm(view, url, message, result);
} else {
return super.onJsConfirm(view, url, message, result);
}
}