android.webkit.JsResult Java Examples
The following examples show how to use
android.webkit.JsResult.
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: PowerfulWebView.java From ProjectX with Apache License 2.0 | 6 votes |
@Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { if (!(view instanceof PowerfulWebView)) return super.onJsAlert(view, url, message, result); final ArrayList<JavascriptInterfaceHelper> helpers = ((PowerfulWebView) view).mHelpers; if (helpers.isEmpty()) return super.onJsAlert(view, url, message, result); boolean response = false; for (JavascriptInterfaceHelper helper : helpers) { if (helper.getSupportType() == JavascriptInterfaceHelper.SUPPORT_TYPE_COMPAT) { response = true; helper.onReceiveValue(message); } } if (response) { result.cancel(); return true; } return super.onJsAlert(view, url, message, result); }
Example #2
Source File: CBrowserMainFrame.java From appcan-android with GNU Lesser General Public License v3.0 | 6 votes |
@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: MainActivity.java From SimplicityBrowser with MIT License | 6 votes |
@Override public boolean onJsConfirm(WebView view, final String url, final String message, final JsResult result) { if (!isDestroyed()) { AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this); builder1.setTitle(R.string.app_name); builder1.setMessage(message); builder1.setCancelable(true); builder1.setPositiveButton(R.string.ok, (dialog, id) -> { result.confirm(); dialog.dismiss(); }); builder1.setNegativeButton(R.string.cancel, (dialog, id) -> { result.cancel(); dialog.dismiss(); }); AlertDialog alert11 = builder1.create(); alert11.show(); } return true; }
Example #4
Source File: BridgeWebChromeClient.java From OsmGo with MIT License | 6 votes |
/** * Show the browser confirm modal * @param view * @param url * @param message * @param result * @return */ @Override public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) { if (bridge.getActivity().isFinishing()) { return true; } Dialogs.confirm(view.getContext(), message, new Dialogs.OnResultListener() { @Override public void onResult(boolean value, boolean didCancel, String inputValue) { if(value) { result.confirm(); } else { result.cancel(); } } }); return true; }
Example #5
Source File: PrivateActivity.java From SimplicityBrowser with MIT License | 6 votes |
@Override public boolean onJsConfirm(WebView view, final String url, final String message, final JsResult result) { if (!isDestroyed()) { AlertDialog.Builder builder1 = new AlertDialog.Builder(PrivateActivity.this); builder1.setTitle(R.string.app_name); builder1.setMessage(message); builder1.setCancelable(true); builder1.setPositiveButton(R.string.ok, (dialog, id) -> { result.confirm(); dialog.dismiss(); }); builder1.setNegativeButton(R.string.cancel, (dialog, id) -> { result.cancel(); dialog.dismiss(); }); AlertDialog alert11 = builder1.create(); alert11.show(); } return true; }
Example #6
Source File: FolioPageFragment.java From ankihelper with GNU General Public License v3.0 | 6 votes |
@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 #7
Source File: BridgeWebChromeClient.java From OsmGo with MIT License | 6 votes |
/** * Show the browser alert modal * @param view * @param url * @param message * @param result * @return */ @Override public boolean onJsAlert(WebView view, String url, String message, final JsResult result) { if (bridge.getActivity().isFinishing()) { return true; } Dialogs.alert(view.getContext(), message, new Dialogs.OnResultListener() { @Override public void onResult(boolean value, boolean didCancel, String inputValue) { if(value) { result.confirm(); } else { result.cancel(); } } }); return true; }
Example #8
Source File: WebPlayerView.java From unity-ads-android with Apache License 2.0 | 6 votes |
@Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { Boolean returnValue = false; if (shouldCallSuper("onJsAlert")) { returnValue = super.onJsAlert(view, url, message, result); } if (shouldSendEvent("onJsAlert")) { WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.JS_ALERT, url, message, result, viewId); } if (hasReturnValue("onJsAlert")) { returnValue = getReturnValue("onJsAlert", java.lang.Boolean.class, true); } return returnValue; }
Example #9
Source File: SystemWebChromeClient.java From app-icon with MIT License | 5 votes |
/** * 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; }
Example #10
Source File: MyWebChromeClient.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
@Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { Log.e(TAG, "onJsAlert: url=" + url); Log.e(TAG, "onJsAlert: message=" + message); Log.e(TAG, "onJsAlert: result=" + result.toString()); return super.onJsAlert(view, url, message, result); }
Example #11
Source File: BaseWebActivity.java From MarkdownEditors with Apache License 2.0 | 5 votes |
@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 #12
Source File: ProxyWebChromeClient.java From robotium-extensions with Apache License 2.0 | 5 votes |
@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); } }
Example #13
Source File: ProxyWebChromeClient.java From robotium-extensions with Apache License 2.0 | 5 votes |
@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); } }
Example #14
Source File: SystemWebChromeClient.java From BigDataPlatform with GNU General Public License v3.0 | 5 votes |
/** * 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; }
Example #15
Source File: SystemWebChromeClient.java From keemob with MIT License | 5 votes |
/** * 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; }
Example #16
Source File: SystemWebChromeClient.java From keemob with MIT License | 5 votes |
/** * 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; }
Example #17
Source File: SystemWebChromeClient.java From keemob with MIT License | 5 votes |
/** * 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; }
Example #18
Source File: DialogWebChromeClient.java From MHViewer with Apache License 2.0 | 5 votes |
@Override public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { new AlertDialog.Builder(view.getContext()) .setMessage(message) .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> result.cancel()) .setOnCancelListener(dialog -> result.cancel()) .show(); return true; }
Example #19
Source File: SystemWebChromeClient.java From app-icon with MIT License | 5 votes |
/** * 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; }
Example #20
Source File: ProgressWebView.java From Android-Application-ZJB with Apache License 2.0 | 5 votes |
@Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { DialogHelper.create(DialogHelper.TYPE_NORMAL) .title(getResources().getString(R.string.web_title_default)) .content(message) .bottomButton(getResources().getString(R.string.sure), getResources().getColor(R.color.black_54)) .onDismissListener(dg -> result.confirm()) .bottomBtnClickListener((dialog, v) -> dialog.dismiss()).show(); return true; }
Example #21
Source File: SystemWebChromeClient.java From keemob with MIT License | 5 votes |
/** * 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; }
Example #22
Source File: MyWebChromeClient.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
@Override public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { Log.e(TAG, "onJsConfirm: url=" + url); Log.e(TAG, "onJsConfirm: message=" + message); Log.e(TAG, "onJsConfirm: result=" + result.toString()); return super.onJsConfirm(view, url, message, result); }
Example #23
Source File: WebViewActivity.java From mattermost-android-classic with Apache License 2.0 | 5 votes |
@Override public boolean onJsAlert(WebView view, String url, String message, final JsResult result) { String newTitle = getTitleFromUrl(url); new AlertDialog.Builder(WebViewActivity.this).setTitle(newTitle).setMessage(message).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { result.confirm(); } }).setCancelable(false).create().show(); return true; }
Example #24
Source File: DialogWebChromeClient.java From EhViewer with Apache License 2.0 | 5 votes |
@Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { new AlertDialog.Builder(view.getContext()) .setMessage(message) .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm()) .setOnCancelListener(dialog -> result.cancel()) .show(); return true; }
Example #25
Source File: DialogWebChromeClient.java From EhViewer with Apache License 2.0 | 5 votes |
@Override public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { new AlertDialog.Builder(view.getContext()) .setMessage(message) .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> result.cancel()) .setOnCancelListener(dialog -> result.cancel()) .show(); return true; }
Example #26
Source File: VideoChromeClient.java From mobile-sdk-android with Apache License 2.0 | 5 votes |
@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 #27
Source File: SystemWebChromeClient.java From a2cardboard with Apache License 2.0 | 5 votes |
/** * 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; }
Example #28
Source File: SystemWebChromeClient.java From cordova-plugin-app-update-demo with MIT License | 5 votes |
/** * 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; }
Example #29
Source File: BaseWebChromeClient.java From mobile-sdk-android with Apache License 2.0 | 5 votes |
@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 #30
Source File: EditorInfoActivity.java From LeisureRead with Apache License 2.0 | 5 votes |
@SuppressLint("SetJavaScriptEnabled") private void setUpWebView() { final WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); webSettings.setDomStorageEnabled(true); webSettings.setGeolocationEnabled(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(EditorInfoActivity.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); }