Java Code Examples for android.webkit.JsResult#confirm()

The following examples show how to use android.webkit.JsResult#confirm() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FolioPageFragment.java    From ankihelper with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {

    // This if block can be dropped
    if (!FolioPageFragment.this.isVisible())
        return true;

    if (TextUtils.isDigitsOnly(message)) {
        try {
            mTotalMinutes = Integer.parseInt(message);
        } catch (NumberFormatException e) {
            mTotalMinutes = 0;
        }
    } else {
        // to handle TTS playback when highlight is deleted.
        Pattern p = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}");
        if (!p.matcher(message).matches() && (!message.equals("undefined")) && isCurrentFragment()) {
            mediaController.speakAudio(message);
        }
    }

    result.confirm();
    return true;
}
 
Example 2
Source File: CBrowserMainFrame.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
    if (!((EBrowserActivity) view.getContext()).isVisable()) {
        result.confirm();
    }
    AlertDialog.Builder dia = new AlertDialog.Builder(view.getContext());
    dia.setTitle(EUExUtil.getResStringID("prompt"));
    dia.setMessage(message);
    dia.setCancelable(false);
    dia.setPositiveButton(EUExUtil.getResStringID("confirm"), new OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            result.confirm();
        }
    });
    dia.create();
    dia.show();
    return true;
}
 
Example 3
Source File: DefaultChromeClient.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
	if (mAgentWebUIController.get() != null) {
		mAgentWebUIController.get().onJsAlert(view, url, message);
	}
	result.confirm();
	return true;
}
 
Example 4
Source File: BaseWebActivity.java    From MarkdownEditors with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
    AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
    builder.setTitle("注意").setMessage(message).setPositiveButton("确定", null);
    builder.setCancelable(false);
    AlertDialog dialog = builder.create();
    dialog.show();
    result.confirm();
    return true;
}
 
Example 5
Source File: VideoChromeClient.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message,
                         JsResult result) {
    Clog.v(Clog.jsLogTag,
            Clog.getString(R.string.js_alert, message, url));
    result.confirm();
    return true;
}
 
Example 6
Source File: BaseWebChromeClient.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message,
                         JsResult result) {
    Clog.v(Clog.jsLogTag,
            Clog.getString(com.appnexus.opensdk.R.string.js_alert, message, url));
    result.confirm();
    return true;
}
 
Example 7
Source File: c.java    From letv with Apache License 2.0 4 votes vote down vote up
public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
    jsResult.confirm();
    return true;
}
 
Example 8
Source File: NoteDetailsActivity.java    From DevHeadLine with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
    result.confirm();
    ToastUtils.toast(message);
    return true;
}
 
Example 9
Source File: NoteDetailsActivity.java    From DevHeadLine with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
    result.confirm();
    return super.onJsConfirm(view, url, message, result);
}
 
Example 10
Source File: SafeWebChromeClient.java    From JianshuApp with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
    result.confirm();
    return true;
}
 
Example 11
Source File: WebFragment.java    From Android_framework with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
    T.getInstance().showShort(message);
    result.confirm();
    return true;
}
 
Example 12
Source File: RetroWebView.java    From retrowatch with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
	Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
	result.confirm();
	return true;
}