Skip to content

Instantly share code, notes, and snippets.

@checko
Created July 20, 2012 06:40
Show Gist options
  • Save checko/3149081 to your computer and use it in GitHub Desktop.
Save checko/3149081 to your computer and use it in GitHub Desktop.
case JS_CONFIRM:
if (mWebChromeClient != null) {
final JsResult res = (JsResult) msg.obj;
String message = msg.getData().getString("message");
String url = msg.getData().getString("url");
if (!mWebChromeClient.onJsConfirm(mWebView, url, message,
res)) {
new AlertDialog.Builder(mContext)
.setTitle(getJsDialogTitle(url))
.setMessage(message)
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
res.confirm();
}})
.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
res.cancel();
}})
.setOnCancelListener(
new DialogInterface.OnCancelListener() {
public void onCancel(
DialogInterface dialog) {
res.cancel();
}
})
.show();
}
// Tell the JsResult that it is ready for client
// interaction.
res.setReady();
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment